# HG changeset patch # User FUJIWARA Katsunori # Date 2012-02-22 15:07:54 # Node ID 616c2e278f18984dc48b80bc56b55da626130709 # Parent 4546a8513dcd437092eb748d24b6fc37a0d7e525 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. diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -206,14 +206,15 @@ class changectx(object): # follow that here, too fset.discard('.') for fn in self: - for ffn in fset: - # match if the file is the exact name or a directory - if ffn == fn or fn.startswith("%s/" % ffn): - fset.remove(ffn) - break + if fn in fset: + # specified pattern is the exact name + fset.remove(fn) if match(fn): yield fn for fn in sorted(fset): + if fn in self._dirs: + # specified pattern is a directory + continue if match.bad(fn, _('no such file in rev %s') % self) and match(fn): yield fn