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