Debian Codegraph @

tests/test-convert-hg-startrev.t

raw
1
2 $ cat >> $HGRCPATH <<EOF
3 > [extensions]
4 > convert =
5 > [convert]
6 > hg.saverev = yes
7 > EOF
8
9 $ glog()
10 > {
11 > hg -R "$1" log -G --template '{rev} "{desc}" files: {files}\n'
12 > }
13
14 $ hg init source
15 $ cd source
16
17 $ echo a > a
18 $ echo b > b
19 $ echo f > f
20 $ hg ci -d '0 0' -qAm '0: add a b f'
21 $ echo c > c
22 $ hg move f d
23 $ hg ci -d '1 0' -qAm '1: add c, move f to d'
24 $ hg copy a e
25 $ echo b >> b
26 $ hg ci -d '2 0' -qAm '2: copy e from a, change b'
27 $ hg up -C 0
28 2 files updated, 0 files merged, 3 files removed, 0 files unresolved
29 $ echo a >> a
30 $ hg ci -d '3 0' -qAm '3: change a'
31 $ hg merge
32 merging a and e to e
33 3 files updated, 1 files merged, 1 files removed, 0 files unresolved
34 (branch merge, don't forget to commit)
35 $ hg ci -d '4 0' -qAm '4: merge 2 and 3'
36 $ echo a >> a
37 $ hg ci -d '5 0' -qAm '5: change a'
38 $ cd ..
39
40 Convert from null revision
41
42 $ hg convert --config convert.hg.startrev=null source full
43 initializing destination full repository
44 scanning source...
45 sorting...
46 converting...
47 5 0: add a b f
48 4 1: add c, move f to d
49 3 2: copy e from a, change b
50 2 3: change a
51 1 4: merge 2 and 3
52 0 5: change a
53
54 $ glog full
55 o 5 "5: change a" files: a
56 |
57 o 4 "4: merge 2 and 3" files: e
58 |\
59 | o 3 "3: change a" files: a
60 | |
61 o | 2 "2: copy e from a, change b" files: b e
62 | |
63 o | 1 "1: add c, move f to d" files: c d f
64 |/
65 o 0 "0: add a b f" files: a b f
66
67 $ rm -Rf full
68
69 Convert from zero revision
70
71 $ hg convert --config convert.hg.startrev=0 source full
72 initializing destination full repository
73 scanning source...
74 sorting...
75 converting...
76 5 0: add a b f
77 4 1: add c, move f to d
78 3 2: copy e from a, change b
79 2 3: change a
80 1 4: merge 2 and 3
81 0 5: change a
82
83 $ glog full
84 o 5 "5: change a" files: a
85 |
86 o 4 "4: merge 2 and 3" files: e
87 |\
88 | o 3 "3: change a" files: a
89 | |
90 o | 2 "2: copy e from a, change b" files: b e
91 | |
92 o | 1 "1: add c, move f to d" files: c d f
93 |/
94 o 0 "0: add a b f" files: a b f
95
96 Convert from merge parent
97
98 $ hg convert --config convert.hg.startrev=1 source conv1
99 initializing destination conv1 repository
100 scanning source...
101 sorting...
102 converting...
103 3 1: add c, move f to d
104 2 2: copy e from a, change b
105 1 4: merge 2 and 3
106 0 5: change a
107
108 $ glog conv1
109 o 3 "5: change a" files: a
110 |
111 o 2 "4: merge 2 and 3" files: a e
112 |
113 o 1 "2: copy e from a, change b" files: b e
114 |
115 o 0 "1: add c, move f to d" files: a b c d
116
117 $ cd conv1
118 $ hg up -q
119
120 Check copy preservation
121
122 $ hg st -C --change 2 e
123 M e
124 $ hg st -C --change 1 e
125 A e
126 a
127 $ hg st -C --change 0 a
128 A a
129
130 (It seems like a bug in log that the following doesn't show rev 1.)
131
132 $ hg log --follow --copies e
133 changeset: 2:8d3c3fe67bb7
134 user: test
135 date: Thu Jan 01 00:00:04 1970 +0000
136 summary: 4: merge 2 and 3
137
138 changeset: 0:23c3be426dce
139 user: test
140 date: Thu Jan 01 00:00:01 1970 +0000
141 summary: 1: add c, move f to d
142
143 Check copy removal on missing parent
144
145 $ hg log --follow --copies d
146 changeset: 0:23c3be426dce
147 user: test
148 date: Thu Jan 01 00:00:01 1970 +0000
149 summary: 1: add c, move f to d
150
151 $ hg cat -r tip a b
152 a
153 a
154 a
155 b
156 b
157 $ hg -q verify
158 $ cd ..
159
160 Convert from merge
161
162 $ hg convert --config convert.hg.startrev=4 source conv4
163 initializing destination conv4 repository
164 scanning source...
165 sorting...
166 converting...
167 1 4: merge 2 and 3
168 0 5: change a
169 $ glog conv4
170 o 1 "5: change a" files: a
171 |
172 o 0 "4: merge 2 and 3" files: a b c d e
173
174 $ cd conv4
175 $ hg up -C
176 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
177 $ hg cat -r tip a b
178 a
179 a
180 a
181 b
182 b
183 $ hg -q verify
184 $ cd ..
185
186 Convert from revset in convert.hg.revs
187
188 $ hg convert --config convert.hg.revs='3:4+0' source revsetrepo
189 initializing destination revsetrepo repository
190 scanning source...
191 sorting...
192 converting...
193 2 0: add a b f
194 1 3: change a
195 0 4: merge 2 and 3
196
197 $ glog revsetrepo
198 o 2 "4: merge 2 and 3" files: b c d e f
199 |
200 o 1 "3: change a" files: a
201 |
202 o 0 "0: add a b f" files: a b f
203
204 Convert from specified revs
205
206 $ hg convert --rev 3 --rev 2 source multiplerevs
207 initializing destination multiplerevs repository
208 scanning source...
209 sorting...
210 converting...
211 3 0: add a b f
212 2 1: add c, move f to d
213 1 2: copy e from a, change b
214 0 3: change a
215 $ glog multiplerevs
216 o 3 "3: change a" files: a
217 |
218 | o 2 "2: copy e from a, change b" files: b e
219 | |
220 | o 1 "1: add c, move f to d" files: c d f
221 |/
222 o 0 "0: add a b f" files: a b f
223
224 Convert in multiple steps that doesn't overlap - the link to the parent is
225 preserved anyway
226
227 $ hg convert --config convert.hg.revs=::1 source multistep
228 initializing destination multistep repository
229 scanning source...
230 sorting...
231 converting...
232 1 0: add a b f
233 0 1: add c, move f to d
234 $ hg convert --config convert.hg.revs=2 source multistep
235 scanning source...
236 sorting...
237 converting...
238 0 2: copy e from a, change b
239 $ glog multistep
240 o 2 "2: copy e from a, change b" files: b e
241 |
242 o 1 "1: add c, move f to d" files: c d f
243 |
244 o 0 "0: add a b f" files: a b f
245