##// END OF EJS Templates
test-revert: add case where file is tracked but deleted in working directory
Pierre-Yves David -
r22144:b7c9f07b default
parent child Browse files
Show More
@@ -1,1145 +1,1214 b''
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 silently keep d removed
146 should silently keep d removed
147
147
148 $ hg revert -r0 d
148 $ hg revert -r0 d
149 $ hg st d
149 $ hg st d
150 R d
150 R d
151
151
152 $ hg update -C
152 $ hg update -C
153 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
153 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
154
154
155 revert of exec bit
155 revert of exec bit
156 ------------------
156 ------------------
157
157
158 #if execbit
158 #if execbit
159 $ chmod +x c
159 $ chmod +x c
160 $ hg revert --all
160 $ hg revert --all
161 reverting c
161 reverting c
162
162
163 $ test -x c || echo non-executable
163 $ test -x c || echo non-executable
164 non-executable
164 non-executable
165
165
166 $ chmod +x c
166 $ chmod +x c
167 $ hg commit -m exe
167 $ hg commit -m exe
168
168
169 $ chmod -x c
169 $ chmod -x c
170 $ hg revert --all
170 $ hg revert --all
171 reverting c
171 reverting c
172
172
173 $ test -x c && echo executable
173 $ test -x c && echo executable
174 executable
174 executable
175 #endif
175 #endif
176
176
177 $ cd ..
177 $ cd ..
178
178
179
179
180 Issue241: update and revert produces inconsistent repositories
180 Issue241: update and revert produces inconsistent repositories
181 --------------------------------------------------------------
181 --------------------------------------------------------------
182
182
183 $ hg init a
183 $ hg init a
184 $ cd a
184 $ cd a
185 $ echo a >> a
185 $ echo a >> a
186 $ hg commit -A -d '1 0' -m a
186 $ hg commit -A -d '1 0' -m a
187 adding a
187 adding a
188 $ echo a >> a
188 $ echo a >> a
189 $ hg commit -d '2 0' -m a
189 $ hg commit -d '2 0' -m a
190 $ hg update 0
190 $ hg update 0
191 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
191 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
192 $ mkdir b
192 $ mkdir b
193 $ echo b > b/b
193 $ echo b > b/b
194
194
195 call `hg revert` with no file specified
195 call `hg revert` with no file specified
196 ---------------------------------------
196 ---------------------------------------
197
197
198 $ hg revert -rtip
198 $ hg revert -rtip
199 abort: no files or directories specified
199 abort: no files or directories specified
200 (use --all to revert all files, or 'hg update 1' to update)
200 (use --all to revert all files, or 'hg update 1' to update)
201 [255]
201 [255]
202
202
203 call `hg revert` with --all
203 call `hg revert` with --all
204 ---------------------------
204 ---------------------------
205
205
206 $ hg revert --all -rtip
206 $ hg revert --all -rtip
207 reverting a
207 reverting a
208
208
209
209
210 Issue332: confusing message when reverting directory
210 Issue332: confusing message when reverting directory
211 ----------------------------------------------------
211 ----------------------------------------------------
212
212
213 $ hg ci -A -m b
213 $ hg ci -A -m b
214 adding b/b
214 adding b/b
215 created new head
215 created new head
216 $ echo foobar > b/b
216 $ echo foobar > b/b
217 $ mkdir newdir
217 $ mkdir newdir
218 $ echo foo > newdir/newfile
218 $ echo foo > newdir/newfile
219 $ hg add newdir/newfile
219 $ hg add newdir/newfile
220 $ hg revert b newdir
220 $ hg revert b newdir
221 reverting b/b (glob)
221 reverting b/b (glob)
222 forgetting newdir/newfile (glob)
222 forgetting newdir/newfile (glob)
223 $ echo foobar > b/b
223 $ echo foobar > b/b
224 $ hg revert .
224 $ hg revert .
225 reverting b/b (glob)
225 reverting b/b (glob)
226
226
227
227
228 reverting a rename target should revert the source
228 reverting a rename target should revert the source
229 --------------------------------------------------
229 --------------------------------------------------
230
230
231 $ hg mv a newa
231 $ hg mv a newa
232 $ hg revert newa
232 $ hg revert newa
233 $ hg st a newa
233 $ hg st a newa
234 ? newa
234 ? newa
235
235
236 $ cd ..
236 $ cd ..
237
237
238 $ hg init ignored
238 $ hg init ignored
239 $ cd ignored
239 $ cd ignored
240 $ echo '^ignored$' > .hgignore
240 $ echo '^ignored$' > .hgignore
241 $ echo '^ignoreddir$' >> .hgignore
241 $ echo '^ignoreddir$' >> .hgignore
242 $ echo '^removed$' >> .hgignore
242 $ echo '^removed$' >> .hgignore
243
243
244 $ mkdir ignoreddir
244 $ mkdir ignoreddir
245 $ touch ignoreddir/file
245 $ touch ignoreddir/file
246 $ touch ignoreddir/removed
246 $ touch ignoreddir/removed
247 $ touch ignored
247 $ touch ignored
248 $ touch removed
248 $ touch removed
249
249
250 4 ignored files (we will add/commit everything)
250 4 ignored files (we will add/commit everything)
251
251
252 $ hg st -A -X .hgignore
252 $ hg st -A -X .hgignore
253 I ignored
253 I ignored
254 I ignoreddir/file
254 I ignoreddir/file
255 I ignoreddir/removed
255 I ignoreddir/removed
256 I removed
256 I removed
257 $ hg ci -qAm 'add files' ignored ignoreddir/file ignoreddir/removed removed
257 $ hg ci -qAm 'add files' ignored ignoreddir/file ignoreddir/removed removed
258
258
259 $ echo >> ignored
259 $ echo >> ignored
260 $ echo >> ignoreddir/file
260 $ echo >> ignoreddir/file
261 $ hg rm removed ignoreddir/removed
261 $ hg rm removed ignoreddir/removed
262
262
263 should revert ignored* and undelete *removed
263 should revert ignored* and undelete *removed
264 --------------------------------------------
264 --------------------------------------------
265
265
266 $ hg revert -a --no-backup
266 $ hg revert -a --no-backup
267 reverting ignored
267 reverting ignored
268 reverting ignoreddir/file (glob)
268 reverting ignoreddir/file (glob)
269 undeleting ignoreddir/removed (glob)
269 undeleting ignoreddir/removed (glob)
270 undeleting removed
270 undeleting removed
271 $ hg st -mardi
271 $ hg st -mardi
272
272
273 $ hg up -qC
273 $ hg up -qC
274 $ echo >> ignored
274 $ echo >> ignored
275 $ hg rm removed
275 $ hg rm removed
276
276
277 should silently revert the named files
277 should silently revert the named files
278 --------------------------------------
278 --------------------------------------
279
279
280 $ hg revert --no-backup ignored removed
280 $ hg revert --no-backup ignored removed
281 $ hg st -mardi
281 $ hg st -mardi
282
282
283 Reverting copy (issue3920)
283 Reverting copy (issue3920)
284 --------------------------
284 --------------------------
285
285
286 someone set up us the copies
286 someone set up us the copies
287
287
288 $ rm .hgignore
288 $ rm .hgignore
289 $ hg update -C
289 $ hg update -C
290 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
290 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
291 $ hg mv ignored allyour
291 $ hg mv ignored allyour
292 $ hg copy removed base
292 $ hg copy removed base
293 $ hg commit -m rename
293 $ hg commit -m rename
294
294
295 copies and renames, you have no chance to survive make your time (issue3920)
295 copies and renames, you have no chance to survive make your time (issue3920)
296
296
297 $ hg update '.^'
297 $ hg update '.^'
298 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
298 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
299 $ hg revert -rtip -a
299 $ hg revert -rtip -a
300 adding allyour
300 adding allyour
301 adding base
301 adding base
302 removing ignored
302 removing ignored
303 $ hg status -C
303 $ hg status -C
304 A allyour
304 A allyour
305 ignored
305 ignored
306 A base
306 A base
307 removed
307 removed
308 R ignored
308 R ignored
309
309
310 Test revert of a file added by one side of the merge
310 Test revert of a file added by one side of the merge
311 ====================================================
311 ====================================================
312
312
313 remove any pending change
313 remove any pending change
314
314
315 $ hg revert --all
315 $ hg revert --all
316 forgetting allyour
316 forgetting allyour
317 forgetting base
317 forgetting base
318 undeleting ignored
318 undeleting ignored
319 $ hg purge --all --config extensions.purge=
319 $ hg purge --all --config extensions.purge=
320
320
321 Adds a new commit
321 Adds a new commit
322
322
323 $ echo foo > newadd
323 $ echo foo > newadd
324 $ hg add newadd
324 $ hg add newadd
325 $ hg commit -m 'other adds'
325 $ hg commit -m 'other adds'
326 created new head
326 created new head
327
327
328
328
329 merge it with the other head
329 merge it with the other head
330
330
331 $ hg merge # merge 1 into 2
331 $ hg merge # merge 1 into 2
332 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
332 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
333 (branch merge, don't forget to commit)
333 (branch merge, don't forget to commit)
334 $ hg summary
334 $ hg summary
335 parent: 2:b8ec310b2d4e tip
335 parent: 2:b8ec310b2d4e tip
336 other adds
336 other adds
337 parent: 1:f6180deb8fbe
337 parent: 1:f6180deb8fbe
338 rename
338 rename
339 branch: default
339 branch: default
340 commit: 2 modified, 1 removed (merge)
340 commit: 2 modified, 1 removed (merge)
341 update: (current)
341 update: (current)
342
342
343 clarifies who added what
343 clarifies who added what
344
344
345 $ hg status
345 $ hg status
346 M allyour
346 M allyour
347 M base
347 M base
348 R ignored
348 R ignored
349 $ hg status --change 'p1()'
349 $ hg status --change 'p1()'
350 A newadd
350 A newadd
351 $ hg status --change 'p2()'
351 $ hg status --change 'p2()'
352 A allyour
352 A allyour
353 A base
353 A base
354 R ignored
354 R ignored
355
355
356 revert file added by p1() to p1() state
356 revert file added by p1() to p1() state
357 -----------------------------------------
357 -----------------------------------------
358
358
359 $ hg revert -r 'p1()' 'glob:newad?'
359 $ hg revert -r 'p1()' 'glob:newad?'
360 $ hg status
360 $ hg status
361 M allyour
361 M allyour
362 M base
362 M base
363 R ignored
363 R ignored
364
364
365 revert file added by p1() to p2() state
365 revert file added by p1() to p2() state
366 ------------------------------------------
366 ------------------------------------------
367
367
368 $ hg revert -r 'p2()' 'glob:newad?'
368 $ hg revert -r 'p2()' 'glob:newad?'
369 removing newadd
369 removing newadd
370 $ hg status
370 $ hg status
371 M allyour
371 M allyour
372 M base
372 M base
373 R ignored
373 R ignored
374 R newadd
374 R newadd
375
375
376 revert file added by p2() to p2() state
376 revert file added by p2() to p2() state
377 ------------------------------------------
377 ------------------------------------------
378
378
379 $ hg revert -r 'p2()' 'glob:allyou?'
379 $ hg revert -r 'p2()' 'glob:allyou?'
380 $ hg status
380 $ hg status
381 M allyour
381 M allyour
382 M base
382 M base
383 R ignored
383 R ignored
384 R newadd
384 R newadd
385
385
386 revert file added by p2() to p1() state
386 revert file added by p2() to p1() state
387 ------------------------------------------
387 ------------------------------------------
388
388
389 $ hg revert -r 'p1()' 'glob:allyou?'
389 $ hg revert -r 'p1()' 'glob:allyou?'
390 removing allyour
390 removing allyour
391 $ hg status
391 $ hg status
392 M base
392 M base
393 R allyour
393 R allyour
394 R ignored
394 R ignored
395 R newadd
395 R newadd
396
396
397 Systematic behavior validation of most possible cases
397 Systematic behavior validation of most possible cases
398 =====================================================
398 =====================================================
399
399
400 This section tests most of the possible combinations of working directory
400 This section tests most of the possible combinations of working directory
401 changes and inter-revision changes. The number of possible cases is significant
401 changes and inter-revision changes. The number of possible cases is significant
402 but they all have a slighly different handling. So this section commits to
402 but they all have a slighly different handling. So this section commits to
403 generating and testing all of them to allow safe refactoring of the revert code.
403 generating and testing all of them to allow safe refactoring of the revert code.
404
404
405 A python script is used to generate a file history for each combination of
405 A python script is used to generate a file history for each combination of
406 changes between, on one side the working directory and its parent and on
406 changes between, on one side the working directory and its parent and on
407 the other side, changes between a revert target (--rev) and working directory
407 the other side, changes between a revert target (--rev) and working directory
408 parent. The three states generated are:
408 parent. The three states generated are:
409
409
410 - a "base" revision
410 - a "base" revision
411 - a "parent" revision
411 - a "parent" revision
412 - the working directory (based on "parent")
412 - the working directory (based on "parent")
413
413
414 The file generated have names of the form:
414 The file generated have names of the form:
415
415
416 <changeset-state>_<working-copy-state>
416 <changeset-state>_<working-copy-state>
417
417
418 Here, "changeset-state" conveys the state in "base" and "parent" (or the change
418 Here, "changeset-state" conveys the state in "base" and "parent" (or the change
419 that happen between them), "working-copy-state" is self explanatory.
419 that happen between them), "working-copy-state" is self explanatory.
420
420
421 All known states are not tested yet. See inline documentation for details.
421 All known states are not tested yet. See inline documentation for details.
422 Special cases from merge and rename are not tested by this section.
422 Special cases from merge and rename are not tested by this section.
423
423
424 There are also multiple cases where the current revert implementation is known to
424 There are also multiple cases where the current revert implementation is known to
425 slightly misbehave.
425 slightly misbehave.
426
426
427 Write the python script to disk
427 Write the python script to disk
428 -------------------------------
428 -------------------------------
429
429
430 $ cat << EOF > gen-revert-cases.py
430 $ cat << EOF > gen-revert-cases.py
431 > # generate proper file state to test revert behavior
431 > # generate proper file state to test revert behavior
432 > import sys
432 > import sys
433 > import os
433 > import os
434 >
434 >
435 > # content of the file in "base" and "parent"
435 > # content of the file in "base" and "parent"
436 > # None means no file at all
436 > # None means no file at all
437 > ctxcontent = {
437 > ctxcontent = {
438 > # clean: no change from base to parent
438 > # clean: no change from base to parent
439 > 'clean': ['base', 'base'],
439 > 'clean': ['base', 'base'],
440 > # modified: file content change from base to parent
440 > # modified: file content change from base to parent
441 > 'modified': ['base', 'parent'],
441 > 'modified': ['base', 'parent'],
442 > # added: file is missing from base and added in parent
442 > # added: file is missing from base and added in parent
443 > 'added': [None, 'parent'],
443 > 'added': [None, 'parent'],
444 > # removed: file exist in base but is removed from parent
444 > # removed: file exist in base but is removed from parent
445 > 'removed': ['base', None],
445 > 'removed': ['base', None],
446 > # file exist neither in base not in parent
446 > # file exist neither in base not in parent
447 > 'missing': [None, None],
447 > 'missing': [None, None],
448 > }
448 > }
449 >
449 >
450 > # content of file in working copy
450 > # content of file in working copy
451 > wccontent = {
451 > wccontent = {
452 > # clean: wc content is the same as parent
452 > # clean: wc content is the same as parent
453 > 'clean': lambda cc: cc[1],
453 > 'clean': lambda cc: cc[1],
454 > # revert: wc content is the same as base
454 > # revert: wc content is the same as base
455 > 'revert': lambda cc: cc[0],
455 > 'revert': lambda cc: cc[0],
456 > # wc: file exist with a content different from base and parent
456 > # wc: file exist with a content different from base and parent
457 > 'wc': lambda cc: 'wc',
457 > 'wc': lambda cc: 'wc',
458 > # removed: file is missing and marked as untracked
458 > # removed: file is missing and marked as untracked
459 > 'removed': lambda cc: None,
459 > 'removed': lambda cc: None,
460 > # deleted: file is recorded as tracked but missing
461 > # rely on file deletion outside of this script
462 > 'deleted': lambda cc:'TOBEDELETED',
460 > }
463 > }
461 > # untracked-X is a version of X where the file is not tracked (? unknown)
464 > # untracked-X is a version of X where the file is not tracked (? unknown)
462 > wccontent['untracked-clean'] = wccontent['clean']
465 > wccontent['untracked-clean'] = wccontent['clean']
463 > wccontent['untracked-revert'] = wccontent['revert']
466 > wccontent['untracked-revert'] = wccontent['revert']
464 > wccontent['untracked-wc'] = wccontent['wc']
467 > wccontent['untracked-wc'] = wccontent['wc']
465 >
468 >
466 > # build the combination of possible states
469 > # build the combination of possible states
467 > combination = []
470 > combination = []
468 > for ctxkey in ctxcontent:
471 > for ctxkey in ctxcontent:
469 > for wckey in wccontent:
472 > for wckey in wccontent:
470 > filename = "%s_%s" % (ctxkey, wckey)
473 > filename = "%s_%s" % (ctxkey, wckey)
471 > combination.append((filename, ctxkey, wckey))
474 > combination.append((filename, ctxkey, wckey))
472 >
475 >
473 > # make sure we have stable output
476 > # make sure we have stable output
474 > combination.sort()
477 > combination.sort()
475 >
478 >
476 > # retrieve the state we must generate
479 > # retrieve the state we must generate
477 > target = sys.argv[1]
480 > target = sys.argv[1]
478 >
481 >
479 > # compute file content
482 > # compute file content
480 > content = []
483 > content = []
481 > for filename, ctxkey, wckey in combination:
484 > for filename, ctxkey, wckey in combination:
482 > cc = ctxcontent[ctxkey]
485 > cc = ctxcontent[ctxkey]
483 > if target == 'filelist':
486 > if target == 'filelist':
484 > print filename
487 > print filename
485 > elif target == 'base':
488 > elif target == 'base':
486 > content.append((filename, cc[0]))
489 > content.append((filename, cc[0]))
487 > elif target == 'parent':
490 > elif target == 'parent':
488 > content.append((filename, cc[1]))
491 > content.append((filename, cc[1]))
489 > elif target == 'wc':
492 > elif target == 'wc':
490 > content.append((filename, wccontent[wckey](cc)))
493 > content.append((filename, wccontent[wckey](cc)))
491 > else:
494 > else:
492 > print >> sys.stderr, "unknown target:", target
495 > print >> sys.stderr, "unknown target:", target
493 > sys.exit(1)
496 > sys.exit(1)
494 >
497 >
495 > # write actual content
498 > # write actual content
496 > for filename, data in content:
499 > for filename, data in content:
497 > if data is not None:
500 > if data is not None:
498 > f = open(filename, 'w')
501 > f = open(filename, 'w')
499 > f.write(data + '\n')
502 > f.write(data + '\n')
500 > f.close()
503 > f.close()
501 > elif os.path.exists(filename):
504 > elif os.path.exists(filename):
502 > os.remove(filename)
505 > os.remove(filename)
503 > EOF
506 > EOF
504
507
505 check list of planned files
508 check list of planned files
506
509
507 $ python gen-revert-cases.py filelist
510 $ python gen-revert-cases.py filelist
508 added_clean
511 added_clean
512 added_deleted
509 added_removed
513 added_removed
510 added_revert
514 added_revert
511 added_untracked-clean
515 added_untracked-clean
512 added_untracked-revert
516 added_untracked-revert
513 added_untracked-wc
517 added_untracked-wc
514 added_wc
518 added_wc
515 clean_clean
519 clean_clean
520 clean_deleted
516 clean_removed
521 clean_removed
517 clean_revert
522 clean_revert
518 clean_untracked-clean
523 clean_untracked-clean
519 clean_untracked-revert
524 clean_untracked-revert
520 clean_untracked-wc
525 clean_untracked-wc
521 clean_wc
526 clean_wc
522 missing_clean
527 missing_clean
528 missing_deleted
523 missing_removed
529 missing_removed
524 missing_revert
530 missing_revert
525 missing_untracked-clean
531 missing_untracked-clean
526 missing_untracked-revert
532 missing_untracked-revert
527 missing_untracked-wc
533 missing_untracked-wc
528 missing_wc
534 missing_wc
529 modified_clean
535 modified_clean
536 modified_deleted
530 modified_removed
537 modified_removed
531 modified_revert
538 modified_revert
532 modified_untracked-clean
539 modified_untracked-clean
533 modified_untracked-revert
540 modified_untracked-revert
534 modified_untracked-wc
541 modified_untracked-wc
535 modified_wc
542 modified_wc
536 removed_clean
543 removed_clean
544 removed_deleted
537 removed_removed
545 removed_removed
538 removed_revert
546 removed_revert
539 removed_untracked-clean
547 removed_untracked-clean
540 removed_untracked-revert
548 removed_untracked-revert
541 removed_untracked-wc
549 removed_untracked-wc
542 removed_wc
550 removed_wc
543
551
544 Script to make a simple text version of the content
552 Script to make a simple text version of the content
545 ---------------------------------------------------
553 ---------------------------------------------------
546
554
547 $ cat << EOF >> dircontent.py
555 $ cat << EOF >> dircontent.py
548 > # generate a simple text view of the directory for easy comparison
556 > # generate a simple text view of the directory for easy comparison
549 > import os
557 > import os
550 > files = os.listdir('.')
558 > files = os.listdir('.')
551 > files.sort()
559 > files.sort()
552 > for filename in files:
560 > for filename in files:
553 > if os.path.isdir(filename):
561 > if os.path.isdir(filename):
554 > continue
562 > continue
555 > content = open(filename).read()
563 > content = open(filename).read()
556 > print '%-6s %s' % (content.strip(), filename)
564 > print '%-6s %s' % (content.strip(), filename)
557 > EOF
565 > EOF
558
566
559 Generate appropriate repo state
567 Generate appropriate repo state
560 -------------------------------
568 -------------------------------
561
569
562 $ hg init revert-ref
570 $ hg init revert-ref
563 $ cd revert-ref
571 $ cd revert-ref
564
572
565 Generate base changeset
573 Generate base changeset
566
574
567 $ python ../gen-revert-cases.py base
575 $ python ../gen-revert-cases.py base
568 $ hg addremove --similarity 0
576 $ hg addremove --similarity 0
569 adding clean_clean
577 adding clean_clean
578 adding clean_deleted
570 adding clean_removed
579 adding clean_removed
571 adding clean_revert
580 adding clean_revert
572 adding clean_untracked-clean
581 adding clean_untracked-clean
573 adding clean_untracked-revert
582 adding clean_untracked-revert
574 adding clean_untracked-wc
583 adding clean_untracked-wc
575 adding clean_wc
584 adding clean_wc
576 adding modified_clean
585 adding modified_clean
586 adding modified_deleted
577 adding modified_removed
587 adding modified_removed
578 adding modified_revert
588 adding modified_revert
579 adding modified_untracked-clean
589 adding modified_untracked-clean
580 adding modified_untracked-revert
590 adding modified_untracked-revert
581 adding modified_untracked-wc
591 adding modified_untracked-wc
582 adding modified_wc
592 adding modified_wc
583 adding removed_clean
593 adding removed_clean
594 adding removed_deleted
584 adding removed_removed
595 adding removed_removed
585 adding removed_revert
596 adding removed_revert
586 adding removed_untracked-clean
597 adding removed_untracked-clean
587 adding removed_untracked-revert
598 adding removed_untracked-revert
588 adding removed_untracked-wc
599 adding removed_untracked-wc
589 adding removed_wc
600 adding removed_wc
590 $ hg status
601 $ hg status
591 A clean_clean
602 A clean_clean
603 A clean_deleted
592 A clean_removed
604 A clean_removed
593 A clean_revert
605 A clean_revert
594 A clean_untracked-clean
606 A clean_untracked-clean
595 A clean_untracked-revert
607 A clean_untracked-revert
596 A clean_untracked-wc
608 A clean_untracked-wc
597 A clean_wc
609 A clean_wc
598 A modified_clean
610 A modified_clean
611 A modified_deleted
599 A modified_removed
612 A modified_removed
600 A modified_revert
613 A modified_revert
601 A modified_untracked-clean
614 A modified_untracked-clean
602 A modified_untracked-revert
615 A modified_untracked-revert
603 A modified_untracked-wc
616 A modified_untracked-wc
604 A modified_wc
617 A modified_wc
605 A removed_clean
618 A removed_clean
619 A removed_deleted
606 A removed_removed
620 A removed_removed
607 A removed_revert
621 A removed_revert
608 A removed_untracked-clean
622 A removed_untracked-clean
609 A removed_untracked-revert
623 A removed_untracked-revert
610 A removed_untracked-wc
624 A removed_untracked-wc
611 A removed_wc
625 A removed_wc
612 $ hg commit -m 'base'
626 $ hg commit -m 'base'
613
627
614 (create a simple text version of the content)
628 (create a simple text version of the content)
615
629
616 $ python ../dircontent.py > ../content-base.txt
630 $ python ../dircontent.py > ../content-base.txt
617 $ cat ../content-base.txt
631 $ cat ../content-base.txt
618 base clean_clean
632 base clean_clean
633 base clean_deleted
619 base clean_removed
634 base clean_removed
620 base clean_revert
635 base clean_revert
621 base clean_untracked-clean
636 base clean_untracked-clean
622 base clean_untracked-revert
637 base clean_untracked-revert
623 base clean_untracked-wc
638 base clean_untracked-wc
624 base clean_wc
639 base clean_wc
625 base modified_clean
640 base modified_clean
641 base modified_deleted
626 base modified_removed
642 base modified_removed
627 base modified_revert
643 base modified_revert
628 base modified_untracked-clean
644 base modified_untracked-clean
629 base modified_untracked-revert
645 base modified_untracked-revert
630 base modified_untracked-wc
646 base modified_untracked-wc
631 base modified_wc
647 base modified_wc
632 base removed_clean
648 base removed_clean
649 base removed_deleted
633 base removed_removed
650 base removed_removed
634 base removed_revert
651 base removed_revert
635 base removed_untracked-clean
652 base removed_untracked-clean
636 base removed_untracked-revert
653 base removed_untracked-revert
637 base removed_untracked-wc
654 base removed_untracked-wc
638 base removed_wc
655 base removed_wc
639
656
640 Create parent changeset
657 Create parent changeset
641
658
642 $ python ../gen-revert-cases.py parent
659 $ python ../gen-revert-cases.py parent
643 $ hg addremove --similarity 0
660 $ hg addremove --similarity 0
644 adding added_clean
661 adding added_clean
662 adding added_deleted
645 adding added_removed
663 adding added_removed
646 adding added_revert
664 adding added_revert
647 adding added_untracked-clean
665 adding added_untracked-clean
648 adding added_untracked-revert
666 adding added_untracked-revert
649 adding added_untracked-wc
667 adding added_untracked-wc
650 adding added_wc
668 adding added_wc
651 removing removed_clean
669 removing removed_clean
670 removing removed_deleted
652 removing removed_removed
671 removing removed_removed
653 removing removed_revert
672 removing removed_revert
654 removing removed_untracked-clean
673 removing removed_untracked-clean
655 removing removed_untracked-revert
674 removing removed_untracked-revert
656 removing removed_untracked-wc
675 removing removed_untracked-wc
657 removing removed_wc
676 removing removed_wc
658 $ hg status
677 $ hg status
659 M modified_clean
678 M modified_clean
679 M modified_deleted
660 M modified_removed
680 M modified_removed
661 M modified_revert
681 M modified_revert
662 M modified_untracked-clean
682 M modified_untracked-clean
663 M modified_untracked-revert
683 M modified_untracked-revert
664 M modified_untracked-wc
684 M modified_untracked-wc
665 M modified_wc
685 M modified_wc
666 A added_clean
686 A added_clean
687 A added_deleted
667 A added_removed
688 A added_removed
668 A added_revert
689 A added_revert
669 A added_untracked-clean
690 A added_untracked-clean
670 A added_untracked-revert
691 A added_untracked-revert
671 A added_untracked-wc
692 A added_untracked-wc
672 A added_wc
693 A added_wc
673 R removed_clean
694 R removed_clean
695 R removed_deleted
674 R removed_removed
696 R removed_removed
675 R removed_revert
697 R removed_revert
676 R removed_untracked-clean
698 R removed_untracked-clean
677 R removed_untracked-revert
699 R removed_untracked-revert
678 R removed_untracked-wc
700 R removed_untracked-wc
679 R removed_wc
701 R removed_wc
680 $ hg commit -m 'parent'
702 $ hg commit -m 'parent'
681
703
682 (create a simple text version of the content)
704 (create a simple text version of the content)
683
705
684 $ python ../dircontent.py > ../content-parent.txt
706 $ python ../dircontent.py > ../content-parent.txt
685 $ cat ../content-parent.txt
707 $ cat ../content-parent.txt
686 parent added_clean
708 parent added_clean
709 parent added_deleted
687 parent added_removed
710 parent added_removed
688 parent added_revert
711 parent added_revert
689 parent added_untracked-clean
712 parent added_untracked-clean
690 parent added_untracked-revert
713 parent added_untracked-revert
691 parent added_untracked-wc
714 parent added_untracked-wc
692 parent added_wc
715 parent added_wc
693 base clean_clean
716 base clean_clean
717 base clean_deleted
694 base clean_removed
718 base clean_removed
695 base clean_revert
719 base clean_revert
696 base clean_untracked-clean
720 base clean_untracked-clean
697 base clean_untracked-revert
721 base clean_untracked-revert
698 base clean_untracked-wc
722 base clean_untracked-wc
699 base clean_wc
723 base clean_wc
700 parent modified_clean
724 parent modified_clean
725 parent modified_deleted
701 parent modified_removed
726 parent modified_removed
702 parent modified_revert
727 parent modified_revert
703 parent modified_untracked-clean
728 parent modified_untracked-clean
704 parent modified_untracked-revert
729 parent modified_untracked-revert
705 parent modified_untracked-wc
730 parent modified_untracked-wc
706 parent modified_wc
731 parent modified_wc
707
732
708 Setup working directory
733 Setup working directory
709
734
710 $ python ../gen-revert-cases.py wc | cat
735 $ python ../gen-revert-cases.py wc | cat
711 $ hg addremove --similarity 0
736 $ hg addremove --similarity 0
712 removing added_removed
737 removing added_removed
713 removing added_revert
738 removing added_revert
714 removing added_untracked-revert
739 removing added_untracked-revert
715 removing clean_removed
740 removing clean_removed
741 adding missing_deleted
716 adding missing_untracked-wc
742 adding missing_untracked-wc
717 adding missing_wc
743 adding missing_wc
718 removing modified_removed
744 removing modified_removed
745 adding removed_deleted
719 adding removed_revert
746 adding removed_revert
720 adding removed_untracked-revert
747 adding removed_untracked-revert
721 adding removed_untracked-wc
748 adding removed_untracked-wc
722 adding removed_wc
749 adding removed_wc
723 $ hg forget *untracked*
750 $ hg forget *untracked*
751 $ rm *deleted*
724 $ hg status
752 $ hg status
725 M added_wc
753 M added_wc
726 M clean_wc
754 M clean_wc
727 M modified_revert
755 M modified_revert
728 M modified_wc
756 M modified_wc
729 A missing_wc
757 A missing_wc
730 A removed_revert
758 A removed_revert
731 A removed_wc
759 A removed_wc
732 R added_removed
760 R added_removed
733 R added_revert
761 R added_revert
734 R added_untracked-clean
762 R added_untracked-clean
735 R added_untracked-revert
763 R added_untracked-revert
736 R added_untracked-wc
764 R added_untracked-wc
737 R clean_removed
765 R clean_removed
738 R clean_untracked-clean
766 R clean_untracked-clean
739 R clean_untracked-revert
767 R clean_untracked-revert
740 R clean_untracked-wc
768 R clean_untracked-wc
741 R modified_removed
769 R modified_removed
742 R modified_untracked-clean
770 R modified_untracked-clean
743 R modified_untracked-revert
771 R modified_untracked-revert
744 R modified_untracked-wc
772 R modified_untracked-wc
773 ! added_deleted
774 ! clean_deleted
775 ! missing_deleted
776 ! modified_deleted
777 ! removed_deleted
745 ? missing_untracked-wc
778 ? missing_untracked-wc
746 ? removed_untracked-revert
779 ? removed_untracked-revert
747 ? removed_untracked-wc
780 ? removed_untracked-wc
748
781
749 $ hg status --rev 'desc("base")'
782 $ hg status --rev 'desc("base")'
750 M clean_wc
783 M clean_wc
751 M modified_clean
784 M modified_clean
752 M modified_wc
785 M modified_wc
753 M removed_wc
786 M removed_wc
754 A added_clean
787 A added_clean
755 A added_wc
788 A added_wc
756 A missing_wc
789 A missing_wc
757 R clean_removed
790 R clean_removed
758 R clean_untracked-clean
791 R clean_untracked-clean
759 R clean_untracked-revert
792 R clean_untracked-revert
760 R clean_untracked-wc
793 R clean_untracked-wc
761 R modified_removed
794 R modified_removed
762 R modified_untracked-clean
795 R modified_untracked-clean
763 R modified_untracked-revert
796 R modified_untracked-revert
764 R modified_untracked-wc
797 R modified_untracked-wc
765 R removed_clean
798 R removed_clean
799 R removed_deleted
766 R removed_removed
800 R removed_removed
767 R removed_untracked-clean
801 R removed_untracked-clean
768 R removed_untracked-revert
802 R removed_untracked-revert
769 R removed_untracked-wc
803 R removed_untracked-wc
804 ! added_deleted
805 ! clean_deleted
806 ! missing_deleted
807 ! modified_deleted
808 ! removed_deleted
770 ? missing_untracked-wc
809 ? missing_untracked-wc
771
810
772 (create a simple text version of the content)
811 (create a simple text version of the content)
773
812
774 $ python ../dircontent.py > ../content-wc.txt
813 $ python ../dircontent.py > ../content-wc.txt
775 $ cat ../content-wc.txt
814 $ cat ../content-wc.txt
776 parent added_clean
815 parent added_clean
777 parent added_untracked-clean
816 parent added_untracked-clean
778 wc added_untracked-wc
817 wc added_untracked-wc
779 wc added_wc
818 wc added_wc
780 base clean_clean
819 base clean_clean
781 base clean_revert
820 base clean_revert
782 base clean_untracked-clean
821 base clean_untracked-clean
783 base clean_untracked-revert
822 base clean_untracked-revert
784 wc clean_untracked-wc
823 wc clean_untracked-wc
785 wc clean_wc
824 wc clean_wc
786 wc missing_untracked-wc
825 wc missing_untracked-wc
787 wc missing_wc
826 wc missing_wc
788 parent modified_clean
827 parent modified_clean
789 base modified_revert
828 base modified_revert
790 parent modified_untracked-clean
829 parent modified_untracked-clean
791 base modified_untracked-revert
830 base modified_untracked-revert
792 wc modified_untracked-wc
831 wc modified_untracked-wc
793 wc modified_wc
832 wc modified_wc
794 base removed_revert
833 base removed_revert
795 base removed_untracked-revert
834 base removed_untracked-revert
796 wc removed_untracked-wc
835 wc removed_untracked-wc
797 wc removed_wc
836 wc removed_wc
798
837
799 $ cd ..
838 $ cd ..
800
839
801 Test revert --all to parent content
840 Test revert --all to parent content
802 -----------------------------------
841 -----------------------------------
803
842
804 (setup from reference repo)
843 (setup from reference repo)
805
844
806 $ cp -r revert-ref revert-parent-all
845 $ cp -r revert-ref revert-parent-all
807 $ cd revert-parent-all
846 $ cd revert-parent-all
808
847
809 check revert output
848 check revert output
810
849
811 $ hg revert --all
850 $ hg revert --all
851 reverting added_deleted
812 undeleting added_removed
852 undeleting added_removed
813 undeleting added_revert
853 undeleting added_revert
814 undeleting added_untracked-clean
854 undeleting added_untracked-clean
815 undeleting added_untracked-revert
855 undeleting added_untracked-revert
816 undeleting added_untracked-wc
856 undeleting added_untracked-wc
817 reverting added_wc
857 reverting added_wc
858 reverting clean_deleted
818 undeleting clean_removed
859 undeleting clean_removed
819 undeleting clean_untracked-clean
860 undeleting clean_untracked-clean
820 undeleting clean_untracked-revert
861 undeleting clean_untracked-revert
821 undeleting clean_untracked-wc
862 undeleting clean_untracked-wc
822 reverting clean_wc
863 reverting clean_wc
864 forgetting missing_deleted
823 forgetting missing_wc
865 forgetting missing_wc
866 reverting modified_deleted
824 undeleting modified_removed
867 undeleting modified_removed
825 reverting modified_revert
868 reverting modified_revert
826 undeleting modified_untracked-clean
869 undeleting modified_untracked-clean
827 undeleting modified_untracked-revert
870 undeleting modified_untracked-revert
828 undeleting modified_untracked-wc
871 undeleting modified_untracked-wc
829 reverting modified_wc
872 reverting modified_wc
873 forgetting removed_deleted
830 forgetting removed_revert
874 forgetting removed_revert
831 forgetting removed_wc
875 forgetting removed_wc
832
876
833 Compare resulting directory with revert target.
877 Compare resulting directory with revert target.
834
878
835 The diff is filtered to include change only. The only difference should be
879 The diff is filtered to include change only. The only difference should be
836 additional `.orig` backup file when applicable.
880 additional `.orig` backup file when applicable.
837
881
838 $ python ../dircontent.py > ../content-parent-all.txt
882 $ python ../dircontent.py > ../content-parent-all.txt
839 $ cd ..
883 $ cd ..
840 $ diff -U 0 -- content-parent.txt content-parent-all.txt | grep _
884 $ diff -U 0 -- content-parent.txt content-parent-all.txt | grep _
841 +wc added_untracked-wc.orig
885 +wc added_untracked-wc.orig
842 +wc added_wc.orig
886 +wc added_wc.orig
843 +wc clean_untracked-wc.orig
887 +wc clean_untracked-wc.orig
844 +wc clean_wc.orig
888 +wc clean_wc.orig
845 +wc missing_untracked-wc
889 +wc missing_untracked-wc
846 +wc missing_wc
890 +wc missing_wc
847 +base modified_revert.orig
891 +base modified_revert.orig
848 +base modified_untracked-revert.orig
892 +base modified_untracked-revert.orig
849 +wc modified_untracked-wc.orig
893 +wc modified_untracked-wc.orig
850 +wc modified_wc.orig
894 +wc modified_wc.orig
851 +base removed_revert
895 +base removed_revert
852 +base removed_untracked-revert
896 +base removed_untracked-revert
853 +wc removed_untracked-wc
897 +wc removed_untracked-wc
854 +wc removed_wc
898 +wc removed_wc
855
899
856 Test revert --all to "base" content
900 Test revert --all to "base" content
857 -----------------------------------
901 -----------------------------------
858
902
859 (setup from reference repo)
903 (setup from reference repo)
860
904
861 $ cp -r revert-ref revert-base-all
905 $ cp -r revert-ref revert-base-all
862 $ cd revert-base-all
906 $ cd revert-base-all
863
907
864 check revert output
908 check revert output
865
909
866 Misbehavior:
910 Misbehavior:
867
911
868 - report "reverting" when file needs no changes
912 - report "reverting" when file needs no changes
869 |
913 |
870 | - reverting modified_revert
914 | - reverting modified_revert
871 | - reverting removed_revert
915 | - reverting removed_revert
872
916
873 $ hg revert --all --rev 'desc(base)'
917 $ hg revert --all --rev 'desc(base)'
874 removing added_clean
918 removing added_clean
919 removing added_deleted
875 removing added_wc
920 removing added_wc
921 reverting clean_deleted
876 undeleting clean_removed
922 undeleting clean_removed
877 undeleting clean_untracked-clean
923 undeleting clean_untracked-clean
878 undeleting clean_untracked-revert
924 undeleting clean_untracked-revert
879 undeleting clean_untracked-wc
925 undeleting clean_untracked-wc
880 reverting clean_wc
926 reverting clean_wc
927 forgetting missing_deleted
881 forgetting missing_wc
928 forgetting missing_wc
882 reverting modified_clean
929 reverting modified_clean
930 reverting modified_deleted
883 undeleting modified_removed
931 undeleting modified_removed
884 reverting modified_revert
932 reverting modified_revert
885 undeleting modified_untracked-clean
933 undeleting modified_untracked-clean
886 undeleting modified_untracked-revert
934 undeleting modified_untracked-revert
887 undeleting modified_untracked-wc
935 undeleting modified_untracked-wc
888 reverting modified_wc
936 reverting modified_wc
889 adding removed_clean
937 adding removed_clean
938 reverting removed_deleted
890 adding removed_removed
939 adding removed_removed
891 reverting removed_revert
940 reverting removed_revert
892 adding removed_untracked-clean
941 adding removed_untracked-clean
893 adding removed_untracked-revert
942 adding removed_untracked-revert
894 adding removed_untracked-wc
943 adding removed_untracked-wc
895 reverting removed_wc
944 reverting removed_wc
896
945
897 Compare resulting directory with revert target.
946 Compare resulting directory with revert target.
898
947
899 The diff is filtered to include change only. The only difference should be
948 The diff is filtered to include change only. The only difference should be
900 additional `.orig` backup file when applicable.
949 additional `.orig` backup file when applicable.
901
950
902 Misbehavior:
951 Misbehavior:
903
952
904 - no backup for
953 - no backup for
905 | - added_wc (DATA LOSS)
954 | - added_wc (DATA LOSS)
906
955
907 $ python ../dircontent.py > ../content-base-all.txt
956 $ python ../dircontent.py > ../content-base-all.txt
908 $ cd ..
957 $ cd ..
909 $ diff -U 0 -- content-base.txt content-base-all.txt | grep _
958 $ diff -U 0 -- content-base.txt content-base-all.txt | grep _
910 +parent added_untracked-clean
959 +parent added_untracked-clean
911 +wc added_untracked-wc
960 +wc added_untracked-wc
912 +wc clean_untracked-wc.orig
961 +wc clean_untracked-wc.orig
913 +wc clean_wc.orig
962 +wc clean_wc.orig
914 +wc missing_untracked-wc
963 +wc missing_untracked-wc
915 +wc missing_wc
964 +wc missing_wc
916 +parent modified_untracked-clean.orig
965 +parent modified_untracked-clean.orig
917 +wc modified_untracked-wc.orig
966 +wc modified_untracked-wc.orig
918 +wc modified_wc.orig
967 +wc modified_wc.orig
919 +wc removed_untracked-wc.orig
968 +wc removed_untracked-wc.orig
920 +wc removed_wc.orig
969 +wc removed_wc.orig
921
970
922 Test revert to parent content with explicit file name
971 Test revert to parent content with explicit file name
923 -----------------------------------------------------
972 -----------------------------------------------------
924
973
925 (setup from reference repo)
974 (setup from reference repo)
926
975
927 $ cp -r revert-ref revert-parent-explicit
976 $ cp -r revert-ref revert-parent-explicit
928 $ cd revert-parent-explicit
977 $ cd revert-parent-explicit
929
978
930 revert all files individually and check the output
979 revert all files individually and check the output
931 (output is expected to be different than in the --all case)
980 (output is expected to be different than in the --all case)
932
981
933 $ for file in `python ../gen-revert-cases.py filelist`; do
982 $ for file in `python ../gen-revert-cases.py filelist`; do
934 > echo '### revert for:' $file;
983 > echo '### revert for:' $file;
935 > hg revert $file;
984 > hg revert $file;
936 > echo
985 > echo
937 > done
986 > done
938 ### revert for: added_clean
987 ### revert for: added_clean
939 no changes needed to added_clean
988 no changes needed to added_clean
940
989
990 ### revert for: added_deleted
991
941 ### revert for: added_removed
992 ### revert for: added_removed
942
993
943 ### revert for: added_revert
994 ### revert for: added_revert
944
995
945 ### revert for: added_untracked-clean
996 ### revert for: added_untracked-clean
946
997
947 ### revert for: added_untracked-revert
998 ### revert for: added_untracked-revert
948
999
949 ### revert for: added_untracked-wc
1000 ### revert for: added_untracked-wc
950
1001
951 ### revert for: added_wc
1002 ### revert for: added_wc
952
1003
953 ### revert for: clean_clean
1004 ### revert for: clean_clean
954 no changes needed to clean_clean
1005 no changes needed to clean_clean
955
1006
1007 ### revert for: clean_deleted
1008
956 ### revert for: clean_removed
1009 ### revert for: clean_removed
957
1010
958 ### revert for: clean_revert
1011 ### revert for: clean_revert
959 no changes needed to clean_revert
1012 no changes needed to clean_revert
960
1013
961 ### revert for: clean_untracked-clean
1014 ### revert for: clean_untracked-clean
962
1015
963 ### revert for: clean_untracked-revert
1016 ### revert for: clean_untracked-revert
964
1017
965 ### revert for: clean_untracked-wc
1018 ### revert for: clean_untracked-wc
966
1019
967 ### revert for: clean_wc
1020 ### revert for: clean_wc
968
1021
969 ### revert for: missing_clean
1022 ### revert for: missing_clean
970 missing_clean: no such file in rev * (glob)
1023 missing_clean: no such file in rev * (glob)
971
1024
1025 ### revert for: missing_deleted
1026
972 ### revert for: missing_removed
1027 ### revert for: missing_removed
973 missing_removed: no such file in rev * (glob)
1028 missing_removed: no such file in rev * (glob)
974
1029
975 ### revert for: missing_revert
1030 ### revert for: missing_revert
976 missing_revert: no such file in rev * (glob)
1031 missing_revert: no such file in rev * (glob)
977
1032
978 ### revert for: missing_untracked-clean
1033 ### revert for: missing_untracked-clean
979 missing_untracked-clean: no such file in rev * (glob)
1034 missing_untracked-clean: no such file in rev * (glob)
980
1035
981 ### revert for: missing_untracked-revert
1036 ### revert for: missing_untracked-revert
982 missing_untracked-revert: no such file in rev * (glob)
1037 missing_untracked-revert: no such file in rev * (glob)
983
1038
984 ### revert for: missing_untracked-wc
1039 ### revert for: missing_untracked-wc
985 file not managed: missing_untracked-wc
1040 file not managed: missing_untracked-wc
986
1041
987 ### revert for: missing_wc
1042 ### revert for: missing_wc
988
1043
989 ### revert for: modified_clean
1044 ### revert for: modified_clean
990 no changes needed to modified_clean
1045 no changes needed to modified_clean
991
1046
1047 ### revert for: modified_deleted
1048
992 ### revert for: modified_removed
1049 ### revert for: modified_removed
993
1050
994 ### revert for: modified_revert
1051 ### revert for: modified_revert
995
1052
996 ### revert for: modified_untracked-clean
1053 ### revert for: modified_untracked-clean
997
1054
998 ### revert for: modified_untracked-revert
1055 ### revert for: modified_untracked-revert
999
1056
1000 ### revert for: modified_untracked-wc
1057 ### revert for: modified_untracked-wc
1001
1058
1002 ### revert for: modified_wc
1059 ### revert for: modified_wc
1003
1060
1004 ### revert for: removed_clean
1061 ### revert for: removed_clean
1005 removed_clean: no such file in rev * (glob)
1062 removed_clean: no such file in rev * (glob)
1006
1063
1064 ### revert for: removed_deleted
1065
1007 ### revert for: removed_removed
1066 ### revert for: removed_removed
1008 removed_removed: no such file in rev * (glob)
1067 removed_removed: no such file in rev * (glob)
1009
1068
1010 ### revert for: removed_revert
1069 ### revert for: removed_revert
1011
1070
1012 ### revert for: removed_untracked-clean
1071 ### revert for: removed_untracked-clean
1013 removed_untracked-clean: no such file in rev * (glob)
1072 removed_untracked-clean: no such file in rev * (glob)
1014
1073
1015 ### revert for: removed_untracked-revert
1074 ### revert for: removed_untracked-revert
1016 file not managed: removed_untracked-revert
1075 file not managed: removed_untracked-revert
1017
1076
1018 ### revert for: removed_untracked-wc
1077 ### revert for: removed_untracked-wc
1019 file not managed: removed_untracked-wc
1078 file not managed: removed_untracked-wc
1020
1079
1021 ### revert for: removed_wc
1080 ### revert for: removed_wc
1022
1081
1023
1082
1024 check resulting directory againt the --all run
1083 check resulting directory againt the --all run
1025 (There should be no difference)
1084 (There should be no difference)
1026
1085
1027 $ python ../dircontent.py > ../content-parent-explicit.txt
1086 $ python ../dircontent.py > ../content-parent-explicit.txt
1028 $ cd ..
1087 $ cd ..
1029 $ diff -U 0 -- content-parent-all.txt content-parent-explicit.txt | grep _
1088 $ diff -U 0 -- content-parent-all.txt content-parent-explicit.txt | grep _
1030 [1]
1089 [1]
1031
1090
1032 Test revert to "base" content with explicit file name
1091 Test revert to "base" content with explicit file name
1033 -----------------------------------------------------
1092 -----------------------------------------------------
1034
1093
1035 (setup from reference repo)
1094 (setup from reference repo)
1036
1095
1037 $ cp -r revert-ref revert-base-explicit
1096 $ cp -r revert-ref revert-base-explicit
1038 $ cd revert-base-explicit
1097 $ cd revert-base-explicit
1039
1098
1040 revert all files individually and check the output
1099 revert all files individually and check the output
1041 (output is expected to be different than in the --all case)
1100 (output is expected to be different than in the --all case)
1042
1101
1043 Misbehavior:
1102 Misbehavior:
1044
1103
1045 - fails to report no change to revert for
1104 - fails to report no change to revert for
1046 |
1105 |
1047 | - clean_clean
1106 | - clean_clean
1048 | - added_revert
1107 | - added_revert
1049 | - clean_revert
1108 | - clean_revert
1050 | - modified_revert
1109 | - modified_revert
1051 | - removed_revert
1110 | - removed_revert
1052 | - added_removed
1111 | - added_removed
1053 | - added_untracked-clean
1112 | - added_untracked-clean
1054 | - added_untracked-revert
1113 | - added_untracked-revert
1055 | - added_untracked-wc
1114 | - added_untracked-wc
1056
1115
1057 $ for file in `python ../gen-revert-cases.py filelist`; do
1116 $ for file in `python ../gen-revert-cases.py filelist`; do
1058 > echo '### revert for:' $file;
1117 > echo '### revert for:' $file;
1059 > hg revert $file --rev 'desc(base)';
1118 > hg revert $file --rev 'desc(base)';
1060 > echo
1119 > echo
1061 > done
1120 > done
1062 ### revert for: added_clean
1121 ### revert for: added_clean
1063
1122
1123 ### revert for: added_deleted
1124
1064 ### revert for: added_removed
1125 ### revert for: added_removed
1065
1126
1066 ### revert for: added_revert
1127 ### revert for: added_revert
1067
1128
1068 ### revert for: added_untracked-clean
1129 ### revert for: added_untracked-clean
1069
1130
1070 ### revert for: added_untracked-revert
1131 ### revert for: added_untracked-revert
1071
1132
1072 ### revert for: added_untracked-wc
1133 ### revert for: added_untracked-wc
1073
1134
1074 ### revert for: added_wc
1135 ### revert for: added_wc
1075
1136
1076 ### revert for: clean_clean
1137 ### revert for: clean_clean
1077
1138
1139 ### revert for: clean_deleted
1140
1078 ### revert for: clean_removed
1141 ### revert for: clean_removed
1079
1142
1080 ### revert for: clean_revert
1143 ### revert for: clean_revert
1081
1144
1082 ### revert for: clean_untracked-clean
1145 ### revert for: clean_untracked-clean
1083
1146
1084 ### revert for: clean_untracked-revert
1147 ### revert for: clean_untracked-revert
1085
1148
1086 ### revert for: clean_untracked-wc
1149 ### revert for: clean_untracked-wc
1087
1150
1088 ### revert for: clean_wc
1151 ### revert for: clean_wc
1089
1152
1090 ### revert for: missing_clean
1153 ### revert for: missing_clean
1091 missing_clean: no such file in rev * (glob)
1154 missing_clean: no such file in rev * (glob)
1092
1155
1156 ### revert for: missing_deleted
1157
1093 ### revert for: missing_removed
1158 ### revert for: missing_removed
1094 missing_removed: no such file in rev * (glob)
1159 missing_removed: no such file in rev * (glob)
1095
1160
1096 ### revert for: missing_revert
1161 ### revert for: missing_revert
1097 missing_revert: no such file in rev * (glob)
1162 missing_revert: no such file in rev * (glob)
1098
1163
1099 ### revert for: missing_untracked-clean
1164 ### revert for: missing_untracked-clean
1100 missing_untracked-clean: no such file in rev * (glob)
1165 missing_untracked-clean: no such file in rev * (glob)
1101
1166
1102 ### revert for: missing_untracked-revert
1167 ### revert for: missing_untracked-revert
1103 missing_untracked-revert: no such file in rev * (glob)
1168 missing_untracked-revert: no such file in rev * (glob)
1104
1169
1105 ### revert for: missing_untracked-wc
1170 ### revert for: missing_untracked-wc
1106 file not managed: missing_untracked-wc
1171 file not managed: missing_untracked-wc
1107
1172
1108 ### revert for: missing_wc
1173 ### revert for: missing_wc
1109
1174
1110 ### revert for: modified_clean
1175 ### revert for: modified_clean
1111
1176
1177 ### revert for: modified_deleted
1178
1112 ### revert for: modified_removed
1179 ### revert for: modified_removed
1113
1180
1114 ### revert for: modified_revert
1181 ### revert for: modified_revert
1115
1182
1116 ### revert for: modified_untracked-clean
1183 ### revert for: modified_untracked-clean
1117
1184
1118 ### revert for: modified_untracked-revert
1185 ### revert for: modified_untracked-revert
1119
1186
1120 ### revert for: modified_untracked-wc
1187 ### revert for: modified_untracked-wc
1121
1188
1122 ### revert for: modified_wc
1189 ### revert for: modified_wc
1123
1190
1124 ### revert for: removed_clean
1191 ### revert for: removed_clean
1125
1192
1193 ### revert for: removed_deleted
1194
1126 ### revert for: removed_removed
1195 ### revert for: removed_removed
1127
1196
1128 ### revert for: removed_revert
1197 ### revert for: removed_revert
1129
1198
1130 ### revert for: removed_untracked-clean
1199 ### revert for: removed_untracked-clean
1131
1200
1132 ### revert for: removed_untracked-revert
1201 ### revert for: removed_untracked-revert
1133
1202
1134 ### revert for: removed_untracked-wc
1203 ### revert for: removed_untracked-wc
1135
1204
1136 ### revert for: removed_wc
1205 ### revert for: removed_wc
1137
1206
1138
1207
1139 check resulting directory againt the --all run
1208 check resulting directory againt the --all run
1140 (There should be no difference)
1209 (There should be no difference)
1141
1210
1142 $ python ../dircontent.py > ../content-base-explicit.txt
1211 $ python ../dircontent.py > ../content-base-explicit.txt
1143 $ cd ..
1212 $ cd ..
1144 $ diff -U 0 -- content-base-all.txt content-base-explicit.txt | grep _
1213 $ diff -U 0 -- content-base-all.txt content-base-explicit.txt | grep _
1145 [1]
1214 [1]
General Comments 0
You need to be logged in to leave comments. Login now