comparison mercurial/context.py @ 16145:616c2e278f18 stable

context: use 'changectx.dirs()' in 'walk()' for directory patterns this patch uses 'changectx.dirs()' instead of nested loop, to examine whether specified pattern is related to the context as a directory or not.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Thu, 23 Feb 2012 00:07:54 +0900
parents fceb2964fa6c
children a01d2fb5ba65 a1b6a63f9f39
comparison
equal deleted inserted replaced
16144:4546a8513dcd 16145:616c2e278f18
204 fset = set(match.files()) 204 fset = set(match.files())
205 # for dirstate.walk, files=['.'] means "walk the whole tree". 205 # for dirstate.walk, files=['.'] means "walk the whole tree".
206 # follow that here, too 206 # follow that here, too
207 fset.discard('.') 207 fset.discard('.')
208 for fn in self: 208 for fn in self:
209 for ffn in fset: 209 if fn in fset:
210 # match if the file is the exact name or a directory 210 # specified pattern is the exact name
211 if ffn == fn or fn.startswith("%s/" % ffn): 211 fset.remove(fn)
212 fset.remove(ffn)
213 break
214 if match(fn): 212 if match(fn):
215 yield fn 213 yield fn
216 for fn in sorted(fset): 214 for fn in sorted(fset):
215 if fn in self._dirs:
216 # specified pattern is a directory
217 continue
217 if match.bad(fn, _('no such file in rev %s') % self) and match(fn): 218 if match.bad(fn, _('no such file in rev %s') % self) and match(fn):
218 yield fn 219 yield fn
219 220
220 def sub(self, path): 221 def sub(self, path):
221 return subrepo.subrepo(self, path) 222 return subrepo.subrepo(self, path)