branching: merge with stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 05 Feb 2018 14:36:34 +0100
changeset 3484 6d180db0e3e8
parent 3482 7f646d98858e (current diff)
parent 3483 f03845bfd015 (diff)
child 3487 14b9cded3c81
branching: merge with stable
hgext3rd/evolve/__init__.py
hgext3rd/evolve/cmdrewrite.py
hgext3rd/evolve/evolvecmd.py
hgext3rd/evolve/obshistory.py
--- a/hgext3rd/evolve/__init__.py	Mon Jan 22 18:35:50 2018 +0530
+++ b/hgext3rd/evolve/__init__.py	Mon Feb 05 14:36:34 2018 +0100
@@ -1040,7 +1040,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,
@@ -1100,7 +1101,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 22 18:35:50 2018 +0530
+++ b/hgext3rd/evolve/cmdrewrite.py	Mon Feb 05 14:36:34 2018 +0100
@@ -1088,7 +1088,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 22 18:35:50 2018 +0530
+++ b/hgext3rd/evolve/compat.py	Mon Feb 05 14:36:34 2018 +0100
@@ -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/evolvecmd.py	Mon Jan 22 18:35:50 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Mon Feb 05 14:36:34 2018 +0100
@@ -133,7 +133,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:'))
@@ -190,7 +190,7 @@
         ui.write_err(msg)
         return (False, '')
 
-    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)
@@ -333,7 +333,7 @@
         ui.write_err(hint)
         return (False, '')
 
-    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)
@@ -1075,8 +1075,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[utility._singlesuccessor(repo, repo['.'])]
--- a/hgext3rd/evolve/obshistory.py	Mon Jan 22 18:35:50 2018 +0530
+++ b/hgext3rd/evolve/obshistory.py	Mon Feb 05 14:36:34 2018 +0100
@@ -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 22 18:35:50 2018 +0530
+++ b/hgext3rd/evolve/stablesort.py	Mon Feb 05 14:36:34 2018 +0100
@@ -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 22 18:35:50 2018 +0530
+++ b/hgext3rd/evolve/templatekw.py	Mon Feb 05 14:36:34 2018 +0100
@@ -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)