# HG changeset patch # User Durham Goode # Date 1431817920 25200 # Node ID 5a55ad6e8e241c78156389b864a7199ead080e71 # Parent 7504a7325e4cf7d9a069e4aab08af6e75697477a match: add root to _buildmatch A future patch will make _buildmatch able to expand relative include patterns. Doing so will require knowing the root of the repo, so let's go ahead and pass it in. diff -r 7504a7325e4c -r 5a55ad6e8e24 mercurial/match.py --- a/mercurial/match.py Thu May 21 10:41:06 2015 -0700 +++ b/mercurial/match.py Sat May 16 16:12:00 2015 -0700 @@ -94,7 +94,7 @@ if include: kindpats = self._normalize(include, 'glob', root, cwd, auditor) self.includepat, im = _buildmatch(ctx, kindpats, '(?:/|$)', - listsubrepos) + listsubrepos, root) self._includeroots.update(_roots(kindpats)) self._includeroots.discard('.') self._includedirs.update(util.dirs(self._includeroots)) @@ -102,7 +102,7 @@ if exclude: kindpats = self._normalize(exclude, 'glob', root, cwd, auditor) self.excludepat, em = _buildmatch(ctx, kindpats, '(?:/|$)', - listsubrepos) + listsubrepos, root) self._excluderoots.update(_roots(kindpats)) self._excluderoots.discard('.') matchfns.append(lambda f: not em(f)) @@ -118,7 +118,7 @@ self._files = _roots(kindpats) self._anypats = self._anypats or _anypats(kindpats) self.patternspat, pm = _buildmatch(ctx, kindpats, '$', - listsubrepos) + listsubrepos, root) matchfns.append(pm) if not matchfns: @@ -476,7 +476,7 @@ return '.*' + pat return _globre(pat) + globsuffix -def _buildmatch(ctx, kindpats, globsuffix, listsubrepos): +def _buildmatch(ctx, kindpats, globsuffix, listsubrepos, root): '''Return regexp string and a matcher function for kindpats. globsuffix is appended to the regexp of globs.''' fset, kindpats = _expandsets(kindpats, ctx, listsubrepos)