Submitter | via Mercurial-devel |
---|---|
Date | June 9, 2017, 5:29 a.m. |
Message ID | <6f66d0e87e1fe4d444cc.1496986192@martinvonz.svl.corp.google.com> |
Download | mbox | patch |
Permalink | /patch/21269/ |
State | Accepted |
Headers | show |
Comments
On Thu, 08 Jun 2017 22:29:52 -0700, Martin von Zweigbergk via Mercurial-devel wrote: > # HG changeset patch > # User Martin von Zweigbergk <martinvonz@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.
On Fri, Jun 9, 2017 at 6:27 AM, Yuya Nishihara <yuya@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@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?
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@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@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
On Fri, Jun 9, 2017 at 10:29 PM, Yuya Nishihara <yuya@tcha.org> wrote: > 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@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@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 Ah, that makes sense. Perhaps that should be another ProgrammingError.
Patch
diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -301,8 +301,6 @@ def match(self, pats=None, include=None, exclude=None, default='glob', listsubrepos=False, badfn=None): - if pats is None: - pats = [] r = self._repo return matchmod.match(r.root, r.getcwd(), pats, include, exclude, default, @@ -1701,8 +1699,6 @@ def match(self, pats=None, include=None, exclude=None, default='glob', listsubrepos=False, badfn=None): - if pats is None: - pats = [] r = self._repo # Only a case insensitive filesystem needs magic to translate user input diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -85,7 +85,7 @@ return False return True -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): """build an object to match a set of file patterns