[PATCH] match: allow pats to be None

Yuya Nishihara yuya at tcha.org
Sat Jun 10 01:29:04 EDT 2017


On Fri, 9 Jun 2017 22:15:00 -0700, Martin von Zweigbergk wrote:
> On Fri, Jun 9, 2017 at 6:27 AM, Yuya Nishihara <yuya at tcha.org> wrote:
> > On Thu, 08 Jun 2017 22:29:52 -0700, Martin von Zweigbergk via Mercurial-devel wrote:
> >> # HG changeset patch
> >> # User Martin von Zweigbergk <martinvonz at google.com>
> >> # Date 1496985497 25200
> >> #      Thu Jun 08 22:18:17 2017 -0700
> >> # Node ID 6f66d0e87e1fe4d444ccc4e2df4a2b3597a40afc
> >> # Parent  04c19c8082410049465e2cdc510e24801530c94b
> >> match: allow pats to be None
> >
> > Queued, thanks.
> >
> >> -def match(root, cwd, patterns, include=None, exclude=None, default='glob',
> >> +def match(root, cwd, patterns=None, include=None, exclude=None, default='glob',
> >>            exact=False, auditor=None, ctx=None, listsubrepos=False, warn=None,
> >>            badfn=None, icasefs=False):
> >
> > match(root, cwd, exact=True) could have a better exception message.
> 
> Sorry, I don't follow. Which exception do you mean?

'patterns' are required by exactmatcher.

>>> matchmod.match('', '', exact=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "mercurial/match.py", line 146, in match
    m = exactmatcher(root, cwd, patterns, badfn)
  File "mercurial/match.py", line 427, in __init__
    self._files = list(files)
TypeError: 'NoneType' object is not iterable


More information about the Mercurial-devel mailing list