[PATCH 12 of 17] rebase: rename defineparents to computerebase by also returning merge parents
Mads Kiilerich
mads at kiilerich.com
Sun Nov 30 13:08:39 CST 2014
# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1417052361 -3600
# Thu Nov 27 02:39:21 2014 +0100
# Node ID 303cb3b88ef835c2dad3e1917b0d21715f461756
# Parent b7fac908f85970b07dcc14903545097b82204bb6
rebase: rename defineparents to computerebase by also returning merge parents
So far the merge parents are trivial. Soon, we want to compute it more
carefully and correctly.
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -379,8 +379,8 @@ def rebase(ui, repo, **opts):
if state[rev] == nullrev:
ui.progress(_("rebasing"), pos, ("%d:%s" % (rev, short(node))),
_('changesets'), total)
- p1, p2, base = defineparents(repo, rev, target, state,
- targetancestors)
+ m1, m2, anc, p1, p2 = computerebase(repo, rev, target, state,
+ targetancestors)
storestatus(repo, originalwd, target, state, collapsef, keepf,
keepbranchesf, external, activebookmark)
if len(repo.parents()) == 2:
@@ -389,7 +389,7 @@ def rebase(ui, repo, **opts):
try:
ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
'rebase')
- stats = rebasenode(repo, rev, p1, base, state, collapsef,
+ stats = rebasenode(repo, m2, m1, anc, state, collapsef,
target)
if stats and stats[3] > 0:
raise error.InterventionRequired(
@@ -438,8 +438,8 @@ def rebase(ui, repo, **opts):
ui.note(_('rebase merging completed\n'))
if collapsef and not keepopen:
- p1, p2, _base = defineparents(repo, min(state), target,
- state, targetancestors)
+ _m1, _m2, _anc, p1, _p2 = computerebase(repo, min(state), target,
+ state, targetancestors)
editopt = opts.get('edit')
editform = 'rebase.collapse'
if collapsemsg:
@@ -595,8 +595,11 @@ def nearestrebased(repo, rev, state):
else:
return None
-def defineparents(repo, rev, target, state, targetancestors):
- 'Return the new parent relationship of the revision that will be rebased'
+def computerebase(repo, rev, target, state, targetancestors):
+ '''Return the merge revisions and new parent relationship of rev rebased
+ to target:
+ merge parent 1, merge parent 2, ancestor, new parent 1, new parent 2
+ '''
parents = repo[rev].parents()
p1 = p2 = nullrev
@@ -678,8 +681,8 @@ def defineparents(repo, rev, target, sta
# Raise because this function is called wrong (see issue 4106)
raise AssertionError('no base found to rebase on '
- '(defineparents called wrong)')
- return p1, p2, base
+ '(computerebase called wrong)')
+ return p1, rev, base, p1, p2
def isagitpatch(repo, patchname):
'Return true if the given patch is in git format'
@@ -937,7 +940,7 @@ def buildstate(repo, dest, rebaseset, co
# | unrelated source | new parent is <dest> | ambiguous, abort |
# +------------------+----------------------+-------------------------+
#
- # The actual abort is handled by `defineparents`
+ # The actual abort is handled by `computerebase`
if len(root.parents()) <= 1:
# ancestors of <root> not ancestors of <dest>
detachset.update(repo.changelog.findmissingrevs([commonbase.rev()],
@@ -949,7 +952,7 @@ def buildstate(repo, dest, rebaseset, co
# If we have multiple roots, we may have "hole" in the rebase set.
# Rebase roots that descend from those "hole" should not be detached as
# other root are. We use the special `revignored` to inform rebase that
- # the revision should be ignored but that `defineparents` should search
+ # the revision should be ignored but that `computerebase` should search
# a rebase destination that make sense regarding rebased topology.
rebasedomain = set(repo.revs('%ld::%ld', rebaseset, rebaseset))
for ignored in set(rebasedomain) - set(rebaseset):
More information about the Mercurial-devel
mailing list