##// END OF EJS Templates
test-revert: sort by output filename again...
Martin von Zweigbergk -
r23160:4f4e6815 default
parent child Browse files
Show More
@@ -1,1087 +1,1090
1 $ hg init repo
1 $ hg init repo
2 $ cd repo
2 $ cd repo
3 $ echo 123 > a
3 $ echo 123 > a
4 $ echo 123 > c
4 $ echo 123 > c
5 $ echo 123 > e
5 $ echo 123 > e
6 $ hg add a c e
6 $ hg add a c e
7 $ hg commit -m "first" a c e
7 $ hg commit -m "first" a c e
8
8
9 nothing changed
9 nothing changed
10
10
11 $ hg revert
11 $ hg revert
12 abort: no files or directories specified
12 abort: no files or directories specified
13 (use --all to revert all files)
13 (use --all to revert all files)
14 [255]
14 [255]
15 $ hg revert --all
15 $ hg revert --all
16
16
17 Introduce some changes and revert them
17 Introduce some changes and revert them
18 --------------------------------------
18 --------------------------------------
19
19
20 $ echo 123 > b
20 $ echo 123 > b
21
21
22 $ hg status
22 $ hg status
23 ? b
23 ? b
24 $ echo 12 > c
24 $ echo 12 > c
25
25
26 $ hg status
26 $ hg status
27 M c
27 M c
28 ? b
28 ? b
29 $ hg add b
29 $ hg add b
30
30
31 $ hg status
31 $ hg status
32 M c
32 M c
33 A b
33 A b
34 $ hg rm a
34 $ hg rm a
35
35
36 $ hg status
36 $ hg status
37 M c
37 M c
38 A b
38 A b
39 R a
39 R a
40
40
41 revert removal of a file
41 revert removal of a file
42
42
43 $ hg revert a
43 $ hg revert a
44 $ hg status
44 $ hg status
45 M c
45 M c
46 A b
46 A b
47
47
48 revert addition of a file
48 revert addition of a file
49
49
50 $ hg revert b
50 $ hg revert b
51 $ hg status
51 $ hg status
52 M c
52 M c
53 ? b
53 ? b
54
54
55 revert modification of a file (--no-backup)
55 revert modification of a file (--no-backup)
56
56
57 $ hg revert --no-backup c
57 $ hg revert --no-backup c
58 $ hg status
58 $ hg status
59 ? b
59 ? b
60
60
61 revert deletion (! status) of a added file
61 revert deletion (! status) of a added file
62 ------------------------------------------
62 ------------------------------------------
63
63
64 $ hg add b
64 $ hg add b
65
65
66 $ hg status b
66 $ hg status b
67 A b
67 A b
68 $ rm b
68 $ rm b
69 $ hg status b
69 $ hg status b
70 ! b
70 ! b
71 $ hg revert -v b
71 $ hg revert -v b
72 forgetting b
72 forgetting b
73 $ hg status b
73 $ hg status b
74 b: * (glob)
74 b: * (glob)
75
75
76 $ ls
76 $ ls
77 a
77 a
78 c
78 c
79 e
79 e
80
80
81 Test creation of backup (.orig) files
81 Test creation of backup (.orig) files
82 -------------------------------------
82 -------------------------------------
83
83
84 $ echo z > e
84 $ echo z > e
85 $ hg revert --all -v
85 $ hg revert --all -v
86 saving current version of e as e.orig
86 saving current version of e as e.orig
87 reverting e
87 reverting e
88
88
89 revert on clean file (no change)
89 revert on clean file (no change)
90 --------------------------------
90 --------------------------------
91
91
92 $ hg revert a
92 $ hg revert a
93 no changes needed to a
93 no changes needed to a
94
94
95 revert on an untracked file
95 revert on an untracked file
96 ---------------------------
96 ---------------------------
97
97
98 $ echo q > q
98 $ echo q > q
99 $ hg revert q
99 $ hg revert q
100 file not managed: q
100 file not managed: q
101 $ rm q
101 $ rm q
102
102
103 revert on file that does not exists
103 revert on file that does not exists
104 -----------------------------------
104 -----------------------------------
105
105
106 $ hg revert notfound
106 $ hg revert notfound
107 notfound: no such file in rev 334a9e57682c
107 notfound: no such file in rev 334a9e57682c
108 $ touch d
108 $ touch d
109 $ hg add d
109 $ hg add d
110 $ hg rm a
110 $ hg rm a
111 $ hg commit -m "second"
111 $ hg commit -m "second"
112 $ echo z > z
112 $ echo z > z
113 $ hg add z
113 $ hg add z
114 $ hg st
114 $ hg st
115 A z
115 A z
116 ? e.orig
116 ? e.orig
117
117
118 revert to another revision (--rev)
118 revert to another revision (--rev)
119 ----------------------------------
119 ----------------------------------
120
120
121 $ hg revert --all -r0
121 $ hg revert --all -r0
122 adding a
122 adding a
123 removing d
123 removing d
124 forgetting z
124 forgetting z
125
125
126 revert explicitly to parent (--rev)
126 revert explicitly to parent (--rev)
127 -----------------------------------
127 -----------------------------------
128
128
129 $ hg revert --all -rtip
129 $ hg revert --all -rtip
130 forgetting a
130 forgetting a
131 undeleting d
131 undeleting d
132 $ rm a *.orig
132 $ rm a *.orig
133
133
134 revert to another revision (--rev) and exact match
134 revert to another revision (--rev) and exact match
135 --------------------------------------------------
135 --------------------------------------------------
136
136
137 exact match are more silent
137 exact match are more silent
138
138
139 $ hg revert -r0 a
139 $ hg revert -r0 a
140 $ hg st a
140 $ hg st a
141 A a
141 A a
142 $ hg rm d
142 $ hg rm d
143 $ hg st d
143 $ hg st d
144 R d
144 R d
145
145
146 should keep d removed
146 should keep d removed
147
147
148 $ hg revert -r0 d
148 $ hg revert -r0 d
149 no changes needed to d
149 no changes needed to d
150 $ hg st d
150 $ hg st d
151 R d
151 R d
152
152
153 $ hg update -C
153 $ hg update -C
154 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
154 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
155
155
156 revert of exec bit
156 revert of exec bit
157 ------------------
157 ------------------
158
158
159 #if execbit
159 #if execbit
160 $ chmod +x c
160 $ chmod +x c
161 $ hg revert --all
161 $ hg revert --all
162 reverting c
162 reverting c
163
163
164 $ test -x c || echo non-executable
164 $ test -x c || echo non-executable
165 non-executable
165 non-executable
166
166
167 $ chmod +x c
167 $ chmod +x c
168 $ hg commit -m exe
168 $ hg commit -m exe
169
169
170 $ chmod -x c
170 $ chmod -x c
171 $ hg revert --all
171 $ hg revert --all
172 reverting c
172 reverting c
173
173
174 $ test -x c && echo executable
174 $ test -x c && echo executable
175 executable
175 executable
176 #endif
176 #endif
177
177
178 $ cd ..
178 $ cd ..
179
179
180
180
181 Issue241: update and revert produces inconsistent repositories
181 Issue241: update and revert produces inconsistent repositories
182 --------------------------------------------------------------
182 --------------------------------------------------------------
183
183
184 $ hg init a
184 $ hg init a
185 $ cd a
185 $ cd a
186 $ echo a >> a
186 $ echo a >> a
187 $ hg commit -A -d '1 0' -m a
187 $ hg commit -A -d '1 0' -m a
188 adding a
188 adding a
189 $ echo a >> a
189 $ echo a >> a
190 $ hg commit -d '2 0' -m a
190 $ hg commit -d '2 0' -m a
191 $ hg update 0
191 $ hg update 0
192 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
192 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
193 $ mkdir b
193 $ mkdir b
194 $ echo b > b/b
194 $ echo b > b/b
195
195
196 call `hg revert` with no file specified
196 call `hg revert` with no file specified
197 ---------------------------------------
197 ---------------------------------------
198
198
199 $ hg revert -rtip
199 $ hg revert -rtip
200 abort: no files or directories specified
200 abort: no files or directories specified
201 (use --all to revert all files, or 'hg update 1' to update)
201 (use --all to revert all files, or 'hg update 1' to update)
202 [255]
202 [255]
203
203
204 call `hg revert` with --all
204 call `hg revert` with --all
205 ---------------------------
205 ---------------------------
206
206
207 $ hg revert --all -rtip
207 $ hg revert --all -rtip
208 reverting a
208 reverting a
209
209
210
210
211 Issue332: confusing message when reverting directory
211 Issue332: confusing message when reverting directory
212 ----------------------------------------------------
212 ----------------------------------------------------
213
213
214 $ hg ci -A -m b
214 $ hg ci -A -m b
215 adding b/b
215 adding b/b
216 created new head
216 created new head
217 $ echo foobar > b/b
217 $ echo foobar > b/b
218 $ mkdir newdir
218 $ mkdir newdir
219 $ echo foo > newdir/newfile
219 $ echo foo > newdir/newfile
220 $ hg add newdir/newfile
220 $ hg add newdir/newfile
221 $ hg revert b newdir
221 $ hg revert b newdir
222 reverting b/b (glob)
222 reverting b/b (glob)
223 forgetting newdir/newfile (glob)
223 forgetting newdir/newfile (glob)
224 $ echo foobar > b/b
224 $ echo foobar > b/b
225 $ hg revert .
225 $ hg revert .
226 reverting b/b (glob)
226 reverting b/b (glob)
227
227
228
228
229 reverting a rename target should revert the source
229 reverting a rename target should revert the source
230 --------------------------------------------------
230 --------------------------------------------------
231
231
232 $ hg mv a newa
232 $ hg mv a newa
233 $ hg revert newa
233 $ hg revert newa
234 $ hg st a newa
234 $ hg st a newa
235 ? newa
235 ? newa
236
236
237 $ cd ..
237 $ cd ..
238
238
239 $ hg init ignored
239 $ hg init ignored
240 $ cd ignored
240 $ cd ignored
241 $ echo '^ignored$' > .hgignore
241 $ echo '^ignored$' > .hgignore
242 $ echo '^ignoreddir$' >> .hgignore
242 $ echo '^ignoreddir$' >> .hgignore
243 $ echo '^removed$' >> .hgignore
243 $ echo '^removed$' >> .hgignore
244
244
245 $ mkdir ignoreddir
245 $ mkdir ignoreddir
246 $ touch ignoreddir/file
246 $ touch ignoreddir/file
247 $ touch ignoreddir/removed
247 $ touch ignoreddir/removed
248 $ touch ignored
248 $ touch ignored
249 $ touch removed
249 $ touch removed
250
250
251 4 ignored files (we will add/commit everything)
251 4 ignored files (we will add/commit everything)
252
252
253 $ hg st -A -X .hgignore
253 $ hg st -A -X .hgignore
254 I ignored
254 I ignored
255 I ignoreddir/file
255 I ignoreddir/file
256 I ignoreddir/removed
256 I ignoreddir/removed
257 I removed
257 I removed
258 $ hg ci -qAm 'add files' ignored ignoreddir/file ignoreddir/removed removed
258 $ hg ci -qAm 'add files' ignored ignoreddir/file ignoreddir/removed removed
259
259
260 $ echo >> ignored
260 $ echo >> ignored
261 $ echo >> ignoreddir/file
261 $ echo >> ignoreddir/file
262 $ hg rm removed ignoreddir/removed
262 $ hg rm removed ignoreddir/removed
263
263
264 should revert ignored* and undelete *removed
264 should revert ignored* and undelete *removed
265 --------------------------------------------
265 --------------------------------------------
266
266
267 $ hg revert -a --no-backup
267 $ hg revert -a --no-backup
268 reverting ignored
268 reverting ignored
269 reverting ignoreddir/file (glob)
269 reverting ignoreddir/file (glob)
270 undeleting ignoreddir/removed (glob)
270 undeleting ignoreddir/removed (glob)
271 undeleting removed
271 undeleting removed
272 $ hg st -mardi
272 $ hg st -mardi
273
273
274 $ hg up -qC
274 $ hg up -qC
275 $ echo >> ignored
275 $ echo >> ignored
276 $ hg rm removed
276 $ hg rm removed
277
277
278 should silently revert the named files
278 should silently revert the named files
279 --------------------------------------
279 --------------------------------------
280
280
281 $ hg revert --no-backup ignored removed
281 $ hg revert --no-backup ignored removed
282 $ hg st -mardi
282 $ hg st -mardi
283
283
284 Reverting copy (issue3920)
284 Reverting copy (issue3920)
285 --------------------------
285 --------------------------
286
286
287 someone set up us the copies
287 someone set up us the copies
288
288
289 $ rm .hgignore
289 $ rm .hgignore
290 $ hg update -C
290 $ hg update -C
291 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
291 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
292 $ hg mv ignored allyour
292 $ hg mv ignored allyour
293 $ hg copy removed base
293 $ hg copy removed base
294 $ hg commit -m rename
294 $ hg commit -m rename
295
295
296 copies and renames, you have no chance to survive make your time (issue3920)
296 copies and renames, you have no chance to survive make your time (issue3920)
297
297
298 $ hg update '.^'
298 $ hg update '.^'
299 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
299 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
300 $ hg revert -rtip -a
300 $ hg revert -rtip -a
301 adding allyour
301 adding allyour
302 adding base
302 adding base
303 removing ignored
303 removing ignored
304 $ hg status -C
304 $ hg status -C
305 A allyour
305 A allyour
306 ignored
306 ignored
307 A base
307 A base
308 removed
308 removed
309 R ignored
309 R ignored
310
310
311 Test revert of a file added by one side of the merge
311 Test revert of a file added by one side of the merge
312 ====================================================
312 ====================================================
313
313
314 remove any pending change
314 remove any pending change
315
315
316 $ hg revert --all
316 $ hg revert --all
317 forgetting allyour
317 forgetting allyour
318 forgetting base
318 forgetting base
319 undeleting ignored
319 undeleting ignored
320 $ hg purge --all --config extensions.purge=
320 $ hg purge --all --config extensions.purge=
321
321
322 Adds a new commit
322 Adds a new commit
323
323
324 $ echo foo > newadd
324 $ echo foo > newadd
325 $ hg add newadd
325 $ hg add newadd
326 $ hg commit -m 'other adds'
326 $ hg commit -m 'other adds'
327 created new head
327 created new head
328
328
329
329
330 merge it with the other head
330 merge it with the other head
331
331
332 $ hg merge # merge 1 into 2
332 $ hg merge # merge 1 into 2
333 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
333 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
334 (branch merge, don't forget to commit)
334 (branch merge, don't forget to commit)
335 $ hg summary
335 $ hg summary
336 parent: 2:b8ec310b2d4e tip
336 parent: 2:b8ec310b2d4e tip
337 other adds
337 other adds
338 parent: 1:f6180deb8fbe
338 parent: 1:f6180deb8fbe
339 rename
339 rename
340 branch: default
340 branch: default
341 commit: 2 modified, 1 removed (merge)
341 commit: 2 modified, 1 removed (merge)
342 update: (current)
342 update: (current)
343
343
344 clarifies who added what
344 clarifies who added what
345
345
346 $ hg status
346 $ hg status
347 M allyour
347 M allyour
348 M base
348 M base
349 R ignored
349 R ignored
350 $ hg status --change 'p1()'
350 $ hg status --change 'p1()'
351 A newadd
351 A newadd
352 $ hg status --change 'p2()'
352 $ hg status --change 'p2()'
353 A allyour
353 A allyour
354 A base
354 A base
355 R ignored
355 R ignored
356
356
357 revert file added by p1() to p1() state
357 revert file added by p1() to p1() state
358 -----------------------------------------
358 -----------------------------------------
359
359
360 $ hg revert -r 'p1()' 'glob:newad?'
360 $ hg revert -r 'p1()' 'glob:newad?'
361 $ hg status
361 $ hg status
362 M allyour
362 M allyour
363 M base
363 M base
364 R ignored
364 R ignored
365
365
366 revert file added by p1() to p2() state
366 revert file added by p1() to p2() state
367 ------------------------------------------
367 ------------------------------------------
368
368
369 $ hg revert -r 'p2()' 'glob:newad?'
369 $ hg revert -r 'p2()' 'glob:newad?'
370 removing newadd
370 removing newadd
371 $ hg status
371 $ hg status
372 M allyour
372 M allyour
373 M base
373 M base
374 R ignored
374 R ignored
375 R newadd
375 R newadd
376
376
377 revert file added by p2() to p2() state
377 revert file added by p2() to p2() state
378 ------------------------------------------
378 ------------------------------------------
379
379
380 $ hg revert -r 'p2()' 'glob:allyou?'
380 $ hg revert -r 'p2()' 'glob:allyou?'
381 $ hg status
381 $ hg status
382 M allyour
382 M allyour
383 M base
383 M base
384 R ignored
384 R ignored
385 R newadd
385 R newadd
386
386
387 revert file added by p2() to p1() state
387 revert file added by p2() to p1() state
388 ------------------------------------------
388 ------------------------------------------
389
389
390 $ hg revert -r 'p1()' 'glob:allyou?'
390 $ hg revert -r 'p1()' 'glob:allyou?'
391 removing allyour
391 removing allyour
392 $ hg status
392 $ hg status
393 M base
393 M base
394 R allyour
394 R allyour
395 R ignored
395 R ignored
396 R newadd
396 R newadd
397
397
398 Systematic behavior validation of most possible cases
398 Systematic behavior validation of most possible cases
399 =====================================================
399 =====================================================
400
400
401 This section tests most of the possible combinations of revision states and
401 This section tests most of the possible combinations of revision states and
402 working directory states. The number of possible cases is significant but they
402 working directory states. The number of possible cases is significant but they
403 but they all have a slightly different handling. So this section commits to
403 but they all have a slightly different handling. So this section commits to
404 and testing all of them to allow safe refactoring of the revert code.
404 and testing all of them to allow safe refactoring of the revert code.
405
405
406 A python script is used to generate a file history for each combination of
406 A python script is used to generate a file history for each combination of
407 states, on one side the content (or lack thereof) in two revisions, and
407 states, on one side the content (or lack thereof) in two revisions, and
408 on the other side, the content and "tracked-ness" of the working directory. The
408 on the other side, the content and "tracked-ness" of the working directory. The
409 three states generated are:
409 three states generated are:
410
410
411 - a "base" revision
411 - a "base" revision
412 - a "parent" revision
412 - a "parent" revision
413 - the working directory (based on "parent")
413 - the working directory (based on "parent")
414
414
415 The files generated have names of the form:
415 The files generated have names of the form:
416
416
417 <rev1-content>_<rev2-content>_<working-copy-content>-<tracked-ness>
417 <rev1-content>_<rev2-content>_<working-copy-content>-<tracked-ness>
418
418
419 All known states are not tested yet. See inline documentation for details.
419 All known states are not tested yet. See inline documentation for details.
420 Special cases from merge and rename are not tested by this section.
420 Special cases from merge and rename are not tested by this section.
421
421
422 Write the python script to disk
422 Write the python script to disk
423 -------------------------------
423 -------------------------------
424
424
425 $ cat << EOF > gen-revert-cases.py
425 $ cat << EOF > gen-revert-cases.py
426 > # generate proper file state to test revert behavior
426 > # generate proper file state to test revert behavior
427 > import sys
427 > import sys
428 > import os
428 > import os
429 >
429 >
430 > # content of the file in "base" and "parent"
430 > # content of the file in "base" and "parent"
431 > # None means no file at all
431 > # None means no file at all
432 > ctxcontent = {
432 > ctxcontent = {
433 > # clean: no change from base to parent
433 > # clean: no change from base to parent
434 > 'clean': ['content1', 'content1'],
434 > 'clean': ['content1', 'content1'],
435 > # modified: file content change from base to parent
435 > # modified: file content change from base to parent
436 > 'modified': ['content1', 'content2'],
436 > 'modified': ['content1', 'content2'],
437 > # added: file is missing from base and added in parent
437 > # added: file is missing from base and added in parent
438 > 'added': [None, 'content2'],
438 > 'added': [None, 'content2'],
439 > # removed: file exist in base but is removed from parent
439 > # removed: file exist in base but is removed from parent
440 > 'removed': ['content1', None],
440 > 'removed': ['content1', None],
441 > # file exist neither in base not in parent
441 > # file exist neither in base not in parent
442 > 'missing': [None, None],
442 > 'missing': [None, None],
443 > }
443 > }
444 >
444 >
445 > # content of file in working copy
445 > # content of file in working copy
446 > wccontent = {
446 > wccontent = {
447 > # clean: wc content is the same as parent
447 > # clean: wc content is the same as parent
448 > 'clean': (True, lambda cc: cc[1]),
448 > 'clean': (True, lambda cc: cc[1]),
449 > # revert: wc content is the same as base
449 > # revert: wc content is the same as base
450 > 'revert': (True, lambda cc: cc[0]),
450 > 'revert': (True, lambda cc: cc[0]),
451 > # wc: file exist with a content different from base and parent
451 > # wc: file exist with a content different from base and parent
452 > 'wc': (True, lambda cc: 'content3'),
452 > 'wc': (True, lambda cc: 'content3'),
453 > # deleted: file is recorded as tracked but missing
453 > # deleted: file is recorded as tracked but missing
454 > # rely on file deletion outside of this script
454 > # rely on file deletion outside of this script
455 > 'deleted': (True, lambda cc:'TOBEDELETED'),
455 > 'deleted': (True, lambda cc:'TOBEDELETED'),
456 > }
456 > }
457 > # untracked-X is a version of X where the file is not tracked (? unknown)
457 > # untracked-X is a version of X where the file is not tracked (? unknown)
458 > wccontent['untracked-clean'] = (False, wccontent['clean'][1])
458 > wccontent['untracked-clean'] = (False, wccontent['clean'][1])
459 > wccontent['untracked-deleted'] = (False, wccontent['deleted'][1])
459 > wccontent['untracked-deleted'] = (False, wccontent['deleted'][1])
460 > wccontent['untracked-revert'] = (False, wccontent['revert'][1])
460 > wccontent['untracked-revert'] = (False, wccontent['revert'][1])
461 > wccontent['untracked-wc'] = (False, wccontent['wc'][1])
461 > wccontent['untracked-wc'] = (False, wccontent['wc'][1])
462 >
462 >
463 > # build the combination of possible states
463 > # build the combination of possible states
464 > combination = []
464 > combination = []
465 > for ctxkey, ctxvalue in sorted(ctxcontent.iteritems()):
465 > for ctxkey, ctxvalue in ctxcontent.iteritems():
466 > for wckey, (tracked, wcfunc) in sorted(wccontent.iteritems()):
466 > for wckey, (tracked, wcfunc) in wccontent.iteritems():
467 > base, parent = ctxvalue
467 > base, parent = ctxvalue
468 > if (base == parent and 'revert' in wckey):
468 > if (base == parent and 'revert' in wckey):
469 > continue
469 > continue
470 > if not base and 'revert' in wckey:
470 > if not base and 'revert' in wckey:
471 > continue
471 > continue
472 > if not parent and 'deleted' in wckey:
472 > if not parent and 'deleted' in wckey:
473 > continue
473 > continue
474 > def statestring(content):
474 > def statestring(content):
475 > return content in (None, 'TOBEDELETED') and 'missing' or content
475 > return content in (None, 'TOBEDELETED') and 'missing' or content
476 > wcc = wcfunc(ctxvalue)
476 > wcc = wcfunc(ctxvalue)
477 > trackedstring = tracked and 'tracked' or 'untracked'
477 > trackedstring = tracked and 'tracked' or 'untracked'
478 > filename = "%s_%s_%s-%s" % (statestring(base),
478 > filename = "%s_%s_%s-%s" % (statestring(base),
479 > statestring(parent),
479 > statestring(parent),
480 > statestring(wcc),
480 > statestring(wcc),
481 > trackedstring)
481 > trackedstring)
482 > combination.append((filename, base, parent, wcc))
482 > combination.append((filename, base, parent, wcc))
483 >
483 >
484 > # make sure we have stable output
485 > combination.sort()
486 >
484 > # retrieve the state we must generate
487 > # retrieve the state we must generate
485 > target = sys.argv[1]
488 > target = sys.argv[1]
486 >
489 >
487 > # compute file content
490 > # compute file content
488 > content = []
491 > content = []
489 > for filename, base, parent, wcc in combination:
492 > for filename, base, parent, wcc in combination:
490 > if target == 'filelist':
493 > if target == 'filelist':
491 > print filename
494 > print filename
492 > elif target == 'base':
495 > elif target == 'base':
493 > content.append((filename, base))
496 > content.append((filename, base))
494 > elif target == 'parent':
497 > elif target == 'parent':
495 > content.append((filename, parent))
498 > content.append((filename, parent))
496 > elif target == 'wc':
499 > elif target == 'wc':
497 > content.append((filename, wcc))
500 > content.append((filename, wcc))
498 > else:
501 > else:
499 > print >> sys.stderr, "unknown target:", target
502 > print >> sys.stderr, "unknown target:", target
500 > sys.exit(1)
503 > sys.exit(1)
501 >
504 >
502 > # write actual content
505 > # write actual content
503 > for filename, data in content:
506 > for filename, data in content:
504 > if data is not None:
507 > if data is not None:
505 > f = open(filename, 'w')
508 > f = open(filename, 'w')
506 > f.write(data + '\n')
509 > f.write(data + '\n')
507 > f.close()
510 > f.close()
508 > elif os.path.exists(filename):
511 > elif os.path.exists(filename):
509 > os.remove(filename)
512 > os.remove(filename)
510 > EOF
513 > EOF
511
514
512 check list of planned files
515 check list of planned files
513
516
514 $ python gen-revert-cases.py filelist
517 $ python gen-revert-cases.py filelist
518 content1_content1_content1-tracked
519 content1_content1_content1-untracked
520 content1_content1_content3-tracked
521 content1_content1_content3-untracked
522 content1_content1_missing-tracked
523 content1_content1_missing-untracked
524 content1_content2_content1-tracked
525 content1_content2_content1-untracked
526 content1_content2_content2-tracked
527 content1_content2_content2-untracked
528 content1_content2_content3-tracked
529 content1_content2_content3-untracked
530 content1_content2_missing-tracked
531 content1_content2_missing-untracked
532 content1_missing_content1-tracked
533 content1_missing_content1-untracked
534 content1_missing_content3-tracked
535 content1_missing_content3-untracked
536 content1_missing_missing-tracked
537 content1_missing_missing-untracked
515 missing_content2_content2-tracked
538 missing_content2_content2-tracked
516 missing_content2_missing-tracked
517 missing_content2_content2-untracked
539 missing_content2_content2-untracked
518 missing_content2_missing-untracked
519 missing_content2_content3-untracked
520 missing_content2_content3-tracked
540 missing_content2_content3-tracked
521 content1_content1_content1-tracked
541 missing_content2_content3-untracked
522 content1_content1_missing-tracked
542 missing_content2_missing-tracked
523 content1_content1_content1-untracked
543 missing_content2_missing-untracked
524 content1_content1_missing-untracked
544 missing_missing_content3-tracked
525 content1_content1_content3-untracked
545 missing_missing_content3-untracked
526 content1_content1_content3-tracked
527 missing_missing_missing-tracked
546 missing_missing_missing-tracked
528 missing_missing_missing-untracked
547 missing_missing_missing-untracked
529 missing_missing_content3-untracked
530 missing_missing_content3-tracked
531 content1_content2_content2-tracked
532 content1_content2_missing-tracked
533 content1_content2_content1-tracked
534 content1_content2_content2-untracked
535 content1_content2_missing-untracked
536 content1_content2_content1-untracked
537 content1_content2_content3-untracked
538 content1_content2_content3-tracked
539 content1_missing_missing-tracked
540 content1_missing_content1-tracked
541 content1_missing_missing-untracked
542 content1_missing_content1-untracked
543 content1_missing_content3-untracked
544 content1_missing_content3-tracked
545
548
546 Script to make a simple text version of the content
549 Script to make a simple text version of the content
547 ---------------------------------------------------
550 ---------------------------------------------------
548
551
549 $ cat << EOF >> dircontent.py
552 $ cat << EOF >> dircontent.py
550 > # generate a simple text view of the directory for easy comparison
553 > # generate a simple text view of the directory for easy comparison
551 > import os
554 > import os
552 > files = os.listdir('.')
555 > files = os.listdir('.')
553 > files.sort()
556 > files.sort()
554 > for filename in files:
557 > for filename in files:
555 > if os.path.isdir(filename):
558 > if os.path.isdir(filename):
556 > continue
559 > continue
557 > content = open(filename).read()
560 > content = open(filename).read()
558 > print '%-6s %s' % (content.strip(), filename)
561 > print '%-6s %s' % (content.strip(), filename)
559 > EOF
562 > EOF
560
563
561 Generate appropriate repo state
564 Generate appropriate repo state
562 -------------------------------
565 -------------------------------
563
566
564 $ hg init revert-ref
567 $ hg init revert-ref
565 $ cd revert-ref
568 $ cd revert-ref
566
569
567 Generate base changeset
570 Generate base changeset
568
571
569 $ python ../gen-revert-cases.py base
572 $ python ../gen-revert-cases.py base
570 $ hg addremove --similarity 0
573 $ hg addremove --similarity 0
571 adding content1_content1_content1-tracked
574 adding content1_content1_content1-tracked
572 adding content1_content1_content1-untracked
575 adding content1_content1_content1-untracked
573 adding content1_content1_content3-tracked
576 adding content1_content1_content3-tracked
574 adding content1_content1_content3-untracked
577 adding content1_content1_content3-untracked
575 adding content1_content1_missing-tracked
578 adding content1_content1_missing-tracked
576 adding content1_content1_missing-untracked
579 adding content1_content1_missing-untracked
577 adding content1_content2_content1-tracked
580 adding content1_content2_content1-tracked
578 adding content1_content2_content1-untracked
581 adding content1_content2_content1-untracked
579 adding content1_content2_content2-tracked
582 adding content1_content2_content2-tracked
580 adding content1_content2_content2-untracked
583 adding content1_content2_content2-untracked
581 adding content1_content2_content3-tracked
584 adding content1_content2_content3-tracked
582 adding content1_content2_content3-untracked
585 adding content1_content2_content3-untracked
583 adding content1_content2_missing-tracked
586 adding content1_content2_missing-tracked
584 adding content1_content2_missing-untracked
587 adding content1_content2_missing-untracked
585 adding content1_missing_content1-tracked
588 adding content1_missing_content1-tracked
586 adding content1_missing_content1-untracked
589 adding content1_missing_content1-untracked
587 adding content1_missing_content3-tracked
590 adding content1_missing_content3-tracked
588 adding content1_missing_content3-untracked
591 adding content1_missing_content3-untracked
589 adding content1_missing_missing-tracked
592 adding content1_missing_missing-tracked
590 adding content1_missing_missing-untracked
593 adding content1_missing_missing-untracked
591 $ hg status
594 $ hg status
592 A content1_content1_content1-tracked
595 A content1_content1_content1-tracked
593 A content1_content1_content1-untracked
596 A content1_content1_content1-untracked
594 A content1_content1_content3-tracked
597 A content1_content1_content3-tracked
595 A content1_content1_content3-untracked
598 A content1_content1_content3-untracked
596 A content1_content1_missing-tracked
599 A content1_content1_missing-tracked
597 A content1_content1_missing-untracked
600 A content1_content1_missing-untracked
598 A content1_content2_content1-tracked
601 A content1_content2_content1-tracked
599 A content1_content2_content1-untracked
602 A content1_content2_content1-untracked
600 A content1_content2_content2-tracked
603 A content1_content2_content2-tracked
601 A content1_content2_content2-untracked
604 A content1_content2_content2-untracked
602 A content1_content2_content3-tracked
605 A content1_content2_content3-tracked
603 A content1_content2_content3-untracked
606 A content1_content2_content3-untracked
604 A content1_content2_missing-tracked
607 A content1_content2_missing-tracked
605 A content1_content2_missing-untracked
608 A content1_content2_missing-untracked
606 A content1_missing_content1-tracked
609 A content1_missing_content1-tracked
607 A content1_missing_content1-untracked
610 A content1_missing_content1-untracked
608 A content1_missing_content3-tracked
611 A content1_missing_content3-tracked
609 A content1_missing_content3-untracked
612 A content1_missing_content3-untracked
610 A content1_missing_missing-tracked
613 A content1_missing_missing-tracked
611 A content1_missing_missing-untracked
614 A content1_missing_missing-untracked
612 $ hg commit -m 'base'
615 $ hg commit -m 'base'
613
616
614 (create a simple text version of the content)
617 (create a simple text version of the content)
615
618
616 $ python ../dircontent.py > ../content-base.txt
619 $ python ../dircontent.py > ../content-base.txt
617 $ cat ../content-base.txt
620 $ cat ../content-base.txt
618 content1 content1_content1_content1-tracked
621 content1 content1_content1_content1-tracked
619 content1 content1_content1_content1-untracked
622 content1 content1_content1_content1-untracked
620 content1 content1_content1_content3-tracked
623 content1 content1_content1_content3-tracked
621 content1 content1_content1_content3-untracked
624 content1 content1_content1_content3-untracked
622 content1 content1_content1_missing-tracked
625 content1 content1_content1_missing-tracked
623 content1 content1_content1_missing-untracked
626 content1 content1_content1_missing-untracked
624 content1 content1_content2_content1-tracked
627 content1 content1_content2_content1-tracked
625 content1 content1_content2_content1-untracked
628 content1 content1_content2_content1-untracked
626 content1 content1_content2_content2-tracked
629 content1 content1_content2_content2-tracked
627 content1 content1_content2_content2-untracked
630 content1 content1_content2_content2-untracked
628 content1 content1_content2_content3-tracked
631 content1 content1_content2_content3-tracked
629 content1 content1_content2_content3-untracked
632 content1 content1_content2_content3-untracked
630 content1 content1_content2_missing-tracked
633 content1 content1_content2_missing-tracked
631 content1 content1_content2_missing-untracked
634 content1 content1_content2_missing-untracked
632 content1 content1_missing_content1-tracked
635 content1 content1_missing_content1-tracked
633 content1 content1_missing_content1-untracked
636 content1 content1_missing_content1-untracked
634 content1 content1_missing_content3-tracked
637 content1 content1_missing_content3-tracked
635 content1 content1_missing_content3-untracked
638 content1 content1_missing_content3-untracked
636 content1 content1_missing_missing-tracked
639 content1 content1_missing_missing-tracked
637 content1 content1_missing_missing-untracked
640 content1 content1_missing_missing-untracked
638
641
639 Create parent changeset
642 Create parent changeset
640
643
641 $ python ../gen-revert-cases.py parent
644 $ python ../gen-revert-cases.py parent
642 $ hg addremove --similarity 0
645 $ hg addremove --similarity 0
643 removing content1_missing_content1-tracked
646 removing content1_missing_content1-tracked
644 removing content1_missing_content1-untracked
647 removing content1_missing_content1-untracked
645 removing content1_missing_content3-tracked
648 removing content1_missing_content3-tracked
646 removing content1_missing_content3-untracked
649 removing content1_missing_content3-untracked
647 removing content1_missing_missing-tracked
650 removing content1_missing_missing-tracked
648 removing content1_missing_missing-untracked
651 removing content1_missing_missing-untracked
649 adding missing_content2_content2-tracked
652 adding missing_content2_content2-tracked
650 adding missing_content2_content2-untracked
653 adding missing_content2_content2-untracked
651 adding missing_content2_content3-tracked
654 adding missing_content2_content3-tracked
652 adding missing_content2_content3-untracked
655 adding missing_content2_content3-untracked
653 adding missing_content2_missing-tracked
656 adding missing_content2_missing-tracked
654 adding missing_content2_missing-untracked
657 adding missing_content2_missing-untracked
655 $ hg status
658 $ hg status
656 M content1_content2_content1-tracked
659 M content1_content2_content1-tracked
657 M content1_content2_content1-untracked
660 M content1_content2_content1-untracked
658 M content1_content2_content2-tracked
661 M content1_content2_content2-tracked
659 M content1_content2_content2-untracked
662 M content1_content2_content2-untracked
660 M content1_content2_content3-tracked
663 M content1_content2_content3-tracked
661 M content1_content2_content3-untracked
664 M content1_content2_content3-untracked
662 M content1_content2_missing-tracked
665 M content1_content2_missing-tracked
663 M content1_content2_missing-untracked
666 M content1_content2_missing-untracked
664 A missing_content2_content2-tracked
667 A missing_content2_content2-tracked
665 A missing_content2_content2-untracked
668 A missing_content2_content2-untracked
666 A missing_content2_content3-tracked
669 A missing_content2_content3-tracked
667 A missing_content2_content3-untracked
670 A missing_content2_content3-untracked
668 A missing_content2_missing-tracked
671 A missing_content2_missing-tracked
669 A missing_content2_missing-untracked
672 A missing_content2_missing-untracked
670 R content1_missing_content1-tracked
673 R content1_missing_content1-tracked
671 R content1_missing_content1-untracked
674 R content1_missing_content1-untracked
672 R content1_missing_content3-tracked
675 R content1_missing_content3-tracked
673 R content1_missing_content3-untracked
676 R content1_missing_content3-untracked
674 R content1_missing_missing-tracked
677 R content1_missing_missing-tracked
675 R content1_missing_missing-untracked
678 R content1_missing_missing-untracked
676 $ hg commit -m 'parent'
679 $ hg commit -m 'parent'
677
680
678 (create a simple text version of the content)
681 (create a simple text version of the content)
679
682
680 $ python ../dircontent.py > ../content-parent.txt
683 $ python ../dircontent.py > ../content-parent.txt
681 $ cat ../content-parent.txt
684 $ cat ../content-parent.txt
682 content1 content1_content1_content1-tracked
685 content1 content1_content1_content1-tracked
683 content1 content1_content1_content1-untracked
686 content1 content1_content1_content1-untracked
684 content1 content1_content1_content3-tracked
687 content1 content1_content1_content3-tracked
685 content1 content1_content1_content3-untracked
688 content1 content1_content1_content3-untracked
686 content1 content1_content1_missing-tracked
689 content1 content1_content1_missing-tracked
687 content1 content1_content1_missing-untracked
690 content1 content1_content1_missing-untracked
688 content2 content1_content2_content1-tracked
691 content2 content1_content2_content1-tracked
689 content2 content1_content2_content1-untracked
692 content2 content1_content2_content1-untracked
690 content2 content1_content2_content2-tracked
693 content2 content1_content2_content2-tracked
691 content2 content1_content2_content2-untracked
694 content2 content1_content2_content2-untracked
692 content2 content1_content2_content3-tracked
695 content2 content1_content2_content3-tracked
693 content2 content1_content2_content3-untracked
696 content2 content1_content2_content3-untracked
694 content2 content1_content2_missing-tracked
697 content2 content1_content2_missing-tracked
695 content2 content1_content2_missing-untracked
698 content2 content1_content2_missing-untracked
696 content2 missing_content2_content2-tracked
699 content2 missing_content2_content2-tracked
697 content2 missing_content2_content2-untracked
700 content2 missing_content2_content2-untracked
698 content2 missing_content2_content3-tracked
701 content2 missing_content2_content3-tracked
699 content2 missing_content2_content3-untracked
702 content2 missing_content2_content3-untracked
700 content2 missing_content2_missing-tracked
703 content2 missing_content2_missing-tracked
701 content2 missing_content2_missing-untracked
704 content2 missing_content2_missing-untracked
702
705
703 Setup working directory
706 Setup working directory
704
707
705 $ python ../gen-revert-cases.py wc
708 $ python ../gen-revert-cases.py wc
706 $ hg addremove --similarity 0
709 $ hg addremove --similarity 0
707 adding content1_missing_content1-tracked
710 adding content1_missing_content1-tracked
708 adding content1_missing_content1-untracked
711 adding content1_missing_content1-untracked
709 adding content1_missing_content3-tracked
712 adding content1_missing_content3-tracked
710 adding content1_missing_content3-untracked
713 adding content1_missing_content3-untracked
711 adding missing_missing_content3-tracked
714 adding missing_missing_content3-tracked
712 adding missing_missing_content3-untracked
715 adding missing_missing_content3-untracked
713 $ hg forget *_*_*-untracked
716 $ hg forget *_*_*-untracked
714 $ rm *_*_missing-*
717 $ rm *_*_missing-*
715 $ hg status
718 $ hg status
716 M content1_content1_content3-tracked
719 M content1_content1_content3-tracked
717 M content1_content2_content1-tracked
720 M content1_content2_content1-tracked
718 M content1_content2_content3-tracked
721 M content1_content2_content3-tracked
719 M missing_content2_content3-tracked
722 M missing_content2_content3-tracked
720 A content1_missing_content1-tracked
723 A content1_missing_content1-tracked
721 A content1_missing_content3-tracked
724 A content1_missing_content3-tracked
722 A missing_missing_content3-tracked
725 A missing_missing_content3-tracked
723 R content1_content1_content1-untracked
726 R content1_content1_content1-untracked
724 R content1_content1_content3-untracked
727 R content1_content1_content3-untracked
725 R content1_content1_missing-untracked
728 R content1_content1_missing-untracked
726 R content1_content2_content1-untracked
729 R content1_content2_content1-untracked
727 R content1_content2_content2-untracked
730 R content1_content2_content2-untracked
728 R content1_content2_content3-untracked
731 R content1_content2_content3-untracked
729 R content1_content2_missing-untracked
732 R content1_content2_missing-untracked
730 R missing_content2_content2-untracked
733 R missing_content2_content2-untracked
731 R missing_content2_content3-untracked
734 R missing_content2_content3-untracked
732 R missing_content2_missing-untracked
735 R missing_content2_missing-untracked
733 ! content1_content1_missing-tracked
736 ! content1_content1_missing-tracked
734 ! content1_content2_missing-tracked
737 ! content1_content2_missing-tracked
735 ! missing_content2_missing-tracked
738 ! missing_content2_missing-tracked
736 ? content1_missing_content1-untracked
739 ? content1_missing_content1-untracked
737 ? content1_missing_content3-untracked
740 ? content1_missing_content3-untracked
738 ? missing_missing_content3-untracked
741 ? missing_missing_content3-untracked
739
742
740 $ hg status --rev 'desc("base")'
743 $ hg status --rev 'desc("base")'
741 M content1_content1_content3-tracked
744 M content1_content1_content3-tracked
742 M content1_content2_content2-tracked
745 M content1_content2_content2-tracked
743 M content1_content2_content3-tracked
746 M content1_content2_content3-tracked
744 M content1_missing_content3-tracked
747 M content1_missing_content3-tracked
745 A missing_content2_content2-tracked
748 A missing_content2_content2-tracked
746 A missing_content2_content3-tracked
749 A missing_content2_content3-tracked
747 A missing_missing_content3-tracked
750 A missing_missing_content3-tracked
748 R content1_content1_content1-untracked
751 R content1_content1_content1-untracked
749 R content1_content1_content3-untracked
752 R content1_content1_content3-untracked
750 R content1_content1_missing-untracked
753 R content1_content1_missing-untracked
751 R content1_content2_content1-untracked
754 R content1_content2_content1-untracked
752 R content1_content2_content2-untracked
755 R content1_content2_content2-untracked
753 R content1_content2_content3-untracked
756 R content1_content2_content3-untracked
754 R content1_content2_missing-untracked
757 R content1_content2_missing-untracked
755 R content1_missing_content1-untracked
758 R content1_missing_content1-untracked
756 R content1_missing_content3-untracked
759 R content1_missing_content3-untracked
757 R content1_missing_missing-tracked
760 R content1_missing_missing-tracked
758 R content1_missing_missing-untracked
761 R content1_missing_missing-untracked
759 ! content1_content1_missing-tracked
762 ! content1_content1_missing-tracked
760 ! content1_content2_missing-tracked
763 ! content1_content2_missing-tracked
761 ! missing_content2_missing-tracked
764 ! missing_content2_missing-tracked
762 ? missing_missing_content3-untracked
765 ? missing_missing_content3-untracked
763
766
764 (create a simple text version of the content)
767 (create a simple text version of the content)
765
768
766 $ python ../dircontent.py > ../content-wc.txt
769 $ python ../dircontent.py > ../content-wc.txt
767 $ cat ../content-wc.txt
770 $ cat ../content-wc.txt
768 content1 content1_content1_content1-tracked
771 content1 content1_content1_content1-tracked
769 content1 content1_content1_content1-untracked
772 content1 content1_content1_content1-untracked
770 content3 content1_content1_content3-tracked
773 content3 content1_content1_content3-tracked
771 content3 content1_content1_content3-untracked
774 content3 content1_content1_content3-untracked
772 content1 content1_content2_content1-tracked
775 content1 content1_content2_content1-tracked
773 content1 content1_content2_content1-untracked
776 content1 content1_content2_content1-untracked
774 content2 content1_content2_content2-tracked
777 content2 content1_content2_content2-tracked
775 content2 content1_content2_content2-untracked
778 content2 content1_content2_content2-untracked
776 content3 content1_content2_content3-tracked
779 content3 content1_content2_content3-tracked
777 content3 content1_content2_content3-untracked
780 content3 content1_content2_content3-untracked
778 content1 content1_missing_content1-tracked
781 content1 content1_missing_content1-tracked
779 content1 content1_missing_content1-untracked
782 content1 content1_missing_content1-untracked
780 content3 content1_missing_content3-tracked
783 content3 content1_missing_content3-tracked
781 content3 content1_missing_content3-untracked
784 content3 content1_missing_content3-untracked
782 content2 missing_content2_content2-tracked
785 content2 missing_content2_content2-tracked
783 content2 missing_content2_content2-untracked
786 content2 missing_content2_content2-untracked
784 content3 missing_content2_content3-tracked
787 content3 missing_content2_content3-tracked
785 content3 missing_content2_content3-untracked
788 content3 missing_content2_content3-untracked
786 content3 missing_missing_content3-tracked
789 content3 missing_missing_content3-tracked
787 content3 missing_missing_content3-untracked
790 content3 missing_missing_content3-untracked
788
791
789 $ cd ..
792 $ cd ..
790
793
791 Test revert --all to parent content
794 Test revert --all to parent content
792 -----------------------------------
795 -----------------------------------
793
796
794 (setup from reference repo)
797 (setup from reference repo)
795
798
796 $ cp -r revert-ref revert-parent-all
799 $ cp -r revert-ref revert-parent-all
797 $ cd revert-parent-all
800 $ cd revert-parent-all
798
801
799 check revert output
802 check revert output
800
803
801 $ hg revert --all
804 $ hg revert --all
802 undeleting content1_content1_content1-untracked
805 undeleting content1_content1_content1-untracked
803 reverting content1_content1_content3-tracked
806 reverting content1_content1_content3-tracked
804 undeleting content1_content1_content3-untracked
807 undeleting content1_content1_content3-untracked
805 reverting content1_content1_missing-tracked
808 reverting content1_content1_missing-tracked
806 undeleting content1_content1_missing-untracked
809 undeleting content1_content1_missing-untracked
807 reverting content1_content2_content1-tracked
810 reverting content1_content2_content1-tracked
808 undeleting content1_content2_content1-untracked
811 undeleting content1_content2_content1-untracked
809 undeleting content1_content2_content2-untracked
812 undeleting content1_content2_content2-untracked
810 reverting content1_content2_content3-tracked
813 reverting content1_content2_content3-tracked
811 undeleting content1_content2_content3-untracked
814 undeleting content1_content2_content3-untracked
812 reverting content1_content2_missing-tracked
815 reverting content1_content2_missing-tracked
813 undeleting content1_content2_missing-untracked
816 undeleting content1_content2_missing-untracked
814 forgetting content1_missing_content1-tracked
817 forgetting content1_missing_content1-tracked
815 forgetting content1_missing_content3-tracked
818 forgetting content1_missing_content3-tracked
816 undeleting missing_content2_content2-untracked
819 undeleting missing_content2_content2-untracked
817 reverting missing_content2_content3-tracked
820 reverting missing_content2_content3-tracked
818 undeleting missing_content2_content3-untracked
821 undeleting missing_content2_content3-untracked
819 reverting missing_content2_missing-tracked
822 reverting missing_content2_missing-tracked
820 undeleting missing_content2_missing-untracked
823 undeleting missing_content2_missing-untracked
821 forgetting missing_missing_content3-tracked
824 forgetting missing_missing_content3-tracked
822
825
823 Compare resulting directory with revert target.
826 Compare resulting directory with revert target.
824
827
825 The diff is filtered to include change only. The only difference should be
828 The diff is filtered to include change only. The only difference should be
826 additional `.orig` backup file when applicable.
829 additional `.orig` backup file when applicable.
827
830
828 $ python ../dircontent.py > ../content-parent-all.txt
831 $ python ../dircontent.py > ../content-parent-all.txt
829 $ cd ..
832 $ cd ..
830 $ diff -U 0 -- content-parent.txt content-parent-all.txt | grep _
833 $ diff -U 0 -- content-parent.txt content-parent-all.txt | grep _
831 +content3 content1_content1_content3-tracked.orig
834 +content3 content1_content1_content3-tracked.orig
832 +content3 content1_content1_content3-untracked.orig
835 +content3 content1_content1_content3-untracked.orig
833 +content1 content1_content2_content1-tracked.orig
836 +content1 content1_content2_content1-tracked.orig
834 +content1 content1_content2_content1-untracked.orig
837 +content1 content1_content2_content1-untracked.orig
835 +content3 content1_content2_content3-tracked.orig
838 +content3 content1_content2_content3-tracked.orig
836 +content3 content1_content2_content3-untracked.orig
839 +content3 content1_content2_content3-untracked.orig
837 +content1 content1_missing_content1-tracked
840 +content1 content1_missing_content1-tracked
838 +content1 content1_missing_content1-untracked
841 +content1 content1_missing_content1-untracked
839 +content3 content1_missing_content3-tracked
842 +content3 content1_missing_content3-tracked
840 +content3 content1_missing_content3-untracked
843 +content3 content1_missing_content3-untracked
841 +content3 missing_content2_content3-tracked.orig
844 +content3 missing_content2_content3-tracked.orig
842 +content3 missing_content2_content3-untracked.orig
845 +content3 missing_content2_content3-untracked.orig
843 +content3 missing_missing_content3-tracked
846 +content3 missing_missing_content3-tracked
844 +content3 missing_missing_content3-untracked
847 +content3 missing_missing_content3-untracked
845
848
846 Test revert --all to "base" content
849 Test revert --all to "base" content
847 -----------------------------------
850 -----------------------------------
848
851
849 (setup from reference repo)
852 (setup from reference repo)
850
853
851 $ cp -r revert-ref revert-base-all
854 $ cp -r revert-ref revert-base-all
852 $ cd revert-base-all
855 $ cd revert-base-all
853
856
854 check revert output
857 check revert output
855
858
856 $ hg revert --all --rev 'desc(base)'
859 $ hg revert --all --rev 'desc(base)'
857 undeleting content1_content1_content1-untracked
860 undeleting content1_content1_content1-untracked
858 reverting content1_content1_content3-tracked
861 reverting content1_content1_content3-tracked
859 undeleting content1_content1_content3-untracked
862 undeleting content1_content1_content3-untracked
860 reverting content1_content1_missing-tracked
863 reverting content1_content1_missing-tracked
861 undeleting content1_content1_missing-untracked
864 undeleting content1_content1_missing-untracked
862 undeleting content1_content2_content1-untracked
865 undeleting content1_content2_content1-untracked
863 reverting content1_content2_content2-tracked
866 reverting content1_content2_content2-tracked
864 undeleting content1_content2_content2-untracked
867 undeleting content1_content2_content2-untracked
865 reverting content1_content2_content3-tracked
868 reverting content1_content2_content3-tracked
866 undeleting content1_content2_content3-untracked
869 undeleting content1_content2_content3-untracked
867 reverting content1_content2_missing-tracked
870 reverting content1_content2_missing-tracked
868 undeleting content1_content2_missing-untracked
871 undeleting content1_content2_missing-untracked
869 adding content1_missing_content1-untracked
872 adding content1_missing_content1-untracked
870 reverting content1_missing_content3-tracked
873 reverting content1_missing_content3-tracked
871 adding content1_missing_content3-untracked
874 adding content1_missing_content3-untracked
872 adding content1_missing_missing-tracked
875 adding content1_missing_missing-tracked
873 adding content1_missing_missing-untracked
876 adding content1_missing_missing-untracked
874 removing missing_content2_content2-tracked
877 removing missing_content2_content2-tracked
875 removing missing_content2_content3-tracked
878 removing missing_content2_content3-tracked
876 removing missing_content2_missing-tracked
879 removing missing_content2_missing-tracked
877 forgetting missing_missing_content3-tracked
880 forgetting missing_missing_content3-tracked
878
881
879 Compare resulting directory with revert target.
882 Compare resulting directory with revert target.
880
883
881 The diff is filtered to include change only. The only difference should be
884 The diff is filtered to include change only. The only difference should be
882 additional `.orig` backup file when applicable.
885 additional `.orig` backup file when applicable.
883
886
884 $ python ../dircontent.py > ../content-base-all.txt
887 $ python ../dircontent.py > ../content-base-all.txt
885 $ cd ..
888 $ cd ..
886 $ diff -U 0 -- content-base.txt content-base-all.txt | grep _
889 $ diff -U 0 -- content-base.txt content-base-all.txt | grep _
887 +content3 content1_content1_content3-tracked.orig
890 +content3 content1_content1_content3-tracked.orig
888 +content3 content1_content1_content3-untracked.orig
891 +content3 content1_content1_content3-untracked.orig
889 +content2 content1_content2_content2-untracked.orig
892 +content2 content1_content2_content2-untracked.orig
890 +content3 content1_content2_content3-tracked.orig
893 +content3 content1_content2_content3-tracked.orig
891 +content3 content1_content2_content3-untracked.orig
894 +content3 content1_content2_content3-untracked.orig
892 +content3 content1_missing_content3-tracked.orig
895 +content3 content1_missing_content3-tracked.orig
893 +content3 content1_missing_content3-untracked.orig
896 +content3 content1_missing_content3-untracked.orig
894 +content2 missing_content2_content2-untracked
897 +content2 missing_content2_content2-untracked
895 +content3 missing_content2_content3-tracked.orig
898 +content3 missing_content2_content3-tracked.orig
896 +content3 missing_content2_content3-untracked
899 +content3 missing_content2_content3-untracked
897 +content3 missing_missing_content3-tracked
900 +content3 missing_missing_content3-tracked
898 +content3 missing_missing_content3-untracked
901 +content3 missing_missing_content3-untracked
899
902
900 Test revert to parent content with explicit file name
903 Test revert to parent content with explicit file name
901 -----------------------------------------------------
904 -----------------------------------------------------
902
905
903 (setup from reference repo)
906 (setup from reference repo)
904
907
905 $ cp -r revert-ref revert-parent-explicit
908 $ cp -r revert-ref revert-parent-explicit
906 $ cd revert-parent-explicit
909 $ cd revert-parent-explicit
907
910
908 revert all files individually and check the output
911 revert all files individually and check the output
909 (output is expected to be different than in the --all case)
912 (output is expected to be different than in the --all case)
910
913
911 $ for file in `python ../gen-revert-cases.py filelist`; do
914 $ for file in `python ../gen-revert-cases.py filelist`; do
912 > echo '### revert for:' $file;
915 > echo '### revert for:' $file;
913 > hg revert $file;
916 > hg revert $file;
914 > echo
917 > echo
915 > done
918 > done
919 ### revert for: content1_content1_content1-tracked
920 no changes needed to content1_content1_content1-tracked
921
922 ### revert for: content1_content1_content1-untracked
923
924 ### revert for: content1_content1_content3-tracked
925
926 ### revert for: content1_content1_content3-untracked
927
928 ### revert for: content1_content1_missing-tracked
929
930 ### revert for: content1_content1_missing-untracked
931
932 ### revert for: content1_content2_content1-tracked
933
934 ### revert for: content1_content2_content1-untracked
935
936 ### revert for: content1_content2_content2-tracked
937 no changes needed to content1_content2_content2-tracked
938
939 ### revert for: content1_content2_content2-untracked
940
941 ### revert for: content1_content2_content3-tracked
942
943 ### revert for: content1_content2_content3-untracked
944
945 ### revert for: content1_content2_missing-tracked
946
947 ### revert for: content1_content2_missing-untracked
948
949 ### revert for: content1_missing_content1-tracked
950
951 ### revert for: content1_missing_content1-untracked
952 file not managed: content1_missing_content1-untracked
953
954 ### revert for: content1_missing_content3-tracked
955
956 ### revert for: content1_missing_content3-untracked
957 file not managed: content1_missing_content3-untracked
958
959 ### revert for: content1_missing_missing-tracked
960 content1_missing_missing-tracked: no such file in rev * (glob)
961
962 ### revert for: content1_missing_missing-untracked
963 content1_missing_missing-untracked: no such file in rev * (glob)
964
916 ### revert for: missing_content2_content2-tracked
965 ### revert for: missing_content2_content2-tracked
917 no changes needed to missing_content2_content2-tracked
966 no changes needed to missing_content2_content2-tracked
918
967
919 ### revert for: missing_content2_missing-tracked
920
921 ### revert for: missing_content2_content2-untracked
968 ### revert for: missing_content2_content2-untracked
922
969
923 ### revert for: missing_content2_missing-untracked
924
925 ### revert for: missing_content2_content3-untracked
926
927 ### revert for: missing_content2_content3-tracked
970 ### revert for: missing_content2_content3-tracked
928
971
929 ### revert for: content1_content1_content1-tracked
972 ### revert for: missing_content2_content3-untracked
930 no changes needed to content1_content1_content1-tracked
931
973
932 ### revert for: content1_content1_missing-tracked
974 ### revert for: missing_content2_missing-tracked
933
975
934 ### revert for: content1_content1_content1-untracked
976 ### revert for: missing_content2_missing-untracked
935
936 ### revert for: content1_content1_missing-untracked
937
977
938 ### revert for: content1_content1_content3-untracked
978 ### revert for: missing_missing_content3-tracked
939
979
940 ### revert for: content1_content1_content3-tracked
980 ### revert for: missing_missing_content3-untracked
981 file not managed: missing_missing_content3-untracked
941
982
942 ### revert for: missing_missing_missing-tracked
983 ### revert for: missing_missing_missing-tracked
943 missing_missing_missing-tracked: no such file in rev * (glob)
984 missing_missing_missing-tracked: no such file in rev * (glob)
944
985
945 ### revert for: missing_missing_missing-untracked
986 ### revert for: missing_missing_missing-untracked
946 missing_missing_missing-untracked: no such file in rev * (glob)
987 missing_missing_missing-untracked: no such file in rev * (glob)
947
988
948 ### revert for: missing_missing_content3-untracked
949 file not managed: missing_missing_content3-untracked
950
951 ### revert for: missing_missing_content3-tracked
952
953 ### revert for: content1_content2_content2-tracked
954 no changes needed to content1_content2_content2-tracked
955
956 ### revert for: content1_content2_missing-tracked
957
958 ### revert for: content1_content2_content1-tracked
959
960 ### revert for: content1_content2_content2-untracked
961
962 ### revert for: content1_content2_missing-untracked
963
964 ### revert for: content1_content2_content1-untracked
965
966 ### revert for: content1_content2_content3-untracked
967
968 ### revert for: content1_content2_content3-tracked
969
970 ### revert for: content1_missing_missing-tracked
971 content1_missing_missing-tracked: no such file in rev * (glob)
972
973 ### revert for: content1_missing_content1-tracked
974
975 ### revert for: content1_missing_missing-untracked
976 content1_missing_missing-untracked: no such file in rev * (glob)
977
978 ### revert for: content1_missing_content1-untracked
979 file not managed: content1_missing_content1-untracked
980
981 ### revert for: content1_missing_content3-untracked
982 file not managed: content1_missing_content3-untracked
983
984 ### revert for: content1_missing_content3-tracked
985
986
989
987 check resulting directory against the --all run
990 check resulting directory against the --all run
988 (There should be no difference)
991 (There should be no difference)
989
992
990 $ python ../dircontent.py > ../content-parent-explicit.txt
993 $ python ../dircontent.py > ../content-parent-explicit.txt
991 $ cd ..
994 $ cd ..
992 $ diff -U 0 -- content-parent-all.txt content-parent-explicit.txt | grep _
995 $ diff -U 0 -- content-parent-all.txt content-parent-explicit.txt | grep _
993 [1]
996 [1]
994
997
995 Test revert to "base" content with explicit file name
998 Test revert to "base" content with explicit file name
996 -----------------------------------------------------
999 -----------------------------------------------------
997
1000
998 (setup from reference repo)
1001 (setup from reference repo)
999
1002
1000 $ cp -r revert-ref revert-base-explicit
1003 $ cp -r revert-ref revert-base-explicit
1001 $ cd revert-base-explicit
1004 $ cd revert-base-explicit
1002
1005
1003 revert all files individually and check the output
1006 revert all files individually and check the output
1004 (output is expected to be different than in the --all case)
1007 (output is expected to be different than in the --all case)
1005
1008
1006 $ for file in `python ../gen-revert-cases.py filelist`; do
1009 $ for file in `python ../gen-revert-cases.py filelist`; do
1007 > echo '### revert for:' $file;
1010 > echo '### revert for:' $file;
1008 > hg revert $file --rev 'desc(base)';
1011 > hg revert $file --rev 'desc(base)';
1009 > echo
1012 > echo
1010 > done
1013 > done
1011 ### revert for: missing_content2_content2-tracked
1014 ### revert for: content1_content1_content1-tracked
1015 no changes needed to content1_content1_content1-tracked
1016
1017 ### revert for: content1_content1_content1-untracked
1018
1019 ### revert for: content1_content1_content3-tracked
1020
1021 ### revert for: content1_content1_content3-untracked
1022
1023 ### revert for: content1_content1_missing-tracked
1024
1025 ### revert for: content1_content1_missing-untracked
1026
1027 ### revert for: content1_content2_content1-tracked
1028 no changes needed to content1_content2_content1-tracked
1029
1030 ### revert for: content1_content2_content1-untracked
1031
1032 ### revert for: content1_content2_content2-tracked
1033
1034 ### revert for: content1_content2_content2-untracked
1012
1035
1013 ### revert for: missing_content2_missing-tracked
1036 ### revert for: content1_content2_content3-tracked
1037
1038 ### revert for: content1_content2_content3-untracked
1039
1040 ### revert for: content1_content2_missing-tracked
1041
1042 ### revert for: content1_content2_missing-untracked
1043
1044 ### revert for: content1_missing_content1-tracked
1045 no changes needed to content1_missing_content1-tracked
1046
1047 ### revert for: content1_missing_content1-untracked
1048
1049 ### revert for: content1_missing_content3-tracked
1050
1051 ### revert for: content1_missing_content3-untracked
1052
1053 ### revert for: content1_missing_missing-tracked
1054
1055 ### revert for: content1_missing_missing-untracked
1056
1057 ### revert for: missing_content2_content2-tracked
1014
1058
1015 ### revert for: missing_content2_content2-untracked
1059 ### revert for: missing_content2_content2-untracked
1016 no changes needed to missing_content2_content2-untracked
1060 no changes needed to missing_content2_content2-untracked
1017
1061
1018 ### revert for: missing_content2_missing-untracked
1062 ### revert for: missing_content2_content3-tracked
1019 no changes needed to missing_content2_missing-untracked
1020
1063
1021 ### revert for: missing_content2_content3-untracked
1064 ### revert for: missing_content2_content3-untracked
1022 no changes needed to missing_content2_content3-untracked
1065 no changes needed to missing_content2_content3-untracked
1023
1066
1024 ### revert for: missing_content2_content3-tracked
1067 ### revert for: missing_content2_missing-tracked
1025
1068
1026 ### revert for: content1_content1_content1-tracked
1069 ### revert for: missing_content2_missing-untracked
1027 no changes needed to content1_content1_content1-tracked
1070 no changes needed to missing_content2_missing-untracked
1028
1029 ### revert for: content1_content1_missing-tracked
1030
1071
1031 ### revert for: content1_content1_content1-untracked
1072 ### revert for: missing_missing_content3-tracked
1032
1033 ### revert for: content1_content1_missing-untracked
1034
1073
1035 ### revert for: content1_content1_content3-untracked
1074 ### revert for: missing_missing_content3-untracked
1036
1075 file not managed: missing_missing_content3-untracked
1037 ### revert for: content1_content1_content3-tracked
1038
1076
1039 ### revert for: missing_missing_missing-tracked
1077 ### revert for: missing_missing_missing-tracked
1040 missing_missing_missing-tracked: no such file in rev * (glob)
1078 missing_missing_missing-tracked: no such file in rev * (glob)
1041
1079
1042 ### revert for: missing_missing_missing-untracked
1080 ### revert for: missing_missing_missing-untracked
1043 missing_missing_missing-untracked: no such file in rev * (glob)
1081 missing_missing_missing-untracked: no such file in rev * (glob)
1044
1082
1045 ### revert for: missing_missing_content3-untracked
1046 file not managed: missing_missing_content3-untracked
1047
1048 ### revert for: missing_missing_content3-tracked
1049
1050 ### revert for: content1_content2_content2-tracked
1051
1052 ### revert for: content1_content2_missing-tracked
1053
1054 ### revert for: content1_content2_content1-tracked
1055 no changes needed to content1_content2_content1-tracked
1056
1057 ### revert for: content1_content2_content2-untracked
1058
1059 ### revert for: content1_content2_missing-untracked
1060
1061 ### revert for: content1_content2_content1-untracked
1062
1063 ### revert for: content1_content2_content3-untracked
1064
1065 ### revert for: content1_content2_content3-tracked
1066
1067 ### revert for: content1_missing_missing-tracked
1068
1069 ### revert for: content1_missing_content1-tracked
1070 no changes needed to content1_missing_content1-tracked
1071
1072 ### revert for: content1_missing_missing-untracked
1073
1074 ### revert for: content1_missing_content1-untracked
1075
1076 ### revert for: content1_missing_content3-untracked
1077
1078 ### revert for: content1_missing_content3-tracked
1079
1080
1083
1081 check resulting directory against the --all run
1084 check resulting directory against the --all run
1082 (There should be no difference)
1085 (There should be no difference)
1083
1086
1084 $ python ../dircontent.py > ../content-base-explicit.txt
1087 $ python ../dircontent.py > ../content-base-explicit.txt
1085 $ cd ..
1088 $ cd ..
1086 $ diff -U 0 -- content-base-all.txt content-base-explicit.txt | grep _
1089 $ diff -U 0 -- content-base-all.txt content-base-explicit.txt | grep _
1087 [1]
1090 [1]
General Comments 0
You need to be logged in to leave comments. Login now