[PATCH 3 of 6 V4] merge: refactor initialization of variables in update
Sean Farley
sean.michael.farley at gmail.com
Fri Jan 17 14:14:29 CST 2014
# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1383778927 21600
# Wed Nov 06 17:02:07 2013 -0600
# Node ID ff1a93158e097797c485bba97ba2eae9e4763be4
# Parent 1fea5d10467ba9af2e1083a43df290749fdf5bcf
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.
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -677,10 +677,16 @@ def update(repo, node, branchmerge, forc
onode = node
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;
# but currently we are only checking the branch tips.
try:
@@ -689,15 +695,13 @@ def update(repo, node, branchmerge, forc
if wc.branch() == "default": # no default branch!
node = repo.lookup("tip") # update to tip
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)
### check phase
More information about the Mercurial-devel
mailing list