diff mercurial/commands.py @ 21980:f4e5753745e9

graft: make --force apply across continues (issue3220) Since --force determines the list of revisions to be grafted, it doesn't really make sense for users to have to keep typing --force --continue as they continue grafting.
author Siddharth Agarwal <sid0@fb.com>
date Sat, 26 Jul 2014 14:54:36 -0700
parents c2863cfe8a8a
children 48166e46f111
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Jul 25 18:21:16 2014 -0700
+++ b/mercurial/commands.py	Sat Jul 26 14:54:36 2014 -0700
@@ -3089,7 +3089,8 @@
 
     .. note::
 
-      The -c/--continue option does not reapply earlier options.
+      The -c/--continue option does not reapply earlier options, except
+      for --force.
 
     .. container:: verbose
 
@@ -3155,8 +3156,14 @@
     if not revs:
         return -1
 
-    # check for ancestors of dest branch
-    if not opts.get('force'):
+    # Don't check in the --continue case, in effect retaining --force across
+    # --continues. That's because without --force, any revisions we decided to
+    # skip would have been filtered out here, so they wouldn't have made their
+    # way to the graftstate. With --force, any revisions we would have otherwise
+    # skipped would not have been filtered out, and if they hadn't been applied
+    # already, they'd have been in the graftstate.
+    if not (cont or opts.get('force')):
+        # check for ancestors of dest branch
         crev = repo['.'].rev()
         ancestors = repo.changelog.ancestors([crev], inclusive=True)
         # Cannot use x.remove(y) on smart set, this has to be a list.