comparison hgsubversion/__init__.py @ 1598:394007c5efea

hgsubversion: drop some more code which is for compat with hg<1.6
author Pulkit Goyal <pulkit@yandex-team.ru>
date Tue, 27 Nov 2018 14:04:08 +0300
parents 74c5fd9c3e76
children
comparison
equal deleted inserted replaced
1597:b06be5815692 1598:394007c5efea
45 'svn.core', 45 'svn.core',
46 'svn.delta', 46 'svn.delta',
47 'svn.ra', 47 'svn.ra',
48 } 48 }
49 49
50 from mercurial import discovery
50 from mercurial import revset 51 from mercurial import revset
51 from mercurial import subrepo 52 from mercurial import subrepo
52 53
53 import svncommands 54 import svncommands
54 import util 55 import util
99 'HEAD causes only the latest revision to be ' 100 'HEAD causes only the latest revision to be '
100 'pulled')), 101 'pulled')),
101 ]), 102 ]),
102 } 103 }
103 104
104 try: 105 def findcommonoutgoing(orig, *args, **opts):
105 from mercurial import discovery 106 capable = getattr(args[1], 'capable', lambda x: False)
106 def findcommonoutgoing(orig, *args, **opts): 107 if capable('subversion'):
107 capable = getattr(args[1], 'capable', lambda x: False) 108 return wrappers.findcommonoutgoing(*args, **opts)
108 if capable('subversion'): 109 else:
109 return wrappers.findcommonoutgoing(*args, **opts) 110 return orig(*args, **opts)
110 else: 111 extensions.wrapfunction(discovery, 'findcommonoutgoing', findcommonoutgoing)
111 return orig(*args, **opts)
112 extensions.wrapfunction(discovery, 'findcommonoutgoing', findcommonoutgoing)
113 except AttributeError:
114 # only need the discovery variant of this code when we drop hg < 1.6
115 def findoutgoing(orig, *args, **opts):
116 capable = getattr(args[1], 'capable', lambda x: False)
117 if capable('subversion'):
118 return wrappers.findoutgoing(*args, **opts)
119 else:
120 return orig(*args, **opts)
121 extensions.wrapfunction(discovery, 'findoutgoing', findoutgoing)
122 except ImportError:
123 pass
124 112
125 def extsetup(ui): 113 def extsetup(ui):
126 """insert command wrappers for a bunch of commands""" 114 """insert command wrappers for a bunch of commands"""
127 115
128 docvals = {'extension': 'hgsubversion'} 116 docvals = {'extension': 'hgsubversion'}