Skip to content
Snippets Groups Projects
Commit 2160c2e0 authored by Mads Kiilerich's avatar Mads Kiilerich
Browse files

rebase: refactor and rename checkexternal - it is a getter more than a setter

parent 427ce563
Branches
Tags
No related merge requests found
......@@ -259,7 +259,7 @@
if collapsef:
targetancestors = repo.changelog.ancestors([target],
inclusive=True)
external = checkexternal(repo, state, targetancestors)
external = externalparent(repo, state, targetancestors)
if keepbranchesf:
# insert _savebranch at the start of extrafns so if
......@@ -388,7 +388,8 @@
finally:
release(lock, wlock)
def checkexternal(repo, state, targetancestors):
"""Check whether one or more external revisions need to be taken in
consideration. In the latter case, abort.
def externalparent(repo, state, targetancestors):
"""Return the revision that should be used as the second parent
when the revisions in state is collapsed on top of targetancestors.
Abort if there is more than one parent.
"""
......@@ -394,6 +395,6 @@
"""
external = nullrev
parents = set()
source = min(state)
for rev in state:
if rev == source:
continue
......@@ -396,8 +397,7 @@
source = min(state)
for rev in state:
if rev == source:
continue
# Check externals and fail if there are more than one
for p in repo[rev].parents():
if (p.rev() not in state
and p.rev() not in targetancestors):
......@@ -401,11 +401,13 @@
for p in repo[rev].parents():
if (p.rev() not in state
and p.rev() not in targetancestors):
if external != nullrev:
raise util.Abort(_('unable to collapse, there is more '
'than one external parent'))
external = p.rev()
return external
parents.add(p.rev())
if not parents:
return nullrev
if len(parents) == 1:
return parents.pop()
raise util.Abort(_('unable to collapse, there is more '
'than one external parent'))
def concludenode(repo, rev, p1, p2, commitmsg=None, editor=None, extrafn=None):
'Commit the changes and store useful information in extra'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment