[PATCH 6 of 7] dirstate: report bad subdirectories as match.bad, not just a warning

Mads Kiilerich mads at kiilerich.com
Wed Jan 15 19:18:14 CST 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1380816081 -7200
#      Thu Oct 03 18:01:21 2013 +0200
# Node ID c451c290c556b97efa39c1c2bc65d5cccf76cddc
# Parent  f85de316fddc513f7304f345e4666f060349af1a
dirstate: report bad subdirectories as match.bad, not just a warning

This seems simpler and more correct.

The only test coverage for this is test-permissions.t when it says:
  dir: Permission denied

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -638,10 +638,6 @@ class dirstate(object):
         # implementation doesn't use it at all. This satisfies the contract
         # because we only guarantee a "maybe".
 
-        def fwarn(f, msg):
-            self._ui.warn('%s: %s\n' % (self.pathto(f), msg))
-            return False
-
         ignore = self._ignore
         dirignore = self._dirignore
         if ignored:
@@ -695,7 +691,7 @@ class dirstate(object):
                 entries = listdir(join(nd), stat=True, skip=skip)
             except OSError, inst:
                 if inst.errno in (errno.EACCES, errno.ENOENT):
-                    fwarn(nd, inst.strerror)
+                    match.bad(self.pathto(nd), inst.strerror)
                     continue
                 raise
             for f, kind, st in entries:


More information about the Mercurial-devel mailing list