[PATCH] match: fix bug in match.visitdir()

Drew Gottlieb drgott at google.com
Fri May 22 16:40:29 CDT 2015

# HG changeset patch
# User Drew Gottlieb <drgott at google.com>
# Date 1432330774 25200
#      Fri May 22 14:39:34 2015 -0700
# Node ID 5b93e1cbb45cde9ede354ec6473f22734e1311e1
# Parent  f2b98dacb37ddd6713b11a1a871fcdbbc5fd8bb2
match: fix bug in match.visitdir()

There was a bug in my recent change to visitdir (8545bd381504) due to
the stored generator being iterated over twice. Making the generator into a
list at the start fixes this.

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -197,7 +197,7 @@
         parentdirs = None
         if (self._includeroots and dir not in self._includeroots and
                 dir not in self._includedirs):
-            parentdirs = util.finddirs(dir)
+            parentdirs = list(util.finddirs(dir))
             if not any(parent in self._includeroots for parent in parentdirs):
                 return False
         return (not self._fileroots or '.' in self._fileroots or

More information about the Mercurial-devel mailing list