[PATCH 4 of 8 STABLE RFC] largefiles: check directory matching pattern correctly
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Fri Feb 17 16:07:30 UTC 2012
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1329494572 -32400
# Branch stable
# Node ID 507343506cb1260d5c3429c4b15d581291067a85
# Parent 5a568b210fe58273670925aef2278c5fc0d059e0
largefiles: check directory matching pattern correctly
current implementation can not show correct statuses, if "hg status"
is invoked with:
- 2nd context is 'working directory', and
- both of file and directory patterns for largefiles
this problem occures in steps shown below:
1. 'match._files' is updated by:
'[f for f in match._files if f in lfdirstate]'
2. file pattern is choosen, but directory pattern is not at (1),
because 'f in lfdirstate' never return True for directories
3. 'dirstate.status()' is called with updated 'match'
4. 'dirstate.status()' return status for specified files, but not
of files under specified directories, because directories are
not listed in 'match._files': see (2)
you can not reproduce this behavior, if you only specify directory
patterns: in this case, 'match._files' becomes empty at (2), so
'dirstate.status()' scans all of its entries and examines 'match(f)'
on them.
this patch updates 'match._files' correctly also for directory
patterns by examining file/directory existence under STANDIN
directory.
diff -r 5a568b210fe5 -r 507343506cb1 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:52 2012 +0900
@@ -173,8 +173,9 @@
lfdirstate._ignore = _ignoreoverride
match = copy.copy(match)
- match._files = [f for f in match._files if f in
- lfdirstate]
+ match._files = [f for f in match._files
+ if ((not lfutil.isstandin(f)) and
+ hasstandin(f))]
match._fmap = set(match._files)
# Don't waste time getting the ignored and unknown
# files again; we already have them
diff -r 5a568b210fe5 -r 507343506cb1 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:52 2012 +0900
@@ -1043,4 +1043,23 @@
A sub/b.txt
C sub/a.txt
+ $ mkdir sub/sub
+ $ echo d > sub/sub/d.txt
+ $ hg add --large sub/sub/d.txt
+ $ hg commit -m '#3'
+ Invoking status precommit hook
+ A sub/sub/d.txt
+
+ $ hg status -A sub/a.txt sub/sub
+ C sub/a.txt
+ C sub/sub/d.txt
+ $ hg status -A --rev 0 sub/a.txt sub/sub
+ A sub/sub/d.txt
+ C sub/a.txt
+ $ hg status -A --rev . --rev 0 sub/a.txt sub/sub
+ R sub/sub/d.txt
+ C sub/a.txt
+ $ hg status -A --rev 0 --rev 1 sub/a.txt sub/sub
+ C sub/a.txt
+
$ cd ..
More information about the Mercurial-devel
mailing list