Mercurial > hg
changeset 25238:5a55ad6e8e24
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.
author | Durham Goode <durham@fb.com> |
---|---|
date | Sat, 16 May 2015 16:12:00 -0700 |
parents | 7504a7325e4c |
children | 714f612f2afc |
files | mercurial/match.py |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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)