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

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 16, 2014, 1:18 a.m.
Message ID <c451c290c556b97efa39.1389835094@localhost.localdomain>
Download mbox | patch
Permalink /patch/3344/
State Rejected
Headers show

Comments

Mads Kiilerich - Jan. 16, 2014, 1:18 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@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

Patch

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: