Weaning away from basectx.int.
Details
Details
- Reviewers
yuja - Group Reviewers
hg-reviewers - Commits
- rHG0b57596253b8: rebase: use ctx.rev() instead of %d % ctx
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
yuja |
hg-reviewers |
Weaning away from basectx.int.
Lint Skipped |
Unit Tests Skipped |
dest = scmutil.revsingle(repo, destf) | dest = scmutil.revsingle(repo, destf) | ||||
else: | else: | ||||
dest = repo[_destrebase(repo, base, destspace=destspace)] | dest = repo[_destrebase(repo, base, destspace=destspace)] | ||||
destf = str(dest) | destf = str(dest) | ||||
roots = [] # selected children of branching points | roots = [] # selected children of branching points | ||||
bpbase = {} # {branchingpoint: [origbase]} | bpbase = {} # {branchingpoint: [origbase]} | ||||
for b in base: # group bases by branching points | for b in base: # group bases by branching points | ||||
bp = repo.revs('ancestor(%d, %d)', b, dest).first() | bp = repo.revs('ancestor(%d, %d)', b, dest.rev()).first() | ||||
bpbase[bp] = bpbase.get(bp, []) + [b] | bpbase[bp] = bpbase.get(bp, []) + [b] | ||||
if None in bpbase: | if None in bpbase: | ||||
# emulate the old behavior, showing "nothing to rebase" (a better | # emulate the old behavior, showing "nothing to rebase" (a better | ||||
# behavior may be abort with "cannot find branching point" error) | # behavior may be abort with "cannot find branching point" error) | ||||
bpbase.clear() | bpbase.clear() | ||||
for bp, bs in bpbase.iteritems(): # calculate roots | for bp, bs in bpbase.iteritems(): # calculate roots | ||||
roots += list(repo.revs('children(%d) & ancestors(%ld)', bp, bs)) | roots += list(repo.revs('children(%d) & ancestors(%ld)', bp, bs)) | ||||
rebaseset = repo.revs('%ld::', roots) | rebaseset = repo.revs('%ld::', roots) | ||||
if not rebaseset: | if not rebaseset: | ||||
# transform to list because smartsets are not comparable to | # transform to list because smartsets are not comparable to | ||||
# lists. This should be improved to honor laziness of | # lists. This should be improved to honor laziness of | ||||
# smartset. | # smartset. | ||||
if list(base) == [dest.rev()]: | if list(base) == [dest.rev()]: | ||||
if basef: | if basef: | ||||
ui.status(_('nothing to rebase - %s is both "base"' | ui.status(_('nothing to rebase - %s is both "base"' | ||||
' and destination\n') % dest) | ' and destination\n') % dest) | ||||
else: | else: | ||||
ui.status(_('nothing to rebase - working directory ' | ui.status(_('nothing to rebase - working directory ' | ||||
'parent is also destination\n')) | 'parent is also destination\n')) | ||||
elif not repo.revs('%ld - ::%d', base, dest): | elif not repo.revs('%ld - ::%d', base, dest.rev()): | ||||
if basef: | if basef: | ||||
ui.status(_('nothing to rebase - "base" %s is ' | ui.status(_('nothing to rebase - "base" %s is ' | ||||
'already an ancestor of destination ' | 'already an ancestor of destination ' | ||||
'%s\n') % | '%s\n') % | ||||
('+'.join(str(repo[r]) for r in base), | ('+'.join(str(repo[r]) for r in base), | ||||
dest)) | dest)) | ||||
else: | else: | ||||
ui.status(_('nothing to rebase - working ' | ui.status(_('nothing to rebase - working ' |