Mercurial > hg
comparison tests/test-convert-hg-svn.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 | 9a0528fd9172 |
children | e61a8395c3c1 |
comparison
equal
deleted
inserted
replaced
17032:7dd82e0c43ea | 17033:0413f68da85c |
---|---|
1 | 1 |
2 $ "$TESTDIR/hghave" svn svn-bindings || exit 80 | 2 $ "$TESTDIR/hghave" svn svn-bindings || exit 80 |
3 $ fix_path() | |
4 > { | |
5 > tr '\\' / | |
6 > } | |
7 $ echo "[extensions]" >> $HGRCPATH | 3 $ echo "[extensions]" >> $HGRCPATH |
8 $ echo "convert = " >> $HGRCPATH | 4 $ echo "convert = " >> $HGRCPATH |
9 $ echo "mq = " >> $HGRCPATH | 5 $ echo "mq = " >> $HGRCPATH |
10 $ svnpath=`pwd | fix_path`/svn-repo | 6 |
11 $ svnadmin create "$svnpath" | 7 $ SVNREPOPATH=`pwd`/svn-repo |
12 $ cat > "$svnpath"/hooks/pre-revprop-change <<EOF | 8 #if windows |
9 $ SVNREPOURL=file:///`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"` | |
10 #else | |
11 $ SVNREPOURL=file://`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"` | |
12 #endif | |
13 | |
14 $ svnadmin create "$SVNREPOPATH" | |
15 $ cat > "$SVNREPOPATH"/hooks/pre-revprop-change <<EOF | |
13 > #!/bin/sh | 16 > #!/bin/sh |
14 > | 17 > |
15 > REPOS="$1" | 18 > REPOS="$1" |
16 > REV="$2" | 19 > REV="$2" |
17 > USER="$3" | 20 > USER="$3" |
23 > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi | 26 > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi |
24 > | 27 > |
25 > echo "Changing prohibited revision property" >&2 | 28 > echo "Changing prohibited revision property" >&2 |
26 > exit 1 | 29 > exit 1 |
27 > EOF | 30 > EOF |
28 $ chmod +x "$svnpath"/hooks/pre-revprop-change | 31 $ chmod +x "$SVNREPOPATH"/hooks/pre-revprop-change |
29 $ | 32 $ svn co "$SVNREPOURL" "$SVNREPOPATH"-wc |
30 $ # SVN wants all paths to start with a slash. Unfortunately, | |
31 $ # Windows ones don't. Handle that. | |
32 $ svnurl="$svnpath" | |
33 $ expr "$svnurl" : "\/" > /dev/null || svnurl="/$svnurl" | |
34 $ svnurl="file://$svnurl" | |
35 $ svn co "$svnurl" "$svnpath"-wc | |
36 Checked out revision 0. | 33 Checked out revision 0. |
37 $ cd "$svnpath"-wc | 34 $ cd "$SVNREPOPATH"-wc |
38 $ echo a > a | 35 $ echo a > a |
39 $ svn add a | 36 $ svn add a |
40 A a | 37 A a |
41 $ svn ci -m'added a' a | 38 $ svn ci -m'added a' a |
42 Adding a | 39 Adding a |
44 Committed revision 1. | 41 Committed revision 1. |
45 $ cd .. | 42 $ cd .. |
46 | 43 |
47 initial roundtrip | 44 initial roundtrip |
48 | 45 |
49 $ hg convert -s svn -d hg "$svnpath"-wc "$svnpath"-hg | grep -v initializing | 46 $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg | grep -v initializing |
50 scanning source... | 47 scanning source... |
51 sorting... | 48 sorting... |
52 converting... | 49 converting... |
53 0 added a | 50 0 added a |
54 $ hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc | 51 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc |
55 scanning source... | 52 scanning source... |
56 sorting... | 53 sorting... |
57 converting... | 54 converting... |
58 | 55 |
59 second roundtrip should do nothing | 56 second roundtrip should do nothing |
60 | 57 |
61 $ hg convert -s svn -d hg "$svnpath"-wc "$svnpath"-hg | 58 $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg |
62 scanning source... | 59 scanning source... |
63 sorting... | 60 sorting... |
64 converting... | 61 converting... |
65 $ hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc | 62 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc |
66 scanning source... | 63 scanning source... |
67 sorting... | 64 sorting... |
68 converting... | 65 converting... |
69 | 66 |
70 new hg rev | 67 new hg rev |
71 | 68 |
72 $ hg clone "$svnpath"-hg "$svnpath"-work | 69 $ hg clone "$SVNREPOPATH"-hg "$SVNREPOPATH"-work |
73 updating to branch default | 70 updating to branch default |
74 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | 71 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
75 $ cd "$svnpath"-work | 72 $ cd "$SVNREPOPATH"-work |
76 $ echo b > b | 73 $ echo b > b |
77 $ hg add b | 74 $ hg add b |
78 $ hg ci -mb | 75 $ hg ci -mb |
79 | 76 |
80 adding an empty revision | 77 adding an empty revision |
83 $ hg qfinish -a | 80 $ hg qfinish -a |
84 $ cd .. | 81 $ cd .. |
85 | 82 |
86 echo hg to svn | 83 echo hg to svn |
87 | 84 |
88 $ hg --cwd "$svnpath"-hg pull -q "$svnpath"-work | 85 $ hg --cwd "$SVNREPOPATH"-hg pull -q "$SVNREPOPATH"-work |
89 $ hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc | 86 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc |
90 scanning source... | 87 scanning source... |
91 sorting... | 88 sorting... |
92 converting... | 89 converting... |
93 1 b | 90 1 b |
94 0 emtpy | 91 0 emtpy |
95 | 92 |
96 svn back to hg should do nothing | 93 svn back to hg should do nothing |
97 | 94 |
98 $ hg convert -s svn -d hg "$svnpath"-wc "$svnpath"-hg | 95 $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg |
99 scanning source... | 96 scanning source... |
100 sorting... | 97 sorting... |
101 converting... | 98 converting... |
102 | 99 |
103 hg back to svn should do nothing | 100 hg back to svn should do nothing |
104 | 101 |
105 $ hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc | 102 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc |
106 scanning source... | 103 scanning source... |
107 sorting... | 104 sorting... |
108 converting... | 105 converting... |