# HG changeset patch # User Benoit Boissinot # Date 1224075147 -7200 # Node ID 6f750e76fb4667ad41545a8422f4925a87e5d95d # Parent 8a5c88c7e97ba693e80aaf61bb5213a0e8a381b6 dirstate.walk: skip unreadable directories (issue1213) Do not abort on permission denied error, just skip the directory. diff -r 8a5c88c7e97b -r 6f750e76fb46 mercurial/dirstate.py --- a/mercurial/dirstate.py Wed Oct 15 14:06:46 2008 +0200 +++ b/mercurial/dirstate.py Wed Oct 15 14:52:27 2008 +0200 @@ -492,11 +492,18 @@ nd = work.pop() if hasattr(match, 'dir'): match.dir(nd) + skip = None if nd == '.': nd = '' - entries = listdir(join(nd), stat=True) else: - entries = listdir(join(nd), stat=True, skip ='.hg') + skip = '.hg' + try: + entries = listdir(join(nd), stat=True, skip=skip) + except OSError, inst: + if inst.errno == errno.EACCES: + fwarn(nd, inst.strerror) + continue + raise for f, kind, st in entries: nf = normalize(nd and (nd + "/" + f) or f, True) if nf not in results: diff -r 8a5c88c7e97b -r 6f750e76fb46 tests/test-permissions --- a/tests/test-permissions Wed Oct 15 14:06:46 2008 +0200 +++ b/tests/test-permissions Wed Oct 15 14:52:27 2008 +0200 @@ -16,3 +16,10 @@ chmod -w . hg diff --nodates chmod +w . + +chmod +w .hg/store/data/a.i +mkdir dir +touch dir/a +hg status +chmod -rx dir +hg status diff -r 8a5c88c7e97b -r 6f750e76fb46 tests/test-permissions.out --- a/tests/test-permissions.out Wed Oct 15 14:06:46 2008 +0200 +++ b/tests/test-permissions.out Wed Oct 15 14:52:27 2008 +0200 @@ -20,3 +20,7 @@ @@ -1,1 +1,1 @@ -foo +barber +M a +? dir/a +dir: Permission denied +M a