Patchwork D8081: manifest: fix _very_ subtle bug with exact matchers passed to walk()

login
register
mail settings
Submitter phabricator
Date Feb. 5, 2020, 10:34 p.m.
Message ID <differential-rev-PHID-DREV-2rcsxh56d6aizlaugg5c-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44965/
State Superseded
Headers show

Comments

phabricator - Feb. 5, 2020, 10:34 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Prior to this fix, manifestdict.walk() with an exact matcher would blindly
  list the files in the matcher, even if they weren't in the manifest. This was
  exposed by my next patch where I rewrite filesnotin() to use walk() instead of
  matches().

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8081

AFFECTED FILES
  mercurial/manifest.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -530,7 +530,8 @@ 
         # avoid the entire walk if we're only looking for specific files
         if self._filesfastpath(match):
             for fn in sorted(fset):
-                yield fn
+                if fn in self:
+                    yield fn
             return
 
         for fn in self: