changeset 19706:26ddce1a2a55 stable

revset: fix wrong keyword() behaviour for strings with spaces Some changesets can be wrongly reported as matched by this predicate due to searching in a string joined with spaces and not individually. A test case added, which fails without this fix.
author Alexander Plavin <alexander@plav.in>
date Tue, 06 Aug 2013 00:52:06 +0400
parents e90c37d7d48c
children 591cbff13a7f fd4f612f7cb6
files mercurial/revset.py tests/test-revset.t
diffstat 2 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Tue Sep 03 18:05:11 2013 -0500
+++ b/mercurial/revset.py	Tue Aug 06 00:52:06 2013 +0400
@@ -910,8 +910,8 @@
     l = []
     for r in subset:
         c = repo[r]
-        t = " ".join(c.files() + [c.user(), c.description()])
-        if kw in encoding.lower(t):
+        if util.any(kw in encoding.lower(t)
+                    for t in c.files() + [c.user(), c.description()]):
             l.append(r)
     return l
 
--- a/tests/test-revset.t	Tue Sep 03 18:05:11 2013 -0500
+++ b/tests/test-revset.t	Tue Aug 06 00:52:06 2013 +0400
@@ -328,6 +328,7 @@
   7
   $ log 'keyword(issue)'
   6
+  $ log 'keyword("test a")'
   $ log 'limit(head(), 1)'
   0
   $ log 'matching(6)'