changeset 20279:5b4f963d21cc

merge: refactor initialization of variables in update There is no code change here but this helps prepare for future commits that will fix a bare update with obsolete markers.
author Sean Farley <sean.michael.farley@gmail.com>
date Wed, 06 Nov 2013 17:02:07 -0600
parents 20ef533ffb01
children 95b9c6149e17
files mercurial/merge.py
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Wed Nov 06 10:26:25 2013 -0600
+++ b/mercurial/merge.py	Wed Nov 06 17:02:07 2013 -0600
@@ -679,6 +679,12 @@
     wlock = repo.wlock()
     try:
         wc = repo[None]
+        pl = wc.parents()
+        p1 = pl[0]
+        pa = None
+        if ancestor:
+            pa = repo[ancestor]
+
         if node is None:
             # Here is where we should consider bookmarks, divergent bookmarks,
             # foreground changesets (successors), and tip of current branch;
@@ -691,11 +697,9 @@
                 else:
                     raise util.Abort(_("branch %s not found") % wc.branch())
         overwrite = force and not branchmerge
-        pl = wc.parents()
-        p1, p2 = pl[0], repo[node]
-        if ancestor:
-            pa = repo[ancestor]
-        else:
+
+        p2 = repo[node]
+        if pa is None:
             pa = p1.ancestor(p2)
 
         fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2)