# HG changeset patch # User FUJIWARA Katsunori # Date 1332428327 -32400 # Node ID 50247a7a998394b2ef94f206caffb0adf5c5b2a2 # Parent d8cc67114dc3b336fe7f8c07b413cfc4a0ce7af0 largefiles: use 'dirstate.dirs()' for 'directory pattern' relation check original implementation queries whether specified pattern is related or not to largefiles in target context by 'dirstate.__contains__()'. but this can't recognize 'directory pattern' correctly, so this patch uses 'dirstate.dirs()' for it. this patch uses dirstate instead of lfdirstate in 'working' route (second patch hunk for 'hgext/largefiles/reposetup.py'), because 'dirs()' information may be already built for dirstate but not yet for lfdirstate at this point. this prevents lfdirstate from building up and having 'dirs()' information. diff -r d8cc67114dc3 -r 50247a7a9983 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 @@ -137,8 +137,11 @@ # Create a copy of match that matches standins instead # of largefiles. def tostandin(file): - if working and lfutil.standin(file) in repo.dirstate: - return lfutil.standin(file) + if working: + sf = lfutil.standin(file) + dirstate = repo.dirstate + if sf in dirstate or sf in dirstate.dirs(): + return sf return file # Create a function that we can use to override what is @@ -167,8 +170,12 @@ orig_ignore = lfdirstate._ignore lfdirstate._ignore = _ignoreoverride - match._files = [f for f in match._files if f in - lfdirstate] + def sfindirstate(f): + sf = lfutil.standin(f) + dirstate = repo.dirstate + return sf in dirstate or sf in dirstate.dirs() + match._files = [f for f in match._files + if sfindirstate(f)] # Don't waste time getting the ignored and unknown # files again; we already have them s = lfdirstate.status(match, [], False, diff -r d8cc67114dc3 -r 50247a7a9983 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 @@ -251,6 +251,13 @@ A sub2/large6 A sub2/large7 +Test "hg status" with combination of 'file pattern' and 'directory +pattern' for largefiles: + + $ hg status sub2/large6 sub2 + A sub2/large6 + A sub2/large7 + Config settings (pattern **.dat, minsize 2 MB) are respected. $ echo testdata > test.dat