comparison hggit/gitdirstate.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 6141895a53c9
children 56a3fc2086b3
comparison
equal deleted inserted replaced
1134:d75d704772d1 1135:c4703246f350
9 match as matchmod, 9 match as matchmod,
10 scmutil, 10 scmutil,
11 util, 11 util,
12 ) 12 )
13 13
14 # COMPAT: hg 3.5 - ignore module was removed
14 try: 15 try:
15 from mercurial import ignore 16 from mercurial import ignore
16 ignore.readpats 17 ignore.readpats
17 ignoremod = True 18 ignoremod = True
18 except (AttributeError, ImportError): 19 except (AttributeError, ImportError):
19 # ignore module was removed in Mercurial 3.5
20 ignoremod = False 20 ignoremod = False
21 # pathauditor moved to pathutil in 2.9 21
22 # COMPAT: hg 2.9 - pathauditor moved to pathutil
22 try: 23 try:
23 from mercurial import pathutil 24 from mercurial import pathutil
24 pathutil.pathauditor 25 pathutil.pathauditor
25 except (AttributeError, ImportError): 26 except (AttributeError, ImportError):
26 pathutil = scmutil 27 pathutil = scmutil
161 162
162 matchfn = match.matchfn 163 matchfn = match.matchfn
163 matchalways = match.always() 164 matchalways = match.always()
164 matchtdir = match.traversedir 165 matchtdir = match.traversedir
165 dmap = self._map 166 dmap = self._map
166 # osutil moved in hg 4.3, but util re-exports listdir 167 # COMPAT: hg 4.3 - osutil moved, but util re-exports listdir
167 try: 168 try:
168 listdir = util.listdir 169 listdir = util.listdir
169 except AttributeError: 170 except AttributeError:
170 from mercurial import osutil 171 from mercurial import osutil
171 listdir = osutil.listdir 172 listdir = osutil.listdir
190 191
191 # step 1: find all explicit files 192 # step 1: find all explicit files
192 results, work, dirsnotfound = self._walkexplicit(match, subrepos) 193 results, work, dirsnotfound = self._walkexplicit(match, subrepos)
193 194
194 skipstep3 = skipstep3 and not (work or dirsnotfound) 195 skipstep3 = skipstep3 and not (work or dirsnotfound)
196 # COMPAT: hg 3.3.3 - work is now a list of tuples
195 if work and isinstance(work[0], tuple): 197 if work and isinstance(work[0], tuple):
196 # Mercurial >= 3.3.3
197 work = [nd for nd, d in work if not dirignore(d)] 198 work = [nd for nd, d in work if not dirignore(d)]
198 else: 199 else:
199 work = [d for d in work if not dirignore(d)] 200 work = [d for d in work if not dirignore(d)]
200 wadd = work.append 201 wadd = work.append
201 202