Skip to content
Snippets Groups Projects
Commit 56a3fc20 authored by Kevin Bullock's avatar Kevin Bullock
Browse files

compat: find listdir function in compat module

parent 583ac3dd
No related branches found
No related tags found
No related merge requests found
......@@ -83,6 +83,13 @@
except TypeError:
phases.advanceboundary(repo, targetphase, nodes)
# hg 4.3 - osutil moved, but mercurial.util re-exports listdir
if hgutil.safehasattr(hgutil, 'listdir'):
listdir = hgutil.listdir
else:
from mercurial import osutil
listdir = osutil.listdir
try:
import dulwich.client
......
......@@ -11,6 +11,8 @@
util,
)
import compat
# COMPAT: hg 3.5 - ignore module was removed
try:
from mercurial import ignore
......@@ -164,12 +166,6 @@
matchalways = match.always()
matchtdir = match.traversedir
dmap = self._map
# COMPAT: hg 4.3 - osutil moved, but util re-exports listdir
try:
listdir = util.listdir
except AttributeError:
from mercurial import osutil
listdir = osutil.listdir
lstat = os.lstat
dirkind = stat.S_IFDIR
regkind = stat.S_IFREG
......@@ -209,7 +205,7 @@
else:
skip = '.hg'
try:
entries = listdir(join(nd), stat=True, skip=skip)
entries = compat.listdir(join(nd), stat=True, skip=skip)
except OSError, inst:
if inst.errno in (errno.EACCES, errno.ENOENT):
fwarn(nd, inst.strerror)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment