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