[PATCH 4 of 6 STABLE V2] largefiles: use 'dirstate.rdirs()' to match against removed directory

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Thu Mar 22 10:06:34 CDT 2012


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1332428327 -32400
# Branch stable
# Node ID dac978818d9bcd735a3135d584e514d76a1cef01
# Parent  200e12e1d1f146e52bf01aed854562df30089c45
largefiles: use 'dirstate.rdirs()' to match against removed directory

original implementation uses '__contains__()' and 'rdirs()' of
dirstate to examine whether specified pattern is related to largefiles
in target context.

but the directory removed recursively by 'hg remove' is not recognized
in both, so 'directory pattern' for it can't be recognized correctly.

this patch uses 'dirstate.rdirs()' for 'directory pattern' matched
against removed directory.

diff -r 200e12e1d1f1 -r dac978818d9b hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py	Thu Mar 22 23:58:47 2012 +0900
+++ b/hgext/largefiles/reposetup.py	Thu Mar 22 23:58:47 2012 +0900
@@ -140,7 +140,8 @@
                     if working:
                         sf = lfutil.standin(file)
                         dirstate = repo.dirstate
-                        if sf in dirstate or sf in dirstate.dirs():
+                        if (sf in dirstate or sf in dirstate.dirs() or
+                            sf in dirstate.rdirs()):
                             return sf
                     return file
 
@@ -173,7 +174,8 @@
                         def sfindirstate(f):
                             sf = lfutil.standin(f)
                             dirstate = repo.dirstate
-                            return sf in dirstate or sf in dirstate.dirs()
+                            return (sf in dirstate or sf in dirstate.dirs() or
+                                    sf in dirstate.rdirs())
                         match._files = [f for f in match._files
                                         if sfindirstate(f)]
                         # Don't waste time getting the ignored and unknown
diff -r 200e12e1d1f1 -r dac978818d9b tests/test-largefiles.t
--- a/tests/test-largefiles.t	Thu Mar 22 23:58:47 2012 +0900
+++ b/tests/test-largefiles.t	Thu Mar 22 23:58:47 2012 +0900
@@ -1014,3 +1014,26 @@
   
 
   $ cd ..
+
+test of 'hg status' with 'directory pattern' for recursively removed
+directory.
+
+  $ hg init removeddirpat
+  $ cd removeddirpat
+
+  $ mkdir -p sub/sub/sub
+  $ echo a > sub/sub/sub/a.large
+  $ echo b > b.large
+  $ hg add --large sub/sub/sub/a.large b.large
+  $ hg commit -m '#0'
+  Invoking status precommit hook
+  A b.large
+  A sub/sub/sub/a.large
+
+  $ hg remove sub/sub/sub/a.large
+  $ test ! -d sub/sub/sub
+  $ hg status -A b.large sub/sub/sub
+  R sub/sub/sub/a.large
+  C b.large
+
+  $ cd ..


More information about the Mercurial-devel mailing list