comparison hgext3rd/evolve/obshistory.py @ 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 16bec7609a08
children 35b2d201eb71
comparison
equal deleted inserted replaced
3917:ca7f02c9fa57 3921:28824ad64a12
139 """show (available) information about a node 139 """show (available) information about a node
140 140
141 We display the node, description (if available) and various information 141 We display the node, description (if available) and various information
142 about obsolescence markers affecting it""" 142 about obsolescence markers affecting it"""
143 143
144 def __init__(self, ui, repo, differ=None, diffopts=None, buffered=False): 144 def __init__(self, ui, repo, *args, **kwargs):
145 super(obsmarker_printer, self).__init__(ui, repo, differ=differ, diffopts=diffopts, buffered=buffered) 145
146 if kwargs.pop('obspatch', False):
147 if compat.changesetdiffer is None:
148 kwargs['matchfn'] = scmutil.matchall(repo)
149 else:
150 kwargs['differ'] = scmutil.matchall(repo)
151
152 super(obsmarker_printer, self).__init__(ui, repo, *args, **kwargs)
153 diffopts = kwargs.get('diffopts', {})
146 154
147 # Compat 4.6 155 # Compat 4.6
148 if not util.safehasattr(self, "_includediff"): 156 if not util.safehasattr(self, "_includediff"):
149 self._includediff = diffopts and diffopts.get('patch') 157 self._includediff = diffopts and diffopts.get('patch')
150 158
413 nodes.append(succnodeid) 421 nodes.append(succnodeid)
414 422
415 return sorted(seen), nodesucc, nodeprec 423 return sorted(seen), nodesucc, nodeprec
416 424
417 def _debugobshistorygraph(ui, repo, revs, opts): 425 def _debugobshistorygraph(ui, repo, revs, opts):
418 matchfn = None 426
419 if opts.get('patch'): 427 displayer = obsmarker_printer(ui, repo.unfiltered(), obspatch=True, diffopts=opts, buffered=True)
420 matchfn = scmutil.matchall(repo)
421
422 displayer = obsmarker_printer(ui, repo.unfiltered(), matchfn, opts, buffered=True)
423 edges = graphmod.asciiedges 428 edges = graphmod.asciiedges
424 walker = _obshistorywalker(repo.unfiltered(), revs, opts.get('all', False), opts.get('filternonlocal', False)) 429 walker = _obshistorywalker(repo.unfiltered(), revs, opts.get('all', False), opts.get('filternonlocal', False))
425 compat.displaygraph(ui, repo, walker, displayer, edges) 430 compat.displaygraph(ui, repo, walker, displayer, edges)
426 431
427 def _debugobshistoryrevs(ui, repo, revs, opts): 432 def _debugobshistoryrevs(ui, repo, revs, opts):