match: fix assertion for fileset with no context (issue6046) stable
authorYuya Nishihara <yuya@tcha.org>
Sat, 05 Jan 2019 15:44:55 +0900
branchstable
changeset 41022 481249481392
parent 41021 70e3e3da24be
child 41023 197f092b2cd9
match: fix assertion for fileset with no context (issue6046) A falsy changectx should be allowed.
mercurial/match.py
tests/test-locate.t
--- a/mercurial/match.py	Fri Jan 04 21:01:10 2019 -0500
+++ b/mercurial/match.py	Sat Jan 05 15:44:55 2019 +0900
@@ -48,7 +48,7 @@
 
     for kind, pat, source in kindpats:
         if kind == 'set':
-            if not ctx:
+            if ctx is None:
                 raise error.ProgrammingError("fileset expression with no "
                                              "context")
             matchers.append(ctx.matchfileset(pat, badfn=badfn))
--- a/tests/test-locate.t	Fri Jan 04 21:01:10 2019 -0500
+++ b/tests/test-locate.t	Sat Jan 05 15:44:55 2019 +0900
@@ -156,6 +156,11 @@
   $ hg files .
   [1]
 
+Fileset at null (i.e. a falsy context) shouldn't crash (issue6046)
+
+  $ hg files -r null 'set:tracked()'
+  [1]
+
 Convert native path separator to slash (issue5572)
 
   $ hg files -T '{path|relpath|slashpath}\n'