Patchwork [8,of,8,match] dirstate: report bad subdirectories as match.bad, not just a warning (BC)

login
register
mail settings
Submitter Mads Kiilerich
Date April 15, 2014, 12:40 a.m.
Message ID <3932af80549a6d2c2a6c.1397522442@mk-desktop>
Download mbox | patch
Permalink /patch/4360/
State Accepted
Commit 30c60e28aa9b1ae84364ca15f8e7e09593cc3aa6
Headers show

Comments

Mads Kiilerich - April 15, 2014, 12:40 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1380816081 -7200
#      Thu Oct 03 18:01:21 2013 +0200
# Node ID 3932af80549a6d2c2a6c9f811484597966d06fcd
# Parent  6c995a3a1bc55be4c2d0a3d5de3bca7e901406fa
dirstate: report bad subdirectories as match.bad, not just a warning (BC)

This seems simpler and more correct.

The only test coverage for this is test-permissions.t when it says:
  dir: Permission denied
Siddharth Agarwal - April 16, 2014, 7:47 p.m.
On 04/14/2014 05:40 PM, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1380816081 -7200
> #      Thu Oct 03 18:01:21 2013 +0200
> # Node ID 3932af80549a6d2c2a6c9f811484597966d06fcd
> # Parent  6c995a3a1bc55be4c2d0a3d5de3bca7e901406fa
> dirstate: report bad subdirectories as match.bad, not just a warning (BC)

These look good to me.

>
> 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
> @@ -637,10 +637,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
> -
>           if ignored:
>               ignore = util.never
>               dirignore = util.never
> @@ -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:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Matt Mackall - April 17, 2014, 8:24 p.m.
On Tue, 2014-04-15 at 02:40 +0200, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1380816081 -7200
> #      Thu Oct 03 18:01:21 2013 +0200
> # Node ID 3932af80549a6d2c2a6c9f811484597966d06fcd
> # Parent  6c995a3a1bc55be4c2d0a3d5de3bca7e901406fa
> dirstate: report bad subdirectories as match.bad, not just a warning (BC)

I've queued all but 4 (add an assert), thanks. I actually prefer not to
use asserts. I've applied Sid's changes in flight.

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -637,10 +637,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
-
         if ignored:
             ignore = util.never
             dirignore = util.never
@@ -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: