Mercurial > evolve
comparison hgext3rd/topic/compat.py @ 3094:e11e018e8338 stable
compat: add an abstraction for 'scmutil.cleanupnodes'
The usage of the function was added in 103244e34a9c but is not compatible with
Mercurial <= 4.2.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 20 Oct 2017 19:29:56 +0200 |
parents | 7a1a4d1f0958 |
children | f61a23a84dac |
comparison
equal
deleted
inserted
replaced
3093:9c04bd928056 | 3094:e11e018e8338 |
---|---|
5 """ | 5 """ |
6 Compatibility module | 6 Compatibility module |
7 """ | 7 """ |
8 from __future__ import absolute_import | 8 from __future__ import absolute_import |
9 | 9 |
10 from mercurial import obsolete | 10 from mercurial import ( |
11 obsolete, | |
12 scmutil, | |
13 util, | |
14 ) | |
11 | 15 |
12 getmarkers = None | 16 getmarkers = None |
13 successorssets = None | 17 successorssets = None |
14 try: | 18 try: |
15 from mercurial import obsutil | 19 from mercurial import obsutil |
27 """function to start a pager in case ui.pager() exists""" | 31 """function to start a pager in case ui.pager() exists""" |
28 try: | 32 try: |
29 ui.pager(cmd) | 33 ui.pager(cmd) |
30 except AttributeError: | 34 except AttributeError: |
31 pass | 35 pass |
36 | |
37 def cleanupnodes(repo, replacements, operation, moves=None): | |
38 # create obsmarkers and move bookmarks | |
39 # XXX we should be creating marker as we go instead of only at the end, | |
40 # this makes the operations more modulars | |
41 if util.safehasattr(scmutil, 'cleanupnodes'): | |
42 scmutil.cleanupnodes(repo, replacements, 'changetopics', | |
43 moves=moves) | |
44 else: | |
45 relations = [(repo[o], tuple(repo[n] for n in new)) | |
46 for (o, new) in replacements.iteritems()] | |
47 obsolete.createmarkers(repo, relations) |