comparison hgext/largefiles/reposetup.py @ 16110:41417443b7d0 stable

largefiles: check whether specified patterns are related to largefiles strictly current 'lfiles_repo.status()' implementation examines whether specified patterns are related to largefiles in working directory (not to STANDIN) or not by NOT-EMPTY-NESS of below list: [f for f in match.files() if f in lfdirstate] but it can not be assumed that all in 'match.files()' are file itself exactly, because user may only specify part of path to match whole under subdirectories recursively. above examination will mis-recognize such pattern as 'not related to largefiles', and executes normal 'status()' procedure. so, 'hg status' shows '?'(unknown) status for largefiles in working directory unexpectedly. this patch examines relation of pattern to largefiles by applying 'match()' on each entries in lfdirstate and checking wheter there is no matched entry. it may increase cost of examination, because it causes of full scan of entries in lfdirstate. so this patch uses normal for-loop instead of list comprehensions, to decrease cost when matching is found.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 15 Feb 2012 23:01:09 +0900
parents bf502ccc46d7
children f346de4dff57
comparison
equal deleted inserted replaced
16108:f7e0d95d0a0b 16110:41417443b7d0
116 # command line. If there were, and none of them were 116 # command line. If there were, and none of them were
117 # largefiles, we should just bail here and let super 117 # largefiles, we should just bail here and let super
118 # handle it -- thus gaining a big performance boost. 118 # handle it -- thus gaining a big performance boost.
119 lfdirstate = lfutil.openlfdirstate(ui, self) 119 lfdirstate = lfutil.openlfdirstate(ui, self)
120 if match.files() and not match.anypats(): 120 if match.files() and not match.anypats():
121 matchedfiles = [f for f in match.files() if f in lfdirstate] 121 for f in lfdirstate:
122 if not matchedfiles: 122 if match(f):
123 break
124 else:
123 return super(lfiles_repo, self).status(node1, node2, 125 return super(lfiles_repo, self).status(node1, node2,
124 match, listignored, listclean, 126 match, listignored, listclean,
125 listunknown, listsubrepos) 127 listunknown, listsubrepos)
126 128
127 # Create a copy of match that matches standins instead 129 # Create a copy of match that matches standins instead