changeset 5181:c979d64a2589

compat: drop 4.5 compatibility layer for log utility
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 04 Mar 2020 16:30:19 +0100
parents 515d425c0a05
children df5e6e3884bc
files hgext3rd/evolve/__init__.py hgext3rd/evolve/cmdrewrite.py hgext3rd/evolve/compat.py hgext3rd/evolve/evolvecmd.py hgext3rd/evolve/obshistory.py hgext3rd/evolve/stablesort.py
diffstat 6 files changed, 26 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py	Tue Mar 10 11:07:06 2020 +0100
+++ b/hgext3rd/evolve/__init__.py	Wed Mar 04 16:30:19 2020 +0100
@@ -274,6 +274,7 @@
     help,
     hg,
     lock as lockmod,
+    logcmdutil,
     node,
     patch,
     pycompat,
@@ -984,7 +985,8 @@
         if topic and hastopic:
             template = utility.stacktemplate
 
-        displayer = compat.changesetdisplayer(ui, repo, {b'template': template})
+        displayer = logcmdutil.changesetdisplayer(ui, repo,
+                                                  {b'template': template})
 
         target, bookmark = _findprevtarget(repo, displayer,
                                            opts.get('move_bookmark'), topic)
@@ -1042,7 +1044,8 @@
             children = [ctx for ctx in children if ctx not in filtered]
             template = utility.stacktemplate
             opts['stacktemplate'] = True
-        displayer = compat.changesetdisplayer(ui, repo, {b'template': template})
+        displayer = logcmdutil.changesetdisplayer(ui, repo,
+                                                  {b'template': template})
 
         # check if we need to evolve while updating to the next child revision
         needevolve = False
--- a/hgext3rd/evolve/cmdrewrite.py	Tue Mar 10 11:07:06 2020 +0100
+++ b/hgext3rd/evolve/cmdrewrite.py	Wed Mar 04 16:30:19 2020 +0100
@@ -23,6 +23,7 @@
     error,
     hg,
     lock as lockmod,
+    logcmdutil,
     merge,
     node,
     obsolete,
@@ -1397,7 +1398,7 @@
         with ui.configoverride(overrides, b'touch'):
             rewriteutil.precheck(repo, revs, b'touch')
     tmpl = utility.shorttemplate
-    displayer = compat.changesetdisplayer(ui, repo, {b'template': tmpl})
+    displayer = logcmdutil.changesetdisplayer(ui, repo, {b'template': tmpl})
     with repo.wlock(), repo.lock(), repo.transaction(b'touch'):
         touchnodes(ui, repo, revs, displayer, **opts)
 
--- a/hgext3rd/evolve/compat.py	Tue Mar 10 11:07:06 2020 +0100
+++ b/hgext3rd/evolve/compat.py	Wed Mar 04 16:30:19 2020 +0100
@@ -30,20 +30,6 @@
     arraytobytes = array.array.tostring
     arrayfrombytes = array.array.fromstring
 
-# hg < 4.6 compat (c8e2d6ed1f9e)
-try:
-    from mercurial import logcmdutil
-    changesetdisplayer = logcmdutil.changesetdisplayer
-    changesetprinter = logcmdutil.changesetprinter
-    displaygraph = logcmdutil.displaygraph
-    changesetdiffer = logcmdutil.changesetdiffer
-except (AttributeError, ImportError):
-    from mercurial import cmdutil
-    changesetdisplayer = cmdutil.show_changeset  # pytype: disable=module-attr
-    changesetprinter = cmdutil.changeset_printer  # pytype: disable=module-attr
-    displaygraph = cmdutil.displaygraph  # pytype: disable=module-attr
-    changesetdiffer = None
-
 # hg <= 5.3 (c21aca51b392)
 try:
     from mercurial import pathutil
--- a/hgext3rd/evolve/evolvecmd.py	Tue Mar 10 11:07:06 2020 +0100
+++ b/hgext3rd/evolve/evolvecmd.py	Wed Mar 04 16:30:19 2020 +0100
@@ -16,9 +16,10 @@
     cmdutil,
     commands,
     context,
+    encoding,
     error,
-    encoding,
     hg,
+    logcmdutil,
     merge,
     mergeutil,
     node as nodemod,
@@ -68,11 +69,11 @@
     assert tr is not None
     displayer = None
     if stacktmplt:
-        displayer = compat.changesetdisplayer(ui, repo,
-                                              {b'template': stacktemplate})
+        displayer = logcmdutil.changesetdisplayer(ui, repo,
+                                                  {b'template': stacktemplate})
     else:
-        displayer = compat.changesetdisplayer(ui, repo,
-                                              {b'template': shorttemplate})
+        displayer = logcmdutil.changesetdisplayer(ui, repo,
+                                                  {b'template': shorttemplate})
     if b'orphan' == category:
         result = _solveunstable(ui, repo, ctx, evolvestate, displayer,
                                 dryrun, confirm, progresscb,
@@ -1814,8 +1815,8 @@
     oldid = repo[b'.'].node()
     startctx = repo[b'.']
     dryrunopt = opts.get('dry_run', False)
-    displayer = compat.changesetdisplayer(ui, repo,
-                                          {b'template': shorttemplate})
+    displayer = logcmdutil.changesetdisplayer(ui, repo,
+                                              {b'template': shorttemplate})
     try:
         ctx = repo[utility._singlesuccessor(repo, repo[b'.'])]
     except utility.MultipleSuccessorsError as exc:
--- a/hgext3rd/evolve/obshistory.py	Tue Mar 10 11:07:06 2020 +0100
+++ b/hgext3rd/evolve/obshistory.py	Wed Mar 04 16:30:19 2020 +0100
@@ -13,9 +13,10 @@
     commands,
     error,
     graphmod,
-    patch,
+    logcmdutil,
+    node as nodemod,
     obsutil,
-    node as nodemod,
+    patch,
     pycompat,
     scmutil,
     util,
@@ -134,7 +135,7 @@
     b"patch": TEMPLATE_PATCH,
 }
 
-class obsmarker_printer(compat.changesetprinter):
+class obsmarker_printer(logcmdutil.changesetprinter):
     """show (available) information about a node
 
     We display the node, description (if available) and various information
@@ -143,7 +144,7 @@
     def __init__(self, ui, repo, *args, **kwargs):
 
         if kwargs.pop('obspatch', False):
-            if compat.changesetdiffer is None:
+            if logcmdutil.changesetdiffer is None:
                 kwargs['matchfn'] = scmutil.matchall(repo)
             else:
                 kwargs['differ'] = scmutil.matchall(repo)
@@ -435,7 +436,7 @@
     edges = graphmod.asciiedges
     walker = _obshistorywalker(repo.unfiltered(), revs, opts.get('all', False),
                                opts.get('filternonlocal', False))
-    compat.displaygraph(ui, repo, walker, displayer, edges)
+    logcmdutil.displaygraph(ui, repo, walker, displayer, edges)
 
 def _debugobshistoryrevs(ui, repo, revs, opts):
     """ Display the obsolescence history for revset
--- a/hgext3rd/evolve/stablesort.py	Tue Mar 10 11:07:06 2020 +0100
+++ b/hgext3rd/evolve/stablesort.py	Wed Mar 04 16:30:19 2020 +0100
@@ -252,8 +252,9 @@
 
 from mercurial import (
     commands,
+    error,
     localrepo,
-    error,
+    logcmdutil,
     node as nodemod,
     pycompat,
     scmutil,
@@ -314,8 +315,9 @@
         raise error.Abort(b'unknown sorting method: "%s"' % method,
                           hint=b'pick one of: %s' % valid_method)
 
-    displayer = compat.changesetdisplayer(ui, repo, pycompat.byteskwargs(opts),
-                                          buffered=True)
+    displayer = logcmdutil.changesetdisplayer(ui, repo,
+                                              pycompat.byteskwargs(opts),
+                                              buffered=True)
     kwargs = {}
     if opts['limit']:
         kwargs['limit'] = int(opts['limit'])