diff tests/test-convert-svn-source.t @ 17033:0413f68da85c

tests: cleanup of svn url handling The subversion tests used different tricks to create properly encoded URLs, partly due to partial support for different ways of running the tests on windows. Now we only need/support one way of running the tests on windows. Windows URLs should look like 'file:///c:/foo%20bar' and on Unix platforms like 'file:///tmp/baz'. 'pwd' in the test framework will on Windows emit paths like 'c:/foo bar'. Explicit handling of backslashes in paths is thus no longer needed and is removed. Paths on windows do however need an extra '/' compared to other platforms. This change makes test-subrepo-svn.t pass on windows with msys. Other tests might need more work.
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 26 Jun 2012 03:35:22 +0200
parents b12b65d2cbe4
children 3dd6da761fff
line wrap: on
line diff
--- a/tests/test-convert-svn-source.t	Sat Jun 23 19:54:08 2012 +0300
+++ b/tests/test-convert-svn-source.t	Tue Jun 26 03:35:22 2012 +0200
@@ -1,10 +1,6 @@
 
   $ "$TESTDIR/hghave" svn svn-bindings || exit 80
 
-  $ fixpath()
-  > {
-  >     tr '\\' /
-  > }
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
   > convert = 
@@ -14,14 +10,12 @@
   > EOF
 
   $ svnadmin create svn-repo
-  $ svnpath=`pwd | fixpath`
-
-
-  $ expr "$svnpath" : "\/" > /dev/null
-  > if [ $? -ne 0 ]; then
-  >   svnpath="/$svnpath"
-  > fi
-  > svnurl="file://$svnpath/svn-repo"
+  $ SVNREPOPATH=`pwd`/svn-repo
+#if windows
+  $ SVNREPOURL=file:///`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
+#else
+  $ SVNREPOURL=file://`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
+#endif
 
 Now test that it works with trunk/tags layout, but no branches yet.
 
@@ -33,8 +27,7 @@
   $ mkdir tags
   $ cd ..
 
-  $ svnurl="file://$svnpath/svn-repo/proj%20B"
-  $ svn import -m "init projB" projB "$svnurl" | fixpath | sort
+  $ svn import -m "init projB" projB "$SVNREPOURL/proj%20B" | sort
   
   Adding         projB/mytrunk
   Adding         projB/tags
@@ -42,7 +35,7 @@
 
 Update svn repository
 
-  $ svn co "$svnurl"/mytrunk B | fixpath
+  $ svn co "$SVNREPOURL/proj%20B/mytrunk" B
   Checked out revision 1.
   $ cd B
   $ echo hello > 'letter .txt'
@@ -59,7 +52,7 @@
   Transmitting file data .
   Committed revision 3.
 
-  $ svn copy -m "tag v0.1" "$svnurl"/mytrunk "$svnurl"/tags/v0.1
+  $ svn copy -m "tag v0.1" "$SVNREPOURL/proj%20B/mytrunk" "$SVNREPOURL/proj%20B/tags/v0.1"
   
   Committed revision 4.
 
@@ -72,7 +65,7 @@
 
 Convert to hg once
 
-  $ hg convert "$svnurl" B-hg
+  $ hg convert "$SVNREPOURL/proj%20B" B-hg
   initializing destination B-hg repository
   scanning source...
   sorting...
@@ -96,7 +89,7 @@
   Transmitting file data ..
   Committed revision 6.
 
-  $ svn copy -m "tag v0.2" "$svnurl"/mytrunk "$svnurl"/tags/v0.2
+  $ svn copy -m "tag v0.2" "$SVNREPOURL/proj%20B/mytrunk" "$SVNREPOURL/proj%20B/tags/v0.2"
   
   Committed revision 7.
 
@@ -107,7 +100,7 @@
   Committed revision 8.
   $ cd ..
 
-  $ hg convert -s svn "$svnurl/non-existent-path" dest
+  $ hg convert -s svn "$SVNREPOURL/proj%20B/non-existent-path" dest
   initializing destination dest repository
   abort: no revision found in module /proj B/non-existent-path
   [255]
@@ -116,7 +109,7 @@
 
 Test incremental conversion
 
-  $ hg convert "$svnurl" B-hg
+  $ hg convert "$SVNREPOURL/proj%20B" B-hg
   scanning source...
   sorting...
   converting...
@@ -150,7 +143,7 @@
 
 Test filemap
   $ echo 'include letter2.txt' > filemap
-  $ hg convert --filemap filemap "$svnurl"/mytrunk fmap
+  $ hg convert --filemap filemap "$SVNREPOURL/proj%20B/mytrunk" fmap
   initializing destination fmap repository
   scanning source...
   sorting...
@@ -170,7 +163,7 @@
   
 
 Test stop revision
-  $ hg convert --rev 1 "$svnurl"/mytrunk stoprev
+  $ hg convert --rev 1 "$SVNREPOURL/proj%20B/mytrunk" stoprev
   initializing destination stoprev repository
   scanning source...
   sorting...
@@ -200,7 +193,7 @@
   converting...
   1 init projA
   0 adddir
-  $ hg --config convert.svn.trunk= convert file://$svnpath/svn-empty/trunk
+  $ hg --config convert.svn.trunk= convert "$SVNREPOURL/../svn-empty/trunk"
   assuming destination trunk-hg
   initializing destination trunk-hg repository
   scanning source...