compat: add wrapper for logcmdutil functions
These classes and functions were bulk-renamed at hg c8e2d6ed1f9e.
--- a/hgext3rd/evolve/__init__.py Mon Jan 29 17:32:08 2018 +0100
+++ b/hgext3rd/evolve/__init__.py Mon Feb 05 20:58:46 2018 +0900
@@ -1548,8 +1548,8 @@
elif len(specifiedcategories) == 1:
targetcat = specifiedcategories[0]
elif repo['.'].obsolete():
- displayer = cmdutil.show_changeset(ui, repo,
- {'template': shorttemplate})
+ displayer = compat.changesetdisplayer(ui, repo,
+ {'template': shorttemplate})
# no args and parent is obsolete, update to successors
try:
ctx = repo[_singlesuccessor(repo, repo['.'])]
@@ -1776,7 +1776,7 @@
target = repo[heads.first()]
else:
target = targets[0]
- displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
+ displayer = compat.changesetdisplayer(ui, repo, {'template': shorttemplate})
target = repo[target]
if not ui.quiet or confirm:
repo.ui.write(_('move:'))
@@ -1824,7 +1824,7 @@
ui.write_err(msg)
return 2
- displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
+ displayer = compat.changesetdisplayer(ui, repo, {'template': shorttemplate})
if not ui.quiet or confirm:
repo.ui.write(_('recreate:'))
displayer.show(bumped)
@@ -1958,7 +1958,7 @@
ui.write_err(hint)
return 2
- displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
+ displayer = compat.changesetdisplayer(ui, repo, {'template': shorttemplate})
if not ui.quiet or confirm:
ui.write(_('merge:'))
displayer.show(divergent)
@@ -2137,7 +2137,8 @@
exc.hint = _('do you want --merge?')
raise
- displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
+ displayer = compat.changesetdisplayer(ui, repo,
+ {'template': shorttemplate})
topic = not opts.get("no_topic", False)
target, bookmark = _findprevtarget(repo, displayer,
@@ -2197,7 +2198,8 @@
filtered = [ctx for ctx in children if ctx.topic() != topic]
# XXX N-square membership on children
children = [ctx for ctx in children if ctx not in filtered]
- displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
+ displayer = compat.changesetdisplayer(ui, repo,
+ {'template': shorttemplate})
if len(children) == 1:
c = children[0]
bm = repo._activebookmark
--- a/hgext3rd/evolve/cmdrewrite.py Mon Jan 29 17:32:08 2018 +0100
+++ b/hgext3rd/evolve/cmdrewrite.py Mon Feb 05 20:58:46 2018 +0900
@@ -1086,7 +1086,7 @@
if not duplicate:
rewriteutil.precheck(repo, revs, touch)
tmpl = utility.shorttemplate
- displayer = cmdutil.show_changeset(ui, repo, {'template': tmpl})
+ displayer = compat.changesetdisplayer(ui, repo, {'template': tmpl})
wlock = lock = tr = None
try:
wlock = repo.wlock()
--- a/hgext3rd/evolve/compat.py Mon Jan 29 17:32:08 2018 +0100
+++ b/hgext3rd/evolve/compat.py Mon Feb 05 20:58:46 2018 +0900
@@ -28,6 +28,18 @@
except ImportError:
obsutil = None
+# hg < 4.6 compat (c8e2d6ed1f9e)
+try:
+ from mercurial import logcmdutil
+ changesetdisplayer = logcmdutil.changesetdisplayer
+ changesetprinter = logcmdutil.changesetprinter
+ displaygraph = logcmdutil.displaygraph
+except (AttributeError, ImportError):
+ from mercurial import cmdutil
+ changesetdisplayer = cmdutil.show_changeset
+ changesetprinter = cmdutil.changeset_printer
+ displaygraph = cmdutil.displaygraph
+
from . import (
exthelper,
)
--- a/hgext3rd/evolve/obshistory.py Mon Jan 29 17:32:08 2018 +0100
+++ b/hgext3rd/evolve/obshistory.py Mon Feb 05 20:58:46 2018 +0900
@@ -10,7 +10,6 @@
import re
from mercurial import (
- cmdutil,
commands,
error,
graphmod,
@@ -97,7 +96,7 @@
revs.reverse()
_debugobshistoryrevs(ui, repo, revs, opts)
-class obsmarker_printer(cmdutil.changeset_printer):
+class obsmarker_printer(compat.changesetprinter):
"""show (available) information about a node
We display the node, description (if available) and various information
@@ -356,7 +355,7 @@
displayer = obsmarker_printer(ui, repo.unfiltered(), matchfn, opts, buffered=True)
edges = graphmod.asciiedges
walker = _obshistorywalker(repo.unfiltered(), revs, opts.get('all', False))
- cmdutil.displaygraph(ui, repo, walker, displayer, edges)
+ compat.displaygraph(ui, repo, walker, displayer, edges)
def _debugobshistoryrevs(ui, repo, revs, opts):
""" Display the obsolescence history for revset
--- a/hgext3rd/evolve/stablesort.py Mon Jan 29 17:32:08 2018 +0100
+++ b/hgext3rd/evolve/stablesort.py Mon Feb 05 20:58:46 2018 +0900
@@ -14,7 +14,6 @@
from mercurial import (
commands,
- cmdutil,
localrepo,
error,
node as nodemod,
@@ -76,7 +75,7 @@
raise error.Abort('unknown sorting method: "%s"' % method,
hint='pick one of: %s' % valid_method)
- displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True)
+ displayer = compat.changesetdisplayer(ui, repo, opts, buffered=True)
kwargs = {}
if opts['limit']:
kwargs['limit'] = int(opts['limit'])
--- a/hgext3rd/evolve/templatekw.py Mon Jan 29 17:32:08 2018 +0100
+++ b/hgext3rd/evolve/templatekw.py Mon Feb 05 20:58:46 2018 +0900
@@ -9,13 +9,13 @@
"""
from . import (
+ compat,
error,
exthelper,
obshistory
)
from mercurial import (
- cmdutil,
templatekw,
node,
util
@@ -316,10 +316,10 @@
def showobsfate(*args, **kwargs):
return showobsfatedata(*args, **kwargs)
-if util.safehasattr(cmdutil.changeset_printer, '_showobsfate'):
+if util.safehasattr(compat.changesetprinter, '_showobsfate'):
pass # already included by default
-elif util.safehasattr(cmdutil.changeset_printer, '_exthook'):
- @eh.wrapfunction(cmdutil.changeset_printer, '_exthook')
+elif util.safehasattr(compat.changesetprinter, '_exthook'):
+ @eh.wrapfunction(compat.changesetprinter, '_exthook')
def exthook(original, self, ctx):
# Call potential other extensions
original(self, ctx)