[PATCH] revset: fix wrong keyword() behaviour for strings with spaces
Alexander Plavin
alexander at plav.in
Mon Aug 5 21:20:29 UTC 2013
# HG changeset patch
# User Alexander Plavin <alexander at plav.in>
# Date 1375735926 -14400
# Tue Aug 06 00:52:06 2013 +0400
# Node ID ecb8e32e765eaf8e2df8d6535be6ca66275ca0df
# Parent d07c92b5a8382e8182cf63dbf6463c32140e9d14
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.
diff -r d07c92b5a838 -r ecb8e32e765e mercurial/revset.py
--- a/mercurial/revset.py Sun Jun 30 11:48:21 2013 +0400
+++ 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
diff -r d07c92b5a838 -r ecb8e32e765e tests/test-revset.t
--- a/tests/test-revset.t Sun Jun 30 11:48:21 2013 +0400
+++ 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)'
More information about the Mercurial-devel
mailing list