[Reviewers] [Differential] [Request, 16 lines] D22: rebase: extract ctx description logic to a function
quark (Jun Wu)
phabricator-noreply at mercurial-scm.org
Mon Jul 10 19:15:19 UTC 2017
quark created this revision.
Herald added a subscriber: reviewers.
REVISION SUMMARY
The function will be used in a later patch.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D22
AFFECTED FILES
hgext/rebase.py
CHANGE DETAILS
Index: hgext/rebase.py
===================================================================
--- hgext/rebase.py
+++ hgext/rebase.py
@@ -122,6 +122,16 @@
sourceset = revset.getset(repo, smartset.fullreposet(repo), x)
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):
"""This class is a container for rebase runtime state"""
def __init__(self, repo, ui, opts=None):
@@ -377,11 +387,7 @@
pos = 0
for rev in sortedrevs:
ctx = repo[rev]
- desc = '%d:%s "%s"' % (ctx.rev(), ctx,
- ctx.description().split('\n', 1)[0])
- names = repo.nodetags(ctx.node()) + repo.nodebookmarks(ctx.node())
- if names:
- desc += ' (%s)' % ' '.join(names)
+ desc = _ctxdesc(ctx)
if self.state[rev] == rev:
ui.status(_('already rebased %s\n') % desc)
elif self.state[rev] == revtodo:
EMAIL PREFERENCES
https://phab.mercurial-scm.org/settings/panel/emailpreferences/
To: quark
Cc: reviewers
More information about the Reviewers
mailing list