[PATCH 1 of 6 STABLE V2] largefiles: suppress unexpected warning of 'hg status' for removed files

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


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1332428327 -32400
# Branch stable
# Node ID 447a62ee6b761f083fb839a2f65df9b1d9579cc2
# Parent  2338ab19b23690e74e1ba3936667399dfeb9490c
largefiles: suppress unexpected warning of 'hg status' for removed files

original implementation queries whether specified pattern is related
or not to largefiles, to target context.

but changectx/workingctx returns False about relationship with files
marked as removed.

So, 'hg status' with 'file pattern' for removed file shows unexpected
warning message in below process:

    1. 'tostandin()' returns non-STANDIN filename for removed file,
       because changectx/workingctx returns False about relationship
       with it

    2. 'match.files()' contains non-STANDIN filename, which is already
       removed from working directory

    3. 'dirstate.walk()' invoked via 'localrepository.status()' treats
       non-STANDIN filename as bad filename, because there is no entry
       for it in dirstate: only STANDIN is managed in dirstate

    4. 'dirstate.walk()' invokes 'match.bad()', which is defined in
       'localrepository.status()' as 'bad()'

    5. 'bad()' shows warning message for non-STANDIN, because it is
       not related to source context: only STANDIN is related to it

this patch queries to dirstate instead of changectxt/workingctx,
because dirstate returns expected result for removed files.

'match.files()' is used by 'localrepository.status()' only in
'working' case, so this patched code also works correctly in
non-'working' case.

diff -r 2338ab19b236 -r 447a62ee6b76 hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py	Sun Mar 18 18:21:32 2012 -0500
+++ b/hgext/largefiles/reposetup.py	Thu Mar 22 23:58:47 2012 +0900
@@ -137,7 +137,7 @@
                 # Create a copy of match that matches standins instead
                 # of largefiles.
                 def tostandin(file):
-                    if inctx(lfutil.standin(file), ctx2):
+                    if working and lfutil.standin(file) in repo.dirstate:
                         return lfutil.standin(file)
                     return file
 
diff -r 2338ab19b236 -r 447a62ee6b76 tests/test-largefiles.t
--- a/tests/test-largefiles.t	Sun Mar 18 18:21:32 2012 -0500
+++ b/tests/test-largefiles.t	Thu Mar 22 23:58:47 2012 +0900
@@ -68,6 +68,8 @@
 Remove both largefiles and normal files.
  
   $ hg remove normal1 large1
+  $ hg status large1
+  R large1
   $ hg commit -m "remove files"
   Invoking status precommit hook
   R large1


More information about the Mercurial-devel mailing list