[PATCH 14 of 19 STABLE] largefiles: show status for files added on another branch correctly

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Mon Feb 27 10:46:39 UTC 2012


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1330335216 -32400
# Branch stable
# Node ID b728948758a3dd40ab955b314dbcc3a3f12f924c
# Parent  80ad9da167d20345ccf59b8ff968c44f206d1e09
largefiles: show status for files added on another branch correctly

original implementation can't show status for largefiles added on
another branch correctly, because:

    1. no STANDIN file/directory corresponded to specified patterns
       exists 'local' side branch (this also causes unexpected
       'performance boost' root choice), and

    2. 'filefn()' for matcher creation only examines 2nd context, so
       files()' of created matcher is not updated expectedly (this
       causes unexpected behavior of 'dirstate.status()')

this patch fixes this problem by examining both 1st/2nd context for
files/directories not known to each other.

in this patch, 1st context is examined only not in 'parentworking'
case for performance efficiency, because 2nd context (= working
context) should have enough information about removed files in
'parentworking' case.

diff -r 80ad9da167d2 -r b728948758a3 hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py	Mon Feb 27 18:33:36 2012 +0900
+++ b/hgext/largefiles/reposetup.py	Mon Feb 27 18:33:36 2012 +0900
@@ -128,12 +128,13 @@
                 # largefiles, we should just bail here and let super
                 # handle it -- thus gaining a big performance boost.
                 if match.files() and not match.anypats():
-                    wctx = repo[None]
                     for f in match.files():
                         if lfutil.isstandin(f):
                             continue
                         sf = lfutil.standin(f)
-                        if inctx(sf, wctx) or inctxdirs(sf, wctx):
+                        if (inctx(sf, ctx2) or inctxdirs(sf, ctx2) or
+                            (not parentworking and
+                             (inctx(sf, ctx1) or inctxdirs(sf, ctx1)))):
                             break
                     else:
                         return super(lfiles_repo, self).status(node1, node2,
@@ -156,7 +157,9 @@
                     for f in files:
                         if not lfutil.isstandin(f):
                             sf = lfutil.standin(f)
-                            if inctx(sf, ctx2) or inctxdirs(sf, ctx2):
+                            if (inctx(sf, ctx2) or inctxdirs(sf, ctx2) or
+                                (not parentworking and
+                                 (inctx(sf, ctx1) or inctxdirs(sf, ctx1)))):
                                 yield sf
                                 continue
                         # not 'known largefile', or 'STANDIN direct' pattern
diff -r 80ad9da167d2 -r b728948758a3 tests/test-largefiles.t
--- a/tests/test-largefiles.t	Mon Feb 27 18:33:36 2012 +0900
+++ b/tests/test-largefiles.t	Mon Feb 27 18:33:36 2012 +0900
@@ -1080,6 +1080,37 @@
   $ hg status -A --rev 0 --rev 1 sub/a.large sub/sub
   C sub/a.large
 
+add files on another branch:
+
+  $ hg update -C 0 > /dev/null
+  $ mkdir another1
+  $ echo e > another1/e.large
+  $ hg add --large another1/e.large
+  $ hg commit -m '#4'
+  Invoking status precommit hook
+  A another1/e.large
+  created new head
+  $ hg update -C 3 > /dev/null
+  $ test ! -d another
+
+test for file added on another branch by file pattern:
+
+  $ hg status -A --rev 4 another1/e.large
+  R another1/e.large
+  $ hg status -A --rev 4 --rev . another1/e.large
+  R another1/e.large
+  $ hg status -A --rev . --rev 4 another1/e.large
+  A another1/e.large
+
+test for file added on another branch by directory pattern:
+
+  $ hg status -A --rev 4 another1
+  R another1/e.large
+  $ hg status -A --rev 4 --rev . another1
+  R another1/e.large
+  $ hg status -A --rev . --rev 4 another1
+  A another1/e.large
+
   $ cd ..
 
 tests for pattern matching for removed files in working context:



More information about the Mercurial-devel mailing list