diff --git a/mercurial/context.py b/mercurial/context.py index 7d589d923b8a1ae7b920a88cf66a79d3faa330b5_bWVyY3VyaWFsL2NvbnRleHQucHk=..8dc254198a8f7ec51e459d3804fe0de91a17979a_bWVyY3VyaWFsL2NvbnRleHQucHk= 100644 --- a/mercurial/context.py +++ b/mercurial/context.py @@ -410,6 +410,15 @@ # for dirstate.walk, files=['.'] means "walk the whole tree". # follow that here, too fset.discard('.') + + # avoid the entire walk if we're only looking for specific files + if fset and not match.anypats(): + if util.all([fn in self for fn in fset]): + for fn in sorted(fset): + if match(fn): + yield fn + raise StopIteration + for fn in self: if fn in fset: # specified pattern is the exact name