##// END OF EJS Templates
test-revert: reverting an addition is the same as removing...
Martin von Zweigbergk -
r23154:690db741 default
parent child Browse files
Show More
@@ -1,1156 +1,1134
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 working directory
401 This section tests most of the possible combinations of working directory
402 changes and inter-revision changes. The number of possible cases is significant
402 changes and inter-revision changes. The number of possible cases is significant
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 generating and testing all of them to allow safe refactoring of the revert code.
404 generating 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 changes between, on one side the working directory and its parent and on
407 changes between, on one side the working directory and its parent and on
408 the other side, changes between a revert target (--rev) and working directory
408 the other side, changes between a revert target (--rev) and working directory
409 parent. The three states generated are:
409 parent. The 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 file generated have names of the form:
415 The file generated have names of the form:
416
416
417 <changeset-state>_<working-copy-state>
417 <changeset-state>_<working-copy-state>
418
418
419 Here, "changeset-state" conveys the state in "base" and "parent" (or the change
419 Here, "changeset-state" conveys the state in "base" and "parent" (or the change
420 that happen between them), "working-copy-state" is self explanatory.
420 that happen between them), "working-copy-state" is self explanatory.
421
421
422 All known states are not tested yet. See inline documentation for details.
422 All known states are not tested yet. See inline documentation for details.
423 Special cases from merge and rename are not tested by this section.
423 Special cases from merge and rename are not tested by this section.
424
424
425 Write the python script to disk
425 Write the python script to disk
426 -------------------------------
426 -------------------------------
427
427
428 $ cat << EOF > gen-revert-cases.py
428 $ cat << EOF > gen-revert-cases.py
429 > # generate proper file state to test revert behavior
429 > # generate proper file state to test revert behavior
430 > import sys
430 > import sys
431 > import os
431 > import os
432 >
432 >
433 > # content of the file in "base" and "parent"
433 > # content of the file in "base" and "parent"
434 > # None means no file at all
434 > # None means no file at all
435 > ctxcontent = {
435 > ctxcontent = {
436 > # clean: no change from base to parent
436 > # clean: no change from base to parent
437 > 'clean': ['base', 'base'],
437 > 'clean': ['base', 'base'],
438 > # modified: file content change from base to parent
438 > # modified: file content change from base to parent
439 > 'modified': ['base', 'parent'],
439 > 'modified': ['base', 'parent'],
440 > # added: file is missing from base and added in parent
440 > # added: file is missing from base and added in parent
441 > 'added': [None, 'parent'],
441 > 'added': [None, 'parent'],
442 > # removed: file exist in base but is removed from parent
442 > # removed: file exist in base but is removed from parent
443 > 'removed': ['base', None],
443 > 'removed': ['base', None],
444 > # file exist neither in base not in parent
444 > # file exist neither in base not in parent
445 > 'missing': [None, None],
445 > 'missing': [None, None],
446 > }
446 > }
447 >
447 >
448 > # content of file in working copy
448 > # content of file in working copy
449 > wccontent = {
449 > wccontent = {
450 > # clean: wc content is the same as parent
450 > # clean: wc content is the same as parent
451 > 'clean': lambda cc: cc[1],
451 > 'clean': lambda cc: cc[1],
452 > # revert: wc content is the same as base
452 > # revert: wc content is the same as base
453 > 'revert': lambda cc: cc[0],
453 > 'revert': lambda cc: cc[0],
454 > # wc: file exist with a content different from base and parent
454 > # wc: file exist with a content different from base and parent
455 > 'wc': lambda cc: 'wc',
455 > 'wc': lambda cc: 'wc',
456 > # removed: file is missing and marked as untracked
456 > # removed: file is missing and marked as untracked
457 > 'removed': lambda cc: None,
457 > 'removed': lambda cc: None,
458 > # deleted: file is recorded as tracked but missing
458 > # deleted: file is recorded as tracked but missing
459 > # rely on file deletion outside of this script
459 > # rely on file deletion outside of this script
460 > 'deleted': lambda cc:'TOBEDELETED',
460 > 'deleted': lambda cc:'TOBEDELETED',
461 > }
461 > }
462 > # untracked-X is a version of X where the file is not tracked (? unknown)
462 > # untracked-X is a version of X where the file is not tracked (? unknown)
463 > wccontent['untracked-clean'] = wccontent['clean']
463 > wccontent['untracked-clean'] = wccontent['clean']
464 > wccontent['untracked-revert'] = wccontent['revert']
464 > wccontent['untracked-revert'] = wccontent['revert']
465 > wccontent['untracked-wc'] = wccontent['wc']
465 > wccontent['untracked-wc'] = wccontent['wc']
466 >
466 >
467 > # build the combination of possible states
467 > # build the combination of possible states
468 > combination = []
468 > combination = []
469 > for ctxkey, ctxvalue in ctxcontent.iteritems():
469 > for ctxkey, ctxvalue in ctxcontent.iteritems():
470 > for wckey in wccontent:
470 > for wckey in wccontent:
471 > if (ctxvalue[0] == ctxvalue[1] and 'revert' in wckey):
471 > if (ctxvalue[0] == ctxvalue[1] and 'revert' in wckey):
472 > continue
472 > continue
473 > if not ctxvalue[0] and 'revert' in wckey:
474 > continue
473 > filename = "%s_%s" % (ctxkey, wckey)
475 > filename = "%s_%s" % (ctxkey, wckey)
474 > combination.append((filename, ctxkey, wckey))
476 > combination.append((filename, ctxkey, wckey))
475 >
477 >
476 > # make sure we have stable output
478 > # make sure we have stable output
477 > combination.sort()
479 > combination.sort()
478 >
480 >
479 > # retrieve the state we must generate
481 > # retrieve the state we must generate
480 > target = sys.argv[1]
482 > target = sys.argv[1]
481 >
483 >
482 > # compute file content
484 > # compute file content
483 > content = []
485 > content = []
484 > for filename, ctxkey, wckey in combination:
486 > for filename, ctxkey, wckey in combination:
485 > cc = ctxcontent[ctxkey]
487 > cc = ctxcontent[ctxkey]
486 > if target == 'filelist':
488 > if target == 'filelist':
487 > print filename
489 > print filename
488 > elif target == 'base':
490 > elif target == 'base':
489 > content.append((filename, cc[0]))
491 > content.append((filename, cc[0]))
490 > elif target == 'parent':
492 > elif target == 'parent':
491 > content.append((filename, cc[1]))
493 > content.append((filename, cc[1]))
492 > elif target == 'wc':
494 > elif target == 'wc':
493 > content.append((filename, wccontent[wckey](cc)))
495 > content.append((filename, wccontent[wckey](cc)))
494 > else:
496 > else:
495 > print >> sys.stderr, "unknown target:", target
497 > print >> sys.stderr, "unknown target:", target
496 > sys.exit(1)
498 > sys.exit(1)
497 >
499 >
498 > # write actual content
500 > # write actual content
499 > for filename, data in content:
501 > for filename, data in content:
500 > if data is not None:
502 > if data is not None:
501 > f = open(filename, 'w')
503 > f = open(filename, 'w')
502 > f.write(data + '\n')
504 > f.write(data + '\n')
503 > f.close()
505 > f.close()
504 > elif os.path.exists(filename):
506 > elif os.path.exists(filename):
505 > os.remove(filename)
507 > os.remove(filename)
506 > EOF
508 > EOF
507
509
508 check list of planned files
510 check list of planned files
509
511
510 $ python gen-revert-cases.py filelist
512 $ python gen-revert-cases.py filelist
511 added_clean
513 added_clean
512 added_deleted
514 added_deleted
513 added_removed
515 added_removed
514 added_revert
515 added_untracked-clean
516 added_untracked-clean
516 added_untracked-revert
517 added_untracked-wc
517 added_untracked-wc
518 added_wc
518 added_wc
519 clean_clean
519 clean_clean
520 clean_deleted
520 clean_deleted
521 clean_removed
521 clean_removed
522 clean_untracked-clean
522 clean_untracked-clean
523 clean_untracked-wc
523 clean_untracked-wc
524 clean_wc
524 clean_wc
525 missing_clean
525 missing_clean
526 missing_deleted
526 missing_deleted
527 missing_removed
527 missing_removed
528 missing_untracked-clean
528 missing_untracked-clean
529 missing_untracked-wc
529 missing_untracked-wc
530 missing_wc
530 missing_wc
531 modified_clean
531 modified_clean
532 modified_deleted
532 modified_deleted
533 modified_removed
533 modified_removed
534 modified_revert
534 modified_revert
535 modified_untracked-clean
535 modified_untracked-clean
536 modified_untracked-revert
536 modified_untracked-revert
537 modified_untracked-wc
537 modified_untracked-wc
538 modified_wc
538 modified_wc
539 removed_clean
539 removed_clean
540 removed_deleted
540 removed_deleted
541 removed_removed
541 removed_removed
542 removed_revert
542 removed_revert
543 removed_untracked-clean
543 removed_untracked-clean
544 removed_untracked-revert
544 removed_untracked-revert
545 removed_untracked-wc
545 removed_untracked-wc
546 removed_wc
546 removed_wc
547
547
548 Script to make a simple text version of the content
548 Script to make a simple text version of the content
549 ---------------------------------------------------
549 ---------------------------------------------------
550
550
551 $ cat << EOF >> dircontent.py
551 $ cat << EOF >> dircontent.py
552 > # generate a simple text view of the directory for easy comparison
552 > # generate a simple text view of the directory for easy comparison
553 > import os
553 > import os
554 > files = os.listdir('.')
554 > files = os.listdir('.')
555 > files.sort()
555 > files.sort()
556 > for filename in files:
556 > for filename in files:
557 > if os.path.isdir(filename):
557 > if os.path.isdir(filename):
558 > continue
558 > continue
559 > content = open(filename).read()
559 > content = open(filename).read()
560 > print '%-6s %s' % (content.strip(), filename)
560 > print '%-6s %s' % (content.strip(), filename)
561 > EOF
561 > EOF
562
562
563 Generate appropriate repo state
563 Generate appropriate repo state
564 -------------------------------
564 -------------------------------
565
565
566 $ hg init revert-ref
566 $ hg init revert-ref
567 $ cd revert-ref
567 $ cd revert-ref
568
568
569 Generate base changeset
569 Generate base changeset
570
570
571 $ python ../gen-revert-cases.py base
571 $ python ../gen-revert-cases.py base
572 $ hg addremove --similarity 0
572 $ hg addremove --similarity 0
573 adding clean_clean
573 adding clean_clean
574 adding clean_deleted
574 adding clean_deleted
575 adding clean_removed
575 adding clean_removed
576 adding clean_untracked-clean
576 adding clean_untracked-clean
577 adding clean_untracked-wc
577 adding clean_untracked-wc
578 adding clean_wc
578 adding clean_wc
579 adding modified_clean
579 adding modified_clean
580 adding modified_deleted
580 adding modified_deleted
581 adding modified_removed
581 adding modified_removed
582 adding modified_revert
582 adding modified_revert
583 adding modified_untracked-clean
583 adding modified_untracked-clean
584 adding modified_untracked-revert
584 adding modified_untracked-revert
585 adding modified_untracked-wc
585 adding modified_untracked-wc
586 adding modified_wc
586 adding modified_wc
587 adding removed_clean
587 adding removed_clean
588 adding removed_deleted
588 adding removed_deleted
589 adding removed_removed
589 adding removed_removed
590 adding removed_revert
590 adding removed_revert
591 adding removed_untracked-clean
591 adding removed_untracked-clean
592 adding removed_untracked-revert
592 adding removed_untracked-revert
593 adding removed_untracked-wc
593 adding removed_untracked-wc
594 adding removed_wc
594 adding removed_wc
595 $ hg status
595 $ hg status
596 A clean_clean
596 A clean_clean
597 A clean_deleted
597 A clean_deleted
598 A clean_removed
598 A clean_removed
599 A clean_untracked-clean
599 A clean_untracked-clean
600 A clean_untracked-wc
600 A clean_untracked-wc
601 A clean_wc
601 A clean_wc
602 A modified_clean
602 A modified_clean
603 A modified_deleted
603 A modified_deleted
604 A modified_removed
604 A modified_removed
605 A modified_revert
605 A modified_revert
606 A modified_untracked-clean
606 A modified_untracked-clean
607 A modified_untracked-revert
607 A modified_untracked-revert
608 A modified_untracked-wc
608 A modified_untracked-wc
609 A modified_wc
609 A modified_wc
610 A removed_clean
610 A removed_clean
611 A removed_deleted
611 A removed_deleted
612 A removed_removed
612 A removed_removed
613 A removed_revert
613 A removed_revert
614 A removed_untracked-clean
614 A removed_untracked-clean
615 A removed_untracked-revert
615 A removed_untracked-revert
616 A removed_untracked-wc
616 A removed_untracked-wc
617 A removed_wc
617 A removed_wc
618 $ hg commit -m 'base'
618 $ hg commit -m 'base'
619
619
620 (create a simple text version of the content)
620 (create a simple text version of the content)
621
621
622 $ python ../dircontent.py > ../content-base.txt
622 $ python ../dircontent.py > ../content-base.txt
623 $ cat ../content-base.txt
623 $ cat ../content-base.txt
624 base clean_clean
624 base clean_clean
625 base clean_deleted
625 base clean_deleted
626 base clean_removed
626 base clean_removed
627 base clean_untracked-clean
627 base clean_untracked-clean
628 base clean_untracked-wc
628 base clean_untracked-wc
629 base clean_wc
629 base clean_wc
630 base modified_clean
630 base modified_clean
631 base modified_deleted
631 base modified_deleted
632 base modified_removed
632 base modified_removed
633 base modified_revert
633 base modified_revert
634 base modified_untracked-clean
634 base modified_untracked-clean
635 base modified_untracked-revert
635 base modified_untracked-revert
636 base modified_untracked-wc
636 base modified_untracked-wc
637 base modified_wc
637 base modified_wc
638 base removed_clean
638 base removed_clean
639 base removed_deleted
639 base removed_deleted
640 base removed_removed
640 base removed_removed
641 base removed_revert
641 base removed_revert
642 base removed_untracked-clean
642 base removed_untracked-clean
643 base removed_untracked-revert
643 base removed_untracked-revert
644 base removed_untracked-wc
644 base removed_untracked-wc
645 base removed_wc
645 base removed_wc
646
646
647 Create parent changeset
647 Create parent changeset
648
648
649 $ python ../gen-revert-cases.py parent
649 $ python ../gen-revert-cases.py parent
650 $ hg addremove --similarity 0
650 $ hg addremove --similarity 0
651 adding added_clean
651 adding added_clean
652 adding added_deleted
652 adding added_deleted
653 adding added_removed
653 adding added_removed
654 adding added_revert
655 adding added_untracked-clean
654 adding added_untracked-clean
656 adding added_untracked-revert
657 adding added_untracked-wc
655 adding added_untracked-wc
658 adding added_wc
656 adding added_wc
659 removing removed_clean
657 removing removed_clean
660 removing removed_deleted
658 removing removed_deleted
661 removing removed_removed
659 removing removed_removed
662 removing removed_revert
660 removing removed_revert
663 removing removed_untracked-clean
661 removing removed_untracked-clean
664 removing removed_untracked-revert
662 removing removed_untracked-revert
665 removing removed_untracked-wc
663 removing removed_untracked-wc
666 removing removed_wc
664 removing removed_wc
667 $ hg status
665 $ hg status
668 M modified_clean
666 M modified_clean
669 M modified_deleted
667 M modified_deleted
670 M modified_removed
668 M modified_removed
671 M modified_revert
669 M modified_revert
672 M modified_untracked-clean
670 M modified_untracked-clean
673 M modified_untracked-revert
671 M modified_untracked-revert
674 M modified_untracked-wc
672 M modified_untracked-wc
675 M modified_wc
673 M modified_wc
676 A added_clean
674 A added_clean
677 A added_deleted
675 A added_deleted
678 A added_removed
676 A added_removed
679 A added_revert
680 A added_untracked-clean
677 A added_untracked-clean
681 A added_untracked-revert
682 A added_untracked-wc
678 A added_untracked-wc
683 A added_wc
679 A added_wc
684 R removed_clean
680 R removed_clean
685 R removed_deleted
681 R removed_deleted
686 R removed_removed
682 R removed_removed
687 R removed_revert
683 R removed_revert
688 R removed_untracked-clean
684 R removed_untracked-clean
689 R removed_untracked-revert
685 R removed_untracked-revert
690 R removed_untracked-wc
686 R removed_untracked-wc
691 R removed_wc
687 R removed_wc
692 $ hg commit -m 'parent'
688 $ hg commit -m 'parent'
693
689
694 (create a simple text version of the content)
690 (create a simple text version of the content)
695
691
696 $ python ../dircontent.py > ../content-parent.txt
692 $ python ../dircontent.py > ../content-parent.txt
697 $ cat ../content-parent.txt
693 $ cat ../content-parent.txt
698 parent added_clean
694 parent added_clean
699 parent added_deleted
695 parent added_deleted
700 parent added_removed
696 parent added_removed
701 parent added_revert
702 parent added_untracked-clean
697 parent added_untracked-clean
703 parent added_untracked-revert
704 parent added_untracked-wc
698 parent added_untracked-wc
705 parent added_wc
699 parent added_wc
706 base clean_clean
700 base clean_clean
707 base clean_deleted
701 base clean_deleted
708 base clean_removed
702 base clean_removed
709 base clean_untracked-clean
703 base clean_untracked-clean
710 base clean_untracked-wc
704 base clean_untracked-wc
711 base clean_wc
705 base clean_wc
712 parent modified_clean
706 parent modified_clean
713 parent modified_deleted
707 parent modified_deleted
714 parent modified_removed
708 parent modified_removed
715 parent modified_revert
709 parent modified_revert
716 parent modified_untracked-clean
710 parent modified_untracked-clean
717 parent modified_untracked-revert
711 parent modified_untracked-revert
718 parent modified_untracked-wc
712 parent modified_untracked-wc
719 parent modified_wc
713 parent modified_wc
720
714
721 Setup working directory
715 Setup working directory
722
716
723 $ python ../gen-revert-cases.py wc
717 $ python ../gen-revert-cases.py wc
724 $ hg addremove --similarity 0
718 $ hg addremove --similarity 0
725 removing added_removed
719 removing added_removed
726 removing added_revert
727 removing added_untracked-revert
728 removing clean_removed
720 removing clean_removed
729 adding missing_deleted
721 adding missing_deleted
730 adding missing_untracked-wc
722 adding missing_untracked-wc
731 adding missing_wc
723 adding missing_wc
732 removing modified_removed
724 removing modified_removed
733 adding removed_deleted
725 adding removed_deleted
734 adding removed_revert
726 adding removed_revert
735 adding removed_untracked-revert
727 adding removed_untracked-revert
736 adding removed_untracked-wc
728 adding removed_untracked-wc
737 adding removed_wc
729 adding removed_wc
738 $ hg forget *untracked*
730 $ hg forget *untracked*
739 $ rm *deleted*
731 $ rm *deleted*
740 $ hg status
732 $ hg status
741 M added_wc
733 M added_wc
742 M clean_wc
734 M clean_wc
743 M modified_revert
735 M modified_revert
744 M modified_wc
736 M modified_wc
745 A missing_wc
737 A missing_wc
746 A removed_revert
738 A removed_revert
747 A removed_wc
739 A removed_wc
748 R added_removed
740 R added_removed
749 R added_revert
750 R added_untracked-clean
741 R added_untracked-clean
751 R added_untracked-revert
752 R added_untracked-wc
742 R added_untracked-wc
753 R clean_removed
743 R clean_removed
754 R clean_untracked-clean
744 R clean_untracked-clean
755 R clean_untracked-wc
745 R clean_untracked-wc
756 R modified_removed
746 R modified_removed
757 R modified_untracked-clean
747 R modified_untracked-clean
758 R modified_untracked-revert
748 R modified_untracked-revert
759 R modified_untracked-wc
749 R modified_untracked-wc
760 ! added_deleted
750 ! added_deleted
761 ! clean_deleted
751 ! clean_deleted
762 ! missing_deleted
752 ! missing_deleted
763 ! modified_deleted
753 ! modified_deleted
764 ! removed_deleted
754 ! removed_deleted
765 ? missing_untracked-wc
755 ? missing_untracked-wc
766 ? removed_untracked-revert
756 ? removed_untracked-revert
767 ? removed_untracked-wc
757 ? removed_untracked-wc
768
758
769 $ hg status --rev 'desc("base")'
759 $ hg status --rev 'desc("base")'
770 M clean_wc
760 M clean_wc
771 M modified_clean
761 M modified_clean
772 M modified_wc
762 M modified_wc
773 M removed_wc
763 M removed_wc
774 A added_clean
764 A added_clean
775 A added_wc
765 A added_wc
776 A missing_wc
766 A missing_wc
777 R clean_removed
767 R clean_removed
778 R clean_untracked-clean
768 R clean_untracked-clean
779 R clean_untracked-wc
769 R clean_untracked-wc
780 R modified_removed
770 R modified_removed
781 R modified_untracked-clean
771 R modified_untracked-clean
782 R modified_untracked-revert
772 R modified_untracked-revert
783 R modified_untracked-wc
773 R modified_untracked-wc
784 R removed_clean
774 R removed_clean
785 R removed_deleted
775 R removed_deleted
786 R removed_removed
776 R removed_removed
787 R removed_untracked-clean
777 R removed_untracked-clean
788 R removed_untracked-revert
778 R removed_untracked-revert
789 R removed_untracked-wc
779 R removed_untracked-wc
790 ! added_deleted
780 ! added_deleted
791 ! clean_deleted
781 ! clean_deleted
792 ! missing_deleted
782 ! missing_deleted
793 ! modified_deleted
783 ! modified_deleted
794 ! removed_deleted
784 ! removed_deleted
795 ? missing_untracked-wc
785 ? missing_untracked-wc
796
786
797 (create a simple text version of the content)
787 (create a simple text version of the content)
798
788
799 $ python ../dircontent.py > ../content-wc.txt
789 $ python ../dircontent.py > ../content-wc.txt
800 $ cat ../content-wc.txt
790 $ cat ../content-wc.txt
801 parent added_clean
791 parent added_clean
802 parent added_untracked-clean
792 parent added_untracked-clean
803 wc added_untracked-wc
793 wc added_untracked-wc
804 wc added_wc
794 wc added_wc
805 base clean_clean
795 base clean_clean
806 base clean_untracked-clean
796 base clean_untracked-clean
807 wc clean_untracked-wc
797 wc clean_untracked-wc
808 wc clean_wc
798 wc clean_wc
809 wc missing_untracked-wc
799 wc missing_untracked-wc
810 wc missing_wc
800 wc missing_wc
811 parent modified_clean
801 parent modified_clean
812 base modified_revert
802 base modified_revert
813 parent modified_untracked-clean
803 parent modified_untracked-clean
814 base modified_untracked-revert
804 base modified_untracked-revert
815 wc modified_untracked-wc
805 wc modified_untracked-wc
816 wc modified_wc
806 wc modified_wc
817 base removed_revert
807 base removed_revert
818 base removed_untracked-revert
808 base removed_untracked-revert
819 wc removed_untracked-wc
809 wc removed_untracked-wc
820 wc removed_wc
810 wc removed_wc
821
811
822 $ cd ..
812 $ cd ..
823
813
824 Test revert --all to parent content
814 Test revert --all to parent content
825 -----------------------------------
815 -----------------------------------
826
816
827 (setup from reference repo)
817 (setup from reference repo)
828
818
829 $ cp -r revert-ref revert-parent-all
819 $ cp -r revert-ref revert-parent-all
830 $ cd revert-parent-all
820 $ cd revert-parent-all
831
821
832 check revert output
822 check revert output
833
823
834 $ hg revert --all
824 $ hg revert --all
835 reverting added_deleted
825 reverting added_deleted
836 undeleting added_removed
826 undeleting added_removed
837 undeleting added_revert
838 undeleting added_untracked-clean
827 undeleting added_untracked-clean
839 undeleting added_untracked-revert
840 undeleting added_untracked-wc
828 undeleting added_untracked-wc
841 reverting added_wc
829 reverting added_wc
842 reverting clean_deleted
830 reverting clean_deleted
843 undeleting clean_removed
831 undeleting clean_removed
844 undeleting clean_untracked-clean
832 undeleting clean_untracked-clean
845 undeleting clean_untracked-wc
833 undeleting clean_untracked-wc
846 reverting clean_wc
834 reverting clean_wc
847 forgetting missing_deleted
835 forgetting missing_deleted
848 forgetting missing_wc
836 forgetting missing_wc
849 reverting modified_deleted
837 reverting modified_deleted
850 undeleting modified_removed
838 undeleting modified_removed
851 reverting modified_revert
839 reverting modified_revert
852 undeleting modified_untracked-clean
840 undeleting modified_untracked-clean
853 undeleting modified_untracked-revert
841 undeleting modified_untracked-revert
854 undeleting modified_untracked-wc
842 undeleting modified_untracked-wc
855 reverting modified_wc
843 reverting modified_wc
856 forgetting removed_deleted
844 forgetting removed_deleted
857 forgetting removed_revert
845 forgetting removed_revert
858 forgetting removed_wc
846 forgetting removed_wc
859
847
860 Compare resulting directory with revert target.
848 Compare resulting directory with revert target.
861
849
862 The diff is filtered to include change only. The only difference should be
850 The diff is filtered to include change only. The only difference should be
863 additional `.orig` backup file when applicable.
851 additional `.orig` backup file when applicable.
864
852
865 $ python ../dircontent.py > ../content-parent-all.txt
853 $ python ../dircontent.py > ../content-parent-all.txt
866 $ cd ..
854 $ cd ..
867 $ diff -U 0 -- content-parent.txt content-parent-all.txt | grep _
855 $ diff -U 0 -- content-parent.txt content-parent-all.txt | grep _
868 +wc added_untracked-wc.orig
856 +wc added_untracked-wc.orig
869 +wc added_wc.orig
857 +wc added_wc.orig
870 +wc clean_untracked-wc.orig
858 +wc clean_untracked-wc.orig
871 +wc clean_wc.orig
859 +wc clean_wc.orig
872 +wc missing_untracked-wc
860 +wc missing_untracked-wc
873 +wc missing_wc
861 +wc missing_wc
874 +base modified_revert.orig
862 +base modified_revert.orig
875 +base modified_untracked-revert.orig
863 +base modified_untracked-revert.orig
876 +wc modified_untracked-wc.orig
864 +wc modified_untracked-wc.orig
877 +wc modified_wc.orig
865 +wc modified_wc.orig
878 +base removed_revert
866 +base removed_revert
879 +base removed_untracked-revert
867 +base removed_untracked-revert
880 +wc removed_untracked-wc
868 +wc removed_untracked-wc
881 +wc removed_wc
869 +wc removed_wc
882
870
883 Test revert --all to "base" content
871 Test revert --all to "base" content
884 -----------------------------------
872 -----------------------------------
885
873
886 (setup from reference repo)
874 (setup from reference repo)
887
875
888 $ cp -r revert-ref revert-base-all
876 $ cp -r revert-ref revert-base-all
889 $ cd revert-base-all
877 $ cd revert-base-all
890
878
891 check revert output
879 check revert output
892
880
893 $ hg revert --all --rev 'desc(base)'
881 $ hg revert --all --rev 'desc(base)'
894 removing added_clean
882 removing added_clean
895 removing added_deleted
883 removing added_deleted
896 removing added_wc
884 removing added_wc
897 reverting clean_deleted
885 reverting clean_deleted
898 undeleting clean_removed
886 undeleting clean_removed
899 undeleting clean_untracked-clean
887 undeleting clean_untracked-clean
900 undeleting clean_untracked-wc
888 undeleting clean_untracked-wc
901 reverting clean_wc
889 reverting clean_wc
902 forgetting missing_deleted
890 forgetting missing_deleted
903 forgetting missing_wc
891 forgetting missing_wc
904 reverting modified_clean
892 reverting modified_clean
905 reverting modified_deleted
893 reverting modified_deleted
906 undeleting modified_removed
894 undeleting modified_removed
907 undeleting modified_untracked-clean
895 undeleting modified_untracked-clean
908 undeleting modified_untracked-revert
896 undeleting modified_untracked-revert
909 undeleting modified_untracked-wc
897 undeleting modified_untracked-wc
910 reverting modified_wc
898 reverting modified_wc
911 adding removed_clean
899 adding removed_clean
912 reverting removed_deleted
900 reverting removed_deleted
913 adding removed_removed
901 adding removed_removed
914 adding removed_untracked-clean
902 adding removed_untracked-clean
915 adding removed_untracked-revert
903 adding removed_untracked-revert
916 adding removed_untracked-wc
904 adding removed_untracked-wc
917 reverting removed_wc
905 reverting removed_wc
918
906
919 Compare resulting directory with revert target.
907 Compare resulting directory with revert target.
920
908
921 The diff is filtered to include change only. The only difference should be
909 The diff is filtered to include change only. The only difference should be
922 additional `.orig` backup file when applicable.
910 additional `.orig` backup file when applicable.
923
911
924 $ python ../dircontent.py > ../content-base-all.txt
912 $ python ../dircontent.py > ../content-base-all.txt
925 $ cd ..
913 $ cd ..
926 $ diff -U 0 -- content-base.txt content-base-all.txt | grep _
914 $ diff -U 0 -- content-base.txt content-base-all.txt | grep _
927 +parent added_untracked-clean
915 +parent added_untracked-clean
928 +wc added_untracked-wc
916 +wc added_untracked-wc
929 +wc added_wc.orig
917 +wc added_wc.orig
930 +wc clean_untracked-wc.orig
918 +wc clean_untracked-wc.orig
931 +wc clean_wc.orig
919 +wc clean_wc.orig
932 +wc missing_untracked-wc
920 +wc missing_untracked-wc
933 +wc missing_wc
921 +wc missing_wc
934 +parent modified_untracked-clean.orig
922 +parent modified_untracked-clean.orig
935 +wc modified_untracked-wc.orig
923 +wc modified_untracked-wc.orig
936 +wc modified_wc.orig
924 +wc modified_wc.orig
937 +wc removed_untracked-wc.orig
925 +wc removed_untracked-wc.orig
938 +wc removed_wc.orig
926 +wc removed_wc.orig
939
927
940 Test revert to parent content with explicit file name
928 Test revert to parent content with explicit file name
941 -----------------------------------------------------
929 -----------------------------------------------------
942
930
943 (setup from reference repo)
931 (setup from reference repo)
944
932
945 $ cp -r revert-ref revert-parent-explicit
933 $ cp -r revert-ref revert-parent-explicit
946 $ cd revert-parent-explicit
934 $ cd revert-parent-explicit
947
935
948 revert all files individually and check the output
936 revert all files individually and check the output
949 (output is expected to be different than in the --all case)
937 (output is expected to be different than in the --all case)
950
938
951 $ for file in `python ../gen-revert-cases.py filelist`; do
939 $ for file in `python ../gen-revert-cases.py filelist`; do
952 > echo '### revert for:' $file;
940 > echo '### revert for:' $file;
953 > hg revert $file;
941 > hg revert $file;
954 > echo
942 > echo
955 > done
943 > done
956 ### revert for: added_clean
944 ### revert for: added_clean
957 no changes needed to added_clean
945 no changes needed to added_clean
958
946
959 ### revert for: added_deleted
947 ### revert for: added_deleted
960
948
961 ### revert for: added_removed
949 ### revert for: added_removed
962
950
963 ### revert for: added_revert
964
965 ### revert for: added_untracked-clean
951 ### revert for: added_untracked-clean
966
952
967 ### revert for: added_untracked-revert
968
969 ### revert for: added_untracked-wc
953 ### revert for: added_untracked-wc
970
954
971 ### revert for: added_wc
955 ### revert for: added_wc
972
956
973 ### revert for: clean_clean
957 ### revert for: clean_clean
974 no changes needed to clean_clean
958 no changes needed to clean_clean
975
959
976 ### revert for: clean_deleted
960 ### revert for: clean_deleted
977
961
978 ### revert for: clean_removed
962 ### revert for: clean_removed
979
963
980 ### revert for: clean_untracked-clean
964 ### revert for: clean_untracked-clean
981
965
982 ### revert for: clean_untracked-wc
966 ### revert for: clean_untracked-wc
983
967
984 ### revert for: clean_wc
968 ### revert for: clean_wc
985
969
986 ### revert for: missing_clean
970 ### revert for: missing_clean
987 missing_clean: no such file in rev * (glob)
971 missing_clean: no such file in rev * (glob)
988
972
989 ### revert for: missing_deleted
973 ### revert for: missing_deleted
990
974
991 ### revert for: missing_removed
975 ### revert for: missing_removed
992 missing_removed: no such file in rev * (glob)
976 missing_removed: no such file in rev * (glob)
993
977
994 ### revert for: missing_untracked-clean
978 ### revert for: missing_untracked-clean
995 missing_untracked-clean: no such file in rev * (glob)
979 missing_untracked-clean: no such file in rev * (glob)
996
980
997 ### revert for: missing_untracked-wc
981 ### revert for: missing_untracked-wc
998 file not managed: missing_untracked-wc
982 file not managed: missing_untracked-wc
999
983
1000 ### revert for: missing_wc
984 ### revert for: missing_wc
1001
985
1002 ### revert for: modified_clean
986 ### revert for: modified_clean
1003 no changes needed to modified_clean
987 no changes needed to modified_clean
1004
988
1005 ### revert for: modified_deleted
989 ### revert for: modified_deleted
1006
990
1007 ### revert for: modified_removed
991 ### revert for: modified_removed
1008
992
1009 ### revert for: modified_revert
993 ### revert for: modified_revert
1010
994
1011 ### revert for: modified_untracked-clean
995 ### revert for: modified_untracked-clean
1012
996
1013 ### revert for: modified_untracked-revert
997 ### revert for: modified_untracked-revert
1014
998
1015 ### revert for: modified_untracked-wc
999 ### revert for: modified_untracked-wc
1016
1000
1017 ### revert for: modified_wc
1001 ### revert for: modified_wc
1018
1002
1019 ### revert for: removed_clean
1003 ### revert for: removed_clean
1020 removed_clean: no such file in rev * (glob)
1004 removed_clean: no such file in rev * (glob)
1021
1005
1022 ### revert for: removed_deleted
1006 ### revert for: removed_deleted
1023
1007
1024 ### revert for: removed_removed
1008 ### revert for: removed_removed
1025 removed_removed: no such file in rev * (glob)
1009 removed_removed: no such file in rev * (glob)
1026
1010
1027 ### revert for: removed_revert
1011 ### revert for: removed_revert
1028
1012
1029 ### revert for: removed_untracked-clean
1013 ### revert for: removed_untracked-clean
1030 removed_untracked-clean: no such file in rev * (glob)
1014 removed_untracked-clean: no such file in rev * (glob)
1031
1015
1032 ### revert for: removed_untracked-revert
1016 ### revert for: removed_untracked-revert
1033 file not managed: removed_untracked-revert
1017 file not managed: removed_untracked-revert
1034
1018
1035 ### revert for: removed_untracked-wc
1019 ### revert for: removed_untracked-wc
1036 file not managed: removed_untracked-wc
1020 file not managed: removed_untracked-wc
1037
1021
1038 ### revert for: removed_wc
1022 ### revert for: removed_wc
1039
1023
1040
1024
1041 check resulting directory against the --all run
1025 check resulting directory against the --all run
1042 (There should be no difference)
1026 (There should be no difference)
1043
1027
1044 $ python ../dircontent.py > ../content-parent-explicit.txt
1028 $ python ../dircontent.py > ../content-parent-explicit.txt
1045 $ cd ..
1029 $ cd ..
1046 $ diff -U 0 -- content-parent-all.txt content-parent-explicit.txt | grep _
1030 $ diff -U 0 -- content-parent-all.txt content-parent-explicit.txt | grep _
1047 [1]
1031 [1]
1048
1032
1049 Test revert to "base" content with explicit file name
1033 Test revert to "base" content with explicit file name
1050 -----------------------------------------------------
1034 -----------------------------------------------------
1051
1035
1052 (setup from reference repo)
1036 (setup from reference repo)
1053
1037
1054 $ cp -r revert-ref revert-base-explicit
1038 $ cp -r revert-ref revert-base-explicit
1055 $ cd revert-base-explicit
1039 $ cd revert-base-explicit
1056
1040
1057 revert all files individually and check the output
1041 revert all files individually and check the output
1058 (output is expected to be different than in the --all case)
1042 (output is expected to be different than in the --all case)
1059
1043
1060 $ for file in `python ../gen-revert-cases.py filelist`; do
1044 $ for file in `python ../gen-revert-cases.py filelist`; do
1061 > echo '### revert for:' $file;
1045 > echo '### revert for:' $file;
1062 > hg revert $file --rev 'desc(base)';
1046 > hg revert $file --rev 'desc(base)';
1063 > echo
1047 > echo
1064 > done
1048 > done
1065 ### revert for: added_clean
1049 ### revert for: added_clean
1066
1050
1067 ### revert for: added_deleted
1051 ### revert for: added_deleted
1068
1052
1069 ### revert for: added_removed
1053 ### revert for: added_removed
1070 no changes needed to added_removed
1054 no changes needed to added_removed
1071
1055
1072 ### revert for: added_revert
1073 no changes needed to added_revert
1074
1075 ### revert for: added_untracked-clean
1056 ### revert for: added_untracked-clean
1076 no changes needed to added_untracked-clean
1057 no changes needed to added_untracked-clean
1077
1058
1078 ### revert for: added_untracked-revert
1079 no changes needed to added_untracked-revert
1080
1081 ### revert for: added_untracked-wc
1059 ### revert for: added_untracked-wc
1082 no changes needed to added_untracked-wc
1060 no changes needed to added_untracked-wc
1083
1061
1084 ### revert for: added_wc
1062 ### revert for: added_wc
1085
1063
1086 ### revert for: clean_clean
1064 ### revert for: clean_clean
1087 no changes needed to clean_clean
1065 no changes needed to clean_clean
1088
1066
1089 ### revert for: clean_deleted
1067 ### revert for: clean_deleted
1090
1068
1091 ### revert for: clean_removed
1069 ### revert for: clean_removed
1092
1070
1093 ### revert for: clean_untracked-clean
1071 ### revert for: clean_untracked-clean
1094
1072
1095 ### revert for: clean_untracked-wc
1073 ### revert for: clean_untracked-wc
1096
1074
1097 ### revert for: clean_wc
1075 ### revert for: clean_wc
1098
1076
1099 ### revert for: missing_clean
1077 ### revert for: missing_clean
1100 missing_clean: no such file in rev * (glob)
1078 missing_clean: no such file in rev * (glob)
1101
1079
1102 ### revert for: missing_deleted
1080 ### revert for: missing_deleted
1103
1081
1104 ### revert for: missing_removed
1082 ### revert for: missing_removed
1105 missing_removed: no such file in rev * (glob)
1083 missing_removed: no such file in rev * (glob)
1106
1084
1107 ### revert for: missing_untracked-clean
1085 ### revert for: missing_untracked-clean
1108 missing_untracked-clean: no such file in rev * (glob)
1086 missing_untracked-clean: no such file in rev * (glob)
1109
1087
1110 ### revert for: missing_untracked-wc
1088 ### revert for: missing_untracked-wc
1111 file not managed: missing_untracked-wc
1089 file not managed: missing_untracked-wc
1112
1090
1113 ### revert for: missing_wc
1091 ### revert for: missing_wc
1114
1092
1115 ### revert for: modified_clean
1093 ### revert for: modified_clean
1116
1094
1117 ### revert for: modified_deleted
1095 ### revert for: modified_deleted
1118
1096
1119 ### revert for: modified_removed
1097 ### revert for: modified_removed
1120
1098
1121 ### revert for: modified_revert
1099 ### revert for: modified_revert
1122 no changes needed to modified_revert
1100 no changes needed to modified_revert
1123
1101
1124 ### revert for: modified_untracked-clean
1102 ### revert for: modified_untracked-clean
1125
1103
1126 ### revert for: modified_untracked-revert
1104 ### revert for: modified_untracked-revert
1127
1105
1128 ### revert for: modified_untracked-wc
1106 ### revert for: modified_untracked-wc
1129
1107
1130 ### revert for: modified_wc
1108 ### revert for: modified_wc
1131
1109
1132 ### revert for: removed_clean
1110 ### revert for: removed_clean
1133
1111
1134 ### revert for: removed_deleted
1112 ### revert for: removed_deleted
1135
1113
1136 ### revert for: removed_removed
1114 ### revert for: removed_removed
1137
1115
1138 ### revert for: removed_revert
1116 ### revert for: removed_revert
1139 no changes needed to removed_revert
1117 no changes needed to removed_revert
1140
1118
1141 ### revert for: removed_untracked-clean
1119 ### revert for: removed_untracked-clean
1142
1120
1143 ### revert for: removed_untracked-revert
1121 ### revert for: removed_untracked-revert
1144
1122
1145 ### revert for: removed_untracked-wc
1123 ### revert for: removed_untracked-wc
1146
1124
1147 ### revert for: removed_wc
1125 ### revert for: removed_wc
1148
1126
1149
1127
1150 check resulting directory against the --all run
1128 check resulting directory against the --all run
1151 (There should be no difference)
1129 (There should be no difference)
1152
1130
1153 $ python ../dircontent.py > ../content-base-explicit.txt
1131 $ python ../dircontent.py > ../content-base-explicit.txt
1154 $ cd ..
1132 $ cd ..
1155 $ diff -U 0 -- content-base-all.txt content-base-explicit.txt | grep _
1133 $ diff -U 0 -- content-base-all.txt content-base-explicit.txt | grep _
1156 [1]
1134 [1]
General Comments 0
You need to be logged in to leave comments. Login now