##// END OF EJS Templates
rebase: refactor and rename checkexternal - it is a getter more than a setter
Mads Kiilerich -
r19955:2160c2e0 stable
parent child Browse files
Show More
@@ -259,7 +259,7 b' def rebase(ui, repo, **opts):'
259 259 if collapsef:
260 260 targetancestors = repo.changelog.ancestors([target],
261 261 inclusive=True)
262 external = checkexternal(repo, state, targetancestors)
262 external = externalparent(repo, state, targetancestors)
263 263
264 264 if keepbranchesf:
265 265 # insert _savebranch at the start of extrafns so if
@@ -388,24 +388,26 b' def rebase(ui, repo, **opts):'
388 388 finally:
389 389 release(lock, wlock)
390 390
391 def checkexternal(repo, state, targetancestors):
392 """Check whether one or more external revisions need to be taken in
393 consideration. In the latter case, abort.
391 def externalparent(repo, state, targetancestors):
392 """Return the revision that should be used as the second parent
393 when the revisions in state is collapsed on top of targetancestors.
394 Abort if there is more than one parent.
394 395 """
395 external = nullrev
396 parents = set()
396 397 source = min(state)
397 398 for rev in state:
398 399 if rev == source:
399 400 continue
400 # Check externals and fail if there are more than one
401 401 for p in repo[rev].parents():
402 402 if (p.rev() not in state
403 403 and p.rev() not in targetancestors):
404 if external != nullrev:
405 raise util.Abort(_('unable to collapse, there is more '
406 'than one external parent'))
407 external = p.rev()
408 return external
404 parents.add(p.rev())
405 if not parents:
406 return nullrev
407 if len(parents) == 1:
408 return parents.pop()
409 raise util.Abort(_('unable to collapse, there is more '
410 'than one external parent'))
409 411
410 412 def concludenode(repo, rev, p1, p2, commitmsg=None, editor=None, extrafn=None):
411 413 'Commit the changes and store useful information in extra'
General Comments 0
You need to be logged in to leave comments. Login now