1 #!/bin/sh |
|
2 |
|
3 "$TESTDIR/hghave" svn svn-bindings no-outer-repo || exit 80 |
|
4 |
|
5 fixpath() |
|
6 { |
|
7 tr '\\' / |
|
8 } |
|
9 |
|
10 svnupanddisplay() |
|
11 { |
|
12 ( |
|
13 cd $1; |
|
14 svn up; |
|
15 svn st -v | fixpath | sed 's/ */ /g' |
|
16 limit='' |
|
17 if [ $2 -gt 0 ]; then |
|
18 limit="--limit=$2" |
|
19 fi |
|
20 svn log --xml -v $limit | fixpath | sed 's,<date>.*,<date/>,' | grep -v 'kind="' |
|
21 ) |
|
22 } |
|
23 |
|
24 echo "[extensions]" >> $HGRCPATH |
|
25 echo "convert = " >> $HGRCPATH |
|
26 |
|
27 hg init a |
|
28 |
|
29 echo a > a/a |
|
30 mkdir -p a/d1/d2 |
|
31 echo b > a/d1/d2/b |
|
32 ln -s a/missing a/link |
|
33 echo % add |
|
34 hg --cwd a ci -d '0 0' -A -m 'add a file' |
|
35 |
|
36 "$TESTDIR/svn-safe-append.py" a a/a |
|
37 echo % modify |
|
38 hg --cwd a ci -d '1 0' -m 'modify a file' |
|
39 hg --cwd a tip -q |
|
40 |
|
41 hg convert -d svn a |
|
42 svnupanddisplay a-hg-wc 2 |
|
43 ls a a-hg-wc |
|
44 cmp a/a a-hg-wc/a && echo same || echo different |
|
45 |
|
46 hg --cwd a mv a b |
|
47 hg --cwd a mv link newlink |
|
48 echo % rename |
|
49 hg --cwd a ci -d '2 0' -m 'rename a file' |
|
50 hg --cwd a tip -q |
|
51 |
|
52 hg convert -d svn a |
|
53 svnupanddisplay a-hg-wc 1 |
|
54 ls a a-hg-wc |
|
55 |
|
56 hg --cwd a cp b c |
|
57 echo % copy |
|
58 hg --cwd a ci -d '3 0' -m 'copy a file' |
|
59 hg --cwd a tip -q |
|
60 |
|
61 hg convert -d svn a |
|
62 svnupanddisplay a-hg-wc 1 |
|
63 ls a a-hg-wc |
|
64 |
|
65 hg --cwd a rm b |
|
66 echo % remove |
|
67 hg --cwd a ci -d '4 0' -m 'remove a file' |
|
68 hg --cwd a tip -q |
|
69 |
|
70 hg convert -d svn a |
|
71 svnupanddisplay a-hg-wc 1 |
|
72 ls a a-hg-wc |
|
73 |
|
74 chmod +x a/c |
|
75 echo % executable |
|
76 hg --cwd a ci -d '5 0' -m 'make a file executable' |
|
77 hg --cwd a tip -q |
|
78 |
|
79 hg convert -d svn a |
|
80 svnupanddisplay a-hg-wc 1 |
|
81 test -x a-hg-wc/c && echo executable || echo not executable |
|
82 |
|
83 echo % executable in new directory |
|
84 |
|
85 rm -rf a a-hg a-hg-wc |
|
86 hg init a |
|
87 |
|
88 mkdir a/d1 |
|
89 echo a > a/d1/a |
|
90 chmod +x a/d1/a |
|
91 hg --cwd a ci -d '0 0' -A -m 'add executable file in new directory' |
|
92 |
|
93 hg convert -d svn a |
|
94 svnupanddisplay a-hg-wc 1 |
|
95 test -x a-hg-wc/d1/a && echo executable || echo not executable |
|
96 |
|
97 echo % copy to new directory |
|
98 |
|
99 mkdir a/d2 |
|
100 hg --cwd a cp d1/a d2/a |
|
101 hg --cwd a ci -d '1 0' -A -m 'copy file to new directory' |
|
102 |
|
103 hg convert -d svn a |
|
104 svnupanddisplay a-hg-wc 1 |
|
105 |
|
106 echo % branchy history |
|
107 |
|
108 hg init b |
|
109 echo base > b/b |
|
110 hg --cwd b ci -d '0 0' -Ambase |
|
111 |
|
112 "$TESTDIR/svn-safe-append.py" left-1 b/b |
|
113 echo left-1 > b/left-1 |
|
114 hg --cwd b ci -d '1 0' -Amleft-1 |
|
115 |
|
116 "$TESTDIR/svn-safe-append.py" left-2 b/b |
|
117 echo left-2 > b/left-2 |
|
118 hg --cwd b ci -d '2 0' -Amleft-2 |
|
119 |
|
120 hg --cwd b up 0 |
|
121 |
|
122 "$TESTDIR/svn-safe-append.py" right-1 b/b |
|
123 echo right-1 > b/right-1 |
|
124 hg --cwd b ci -d '3 0' -Amright-1 |
|
125 |
|
126 "$TESTDIR/svn-safe-append.py" right-2 b/b |
|
127 echo right-2 > b/right-2 |
|
128 hg --cwd b ci -d '4 0' -Amright-2 |
|
129 |
|
130 hg --cwd b up -C 2 |
|
131 hg --cwd b merge |
|
132 hg --cwd b revert -r 2 b |
|
133 hg resolve -m b |
|
134 hg --cwd b ci -d '5 0' -m 'merge' |
|
135 |
|
136 hg convert -d svn b |
|
137 echo % expect 4 changes |
|
138 svnupanddisplay b-hg-wc 0 |
|
139 |
|
140 echo % tags are not supported, but must not break conversion |
|
141 |
|
142 rm -rf a a-hg a-hg-wc |
|
143 hg init a |
|
144 echo a > a/a |
|
145 hg --cwd a ci -d '0 0' -A -m 'Add file a' |
|
146 hg --cwd a tag -d '1 0' -m 'Tagged as v1.0' v1.0 |
|
147 |
|
148 hg convert -d svn a |
|
149 svnupanddisplay a-hg-wc 2 |
|
150 rm -rf a a-hg a-hg-wc |
|