diff -r 67567d7f1174 -r 48b30ff742cb hgext3rd/topic/destination.py --- a/hgext3rd/topic/destination.py Tue Aug 06 15:06:27 2019 +0200 +++ b/hgext3rd/topic/destination.py Tue Aug 06 15:06:38 2019 +0200 @@ -13,11 +13,11 @@ ) from .evolvebits import builddependencies -def _destmergebranch(orig, repo, action='merge', sourceset=None, +def _destmergebranch(orig, repo, action=b'merge', sourceset=None, onheadcheck=True, destspace=None): # XXX: take destspace into account if sourceset is None: - p1 = repo['.'] + p1 = repo[b'.'] else: # XXX: using only the max here is flacky. That code should eventually # be updated to take care of the whole sourceset. @@ -26,11 +26,11 @@ if common.hastopicext(repo): top = p1.topic() if top: - revs = repo.revs('topic(%s) - obsolete()', top) + revs = repo.revs(b'topic(%s) - obsolete()', top) deps, rdeps = builddependencies(repo, revs) heads = [r for r in revs if not rdeps[r]] if onheadcheck and p1.rev() not in heads: - raise error.Abort(_("not at topic head, update or explicit")) + raise error.Abort(_(b"not at topic head, update or explicit")) # prune heads above the source otherheads = set(heads) @@ -43,20 +43,20 @@ # nothing to do at the topic level bhead = ngtip(repo, p1.branch(), all=True) if not bhead: - raise error.NoMergeDestAbort(_("nothing to merge")) + raise error.NoMergeDestAbort(_(b"nothing to merge")) elif 1 == len(bhead): return bhead[0] else: - msg = _("branch '%s' has %d heads " - "- please merge with an explicit rev") - hint = _("run 'hg heads .' to see heads") + msg = _(b"branch '%s' has %d heads " + b"- please merge with an explicit rev") + hint = _(b"run 'hg heads .' to see heads") raise error.ManyMergeDestAbort(msg % (p1.branch(), len(bhead)), hint=hint) elif len(otherheads) == 1: return otherheads.pop() else: - msg = _("topic '%s' has %d heads " - "- please merge with an explicit rev") % (top, len(heads)) + msg = _(b"topic '%s' has %d heads " + b"- please merge with an explicit rev") % (top, len(heads)) raise error.ManyMergeDestAbort(msg) return orig(repo, action, sourceset, onheadcheck, destspace=destspace) @@ -67,23 +67,23 @@ movemark = node = None topic = repo.currenttopic if topic: - revs = repo.revs('.::topic(%s)', topic) + revs = repo.revs(b'.::topic(%s)', topic) else: revs = [] if not revs: return None, None, None node = revs.last() if bookmarks.isactivewdirparent(repo): - movemark = repo['.'].node() + movemark = repo[b'.'].node() return node, movemark, None def desthistedit(orig, ui, repo): if not common.hastopicext(repo): return None - if not (ui.config('histedit', 'defaultrev', None) is None + if not (ui.config(b'histedit', b'defaultrev', None) is None and repo.currenttopic): return orig(ui, repo) - revs = repo.revs('::. and stack()') + revs = repo.revs(b'::. and stack()') if revs: return revs.min() return None @@ -107,7 +107,7 @@ def modsetup(ui): """run a uisetup time to install all destinations wrapping""" extensions.wrapfunction(destutil, '_destmergebranch', _destmergebranch) - bridx = destutil.destupdatesteps.index('branch') - destutil.destupdatesteps.insert(bridx, 'topic') - destutil.destupdatestepmap['topic'] = _destupdatetopic + bridx = destutil.destupdatesteps.index(b'branch') + destutil.destupdatesteps.insert(bridx, b'topic') + destutil.destupdatestepmap[b'topic'] = _destupdatetopic extensions.wrapfunction(destutil, 'desthistedit', desthistedit)