6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
1 |
# Copyright (C) 2010, 2011, 2012, 2016 Canonical Ltd
|
0.40.11
by Parth Malwankar
added basic test |
2 |
#
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
||
0.40.147
by Jelmer Vernooij
Fix compatibility with newer versions of bzr: don't use relative imports in lazy imports, and import features from bzrlib.tests.features. |
17 |
from __future__ import absolute_import |
18 |
||
0.40.11
by Parth Malwankar
added basic test |
19 |
import os |
20 |
import re |
|
0.40.71
by Parth Malwankar
fixed test_ver_null_option to pass on windows. |
21 |
import unicodedata as ud |
0.40.11
by Parth Malwankar
added basic test |
22 |
|
0.40.46
by Parth Malwankar
--levels=0 now implicitly prints revnos. added test for --levels=0. |
23 |
from bzrlib import tests, osutils |
6531.3.10
by Jelmer Vernooij
Rename termcolor to _termcolor. |
24 |
from bzrlib._termcolor import color_string, FG |
0.40.11
by Parth Malwankar
added basic test |
25 |
|
6531.3.8
by Jelmer Vernooij
Move color feature into bzrlib.tests.features. |
26 |
from bzrlib.tests.features import ( |
27 |
ColorFeature, |
|
28 |
UnicodeFilenameFeature, |
|
29 |
)
|
|
0.40.147
by Jelmer Vernooij
Fix compatibility with newer versions of bzr: don't use relative imports in lazy imports, and import features from bzrlib.tests.features. |
30 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
31 |
# NOTE: As bzr-grep optimizes PATTERN search to -F/--fixed-string
|
32 |
# for patterns that are not alphanumeric+whitespace, we test grep
|
|
33 |
# specfically with patterns that have special characters so that
|
|
34 |
# regex path is tested. alphanumeric patterns test the -F path.
|
|
35 |
||
0.43.11
by Parth Malwankar
test cases for colored results. |
36 |
class GrepTestBase(tests.TestCaseWithTransport): |
37 |
"""Base class for testing grep.
|
|
38 |
||
39 |
Provides support methods for creating directory and file revisions.
|
|
40 |
"""
|
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
41 |
_reflags = re.MULTILINE|re.DOTALL |
0.40.11
by Parth Malwankar
added basic test |
42 |
|
0.40.26
by Parth Malwankar
test passing for multiple matches |
43 |
def _mk_file(self, path, line_prefix, total_lines, versioned): |
0.40.13
by Parth Malwankar
added tests for -R and -i |
44 |
text='' |
45 |
for i in range(total_lines): |
|
46 |
text += line_prefix + str(i+1) + "\n" |
|
47 |
||
0.40.12
by Parth Malwankar
added test for versioned file |
48 |
open(path, 'w').write(text) |
49 |
if versioned: |
|
50 |
self.run_bzr(['add', path]) |
|
0.40.25
by Parth Malwankar
added test case for multilevel dir. |
51 |
self.run_bzr(['ci', '-m', '"' + path + '"']) |
0.40.12
by Parth Malwankar
added test for versioned file |
52 |
|
0.41.14
by Parth Malwankar
updated help and added test. |
53 |
def _update_file(self, path, text, checkin=True): |
0.40.34
by Parth Malwankar
added tests for single revision history search |
54 |
"""append text to file 'path' and check it in"""
|
55 |
open(path, 'a').write(text) |
|
0.41.14
by Parth Malwankar
updated help and added test. |
56 |
if checkin: |
0.41.15
by Parth Malwankar
bzr-grep now searches working copy by default. |
57 |
self.run_bzr(['ci', path, '-m', '"' + path + '"']) |
0.40.34
by Parth Malwankar
added tests for single revision history search |
58 |
|
0.40.37
by Parth Malwankar
grep now accepts rev range |
59 |
def _mk_unknown_file(self, path, line_prefix='line', total_lines=10): |
0.40.26
by Parth Malwankar
test passing for multiple matches |
60 |
self._mk_file(path, line_prefix, total_lines, versioned=False) |
0.40.13
by Parth Malwankar
added tests for -R and -i |
61 |
|
62 |
def _mk_versioned_file(self, path, line_prefix='line', total_lines=10): |
|
0.40.26
by Parth Malwankar
test passing for multiple matches |
63 |
self._mk_file(path, line_prefix, total_lines, versioned=True) |
0.40.13
by Parth Malwankar
added tests for -R and -i |
64 |
|
65 |
def _mk_dir(self, path, versioned): |
|
66 |
os.mkdir(path) |
|
67 |
if versioned: |
|
68 |
self.run_bzr(['add', path]) |
|
0.40.26
by Parth Malwankar
test passing for multiple matches |
69 |
self.run_bzr(['ci', '-m', '"' + path + '"']) |
0.40.13
by Parth Malwankar
added tests for -R and -i |
70 |
|
0.40.37
by Parth Malwankar
grep now accepts rev range |
71 |
def _mk_unknown_dir(self, path): |
0.40.26
by Parth Malwankar
test passing for multiple matches |
72 |
self._mk_dir(path, versioned=False) |
0.40.13
by Parth Malwankar
added tests for -R and -i |
73 |
|
74 |
def _mk_versioned_dir(self, path): |
|
75 |
self._mk_dir(path, versioned=True) |
|
76 |
||
0.40.131
by Parth Malwankar
bzr grep now allows grepping with -r even when no tree exists. |
77 |
|
0.43.11
by Parth Malwankar
test cases for colored results. |
78 |
class TestGrep(GrepTestBase): |
79 |
"""Core functional tests for grep."""
|
|
80 |
||
0.40.37
by Parth Malwankar
grep now accepts rev range |
81 |
def test_basic_unknown_file(self): |
0.41.13
by Parth Malwankar
working tree grep is now working |
82 |
"""Search for pattern in specfic file.
|
83 |
||
84 |
If specified file is unknown, grep it anyway."""
|
|
0.40.11
by Parth Malwankar
added basic test |
85 |
wd = 'foobar0' |
86 |
self.make_branch_and_tree(wd) |
|
87 |
os.chdir(wd) |
|
0.40.37
by Parth Malwankar
grep now accepts rev range |
88 |
self._mk_unknown_file('file0.txt') |
0.41.18
by Parth Malwankar
updated test to ensure that unknown files are skipped by default. |
89 |
|
0.40.11
by Parth Malwankar
added basic test |
90 |
out, err = self.run_bzr(['grep', 'line1', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
91 |
self.assertContainsRe(out, "file0.txt:line1", flags=TestGrep._reflags) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
92 |
self.assertEqual(len(out.splitlines()), 2) # finds line1 and line10 |
0.40.45
by Parth Malwankar
fixed case where only revno:0 is present. added test. |
93 |
|
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
94 |
out, err = self.run_bzr(['grep', 'line\d+', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
95 |
self.assertContainsRe(out, "file0.txt:line1", flags=TestGrep._reflags) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
96 |
self.assertEqual(len(out.splitlines()), 10) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
97 |
|
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
98 |
# unknown file is not grepped unless explicitely specified
|
0.41.18
by Parth Malwankar
updated test to ensure that unknown files are skipped by default. |
99 |
out, err = self.run_bzr(['grep', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
100 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
101 |
self.assertEqual(len(out.splitlines()), 0) |
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
102 |
|
103 |
# unknown file is not grepped unless explicitely specified
|
|
104 |
out, err = self.run_bzr(['grep', 'line1$']) |
|
105 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
106 |
self.assertEqual(len(out.splitlines()), 0) |
0.41.18
by Parth Malwankar
updated test to ensure that unknown files are skipped by default. |
107 |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
108 |
def test_ver_basic_file(self): |
0.41.17
by Parth Malwankar
added tests. |
109 |
"""(versioned) Search for pattern in specfic file.
|
110 |
"""
|
|
0.41.14
by Parth Malwankar
updated help and added test. |
111 |
wd = 'foobar0' |
112 |
self.make_branch_and_tree(wd) |
|
113 |
os.chdir(wd) |
|
114 |
self._mk_versioned_file('file0.txt') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
115 |
|
0.41.14
by Parth Malwankar
updated help and added test. |
116 |
out, err = self.run_bzr(['grep', '-r', '1', 'line1', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
117 |
self.assertContainsRe(out, "file0.txt~1:line1", flags=TestGrep._reflags) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
118 |
self.assertEqual(len(out.splitlines()), 2) # finds line1 and line10 |
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
119 |
|
120 |
out, err = self.run_bzr(['grep', '-r', '1', 'line[0-9]$', 'file0.txt']) |
|
121 |
self.assertContainsRe(out, "file0.txt~1:line1", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
122 |
self.assertEqual(len(out.splitlines()), 9) |
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
123 |
|
124 |
# finds all the lines
|
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
125 |
out, err = self.run_bzr(['grep', '-r', '1', 'line[0-9]', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
126 |
self.assertContainsRe(out, "file0.txt~1:line1", flags=TestGrep._reflags) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
127 |
self.assertEqual(len(out.splitlines()), 10) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
128 |
|
0.41.17
by Parth Malwankar
added tests. |
129 |
def test_wtree_basic_file(self): |
130 |
"""(wtree) Search for pattern in specfic file.
|
|
131 |
"""
|
|
0.40.12
by Parth Malwankar
added test for versioned file |
132 |
wd = 'foobar0' |
133 |
self.make_branch_and_tree(wd) |
|
134 |
os.chdir(wd) |
|
0.40.13
by Parth Malwankar
added tests for -R and -i |
135 |
self._mk_versioned_file('file0.txt') |
0.41.14
by Parth Malwankar
updated help and added test. |
136 |
self._update_file('file0.txt', 'ABC\n', checkin=False) |
137 |
||
138 |
out, err = self.run_bzr(['grep', 'ABC', 'file0.txt']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
139 |
self.assertContainsRe(out, "file0.txt:ABC", flags=TestGrep._reflags) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
140 |
self.assertEqual(len(out.splitlines()), 1) |
0.41.14
by Parth Malwankar
updated help and added test. |
141 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
142 |
out, err = self.run_bzr(['grep', '[A-Z]{3}', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
143 |
self.assertContainsRe(out, "file0.txt:ABC", flags=TestGrep._reflags) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
144 |
self.assertEqual(len(out.splitlines()), 1) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
145 |
|
0.41.14
by Parth Malwankar
updated help and added test. |
146 |
out, err = self.run_bzr(['grep', '-r', 'last:1', 'ABC', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
147 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
148 |
self.assertEqual(len(out.splitlines()), 0) |
0.40.12
by Parth Malwankar
added test for versioned file |
149 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
150 |
out, err = self.run_bzr(['grep', '-r', 'last:1', '[A-Z]{3}', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
151 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
152 |
self.assertEqual(len(out.splitlines()), 0) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
153 |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
154 |
def test_ver_basic_include(self): |
0.40.58
by Parth Malwankar
-I and -X are shortnames for --include and --exclude |
155 |
"""(versioned) Ensure that -I flag is respected.
|
0.41.22
by Parth Malwankar
added basic --exclude/include tests |
156 |
"""
|
157 |
wd = 'foobar0' |
|
158 |
self.make_branch_and_tree(wd) |
|
159 |
os.chdir(wd) |
|
160 |
self._mk_versioned_file('file0.aa') |
|
161 |
self._mk_versioned_file('file0.bb') |
|
162 |
self._mk_versioned_file('file0.cc') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
163 |
|
0.41.22
by Parth Malwankar
added basic --exclude/include tests |
164 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
165 |
'--include', '*.aa', '--include', '*.bb', 'line1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
166 |
self.assertContainsRe(out, "file0.aa~.:line1", flags=TestGrep._reflags) |
167 |
self.assertContainsRe(out, "file0.bb~.:line1", flags=TestGrep._reflags) |
|
168 |
self.assertNotContainsRe(out, "file0.cc", flags=TestGrep._reflags) |
|
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
169 |
# two lines each (line1, line10) from file0.aa and file0.bb
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
170 |
self.assertEqual(len(out.splitlines()), 4) |
0.41.22
by Parth Malwankar
added basic --exclude/include tests |
171 |
|
0.40.58
by Parth Malwankar
-I and -X are shortnames for --include and --exclude |
172 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
173 |
'--include', '*.aa', '--include', '*.bb', 'line1$']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
174 |
self.assertContainsRe(out, "file0.aa~.:line1", flags=TestGrep._reflags) |
175 |
self.assertContainsRe(out, "file0.bb~.:line1", flags=TestGrep._reflags) |
|
176 |
self.assertNotContainsRe(out, "file0.cc", flags=TestGrep._reflags) |
|
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
177 |
# one lines each (line1) from file0.aa and file0.bb
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
178 |
self.assertEqual(len(out.splitlines()), 2) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
179 |
|
180 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
|
0.40.58
by Parth Malwankar
-I and -X are shortnames for --include and --exclude |
181 |
'-I', '*.aa', '-I', '*.bb', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
182 |
self.assertContainsRe(out, "file0.aa~.:line1", flags=TestGrep._reflags) |
183 |
self.assertContainsRe(out, "file0.bb~.:line1", flags=TestGrep._reflags) |
|
184 |
self.assertNotContainsRe(out, "file0.cc", flags=TestGrep._reflags) |
|
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
185 |
# two lines each (line1, line10) from file0.aa and file0.bb
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
186 |
self.assertEqual(len(out.splitlines()), 4) |
0.40.58
by Parth Malwankar
-I and -X are shortnames for --include and --exclude |
187 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
188 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
189 |
'-I', '*.aa', '-I', '*.bb', 'line1$']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
190 |
self.assertContainsRe(out, "file0.aa~.:line1", flags=TestGrep._reflags) |
191 |
self.assertContainsRe(out, "file0.bb~.:line1", flags=TestGrep._reflags) |
|
192 |
self.assertNotContainsRe(out, "file0.cc", flags=TestGrep._reflags) |
|
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
193 |
# one lines each (line1) from file0.aa and file0.bb
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
194 |
self.assertEqual(len(out.splitlines()), 2) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
195 |
|
0.41.22
by Parth Malwankar
added basic --exclude/include tests |
196 |
def test_wtree_basic_include(self): |
197 |
"""(wtree) Ensure that --include flag is respected.
|
|
198 |
"""
|
|
199 |
wd = 'foobar0' |
|
200 |
self.make_branch_and_tree(wd) |
|
201 |
os.chdir(wd) |
|
202 |
self._mk_versioned_file('file0.aa') |
|
203 |
self._mk_versioned_file('file0.bb') |
|
204 |
self._mk_versioned_file('file0.cc') |
|
0.40.58
by Parth Malwankar
-I and -X are shortnames for --include and --exclude |
205 |
|
0.41.22
by Parth Malwankar
added basic --exclude/include tests |
206 |
out, err = self.run_bzr(['grep', '--include', '*.aa', |
207 |
'--include', '*.bb', 'line1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
208 |
self.assertContainsRe(out, "file0.aa:line1", flags=TestGrep._reflags) |
209 |
self.assertContainsRe(out, "file0.bb:line1", flags=TestGrep._reflags) |
|
210 |
self.assertNotContainsRe(out, "file0.cc", flags=TestGrep._reflags) |
|
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
211 |
# two lines each (line1, line10) from file0.aa and file0.bb
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
212 |
self.assertEqual(len(out.splitlines()), 4) |
0.41.22
by Parth Malwankar
added basic --exclude/include tests |
213 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
214 |
out, err = self.run_bzr(['grep', '--include', '*.aa', |
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
215 |
'--include', '*.bb', 'line1$']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
216 |
self.assertContainsRe(out, "file0.aa:line1", flags=TestGrep._reflags) |
217 |
self.assertContainsRe(out, "file0.bb:line1", flags=TestGrep._reflags) |
|
218 |
self.assertNotContainsRe(out, "file0.cc", flags=TestGrep._reflags) |
|
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
219 |
# one line each (line1) from file0.aa and file0.bb
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
220 |
self.assertEqual(len(out.splitlines()), 2) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
221 |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
222 |
def test_ver_basic_exclude(self): |
0.41.22
by Parth Malwankar
added basic --exclude/include tests |
223 |
"""(versioned) Ensure that --exclude flag is respected.
|
224 |
"""
|
|
225 |
wd = 'foobar0' |
|
226 |
self.make_branch_and_tree(wd) |
|
227 |
os.chdir(wd) |
|
228 |
self._mk_versioned_file('file0.aa') |
|
229 |
self._mk_versioned_file('file0.bb') |
|
230 |
self._mk_versioned_file('file0.cc') |
|
0.40.58
by Parth Malwankar
-I and -X are shortnames for --include and --exclude |
231 |
|
0.41.22
by Parth Malwankar
added basic --exclude/include tests |
232 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
233 |
'--exclude', '*.cc', 'line1']) |
|
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
234 |
self.assertContainsRe(out, "file0.aa~.:line1$", flags=TestGrep._reflags) |
235 |
self.assertContainsRe(out, "file0.bb~.:line1$", flags=TestGrep._reflags) |
|
236 |
self.assertContainsRe(out, "file0.aa~.:line10", flags=TestGrep._reflags) |
|
237 |
self.assertContainsRe(out, "file0.bb~.:line10", flags=TestGrep._reflags) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
238 |
self.assertNotContainsRe(out, "file0.cc", flags=TestGrep._reflags) |
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
239 |
# two lines each (line1, line10) from file0.aa and file0.bb
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
240 |
self.assertEqual(len(out.splitlines()), 4) |
0.41.22
by Parth Malwankar
added basic --exclude/include tests |
241 |
|
0.40.58
by Parth Malwankar
-I and -X are shortnames for --include and --exclude |
242 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
243 |
'--exclude', '*.cc', 'line1$']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
244 |
self.assertContainsRe(out, "file0.aa~.:line1", flags=TestGrep._reflags) |
245 |
self.assertContainsRe(out, "file0.bb~.:line1", flags=TestGrep._reflags) |
|
246 |
self.assertNotContainsRe(out, "file0.cc", flags=TestGrep._reflags) |
|
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
247 |
# one line each (line1) from file0.aa and file0.bb
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
248 |
self.assertEqual(len(out.splitlines()), 2) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
249 |
|
250 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
|
0.40.58
by Parth Malwankar
-I and -X are shortnames for --include and --exclude |
251 |
'-X', '*.cc', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
252 |
self.assertContainsRe(out, "file0.aa~.:line1", flags=TestGrep._reflags) |
253 |
self.assertContainsRe(out, "file0.bb~.:line1", flags=TestGrep._reflags) |
|
254 |
self.assertNotContainsRe(out, "file0.cc", flags=TestGrep._reflags) |
|
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
255 |
# two lines each (line1, line10) from file0.aa and file0.bb
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
256 |
self.assertEqual(len(out.splitlines()), 4) |
0.40.58
by Parth Malwankar
-I and -X are shortnames for --include and --exclude |
257 |
|
0.41.22
by Parth Malwankar
added basic --exclude/include tests |
258 |
def test_wtree_basic_exclude(self): |
259 |
"""(wtree) Ensure that --exclude flag is respected.
|
|
260 |
"""
|
|
261 |
wd = 'foobar0' |
|
262 |
self.make_branch_and_tree(wd) |
|
263 |
os.chdir(wd) |
|
264 |
self._mk_versioned_file('file0.aa') |
|
265 |
self._mk_versioned_file('file0.bb') |
|
266 |
self._mk_versioned_file('file0.cc') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
267 |
|
0.41.22
by Parth Malwankar
added basic --exclude/include tests |
268 |
out, err = self.run_bzr(['grep', '--exclude', '*.cc', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
269 |
self.assertContainsRe(out, "file0.aa:line1", flags=TestGrep._reflags) |
270 |
self.assertContainsRe(out, "file0.bb:line1", flags=TestGrep._reflags) |
|
271 |
self.assertNotContainsRe(out, "file0.cc", flags=TestGrep._reflags) |
|
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
272 |
# two lines each (line1, line10) from file0.aa and file0.bb
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
273 |
self.assertEqual(len(out.splitlines()), 4) |
0.41.22
by Parth Malwankar
added basic --exclude/include tests |
274 |
|
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
275 |
out, err = self.run_bzr(['grep', '--exclude', '*.cc', 'lin.1$']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
276 |
self.assertContainsRe(out, "file0.aa:line1", flags=TestGrep._reflags) |
277 |
self.assertContainsRe(out, "file0.bb:line1", flags=TestGrep._reflags) |
|
278 |
self.assertNotContainsRe(out, "file0.cc", flags=TestGrep._reflags) |
|
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
279 |
# one line each (line1) from file0.aa and file0.bb
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
280 |
self.assertEqual(len(out.splitlines()), 2) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
281 |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
282 |
def test_ver_multiple_files(self): |
0.41.17
by Parth Malwankar
added tests. |
283 |
"""(versioned) Search for pattern in multiple files.
|
284 |
"""
|
|
0.41.15
by Parth Malwankar
bzr-grep now searches working copy by default. |
285 |
wd = 'foobar0' |
286 |
self.make_branch_and_tree(wd) |
|
287 |
os.chdir(wd) |
|
288 |
self._mk_versioned_file('file0.txt', total_lines=2) |
|
289 |
self._mk_versioned_file('file1.txt', total_lines=2) |
|
290 |
self._mk_versioned_file('file2.txt', total_lines=2) |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
291 |
|
0.40.103
by Parth Malwankar
made some tests more accurate by checking number of output lines |
292 |
out, err = self.run_bzr(['grep', '-r', 'last:1', 'line[1-2]$']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
293 |
self.assertContainsRe(out, "file0.txt~.:line1", flags=TestGrep._reflags) |
294 |
self.assertContainsRe(out, "file0.txt~.:line2", flags=TestGrep._reflags) |
|
295 |
self.assertContainsRe(out, "file1.txt~.:line1", flags=TestGrep._reflags) |
|
296 |
self.assertContainsRe(out, "file1.txt~.:line2", flags=TestGrep._reflags) |
|
297 |
self.assertContainsRe(out, "file2.txt~.:line1", flags=TestGrep._reflags) |
|
298 |
self.assertContainsRe(out, "file2.txt~.:line2", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
299 |
self.assertEqual(len(out.splitlines()), 6) |
0.41.15
by Parth Malwankar
bzr-grep now searches working copy by default. |
300 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
301 |
out, err = self.run_bzr(['grep', '-r', 'last:1', 'line']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
302 |
self.assertContainsRe(out, "file0.txt~.:line1", flags=TestGrep._reflags) |
303 |
self.assertContainsRe(out, "file0.txt~.:line2", flags=TestGrep._reflags) |
|
304 |
self.assertContainsRe(out, "file1.txt~.:line1", flags=TestGrep._reflags) |
|
305 |
self.assertContainsRe(out, "file1.txt~.:line2", flags=TestGrep._reflags) |
|
306 |
self.assertContainsRe(out, "file2.txt~.:line1", flags=TestGrep._reflags) |
|
307 |
self.assertContainsRe(out, "file2.txt~.:line2", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
308 |
self.assertEqual(len(out.splitlines()), 6) |
0.41.15
by Parth Malwankar
bzr-grep now searches working copy by default. |
309 |
|
310 |
def test_multiple_wtree_files(self): |
|
0.41.17
by Parth Malwankar
added tests. |
311 |
"""(wtree) Search for pattern in multiple files in working tree.
|
312 |
"""
|
|
0.41.15
by Parth Malwankar
bzr-grep now searches working copy by default. |
313 |
wd = 'foobar0' |
314 |
self.make_branch_and_tree(wd) |
|
315 |
os.chdir(wd) |
|
316 |
self._mk_versioned_file('file0.txt', total_lines=2) |
|
317 |
self._mk_versioned_file('file1.txt', total_lines=2) |
|
318 |
self._mk_versioned_file('file2.txt', total_lines=2) |
|
319 |
self._update_file('file0.txt', 'HELLO\n', checkin=False) |
|
320 |
self._update_file('file1.txt', 'HELLO\n', checkin=True) |
|
321 |
self._update_file('file2.txt', 'HELLO\n', checkin=False) |
|
322 |
||
323 |
out, err = self.run_bzr(['grep', 'HELLO', |
|
324 |
'file0.txt', 'file1.txt', 'file2.txt']) |
|
325 |
||
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
326 |
self.assertContainsRe(out, "file0.txt:HELLO", flags=TestGrep._reflags) |
327 |
self.assertContainsRe(out, "file1.txt:HELLO", flags=TestGrep._reflags) |
|
328 |
self.assertContainsRe(out, "file2.txt:HELLO", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
329 |
self.assertEqual(len(out.splitlines()), 3) |
0.41.15
by Parth Malwankar
bzr-grep now searches working copy by default. |
330 |
|
331 |
out, err = self.run_bzr(['grep', 'HELLO', '-r', 'last:1', |
|
332 |
'file0.txt', 'file1.txt', 'file2.txt']) |
|
333 |
||
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
334 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
335 |
self.assertContainsRe(out, "file1.txt~.:HELLO", flags=TestGrep._reflags) |
|
336 |
self.assertNotContainsRe(out, "file2.txt", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
337 |
self.assertEqual(len(out.splitlines()), 1) |
0.40.25
by Parth Malwankar
added test case for multilevel dir. |
338 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
339 |
out, err = self.run_bzr(['grep', 'HE..O', |
340 |
'file0.txt', 'file1.txt', 'file2.txt']) |
|
341 |
||
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
342 |
self.assertContainsRe(out, "file0.txt:HELLO", flags=TestGrep._reflags) |
343 |
self.assertContainsRe(out, "file1.txt:HELLO", flags=TestGrep._reflags) |
|
344 |
self.assertContainsRe(out, "file2.txt:HELLO", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
345 |
self.assertEqual(len(out.splitlines()), 3) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
346 |
|
347 |
out, err = self.run_bzr(['grep', 'HE..O', '-r', 'last:1', |
|
348 |
'file0.txt', 'file1.txt', 'file2.txt']) |
|
349 |
||
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
350 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
351 |
self.assertContainsRe(out, "file1.txt~.:HELLO", flags=TestGrep._reflags) |
|
352 |
self.assertNotContainsRe(out, "file2.txt", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
353 |
self.assertEqual(len(out.splitlines()), 1) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
354 |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
355 |
def test_ver_null_option(self): |
0.41.17
by Parth Malwankar
added tests. |
356 |
"""(versioned) --null option should use NUL instead of newline.
|
357 |
"""
|
|
358 |
wd = 'foobar0' |
|
359 |
self.make_branch_and_tree(wd) |
|
360 |
os.chdir(wd) |
|
361 |
self._mk_versioned_file('file0.txt', total_lines=3) |
|
362 |
||
0.40.71
by Parth Malwankar
fixed test_ver_null_option to pass on windows. |
363 |
nref = ud.normalize(u'NFC', u"file0.txt~1:line1\0file0.txt~1:line2\0file0.txt~1:line3\0") |
364 |
||
0.41.17
by Parth Malwankar
added tests. |
365 |
out, err = self.run_bzr(['grep', '-r', 'last:1', '--null', 'line[1-3]']) |
0.40.71
by Parth Malwankar
fixed test_ver_null_option to pass on windows. |
366 |
nout = ud.normalize(u'NFC', out.decode('utf-8', 'ignore')) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
367 |
self.assertEqual(nout, nref) |
368 |
self.assertEqual(len(out.splitlines()), 1) |
|
0.41.17
by Parth Malwankar
added tests. |
369 |
|
370 |
out, err = self.run_bzr(['grep', '-r', 'last:1', '-Z', 'line[1-3]']) |
|
0.40.71
by Parth Malwankar
fixed test_ver_null_option to pass on windows. |
371 |
nout = ud.normalize(u'NFC', out.decode('utf-8', 'ignore')) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
372 |
self.assertEqual(nout, nref) |
373 |
self.assertEqual(len(out.splitlines()), 1) |
|
0.41.17
by Parth Malwankar
added tests. |
374 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
375 |
out, err = self.run_bzr(['grep', '-r', 'last:1', '--null', 'line']) |
376 |
nout = ud.normalize(u'NFC', out.decode('utf-8', 'ignore')) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
377 |
self.assertEqual(nout, nref) |
378 |
self.assertEqual(len(out.splitlines()), 1) |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
379 |
|
0.41.17
by Parth Malwankar
added tests. |
380 |
def test_wtree_null_option(self): |
381 |
"""(wtree) --null option should use NUL instead of newline.
|
|
382 |
"""
|
|
0.40.27
by Parth Malwankar
added test for null option |
383 |
wd = 'foobar0' |
384 |
self.make_branch_and_tree(wd) |
|
385 |
os.chdir(wd) |
|
386 |
self._mk_versioned_file('file0.txt', total_lines=3) |
|
387 |
||
388 |
out, err = self.run_bzr(['grep', '--null', 'line[1-3]']) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
389 |
self.assertEqual(out, "file0.txt:line1\0file0.txt:line2\0file0.txt:line3\0") |
390 |
self.assertEqual(len(out.splitlines()), 1) |
|
0.40.27
by Parth Malwankar
added test for null option |
391 |
|
392 |
out, err = self.run_bzr(['grep', '-Z', 'line[1-3]']) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
393 |
self.assertEqual(out, "file0.txt:line1\0file0.txt:line2\0file0.txt:line3\0") |
394 |
self.assertEqual(len(out.splitlines()), 1) |
|
0.40.27
by Parth Malwankar
added test for null option |
395 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
396 |
out, err = self.run_bzr(['grep', '-Z', 'line']) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
397 |
self.assertEqual(out, "file0.txt:line1\0file0.txt:line2\0file0.txt:line3\0") |
398 |
self.assertEqual(len(out.splitlines()), 1) |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
399 |
|
0.41.6
by Parth Malwankar
renamed --recurse/--no-recurse => --recursive/--no-recursive |
400 |
def test_versioned_file_in_dir_no_recursive(self): |
0.41.17
by Parth Malwankar
added tests. |
401 |
"""(versioned) Should not recurse with --no-recursive"""
|
402 |
wd = 'foobar0' |
|
403 |
self.make_branch_and_tree(wd) |
|
404 |
os.chdir(wd) |
|
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
405 |
self._mk_versioned_file('fileX.txt', line_prefix='lin') |
0.41.17
by Parth Malwankar
added tests. |
406 |
self._mk_versioned_dir('dir0') |
407 |
self._mk_versioned_file('dir0/file0.txt') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
408 |
|
0.41.17
by Parth Malwankar
added tests. |
409 |
out, err = self.run_bzr(['grep', '-r', 'last:1', '--no-recursive', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
410 |
self.assertNotContainsRe(out, "file0.txt~.:line1", flags=TestGrep._reflags) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
411 |
self.assertEqual(len(out.splitlines()), 0) |
0.41.17
by Parth Malwankar
added tests. |
412 |
|
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
413 |
out, err = self.run_bzr(['grep', '-r', 'last:1', '--no-recursive', 'line1$']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
414 |
self.assertNotContainsRe(out, "file0.txt~.:line1", flags=TestGrep._reflags) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
415 |
self.assertEqual(len(out.splitlines()), 0) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
416 |
|
0.41.17
by Parth Malwankar
added tests. |
417 |
def test_wtree_file_in_dir_no_recursive(self): |
418 |
"""(wtree) Should not recurse with --no-recursive"""
|
|
0.40.13
by Parth Malwankar
added tests for -R and -i |
419 |
wd = 'foobar0' |
420 |
self.make_branch_and_tree(wd) |
|
421 |
os.chdir(wd) |
|
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
422 |
self._mk_versioned_file('fileX.txt', line_prefix='lin') |
0.40.13
by Parth Malwankar
added tests for -R and -i |
423 |
self._mk_versioned_dir('dir0') |
424 |
self._mk_versioned_file('dir0/file0.txt') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
425 |
|
0.41.6
by Parth Malwankar
renamed --recurse/--no-recurse => --recursive/--no-recursive |
426 |
out, err = self.run_bzr(['grep', '--no-recursive', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
427 |
self.assertNotContainsRe(out, "file0.txt:line1", flags=TestGrep._reflags) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
428 |
self.assertEqual(len(out.splitlines()), 0) |
0.40.13
by Parth Malwankar
added tests for -R and -i |
429 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
430 |
out, err = self.run_bzr(['grep', '--no-recursive', 'lin.1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
431 |
self.assertNotContainsRe(out, "file0.txt:line1", flags=TestGrep._reflags) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
432 |
self.assertEqual(len(out.splitlines()), 0) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
433 |
|
0.40.13
by Parth Malwankar
added tests for -R and -i |
434 |
def test_versioned_file_in_dir_recurse(self): |
0.41.17
by Parth Malwankar
added tests. |
435 |
"""(versioned) Should recurse by default.
|
436 |
"""
|
|
437 |
wd = 'foobar0' |
|
438 |
self.make_branch_and_tree(wd) |
|
439 |
os.chdir(wd) |
|
440 |
self._mk_versioned_dir('dir0') |
|
441 |
self._mk_versioned_file('dir0/file0.txt') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
442 |
|
443 |
out, err = self.run_bzr(['grep', '-r', '-1', '.i.e1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
444 |
self.assertContainsRe(out, "^dir0/file0.txt~.:line1", flags=TestGrep._reflags) |
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
445 |
# find line1 and line10
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
446 |
self.assertEqual(len(out.splitlines()), 2) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
447 |
|
0.41.17
by Parth Malwankar
added tests. |
448 |
out, err = self.run_bzr(['grep', '-r', '-1', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
449 |
self.assertContainsRe(out, "^dir0/file0.txt~.:line1", flags=TestGrep._reflags) |
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
450 |
# find line1 and line10
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
451 |
self.assertEqual(len(out.splitlines()), 2) |
0.41.17
by Parth Malwankar
added tests. |
452 |
|
453 |
def test_wtree_file_in_dir_recurse(self): |
|
454 |
"""(wtree) Should recurse by default.
|
|
455 |
"""
|
|
0.40.13
by Parth Malwankar
added tests for -R and -i |
456 |
wd = 'foobar0' |
457 |
self.make_branch_and_tree(wd) |
|
458 |
os.chdir(wd) |
|
459 |
self._mk_versioned_dir('dir0') |
|
460 |
self._mk_versioned_file('dir0/file0.txt') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
461 |
|
0.41.4
by Parth Malwankar
--recurse is default. |
462 |
out, err = self.run_bzr(['grep', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
463 |
self.assertContainsRe(out, "^dir0/file0.txt:line1", flags=TestGrep._reflags) |
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
464 |
# find line1 and line10
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
465 |
self.assertEqual(len(out.splitlines()), 2) |
0.40.23
by Parth Malwankar
added test case for search while inside dir. |
466 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
467 |
out, err = self.run_bzr(['grep', 'lin.1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
468 |
self.assertContainsRe(out, "^dir0/file0.txt:line1", flags=TestGrep._reflags) |
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
469 |
# find line1 and line10
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
470 |
self.assertEqual(len(out.splitlines()), 2) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
471 |
|
0.40.23
by Parth Malwankar
added test case for search while inside dir. |
472 |
def test_versioned_file_within_dir(self): |
0.41.17
by Parth Malwankar
added tests. |
473 |
"""(versioned) Search for pattern while in nested dir.
|
474 |
"""
|
|
475 |
wd = 'foobar0' |
|
476 |
self.make_branch_and_tree(wd) |
|
477 |
os.chdir(wd) |
|
478 |
self._mk_versioned_dir('dir0') |
|
479 |
self._mk_versioned_file('dir0/file0.txt') |
|
480 |
os.chdir('dir0') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
481 |
|
0.41.17
by Parth Malwankar
added tests. |
482 |
out, err = self.run_bzr(['grep', '-r', 'last:1', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
483 |
self.assertContainsRe(out, "^file0.txt~.:line1", flags=TestGrep._reflags) |
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
484 |
# finds line1 and line10
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
485 |
self.assertEqual(len(out.splitlines()), 2) |
0.41.17
by Parth Malwankar
added tests. |
486 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
487 |
out, err = self.run_bzr(['grep', '-r', 'last:1', '.i.e1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
488 |
self.assertContainsRe(out, "^file0.txt~.:line1", flags=TestGrep._reflags) |
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
489 |
# finds line1 and line10
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
490 |
self.assertEqual(len(out.splitlines()), 2) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
491 |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
492 |
def test_versioned_include_file_within_dir(self): |
493 |
"""(versioned) Ensure --include is respected with file within dir.
|
|
494 |
"""
|
|
495 |
wd = 'foobar0' |
|
496 |
self.make_branch_and_tree(wd) |
|
497 |
os.chdir(wd) |
|
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
498 |
self._mk_versioned_dir('dir0') # revno 1 |
499 |
self._mk_versioned_file('dir0/file0.txt') # revno 2 |
|
500 |
self._mk_versioned_file('dir0/file1.aa') # revno 3 |
|
501 |
self._update_file('dir0/file1.aa', 'hello\n') # revno 4 |
|
502 |
self._update_file('dir0/file0.txt', 'hello\n') # revno 5 |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
503 |
os.chdir('dir0') |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
504 |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
505 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
506 |
'--include', '*.aa', 'line1']) |
|
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
507 |
self.assertContainsRe(out, "^file1.aa~5:line1$", flags=TestGrep._reflags) |
508 |
self.assertContainsRe(out, "^file1.aa~5:line10$", flags=TestGrep._reflags) |
|
509 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
|
510 |
# finds line1 and line10
|
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
511 |
self.assertEqual(len(out.splitlines()), 2) |
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
512 |
|
513 |
out, err = self.run_bzr(['grep', '-r', 'last:2..last:1', |
|
514 |
'--include', '*.aa', 'line1']) |
|
515 |
self.assertContainsRe(out, "^file1.aa~4:line1$", flags=TestGrep._reflags) |
|
516 |
self.assertContainsRe(out, "^file1.aa~4:line10$", flags=TestGrep._reflags) |
|
517 |
self.assertContainsRe(out, "^file1.aa~5:line1$", flags=TestGrep._reflags) |
|
518 |
self.assertContainsRe(out, "^file1.aa~5:line10$", flags=TestGrep._reflags) |
|
519 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
|
520 |
# finds line1 and line10 over two revisions
|
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
521 |
self.assertEqual(len(out.splitlines()), 4) |
0.41.23
by Parth Malwankar
added tests for --include/exclude |
522 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
523 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
524 |
'--include', '*.aa', 'lin.1']) |
|
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
525 |
self.assertContainsRe(out, "^file1.aa~5:line1$", flags=TestGrep._reflags) |
526 |
self.assertContainsRe(out, "^file1.aa~5:line10$", flags=TestGrep._reflags) |
|
527 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
|
528 |
# finds line1 and line10
|
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
529 |
self.assertEqual(len(out.splitlines()), 2) |
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
530 |
|
531 |
out, err = self.run_bzr(['grep', '-r', 'last:3..last:1', |
|
532 |
'--include', '*.aa', 'lin.1']) |
|
533 |
self.assertContainsRe(out, "^file1.aa~3:line1$", flags=TestGrep._reflags) |
|
534 |
self.assertContainsRe(out, "^file1.aa~4:line1$", flags=TestGrep._reflags) |
|
535 |
self.assertContainsRe(out, "^file1.aa~5:line1$", flags=TestGrep._reflags) |
|
536 |
self.assertContainsRe(out, "^file1.aa~3:line10$", flags=TestGrep._reflags) |
|
537 |
self.assertContainsRe(out, "^file1.aa~4:line10$", flags=TestGrep._reflags) |
|
538 |
self.assertContainsRe(out, "^file1.aa~5:line10$", flags=TestGrep._reflags) |
|
539 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
|
540 |
# finds line1 and line10 over 3 revisions
|
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
541 |
self.assertEqual(len(out.splitlines()), 6) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
542 |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
543 |
def test_versioned_exclude_file_within_dir(self): |
544 |
"""(versioned) Ensure --exclude is respected with file within dir.
|
|
545 |
"""
|
|
546 |
wd = 'foobar0' |
|
547 |
self.make_branch_and_tree(wd) |
|
548 |
os.chdir(wd) |
|
549 |
self._mk_versioned_dir('dir0') |
|
550 |
self._mk_versioned_file('dir0/file0.txt') |
|
551 |
self._mk_versioned_file('dir0/file1.aa') |
|
552 |
os.chdir('dir0') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
553 |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
554 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
555 |
'--exclude', '*.txt', 'line1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
556 |
self.assertContainsRe(out, "^file1.aa~.:line1", flags=TestGrep._reflags) |
557 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
|
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
558 |
# finds line1 and line10
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
559 |
self.assertEqual(len(out.splitlines()), 2) |
0.41.23
by Parth Malwankar
added tests for --include/exclude |
560 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
561 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
562 |
'--exclude', '*.txt', 'l[a-z]ne1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
563 |
self.assertContainsRe(out, "^file1.aa~.:line1", flags=TestGrep._reflags) |
564 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
|
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
565 |
# finds line1 and line10
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
566 |
self.assertEqual(len(out.splitlines()), 2) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
567 |
|
0.41.17
by Parth Malwankar
added tests. |
568 |
def test_wtree_file_within_dir(self): |
569 |
"""(wtree) Search for pattern while in nested dir.
|
|
570 |
"""
|
|
0.40.23
by Parth Malwankar
added test case for search while inside dir. |
571 |
wd = 'foobar0' |
572 |
self.make_branch_and_tree(wd) |
|
573 |
os.chdir(wd) |
|
574 |
self._mk_versioned_dir('dir0') |
|
575 |
self._mk_versioned_file('dir0/file0.txt') |
|
576 |
os.chdir('dir0') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
577 |
|
0.40.23
by Parth Malwankar
added test case for search while inside dir. |
578 |
out, err = self.run_bzr(['grep', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
579 |
self.assertContainsRe(out, "^file0.txt:line1", flags=TestGrep._reflags) |
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
580 |
# finds line1 and line10
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
581 |
self.assertEqual(len(out.splitlines()), 2) |
0.40.13
by Parth Malwankar
added tests for -R and -i |
582 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
583 |
out, err = self.run_bzr(['grep', 'l[aeiou]ne1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
584 |
self.assertContainsRe(out, "^file0.txt:line1", flags=TestGrep._reflags) |
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
585 |
# finds line1 and line10
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
586 |
self.assertEqual(len(out.splitlines()), 2) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
587 |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
588 |
def test_wtree_include_file_within_dir(self): |
589 |
"""(wtree) Ensure --include is respected with file within dir.
|
|
590 |
"""
|
|
591 |
wd = 'foobar0' |
|
592 |
self.make_branch_and_tree(wd) |
|
593 |
os.chdir(wd) |
|
594 |
self._mk_versioned_dir('dir0') |
|
595 |
self._mk_versioned_file('dir0/file0.txt') |
|
596 |
self._mk_versioned_file('dir0/file1.aa') |
|
597 |
os.chdir('dir0') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
598 |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
599 |
out, err = self.run_bzr(['grep', '--include', '*.aa', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
600 |
self.assertContainsRe(out, "^file1.aa:line1", flags=TestGrep._reflags) |
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
601 |
# finds line1 and line10
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
602 |
self.assertEqual(len(out.splitlines()), 2) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
603 |
|
604 |
out, err = self.run_bzr(['grep', '--include', '*.aa', 'l[ixn]ne1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
605 |
self.assertContainsRe(out, "^file1.aa:line1", flags=TestGrep._reflags) |
606 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
|
0.40.104
by Parth Malwankar
made more tests more specific for accurate results. |
607 |
# finds line1 and line10
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
608 |
self.assertEqual(len(out.splitlines()), 2) |
0.41.23
by Parth Malwankar
added tests for --include/exclude |
609 |
|
610 |
def test_wtree_exclude_file_within_dir(self): |
|
611 |
"""(wtree) Ensure --exclude is respected with file within dir.
|
|
612 |
"""
|
|
613 |
wd = 'foobar0' |
|
614 |
self.make_branch_and_tree(wd) |
|
615 |
os.chdir(wd) |
|
616 |
self._mk_versioned_dir('dir0') |
|
617 |
self._mk_versioned_file('dir0/file0.txt') |
|
618 |
self._mk_versioned_file('dir0/file1.aa') |
|
619 |
os.chdir('dir0') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
620 |
|
621 |
out, err = self.run_bzr(['grep', '--exclude', '*.txt', 'li.e1']) |
|
0.40.105
by Parth Malwankar
fixed bug in ordering of user provided versions. |
622 |
self.assertContainsRe(out, "^file1.aa:line1$", flags=TestGrep._reflags) |
623 |
self.assertContainsRe(out, "^file1.aa:line10$", flags=TestGrep._reflags) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
624 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
0.40.105
by Parth Malwankar
fixed bug in ordering of user provided versions. |
625 |
# finds line1 and line10
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
626 |
self.assertEqual(len(out.splitlines()), 2) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
627 |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
628 |
out, err = self.run_bzr(['grep', '--exclude', '*.txt', 'line1']) |
0.40.105
by Parth Malwankar
fixed bug in ordering of user provided versions. |
629 |
self.assertContainsRe(out, "^file1.aa:line1$", flags=TestGrep._reflags) |
630 |
self.assertContainsRe(out, "^file1.aa:line10$", flags=TestGrep._reflags) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
631 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
0.40.105
by Parth Malwankar
fixed bug in ordering of user provided versions. |
632 |
# finds line1 and line10
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
633 |
self.assertEqual(len(out.splitlines()), 2) |
0.41.23
by Parth Malwankar
added tests for --include/exclude |
634 |
|
635 |
def test_versioned_include_from_outside_dir(self): |
|
636 |
"""(versioned) Ensure --include is respected during recursive search.
|
|
637 |
"""
|
|
638 |
wd = 'foobar0' |
|
639 |
self.make_branch_and_tree(wd) |
|
640 |
os.chdir(wd) |
|
641 |
||
642 |
self._mk_versioned_dir('dir0') |
|
643 |
self._mk_versioned_file('dir0/file0.aa') |
|
644 |
||
645 |
self._mk_versioned_dir('dir1') |
|
646 |
self._mk_versioned_file('dir1/file1.bb') |
|
647 |
||
648 |
self._mk_versioned_dir('dir2') |
|
649 |
self._mk_versioned_file('dir2/file2.cc') |
|
650 |
||
651 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
652 |
'--include', '*.aa', '--include', '*.bb', 'l..e1']) |
0.40.105
by Parth Malwankar
fixed bug in ordering of user provided versions. |
653 |
self.assertContainsRe(out, "^dir0/file0.aa~.:line1$", flags=TestGrep._reflags) |
654 |
self.assertContainsRe(out, "^dir1/file1.bb~.:line1$", flags=TestGrep._reflags) |
|
655 |
self.assertContainsRe(out, "^dir0/file0.aa~.:line10$", flags=TestGrep._reflags) |
|
656 |
self.assertContainsRe(out, "^dir1/file1.bb~.:line10$", flags=TestGrep._reflags) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
657 |
self.assertNotContainsRe(out, "file1.cc", flags=TestGrep._reflags) |
0.40.105
by Parth Malwankar
fixed bug in ordering of user provided versions. |
658 |
# finds line1 and line10
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
659 |
self.assertEqual(len(out.splitlines()), 4) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
660 |
|
661 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
662 |
'--include', '*.aa', '--include', '*.bb', 'line1']) |
0.40.105
by Parth Malwankar
fixed bug in ordering of user provided versions. |
663 |
self.assertContainsRe(out, "^dir0/file0.aa~.:line1$", flags=TestGrep._reflags) |
664 |
self.assertContainsRe(out, "^dir1/file1.bb~.:line1$", flags=TestGrep._reflags) |
|
665 |
self.assertContainsRe(out, "^dir0/file0.aa~.:line10$", flags=TestGrep._reflags) |
|
666 |
self.assertContainsRe(out, "^dir1/file1.bb~.:line10$", flags=TestGrep._reflags) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
667 |
self.assertNotContainsRe(out, "file1.cc", flags=TestGrep._reflags) |
0.40.105
by Parth Malwankar
fixed bug in ordering of user provided versions. |
668 |
# finds line1 and line10
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
669 |
self.assertEqual(len(out.splitlines()), 4) |
0.41.23
by Parth Malwankar
added tests for --include/exclude |
670 |
|
671 |
def test_wtree_include_from_outside_dir(self): |
|
672 |
"""(wtree) Ensure --include is respected during recursive search.
|
|
673 |
"""
|
|
674 |
wd = 'foobar0' |
|
675 |
self.make_branch_and_tree(wd) |
|
676 |
os.chdir(wd) |
|
677 |
||
678 |
self._mk_versioned_dir('dir0') |
|
679 |
self._mk_versioned_file('dir0/file0.aa') |
|
680 |
||
681 |
self._mk_versioned_dir('dir1') |
|
682 |
self._mk_versioned_file('dir1/file1.bb') |
|
683 |
||
684 |
self._mk_versioned_dir('dir2') |
|
685 |
self._mk_versioned_file('dir2/file2.cc') |
|
686 |
||
687 |
out, err = self.run_bzr(['grep', '--include', '*.aa', |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
688 |
'--include', '*.bb', 'l.n.1']) |
0.40.105
by Parth Malwankar
fixed bug in ordering of user provided versions. |
689 |
self.assertContainsRe(out, "^dir0/file0.aa:line1$", flags=TestGrep._reflags) |
690 |
self.assertContainsRe(out, "^dir1/file1.bb:line1$", flags=TestGrep._reflags) |
|
691 |
self.assertContainsRe(out, "^dir0/file0.aa:line10$", flags=TestGrep._reflags) |
|
692 |
self.assertContainsRe(out, "^dir1/file1.bb:line10$", flags=TestGrep._reflags) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
693 |
self.assertNotContainsRe(out, "file1.cc", flags=TestGrep._reflags) |
0.40.105
by Parth Malwankar
fixed bug in ordering of user provided versions. |
694 |
# finds line1 and line10
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
695 |
self.assertEqual(len(out.splitlines()), 4) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
696 |
|
697 |
out, err = self.run_bzr(['grep', '--include', '*.aa', |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
698 |
'--include', '*.bb', 'line1']) |
0.40.105
by Parth Malwankar
fixed bug in ordering of user provided versions. |
699 |
self.assertContainsRe(out, "^dir0/file0.aa:line1$", flags=TestGrep._reflags) |
700 |
self.assertContainsRe(out, "^dir1/file1.bb:line1$", flags=TestGrep._reflags) |
|
701 |
self.assertContainsRe(out, "^dir0/file0.aa:line10$", flags=TestGrep._reflags) |
|
702 |
self.assertContainsRe(out, "^dir1/file1.bb:line10$", flags=TestGrep._reflags) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
703 |
self.assertNotContainsRe(out, "file1.cc", flags=TestGrep._reflags) |
0.40.105
by Parth Malwankar
fixed bug in ordering of user provided versions. |
704 |
# finds line1 and line10
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
705 |
self.assertEqual(len(out.splitlines()), 4) |
0.41.23
by Parth Malwankar
added tests for --include/exclude |
706 |
|
707 |
def test_versioned_exclude_from_outside_dir(self): |
|
708 |
"""(versioned) Ensure --exclude is respected during recursive search.
|
|
709 |
"""
|
|
710 |
wd = 'foobar0' |
|
711 |
self.make_branch_and_tree(wd) |
|
712 |
os.chdir(wd) |
|
713 |
||
714 |
self._mk_versioned_dir('dir0') |
|
715 |
self._mk_versioned_file('dir0/file0.aa') |
|
716 |
||
717 |
self._mk_versioned_dir('dir1') |
|
718 |
self._mk_versioned_file('dir1/file1.bb') |
|
719 |
||
720 |
self._mk_versioned_dir('dir2') |
|
721 |
self._mk_versioned_file('dir2/file2.cc') |
|
722 |
||
723 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
724 |
'--exclude', '*.cc', 'l..e1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
725 |
self.assertContainsRe(out, "^dir0/file0.aa~.:line1", flags=TestGrep._reflags) |
726 |
self.assertContainsRe(out, "^dir1/file1.bb~.:line1", flags=TestGrep._reflags) |
|
727 |
self.assertNotContainsRe(out, "file1.cc", flags=TestGrep._reflags) |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
728 |
|
729 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
730 |
'--exclude', '*.cc', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
731 |
self.assertContainsRe(out, "^dir0/file0.aa~.:line1", flags=TestGrep._reflags) |
732 |
self.assertContainsRe(out, "^dir1/file1.bb~.:line1", flags=TestGrep._reflags) |
|
733 |
self.assertNotContainsRe(out, "file1.cc", flags=TestGrep._reflags) |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
734 |
|
735 |
def test_wtree_exclude_from_outside_dir(self): |
|
736 |
"""(wtree) Ensure --exclude is respected during recursive search.
|
|
737 |
"""
|
|
738 |
wd = 'foobar0' |
|
739 |
self.make_branch_and_tree(wd) |
|
740 |
os.chdir(wd) |
|
741 |
||
742 |
self._mk_versioned_dir('dir0') |
|
743 |
self._mk_versioned_file('dir0/file0.aa') |
|
744 |
||
745 |
self._mk_versioned_dir('dir1') |
|
746 |
self._mk_versioned_file('dir1/file1.bb') |
|
747 |
||
748 |
self._mk_versioned_dir('dir2') |
|
749 |
self._mk_versioned_file('dir2/file2.cc') |
|
750 |
||
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
751 |
out, err = self.run_bzr(['grep', '--exclude', '*.cc', 'l[hijk]ne1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
752 |
self.assertContainsRe(out, "^dir0/file0.aa:line1", flags=TestGrep._reflags) |
753 |
self.assertContainsRe(out, "^dir1/file1.bb:line1", flags=TestGrep._reflags) |
|
754 |
self.assertNotContainsRe(out, "file1.cc", flags=TestGrep._reflags) |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
755 |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
756 |
out, err = self.run_bzr(['grep', '--exclude', '*.cc', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
757 |
self.assertContainsRe(out, "^dir0/file0.aa:line1", flags=TestGrep._reflags) |
758 |
self.assertContainsRe(out, "^dir1/file1.bb:line1", flags=TestGrep._reflags) |
|
759 |
self.assertNotContainsRe(out, "file1.cc", flags=TestGrep._reflags) |
|
0.41.23
by Parth Malwankar
added tests for --include/exclude |
760 |
|
761 |
def test_workingtree_files_from_outside_dir(self): |
|
0.41.17
by Parth Malwankar
added tests. |
762 |
"""(wtree) Grep for pattern with dirs passed as argument.
|
763 |
"""
|
|
0.40.41
by Parth Malwankar
added test for dir arg provided by user |
764 |
wd = 'foobar0' |
765 |
self.make_branch_and_tree(wd) |
|
766 |
os.chdir(wd) |
|
767 |
||
768 |
self._mk_versioned_dir('dir0') |
|
769 |
self._mk_versioned_file('dir0/file0.txt') |
|
770 |
||
771 |
self._mk_versioned_dir('dir1') |
|
772 |
self._mk_versioned_file('dir1/file1.txt') |
|
773 |
||
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
774 |
out, err = self.run_bzr(['grep', 'l[aeiou]ne1', 'dir0', 'dir1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
775 |
self.assertContainsRe(out, "^dir0/file0.txt:line1", flags=TestGrep._reflags) |
776 |
self.assertContainsRe(out, "^dir1/file1.txt:line1", flags=TestGrep._reflags) |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
777 |
|
0.40.41
by Parth Malwankar
added test for dir arg provided by user |
778 |
out, err = self.run_bzr(['grep', 'line1', 'dir0', 'dir1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
779 |
self.assertContainsRe(out, "^dir0/file0.txt:line1", flags=TestGrep._reflags) |
780 |
self.assertContainsRe(out, "^dir1/file1.txt:line1", flags=TestGrep._reflags) |
|
0.40.44
by Parth Malwankar
improved display of path when dir is given as argument |
781 |
|
0.40.45
by Parth Malwankar
fixed case where only revno:0 is present. added test. |
782 |
def test_versioned_files_from_outside_dir(self): |
0.41.17
by Parth Malwankar
added tests. |
783 |
"""(versioned) Grep for pattern with dirs passed as argument.
|
784 |
"""
|
|
785 |
wd = 'foobar0' |
|
786 |
self.make_branch_and_tree(wd) |
|
787 |
os.chdir(wd) |
|
788 |
||
789 |
self._mk_versioned_dir('dir0') |
|
790 |
self._mk_versioned_file('dir0/file0.txt') |
|
791 |
||
792 |
self._mk_versioned_dir('dir1') |
|
793 |
self._mk_versioned_file('dir1/file1.txt') |
|
794 |
||
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
795 |
out, err = self.run_bzr(['grep', '-r', 'last:1', '.ine1', 'dir0', 'dir1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
796 |
self.assertContainsRe(out, "^dir0/file0.txt~.:line1", flags=TestGrep._reflags) |
797 |
self.assertContainsRe(out, "^dir1/file1.txt~.:line1", flags=TestGrep._reflags) |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
798 |
|
0.41.17
by Parth Malwankar
added tests. |
799 |
out, err = self.run_bzr(['grep', '-r', 'last:1', 'line1', 'dir0', 'dir1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
800 |
self.assertContainsRe(out, "^dir0/file0.txt~.:line1", flags=TestGrep._reflags) |
801 |
self.assertContainsRe(out, "^dir1/file1.txt~.:line1", flags=TestGrep._reflags) |
|
0.41.17
by Parth Malwankar
added tests. |
802 |
|
803 |
def test_wtree_files_from_outside_dir(self): |
|
804 |
"""(wtree) Grep for pattern with dirs passed as argument.
|
|
805 |
"""
|
|
0.40.45
by Parth Malwankar
fixed case where only revno:0 is present. added test. |
806 |
wd = 'foobar0' |
807 |
self.make_branch_and_tree(wd) |
|
808 |
os.chdir(wd) |
|
809 |
||
810 |
self._mk_versioned_dir('dir0') |
|
811 |
self._mk_versioned_file('dir0/file0.txt') |
|
812 |
||
813 |
self._mk_versioned_dir('dir1') |
|
814 |
self._mk_versioned_file('dir1/file1.txt') |
|
815 |
||
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
816 |
out, err = self.run_bzr(['grep', 'li.e1', 'dir0', 'dir1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
817 |
self.assertContainsRe(out, "^dir0/file0.txt:line1", flags=TestGrep._reflags) |
818 |
self.assertContainsRe(out, "^dir1/file1.txt:line1", flags=TestGrep._reflags) |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
819 |
|
0.40.45
by Parth Malwankar
fixed case where only revno:0 is present. added test. |
820 |
out, err = self.run_bzr(['grep', 'line1', 'dir0', 'dir1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
821 |
self.assertContainsRe(out, "^dir0/file0.txt:line1", flags=TestGrep._reflags) |
822 |
self.assertContainsRe(out, "^dir1/file1.txt:line1", flags=TestGrep._reflags) |
|
0.40.44
by Parth Malwankar
improved display of path when dir is given as argument |
823 |
|
824 |
def test_versioned_files_from_outside_two_dirs(self): |
|
0.41.17
by Parth Malwankar
added tests. |
825 |
"""(versioned) Grep for pattern with two levels of nested dir.
|
826 |
"""
|
|
827 |
wd = 'foobar0' |
|
828 |
self.make_branch_and_tree(wd) |
|
829 |
os.chdir(wd) |
|
830 |
||
831 |
self._mk_versioned_dir('dir0') |
|
832 |
self._mk_versioned_file('dir0/file0.txt') |
|
833 |
||
834 |
self._mk_versioned_dir('dir1') |
|
835 |
self._mk_versioned_file('dir1/file1.txt') |
|
836 |
||
837 |
self._mk_versioned_dir('dir0/dir00') |
|
838 |
self._mk_versioned_file('dir0/dir00/file0.txt') |
|
839 |
||
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
840 |
out, err = self.run_bzr(['grep', '-r', 'last:1', 'l.ne1', 'dir0/dir00']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
841 |
self.assertContainsRe(out, "^dir0/dir00/file0.txt~.:line1", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
842 |
|
843 |
out, err = self.run_bzr(['grep', '-r', 'last:1', 'l.ne1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
844 |
self.assertContainsRe(out, "^dir0/dir00/file0.txt~.:line1", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
845 |
|
0.41.17
by Parth Malwankar
added tests. |
846 |
out, err = self.run_bzr(['grep', '-r', 'last:1', 'line1', 'dir0/dir00']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
847 |
self.assertContainsRe(out, "^dir0/dir00/file0.txt~.:line1", flags=TestGrep._reflags) |
0.41.17
by Parth Malwankar
added tests. |
848 |
|
849 |
out, err = self.run_bzr(['grep', '-r', 'last:1', 'line1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
850 |
self.assertContainsRe(out, "^dir0/dir00/file0.txt~.:line1", flags=TestGrep._reflags) |
0.41.17
by Parth Malwankar
added tests. |
851 |
|
852 |
def test_wtree_files_from_outside_two_dirs(self): |
|
853 |
"""(wtree) Grep for pattern with two levels of nested dir.
|
|
854 |
"""
|
|
0.40.44
by Parth Malwankar
improved display of path when dir is given as argument |
855 |
wd = 'foobar0' |
856 |
self.make_branch_and_tree(wd) |
|
857 |
os.chdir(wd) |
|
858 |
||
859 |
self._mk_versioned_dir('dir0') |
|
860 |
self._mk_versioned_file('dir0/file0.txt') |
|
861 |
||
862 |
self._mk_versioned_dir('dir1') |
|
863 |
self._mk_versioned_file('dir1/file1.txt') |
|
864 |
||
865 |
self._mk_versioned_dir('dir0/dir00') |
|
866 |
self._mk_versioned_file('dir0/dir00/file0.txt') |
|
867 |
||
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
868 |
out, err = self.run_bzr(['grep', 'lin.1', 'dir0/dir00']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
869 |
self.assertContainsRe(out, "^dir0/dir00/file0.txt:line1", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
870 |
|
871 |
out, err = self.run_bzr(['grep', 'li.e1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
872 |
self.assertContainsRe(out, "^dir0/dir00/file0.txt:line1", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
873 |
|
0.40.44
by Parth Malwankar
improved display of path when dir is given as argument |
874 |
out, err = self.run_bzr(['grep', 'line1', 'dir0/dir00']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
875 |
self.assertContainsRe(out, "^dir0/dir00/file0.txt:line1", flags=TestGrep._reflags) |
0.40.44
by Parth Malwankar
improved display of path when dir is given as argument |
876 |
|
0.41.4
by Parth Malwankar
--recurse is default. |
877 |
out, err = self.run_bzr(['grep', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
878 |
self.assertContainsRe(out, "^dir0/dir00/file0.txt:line1", flags=TestGrep._reflags) |
0.40.41
by Parth Malwankar
added test for dir arg provided by user |
879 |
|
0.40.25
by Parth Malwankar
added test case for multilevel dir. |
880 |
def test_versioned_file_within_dir_two_levels(self): |
0.41.17
by Parth Malwankar
added tests. |
881 |
"""(versioned) Search for pattern while in nested dir (two levels).
|
882 |
"""
|
|
883 |
wd = 'foobar0' |
|
884 |
self.make_branch_and_tree(wd) |
|
885 |
os.chdir(wd) |
|
886 |
self._mk_versioned_dir('dir0') |
|
887 |
self._mk_versioned_dir('dir0/dir1') |
|
888 |
self._mk_versioned_file('dir0/dir1/file0.txt') |
|
889 |
os.chdir('dir0') |
|
890 |
||
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
891 |
out, err = self.run_bzr(['grep', '-r', 'last:1', '.ine1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
892 |
self.assertContainsRe(out, "^dir1/file0.txt~.:line1", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
893 |
|
894 |
out, err = self.run_bzr(['grep', '-r', 'last:1', '--from-root', 'l.ne1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
895 |
self.assertContainsRe(out, "^dir0/dir1/file0.txt~.:line1", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
896 |
|
897 |
out, err = self.run_bzr(['grep', '-r', 'last:1', '--no-recursive', 'line1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
898 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
899 |
|
900 |
out, err = self.run_bzr(['grep', '-r', 'last:1', 'lin.1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
901 |
self.assertContainsRe(out, "^dir1/file0.txt~.:line1", flags=TestGrep._reflags) |
0.41.17
by Parth Malwankar
added tests. |
902 |
|
903 |
out, err = self.run_bzr(['grep', '-r', 'last:1', '--from-root', 'line1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
904 |
self.assertContainsRe(out, "^dir0/dir1/file0.txt~.:line1", flags=TestGrep._reflags) |
0.41.17
by Parth Malwankar
added tests. |
905 |
|
906 |
out, err = self.run_bzr(['grep', '-r', 'last:1', '--no-recursive', 'line1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
907 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
908 |
self.assertEqual(len(out.splitlines()), 0) |
0.41.17
by Parth Malwankar
added tests. |
909 |
|
910 |
def test_wtree_file_within_dir_two_levels(self): |
|
911 |
"""(wtree) Search for pattern while in nested dir (two levels).
|
|
912 |
"""
|
|
0.40.25
by Parth Malwankar
added test case for multilevel dir. |
913 |
wd = 'foobar0' |
914 |
self.make_branch_and_tree(wd) |
|
915 |
os.chdir(wd) |
|
916 |
self._mk_versioned_dir('dir0') |
|
917 |
self._mk_versioned_dir('dir0/dir1') |
|
918 |
self._mk_versioned_file('dir0/dir1/file0.txt') |
|
919 |
os.chdir('dir0') |
|
0.41.4
by Parth Malwankar
--recurse is default. |
920 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
921 |
out, err = self.run_bzr(['grep', 'l[hij]ne1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
922 |
self.assertContainsRe(out, "^dir1/file0.txt:line1", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
923 |
|
924 |
out, err = self.run_bzr(['grep', '--from-root', 'l.ne1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
925 |
self.assertContainsRe(out, "^dir0/dir1/file0.txt:line1", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
926 |
|
927 |
out, err = self.run_bzr(['grep', '--no-recursive', 'lin.1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
928 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
929 |
|
0.41.4
by Parth Malwankar
--recurse is default. |
930 |
out, err = self.run_bzr(['grep', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
931 |
self.assertContainsRe(out, "^dir1/file0.txt:line1", flags=TestGrep._reflags) |
0.41.4
by Parth Malwankar
--recurse is default. |
932 |
|
0.40.25
by Parth Malwankar
added test case for multilevel dir. |
933 |
out, err = self.run_bzr(['grep', '--from-root', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
934 |
self.assertContainsRe(out, "^dir0/dir1/file0.txt:line1", flags=TestGrep._reflags) |
0.41.4
by Parth Malwankar
--recurse is default. |
935 |
|
0.41.6
by Parth Malwankar
renamed --recurse/--no-recurse => --recursive/--no-recursive |
936 |
out, err = self.run_bzr(['grep', '--no-recursive', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
937 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
0.40.25
by Parth Malwankar
added test case for multilevel dir. |
938 |
|
0.41.17
by Parth Malwankar
added tests. |
939 |
def test_versioned_ignore_case_no_match(self): |
940 |
"""(versioned) Match fails without --ignore-case.
|
|
941 |
"""
|
|
942 |
wd = 'foobar0' |
|
943 |
self.make_branch_and_tree(wd) |
|
944 |
os.chdir(wd) |
|
945 |
self._mk_versioned_file('file0.txt') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
946 |
|
0.41.17
by Parth Malwankar
added tests. |
947 |
out, err = self.run_bzr(['grep', '-r', 'last:1', 'LinE1', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
948 |
self.assertNotContainsRe(out, "file0.txt~.:line1", flags=TestGrep._reflags) |
0.41.17
by Parth Malwankar
added tests. |
949 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
950 |
out, err = self.run_bzr(['grep', '-r', 'last:1', 'Li.E1', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
951 |
self.assertNotContainsRe(out, "file0.txt~.:line1", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
952 |
|
0.41.17
by Parth Malwankar
added tests. |
953 |
def test_wtree_ignore_case_no_match(self): |
954 |
"""(wtree) Match fails without --ignore-case.
|
|
955 |
"""
|
|
0.40.13
by Parth Malwankar
added tests for -R and -i |
956 |
wd = 'foobar0' |
957 |
self.make_branch_and_tree(wd) |
|
958 |
os.chdir(wd) |
|
959 |
self._mk_versioned_file('file0.txt') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
960 |
|
0.40.13
by Parth Malwankar
added tests for -R and -i |
961 |
out, err = self.run_bzr(['grep', 'LinE1', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
962 |
self.assertNotContainsRe(out, "file0.txt:line1", flags=TestGrep._reflags) |
0.40.13
by Parth Malwankar
added tests for -R and -i |
963 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
964 |
out, err = self.run_bzr(['grep', '.inE1', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
965 |
self.assertNotContainsRe(out, "file0.txt:line1", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
966 |
|
0.41.17
by Parth Malwankar
added tests. |
967 |
def test_versioned_ignore_case_match(self): |
968 |
"""(versioned) Match fails without --ignore-case.
|
|
969 |
"""
|
|
970 |
wd = 'foobar0' |
|
971 |
self.make_branch_and_tree(wd) |
|
972 |
os.chdir(wd) |
|
973 |
self._mk_versioned_file('file0.txt') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
974 |
|
975 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
|
976 |
'-i', 'Li.E1', 'file0.txt']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
977 |
self.assertContainsRe(out, "file0.txt~.:line1", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
978 |
|
0.41.17
by Parth Malwankar
added tests. |
979 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
980 |
'-i', 'LinE1', 'file0.txt']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
981 |
self.assertContainsRe(out, "file0.txt~.:line1", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
982 |
|
0.41.17
by Parth Malwankar
added tests. |
983 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
984 |
'--ignore-case', 'LinE1', 'file0.txt']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
985 |
self.assertContainsRe(out, "^file0.txt~.:line1", flags=TestGrep._reflags) |
0.41.17
by Parth Malwankar
added tests. |
986 |
|
987 |
def test_wtree_ignore_case_match(self): |
|
988 |
"""(wtree) Match fails without --ignore-case.
|
|
989 |
"""
|
|
0.40.13
by Parth Malwankar
added tests for -R and -i |
990 |
wd = 'foobar0' |
991 |
self.make_branch_and_tree(wd) |
|
992 |
os.chdir(wd) |
|
993 |
self._mk_versioned_file('file0.txt') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
994 |
|
0.40.13
by Parth Malwankar
added tests for -R and -i |
995 |
out, err = self.run_bzr(['grep', '-i', 'LinE1', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
996 |
self.assertContainsRe(out, "file0.txt:line1", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
997 |
|
0.40.24
by Parth Malwankar
added support for --line-number. |
998 |
out, err = self.run_bzr(['grep', '--ignore-case', 'LinE1', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
999 |
self.assertContainsRe(out, "^file0.txt:line1", flags=TestGrep._reflags) |
0.40.13
by Parth Malwankar
added tests for -R and -i |
1000 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1001 |
out, err = self.run_bzr(['grep', '--ignore-case', 'Li.E1', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1002 |
self.assertContainsRe(out, "^file0.txt:line1", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1003 |
|
0.41.17
by Parth Malwankar
added tests. |
1004 |
def test_versioned_from_root_fail(self): |
1005 |
"""(versioned) Match should fail without --from-root.
|
|
1006 |
"""
|
|
1007 |
wd = 'foobar0' |
|
1008 |
self.make_branch_and_tree(wd) |
|
1009 |
os.chdir(wd) |
|
1010 |
self._mk_versioned_file('file0.txt') |
|
1011 |
self._mk_versioned_dir('dir0') |
|
1012 |
os.chdir('dir0') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1013 |
|
1014 |
out, err = self.run_bzr(['grep', '-r', 'last:1', 'li.e1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1015 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1016 |
|
0.41.17
by Parth Malwankar
added tests. |
1017 |
out, err = self.run_bzr(['grep', '-r', 'last:1', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1018 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
0.41.17
by Parth Malwankar
added tests. |
1019 |
|
1020 |
def test_wtree_from_root_fail(self): |
|
1021 |
"""(wtree) Match should fail without --from-root.
|
|
1022 |
"""
|
|
0.40.14
by Parth Malwankar
added test for --from-root |
1023 |
wd = 'foobar0' |
1024 |
self.make_branch_and_tree(wd) |
|
1025 |
os.chdir(wd) |
|
1026 |
self._mk_versioned_file('file0.txt') |
|
1027 |
self._mk_versioned_dir('dir0') |
|
1028 |
os.chdir('dir0') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1029 |
|
0.40.14
by Parth Malwankar
added test for --from-root |
1030 |
out, err = self.run_bzr(['grep', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1031 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
0.41.17
by Parth Malwankar
added tests. |
1032 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1033 |
out, err = self.run_bzr(['grep', 'li.e1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1034 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1035 |
|
0.41.17
by Parth Malwankar
added tests. |
1036 |
def test_versioned_from_root_pass(self): |
1037 |
"""(versioned) Match pass with --from-root.
|
|
1038 |
"""
|
|
1039 |
wd = 'foobar0' |
|
1040 |
self.make_branch_and_tree(wd) |
|
1041 |
os.chdir(wd) |
|
1042 |
self._mk_versioned_file('file0.txt') |
|
1043 |
self._mk_versioned_dir('dir0') |
|
1044 |
os.chdir('dir0') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1045 |
|
1046 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
|
1047 |
'--from-root', 'l.ne1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1048 |
self.assertContainsRe(out, "file0.txt~.:line1", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1049 |
|
0.41.17
by Parth Malwankar
added tests. |
1050 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
1051 |
'--from-root', 'line1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1052 |
self.assertContainsRe(out, "file0.txt~.:line1", flags=TestGrep._reflags) |
0.41.17
by Parth Malwankar
added tests. |
1053 |
|
1054 |
def test_wtree_from_root_pass(self): |
|
1055 |
"""(wtree) Match pass with --from-root.
|
|
1056 |
"""
|
|
0.40.14
by Parth Malwankar
added test for --from-root |
1057 |
wd = 'foobar0' |
1058 |
self.make_branch_and_tree(wd) |
|
1059 |
os.chdir(wd) |
|
1060 |
self._mk_versioned_file('file0.txt') |
|
1061 |
self._mk_versioned_dir('dir0') |
|
1062 |
os.chdir('dir0') |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1063 |
|
1064 |
out, err = self.run_bzr(['grep', '--from-root', 'lin.1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1065 |
self.assertContainsRe(out, "file0.txt:line1", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1066 |
|
0.40.14
by Parth Malwankar
added test for --from-root |
1067 |
out, err = self.run_bzr(['grep', '--from-root', 'line1']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1068 |
self.assertContainsRe(out, "file0.txt:line1", flags=TestGrep._reflags) |
0.41.17
by Parth Malwankar
added tests. |
1069 |
|
1070 |
def test_versioned_with_line_number(self): |
|
1071 |
"""(versioned) Search for pattern with --line-number.
|
|
1072 |
"""
|
|
1073 |
wd = 'foobar0' |
|
1074 |
self.make_branch_and_tree(wd) |
|
1075 |
os.chdir(wd) |
|
1076 |
self._mk_versioned_file('file0.txt') |
|
1077 |
||
1078 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1079 |
'--line-number', 'li.e3', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1080 |
self.assertContainsRe(out, "file0.txt~.:3:line3", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1081 |
|
1082 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
|
0.41.17
by Parth Malwankar
added tests. |
1083 |
'--line-number', 'line3', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1084 |
self.assertContainsRe(out, "file0.txt~.:3:line3", flags=TestGrep._reflags) |
0.41.17
by Parth Malwankar
added tests. |
1085 |
|
1086 |
out, err = self.run_bzr(['grep', '-r', 'last:1', |
|
1087 |
'-n', 'line1', 'file0.txt']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1088 |
self.assertContainsRe(out, "file0.txt~.:1:line1", flags=TestGrep._reflags) |
0.41.17
by Parth Malwankar
added tests. |
1089 |
|
0.47.3
by Martin
Fix previously untested bug with regexp and line numbers introduced by optimisation |
1090 |
out, err = self.run_bzr(['grep', '-n', 'line[0-9]', 'file0.txt']) |
1091 |
self.assertContainsRe(out, "file0.txt:3:line3", flags=TestGrep._reflags) |
|
1092 |
||
0.41.17
by Parth Malwankar
added tests. |
1093 |
def test_wtree_with_line_number(self): |
1094 |
"""(wtree) Search for pattern with --line-number.
|
|
1095 |
"""
|
|
0.40.24
by Parth Malwankar
added support for --line-number. |
1096 |
wd = 'foobar0' |
1097 |
self.make_branch_and_tree(wd) |
|
1098 |
os.chdir(wd) |
|
1099 |
self._mk_versioned_file('file0.txt') |
|
0.40.35
by Parth Malwankar
fixed asserts and added test for revno based grep |
1100 |
|
0.40.24
by Parth Malwankar
added support for --line-number. |
1101 |
out, err = self.run_bzr(['grep', '--line-number', 'line3', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1102 |
self.assertContainsRe(out, "file0.txt:3:line3", flags=TestGrep._reflags) |
0.40.35
by Parth Malwankar
fixed asserts and added test for revno based grep |
1103 |
|
0.40.24
by Parth Malwankar
added support for --line-number. |
1104 |
out, err = self.run_bzr(['grep', '-n', 'line1', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1105 |
self.assertContainsRe(out, "file0.txt:1:line1", flags=TestGrep._reflags) |
0.40.14
by Parth Malwankar
added test for --from-root |
1106 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1107 |
out, err = self.run_bzr(['grep', '-n', '[hjkl]ine1', 'file0.txt']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1108 |
self.assertContainsRe(out, "file0.txt:1:line1", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1109 |
|
0.47.3
by Martin
Fix previously untested bug with regexp and line numbers introduced by optimisation |
1110 |
out, err = self.run_bzr(['grep', '-n', 'line[0-9]', 'file0.txt']) |
1111 |
self.assertContainsRe(out, "file0.txt:3:line3", flags=TestGrep._reflags) |
|
1112 |
||
0.40.35
by Parth Malwankar
fixed asserts and added test for revno based grep |
1113 |
def test_revno_basic_history_grep_file(self): |
0.41.17
by Parth Malwankar
added tests. |
1114 |
"""Search for pattern in specific revision number in a file.
|
1115 |
"""
|
|
0.40.34
by Parth Malwankar
added tests for single revision history search |
1116 |
wd = 'foobar0' |
1117 |
fname = 'file0.txt' |
|
1118 |
self.make_branch_and_tree(wd) |
|
1119 |
os.chdir(wd) |
|
0.40.35
by Parth Malwankar
fixed asserts and added test for revno based grep |
1120 |
self._mk_versioned_file(fname, total_lines=0) |
0.40.34
by Parth Malwankar
added tests for single revision history search |
1121 |
self._update_file(fname, text="v2 text\n") |
1122 |
self._update_file(fname, text="v3 text\n") |
|
1123 |
self._update_file(fname, text="v4 text\n") |
|
1124 |
||
1125 |
# rev 2 should not have text 'v3'
|
|
1126 |
out, err = self.run_bzr(['grep', '-r', '2', 'v3', fname]) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1127 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
0.40.34
by Parth Malwankar
added tests for single revision history search |
1128 |
|
1129 |
# rev 3 should not have text 'v3'
|
|
1130 |
out, err = self.run_bzr(['grep', '-r', '3', 'v3', fname]) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1131 |
self.assertContainsRe(out, "file0.txt~3:v3.*", flags=TestGrep._reflags) |
0.40.34
by Parth Malwankar
added tests for single revision history search |
1132 |
|
1133 |
# rev 3 should not have text 'v3' with line number
|
|
1134 |
out, err = self.run_bzr(['grep', '-r', '3', '-n', 'v3', fname]) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1135 |
self.assertContainsRe(out, "file0.txt~3:2:v3.*", flags=TestGrep._reflags) |
0.40.34
by Parth Malwankar
added tests for single revision history search |
1136 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1137 |
# rev 2 should not have text 'v3'
|
1138 |
out, err = self.run_bzr(['grep', '-r', '2', '[tuv]3', fname]) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1139 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1140 |
|
1141 |
# rev 3 should not have text 'v3'
|
|
1142 |
out, err = self.run_bzr(['grep', '-r', '3', '[tuv]3', fname]) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1143 |
self.assertContainsRe(out, "file0.txt~3:v3.*", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1144 |
|
1145 |
# rev 3 should not have text 'v3' with line number
|
|
1146 |
out, err = self.run_bzr(['grep', '-r', '3', '-n', '[tuv]3', fname]) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1147 |
self.assertContainsRe(out, "file0.txt~3:2:v3.*", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1148 |
|
0.40.35
by Parth Malwankar
fixed asserts and added test for revno based grep |
1149 |
def test_revno_basic_history_grep_full(self): |
0.41.17
by Parth Malwankar
added tests. |
1150 |
"""Search for pattern in specific revision number in a file.
|
1151 |
"""
|
|
0.40.34
by Parth Malwankar
added tests for single revision history search |
1152 |
wd = 'foobar0' |
1153 |
fname = 'file0.txt' |
|
1154 |
self.make_branch_and_tree(wd) |
|
1155 |
os.chdir(wd) |
|
0.40.35
by Parth Malwankar
fixed asserts and added test for revno based grep |
1156 |
self._mk_versioned_file(fname, total_lines=0) # rev1 |
1157 |
self._mk_versioned_file('file1.txt') # rev2 |
|
1158 |
self._update_file(fname, text="v3 text\n") # rev3 |
|
1159 |
self._update_file(fname, text="v4 text\n") # rev4 |
|
1160 |
self._update_file(fname, text="v5 text\n") # rev5 |
|
0.40.34
by Parth Malwankar
added tests for single revision history search |
1161 |
|
1162 |
# rev 2 should not have text 'v3'
|
|
1163 |
out, err = self.run_bzr(['grep', '-r', '2', 'v3']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1164 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
0.40.34
by Parth Malwankar
added tests for single revision history search |
1165 |
|
1166 |
# rev 3 should not have text 'v3'
|
|
1167 |
out, err = self.run_bzr(['grep', '-r', '3', 'v3']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1168 |
self.assertContainsRe(out, "file0.txt~3:v3", flags=TestGrep._reflags) |
0.40.34
by Parth Malwankar
added tests for single revision history search |
1169 |
|
1170 |
# rev 3 should not have text 'v3' with line number
|
|
1171 |
out, err = self.run_bzr(['grep', '-r', '3', '-n', 'v3']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1172 |
self.assertContainsRe(out, "file0.txt~3:1:v3", flags=TestGrep._reflags) |
0.40.35
by Parth Malwankar
fixed asserts and added test for revno based grep |
1173 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1174 |
# rev 2 should not have text 'v3'
|
1175 |
out, err = self.run_bzr(['grep', '-r', '2', '[tuv]3']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1176 |
self.assertNotContainsRe(out, "file0.txt", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1177 |
|
1178 |
# rev 3 should not have text 'v3'
|
|
1179 |
out, err = self.run_bzr(['grep', '-r', '3', '[tuv]3']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1180 |
self.assertContainsRe(out, "file0.txt~3:v3", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1181 |
|
1182 |
# rev 3 should not have text 'v3' with line number
|
|
1183 |
out, err = self.run_bzr(['grep', '-r', '3', '-n', '[tuv]3']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1184 |
self.assertContainsRe(out, "file0.txt~3:1:v3", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1185 |
|
0.40.35
by Parth Malwankar
fixed asserts and added test for revno based grep |
1186 |
def test_revno_versioned_file_in_dir(self): |
0.41.17
by Parth Malwankar
added tests. |
1187 |
"""Grep specific version of file withing dir.
|
1188 |
"""
|
|
0.40.35
by Parth Malwankar
fixed asserts and added test for revno based grep |
1189 |
wd = 'foobar0' |
1190 |
self.make_branch_and_tree(wd) |
|
1191 |
os.chdir(wd) |
|
1192 |
self._mk_versioned_dir('dir0') # rev1 |
|
1193 |
self._mk_versioned_file('dir0/file0.txt') # rev2 |
|
1194 |
self._update_file('dir0/file0.txt', "v3 text\n") # rev3 |
|
1195 |
self._update_file('dir0/file0.txt', "v4 text\n") # rev4 |
|
1196 |
self._update_file('dir0/file0.txt', "v5 text\n") # rev5 |
|
1197 |
||
1198 |
# v4 should not be present in revno 3
|
|
0.41.4
by Parth Malwankar
--recurse is default. |
1199 |
out, err = self.run_bzr(['grep', '-r', 'last:3', 'v4']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1200 |
self.assertNotContainsRe(out, "^dir0/file0.txt", flags=TestGrep._reflags) |
0.40.35
by Parth Malwankar
fixed asserts and added test for revno based grep |
1201 |
|
1202 |
# v4 should be present in revno 4
|
|
0.41.4
by Parth Malwankar
--recurse is default. |
1203 |
out, err = self.run_bzr(['grep', '-r', 'last:2', 'v4']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1204 |
self.assertContainsRe(out, "^dir0/file0.txt~4:v4", flags=TestGrep._reflags) |
0.40.35
by Parth Malwankar
fixed asserts and added test for revno based grep |
1205 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1206 |
# v4 should not be present in revno 3
|
1207 |
out, err = self.run_bzr(['grep', '-r', 'last:3', '[tuv]4']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1208 |
self.assertNotContainsRe(out, "^dir0/file0.txt", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1209 |
|
1210 |
# v4 should be present in revno 4
|
|
1211 |
out, err = self.run_bzr(['grep', '-r', 'last:2', '[tuv]4']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1212 |
self.assertContainsRe(out, "^dir0/file0.txt~4:v4", flags=TestGrep._reflags) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1213 |
|
0.40.38
by Parth Malwankar
added --levels options. added tests for range search. |
1214 |
def test_revno_range_basic_history_grep(self): |
0.41.17
by Parth Malwankar
added tests. |
1215 |
"""Search for pattern in revision range for file.
|
1216 |
"""
|
|
0.40.38
by Parth Malwankar
added --levels options. added tests for range search. |
1217 |
wd = 'foobar0' |
1218 |
fname = 'file0.txt' |
|
1219 |
self.make_branch_and_tree(wd) |
|
1220 |
os.chdir(wd) |
|
1221 |
self._mk_versioned_file(fname, total_lines=0) # rev1 |
|
1222 |
self._mk_versioned_file('file1.txt') # rev2 |
|
1223 |
self._update_file(fname, text="v3 text\n") # rev3 |
|
1224 |
self._update_file(fname, text="v4 text\n") # rev4 |
|
1225 |
self._update_file(fname, text="v5 text\n") # rev5 |
|
1226 |
self._update_file(fname, text="v6 text\n") # rev6 |
|
1227 |
||
1228 |
out, err = self.run_bzr(['grep', '-r', '1..', 'v3']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1229 |
self.assertContainsRe(out, "file0.txt~3:v3", flags=TestGrep._reflags) |
1230 |
self.assertContainsRe(out, "file0.txt~4:v3", flags=TestGrep._reflags) |
|
1231 |
self.assertContainsRe(out, "file0.txt~5:v3", flags=TestGrep._reflags) |
|
0.40.105
by Parth Malwankar
fixed bug in ordering of user provided versions. |
1232 |
self.assertContainsRe(out, "file0.txt~6:v3", flags=TestGrep._reflags) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1233 |
self.assertEqual(len(out.splitlines()), 4) |
0.40.38
by Parth Malwankar
added --levels options. added tests for range search. |
1234 |
|
0.40.106
by Parth Malwankar
fixed error in dotted rev reverse search. |
1235 |
out, err = self.run_bzr(['grep', '-r', '..1', 'v3']) |
1236 |
# searching only rev1 gives nothing
|
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1237 |
self.assertEqual(len(out.splitlines()), 0) |
0.40.106
by Parth Malwankar
fixed error in dotted rev reverse search. |
1238 |
|
1239 |
out, err = self.run_bzr(['grep', '-r', '..6', 'v3']) |
|
1240 |
self.assertContainsRe(out, "file0.txt~3:v3", flags=TestGrep._reflags) |
|
1241 |
self.assertContainsRe(out, "file0.txt~4:v3", flags=TestGrep._reflags) |
|
1242 |
self.assertContainsRe(out, "file0.txt~5:v3", flags=TestGrep._reflags) |
|
1243 |
self.assertContainsRe(out, "file0.txt~6:v3", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1244 |
self.assertEqual(len(out.splitlines()), 4) |
0.40.106
by Parth Malwankar
fixed error in dotted rev reverse search. |
1245 |
|
1246 |
out, err = self.run_bzr(['grep', '-r', '..', 'v3']) |
|
1247 |
self.assertContainsRe(out, "file0.txt~3:v3", flags=TestGrep._reflags) |
|
1248 |
self.assertContainsRe(out, "file0.txt~4:v3", flags=TestGrep._reflags) |
|
1249 |
self.assertContainsRe(out, "file0.txt~5:v3", flags=TestGrep._reflags) |
|
1250 |
self.assertContainsRe(out, "file0.txt~6:v3", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1251 |
self.assertEqual(len(out.splitlines()), 4) |
0.40.106
by Parth Malwankar
fixed error in dotted rev reverse search. |
1252 |
|
0.40.38
by Parth Malwankar
added --levels options. added tests for range search. |
1253 |
out, err = self.run_bzr(['grep', '-r', '1..5', 'v3']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1254 |
self.assertContainsRe(out, "file0.txt~3:v3", flags=TestGrep._reflags) |
1255 |
self.assertContainsRe(out, "file0.txt~4:v3", flags=TestGrep._reflags) |
|
1256 |
self.assertContainsRe(out, "file0.txt~5:v3", flags=TestGrep._reflags) |
|
1257 |
self.assertNotContainsRe(out, "file0.txt~6:v3", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1258 |
self.assertEqual(len(out.splitlines()), 3) |
0.40.38
by Parth Malwankar
added --levels options. added tests for range search. |
1259 |
|
0.40.106
by Parth Malwankar
fixed error in dotted rev reverse search. |
1260 |
out, err = self.run_bzr(['grep', '-r', '5..1', 'v3']) |
1261 |
self.assertContainsRe(out, "file0.txt~3:v3", flags=TestGrep._reflags) |
|
1262 |
self.assertContainsRe(out, "file0.txt~4:v3", flags=TestGrep._reflags) |
|
1263 |
self.assertContainsRe(out, "file0.txt~5:v3", flags=TestGrep._reflags) |
|
1264 |
self.assertNotContainsRe(out, "file0.txt~6:v3", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1265 |
self.assertEqual(len(out.splitlines()), 3) |
0.40.106
by Parth Malwankar
fixed error in dotted rev reverse search. |
1266 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1267 |
out, err = self.run_bzr(['grep', '-r', '1..', '[tuv]3']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1268 |
self.assertContainsRe(out, "file0.txt~3:v3", flags=TestGrep._reflags) |
1269 |
self.assertContainsRe(out, "file0.txt~4:v3", flags=TestGrep._reflags) |
|
1270 |
self.assertContainsRe(out, "file0.txt~5:v3", flags=TestGrep._reflags) |
|
0.40.105
by Parth Malwankar
fixed bug in ordering of user provided versions. |
1271 |
self.assertContainsRe(out, "file0.txt~6:v3", flags=TestGrep._reflags) |
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1272 |
self.assertEqual(len(out.splitlines()), 4) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1273 |
|
1274 |
out, err = self.run_bzr(['grep', '-r', '1..5', '[tuv]3']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1275 |
self.assertContainsRe(out, "file0.txt~3:v3", flags=TestGrep._reflags) |
1276 |
self.assertContainsRe(out, "file0.txt~4:v3", flags=TestGrep._reflags) |
|
1277 |
self.assertContainsRe(out, "file0.txt~5:v3", flags=TestGrep._reflags) |
|
1278 |
self.assertNotContainsRe(out, "file0.txt~6:v3", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1279 |
self.assertEqual(len(out.splitlines()), 3) |
0.40.105
by Parth Malwankar
fixed bug in ordering of user provided versions. |
1280 |
|
1281 |
out, err = self.run_bzr(['grep', '-r', '5..1', '[tuv]3']) |
|
1282 |
self.assertContainsRe(out, "file0.txt~3:v3", flags=TestGrep._reflags) |
|
1283 |
self.assertContainsRe(out, "file0.txt~4:v3", flags=TestGrep._reflags) |
|
1284 |
self.assertContainsRe(out, "file0.txt~5:v3", flags=TestGrep._reflags) |
|
1285 |
self.assertNotContainsRe(out, "file0.txt~6:v3", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1286 |
self.assertEqual(len(out.splitlines()), 3) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1287 |
|
0.40.38
by Parth Malwankar
added --levels options. added tests for range search. |
1288 |
def test_revno_range_versioned_file_in_dir(self): |
0.41.17
by Parth Malwankar
added tests. |
1289 |
"""Grep rev-range for pattern for file withing a dir.
|
1290 |
"""
|
|
0.40.38
by Parth Malwankar
added --levels options. added tests for range search. |
1291 |
wd = 'foobar0' |
1292 |
self.make_branch_and_tree(wd) |
|
1293 |
os.chdir(wd) |
|
1294 |
self._mk_versioned_dir('dir0') # rev1 |
|
1295 |
self._mk_versioned_file('dir0/file0.txt') # rev2 |
|
1296 |
self._update_file('dir0/file0.txt', "v3 text\n") # rev3 |
|
1297 |
self._update_file('dir0/file0.txt', "v4 text\n") # rev4 |
|
1298 |
self._update_file('dir0/file0.txt', "v5 text\n") # rev5 |
|
1299 |
self._update_file('dir0/file0.txt', "v6 text\n") # rev6 |
|
1300 |
||
0.41.4
by Parth Malwankar
--recurse is default. |
1301 |
out, err = self.run_bzr(['grep', '-r', '2..5', 'v3']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1302 |
self.assertContainsRe(out, "^dir0/file0.txt~3:v3", flags=TestGrep._reflags) |
1303 |
self.assertContainsRe(out, "^dir0/file0.txt~4:v3", flags=TestGrep._reflags) |
|
1304 |
self.assertContainsRe(out, "^dir0/file0.txt~5:v3", flags=TestGrep._reflags) |
|
1305 |
self.assertNotContainsRe(out, "^dir0/file0.txt~6:v3", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1306 |
self.assertEqual(len(out.splitlines()), 3) |
0.40.38
by Parth Malwankar
added --levels options. added tests for range search. |
1307 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1308 |
out, err = self.run_bzr(['grep', '-r', '2..5', '[tuv]3']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1309 |
self.assertContainsRe(out, "^dir0/file0.txt~3:v3", flags=TestGrep._reflags) |
1310 |
self.assertContainsRe(out, "^dir0/file0.txt~4:v3", flags=TestGrep._reflags) |
|
1311 |
self.assertContainsRe(out, "^dir0/file0.txt~5:v3", flags=TestGrep._reflags) |
|
1312 |
self.assertNotContainsRe(out, "^dir0/file0.txt~6:v3", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1313 |
self.assertEqual(len(out.splitlines()), 3) |
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1314 |
|
0.40.38
by Parth Malwankar
added --levels options. added tests for range search. |
1315 |
def test_revno_range_versioned_file_from_outside_dir(self): |
0.41.17
by Parth Malwankar
added tests. |
1316 |
"""Grep rev-range for pattern from outside dir.
|
1317 |
"""
|
|
0.40.38
by Parth Malwankar
added --levels options. added tests for range search. |
1318 |
wd = 'foobar0' |
1319 |
self.make_branch_and_tree(wd) |
|
1320 |
os.chdir(wd) |
|
1321 |
self._mk_versioned_dir('dir0') # rev1 |
|
1322 |
self._mk_versioned_file('dir0/file0.txt') # rev2 |
|
1323 |
self._update_file('dir0/file0.txt', "v3 text\n") # rev3 |
|
1324 |
self._update_file('dir0/file0.txt', "v4 text\n") # rev4 |
|
1325 |
self._update_file('dir0/file0.txt', "v5 text\n") # rev5 |
|
1326 |
self._update_file('dir0/file0.txt', "v6 text\n") # rev6 |
|
1327 |
||
1328 |
out, err = self.run_bzr(['grep', '-r', '2..5', 'v3', 'dir0']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1329 |
self.assertContainsRe(out, "^dir0/file0.txt~3:v3", flags=TestGrep._reflags) |
1330 |
self.assertContainsRe(out, "^dir0/file0.txt~4:v3", flags=TestGrep._reflags) |
|
1331 |
self.assertContainsRe(out, "^dir0/file0.txt~5:v3", flags=TestGrep._reflags) |
|
1332 |
self.assertNotContainsRe(out, "^dir0/file0.txt~6:v3", flags=TestGrep._reflags) |
|
0.40.13
by Parth Malwankar
added tests for -R and -i |
1333 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1334 |
out, err = self.run_bzr(['grep', '-r', '2..5', '[tuv]3', 'dir0']) |
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1335 |
self.assertContainsRe(out, "^dir0/file0.txt~3:v3", flags=TestGrep._reflags) |
1336 |
self.assertContainsRe(out, "^dir0/file0.txt~4:v3", flags=TestGrep._reflags) |
|
1337 |
self.assertContainsRe(out, "^dir0/file0.txt~5:v3", flags=TestGrep._reflags) |
|
1338 |
self.assertNotContainsRe(out, "^dir0/file0.txt~6:v3", flags=TestGrep._reflags) |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1339 |
|
0.40.46
by Parth Malwankar
--levels=0 now implicitly prints revnos. added test for --levels=0. |
1340 |
def test_levels(self): |
0.41.17
by Parth Malwankar
added tests. |
1341 |
"""--levels=0 should show findings from merged revision.
|
1342 |
"""
|
|
0.40.46
by Parth Malwankar
--levels=0 now implicitly prints revnos. added test for --levels=0. |
1343 |
wd0 = 'foobar0' |
1344 |
wd1 = 'foobar1' |
|
1345 |
||
1346 |
self.make_branch_and_tree(wd0) |
|
1347 |
os.chdir(wd0) |
|
1348 |
self._mk_versioned_file('file0.txt') |
|
1349 |
os.chdir('..') |
|
1350 |
||
1351 |
out, err = self.run_bzr(['branch', wd0, wd1]) |
|
1352 |
os.chdir(wd1) |
|
1353 |
self._mk_versioned_file('file1.txt') |
|
1354 |
os.chdir(osutils.pathjoin('..', wd0)) |
|
1355 |
||
1356 |
out, err = self.run_bzr(['merge', osutils.pathjoin('..', wd1)]) |
|
1357 |
out, err = self.run_bzr(['ci', '-m', 'merged']) |
|
1358 |
||
1359 |
out, err = self.run_bzr(['grep', 'line1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1360 |
self.assertContainsRe(out, "file0.txt:line1", flags=TestGrep._reflags) |
1361 |
self.assertContainsRe(out, "file1.txt:line1", flags=TestGrep._reflags) |
|
0.40.46
by Parth Malwankar
--levels=0 now implicitly prints revnos. added test for --levels=0. |
1362 |
|
0.41.17
by Parth Malwankar
added tests. |
1363 |
# levels should be ignored by wtree grep
|
1364 |
out, err = self.run_bzr(['grep', '--levels=0', 'line1']) |
|
0.40.108
by Parth Malwankar
made tests more accurate |
1365 |
self.assertContainsRe(out, "^file0.txt:line1$", flags=TestGrep._reflags) |
1366 |
self.assertContainsRe(out, "^file1.txt:line1$", flags=TestGrep._reflags) |
|
1367 |
self.assertContainsRe(out, "^file0.txt:line10$", flags=TestGrep._reflags) |
|
1368 |
self.assertContainsRe(out, "^file1.txt:line10$", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1369 |
self.assertEqual(len(out.splitlines()), 4) |
0.41.17
by Parth Malwankar
added tests. |
1370 |
|
0.40.77
by Parth Malwankar
fixed test case. |
1371 |
out, err = self.run_bzr(['grep', '-r', 'last:1..', '--levels=0', 'line1']) |
0.40.108
by Parth Malwankar
made tests more accurate |
1372 |
self.assertContainsRe(out, "^file0.txt~2:line1$", flags=TestGrep._reflags) |
1373 |
self.assertContainsRe(out, "^file1.txt~2:line1$", flags=TestGrep._reflags) |
|
1374 |
self.assertContainsRe(out, "^file0.txt~1.1.1:line1$", flags=TestGrep._reflags) |
|
1375 |
self.assertContainsRe(out, "^file1.txt~1.1.1:line1$", flags=TestGrep._reflags) |
|
1376 |
self.assertContainsRe(out, "^file0.txt~2:line10$", flags=TestGrep._reflags) |
|
1377 |
self.assertContainsRe(out, "^file1.txt~2:line10$", flags=TestGrep._reflags) |
|
1378 |
self.assertContainsRe(out, "^file0.txt~1.1.1:line10$", flags=TestGrep._reflags) |
|
1379 |
self.assertContainsRe(out, "^file1.txt~1.1.1:line10$", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1380 |
self.assertEqual(len(out.splitlines()), 8) |
0.40.46
by Parth Malwankar
--levels=0 now implicitly prints revnos. added test for --levels=0. |
1381 |
|
0.40.77
by Parth Malwankar
fixed test case. |
1382 |
out, err = self.run_bzr(['grep', '-r', '-1..', '-n', '--levels=0', 'line1']) |
0.40.108
by Parth Malwankar
made tests more accurate |
1383 |
self.assertContainsRe(out, "^file0.txt~2:1:line1$", flags=TestGrep._reflags) |
1384 |
self.assertContainsRe(out, "^file1.txt~2:1:line1$", flags=TestGrep._reflags) |
|
1385 |
self.assertContainsRe(out, "^file0.txt~1.1.1:1:line1$", flags=TestGrep._reflags) |
|
1386 |
self.assertContainsRe(out, "^file1.txt~1.1.1:1:line1$", flags=TestGrep._reflags) |
|
1387 |
self.assertContainsRe(out, "^file0.txt~2:10:line10$", flags=TestGrep._reflags) |
|
1388 |
self.assertContainsRe(out, "^file1.txt~2:10:line10$", flags=TestGrep._reflags) |
|
1389 |
self.assertContainsRe(out, "^file0.txt~1.1.1:10:line10$", flags=TestGrep._reflags) |
|
1390 |
self.assertContainsRe(out, "^file1.txt~1.1.1:10:line10$", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1391 |
self.assertEqual(len(out.splitlines()), 8) |
0.40.46
by Parth Malwankar
--levels=0 now implicitly prints revnos. added test for --levels=0. |
1392 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1393 |
# levels should be ignored by wtree grep
|
1394 |
out, err = self.run_bzr(['grep', '--levels=0', 'l.ne1']) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1395 |
self.assertContainsRe(out, "^file0.txt:line1$", flags=TestGrep._reflags) |
1396 |
self.assertContainsRe(out, "^file1.txt:line1$", flags=TestGrep._reflags) |
|
1397 |
self.assertContainsRe(out, "^file0.txt:line10$", flags=TestGrep._reflags) |
|
1398 |
self.assertContainsRe(out, "^file1.txt:line10$", flags=TestGrep._reflags) |
|
1399 |
self.assertEqual(len(out.splitlines()), 4) |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1400 |
|
1401 |
out, err = self.run_bzr(['grep', '-r', 'last:1..', '--levels=0', 'lin.1']) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1402 |
self.assertContainsRe(out, "^file0.txt~2:line1$", flags=TestGrep._reflags) |
1403 |
self.assertContainsRe(out, "^file1.txt~2:line1$", flags=TestGrep._reflags) |
|
1404 |
self.assertContainsRe(out, "^file0.txt~1.1.1:line1$", flags=TestGrep._reflags) |
|
1405 |
self.assertContainsRe(out, "^file1.txt~1.1.1:line1$", flags=TestGrep._reflags) |
|
1406 |
self.assertContainsRe(out, "^file0.txt~2:line10$", flags=TestGrep._reflags) |
|
1407 |
self.assertContainsRe(out, "^file1.txt~2:line10$", flags=TestGrep._reflags) |
|
1408 |
self.assertContainsRe(out, "^file0.txt~1.1.1:line10$", flags=TestGrep._reflags) |
|
1409 |
self.assertContainsRe(out, "^file1.txt~1.1.1:line10$", flags=TestGrep._reflags) |
|
1410 |
self.assertEqual(len(out.splitlines()), 8) |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1411 |
|
1412 |
out, err = self.run_bzr(['grep', '-r', '-1..', '-n', '--levels=0', '.ine1']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1413 |
self.assertContainsRe(out, "file0.txt~2:1:line1", flags=TestGrep._reflags) |
1414 |
self.assertContainsRe(out, "file1.txt~2:1:line1", flags=TestGrep._reflags) |
|
1415 |
self.assertContainsRe(out, "file0.txt~1.1.1:1:line1", flags=TestGrep._reflags) |
|
1416 |
self.assertContainsRe(out, "file1.txt~1.1.1:1:line1", flags=TestGrep._reflags) |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1417 |
|
0.40.97
by Parth Malwankar
fixed caching bug for rev range. |
1418 |
def test_dotted_rev_grep(self): |
1419 |
"""Grep in dotted revs
|
|
1420 |
"""
|
|
1421 |
wd0 = 'foobar0' |
|
1422 |
wd1 = 'foobar1' |
|
1423 |
||
1424 |
self.make_branch_and_tree(wd0) |
|
1425 |
os.chdir(wd0) |
|
1426 |
self._mk_versioned_file('file0.txt') |
|
1427 |
os.chdir('..') |
|
1428 |
||
1429 |
out, err = self.run_bzr(['branch', wd0, wd1]) |
|
1430 |
os.chdir(wd1) |
|
1431 |
self._mk_versioned_file('file1.txt') # revno 1.1.1 |
|
1432 |
self._update_file('file1.txt', "text 0\n") # revno 1.1.2 |
|
1433 |
self._update_file('file1.txt', "text 1\n") # revno 1.1.3 |
|
1434 |
self._update_file('file1.txt', "text 2\n") # revno 1.1.4 |
|
1435 |
os.chdir(osutils.pathjoin('..', wd0)) |
|
1436 |
||
1437 |
out, err = self.run_bzr(['merge', osutils.pathjoin('..', wd1)]) |
|
1438 |
out, err = self.run_bzr(['ci', '-m', 'merged']) |
|
1439 |
||
1440 |
out, err = self.run_bzr(['grep', '-r', '1.1.1..1.1.4', 'text']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1441 |
self.assertContainsRe(out, "file1.txt~1.1.2:text 0", flags=TestGrep._reflags) |
1442 |
self.assertContainsRe(out, "file1.txt~1.1.3:text 1", flags=TestGrep._reflags) |
|
1443 |
self.assertContainsRe(out, "file1.txt~1.1.3:text 1", flags=TestGrep._reflags) |
|
1444 |
self.assertContainsRe(out, "file1.txt~1.1.4:text 0", flags=TestGrep._reflags) |
|
1445 |
self.assertContainsRe(out, "file1.txt~1.1.4:text 1", flags=TestGrep._reflags) |
|
1446 |
self.assertContainsRe(out, "file1.txt~1.1.4:text 2", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1447 |
self.assertEqual(len(out.splitlines()), 6) |
0.40.97
by Parth Malwankar
fixed caching bug for rev range. |
1448 |
|
0.41.17
by Parth Malwankar
added tests. |
1449 |
def test_versioned_binary_file_grep(self): |
1450 |
"""(versioned) Grep for pattern in binary file.
|
|
1451 |
"""
|
|
1452 |
wd = 'foobar0' |
|
1453 |
self.make_branch_and_tree(wd) |
|
1454 |
os.chdir(wd) |
|
0.40.107
by Parth Malwankar
made tests more precise |
1455 |
self._mk_versioned_file('file.txt') |
0.40.60
by Parth Malwankar
'binary file skipped' warning is only shown with --verbose flag |
1456 |
self._mk_versioned_file('file0.bin') |
1457 |
self._update_file('file0.bin', "\x00lineNN\x00\n") |
|
1458 |
||
1459 |
# note: set --verbose/-v flag to get the skip message.
|
|
1460 |
out, err = self.run_bzr(['grep', '-v', '-r', 'last:1', |
|
1461 |
'lineNN', 'file0.bin']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1462 |
self.assertNotContainsRe(out, "file0.bin", flags=TestGrep._reflags) |
1463 |
self.assertContainsRe(err, "Binary file.*file0.bin.*skipped", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1464 |
self.assertEqual(len(out.splitlines()), 0) |
1465 |
self.assertEqual(len(err.splitlines()), 1) |
|
0.41.17
by Parth Malwankar
added tests. |
1466 |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1467 |
out, err = self.run_bzr(['grep', '-v', '-r', 'last:1', |
1468 |
'line.N', 'file0.bin']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1469 |
self.assertNotContainsRe(out, "file0.bin", flags=TestGrep._reflags) |
1470 |
self.assertContainsRe(err, "Binary file.*file0.bin.*skipped", flags=TestGrep._reflags) |
|
0.40.109
by Parth Malwankar
changed assertTrue to assertEqual |
1471 |
self.assertEqual(len(out.splitlines()), 0) |
1472 |
self.assertEqual(len(err.splitlines()), 1) |
|
0.40.87
by Parth Malwankar
updated tests for better coverage of pattern and fixed-string match. |
1473 |
|
0.41.17
by Parth Malwankar
added tests. |
1474 |
def test_wtree_binary_file_grep(self): |
1475 |
"""(wtree) Grep for pattern in binary file.
|
|
1476 |
"""
|
|
0.40.47
by Parth Malwankar
fixes bug #531336. binary files are now skipped. |
1477 |
wd = 'foobar0' |
1478 |
self.make_branch_and_tree(wd) |
|
1479 |
os.chdir(wd) |
|
0.40.60
by Parth Malwankar
'binary file skipped' warning is only shown with --verbose flag |
1480 |
self._mk_versioned_file('file0.bin') |
1481 |
self._update_file('file0.bin', "\x00lineNN\x00\n") |
|
1482 |
||
1483 |
# note: set --verbose/-v flag to get the skip message.
|
|
1484 |
out, err = self.run_bzr(['grep', '-v', 'lineNN', 'file0.bin']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1485 |
self.assertNotContainsRe(out, "file0.bin:line1", flags=TestGrep._reflags) |
1486 |
self.assertContainsRe(err, "Binary file.*file0.bin.*skipped", flags=TestGrep._reflags) |
|
0.40.60
by Parth Malwankar
'binary file skipped' warning is only shown with --verbose flag |
1487 |
|
1488 |
# binary warning should not be shown without --verbose
|
|
1489 |
out, err = self.run_bzr(['grep', 'lineNN', 'file0.bin']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1490 |
self.assertNotContainsRe(out, "file0.bin:line1", flags=TestGrep._reflags) |
1491 |
self.assertNotContainsRe(err, "Binary file", flags=TestGrep._reflags) |
|
0.40.47
by Parth Malwankar
fixes bug #531336. binary files are now skipped. |
1492 |
|
0.40.96
by Parth Malwankar
added test to ensure that various revspecs work. |
1493 |
def test_revspec(self): |
1494 |
"""Ensure various revspecs work
|
|
1495 |
"""
|
|
1496 |
wd = 'foobar0' |
|
1497 |
self.make_branch_and_tree(wd) |
|
1498 |
os.chdir(wd) |
|
1499 |
self._mk_versioned_dir('dir0') # rev1 |
|
1500 |
self._mk_versioned_file('dir0/file0.txt') # rev2 |
|
1501 |
self._update_file('dir0/file0.txt', "v3 text\n") # rev3 |
|
1502 |
self._update_file('dir0/file0.txt', "v4 text\n") # rev4 |
|
1503 |
self._update_file('dir0/file0.txt', "v5 text\n") # rev5 |
|
1504 |
||
1505 |
out, err = self.run_bzr(['grep', '-r', 'revno:1..2', 'v3']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1506 |
self.assertNotContainsRe(out, "file0", flags=TestGrep._reflags) |
0.40.110
by Parth Malwankar
made some tests more precise |
1507 |
self.assertEqual(len(out.splitlines()), 0) |
0.40.96
by Parth Malwankar
added test to ensure that various revspecs work. |
1508 |
|
1509 |
out, err = self.run_bzr(['grep', '-r', 'revno:4..', 'v4']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1510 |
self.assertContainsRe(out, "^dir0/file0.txt", flags=TestGrep._reflags) |
0.40.110
by Parth Malwankar
made some tests more precise |
1511 |
self.assertEqual(len(out.splitlines()), 2) # find v4 in rev4 and rev5 |
0.40.96
by Parth Malwankar
added test to ensure that various revspecs work. |
1512 |
|
1513 |
out, err = self.run_bzr(['grep', '-r', '..revno:3', 'v4']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1514 |
self.assertNotContainsRe(out, "file0", flags=TestGrep._reflags) |
0.40.110
by Parth Malwankar
made some tests more precise |
1515 |
self.assertEqual(len(out.splitlines()), 0) |
0.40.96
by Parth Malwankar
added test to ensure that various revspecs work. |
1516 |
|
1517 |
out, err = self.run_bzr(['grep', '-r', '..revno:3', 'v3']) |
|
0.40.99
by Parth Malwankar
updated tests to use assertContainsRe/assertNotContainsRe |
1518 |
self.assertContainsRe(out, "^dir0/file0.txt", flags=TestGrep._reflags) |
0.40.110
by Parth Malwankar
made some tests more precise |
1519 |
self.assertEqual(len(out.splitlines()), 1) |
0.40.96
by Parth Malwankar
added test to ensure that various revspecs work. |
1520 |
|
0.40.114
by Parth Malwankar
test for wtree -l/--files-with-matches |
1521 |
def test_wtree_files_with_matches(self): |
1522 |
"""(wtree) Ensure --files-with-matches, -l works
|
|
1523 |
"""
|
|
1524 |
wd = 'foobar0' |
|
1525 |
self.make_branch_and_tree(wd) |
|
1526 |
os.chdir(wd) |
|
1527 |
||
1528 |
self._mk_versioned_file('file0.txt', total_lines=2) |
|
1529 |
self._mk_versioned_file('file1.txt', total_lines=2) |
|
1530 |
self._mk_versioned_dir('dir0') |
|
1531 |
self._mk_versioned_file('dir0/file00.txt', total_lines=2) |
|
1532 |
self._mk_versioned_file('dir0/file01.txt', total_lines=2) |
|
1533 |
||
1534 |
self._update_file('file0.txt', 'HELLO\n', checkin=False) |
|
1535 |
self._update_file('dir0/file00.txt', 'HELLO\n', checkin=False) |
|
1536 |
||
0.40.123
by Parth Malwankar
added regex tests for wtree -l search |
1537 |
# fixed-string
|
0.40.114
by Parth Malwankar
test for wtree -l/--files-with-matches |
1538 |
out, err = self.run_bzr(['grep', '--files-with-matches', 'HELLO']) |
1539 |
||
1540 |
self.assertContainsRe(out, "^file0.txt$", flags=TestGrep._reflags) |
|
1541 |
self.assertContainsRe(out, "^dir0/file00.txt$", flags=TestGrep._reflags) |
|
1542 |
self.assertEqual(len(out.splitlines()), 2) |
|
1543 |
||
0.40.123
by Parth Malwankar
added regex tests for wtree -l search |
1544 |
# regex
|
1545 |
out, err = self.run_bzr(['grep', '--files-with-matches', 'HE.LO']) |
|
1546 |
||
1547 |
self.assertContainsRe(out, "^file0.txt$", flags=TestGrep._reflags) |
|
1548 |
self.assertContainsRe(out, "^dir0/file00.txt$", flags=TestGrep._reflags) |
|
1549 |
self.assertEqual(len(out.splitlines()), 2) |
|
1550 |
||
1551 |
# fixed-string
|
|
0.40.114
by Parth Malwankar
test for wtree -l/--files-with-matches |
1552 |
out, err = self.run_bzr(['grep', '-l', 'HELLO']) |
1553 |
||
1554 |
self.assertContainsRe(out, "^file0.txt$", flags=TestGrep._reflags) |
|
1555 |
self.assertContainsRe(out, "^dir0/file00.txt$", flags=TestGrep._reflags) |
|
1556 |
self.assertEqual(len(out.splitlines()), 2) |
|
1557 |
||
0.40.123
by Parth Malwankar
added regex tests for wtree -l search |
1558 |
# regex
|
1559 |
out, err = self.run_bzr(['grep', '-l', 'HE.LO']) |
|
1560 |
||
1561 |
self.assertContainsRe(out, "^file0.txt$", flags=TestGrep._reflags) |
|
1562 |
self.assertContainsRe(out, "^dir0/file00.txt$", flags=TestGrep._reflags) |
|
1563 |
self.assertEqual(len(out.splitlines()), 2) |
|
1564 |
||
1565 |
# fixed-string
|
|
0.40.114
by Parth Malwankar
test for wtree -l/--files-with-matches |
1566 |
out, err = self.run_bzr(['grep', '-l', 'HELLO', 'dir0', 'file1.txt']) |
1567 |
||
1568 |
self.assertContainsRe(out, "^dir0/file00.txt$", flags=TestGrep._reflags) |
|
1569 |
self.assertEqual(len(out.splitlines()), 1) |
|
1570 |
||
0.40.123
by Parth Malwankar
added regex tests for wtree -l search |
1571 |
# regex
|
1572 |
out, err = self.run_bzr(['grep', '-l', '.ELLO', 'dir0', 'file1.txt']) |
|
1573 |
||
1574 |
self.assertContainsRe(out, "^dir0/file00.txt$", flags=TestGrep._reflags) |
|
1575 |
self.assertEqual(len(out.splitlines()), 1) |
|
1576 |
||
1577 |
# fixed-string
|
|
0.40.114
by Parth Malwankar
test for wtree -l/--files-with-matches |
1578 |
out, err = self.run_bzr(['grep', '-l', 'HELLO', 'file0.txt']) |
1579 |
||
1580 |
self.assertContainsRe(out, "^file0.txt$", flags=TestGrep._reflags) |
|
1581 |
self.assertEqual(len(out.splitlines()), 1) |
|
1582 |
||
0.40.123
by Parth Malwankar
added regex tests for wtree -l search |
1583 |
# regex
|
1584 |
out, err = self.run_bzr(['grep', '-l', '.ELLO', 'file0.txt']) |
|
1585 |
||
1586 |
self.assertContainsRe(out, "^file0.txt$", flags=TestGrep._reflags) |
|
1587 |
self.assertEqual(len(out.splitlines()), 1) |
|
1588 |
||
1589 |
# fixed-string
|
|
0.40.114
by Parth Malwankar
test for wtree -l/--files-with-matches |
1590 |
out, err = self.run_bzr(['grep', '--no-recursive', '-l', 'HELLO']) |
1591 |
||
1592 |
self.assertContainsRe(out, "^file0.txt$", flags=TestGrep._reflags) |
|
1593 |
self.assertEqual(len(out.splitlines()), 1) |
|
1594 |
||
0.40.123
by Parth Malwankar
added regex tests for wtree -l search |
1595 |
# regex
|
1596 |
out, err = self.run_bzr(['grep', '--no-recursive', '-l', '.ELLO']) |
|
1597 |
||
1598 |
self.assertContainsRe(out, "^file0.txt$", flags=TestGrep._reflags) |
|
1599 |
self.assertEqual(len(out.splitlines()), 1) |
|
1600 |
||
0.40.115
by Parth Malwankar
added test for versioned grep. |
1601 |
def test_ver_files_with_matches(self): |
1602 |
"""(ver) Ensure --files-with-matches, -l works
|
|
1603 |
"""
|
|
1604 |
wd = 'foobar0' |
|
1605 |
self.make_branch_and_tree(wd) |
|
1606 |
os.chdir(wd) |
|
1607 |
||
1608 |
self._mk_versioned_file('file0.txt', total_lines=2) # rev 1 |
|
1609 |
self._mk_versioned_file('file1.txt', total_lines=2) # rev 2 |
|
1610 |
self._mk_versioned_dir('dir0') # rev 3 |
|
1611 |
self._mk_versioned_file('dir0/file00.txt', total_lines=2) # rev 4 |
|
1612 |
self._mk_versioned_file('dir0/file01.txt', total_lines=2) # rev 5 |
|
1613 |
||
1614 |
self._update_file('file0.txt', 'HELLO\n') # rev 6 |
|
1615 |
self._update_file('dir0/file00.txt', 'HELLO\n') # rev 7 |
|
1616 |
||
0.40.120
by Parth Malwankar
added tests for regex search for -l/--files-with-matches |
1617 |
# fixed-string
|
1618 |
out, err = self.run_bzr(['grep', '-r', '-1', '--files-with-matches', |
|
1619 |
'HELLO']) |
|
1620 |
||
1621 |
self.assertContainsRe(out, "^file0.txt~7$", flags=TestGrep._reflags) |
|
1622 |
self.assertContainsRe(out, "^dir0/file00.txt~7$", flags=TestGrep._reflags) |
|
1623 |
self.assertEqual(len(out.splitlines()), 2) |
|
1624 |
||
1625 |
# regex
|
|
1626 |
out, err = self.run_bzr(['grep', '-r', '-1', '--files-with-matches', |
|
1627 |
'H.LLO']) |
|
1628 |
||
1629 |
self.assertContainsRe(out, "^file0.txt~7$", flags=TestGrep._reflags) |
|
1630 |
self.assertContainsRe(out, "^dir0/file00.txt~7$", flags=TestGrep._reflags) |
|
1631 |
self.assertEqual(len(out.splitlines()), 2) |
|
1632 |
||
1633 |
# fixed-string
|
|
1634 |
out, err = self.run_bzr(['grep', '-r', '6..7', '--files-with-matches', |
|
1635 |
'HELLO']) |
|
1636 |
||
1637 |
self.assertContainsRe(out, "^file0.txt~6$", flags=TestGrep._reflags) |
|
1638 |
self.assertContainsRe(out, "^file0.txt~7$", flags=TestGrep._reflags) |
|
1639 |
self.assertContainsRe(out, "^dir0/file00.txt~7$", flags=TestGrep._reflags) |
|
1640 |
self.assertEqual(len(out.splitlines()), 3) |
|
1641 |
||
1642 |
# regex
|
|
1643 |
out, err = self.run_bzr(['grep', '-r', '6..7', '--files-with-matches', |
|
1644 |
'H.LLO']) |
|
1645 |
||
1646 |
self.assertContainsRe(out, "^file0.txt~6$", flags=TestGrep._reflags) |
|
1647 |
self.assertContainsRe(out, "^file0.txt~7$", flags=TestGrep._reflags) |
|
1648 |
self.assertContainsRe(out, "^dir0/file00.txt~7$", flags=TestGrep._reflags) |
|
1649 |
self.assertEqual(len(out.splitlines()), 3) |
|
1650 |
||
1651 |
# fixed-string
|
|
0.40.115
by Parth Malwankar
added test for versioned grep. |
1652 |
out, err = self.run_bzr(['grep', '-r', '-1', '-l', 'HELLO']) |
1653 |
||
1654 |
self.assertContainsRe(out, "^file0.txt~7$", flags=TestGrep._reflags) |
|
1655 |
self.assertContainsRe(out, "^dir0/file00.txt~7$", flags=TestGrep._reflags) |
|
1656 |
self.assertEqual(len(out.splitlines()), 2) |
|
1657 |
||
0.40.120
by Parth Malwankar
added tests for regex search for -l/--files-with-matches |
1658 |
# regex
|
1659 |
out, err = self.run_bzr(['grep', '-r', '-1', '-l', 'H.LLO']) |
|
1660 |
||
1661 |
self.assertContainsRe(out, "^file0.txt~7$", flags=TestGrep._reflags) |
|
1662 |
self.assertContainsRe(out, "^dir0/file00.txt~7$", flags=TestGrep._reflags) |
|
1663 |
self.assertEqual(len(out.splitlines()), 2) |
|
1664 |
||
1665 |
# fixed-string
|
|
0.40.115
by Parth Malwankar
added test for versioned grep. |
1666 |
out, err = self.run_bzr(['grep', '-l', 'HELLO', '-r', '-1', |
1667 |
'dir0', 'file1.txt']) |
|
1668 |
||
1669 |
self.assertContainsRe(out, "^dir0/file00.txt~7$", flags=TestGrep._reflags) |
|
1670 |
self.assertEqual(len(out.splitlines()), 1) |
|
1671 |
||
0.40.120
by Parth Malwankar
added tests for regex search for -l/--files-with-matches |
1672 |
# regex
|
1673 |
out, err = self.run_bzr(['grep', '-l', 'H.LLO', '-r', '-1', |
|
1674 |
'dir0', 'file1.txt']) |
|
1675 |
||
1676 |
self.assertContainsRe(out, "^dir0/file00.txt~7$", flags=TestGrep._reflags) |
|
1677 |
self.assertEqual(len(out.splitlines()), 1) |
|
1678 |
||
1679 |
# fixed-string
|
|
0.40.115
by Parth Malwankar
added test for versioned grep. |
1680 |
out, err = self.run_bzr(['grep', '-l', 'HELLO', |
1681 |
'-r', '-2', 'file0.txt']) |
|
1682 |
||
1683 |
self.assertContainsRe(out, "^file0.txt~6$", flags=TestGrep._reflags) |
|
1684 |
self.assertEqual(len(out.splitlines()), 1) |
|
1685 |
||
0.40.120
by Parth Malwankar
added tests for regex search for -l/--files-with-matches |
1686 |
# regex
|
1687 |
out, err = self.run_bzr(['grep', '-l', 'HE.LO', |
|
1688 |
'-r', '-2', 'file0.txt']) |
|
1689 |
||
1690 |
self.assertContainsRe(out, "^file0.txt~6$", flags=TestGrep._reflags) |
|
1691 |
self.assertEqual(len(out.splitlines()), 1) |
|
1692 |
||
1693 |
# fixed-string
|
|
0.40.115
by Parth Malwankar
added test for versioned grep. |
1694 |
out, err = self.run_bzr(['grep', '--no-recursive', '-r', '-1', |
1695 |
'-l', 'HELLO']) |
|
1696 |
||
1697 |
self.assertContainsRe(out, "^file0.txt~7$", flags=TestGrep._reflags) |
|
1698 |
self.assertEqual(len(out.splitlines()), 1) |
|
1699 |
||
0.40.120
by Parth Malwankar
added tests for regex search for -l/--files-with-matches |
1700 |
# regex
|
1701 |
out, err = self.run_bzr(['grep', '--no-recursive', '-r', '-1', |
|
1702 |
'-l', '.ELLO']) |
|
1703 |
||
1704 |
self.assertContainsRe(out, "^file0.txt~7$", flags=TestGrep._reflags) |
|
1705 |
self.assertEqual(len(out.splitlines()), 1) |
|
0.40.114
by Parth Malwankar
test for wtree -l/--files-with-matches |
1706 |
|
0.40.124
by Parth Malwankar
added test for wtree grep with -L/--files-without-match |
1707 |
def test_wtree_files_without_matches(self): |
0.40.126
by Parth Malwankar
renamed --files-without-matches => --files-without-match |
1708 |
"""(wtree) Ensure --files-without-match, -L works
|
0.40.124
by Parth Malwankar
added test for wtree grep with -L/--files-without-match |
1709 |
"""
|
1710 |
wd = 'foobar0' |
|
1711 |
self.make_branch_and_tree(wd) |
|
1712 |
os.chdir(wd) |
|
1713 |
||
1714 |
self._mk_versioned_file('file0.txt', total_lines=2) |
|
1715 |
self._mk_versioned_file('file1.txt', total_lines=2) |
|
1716 |
self._mk_versioned_dir('dir0') |
|
1717 |
self._mk_versioned_file('dir0/file00.txt', total_lines=2) |
|
1718 |
self._mk_versioned_file('dir0/file01.txt', total_lines=2) |
|
1719 |
||
1720 |
self._update_file('file0.txt', 'HELLO\n', checkin=False) |
|
1721 |
self._update_file('dir0/file00.txt', 'HELLO\n', checkin=False) |
|
1722 |
||
1723 |
# fixed-string
|
|
0.40.126
by Parth Malwankar
renamed --files-without-matches => --files-without-match |
1724 |
out, err = self.run_bzr(['grep', '--files-without-match', 'HELLO']) |
0.40.124
by Parth Malwankar
added test for wtree grep with -L/--files-without-match |
1725 |
|
1726 |
self.assertContainsRe(out, "^file1.txt$", flags=TestGrep._reflags) |
|
1727 |
self.assertContainsRe(out, "^dir0/file01.txt$", flags=TestGrep._reflags) |
|
1728 |
self.assertEqual(len(out.splitlines()), 2) |
|
1729 |
||
1730 |
# regex
|
|
0.40.126
by Parth Malwankar
renamed --files-without-matches => --files-without-match |
1731 |
out, err = self.run_bzr(['grep', '--files-without-match', 'HE.LO']) |
0.40.124
by Parth Malwankar
added test for wtree grep with -L/--files-without-match |
1732 |
|
1733 |
self.assertContainsRe(out, "^file1.txt$", flags=TestGrep._reflags) |
|
1734 |
self.assertContainsRe(out, "^dir0/file01.txt$", flags=TestGrep._reflags) |
|
1735 |
self.assertEqual(len(out.splitlines()), 2) |
|
1736 |
||
1737 |
# fixed-string
|
|
1738 |
out, err = self.run_bzr(['grep', '-L', 'HELLO']) |
|
1739 |
||
1740 |
self.assertContainsRe(out, "^file1.txt$", flags=TestGrep._reflags) |
|
1741 |
self.assertContainsRe(out, "^dir0/file01.txt$", flags=TestGrep._reflags) |
|
1742 |
self.assertEqual(len(out.splitlines()), 2) |
|
1743 |
||
1744 |
# regex
|
|
1745 |
out, err = self.run_bzr(['grep', '-L', 'HE.LO']) |
|
1746 |
||
1747 |
self.assertContainsRe(out, "^file1.txt$", flags=TestGrep._reflags) |
|
1748 |
self.assertContainsRe(out, "^dir0/file01.txt$", flags=TestGrep._reflags) |
|
1749 |
self.assertEqual(len(out.splitlines()), 2) |
|
1750 |
||
1751 |
# fixed-string
|
|
1752 |
out, err = self.run_bzr(['grep', '-L', 'HELLO', 'dir0', 'file1.txt']) |
|
1753 |
||
1754 |
self.assertContainsRe(out, "^file1.txt$", flags=TestGrep._reflags) |
|
1755 |
self.assertContainsRe(out, "^dir0/file01.txt$", flags=TestGrep._reflags) |
|
1756 |
self.assertEqual(len(out.splitlines()), 2) |
|
1757 |
||
1758 |
# regex
|
|
1759 |
out, err = self.run_bzr(['grep', '-L', '.ELLO', 'dir0', 'file1.txt']) |
|
1760 |
||
1761 |
self.assertContainsRe(out, "^file1.txt$", flags=TestGrep._reflags) |
|
1762 |
self.assertContainsRe(out, "^dir0/file01.txt$", flags=TestGrep._reflags) |
|
1763 |
self.assertEqual(len(out.splitlines()), 2) |
|
1764 |
||
1765 |
# fixed-string
|
|
1766 |
out, err = self.run_bzr(['grep', '-L', 'HELLO', 'file1.txt']) |
|
1767 |
||
1768 |
self.assertContainsRe(out, "^file1.txt$", flags=TestGrep._reflags) |
|
1769 |
self.assertEqual(len(out.splitlines()), 1) |
|
1770 |
||
1771 |
# regex
|
|
1772 |
out, err = self.run_bzr(['grep', '-L', '.ELLO', 'file1.txt']) |
|
1773 |
||
1774 |
self.assertContainsRe(out, "^file1.txt$", flags=TestGrep._reflags) |
|
1775 |
self.assertEqual(len(out.splitlines()), 1) |
|
1776 |
||
1777 |
# fixed-string
|
|
1778 |
out, err = self.run_bzr(['grep', '--no-recursive', '-L', 'HELLO']) |
|
1779 |
||
1780 |
self.assertContainsRe(out, "^file1.txt$", flags=TestGrep._reflags) |
|
1781 |
self.assertEqual(len(out.splitlines()), 1) |
|
1782 |
||
1783 |
# regex
|
|
1784 |
out, err = self.run_bzr(['grep', '--no-recursive', '-L', '.ELLO']) |
|
1785 |
||
1786 |
self.assertContainsRe(out, "^file1.txt$", flags=TestGrep._reflags) |
|
1787 |
self.assertEqual(len(out.splitlines()), 1) |
|
1788 |
||
0.40.122
by Parth Malwankar
added test for versioned -L and some fixes. |
1789 |
def test_ver_files_without_matches(self): |
0.40.126
by Parth Malwankar
renamed --files-without-matches => --files-without-match |
1790 |
"""(ver) Ensure --files-without-match, -L works
|
0.40.122
by Parth Malwankar
added test for versioned -L and some fixes. |
1791 |
"""
|
1792 |
wd = 'foobar0' |
|
1793 |
self.make_branch_and_tree(wd) |
|
1794 |
os.chdir(wd) |
|
1795 |
||
1796 |
self._mk_versioned_file('file0.txt', total_lines=2) # rev 1 |
|
1797 |
self._mk_versioned_file('file1.txt', total_lines=2) # rev 2 |
|
1798 |
self._mk_versioned_dir('dir0') # rev 3 |
|
1799 |
self._mk_versioned_file('dir0/file00.txt', total_lines=2) # rev 4 |
|
1800 |
self._mk_versioned_file('dir0/file01.txt', total_lines=2) # rev 5 |
|
1801 |
||
1802 |
self._update_file('file0.txt', 'HELLO\n') # rev 6 |
|
1803 |
self._update_file('dir0/file00.txt', 'HELLO\n') # rev 7 |
|
1804 |
||
1805 |
# fixed-string
|
|
0.40.126
by Parth Malwankar
renamed --files-without-matches => --files-without-match |
1806 |
out, err = self.run_bzr(['grep', '-r', '-1', '--files-without-match', |
0.40.122
by Parth Malwankar
added test for versioned -L and some fixes. |
1807 |
'HELLO']) |
1808 |
||
1809 |
self.assertContainsRe(out, "^file1.txt~7$", flags=TestGrep._reflags) |
|
1810 |
self.assertContainsRe(out, "^dir0/file01.txt~7$", flags=TestGrep._reflags) |
|
1811 |
self.assertEqual(len(out.splitlines()), 2) |
|
1812 |
||
1813 |
# regex
|
|
0.40.126
by Parth Malwankar
renamed --files-without-matches => --files-without-match |
1814 |
out, err = self.run_bzr(['grep', '-r', '-1', '--files-without-match', |
0.40.122
by Parth Malwankar
added test for versioned -L and some fixes. |
1815 |
'H.LLO']) |
1816 |
||
1817 |
self.assertContainsRe(out, "^file1.txt~7$", flags=TestGrep._reflags) |
|
1818 |
self.assertContainsRe(out, "^dir0/file01.txt~7$", flags=TestGrep._reflags) |
|
1819 |
self.assertEqual(len(out.splitlines()), 2) |
|
1820 |
||
1821 |
# fixed-string
|
|
0.40.126
by Parth Malwankar
renamed --files-without-matches => --files-without-match |
1822 |
out, err = self.run_bzr(['grep', '-r', '6..7', '--files-without-match', |
0.40.122
by Parth Malwankar
added test for versioned -L and some fixes. |
1823 |
'HELLO']) |
1824 |
||
1825 |
self.assertContainsRe(out, "^file1.txt~6$", flags=TestGrep._reflags) |
|
1826 |
self.assertContainsRe(out, "^dir0/file00.txt~6$", flags=TestGrep._reflags) |
|
1827 |
self.assertContainsRe(out, "^dir0/file01.txt~6$", flags=TestGrep._reflags) |
|
1828 |
self.assertContainsRe(out, "^file1.txt~7$", flags=TestGrep._reflags) |
|
1829 |
self.assertContainsRe(out, "^dir0/file01.txt~7$", flags=TestGrep._reflags) |
|
1830 |
self.assertEqual(len(out.splitlines()), 5) |
|
1831 |
||
1832 |
# regex
|
|
0.40.126
by Parth Malwankar
renamed --files-without-matches => --files-without-match |
1833 |
out, err = self.run_bzr(['grep', '-r', '6..7', '--files-without-match', |
0.40.122
by Parth Malwankar
added test for versioned -L and some fixes. |
1834 |
'H.LLO']) |
1835 |
||
1836 |
self.assertContainsRe(out, "^file1.txt~6$", flags=TestGrep._reflags) |
|
1837 |
self.assertContainsRe(out, "^dir0/file00.txt~6$", flags=TestGrep._reflags) |
|
1838 |
self.assertContainsRe(out, "^dir0/file01.txt~6$", flags=TestGrep._reflags) |
|
1839 |
self.assertContainsRe(out, "^file1.txt~7$", flags=TestGrep._reflags) |
|
1840 |
self.assertContainsRe(out, "^dir0/file01.txt~7$", flags=TestGrep._reflags) |
|
1841 |
self.assertEqual(len(out.splitlines()), 5) |
|
1842 |
||
1843 |
# fixed-string
|
|
1844 |
out, err = self.run_bzr(['grep', '-r', '-1', '-L', 'HELLO']) |
|
1845 |
||
1846 |
self.assertContainsRe(out, "^file1.txt~7$", flags=TestGrep._reflags) |
|
1847 |
self.assertContainsRe(out, "^dir0/file01.txt~7$", flags=TestGrep._reflags) |
|
1848 |
self.assertEqual(len(out.splitlines()), 2) |
|
1849 |
||
1850 |
# regex
|
|
1851 |
out, err = self.run_bzr(['grep', '-r', '-1', '-L', 'H.LLO']) |
|
1852 |
||
1853 |
self.assertContainsRe(out, "^file1.txt~7$", flags=TestGrep._reflags) |
|
1854 |
self.assertContainsRe(out, "^dir0/file01.txt~7$", flags=TestGrep._reflags) |
|
1855 |
self.assertEqual(len(out.splitlines()), 2) |
|
1856 |
||
1857 |
# fixed-string
|
|
1858 |
out, err = self.run_bzr(['grep', '-L', 'HELLO', '-r', '-1', |
|
1859 |
'dir0', 'file1.txt']) |
|
1860 |
||
1861 |
self.assertContainsRe(out, "^file1.txt~7$", flags=TestGrep._reflags) |
|
1862 |
self.assertContainsRe(out, "^dir0/file01.txt~7$", flags=TestGrep._reflags) |
|
1863 |
self.assertEqual(len(out.splitlines()), 2) |
|
1864 |
||
1865 |
# regex
|
|
1866 |
out, err = self.run_bzr(['grep', '-L', 'H.LLO', '-r', '-1', |
|
1867 |
'dir0', 'file1.txt']) |
|
1868 |
||
1869 |
self.assertContainsRe(out, "^file1.txt~7$", flags=TestGrep._reflags) |
|
1870 |
self.assertContainsRe(out, "^dir0/file01.txt~7$", flags=TestGrep._reflags) |
|
1871 |
self.assertEqual(len(out.splitlines()), 2) |
|
1872 |
||
1873 |
# fixed-string
|
|
1874 |
out, err = self.run_bzr(['grep', '-L', 'HELLO', |
|
1875 |
'-r', '-2', 'file1.txt']) |
|
1876 |
||
1877 |
self.assertContainsRe(out, "^file1.txt~6$", flags=TestGrep._reflags) |
|
1878 |
self.assertEqual(len(out.splitlines()), 1) |
|
1879 |
||
1880 |
# regex
|
|
1881 |
out, err = self.run_bzr(['grep', '-L', 'HE.LO', |
|
1882 |
'-r', '-2', 'file1.txt']) |
|
1883 |
||
1884 |
self.assertContainsRe(out, "^file1.txt~6$", flags=TestGrep._reflags) |
|
1885 |
self.assertEqual(len(out.splitlines()), 1) |
|
1886 |
||
1887 |
# fixed-string
|
|
1888 |
out, err = self.run_bzr(['grep', '--no-recursive', '-r', '-1', |
|
1889 |
'-L', 'HELLO']) |
|
1890 |
||
1891 |
self.assertContainsRe(out, "^file1.txt~7$", flags=TestGrep._reflags) |
|
1892 |
self.assertEqual(len(out.splitlines()), 1) |
|
1893 |
||
1894 |
# regex
|
|
1895 |
out, err = self.run_bzr(['grep', '--no-recursive', '-r', '-1', |
|
1896 |
'-L', '.ELLO']) |
|
1897 |
||
1898 |
self.assertContainsRe(out, "^file1.txt~7$", flags=TestGrep._reflags) |
|
1899 |
self.assertEqual(len(out.splitlines()), 1) |
|
1900 |
||
0.40.131
by Parth Malwankar
bzr grep now allows grepping with -r even when no tree exists. |
1901 |
def test_no_tree(self): |
1902 |
"""Ensure grep works without working tree.
|
|
1903 |
"""
|
|
1904 |
wd0 = 'foobar0' |
|
1905 |
wd1 = 'foobar1' |
|
1906 |
self.make_branch_and_tree(wd0) |
|
1907 |
os.chdir(wd0) |
|
1908 |
self._mk_versioned_file('file0.txt') |
|
1909 |
os.chdir('..') |
|
1910 |
out, err = self.run_bzr(['branch', '--no-tree', wd0, wd1]) |
|
1911 |
os.chdir(wd1) |
|
1912 |
||
1913 |
out, err = self.run_bzr(['grep', 'line1'], 3) |
|
1914 |
self.assertContainsRe(err, "Cannot search working tree", flags=TestGrep._reflags) |
|
1915 |
self.assertEqual(out, '') |
|
1916 |
||
1917 |
out, err = self.run_bzr(['grep', '-r', '1', 'line1']) |
|
1918 |
self.assertContainsRe(out, "file0.txt~1:line1", flags=TestGrep._reflags) |
|
1919 |
self.assertEqual(len(out.splitlines()), 2) # finds line1 and line10 |
|
1920 |
||
0.43.11
by Parth Malwankar
test cases for colored results. |
1921 |
|
0.46.21
by Martin
Fix and test bytes/unicode issue but there's more to do in this area |
1922 |
class TestNonAscii(GrepTestBase): |
1923 |
"""Tests for non-ascii filenames and file contents"""
|
|
1924 |
||
0.40.147
by Jelmer Vernooij
Fix compatibility with newer versions of bzr: don't use relative imports in lazy imports, and import features from bzrlib.tests.features. |
1925 |
_test_needs_features = [UnicodeFilenameFeature] |
0.46.21
by Martin
Fix and test bytes/unicode issue but there's more to do in this area |
1926 |
|
1927 |
def test_unicode_only_file(self): |
|
1928 |
"""Test filename and contents that requires a unicode encoding"""
|
|
1929 |
tree = self.make_branch_and_tree(".") |
|
1930 |
contents = [u"\u1234"] |
|
1931 |
self.build_tree(contents) |
|
1932 |
tree.add(contents) |
|
1933 |
tree.commit("Initial commit") |
|
1934 |
as_utf8 = u"\u1234".encode("UTF-8") |
|
1935 |
||
1936 |
# GZ 2010-06-07: Note we can't actually grep for \u1234 as the pattern
|
|
1937 |
# is mangled according to the user encoding.
|
|
1938 |
streams = self.run_bzr(["grep", "--files-with-matches", |
|
1939 |
u"contents"], encoding="UTF-8") |
|
1940 |
self.assertEqual(streams, (as_utf8 + "\n", "")) |
|
1941 |
||
1942 |
streams = self.run_bzr(["grep", "-r", "1", "--files-with-matches", |
|
1943 |
u"contents"], encoding="UTF-8") |
|
1944 |
self.assertEqual(streams, (as_utf8 + "~1\n", "")) |
|
1945 |
||
1946 |
fileencoding = osutils.get_user_encoding() |
|
1947 |
as_mangled = as_utf8.decode(fileencoding, "replace").encode("UTF-8") |
|
1948 |
||
1949 |
streams = self.run_bzr(["grep", "-n", |
|
1950 |
u"contents"], encoding="UTF-8") |
|
1951 |
self.assertEqual(streams, ("%s:1:contents of %s\n" % |
|
1952 |
(as_utf8, as_mangled), "")) |
|
1953 |
||
1954 |
streams = self.run_bzr(["grep", "-n", "-r", "1", |
|
1955 |
u"contents"], encoding="UTF-8") |
|
1956 |
self.assertEqual(streams, ("%s~1:1:contents of %s\n" % |
|
1957 |
(as_utf8, as_mangled), "")) |
|
1958 |
||
1959 |
||
0.43.11
by Parth Malwankar
test cases for colored results. |
1960 |
class TestColorGrep(GrepTestBase): |
1961 |
"""Tests for the --color option."""
|
|
0.43.12
by Parth Malwankar
added feature for running color tests conditionally |
1962 |
|
0.46.17
by Martin
Fix previously untested issue with colour and match-only, and test a related issue |
1963 |
# GZ 2010-06-05: Does this really require the feature? Nothing prints.
|
6531.3.8
by Jelmer Vernooij
Move color feature into bzrlib.tests.features. |
1964 |
_test_needs_features = [ColorFeature] |
0.43.12
by Parth Malwankar
added feature for running color tests conditionally |
1965 |
|
0.43.11
by Parth Malwankar
test cases for colored results. |
1966 |
_rev_sep = color_string('~', fg=FG.BOLD_YELLOW) |
1967 |
_sep = color_string(':', fg=FG.BOLD_CYAN) |
|
1968 |
||
1969 |
def test_color_option(self): |
|
1970 |
"""Ensure options for color are valid.
|
|
1971 |
"""
|
|
1972 |
out, err = self.run_bzr(['grep', '--color', 'foo', 'bar'], 3) |
|
1973 |
self.assertEqual(out, '') |
|
1974 |
self.assertContainsRe(err, 'Valid values for --color are', flags=TestGrep._reflags) |
|
1975 |
||
0.46.17
by Martin
Fix previously untested issue with colour and match-only, and test a related issue |
1976 |
def test_ver_matching_files(self): |
1977 |
"""(versioned) Search for matches or no matches only"""
|
|
1978 |
tree = self.make_branch_and_tree(".") |
|
1979 |
contents = ["d/", "d/aaa", "bbb"] |
|
1980 |
self.build_tree(contents) |
|
1981 |
tree.add(contents) |
|
1982 |
tree.commit("Initial commit") |
|
1983 |
||
1984 |
# GZ 2010-06-05: Maybe modify the working tree here
|
|
1985 |
||
1986 |
streams = self.run_bzr(["grep", "--color", "always", "-r", "1", |
|
1987 |
"--files-with-matches", "aaa"]) |
|
1988 |
self.assertEqual(streams, ("".join([ |
|
1989 |
FG.MAGENTA, "d/aaa", self._rev_sep, "1", "\n" |
|
1990 |
]), "")) |
|
1991 |
||
1992 |
streams = self.run_bzr(["grep", "--color", "always", "-r", "1", |
|
1993 |
"--files-without-match", "aaa"]) |
|
1994 |
self.assertEqual(streams, ("".join([ |
|
1995 |
FG.MAGENTA, "bbb", self._rev_sep, "1", "\n" |
|
1996 |
]), "")) |
|
1997 |
||
1998 |
def test_wtree_matching_files(self): |
|
1999 |
"""(wtree) Search for matches or no matches only"""
|
|
2000 |
tree = self.make_branch_and_tree(".") |
|
2001 |
contents = ["d/", "d/aaa", "bbb"] |
|
2002 |
self.build_tree(contents) |
|
2003 |
tree.add(contents) |
|
2004 |
tree.commit("Initial commit") |
|
2005 |
||
2006 |
# GZ 2010-06-05: Maybe modify the working tree here
|
|
2007 |
||
2008 |
streams = self.run_bzr(["grep", "--color", "always", |
|
2009 |
"--files-with-matches", "aaa"]) |
|
2010 |
self.assertEqual(streams, ("".join([ |
|
2011 |
FG.MAGENTA, "d/aaa", FG.NONE, "\n" |
|
2012 |
]), "")) |
|
2013 |
||
2014 |
streams = self.run_bzr(["grep", "--color", "always", |
|
2015 |
"--files-without-match", "aaa"]) |
|
2016 |
self.assertEqual(streams, ("".join([ |
|
2017 |
FG.MAGENTA, "bbb", FG.NONE, "\n" |
|
2018 |
]), "")) |
|
2019 |
||
0.43.11
by Parth Malwankar
test cases for colored results. |
2020 |
def test_ver_basic_file(self): |
2021 |
"""(versioned) Search for pattern in specfic file.
|
|
2022 |
"""
|
|
2023 |
wd = 'foobar0' |
|
2024 |
self.make_branch_and_tree(wd) |
|
2025 |
os.chdir(wd) |
|
2026 |
lp = 'foo is foobar' |
|
2027 |
self._mk_versioned_file('file0.txt', line_prefix=lp, total_lines=1) |
|
2028 |
||
2029 |
# prepare colored result
|
|
2030 |
foo = color_string('foo', fg=FG.BOLD_RED) |
|
0.46.4
by Martin
Move remaining formatting setup out of _file_grep and save a colour switch as a side effect |
2031 |
res = (FG.MAGENTA + 'file0.txt' |
0.43.11
by Parth Malwankar
test cases for colored results. |
2032 |
+ self._rev_sep + '1' + self._sep |
2033 |
+ foo + ' is ' + foo + 'bar1' + '\n') |
|
0.40.133
by Parth Malwankar
added test case to check --color=auto |
2034 |
txt_res = 'file0.txt~1:foo is foobar1\n' |
0.43.11
by Parth Malwankar
test cases for colored results. |
2035 |
|
0.46.4
by Martin
Move remaining formatting setup out of _file_grep and save a colour switch as a side effect |
2036 |
nres = (FG.MAGENTA + 'file0.txt' |
0.43.11
by Parth Malwankar
test cases for colored results. |
2037 |
+ self._rev_sep + '1' + self._sep + '1' + self._sep |
2038 |
+ foo + ' is ' + foo + 'bar1' + '\n') |
|
2039 |
||
2040 |
out, err = self.run_bzr(['grep', '--color', |
|
2041 |
'always', '-r', '1', 'foo']) |
|
2042 |
self.assertEqual(out, res) |
|
2043 |
self.assertEqual(len(out.splitlines()), 1) |
|
2044 |
||
0.40.133
by Parth Malwankar
added test case to check --color=auto |
2045 |
# auto should produce plain text result
|
2046 |
# as stdout is redireched here.
|
|
2047 |
out, err = self.run_bzr(['grep', '--color', |
|
2048 |
'auto', '-r', '1', 'foo']) |
|
2049 |
self.assertEqual(out, txt_res) |
|
2050 |
self.assertEqual(len(out.splitlines()), 1) |
|
2051 |
||
0.43.11
by Parth Malwankar
test cases for colored results. |
2052 |
out, err = self.run_bzr(['grep', '-i', '--color', |
2053 |
'always', '-r', '1', 'FOO']) |
|
2054 |
self.assertEqual(out, res) |
|
2055 |
self.assertEqual(len(out.splitlines()), 1) |
|
2056 |
||
2057 |
out, err = self.run_bzr(['grep', '--color', |
|
2058 |
'always', '-r', '1', 'f.o']) |
|
2059 |
self.assertEqual(out, res) |
|
2060 |
self.assertEqual(len(out.splitlines()), 1) |
|
2061 |
||
2062 |
out, err = self.run_bzr(['grep', '-i', '--color', |
|
2063 |
'always', '-r', '1', 'F.O']) |
|
2064 |
self.assertEqual(out, res) |
|
2065 |
self.assertEqual(len(out.splitlines()), 1) |
|
2066 |
||
2067 |
out, err = self.run_bzr(['grep', '-n', '--color', |
|
2068 |
'always', '-r', '1', 'foo']) |
|
2069 |
self.assertEqual(out, nres) |
|
2070 |
self.assertEqual(len(out.splitlines()), 1) |
|
2071 |
||
2072 |
out, err = self.run_bzr(['grep', '-n', '-i', '--color', |
|
2073 |
'always', '-r', '1', 'FOO']) |
|
2074 |
self.assertEqual(out, nres) |
|
2075 |
self.assertEqual(len(out.splitlines()), 1) |
|
2076 |
||
2077 |
out, err = self.run_bzr(['grep', '-n', '--color', |
|
2078 |
'always', '-r', '1', 'f.o']) |
|
2079 |
self.assertEqual(out, nres) |
|
2080 |
self.assertEqual(len(out.splitlines()), 1) |
|
2081 |
||
2082 |
out, err = self.run_bzr(['grep', '-n', '-i', '--color', |
|
2083 |
'always', '-r', '1', 'F.O']) |
|
2084 |
self.assertEqual(out, nres) |
|
2085 |
self.assertEqual(len(out.splitlines()), 1) |
|
2086 |
||
2087 |
def test_wtree_basic_file(self): |
|
2088 |
"""(wtree) Search for pattern in specfic file.
|
|
2089 |
"""
|
|
2090 |
wd = 'foobar0' |
|
2091 |
self.make_branch_and_tree(wd) |
|
2092 |
os.chdir(wd) |
|
2093 |
lp = 'foo is foobar' |
|
2094 |
self._mk_versioned_file('file0.txt', line_prefix=lp, total_lines=1) |
|
2095 |
||
2096 |
# prepare colored result
|
|
2097 |
foo = color_string('foo', fg=FG.BOLD_RED) |
|
0.46.4
by Martin
Move remaining formatting setup out of _file_grep and save a colour switch as a side effect |
2098 |
res = (FG.MAGENTA + 'file0.txt' |
0.43.11
by Parth Malwankar
test cases for colored results. |
2099 |
+ self._sep + foo + ' is ' + foo + 'bar1' + '\n') |
2100 |
||
0.46.4
by Martin
Move remaining formatting setup out of _file_grep and save a colour switch as a side effect |
2101 |
nres = (FG.MAGENTA + 'file0.txt' |
0.43.11
by Parth Malwankar
test cases for colored results. |
2102 |
+ self._sep + '1' + self._sep |
2103 |
+ foo + ' is ' + foo + 'bar1' + '\n') |
|
2104 |
||
2105 |
out, err = self.run_bzr(['grep', '--color', |
|
2106 |
'always', 'foo']) |
|
2107 |
self.assertEqual(out, res) |
|
2108 |
self.assertEqual(len(out.splitlines()), 1) |
|
2109 |
||
2110 |
out, err = self.run_bzr(['grep', '-i', '--color', |
|
2111 |
'always', 'FOO']) |
|
2112 |
self.assertEqual(out, res) |
|
2113 |
self.assertEqual(len(out.splitlines()), 1) |
|
2114 |
||
2115 |
out, err = self.run_bzr(['grep', '--color', |
|
2116 |
'always', 'f.o']) |
|
2117 |
self.assertEqual(out, res) |
|
2118 |
self.assertEqual(len(out.splitlines()), 1) |
|
2119 |
||
2120 |
out, err = self.run_bzr(['grep', '-i', '--color', |
|
2121 |
'always', 'F.O']) |
|
2122 |
self.assertEqual(out, res) |
|
2123 |
self.assertEqual(len(out.splitlines()), 1) |
|
2124 |
||
2125 |
out, err = self.run_bzr(['grep', '-n', '--color', |
|
2126 |
'always', 'foo']) |
|
2127 |
self.assertEqual(out, nres) |
|
2128 |
self.assertEqual(len(out.splitlines()), 1) |
|
2129 |
||
2130 |
out, err = self.run_bzr(['grep', '-n', '-i', '--color', |
|
2131 |
'always', 'FOO']) |
|
2132 |
self.assertEqual(out, nres) |
|
2133 |
self.assertEqual(len(out.splitlines()), 1) |
|
2134 |
||
2135 |
out, err = self.run_bzr(['grep', '-n', '--color', |
|
2136 |
'always', 'f.o']) |
|
2137 |
self.assertEqual(out, nres) |
|
2138 |
self.assertEqual(len(out.splitlines()), 1) |
|
2139 |
||
2140 |
out, err = self.run_bzr(['grep', '-n', '-i', '--color', |
|
2141 |
'always', 'F.O']) |
|
2142 |
self.assertEqual(out, nres) |
|
2143 |
self.assertEqual(len(out.splitlines()), 1) |
|
2144 |
||
0.48.9
by Parth Malwankar
added inital test for 'grep -p' |
2145 |
|
2146 |
# copied from bzrlib.tests.blackbox.test_diff
|
|
2147 |
def subst_dates(string): |
|
2148 |
"""Replace date strings with constant values."""
|
|
2149 |
return re.sub(r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} [-\+]\d{4}', |
|
2150 |
'YYYY-MM-DD HH:MM:SS +ZZZZ', string) |
|
2151 |
||
2152 |
||
2153 |
class TestGrepDiff(tests.TestCaseWithTransport): |
|
2154 |
||
2155 |
def make_example_branch(self): |
|
2156 |
tree = self.make_branch_and_tree('.') |
|
2157 |
self.build_tree_contents([ |
|
2158 |
('hello', 'foo\n'), |
|
2159 |
('goodbye', 'baz\n')]) |
|
2160 |
tree.add(['hello']) |
|
2161 |
tree.commit('setup') |
|
2162 |
tree.add(['goodbye']) |
|
2163 |
tree.commit('setup') |
|
2164 |
return tree |
|
2165 |
||
2166 |
def test_grep_diff_basic(self): |
|
2167 |
"""grep -p basic test."""
|
|
2168 |
tree = self.make_example_branch() |
|
2169 |
self.build_tree_contents([('hello', 'hello world!\n')]) |
|
2170 |
tree.commit('updated hello') |
|
2171 |
out, err = self.run_bzr(['grep', '-p', 'hello']) |
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
2172 |
self.assertEqual(err, '') |
0.48.9
by Parth Malwankar
added inital test for 'grep -p' |
2173 |
self.assertEqualDiff(subst_dates(out), '''\ |
0.48.10
by Parth Malwankar
more tests for 'grep --diff' |
2174 |
=== revno:3 ===
|
0.48.9
by Parth Malwankar
added inital test for 'grep -p' |
2175 |
=== modified file 'hello'
|
2176 |
--- hello YYYY-MM-DD HH:MM:SS +ZZZZ
|
|
2177 |
+++ hello YYYY-MM-DD HH:MM:SS +ZZZZ
|
|
2178 |
+hello world!
|
|
0.48.10
by Parth Malwankar
more tests for 'grep --diff' |
2179 |
=== revno:1 ===
|
0.48.9
by Parth Malwankar
added inital test for 'grep -p' |
2180 |
=== added file 'hello'
|
2181 |
--- hello YYYY-MM-DD HH:MM:SS +ZZZZ
|
|
2182 |
+++ hello YYYY-MM-DD HH:MM:SS +ZZZZ
|
|
2183 |
''') |
|
2184 |
||
0.48.10
by Parth Malwankar
more tests for 'grep --diff' |
2185 |
def test_grep_diff_revision(self): |
2186 |
"""grep -p specific revision."""
|
|
2187 |
tree = self.make_example_branch() |
|
2188 |
self.build_tree_contents([('hello', 'hello world!\n')]) |
|
2189 |
tree.commit('updated hello') |
|
2190 |
out, err = self.run_bzr(['grep', '-p', '-r', '3', 'hello']) |
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
2191 |
self.assertEqual(err, '') |
0.48.10
by Parth Malwankar
more tests for 'grep --diff' |
2192 |
self.assertEqualDiff(subst_dates(out), '''\ |
2193 |
=== revno:3 ===
|
|
2194 |
=== modified file 'hello'
|
|
2195 |
--- hello YYYY-MM-DD HH:MM:SS +ZZZZ
|
|
2196 |
+++ hello YYYY-MM-DD HH:MM:SS +ZZZZ
|
|
2197 |
+hello world!
|
|
2198 |
''') |
|
2199 |
||
2200 |
def test_grep_diff_revision_range(self): |
|
2201 |
"""grep -p revision range."""
|
|
2202 |
tree = self.make_example_branch() |
|
2203 |
self.build_tree_contents([('hello', 'hello world!1\n')]) # rev 3 |
|
2204 |
tree.commit('rev3') |
|
2205 |
self.build_tree_contents([('blah', 'hello world!2\n')]) # rev 4 |
|
2206 |
tree.add('blah') |
|
2207 |
tree.commit('rev4') |
|
2208 |
open('hello', 'a').write('hello world!3\n') |
|
2209 |
#self.build_tree_contents([('hello', 'hello world!3\n')]) # rev 5
|
|
2210 |
tree.commit('rev5') |
|
2211 |
out, err = self.run_bzr(['grep', '-p', '-r', '2..5', 'hello']) |
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
2212 |
self.assertEqual(err, '') |
0.48.10
by Parth Malwankar
more tests for 'grep --diff' |
2213 |
self.assertEqualDiff(subst_dates(out), '''\ |
2214 |
=== revno:5 ===
|
|
2215 |
=== modified file 'hello'
|
|
2216 |
--- hello YYYY-MM-DD HH:MM:SS +ZZZZ
|
|
2217 |
+++ hello YYYY-MM-DD HH:MM:SS +ZZZZ
|
|
2218 |
+hello world!3
|
|
2219 |
=== revno:4 ===
|
|
2220 |
=== added file 'blah'
|
|
2221 |
+hello world!2
|
|
2222 |
=== revno:3 ===
|
|
2223 |
=== modified file 'hello'
|
|
2224 |
--- hello YYYY-MM-DD HH:MM:SS +ZZZZ
|
|
2225 |
+++ hello YYYY-MM-DD HH:MM:SS +ZZZZ
|
|
2226 |
+hello world!1
|
|
2227 |
''') |
|
2228 |
||
2229 |
def test_grep_diff_color(self): |
|
2230 |
"""grep -p color test."""
|
|
2231 |
tree = self.make_example_branch() |
|
2232 |
self.build_tree_contents([('hello', 'hello world!\n')]) |
|
2233 |
tree.commit('updated hello') |
|
2234 |
out, err = self.run_bzr(['grep', '--diff', '-r', '3', |
|
2235 |
'--color', 'always', 'hello']) |
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
2236 |
self.assertEqual(err, '') |
0.48.10
by Parth Malwankar
more tests for 'grep --diff' |
2237 |
revno = color_string('=== revno:3 ===', fg=FG.BOLD_BLUE) + '\n' |
2238 |
filename = color_string(" === modified file 'hello'", fg=FG.BOLD_MAGENTA) + '\n' |
|
2239 |
redhello = color_string('hello', fg=FG.BOLD_RED) |
|
2240 |
diffstr = '''\ |
|
2241 |
--- hello YYYY-MM-DD HH:MM:SS +ZZZZ
|
|
2242 |
+++ hello YYYY-MM-DD HH:MM:SS +ZZZZ
|
|
2243 |
+hello world!
|
|
2244 |
'''
|
|
2245 |
diffstr = diffstr.replace('hello', redhello) |
|
2246 |
self.assertEqualDiff(subst_dates(out), revno + filename + diffstr) |
|
2247 |
||
2248 |
def test_grep_norevs(self): |
|
2249 |
"""grep -p with zero revisions."""
|
|
2250 |
out, err = self.run_bzr(['init']) |
|
2251 |
out, err = self.run_bzr(['grep', '--diff', 'foo'], 3) |
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
2252 |
self.assertEqual(out, '') |
0.48.10
by Parth Malwankar
more tests for 'grep --diff' |
2253 |
self.assertContainsRe(err, "ERROR:.*revision.* does not exist in branch") |
0.48.9
by Parth Malwankar
added inital test for 'grep -p' |
2254 |