[PATCH 5 of 8 STABLE RFC] largefiles: show status for files added on another branch correctly

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Fri Feb 17 16:07:31 UTC 2012


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1329494573 -32400
# Branch stable
# Node ID 82a87da836d10865af586152c2473bc24dd0cfd4
# Parent  507343506cb1260d5c3429c4b15d581291067a85
largefiles: show status for files added on another branch correctly

current 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 causes 'performance boost'
       root choise), and

    2. 'tostandin()' only examines 2nd context, so can't update
       'mach._files' correctly (this causes unexpected behavior of
       'dirstate.status()')

this patch fixes this problem by:

    1. choising 'performance boost' route only 'parent - working
       context' comparison, because 'lfdirstate' and STANDIN directory
       may not have enough information in other cases.

    2. examining both 1st/2nd context for files/directories not known
       to each other

========================================
IN FACT, THIS FIX IS NOT COMPLETE.
========================================

tests shown below does not work expectedly:

  $ hg status -A --rev 4 another
  R another/e.txt

  $ hg status -A --rev 4 sub/a.txt another
  R another/e.txt
  C sub/a.txt

diff -r 507343506cb1 -r 82a87da836d1 hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py	Sat Feb 18 01:02:52 2012 +0900
+++ b/hgext/largefiles/reposetup.py	Sat Feb 18 01:02:53 2012 +0900
@@ -120,7 +120,7 @@
                 # largefiles, we should just bail here and let super
                 # handle it -- thus gaining a big performance boost.
                 lfdirstate = lfutil.openlfdirstate(ui, self)
-                if working and match.files() and not match.anypats():
+                if parentworking and match.files() and not match.anypats():
                     for f in match.files():
                         if (f in lfdirstate) or hasstandin(f):
                             break
@@ -132,8 +132,9 @@
                 # Create a copy of match that matches standins instead
                 # of largefiles.
                 def tostandin(file):
-                    if inctx(lfutil.standin(file), ctx2):
-                        return lfutil.standin(file)
+                    sf = lfutil.standin(file)
+                    if inctx(sf, ctx1) or inctx(sf, ctx2):
+                        return sf
                     return file
 
                 # Create a function that we can use to override what is
diff -r 507343506cb1 -r 82a87da836d1 tests/test-largefiles.t
--- a/tests/test-largefiles.t	Sat Feb 18 01:02:52 2012 +0900
+++ b/tests/test-largefiles.t	Sat Feb 18 01:02:53 2012 +0900
@@ -1062,4 +1062,33 @@
   $ hg status -A --rev 0 --rev 1 sub/a.txt sub/sub
   C sub/a.txt
 
+  $ hg update -C 0 > /dev/null
+  $ mkdir another
+  $ echo e > another/e.txt
+  $ hg add --large another/e.txt
+  $ hg commit -m '#4'
+  Invoking status precommit hook
+  A another/e.txt
+  created new head
+  $ hg update -C 3 > /dev/null
+
+  $ hg status -A --rev 4 another/e.txt
+  R another/e.txt
+  $ hg status -A --rev 4 --rev . another/e.txt
+  R another/e.txt
+  $ hg status -A --rev . --rev 4 another/e.txt
+  A another/e.txt
+
+  $ hg status -A --rev 4 --rev . another
+  R another/e.txt
+  $ hg status -A --rev . --rev 4 another
+  A another/e.txt
+
+  $ hg status -A --rev 4 --rev . sub/a.txt another
+  R another/e.txt
+  C sub/a.txt
+  $ hg status -A --rev . --rev 4 sub/a.txt another
+  A another/e.txt
+  C sub/a.txt
+
   $ cd ..



More information about the Mercurial-devel mailing list