changeset 16789:c17ce7cd5090 stable

match: make 'match.files()' return list object always 'exact' match objects are sometimes created with a non-list 'pattern' argument: - using 'set' in queue.refresh():hgext/mq.py match = scmutil.matchfiles(repo, set(c[0] + c[1] + c[2] + inclsubs)) - using 'dict' in revert():mercurial/cmdutil.py (names = {}) m = scmutil.matchfiles(repo, names) 'exact' match objects return specified 'pattern' to callers of 'match.files()' as it is, so it is a non-list object. but almost all implementations expect 'match.files()' to return a list object, so this may causes problems: e.g. exception for "+" with another list object. this patch ensures that '_files' of 'exact' match objects is a list object. for non 'exact' match objects, parsing specified 'pattern' already ensures that it it a list one.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 23 May 2012 00:25:29 +0900
parents 30e46d7138de
children 2a0efa1112ac
files mercurial/match.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/match.py	Sat May 19 17:19:55 2012 +0200
+++ b/mercurial/match.py	Wed May 23 00:25:29 2012 +0900
@@ -62,7 +62,10 @@
             pats = _normalize(exclude, 'glob', root, cwd, auditor)
             self.excludepat, em = _buildmatch(ctx, pats, '(?:/|$)')
         if exact:
-            self._files = patterns
+            if isinstance(patterns, list):
+                self._files = patterns
+            else:
+                self._files = list(patterns)
             pm = self.exact
         elif patterns:
             pats = _normalize(patterns, default, root, cwd, auditor)