diff mercurial/commands.py @ 26628:45b86dbabbda

destupdate: move the check related to the "clean" logic in the function We want this function to exactly predict the behavior for update. Moreover, we would like to remove all high level behavior logic out of the merge module so this is a step forward. Now that the 'destupdate' function both compute and validate the destination, we can directly use it at the command level, ensuring that the 'hg update' command never call 'merge.update' without a defined destination. This is a first (but significant) step toward having 'merge.update' always feed with a properly validated destination and free of high level logic.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 05 Oct 2015 03:50:47 -0700
parents 36383507a6f8
children ae5f7be2b4ab
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Oct 12 19:22:34 2015 +0200
+++ b/mercurial/commands.py	Mon Oct 05 03:50:47 2015 -0700
@@ -20,7 +20,7 @@
 import minirst, revset, fileset
 import dagparser, context, simplemerge, graphmod, copies
 import random, operator
-import setdiscovery, treediscovery, dagutil, pvec, localrepo
+import setdiscovery, treediscovery, dagutil, pvec, localrepo, destutil
 import phases, obsolete, exchange, bundle2, repair, lock as lockmod
 import ui as uimod
 
@@ -6597,6 +6597,8 @@
             cmdutil.bailifchanged(repo, merge=False)
             if rev is None:
                 rev = repo[repo[None].branch()].rev()
+        elif rev is None:
+            rev = destutil.destupdate(repo, clean=clean)
 
         repo.ui.setconfig('ui', 'forcemerge', tool, 'update')