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