changeset 26722:6cd643a1d32c

destupdate: move obsolete handling first This block was overwriting any result from the previous block anyway. So we move it first to prove it is possible and we'll extract it in its own function in the next patch.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 15 Oct 2015 02:12:55 +0100
parents 3d094fbedf74
children 52d08a93de1f
files mercurial/destutil.py
diffstat 1 files changed, 18 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/destutil.py	Thu Oct 15 02:12:15 2015 +0100
+++ b/mercurial/destutil.py	Thu Oct 15 02:12:55 2015 +0100
@@ -53,22 +53,8 @@
     node = None
     wc = repo[None]
     p1 = wc.p1()
-    movemark, activemark = None
-
-    if node is None:
-        # we also move the active bookmark, if any
-        node, movemark = bookmarks.calculateupdate(repo.ui, repo, None)
-        if node is not None:
-            activemark = node
+    movemark = activemark = None
 
-        if node is None:
-            try:
-                node = repo.branchtip(wc.branch())
-            except error.RepoLookupError:
-                if wc.branch() == 'default': # no default branch!
-                    node = repo.lookup('tip') # update to tip
-                else:
-                    raise error.Abort(_("branch %s not found") % wc.branch())
     if p1.obsolete() and not p1.children():
         # allow updating to successors
         successors = obsolete.successorssets(repo, p1.node())
@@ -94,6 +80,23 @@
             # get the max revision for the given successors set,
             # i.e. the 'tip' of a set
             node = repo.revs('max(%ln)', successors).first()
+            if bookmarks.isactivewdirparent(repo):
+                movemark = repo['.'].node()
+
+    if node is None:
+        # we also move the active bookmark, if any
+        node, movemark = bookmarks.calculateupdate(repo.ui, repo, None)
+        if node is not None:
+            activemark = node
+
+        if node is None:
+            try:
+                node = repo.branchtip(wc.branch())
+            except error.RepoLookupError:
+                if wc.branch() == 'default': # no default branch!
+                    node = repo.lookup('tip') # update to tip
+                else:
+                    raise error.Abort(_("branch %s not found") % wc.branch())
     rev = repo[node].rev()
 
     _destupdatevalidate(repo, rev, clean, check)