Mercurial > evolve
comparison hgext3rd/topic/compat.py @ 2922:66357d4d03b2
topic: centralize compatibility logic between hg versions into compat module
This patch can delay loading obsutil and obsolete modules until they
are actually used at "hg topics" or so, if demandimport of Mercurial
is enabled.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sun, 10 Sep 2017 22:41:54 +0900 |
parents | |
children | 7a1a4d1f0958 |
comparison
equal
deleted
inserted
replaced
2921:23c9600607e7 | 2922:66357d4d03b2 |
---|---|
1 # Copyright 2017 FUJIWARA Katsunori <foozy@lares.dti.ne.jp> | |
2 # | |
3 # This software may be used and distributed according to the terms of the | |
4 # GNU General Public License version 2 or any later version. | |
5 """ | |
6 Compatibility module | |
7 """ | |
8 from __future__ import absolute_import | |
9 | |
10 from mercurial import obsolete | |
11 | |
12 getmarkers = None | |
13 successorssets = None | |
14 try: | |
15 from mercurial import obsutil | |
16 getmarkers = getattr(obsutil, 'getmarkers', None) | |
17 successorssets = getattr(obsutil, 'successorssets', None) | |
18 except ImportError: | |
19 pass | |
20 | |
21 if getmarkers is None: | |
22 getmarkers = obsolete.getmarkers | |
23 if successorssets is None: | |
24 successorssets = obsolete.successorssets |