Mercurial > hg-git
comparison hggit/__init__.py @ 1135:c4703246f350
compat: mark all compat-checking locations outside hggit.compat with "COMPAT:"
The format is:
# COMPAT: hg X.Y - description of change that affects this block
author | Kevin Bullock <kbullock@ringworld.org> |
---|---|
date | Fri, 02 Feb 2018 13:41:42 -0600 |
parents | d75d704772d1 |
children | 633796ad1684 |
comparison
equal
deleted
inserted
replaced
1134:d75d704772d1 | 1135:c4703246f350 |
---|---|
49 revset, | 49 revset, |
50 scmutil, | 50 scmutil, |
51 templatekw, | 51 templatekw, |
52 ) | 52 ) |
53 | 53 |
54 # COMPAT: hg 3.2 - exchange module was introduced | |
54 try: | 55 try: |
55 from mercurial import exchange | 56 from mercurial import exchange |
56 exchange.push # existed in first iteration of this file | 57 exchange.push # existed in first iteration of this file |
57 except (AttributeError, ImportError): | 58 except (AttributeError, ImportError): |
58 # We only *use* the exchange module in hg 3.2+, so this is safe | 59 # We only *use* the exchange module in hg 3.2+, so this is safe |
59 pass | 60 pass |
60 | 61 |
62 # COMPAT: hg 3.5 - ignore module was removed | |
61 try: | 63 try: |
62 from mercurial import ignore | 64 from mercurial import ignore |
63 ignore.readpats | 65 ignore.readpats |
64 ignoremod = True | 66 ignoremod = True |
65 except (AttributeError, ImportError): | 67 except (AttributeError, ImportError): |
66 # The ignore module disappeared in Mercurial 3.5 | |
67 ignoremod = False | 68 ignoremod = False |
68 | 69 |
70 # COMPAT: hg 3.0 - revset.baseset was added | |
69 baseset = set | 71 baseset = set |
70 try: | 72 try: |
71 baseset = revset.baseset | 73 baseset = revset.baseset |
72 except AttributeError: | 74 except AttributeError: |
73 # baseset was added in hg 3.0 | |
74 pass | 75 pass |
75 | 76 |
76 try: | 77 try: |
77 demandimport.IGNORES.add('collections') | 78 demandimport.IGNORES.add('collections') |
78 except AttributeError as e: # pre 4.7 API | 79 except AttributeError as e: # pre 4.7 API |
103 hg.schemes[_scheme] = gitrepo | 104 hg.schemes[_scheme] = gitrepo |
104 | 105 |
105 # support for `hg clone localgitrepo` | 106 # support for `hg clone localgitrepo` |
106 _oldlocal = hg.schemes['file'] | 107 _oldlocal = hg.schemes['file'] |
107 | 108 |
109 # COMPAT: hg 1.9 - url.url class moved into util module | |
108 try: | 110 try: |
109 urlcls = hgutil.url | 111 urlcls = hgutil.url |
110 except AttributeError: | 112 except AttributeError: |
111 class urlcls(object): | 113 class urlcls(object): |
112 def __init__(self, path): | 114 def __init__(self, path): |
213 if hgutil.safehasattr(lrepo, 'changelog') and co not in lrepo.changelog: | 215 if hgutil.safehasattr(lrepo, 'changelog') and co not in lrepo.changelog: |
214 co = None | 216 co = None |
215 return revs, co | 217 return revs, co |
216 | 218 |
217 | 219 |
220 # COMPAT: hg 1.4 - this is no longer needed | |
218 if getattr(hg, 'addbranchrevs', False): | 221 if getattr(hg, 'addbranchrevs', False): |
219 extensions.wrapfunction(hg, 'addbranchrevs', safebranchrevs) | 222 extensions.wrapfunction(hg, 'addbranchrevs', safebranchrevs) |
220 | 223 |
221 | 224 |
222 def extsetup(ui): | 225 def extsetup(ui): |
224 revset.symbols.update({ | 227 revset.symbols.update({ |
225 'fromgit': revset_fromgit, 'gitnode': revset_gitnode | 228 'fromgit': revset_fromgit, 'gitnode': revset_gitnode |
226 }) | 229 }) |
227 helpdir = os.path.join(os.path.dirname(__file__), 'help') | 230 helpdir = os.path.join(os.path.dirname(__file__), 'help') |
228 entry = (['git'], _("Working with Git Repositories"), | 231 entry = (['git'], _("Working with Git Repositories"), |
229 # Mercurial >= 3.6: doc(ui) | 232 # COMPAT: hg 3.6 - help table expects a delayed loader (see |
233 # help.loaddoc()) | |
230 lambda *args: open(os.path.join(helpdir, 'git.rst')).read()) | 234 lambda *args: open(os.path.join(helpdir, 'git.rst')).read()) |
231 insort(help.helptable, entry) | 235 insort(help.helptable, entry) |
232 | 236 |
233 | 237 |
234 def reposetup(ui, repo): | 238 def reposetup(ui, repo): |