Mercurial > evolve
comparison hgext3rd/topic/compat.py @ 3694:c0d5e0929f8b
compat: from compatibility layer for createmarkers
We support down to 4.3 now. It supports operation.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 19 Apr 2018 16:07:23 +0200 |
parents | c912eaf29eec |
children | 3680f715c14f |
comparison
equal
deleted
inserted
replaced
3693:105d2d2c6a2e | 3694:c0d5e0929f8b |
---|---|
4 # GNU General Public License version 2 or any later version. | 4 # GNU General Public License version 2 or any later version. |
5 """ | 5 """ |
6 Compatibility module | 6 Compatibility module |
7 """ | 7 """ |
8 from __future__ import absolute_import | 8 from __future__ import absolute_import |
9 | |
10 import functools | |
11 | 9 |
12 from mercurial import ( | 10 from mercurial import ( |
13 obsolete, | 11 obsolete, |
14 scmutil, | 12 scmutil, |
15 util, | 13 util, |
27 if getmarkers is None: | 25 if getmarkers is None: |
28 getmarkers = obsolete.getmarkers | 26 getmarkers = obsolete.getmarkers |
29 if successorssets is None: | 27 if successorssets is None: |
30 successorssets = obsolete.successorssets | 28 successorssets = obsolete.successorssets |
31 | 29 |
32 # Wrap obsolete.creatmarkers and make it accept but ignore "operation" argument | |
33 # for hg < 4.3 | |
34 originalcreatemarkers = obsolete.createmarkers | |
35 while isinstance(originalcreatemarkers, functools.partial): | |
36 originalcreatemarkers = originalcreatemarkers.func | |
37 if originalcreatemarkers.__code__.co_argcount < 6: | |
38 def createmarkers(repo, relations, flag=0, date=None, metadata=None, | |
39 operation=None): | |
40 return obsolete.createmarkers(repo, relations, flag, date, metadata) | |
41 else: | |
42 def createmarkers(*args, **kwargs): | |
43 return obsolete.createmarkers(*args, **kwargs) | |
44 | |
45 def startpager(ui, cmd): | 30 def startpager(ui, cmd): |
46 """function to start a pager in case ui.pager() exists""" | 31 """function to start a pager in case ui.pager() exists""" |
47 try: | 32 try: |
48 ui.pager(cmd) | 33 ui.pager(cmd) |
49 except AttributeError: | 34 except AttributeError: |
57 scmutil.cleanupnodes(repo, replacements, 'changetopics', | 42 scmutil.cleanupnodes(repo, replacements, 'changetopics', |
58 moves=moves) | 43 moves=moves) |
59 else: | 44 else: |
60 relations = [(repo[o], tuple(repo[n] for n in new)) | 45 relations = [(repo[o], tuple(repo[n] for n in new)) |
61 for (o, new) in replacements.iteritems()] | 46 for (o, new) in replacements.iteritems()] |
62 createmarkers(repo, relations, operation=operation) | 47 obsolete.createmarkers(repo, relations, operation=operation) |