comparison tests/test-convert-hg-svn.t @ 12527:9a0528fd9172

tests: unify test-convert-hg-svn
author Matt Mackall <mpm@selenic.com>
date Sun, 26 Sep 2010 16:53:06 -0500
parents tests/test-convert-hg-svn@c52057614c72
children 0413f68da85c
comparison
equal deleted inserted replaced
12526:9892949bd969 12527:9a0528fd9172
1
2 $ "$TESTDIR/hghave" svn svn-bindings || exit 80
3 $ fix_path()
4 > {
5 > tr '\\' /
6 > }
7 $ echo "[extensions]" >> $HGRCPATH
8 $ echo "convert = " >> $HGRCPATH
9 $ echo "mq = " >> $HGRCPATH
10 $ svnpath=`pwd | fix_path`/svn-repo
11 $ svnadmin create "$svnpath"
12 $ cat > "$svnpath"/hooks/pre-revprop-change <<EOF
13 > #!/bin/sh
14 >
15 > REPOS="$1"
16 > REV="$2"
17 > USER="$3"
18 > PROPNAME="$4"
19 > ACTION="$5"
20 >
21 > if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
22 > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-branch" ]; then exit 0; fi
23 > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi
24 >
25 > echo "Changing prohibited revision property" >&2
26 > exit 1
27 > EOF
28 $ chmod +x "$svnpath"/hooks/pre-revprop-change
29 $
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.
37 $ cd "$svnpath"-wc
38 $ echo a > a
39 $ svn add a
40 A a
41 $ svn ci -m'added a' a
42 Adding a
43 Transmitting file data .
44 Committed revision 1.
45 $ cd ..
46
47 initial roundtrip
48
49 $ hg convert -s svn -d hg "$svnpath"-wc "$svnpath"-hg | grep -v initializing
50 scanning source...
51 sorting...
52 converting...
53 0 added a
54 $ hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc
55 scanning source...
56 sorting...
57 converting...
58
59 second roundtrip should do nothing
60
61 $ hg convert -s svn -d hg "$svnpath"-wc "$svnpath"-hg
62 scanning source...
63 sorting...
64 converting...
65 $ hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc
66 scanning source...
67 sorting...
68 converting...
69
70 new hg rev
71
72 $ hg clone "$svnpath"-hg "$svnpath"-work
73 updating to branch default
74 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
75 $ cd "$svnpath"-work
76 $ echo b > b
77 $ hg add b
78 $ hg ci -mb
79
80 adding an empty revision
81
82 $ hg qnew -m emtpy empty
83 $ hg qfinish -a
84 $ cd ..
85
86 echo hg to svn
87
88 $ hg --cwd "$svnpath"-hg pull -q "$svnpath"-work
89 $ hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc
90 scanning source...
91 sorting...
92 converting...
93 1 b
94 0 emtpy
95
96 svn back to hg should do nothing
97
98 $ hg convert -s svn -d hg "$svnpath"-wc "$svnpath"-hg
99 scanning source...
100 sorting...
101 converting...
102
103 hg back to svn should do nothing
104
105 $ hg convert -s hg -d svn "$svnpath"-hg "$svnpath"-wc
106 scanning source...
107 sorting...
108 converting...