##// END OF EJS Templates
revert: do not reverse hunks in interactive when REV is not parent (issue5096)...
Denis Laxalde -
r34969:3649c3f2 default
parent child Browse files
Show More
@@ -3790,9 +3790,8 b' def _performrevert(repo, parents, ctx, a'
3790 operation = 'discard'
3790 operation = 'discard'
3791 reversehunks = True
3791 reversehunks = True
3792 if node != parent:
3792 if node != parent:
3793 operation = 'revert'
3793 operation = 'apply'
3794 reversehunks = repo.ui.configbool('experimental',
3794 reversehunks = False
3795 'revertalternateinteractivemode')
3796 if reversehunks:
3795 if reversehunks:
3797 diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts)
3796 diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts)
3798 else:
3797 else:
@@ -439,9 +439,6 b" coreconfigitem('experimental', 'obsmarke"
439 coreconfigitem('experimental', 'rebase.multidest',
439 coreconfigitem('experimental', 'rebase.multidest',
440 default=False,
440 default=False,
441 )
441 )
442 coreconfigitem('experimental', 'revertalternateinteractivemode',
443 default=True,
444 )
445 coreconfigitem('experimental', 'revlogv2',
442 coreconfigitem('experimental', 'revlogv2',
446 default=None,
443 default=None,
447 )
444 )
@@ -997,16 +997,26 b' class recordhunk(object):'
997 def getmessages():
997 def getmessages():
998 return {
998 return {
999 'multiple': {
999 'multiple': {
1000 'apply': _("apply change %d/%d to '%s'?"),
1000 'discard': _("discard change %d/%d to '%s'?"),
1001 'discard': _("discard change %d/%d to '%s'?"),
1001 'record': _("record change %d/%d to '%s'?"),
1002 'record': _("record change %d/%d to '%s'?"),
1002 'revert': _("revert change %d/%d to '%s'?"),
1003 },
1003 },
1004 'single': {
1004 'single': {
1005 'apply': _("apply this change to '%s'?"),
1005 'discard': _("discard this change to '%s'?"),
1006 'discard': _("discard this change to '%s'?"),
1006 'record': _("record this change to '%s'?"),
1007 'record': _("record this change to '%s'?"),
1007 'revert': _("revert this change to '%s'?"),
1008 },
1008 },
1009 'help': {
1009 'help': {
1010 'apply': _('[Ynesfdaq?]'
1011 '$$ &Yes, apply this change'
1012 '$$ &No, skip this change'
1013 '$$ &Edit this change manually'
1014 '$$ &Skip remaining changes to this file'
1015 '$$ Apply remaining changes to this &file'
1016 '$$ &Done, skip remaining changes and files'
1017 '$$ Apply &all changes to all remaining files'
1018 '$$ &Quit, applying no changes'
1019 '$$ &? (display help)'),
1010 'discard': _('[Ynesfdaq?]'
1020 'discard': _('[Ynesfdaq?]'
1011 '$$ &Yes, discard this change'
1021 '$$ &Yes, discard this change'
1012 '$$ &No, skip this change'
1022 '$$ &No, skip this change'
@@ -1027,16 +1037,6 b' def getmessages():'
1027 '$$ Record &all changes to all remaining files'
1037 '$$ Record &all changes to all remaining files'
1028 '$$ &Quit, recording no changes'
1038 '$$ &Quit, recording no changes'
1029 '$$ &? (display help)'),
1039 '$$ &? (display help)'),
1030 'revert': _('[Ynesfdaq?]'
1031 '$$ &Yes, revert this change'
1032 '$$ &No, skip this change'
1033 '$$ &Edit this change manually'
1034 '$$ &Skip remaining changes to this file'
1035 '$$ Revert remaining changes to this &file'
1036 '$$ &Done, skip remaining changes and files'
1037 '$$ Revert &all changes to all remaining files'
1038 '$$ &Quit, reverting no changes'
1039 '$$ &? (display help)')
1040 }
1040 }
1041 }
1041 }
1042
1042
@@ -60,56 +60,56 b' 10 run the same test than 8 from within '
60 2 hunks, 2 lines changed
60 2 hunks, 2 lines changed
61 examine changes to 'f'? [Ynesfdaq?] y
61 examine changes to 'f'? [Ynesfdaq?] y
62
62
63 @@ -1,5 +1,6 @@
63 @@ -1,6 +1,5 @@
64 +a
64 -a
65 1
65 1
66 2
66 2
67 3
67 3
68 4
68 4
69 5
69 5
70 revert change 1/6 to 'f'? [Ynesfdaq?] y
70 apply change 1/6 to 'f'? [Ynesfdaq?] y
71
71
72 @@ -1,5 +2,6 @@
72 @@ -2,6 +1,5 @@
73 1
73 1
74 2
74 2
75 3
75 3
76 4
76 4
77 5
77 5
78 +b
78 -b
79 revert change 2/6 to 'f'? [Ynesfdaq?] y
79 apply change 2/6 to 'f'? [Ynesfdaq?] y
80
80
81 diff --git a/folder1/g b/folder1/g
81 diff --git a/folder1/g b/folder1/g
82 2 hunks, 2 lines changed
82 2 hunks, 2 lines changed
83 examine changes to 'folder1/g'? [Ynesfdaq?] y
83 examine changes to 'folder1/g'? [Ynesfdaq?] y
84
84
85 @@ -1,5 +1,6 @@
85 @@ -1,6 +1,5 @@
86 +c
86 -c
87 1
87 1
88 2
88 2
89 3
89 3
90 4
90 4
91 5
91 5
92 revert change 3/6 to 'folder1/g'? [Ynesfdaq?] ?
92 apply change 3/6 to 'folder1/g'? [Ynesfdaq?] ?
93
93
94 y - yes, revert this change
94 y - yes, apply this change
95 n - no, skip this change
95 n - no, skip this change
96 e - edit this change manually
96 e - edit this change manually
97 s - skip remaining changes to this file
97 s - skip remaining changes to this file
98 f - revert remaining changes to this file
98 f - apply remaining changes to this file
99 d - done, skip remaining changes and files
99 d - done, skip remaining changes and files
100 a - revert all changes to all remaining files
100 a - apply all changes to all remaining files
101 q - quit, reverting no changes
101 q - quit, applying no changes
102 ? - ? (display help)
102 ? - ? (display help)
103 revert change 3/6 to 'folder1/g'? [Ynesfdaq?] y
103 apply change 3/6 to 'folder1/g'? [Ynesfdaq?] y
104
104
105 @@ -1,5 +2,6 @@
105 @@ -2,6 +1,5 @@
106 1
106 1
107 2
107 2
108 3
108 3
109 4
109 4
110 5
110 5
111 +d
111 -d
112 revert change 4/6 to 'folder1/g'? [Ynesfdaq?] n
112 apply change 4/6 to 'folder1/g'? [Ynesfdaq?] n
113
113
114 diff --git a/folder2/h b/folder2/h
114 diff --git a/folder2/h b/folder2/h
115 2 hunks, 2 lines changed
115 2 hunks, 2 lines changed
@@ -157,12 +157,12 b" Test that a noop revert doesn't do an un"
157 1 hunks, 1 lines changed
157 1 hunks, 1 lines changed
158 examine changes to 'folder1/g'? [Ynesfdaq?] y
158 examine changes to 'folder1/g'? [Ynesfdaq?] y
159
159
160 @@ -3,3 +3,4 @@
160 @@ -3,4 +3,3 @@
161 3
161 3
162 4
162 4
163 5
163 5
164 +d
164 -d
165 revert this change to 'folder1/g'? [Ynesfdaq?] n
165 apply this change to 'folder1/g'? [Ynesfdaq?] n
166
166
167 $ ls folder1/
167 $ ls folder1/
168 g
168 g
@@ -173,12 +173,12 b' Test --no-backup'
173 1 hunks, 1 lines changed
173 1 hunks, 1 lines changed
174 examine changes to 'folder1/g'? [Ynesfdaq?] y
174 examine changes to 'folder1/g'? [Ynesfdaq?] y
175
175
176 @@ -3,3 +3,4 @@
176 @@ -3,4 +3,3 @@
177 3
177 3
178 4
178 4
179 5
179 5
180 +d
180 -d
181 revert this change to 'folder1/g'? [Ynesfdaq?] y
181 apply this change to 'folder1/g'? [Ynesfdaq?] y
182
182
183 $ ls folder1/
183 $ ls folder1/
184 g
184 g
@@ -206,45 +206,45 b' Test --no-backup'
206 2 hunks, 2 lines changed
206 2 hunks, 2 lines changed
207 examine changes to 'f'? [Ynesfdaq?] y
207 examine changes to 'f'? [Ynesfdaq?] y
208
208
209 @@ -1,5 +1,6 @@
209 @@ -1,6 +1,5 @@
210 +a
210 -a
211 1
211 1
212 2
212 2
213 3
213 3
214 4
214 4
215 5
215 5
216 revert change 1/6 to 'f'? [Ynesfdaq?] y
216 apply change 1/6 to 'f'? [Ynesfdaq?] y
217
217
218 @@ -1,5 +2,6 @@
218 @@ -2,6 +1,5 @@
219 1
219 1
220 2
220 2
221 3
221 3
222 4
222 4
223 5
223 5
224 +b
224 -b
225 revert change 2/6 to 'f'? [Ynesfdaq?] y
225 apply change 2/6 to 'f'? [Ynesfdaq?] y
226
226
227 diff --git a/folder1/g b/folder1/g
227 diff --git a/folder1/g b/folder1/g
228 2 hunks, 2 lines changed
228 2 hunks, 2 lines changed
229 examine changes to 'folder1/g'? [Ynesfdaq?] y
229 examine changes to 'folder1/g'? [Ynesfdaq?] y
230
230
231 @@ -1,5 +1,6 @@
231 @@ -1,6 +1,5 @@
232 +c
232 -c
233 1
233 1
234 2
234 2
235 3
235 3
236 4
236 4
237 5
237 5
238 revert change 3/6 to 'folder1/g'? [Ynesfdaq?] y
238 apply change 3/6 to 'folder1/g'? [Ynesfdaq?] y
239
239
240 @@ -1,5 +2,6 @@
240 @@ -2,6 +1,5 @@
241 1
241 1
242 2
242 2
243 3
243 3
244 4
244 4
245 5
245 5
246 +d
246 -d
247 revert change 4/6 to 'folder1/g'? [Ynesfdaq?] n
247 apply change 4/6 to 'folder1/g'? [Ynesfdaq?] n
248
248
249 diff --git a/folder2/h b/folder2/h
249 diff --git a/folder2/h b/folder2/h
250 2 hunks, 2 lines changed
250 2 hunks, 2 lines changed
@@ -368,77 +368,6 b' 3) Use interactive revert with editing ('
368 $ cat k
368 $ cat k
369 42
369 42
370
370
371 Check the experimental config to invert the selection:
372 $ cat <<EOF >> $HGRCPATH
373 > [experimental]
374 > revertalternateinteractivemode=False
375 > EOF
376
377
378 $ hg up -C .
379 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
380 $ printf 'firstline\nc\n1\n2\n3\n 3\n5\nd\nlastline\n' > folder1/g
381 $ hg diff --nodates
382 diff -r a3d963a027aa folder1/g
383 --- a/folder1/g
384 +++ b/folder1/g
385 @@ -1,7 +1,9 @@
386 +firstline
387 c
388 1
389 2
390 3
391 -4
392 + 3
393 5
394 d
395 +lastline
396 $ hg revert -i <<EOF
397 > y
398 > y
399 > y
400 > n
401 > EOF
402 reverting folder1/g (glob)
403 diff --git a/folder1/g b/folder1/g
404 3 hunks, 3 lines changed
405 examine changes to 'folder1/g'? [Ynesfdaq?] y
406
407 @@ -1,4 +1,5 @@
408 +firstline
409 c
410 1
411 2
412 3
413 discard change 1/3 to 'folder1/g'? [Ynesfdaq?] y
414
415 @@ -1,7 +2,7 @@
416 c
417 1
418 2
419 3
420 -4
421 + 3
422 5
423 d
424 discard change 2/3 to 'folder1/g'? [Ynesfdaq?] y
425
426 @@ -6,2 +7,3 @@
427 5
428 d
429 +lastline
430 discard change 3/3 to 'folder1/g'? [Ynesfdaq?] n
431
432 $ hg diff --nodates
433 diff -r a3d963a027aa folder1/g
434 --- a/folder1/g
435 +++ b/folder1/g
436 @@ -5,3 +5,4 @@
437 4
438 5
439 d
440 +lastline
441
442 $ hg update -C .
371 $ hg update -C .
443 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
372 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
444 $ hg purge
373 $ hg purge
@@ -463,11 +392,6 b' Check the experimental config to invert '
463
392
464 When a line without EOL is selected during "revert -i" (issue5651)
393 When a line without EOL is selected during "revert -i" (issue5651)
465
394
466 $ cat <<EOF >> $HGRCPATH
467 > [experimental]
468 > %unset revertalternateinteractivemode
469 > EOF
470
471 $ hg init $TESTTMP/revert-i-eol
395 $ hg init $TESTTMP/revert-i-eol
472 $ cd $TESTTMP/revert-i-eol
396 $ cd $TESTTMP/revert-i-eol
473 $ echo 0 > a
397 $ echo 0 > a
@@ -487,11 +411,11 b' When a line without EOL is selected duri'
487 1 hunks, 1 lines changed
411 1 hunks, 1 lines changed
488 examine changes to 'a'? [Ynesfdaq?] y
412 examine changes to 'a'? [Ynesfdaq?] y
489
413
490 @@ -1,1 +1,2 @@
414 @@ -1,2 +1,1 @@
491 0
415 0
492 +1
416 -1
493 \ No newline at end of file
417 \ No newline at end of file
494 revert this change to 'a'? [Ynesfdaq?] y
418 apply this change to 'a'? [Ynesfdaq?] y
495
419
496 $ cat a
420 $ cat a
497 0
421 0
General Comments 0
You need to be logged in to leave comments. Login now