Gentoo Archives: gentoo-commits

From: "Lars Wendler (polynomial-c)" <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-vcs/mercurial/files: mercurial-2.4-dont_grep_indefinitely.patch
Date: Sat, 24 Nov 2012 22:43:00
Message-Id: 20121124224249.8C76F20066@flycatcher.gentoo.org
1 polynomial-c 12/11/24 22:42:49
2
3 Added: mercurial-2.4-dont_grep_indefinitely.patch
4 Log:
5 Revbump to fix an endless grep search (needed by tortoisehg)
6
7 (Portage version: 2.2.0_alpha142/cvs/Linux x86_64, signed Manifest commit with key 0x981CA6FC)
8
9 Revision Changes Path
10 1.1 dev-vcs/mercurial/files/mercurial-2.4-dont_grep_indefinitely.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-vcs/mercurial/files/mercurial-2.4-dont_grep_indefinitely.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-vcs/mercurial/files/mercurial-2.4-dont_grep_indefinitely.patch?rev=1.1&content-type=text/plain
14
15 Index: mercurial-2.4-dont_grep_indefinitely.patch
16 ===================================================================
17
18 # HG changeset patch
19 # User Idan Kamara <idankk86@×××××.com>
20 # Date 1352741223 -7200
21 # Node ID 35ba170c0f82dba18f0207ef4bd93216e6de8bbf
22 # Parent 45bd0cd7ca04f8cda0a61cddded8838dd312675a
23 grep: don't search past the end of the searched string
24
25 '*' causes the resulting RE to match 0 or more repetitions of the preceding RE:
26
27 >>> bool(re.search('.*', ''))
28 >>> True
29
30 This causes an infinite loop because currently we're only checking if there was
31 a match without looking at where we are in the searched string.
32
33 diff -r 45bd0cd7ca04 -r 35ba170c0f82 mercurial/commands.py
34 --- a/mercurial/commands.py Tue Nov 13 08:41:56 2012 -0800
35 +++ b/mercurial/commands.py Mon Nov 12 19:27:03 2012 +0200
36 @@ -2935,7 +2935,7 @@
37 def matchlines(body):
38 begin = 0
39 linenum = 0
40 - while True:
41 + while True and begin < len(body):
42 match = regexp.search(body, begin)
43 if not match:
44 break
45 diff -r 45bd0cd7ca04 -r 35ba170c0f82 tests/test-grep.t
46 --- a/tests/test-grep.t Tue Nov 13 08:41:56 2012 -0800
47 +++ b/tests/test-grep.t Mon Nov 12 19:27:03 2012 +0200
48 @@ -23,6 +23,10 @@
49
50 simple
51
52 + $ hg grep '.*'
53 + port:4:export
54 + port:4:vaportight
55 + port:4:import/export
56 $ hg grep port port
57 port:4:export
58 port:4:vaportight