Mercurial > hg-git
comparison hggit/gitdirstate.py @ 1141:56a3fc2086b3
compat: find listdir function in compat module
author | Kevin Bullock <kbullock@ringworld.org> |
---|---|
date | Wed, 07 Feb 2018 22:42:32 -0600 |
parents | c4703246f350 |
children |
comparison
equal
deleted
inserted
replaced
1140:583ac3ddd54b | 1141:56a3fc2086b3 |
---|---|
8 error, | 8 error, |
9 match as matchmod, | 9 match as matchmod, |
10 scmutil, | 10 scmutil, |
11 util, | 11 util, |
12 ) | 12 ) |
13 | |
14 import compat | |
13 | 15 |
14 # COMPAT: hg 3.5 - ignore module was removed | 16 # COMPAT: hg 3.5 - ignore module was removed |
15 try: | 17 try: |
16 from mercurial import ignore | 18 from mercurial import ignore |
17 ignore.readpats | 19 ignore.readpats |
162 | 164 |
163 matchfn = match.matchfn | 165 matchfn = match.matchfn |
164 matchalways = match.always() | 166 matchalways = match.always() |
165 matchtdir = match.traversedir | 167 matchtdir = match.traversedir |
166 dmap = self._map | 168 dmap = self._map |
167 # COMPAT: hg 4.3 - osutil moved, but util re-exports listdir | |
168 try: | |
169 listdir = util.listdir | |
170 except AttributeError: | |
171 from mercurial import osutil | |
172 listdir = osutil.listdir | |
173 lstat = os.lstat | 169 lstat = os.lstat |
174 dirkind = stat.S_IFDIR | 170 dirkind = stat.S_IFDIR |
175 regkind = stat.S_IFREG | 171 regkind = stat.S_IFREG |
176 lnkkind = stat.S_IFLNK | 172 lnkkind = stat.S_IFLNK |
177 join = self._join | 173 join = self._join |
207 if nd == '.': | 203 if nd == '.': |
208 nd = '' | 204 nd = '' |
209 else: | 205 else: |
210 skip = '.hg' | 206 skip = '.hg' |
211 try: | 207 try: |
212 entries = listdir(join(nd), stat=True, skip=skip) | 208 entries = compat.listdir(join(nd), stat=True, skip=skip) |
213 except OSError, inst: | 209 except OSError, inst: |
214 if inst.errno in (errno.EACCES, errno.ENOENT): | 210 if inst.errno in (errno.EACCES, errno.ENOENT): |
215 fwarn(nd, inst.strerror) | 211 fwarn(nd, inst.strerror) |
216 continue | 212 continue |
217 raise | 213 raise |