comparison mercurial/context.py @ 44009:e685fac56693

match: resolve filesets against the passed `cwd`, not the current one This allows filesets to be resolved relative to `repo.root`, the same as other patterns are since f02d3c0eed18. The current example in contrib/ wasn't working from the tests directory because of this. Differential Revision: https://phab.mercurial-scm.org/D7570
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 06 Dec 2019 20:40:02 -0500
parents bbcf78c4ff90
children 3216cabffd4a
comparison
equal deleted inserted replaced
44008:ac72e17457e5 44009:e685fac56693
198 return phases.phasenames[self.phase()] 198 return phases.phasenames[self.phase()]
199 199
200 def mutable(self): 200 def mutable(self):
201 return self.phase() > phases.public 201 return self.phase() > phases.public
202 202
203 def matchfileset(self, expr, badfn=None): 203 def matchfileset(self, cwd, expr, badfn=None):
204 return fileset.match(self, expr, badfn=badfn) 204 return fileset.match(self, cwd, expr, badfn=badfn)
205 205
206 def obsolete(self): 206 def obsolete(self):
207 """True if the changeset is obsolete""" 207 """True if the changeset is obsolete"""
208 return self.rev() in obsmod.getrevs(self._repo, b'obsolete') 208 return self.rev() in obsmod.getrevs(self._repo, b'obsolete')
209 209
326 include=None, 326 include=None,
327 exclude=None, 327 exclude=None,
328 default=b'glob', 328 default=b'glob',
329 listsubrepos=False, 329 listsubrepos=False,
330 badfn=None, 330 badfn=None,
331 cwd=None,
331 ): 332 ):
332 r = self._repo 333 r = self._repo
334 if not cwd:
335 cwd = r.getcwd()
333 return matchmod.match( 336 return matchmod.match(
334 r.root, 337 r.root,
335 r.getcwd(), 338 cwd,
336 pats, 339 pats,
337 include, 340 include,
338 exclude, 341 exclude,
339 default, 342 default,
340 auditor=r.nofsauditor, 343 auditor=r.nofsauditor,
1692 include=None, 1695 include=None,
1693 exclude=None, 1696 exclude=None,
1694 default=b'glob', 1697 default=b'glob',
1695 listsubrepos=False, 1698 listsubrepos=False,
1696 badfn=None, 1699 badfn=None,
1700 cwd=None,
1697 ): 1701 ):
1698 r = self._repo 1702 r = self._repo
1703 if not cwd:
1704 cwd = r.getcwd()
1699 1705
1700 # Only a case insensitive filesystem needs magic to translate user input 1706 # Only a case insensitive filesystem needs magic to translate user input
1701 # to actual case in the filesystem. 1707 # to actual case in the filesystem.
1702 icasefs = not util.fscasesensitive(r.root) 1708 icasefs = not util.fscasesensitive(r.root)
1703 return matchmod.match( 1709 return matchmod.match(
1704 r.root, 1710 r.root,
1705 r.getcwd(), 1711 cwd,
1706 pats, 1712 pats,
1707 include, 1713 include,
1708 exclude, 1714 exclude,
1709 default, 1715 default,
1710 auditor=r.auditor, 1716 auditor=r.auditor,