test-compat: merge stable into mercurial-4.6 mercurial-4.6
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 02 Aug 2018 01:57:13 +0200
branchmercurial-4.6
changeset 3923 257481642686
parent 3922 9839463088ac (diff)
parent 3920 202413cab59f (current diff)
child 3924 f3713d41b85b
child 3928 a50b7e3d86c2
test-compat: merge stable into mercurial-4.6
--- a/hgext3rd/evolve/compat.py	Thu Aug 02 01:53:01 2018 +0200
+++ b/hgext3rd/evolve/compat.py	Thu Aug 02 01:57:13 2018 +0200
@@ -28,11 +28,13 @@
     changesetdisplayer = logcmdutil.changesetdisplayer
     changesetprinter = logcmdutil.changesetprinter
     displaygraph = logcmdutil.displaygraph
+    changesetdiffer = logcmdutil.changesetdiffer
 except (AttributeError, ImportError):
     from mercurial import cmdutil
     changesetdisplayer = cmdutil.show_changeset
     changesetprinter = cmdutil.changeset_printer
     displaygraph = cmdutil.displaygraph
+    changesetdiffer = None
 
 from . import (
     exthelper,
--- a/hgext3rd/evolve/obshistory.py	Thu Aug 02 01:53:01 2018 +0200
+++ b/hgext3rd/evolve/obshistory.py	Thu Aug 02 01:57:13 2018 +0200
@@ -141,8 +141,16 @@
     We display the node, description (if available) and various information
     about obsolescence markers affecting it"""
 
-    def __init__(self, ui, repo, differ=None, diffopts=None, buffered=False):
-        super(obsmarker_printer, self).__init__(ui, repo, differ=differ, diffopts=diffopts, buffered=buffered)
+    def __init__(self, ui, repo, *args, **kwargs):
+
+        if kwargs.pop('obspatch', False):
+            if compat.changesetdiffer is None:
+                kwargs['matchfn'] = scmutil.matchall(repo)
+            else:
+                kwargs['differ'] = scmutil.matchall(repo)
+
+        super(obsmarker_printer, self).__init__(ui, repo, *args, **kwargs)
+        diffopts = kwargs.get('diffopts', {})
 
         # Compat 4.6
         if not util.safehasattr(self, "_includediff"):
@@ -415,11 +423,8 @@
     return sorted(seen), nodesucc, nodeprec
 
 def _debugobshistorygraph(ui, repo, revs, opts):
-    matchfn = None
-    if opts.get('patch'):
-        matchfn = scmutil.matchall(repo)
 
-    displayer = obsmarker_printer(ui, repo.unfiltered(), matchfn, opts, buffered=True)
+    displayer = obsmarker_printer(ui, repo.unfiltered(), obspatch=True, diffopts=opts, buffered=True)
     edges = graphmod.asciiedges
     walker = _obshistorywalker(repo.unfiltered(), revs, opts.get('all', False), opts.get('filternonlocal', False))
     compat.displaygraph(ui, repo, walker, displayer, edges)
--- a/hgext3rd/topic/__init__.py	Thu Aug 02 01:53:01 2018 +0200
+++ b/hgext3rd/topic/__init__.py	Thu Aug 02 01:57:13 2018 +0200
@@ -487,8 +487,9 @@
                 empty = csetcount == 0
                 if empty and not ctwasempty:
                     ui.status('active topic %r is now empty\n' % ct)
-                    if ('phase' in tr.names
-                            or any(n.startswith('push-response') for n in tr.names)):
+                    if ('phase' in getattr(tr, 'names', ())
+                            or any(n.startswith('push-response')
+                            for n in getattr(tr, 'names', ()))):
                         ui.status(_("(use 'hg topic --clear' to clear it if needed)\n"))
                 hint = _("(see 'hg help topics' for more information)\n")
                 if ctwasempty and not empty: