destupdate: indent bookmark and branch logic
authorPierre-Yves David <pierre-yves.david@fb.com>
Thu, 15 Oct 2015 02:12:15 +0100
changeset 26721 3d094fbedf74
parent 26720 6c22a17faa18
child 26722 6cd643a1d32c
destupdate: indent bookmark and branch logic We'll move the obsolete related logic first (as it is overwriting any other anyway) to make the next patch clearer we add indentation in this one.
mercurial/destutil.py
--- a/mercurial/destutil.py	Thu Oct 15 14:10:57 2015 +0100
+++ b/mercurial/destutil.py	Thu Oct 15 02:12:15 2015 +0100
@@ -53,22 +53,22 @@
     node = None
     wc = repo[None]
     p1 = wc.p1()
-    activemark = 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())
+        # 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())
     if p1.obsolete() and not p1.children():
         # allow updating to successors
         successors = obsolete.successorssets(repo, p1.node())