# HG changeset patch # User FUJIWARA Katsunori # Date 2012-05-22 15:25:29 # Node ID c17ce7cd5090463456dadc2bd893719a649cc315 # Parent 30e46d7138de0acb2d811162c1cf3441afe1687e 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. diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -62,7 +62,10 @@ class match(object): 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)