diff mercurial/destutil.py @ 26629:ae5f7be2b4ab

destupdate: include the 'check' logic After moving logic from 'merge.update' into 'destutil.destupdate', we are now moving logic from 'command.update' in 'destutil.destupdate'. This will make the function actually useful in predicting (and altering) the update behavior.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 29 Sep 2015 00:18:49 -0700
parents 45b86dbabbda
children 5c57d01fe64e
line wrap: on
line diff
--- a/mercurial/destutil.py	Mon Oct 05 03:50:47 2015 -0700
+++ b/mercurial/destutil.py	Tue Sep 29 00:18:49 2015 -0700
@@ -11,7 +11,7 @@
     obsolete,
 )
 
-def destupdate(repo, clean=False):
+def destupdate(repo, clean=False, check=False):
     """destination for bare update operation
     """
     # Here is where we should consider bookmarks, divergent bookmarks, and tip
@@ -71,7 +71,7 @@
                     hint = _("commit and merge, or update --clean to"
                              " discard changes")
                     raise error.Abort(msg, hint=hint)
-                else:  # destination is not a descendant.
+                elif not check:  # destination is not a descendant.
                     msg = _("not a linear update")
                     hint = _("merge or update --check to force update")
                     raise error.Abort(msg, hint=hint)