Mercurial > evolve
changeset 3921:28824ad64a12 stable
compat: restore compatibility with Mercurial <= 4.5
The __init__ arguments changed a lot in 4.6 and 4.7, lets do be as transparent
as possible
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 02 Aug 2018 01:31:02 +0200 |
parents | ca7f02c9fa57 |
children | 9839463088ac |
files | hgext3rd/evolve/compat.py hgext3rd/evolve/obshistory.py |
diffstat | 2 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/compat.py Tue Jul 31 07:38:37 2018 -0500 +++ b/hgext3rd/evolve/compat.py Thu Aug 02 01:31:02 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 Tue Jul 31 07:38:37 2018 -0500 +++ b/hgext3rd/evolve/obshistory.py Thu Aug 02 01:31:02 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)