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