The function will be used in a later patch.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
The function will be used in a later patch.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
# # XXX: Currently private because I expect the signature to change. | # # XXX: Currently private because I expect the signature to change. | ||||
# # XXX: - bailing out in case of ambiguity vs returning all data. | # # XXX: - bailing out in case of ambiguity vs returning all data. | ||||
# i18n: "_rebasedefaultdest" is a keyword | # i18n: "_rebasedefaultdest" is a keyword | ||||
sourceset = None | sourceset = None | ||||
if x is not None: | if x is not None: | ||||
sourceset = revset.getset(repo, smartset.fullreposet(repo), x) | sourceset = revset.getset(repo, smartset.fullreposet(repo), x) | ||||
return subset & smartset.baseset([_destrebase(repo, sourceset)]) | return subset & smartset.baseset([_destrebase(repo, sourceset)]) | ||||
def _ctxdesc(ctx): | |||||
"""short description for a context""" | |||||
desc = '%d:%s "%s"' % (ctx.rev(), ctx, | |||||
ctx.description().split('\n', 1)[0]) | |||||
repo = ctx.repo() | |||||
names = repo.nodetags(ctx.node()) + repo.nodebookmarks(ctx.node()) | |||||
if names: | |||||
desc += ' (%s)' % ' '.join(names) | |||||
return desc | |||||
class rebaseruntime(object): | class rebaseruntime(object): | ||||
"""This class is a container for rebase runtime state""" | """This class is a container for rebase runtime state""" | ||||
def __init__(self, repo, ui, opts=None): | def __init__(self, repo, ui, opts=None): | ||||
if opts is None: | if opts is None: | ||||
opts = {} | opts = {} | ||||
self.repo = repo | self.repo = repo | ||||
self.ui = ui | self.ui = ui | ||||
self.storestatus() | self.storestatus() | ||||
sortedrevs = repo.revs('sort(%ld, -topo)', self.state) | sortedrevs = repo.revs('sort(%ld, -topo)', self.state) | ||||
cands = [k for k, v in self.state.iteritems() if v == revtodo] | cands = [k for k, v in self.state.iteritems() if v == revtodo] | ||||
total = len(cands) | total = len(cands) | ||||
pos = 0 | pos = 0 | ||||
for rev in sortedrevs: | for rev in sortedrevs: | ||||
ctx = repo[rev] | ctx = repo[rev] | ||||
desc = '%d:%s "%s"' % (ctx.rev(), ctx, | desc = _ctxdesc(ctx) | ||||
ctx.description().split('\n', 1)[0]) | |||||
names = repo.nodetags(ctx.node()) + repo.nodebookmarks(ctx.node()) | |||||
if names: | |||||
desc += ' (%s)' % ' '.join(names) | |||||
if self.state[rev] == rev: | if self.state[rev] == rev: | ||||
ui.status(_('already rebased %s\n') % desc) | ui.status(_('already rebased %s\n') % desc) | ||||
elif self.state[rev] == revtodo: | elif self.state[rev] == revtodo: | ||||
pos += 1 | pos += 1 | ||||
ui.status(_('rebasing %s\n') % desc) | ui.status(_('rebasing %s\n') % desc) | ||||
ui.progress(_("rebasing"), pos, ("%d:%s" % (rev, ctx)), | ui.progress(_("rebasing"), pos, ("%d:%s" % (rev, ctx)), | ||||
_('changesets'), total) | _('changesets'), total) | ||||
p1, p2, base = defineparents(repo, rev, self.dest, self.state) | p1, p2, base = defineparents(repo, rev, self.dest, self.state) |