[PATCH 3 of 7] match: consider filesets as "anypats"

Patrick Mezard patrick at mezard.eu
Sun Feb 26 10:14:26 CST 2012

# HG changeset patch
# User Patrick Mezard <patrick at mezard.eu>
# Date 1330272655 -3600
# Node ID 57e84828ff51e200122dbb94d0cebc35e9e8da9b
# Parent  9fc1b65ebb2e863115485158b6a0d27533b2df04
match: consider filesets as "anypats"

Matt suggested this on IRC, I do not think the choice is obvious, but this one
makes things simpler because while filesets are turned into a list of files
into the match objects, it would more be difficult to tell invalid files passed
in pats from those expanded from filesets.

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -333,5 +333,5 @@
 def _anypats(patterns):
     for kind, name in patterns:
-        if kind in ('glob', 're', 'relglob', 'relre'):
+        if kind in ('glob', 're', 'relglob', 'relre', 'set'):
             return True
diff --git a/tests/test-glog.t b/tests/test-glog.t
--- a/tests/test-glog.t
+++ b/tests/test-glog.t
@@ -1663,6 +1663,8 @@
 Test "set:..." and parent revision
   $ hg up -q 4
+  $ testlog "set:copied()"
+  ('group', ('group', ('func', ('symbol', '_matchfiles'), ('list', ('string', 'r:'), ('string', 'p:set:copied()')))))
   $ testlog --include "set:copied()"
   ('group', ('group', ('func', ('symbol', '_matchfiles'), ('list', ('string', 'r:'), ('string', 'i:set:copied()')))))
   $ testlog -r "sort(file('set:copied()'), -rev)"

More information about the Mercurial-devel mailing list