--- a/hgext3rd/topic/__init__.py Thu Jul 25 09:59:41 2019 -0700
+++ b/hgext3rd/topic/__init__.py Mon Jul 29 14:38:31 2019 +0200
@@ -137,6 +137,7 @@
obsolete,
patch,
phases,
+ pycompat,
registrar,
scmutil,
templatefilters,
@@ -186,11 +187,11 @@
'topic.active': 'green',
}
-__version__ = '0.15.1.dev'
+__version__ = b'0.16.0.dev'
-testedwith = '4.5.2 4.6.2 4.7 4.8 4.9 5.0'
-minimumhgversion = '4.5'
-buglink = 'https://bz.mercurial-scm.org/'
+testedwith = b'4.5.2 4.6.2 4.7 4.8 4.9 5.0'
+minimumhgversion = b'4.5'
+buglink = b'https://bz.mercurial-scm.org/'
if util.safehasattr(registrar, 'configitem'):
@@ -436,6 +437,15 @@
return super(topicrepo, self).branchmap()
return self.filtered(topicfilter).branchmap()
+ def branchheads(self, branch=None, start=None, closed=False):
+ if branch is None:
+ branch = self[None].branch()
+ if self.currenttopic:
+ branch = "%s:%s" % (branch, self.currenttopic)
+ return super(topicrepo, self).branchheads(branch=branch,
+ start=start,
+ closed=closed)
+
def invalidatevolatilesets(self):
# XXX we might be able to move this to something invalidated less often
super(topicrepo, self).invalidatevolatilesets()
@@ -537,7 +547,7 @@
csetcount = stack.stack(repo, topic=ct).changesetcount
empty = csetcount == 0
if empty and not ctwasempty:
- ui.status('active topic %r is now empty\n' % ct)
+ ui.status("active topic '%s' is now empty\n" % ct)
trnames = getattr(tr, 'names', getattr(tr, '_names', ()))
if ('phase' in trnames
or any(n.startswith('push-response')
@@ -546,10 +556,10 @@
hint = _("(see 'hg help topics' for more information)\n")
if ctwasempty and not empty:
if csetcount == 1:
- msg = _('active topic %r grew its first changeset\n%s')
+ msg = _("active topic '%s' grew its first changeset\n%s")
ui.status(msg % (ct, hint))
else:
- msg = _('active topic %r grew its %s first changesets\n%s')
+ msg = _("active topic '%s' grew its %s first changesets\n%s")
ui.status(msg % (ct, csetcount, hint))
tr.addpostclose('signalcurrenttopicempty', currenttopicempty)
@@ -563,13 +573,13 @@
listnames=lambda repo: repo.topics))
if post45template:
- @templatekeyword('topic', requires={'ctx'})
+ @templatekeyword(b'topic', requires={b'ctx'})
def topickw(context, mapping):
""":topic: String. The topic of the changeset"""
ctx = context.resource(mapping, 'ctx')
return ctx.topic()
- @templatekeyword('topicidx', requires={'ctx'})
+ @templatekeyword(b'topicidx', requires={b'ctx'})
def topicidxkw(context, mapping):
""":topicidx: Integer. Index of the changeset as a stack alias"""
ctx = context.resource(mapping, 'ctx')
@@ -617,14 +627,14 @@
# revset predicates are automatically registered at loading via this symbol
revsetpredicate = topicrevset.revsetpredicate
-@command('topics', [
- ('', 'clear', False, 'clear active topic if any'),
- ('r', 'rev', [], 'revset of existing revisions', _('REV')),
- ('l', 'list', False, 'show the stack of changeset in the topic'),
- ('', 'age', False, 'show when you last touched the topics'),
- ('', 'current', None, 'display the current topic only'),
+@command(b'topics', [
+ (b'', b'clear', False, b'clear active topic if any'),
+ (b'r', b'rev', [], b'revset of existing revisions', _(b'REV')),
+ (b'l', b'list', False, b'show the stack of changeset in the topic'),
+ (b'', b'age', False, b'show when you last touched the topics'),
+ (b'', b'current', None, b'display the current topic only'),
] + commands.formatteropts,
- _('hg topics [TOPIC]'))
+ _(b'hg topics [TOPIC]'))
def topics(ui, repo, topic=None, **opts):
"""View current topic, set current topic, change topic for a set of revisions, or see all topics.
@@ -702,7 +712,8 @@
topic = repo.currenttopic
if not topic:
raise error.Abort(_('no active topic to list'))
- return stack.showstack(ui, repo, topic=topic, opts=opts)
+ return stack.showstack(ui, repo, topic=topic,
+ opts=pycompat.byteskwargs(opts))
if touchedrevs:
if not obsolete.isenabled(repo, obsolete.createmarkersopt):
@@ -752,7 +763,7 @@
ui.write_err(_('no active topic\n'))
ret = 1
elif current:
- fm = ui.formatter('topic', opts)
+ fm = ui.formatter('topic', pycompat.byteskwargs(opts))
namemask = '%s\n'
label = 'topic.active'
fm.startitem()
@@ -782,7 +793,8 @@
if topic is None:
branch = repo[None].branch()
ui.pager('stack')
- return stack.showstack(ui, repo, branch=branch, topic=topic, opts=opts)
+ return stack.showstack(ui, repo, branch=branch, topic=topic,
+ opts=pycompat.byteskwargs(opts))
@command('debugcb|debugconvertbookmark', [
('b', 'bookmark', '', _('bookmark to convert to topic')),
@@ -804,7 +816,7 @@
bmstore = repo._bookmarks
nodetobook = {}
- for book, revnode in bmstore.iteritems():
+ for book, revnode in bmstore.items():
if nodetobook.get(revnode):
nodetobook[revnode].append(book)
else:
@@ -836,7 +848,7 @@
actions[(bookmark, revnum)] = targetrevs
elif convertall:
- for bmark, revnode in sorted(bmstore.iteritems()):
+ for bmark, revnode in sorted(bmstore.items()):
revnum = repo[revnode].rev()
if revnum in skipped:
continue
@@ -854,7 +866,7 @@
if actions:
try:
tr = repo.transaction('debugconvertbookmark')
- for ((bmark, revnum), targetrevs) in sorted(actions.iteritems()):
+ for ((bmark, revnum), targetrevs) in sorted(actions.items()):
_applyconvertbmarktopic(ui, repo, targetrevs, revnum, bmark, tr)
tr.close()
finally:
@@ -952,7 +964,7 @@
# to not be so invasive.
del fixedextra['amend_source']
ui.debug('changing topic of %s from %s to %s\n' % (
- c, oldtopic, newtopic))
+ c, oldtopic or '<none>', newtopic or '<none>'))
ui.debug('fixedextra: %r\n' % fixedextra)
# While changing topic of set of linear commits, make sure that
# we base our commits on new parent rather than old parent which
@@ -997,7 +1009,7 @@
return rewrote
def _listtopics(ui, repo, opts):
- fm = ui.formatter('topics', opts)
+ fm = ui.formatter('topics', pycompat.byteskwargs(opts))
activetopic = repo.currenttopic
namemask = '%s'
if repo.topics: