bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
1 |
# Copyright (C) 2007 David Allouche <ddaa@ddaa.net>
|
|
0.358.2
by Jelmer Vernooij
Refresh copyright headers, add my email. |
2 |
# Copyright (C) 2007-2018 Jelmer Vernooij <jelmer@jelmer.uk>
|
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
3 |
#
|
4 |
# This program is free software; you can redistribute it and/or modify
|
|
5 |
# it under the terms of the GNU General Public License as published by
|
|
6 |
# the Free Software Foundation; either version 2 of the License, or
|
|
7 |
# (at your option) any later version.
|
|
8 |
#
|
|
9 |
# This program is distributed in the hope that it will be useful,
|
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
# GNU General Public License for more details.
|
|
13 |
#
|
|
14 |
# You should have received a copy of the GNU General Public License
|
|
15 |
# along with this program; if not, write to the Free Software
|
|
|
0.358.1
by Jelmer Vernooij
Fix FSF address. |
16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
17 |
|
18 |
"""Black-box tests for bzr-git."""
|
|
19 |
||
|
0.358.3
by Jelmer Vernooij
Enable absolute import. |
20 |
from __future__ import absolute_import |
21 |
||
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
22 |
from dulwich.repo import ( |
23 |
Repo as GitRepo, |
|
24 |
)
|
|
25 |
||
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
26 |
import os |
27 |
||
|
6986.2.1
by Jelmer Vernooij
Move breezy.plugins.git to breezy.git. |
28 |
from ...controldir import ( |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
29 |
ControlDir, |
|
0.200.769
by Jelmer Vernooij
Cope with open_branch() actually checking whether there is a branch present. |
30 |
)
|
31 |
||
|
6986.2.1
by Jelmer Vernooij
Move breezy.plugins.git to breezy.git. |
32 |
from ...tests.blackbox import ExternalBase |
|
7143.18.1
by Jelmer Vernooij
Fix 'bzr switch' in git repositories. |
33 |
from ...workingtree import WorkingTree |
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
34 |
|
|
0.200.1642
by Jelmer Vernooij
Use relative imports in tests. |
35 |
from .. import ( |
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
36 |
tests, |
37 |
)
|
|
|
7290.26.1
by Jelmer Vernooij
Fix switching in git repositories. |
38 |
from ...tests.script import TestCaseWithTransportAndScript |
|
7211.8.1
by Jelmer Vernooij
Fix stats in Python3 git repositories. |
39 |
from ...tests.features import PluginLoadedFeature |
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
40 |
|
41 |
||
42 |
class TestGitBlackBox(ExternalBase): |
|
43 |
||
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
44 |
def simple_commit(self): |
45 |
# Create a git repository with a revision.
|
|
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
46 |
repo = GitRepo.init(self.test_dir) |
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
47 |
builder = tests.GitBranchBuilder() |
|
7018.3.2
by Jelmer Vernooij
Fix some git tests. |
48 |
builder.set_file('a', b'text for a\n', False) |
49 |
r1 = builder.commit(b'Joe Foo <joe@foo.com>', u'<The commit message>') |
|
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
50 |
return repo, builder.finish()[r1] |
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
51 |
|
|
7473.1.1
by Jelmer Vernooij
Ignore --file-ids-from for trees that do not support file ids. |
52 |
def test_add(self): |
53 |
r = GitRepo.init(self.test_dir) |
|
54 |
dir = ControlDir.open(self.test_dir) |
|
55 |
dir.create_branch() |
|
56 |
self.build_tree(['a', 'b']) |
|
57 |
output, error = self.run_bzr(['add', 'a']) |
|
58 |
self.assertEqual('adding a\n', output) |
|
59 |
self.assertEqual('', error) |
|
60 |
output, error = self.run_bzr( |
|
61 |
['add', '--file-ids-from=../othertree', 'b']) |
|
62 |
self.assertEqual('adding b\n', output) |
|
63 |
self.assertEqual( |
|
64 |
'Ignoring --file-ids-from, since the tree does not support '
|
|
65 |
'setting file ids.\n', error) |
|
66 |
||
|
0.200.294
by Jelmer Vernooij
Add test for nick. |
67 |
def test_nick(self): |
|
0.200.1559
by Jelmer Vernooij
Fix compatibility with bzr 2.5. |
68 |
r = GitRepo.init(self.test_dir) |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
69 |
dir = ControlDir.open(self.test_dir) |
|
0.200.769
by Jelmer Vernooij
Cope with open_branch() actually checking whether there is a branch present. |
70 |
dir.create_branch() |
|
0.200.294
by Jelmer Vernooij
Add test for nick. |
71 |
output, error = self.run_bzr(['nick']) |
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
72 |
self.assertEqual("master\n", output) |
|
0.200.294
by Jelmer Vernooij
Add test for nick. |
73 |
|
|
0.327.1
by Jelmer Vernooij
Add test for branches command. |
74 |
def test_branches(self): |
75 |
self.simple_commit() |
|
76 |
output, error = self.run_bzr(['branches']) |
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
77 |
self.assertEqual("* master\n", output) |
|
0.327.1
by Jelmer Vernooij
Add test for branches command. |
78 |
|
|
0.200.68
by Jelmer Vernooij
Add blackbox test for info. |
79 |
def test_info(self): |
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
80 |
self.simple_commit() |
|
0.200.68
by Jelmer Vernooij
Add blackbox test for info. |
81 |
output, error = self.run_bzr(['info']) |
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
82 |
self.assertEqual(error, '') |
|
7211.9.1
by Jelmer Vernooij
Report colocated branch name in 'brz info'. |
83 |
self.assertEqual( |
|
7211.9.2
by Jelmer Vernooij
Fix formatting. |
84 |
output, |
85 |
'Standalone tree (format: git)\n' |
|
86 |
'Location:\n' |
|
87 |
' light checkout root: .\n' |
|
88 |
' checkout of co-located branch: master\n') |
|
|
0.200.68
by Jelmer Vernooij
Add blackbox test for info. |
89 |
|
|
7199.4.1
by Jelmer Vernooij
Fix 'brz ignore' in Git working trees. |
90 |
def test_ignore(self): |
91 |
self.simple_commit() |
|
92 |
output, error = self.run_bzr(['ignore', 'foo']) |
|
93 |
self.assertEqual(error, '') |
|
94 |
self.assertEqual(output, '') |
|
95 |
self.assertFileEqual("foo\n", ".gitignore") |
|
96 |
||
|
7290.7.1
by Jelmer Vernooij
Print proper error when running `brz cat-revision` on Git repositories. |
97 |
def test_cat_revision(self): |
98 |
self.simple_commit() |
|
99 |
output, error = self.run_bzr(['cat-revision', '-r-1'], retcode=3) |
|
100 |
self.assertContainsRe( |
|
101 |
error, |
|
102 |
'brz: ERROR: Repository .* does not support access to raw '
|
|
103 |
'revision texts') |
|
104 |
self.assertEqual(output, '') |
|
105 |
||
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
106 |
def test_branch(self): |
107 |
os.mkdir("gitbranch") |
|
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
108 |
GitRepo.init(os.path.join(self.test_dir, "gitbranch")) |
109 |
os.chdir('gitbranch') |
|
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
110 |
builder = tests.GitBranchBuilder() |
|
6964.2.1
by Jelmer Vernooij
Initial work to support brz-git on python3. |
111 |
builder.set_file(b'a', b'text for a\n', False) |
112 |
builder.commit(b'Joe Foo <joe@foo.com>', b'<The commit message>') |
|
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
113 |
builder.finish() |
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
114 |
os.chdir('..') |
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
115 |
|
116 |
output, error = self.run_bzr(['branch', 'gitbranch', 'bzrbranch']) |
|
|
0.200.1382
by Jelmer Vernooij
Fix test after i18n fixes in bzr.dev. |
117 |
self.assertTrue( |
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
118 |
(error == 'Branched 1 revision(s).\n') or |
119 |
(error == 'Branched 1 revision.\n'), |
|
|
0.200.1382
by Jelmer Vernooij
Fix test after i18n fixes in bzr.dev. |
120 |
error) |
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
121 |
|
|
0.200.1151
by Jelmer Vernooij
Update NEWS, add test for bug fixed earlier. |
122 |
def test_checkout(self): |
123 |
os.mkdir("gitbranch") |
|
124 |
GitRepo.init(os.path.join(self.test_dir, "gitbranch")) |
|
125 |
os.chdir('gitbranch') |
|
126 |
builder = tests.GitBranchBuilder() |
|
|
6964.2.1
by Jelmer Vernooij
Initial work to support brz-git on python3. |
127 |
builder.set_file(b'a', b'text for a\n', False) |
128 |
builder.commit(b'Joe Foo <joe@foo.com>', b'<The commit message>') |
|
|
0.200.1151
by Jelmer Vernooij
Update NEWS, add test for bug fixed earlier. |
129 |
builder.finish() |
130 |
os.chdir('..') |
|
131 |
||
132 |
output, error = self.run_bzr(['checkout', 'gitbranch', 'bzrbranch']) |
|
|
0.375.1
by Jelmer Vernooij
Fix remote tests, warn when fetching git->bzr and bzr->git. |
133 |
self.assertEqual(error, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
134 |
'Fetching from Git to Bazaar repository. '
|
135 |
'For better performance, fetch into a Git repository.\n') |
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
136 |
self.assertEqual(output, '') |
|
0.200.1151
by Jelmer Vernooij
Update NEWS, add test for bug fixed earlier. |
137 |
|
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
138 |
def test_branch_ls(self): |
|
0.200.78
by Jelmer Vernooij
Add blackbox test for ls. |
139 |
self.simple_commit() |
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
140 |
output, error = self.run_bzr(['ls', '-r-1']) |
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
141 |
self.assertEqual(error, '') |
142 |
self.assertEqual(output, "a\n") |
|
|
0.200.78
by Jelmer Vernooij
Add blackbox test for ls. |
143 |
|
|
0.200.108
by Jelmer Vernooij
Support bzr init --git. |
144 |
def test_init(self): |
|
0.200.1653
by Jelmer Vernooij
--git is now --format=git. |
145 |
self.run_bzr("init --format=git repo") |
|
0.200.108
by Jelmer Vernooij
Support bzr init --git. |
146 |
|
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
147 |
def test_info_verbose(self): |
148 |
self.simple_commit() |
|
149 |
||
150 |
output, error = self.run_bzr(['info', '-v']) |
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
151 |
self.assertEqual(error, '') |
152 |
self.assertTrue("Standalone tree (format: git)" in output) |
|
153 |
self.assertTrue("control: Local Git Repository" in output) |
|
154 |
self.assertTrue("branch: Local Git Branch" in output) |
|
155 |
self.assertTrue("repository: Git Repository" in output) |
|
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
156 |
|
|
0.200.1325
by Jelmer Vernooij
More test fixes. |
157 |
def test_push_roundtripping(self): |
|
0.267.1
by Martin
Don't raise the deprecated KnownFailure from tests |
158 |
self.knownFailure("roundtripping is not yet supported") |
|
0.200.1325
by Jelmer Vernooij
More test fixes. |
159 |
self.with_roundtripping() |
|
0.200.291
by Jelmer Vernooij
Print proper error about not supporting push. |
160 |
os.mkdir("bla") |
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
161 |
GitRepo.init(os.path.join(self.test_dir, "bla")) |
|
0.200.291
by Jelmer Vernooij
Print proper error about not supporting push. |
162 |
self.run_bzr(['init', 'foo']) |
163 |
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo']) |
|
|
0.200.1156
by Jelmer Vernooij
Disable push. |
164 |
# when roundtripping is supported
|
|
0.252.12
by Jelmer Vernooij
Fix push blackbox test. |
165 |
output, error = self.run_bzr(['push', '-d', 'foo', 'bla']) |
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
166 |
self.assertEqual(b"", output) |
167 |
self.assertTrue(error.endswith(b"Created new branch.\n")) |
|
|
0.200.291
by Jelmer Vernooij
Print proper error about not supporting push. |
168 |
|
|
7339.1.6
by Jelmer Vernooij
Also support revno-less push/pull operations. |
169 |
def test_push_without_calculate_revnos(self): |
170 |
self.run_bzr(['init', '--git', 'bla']) |
|
171 |
self.run_bzr(['init', '--git', 'foo']) |
|
172 |
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo']) |
|
173 |
output, error = self.run_bzr( |
|
174 |
['push', '-Ocalculate_revnos=no', '-d', 'foo', 'bla']) |
|
175 |
self.assertEqual("", output) |
|
176 |
self.assertContainsRe( |
|
177 |
error, |
|
|
7339.1.10
by Jelmer Vernooij
Fix test. |
178 |
'Pushed up to revision id git(.*).\n') |
|
7339.1.6
by Jelmer Vernooij
Also support revno-less push/pull operations. |
179 |
|
|
7296.4.1
by Jelmer Vernooij
Fix pushing non-mainline revisions from bzr to git. |
180 |
def test_push_lossy_non_mainline(self): |
181 |
self.run_bzr(['init', '--git', 'bla']) |
|
182 |
self.run_bzr(['init', 'foo']) |
|
183 |
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo']) |
|
184 |
self.run_bzr(['branch', 'foo', 'foo1']) |
|
185 |
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo1']) |
|
186 |
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo']) |
|
187 |
self.run_bzr(['merge', '-d', 'foo', 'foo1']) |
|
188 |
self.run_bzr(['commit', '--unchanged', '-m', 'merge', 'foo']) |
|
189 |
output, error = self.run_bzr(['push', '--lossy', '-r1.1.1', '-d', 'foo', 'bla']) |
|
|
7296.4.2
by Jelmer Vernooij
Fix test. |
190 |
self.assertEqual("", output) |
|
7296.4.1
by Jelmer Vernooij
Fix pushing non-mainline revisions from bzr to git. |
191 |
self.assertEqual( |
|
7296.4.2
by Jelmer Vernooij
Fix test. |
192 |
'Pushing from a Bazaar to a Git repository. For better '
|
193 |
'performance, push into a Bazaar repository.\n' |
|
|
7350.1.3
by Vincent Ladeuil
Fix test_push_lossy_non_mainline failure. |
194 |
'All changes applied successfully.\n' |
|
7296.4.2
by Jelmer Vernooij
Fix test. |
195 |
'Pushed up to revision 2.\n', error) |
|
7296.4.1
by Jelmer Vernooij
Fix pushing non-mainline revisions from bzr to git. |
196 |
|
|
7446.1.2
by Jelmer Vernooij
Fix working tree update of incremental lossy push. |
197 |
def test_push_lossy_non_mainline_incremental(self): |
198 |
self.run_bzr(['init', '--git', 'bla']) |
|
199 |
self.run_bzr(['init', 'foo']) |
|
200 |
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo']) |
|
201 |
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo']) |
|
202 |
output, error = self.run_bzr(['push', '--lossy', '-d', 'foo', 'bla']) |
|
203 |
self.assertEqual("", output) |
|
204 |
self.assertEqual( |
|
205 |
'Pushing from a Bazaar to a Git repository. For better '
|
|
206 |
'performance, push into a Bazaar repository.\n' |
|
207 |
'All changes applied successfully.\n' |
|
208 |
'Pushed up to revision 2.\n', error) |
|
209 |
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo']) |
|
210 |
output, error = self.run_bzr(['push', '--lossy', '-d', 'foo', 'bla']) |
|
211 |
self.assertEqual("", output) |
|
212 |
self.assertEqual( |
|
213 |
'Pushing from a Bazaar to a Git repository. For better '
|
|
214 |
'performance, push into a Bazaar repository.\n' |
|
215 |
'All changes applied successfully.\n' |
|
216 |
'Pushed up to revision 3.\n', error) |
|
217 |
||
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
218 |
def test_log(self): |
219 |
# Smoke test for "bzr log" in a git repository.
|
|
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
220 |
self.simple_commit() |
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
221 |
|
222 |
# Check that bzr log does not fail and includes the revision.
|
|
223 |
output, error = self.run_bzr(['log']) |
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
224 |
self.assertEqual(error, '') |
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
225 |
self.assertTrue( |
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
226 |
'<The commit message>' in output, |
227 |
"Commit message was not found in output:\n%s" % (output,)) |
|
|
0.200.80
by Jelmer Vernooij
Add blackbox test for bzr log -v. |
228 |
|
229 |
def test_log_verbose(self): |
|
230 |
# Smoke test for "bzr log -v" in a git repository.
|
|
231 |
self.simple_commit() |
|
232 |
||
233 |
# Check that bzr log does not fail and includes the revision.
|
|
234 |
output, error = self.run_bzr(['log', '-v']) |
|
|
7339.1.3
by Jelmer Vernooij
Support calculate_revnos option. |
235 |
self.assertContainsRe(output, 'revno: 1') |
236 |
||
237 |
def test_log_without_revno(self): |
|
238 |
# Smoke test for "bzr log -v" in a git repository.
|
|
239 |
self.simple_commit() |
|
240 |
||
241 |
# Check that bzr log does not fail and includes the revision.
|
|
242 |
output, error = self.run_bzr(['log', '-Ocalculate_revnos=no']) |
|
243 |
self.assertNotContainsRe(output, 'revno: 1') |
|
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
244 |
|
|
7339.1.4
by Jelmer Vernooij
Only display revnos in commit if calculate_revnos is enabled. |
245 |
def test_commit_without_revno(self): |
246 |
repo = GitRepo.init(self.test_dir) |
|
247 |
output, error = self.run_bzr( |
|
248 |
['commit', '-Ocalculate_revnos=yes', '--unchanged', '-m', 'one']) |
|
249 |
self.assertContainsRe(error, 'Committed revision 1.') |
|
250 |
output, error = self.run_bzr( |
|
251 |
['commit', '-Ocalculate_revnos=no', '--unchanged', '-m', 'two']) |
|
252 |
self.assertNotContainsRe(error, 'Committed revision 2.') |
|
253 |
self.assertContainsRe(error, 'Committed revid .*.') |
|
254 |
||
|
7290.36.1
by Jelmer Vernooij
Fix filegraph operations on Git. |
255 |
def test_log_file(self): |
256 |
# Smoke test for "bzr log" in a git repository.
|
|
257 |
repo = GitRepo.init(self.test_dir) |
|
258 |
builder = tests.GitBranchBuilder() |
|
259 |
builder.set_file('a', b'text for a\n', False) |
|
260 |
r1 = builder.commit(b'Joe Foo <joe@foo.com>', u'First') |
|
261 |
builder.set_file('a', b'text 3a for a\n', False) |
|
262 |
r2a = builder.commit(b'Joe Foo <joe@foo.com>', u'Second a', base=r1) |
|
263 |
builder.set_file('a', b'text 3b for a\n', False) |
|
264 |
r2b = builder.commit(b'Joe Foo <joe@foo.com>', u'Second b', base=r1) |
|
265 |
builder.set_file('a', b'text 4 for a\n', False) |
|
266 |
builder.commit(b'Joe Foo <joe@foo.com>', u'Third', merge=[r2a], base=r2b) |
|
267 |
builder.finish() |
|
268 |
||
269 |
# Check that bzr log does not fail and includes the revision.
|
|
270 |
output, error = self.run_bzr(['log', '-n2', 'a']) |
|
271 |
self.assertEqual(error, '') |
|
272 |
self.assertIn('Second a', output) |
|
273 |
self.assertIn('Second b', output) |
|
274 |
self.assertIn('First', output) |
|
275 |
self.assertIn('Third', output) |
|
276 |
||
|
0.200.83
by Jelmer Vernooij
Add blackbox test for 'bzr tags' |
277 |
def test_tags(self): |
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
278 |
git_repo, commit_sha1 = self.simple_commit() |
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
279 |
git_repo.refs[b"refs/tags/foo"] = commit_sha1 |
|
0.200.83
by Jelmer Vernooij
Add blackbox test for 'bzr tags' |
280 |
|
281 |
output, error = self.run_bzr(['tags']) |
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
282 |
self.assertEqual(error, '') |
283 |
self.assertEqual(output, "foo 1\n") |
|
|
0.200.83
by Jelmer Vernooij
Add blackbox test for 'bzr tags' |
284 |
|
|
0.200.85
by Jelmer Vernooij
Add test for creating new tags. |
285 |
def test_tag(self): |
286 |
self.simple_commit() |
|
287 |
||
288 |
output, error = self.run_bzr(["tag", "bar"]) |
|
289 |
||
|
0.258.1
by Max Bowsher
Make tests tolerant to bzr <= 2.2. |
290 |
# bzr <= 2.2 emits this message in the output stream
|
291 |
# bzr => 2.3 emits this message in the error stream
|
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
292 |
self.assertEqual(error + output, 'Created tag bar.\n') |
|
0.200.85
by Jelmer Vernooij
Add test for creating new tags. |
293 |
|
|
0.200.288
by Jelmer Vernooij
Add test for init-repo. |
294 |
def test_init_repo(self): |
|
0.200.1653
by Jelmer Vernooij
--git is now --format=git. |
295 |
output, error = self.run_bzr(["init", "--format=git", "bla.git"]) |
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
296 |
self.assertEqual(error, '') |
297 |
self.assertEqual(output, 'Created a standalone tree (format: git)\n') |
|
|
0.200.288
by Jelmer Vernooij
Add test for init-repo. |
298 |
|
|
0.200.1332
by Jelmer Vernooij
Add smoke test for 'bzr diff --format=git'. |
299 |
def test_diff_format(self): |
300 |
tree = self.make_branch_and_tree('.') |
|
301 |
self.build_tree(['a']) |
|
302 |
tree.add(['a']) |
|
303 |
output, error = self.run_bzr(['diff', '--format=git'], retcode=1) |
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
304 |
self.assertEqual(error, '') |
|
7290.27.1
by Vincent Ladeuil
Backport dulwich fix. |
305 |
# Some older versions of Dulwich (< 0.19.12) formatted diffs slightly
|
306 |
# differently.
|
|
|
7324.1.1
by Jelmer Vernooij
Fix compatibility with pre-0.19.12 versions of Dulwich. |
307 |
from dulwich import __version__ as dulwich_version |
308 |
if dulwich_version < (0, 19, 12): |
|
309 |
self.assertEqual(output, |
|
310 |
'diff --git /dev/null b/a\n' |
|
311 |
'old mode 0\n' |
|
312 |
'new mode 100644\n' |
|
313 |
'index 0000000..c197bd8 100644\n' |
|
314 |
'--- /dev/null\n' |
|
315 |
'+++ b/a\n' |
|
316 |
'@@ -0,0 +1 @@\n' |
|
317 |
'+contents of a\n') |
|
318 |
else: |
|
319 |
self.assertEqual(output, |
|
320 |
'diff --git a/a b/a\n' |
|
321 |
'old file mode 0\n' |
|
322 |
'new file mode 100644\n' |
|
323 |
'index 0000000..c197bd8 100644\n' |
|
324 |
'--- /dev/null\n' |
|
325 |
'+++ b/a\n' |
|
326 |
'@@ -0,0 +1 @@\n' |
|
327 |
'+contents of a\n') |
|
|
0.200.1450
by Jelmer Vernooij
Fix git-import after branch refactoring. |
328 |
|
|
0.200.1609
by Jelmer Vernooij
Only create colocated branches in git-import if the --colocated option is specified. |
329 |
def test_git_import_uncolocated(self): |
330 |
r = GitRepo.init("a", mkdir=True) |
|
331 |
self.build_tree(["a/file"]) |
|
332 |
r.stage("file") |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
333 |
r.do_commit(ref=b"refs/heads/abranch", |
334 |
committer=b"Joe <joe@example.com>", message=b"Dummy") |
|
335 |
r.do_commit(ref=b"refs/heads/bbranch", |
|
336 |
committer=b"Joe <joe@example.com>", message=b"Dummy") |
|
|
0.200.1609
by Jelmer Vernooij
Only create colocated branches in git-import if the --colocated option is specified. |
337 |
self.run_bzr(["git-import", "a", "b"]) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
338 |
self.assertEqual( |
339 |
set([".bzr", "abranch", "bbranch"]), set(os.listdir("b"))) |
|
|
0.200.1609
by Jelmer Vernooij
Only create colocated branches in git-import if the --colocated option is specified. |
340 |
|
|
0.200.1450
by Jelmer Vernooij
Fix git-import after branch refactoring. |
341 |
def test_git_import(self): |
342 |
r = GitRepo.init("a", mkdir=True) |
|
343 |
self.build_tree(["a/file"]) |
|
344 |
r.stage("file") |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
345 |
r.do_commit(ref=b"refs/heads/abranch", |
346 |
committer=b"Joe <joe@example.com>", message=b"Dummy") |
|
347 |
r.do_commit(ref=b"refs/heads/bbranch", |
|
348 |
committer=b"Joe <joe@example.com>", message=b"Dummy") |
|
|
0.200.1609
by Jelmer Vernooij
Only create colocated branches in git-import if the --colocated option is specified. |
349 |
self.run_bzr(["git-import", "--colocated", "a", "b"]) |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
350 |
self.assertEqual(set([".bzr"]), set(os.listdir("b"))) |
351 |
self.assertEqual(set(["abranch", "bbranch"]), |
|
|
7490.13.2
by Jelmer Vernooij
Fix reference handling. |
352 |
set(ControlDir.open("b").branch_names())) |
|
0.200.1451
by Jelmer Vernooij
Add some more tests for git-import. |
353 |
|
354 |
def test_git_import_incremental(self): |
|
355 |
r = GitRepo.init("a", mkdir=True) |
|
356 |
self.build_tree(["a/file"]) |
|
357 |
r.stage("file") |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
358 |
r.do_commit(ref=b"refs/heads/abranch", |
359 |
committer=b"Joe <joe@example.com>", message=b"Dummy") |
|
|
0.200.1609
by Jelmer Vernooij
Only create colocated branches in git-import if the --colocated option is specified. |
360 |
self.run_bzr(["git-import", "--colocated", "a", "b"]) |
361 |
self.run_bzr(["git-import", "--colocated", "a", "b"]) |
|
|
6964.2.3
by Jelmer Vernooij
Review comments. |
362 |
self.assertEqual(set([".bzr"]), set(os.listdir("b"))) |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
363 |
b = ControlDir.open("b") |
|
7490.13.2
by Jelmer Vernooij
Fix reference handling. |
364 |
self.assertEqual(["abranch"], b.branch_names()) |
|
0.200.1451
by Jelmer Vernooij
Add some more tests for git-import. |
365 |
|
366 |
def test_git_import_tags(self): |
|
367 |
r = GitRepo.init("a", mkdir=True) |
|
368 |
self.build_tree(["a/file"]) |
|
369 |
r.stage("file") |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
370 |
cid = r.do_commit(ref=b"refs/heads/abranch", |
371 |
committer=b"Joe <joe@example.com>", message=b"Dummy") |
|
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
372 |
r[b"refs/tags/atag"] = cid |
|
0.200.1609
by Jelmer Vernooij
Only create colocated branches in git-import if the --colocated option is specified. |
373 |
self.run_bzr(["git-import", "--colocated", "a", "b"]) |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
374 |
self.assertEqual(set([".bzr"]), set(os.listdir("b"))) |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
375 |
b = ControlDir.open("b") |
|
7490.13.6
by Jelmer Vernooij
Fix tests. |
376 |
self.assertEqual(["abranch"], b.branch_names()) |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
377 |
self.assertEqual(["atag"], |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
378 |
list(b.open_branch("abranch").tags.get_tag_dict().keys())) |
|
0.200.1452
by Jelmer Vernooij
Support colocated branches in 'bzr git-import', flatten namespace. |
379 |
|
380 |
def test_git_import_colo(self): |
|
381 |
r = GitRepo.init("a", mkdir=True) |
|
382 |
self.build_tree(["a/file"]) |
|
383 |
r.stage("file") |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
384 |
r.do_commit(ref=b"refs/heads/abranch", |
385 |
committer=b"Joe <joe@example.com>", message=b"Dummy") |
|
386 |
r.do_commit(ref=b"refs/heads/bbranch", |
|
387 |
committer=b"Joe <joe@example.com>", message=b"Dummy") |
|
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
388 |
self.make_controldir("b", format="development-colo") |
|
0.200.1609
by Jelmer Vernooij
Only create colocated branches in git-import if the --colocated option is specified. |
389 |
self.run_bzr(["git-import", "--colocated", "a", "b"]) |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
390 |
self.assertEqual( |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
391 |
set([b.name for b in ControlDir.open("b").list_branches()]), |
|
0.200.1501
by Jelmer Vernooij
Provide ControlDir.get_branches. |
392 |
set(["abranch", "bbranch"])) |
|
0.200.1521
by Jelmer Vernooij
Fix git-refs command. |
393 |
|
394 |
def test_git_refs_from_git(self): |
|
395 |
r = GitRepo.init("a", mkdir=True) |
|
396 |
self.build_tree(["a/file"]) |
|
397 |
r.stage("file") |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
398 |
cid = r.do_commit(ref=b"refs/heads/abranch", |
399 |
committer=b"Joe <joe@example.com>", message=b"Dummy") |
|
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
400 |
r[b"refs/tags/atag"] = cid |
|
0.200.1521
by Jelmer Vernooij
Fix git-refs command. |
401 |
(stdout, stderr) = self.run_bzr(["git-refs", "a"]) |
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
402 |
self.assertEqual(stderr, "") |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
403 |
self.assertEqual(stdout, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
404 |
'refs/heads/abranch -> ' + cid.decode('ascii') + '\n' |
405 |
'refs/tags/atag -> ' + cid.decode('ascii') + '\n') |
|
|
0.200.1521
by Jelmer Vernooij
Fix git-refs command. |
406 |
|
407 |
def test_git_refs_from_bzr(self): |
|
408 |
tree = self.make_branch_and_tree('a') |
|
409 |
self.build_tree(["a/file"]) |
|
410 |
tree.add(["file"]) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
411 |
revid = tree.commit( |
412 |
committer=b"Joe <joe@example.com>", message=b"Dummy") |
|
|
0.200.1521
by Jelmer Vernooij
Fix git-refs command. |
413 |
tree.branch.tags.set_tag("atag", revid) |
414 |
(stdout, stderr) = self.run_bzr(["git-refs", "a"]) |
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
415 |
self.assertEqual(stderr, "") |
416 |
self.assertTrue("refs/tags/atag -> " in stdout) |
|
417 |
self.assertTrue("HEAD -> " in stdout) |
|
|
0.200.1591
by Jelmer Vernooij
Add basic test for dpush. |
418 |
|
|
0.425.1
by Jelmer Vernooij
Add really basic check implementation. |
419 |
def test_check(self): |
420 |
r = GitRepo.init("gitr", mkdir=True) |
|
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
421 |
self.build_tree_contents([("gitr/foo", b"hello from git")]) |
|
0.425.1
by Jelmer Vernooij
Add really basic check implementation. |
422 |
r.stage("foo") |
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
423 |
r.do_commit(b"message", committer=b"Somebody <user@example.com>") |
|
0.425.1
by Jelmer Vernooij
Add really basic check implementation. |
424 |
out, err = self.run_bzr(["check", "gitr"]) |
425 |
self.maxDiff = None |
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
426 |
self.assertEqual(out, '') |
427 |
self.assertTrue(err.endswith, '3 objects\n') |
|
|
6965.1.2
by Jelmer Vernooij
Add test. |
428 |
|
|
7490.11.1
by Jelmer Vernooij
Support reading user identity from .git/config in git repositories. |
429 |
def test_local_whoami(self): |
430 |
r = GitRepo.init("gitr", mkdir=True) |
|
431 |
self.build_tree_contents([('gitr/.git/config', """\ |
|
432 |
[user]
|
|
433 |
email = some@example.com
|
|
434 |
name = Test User
|
|
435 |
""")]) |
|
436 |
out, err = self.run_bzr(["whoami", "-d", "gitr"]) |
|
437 |
self.assertEqual(out, "Test User <some@example.com>\n") |
|
438 |
self.assertEqual(err, "") |
|
439 |
||
440 |
self.build_tree_contents([('gitr/.git/config', """\ |
|
441 |
[user]
|
|
442 |
email = some@example.com
|
|
443 |
""")]) |
|
444 |
out, err = self.run_bzr(["whoami", "-d", "gitr"]) |
|
445 |
self.assertEqual(out, "some@example.com\n") |
|
446 |
self.assertEqual(err, "") |
|
447 |
||
|
7490.12.1
by Jelmer Vernooij
Support user.signingkey. |
448 |
def test_local_signing_key(self): |
449 |
r = GitRepo.init("gitr", mkdir=True) |
|
450 |
self.build_tree_contents([('gitr/.git/config', """\ |
|
451 |
[user]
|
|
452 |
email = some@example.com
|
|
453 |
name = Test User
|
|
454 |
signingkey = D729A457
|
|
455 |
""")]) |
|
456 |
out, err = self.run_bzr(["config", "-d", "gitr", "gpg_signing_key"]) |
|
457 |
self.assertEqual(out, "D729A457\n") |
|
458 |
self.assertEqual(err, "") |
|
459 |
||
|
6968.1.1
by Jelmer Vernooij
Support 'bzr version-info' in horizon branches. |
460 |
|
461 |
class ShallowTests(ExternalBase): |
|
462 |
||
463 |
def setUp(self): |
|
464 |
super(ShallowTests, self).setUp() |
|
465 |
# Smoke test for "bzr log" in a git repository with shallow depth.
|
|
466 |
self.repo = GitRepo.init('gitr', mkdir=True) |
|
|
7018.3.2
by Jelmer Vernooij
Fix some git tests. |
467 |
self.build_tree_contents([("gitr/foo", b"hello from git")]) |
|
6968.1.1
by Jelmer Vernooij
Support 'bzr version-info' in horizon branches. |
468 |
self.repo.stage("foo") |
469 |
self.repo.do_commit( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
470 |
b"message", committer=b"Somebody <user@example.com>", |
|
7268.1.1
by Jelmer Vernooij
Fix compatibility with newer versions of Dulwich. |
471 |
author=b"Somebody <user@example.com>", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
472 |
commit_timestamp=1526330165, commit_timezone=0, |
473 |
author_timestamp=1526330165, author_timezone=0, |
|
474 |
merge_heads=[b'aa' * 20]) |
|
|
6968.1.1
by Jelmer Vernooij
Support 'bzr version-info' in horizon branches. |
475 |
|
|
6965.1.2
by Jelmer Vernooij
Add test. |
476 |
def test_log_shallow(self): |
477 |
# Check that bzr log does not fail and includes the revision.
|
|
478 |
output, error = self.run_bzr(['log', 'gitr'], retcode=3) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
479 |
self.assertEqual( |
480 |
error, 'brz: ERROR: Further revision history missing.\n') |
|
|
6965.1.2
by Jelmer Vernooij
Add test. |
481 |
self.assertEqual(output, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
482 |
'------------------------------------------------------------\n' |
483 |
'revision-id: git-v1:' + self.repo.head().decode('ascii') + '\n' |
|
484 |
'git commit: ' + self.repo.head().decode('ascii') + '\n' |
|
485 |
'committer: Somebody <user@example.com>\n' |
|
486 |
'timestamp: Mon 2018-05-14 20:36:05 +0000\n' |
|
487 |
'message:\n' |
|
488 |
' message\n') |
|
|
6968.1.1
by Jelmer Vernooij
Support 'bzr version-info' in horizon branches. |
489 |
|
490 |
def test_version_info_rio(self): |
|
491 |
output, error = self.run_bzr(['version-info', '--rio', 'gitr']) |
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
492 |
self.assertEqual(error, '') |
493 |
self.assertNotIn('revno:', output) |
|
|
6968.1.1
by Jelmer Vernooij
Support 'bzr version-info' in horizon branches. |
494 |
|
495 |
def test_version_info_python(self): |
|
496 |
output, error = self.run_bzr(['version-info', '--python', 'gitr']) |
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
497 |
self.assertEqual(error, '') |
498 |
self.assertNotIn('revno:', output) |
|
|
6968.1.1
by Jelmer Vernooij
Support 'bzr version-info' in horizon branches. |
499 |
|
500 |
def test_version_info_custom_with_revno(self): |
|
501 |
output, error = self.run_bzr( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
502 |
['version-info', '--custom', |
503 |
'--template=VERSION_INFO r{revno})\n', 'gitr'], retcode=3) |
|
504 |
self.assertEqual( |
|
505 |
error, 'brz: ERROR: Variable {revno} is not available.\n') |
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
506 |
self.assertEqual(output, 'VERSION_INFO r') |
|
6968.1.1
by Jelmer Vernooij
Support 'bzr version-info' in horizon branches. |
507 |
|
508 |
def test_version_info_custom_without_revno(self): |
|
509 |
output, error = self.run_bzr( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
510 |
['version-info', '--custom', '--template=VERSION_INFO \n', |
511 |
'gitr']) |
|
|
7027.4.1
by Jelmer Vernooij
Use StringIOWithEncoding on Python3. |
512 |
self.assertEqual(error, '') |
513 |
self.assertEqual(output, 'VERSION_INFO \n') |
|
|
7143.17.1
by Jelmer Vernooij
Fix grep in git working trees. |
514 |
|
515 |
||
|
7143.18.1
by Jelmer Vernooij
Fix 'bzr switch' in git repositories. |
516 |
class SwitchTests(ExternalBase): |
517 |
||
518 |
def test_switch_branch(self): |
|
519 |
# Create a git repository with a revision.
|
|
520 |
repo = GitRepo.init(self.test_dir) |
|
521 |
builder = tests.GitBranchBuilder() |
|
522 |
builder.set_branch(b'refs/heads/oldbranch') |
|
523 |
builder.set_file('a', b'text for a\n', False) |
|
524 |
builder.commit(b'Joe Foo <joe@foo.com>', u'<The commit message>') |
|
525 |
builder.set_branch(b'refs/heads/newbranch') |
|
526 |
builder.reset() |
|
527 |
builder.set_file('a', b'text for new a\n', False) |
|
528 |
builder.commit(b'Joe Foo <joe@foo.com>', u'<The commit message>') |
|
529 |
builder.finish() |
|
530 |
||
531 |
repo.refs.set_symbolic_ref(b'HEAD', b'refs/heads/newbranch') |
|
532 |
||
533 |
repo.reset_index() |
|
534 |
||
535 |
output, error = self.run_bzr('switch oldbranch') |
|
536 |
self.assertEqual(output, '') |
|
537 |
self.assertTrue(error.startswith('Updated to revision 1.\n'), error) |
|
538 |
||
539 |
self.assertFileEqual("text for a\n", 'a') |
|
540 |
tree = WorkingTree.open('.') |
|
541 |
with tree.lock_read(): |
|
542 |
basis_tree = tree.basis_tree() |
|
543 |
with basis_tree.lock_read(): |
|
544 |
self.assertEqual([], list(tree.iter_changes(basis_tree))) |
|
|
7143.18.2
by Jelmer Vernooij
Merge trunk. |
545 |
|
|
7404.5.1
by Jelmer Vernooij
Support checking out nested trees, including for git repositories. |
546 |
def test_branch_with_nested_trees(self): |
547 |
orig = self.make_branch_and_tree('source', format='git') |
|
548 |
subtree = self.make_branch_and_tree('source/subtree', format='git') |
|
549 |
self.build_tree(['source/subtree/a']) |
|
550 |
self.build_tree_contents([('source/.gitmodules', """\ |
|
551 |
[submodule "subtree"]
|
|
552 |
path = subtree
|
|
553 |
url = %s |
|
554 |
""" % subtree.user_url)]) |
|
555 |
subtree.add(['a']) |
|
556 |
subtree.commit('add subtree contents') |
|
557 |
orig.add_reference(subtree) |
|
558 |
orig.add(['.gitmodules']) |
|
559 |
orig.commit('add subtree') |
|
560 |
||
561 |
self.run_bzr('branch source target') |
|
562 |
||
563 |
target = WorkingTree.open('target') |
|
564 |
target_subtree = WorkingTree.open('target/subtree') |
|
565 |
self.assertTreesEqual(orig, target) |
|
566 |
self.assertTreesEqual(subtree, target_subtree) |
|
567 |
||
|
7143.18.2
by Jelmer Vernooij
Merge trunk. |
568 |
|
|
7290.26.1
by Jelmer Vernooij
Fix switching in git repositories. |
569 |
class SwitchScriptTests(TestCaseWithTransportAndScript): |
570 |
||
571 |
def test_switch_preserves(self): |
|
572 |
# See https://bugs.launchpad.net/brz/+bug/1820606
|
|
573 |
self.run_script(""" |
|
574 |
$ brz init --git r
|
|
575 |
Created a standalone tree (format: git)
|
|
576 |
$ cd r
|
|
577 |
$ echo original > file.txt
|
|
578 |
$ brz add
|
|
579 |
adding file.txt
|
|
580 |
$ brz ci -q -m "Initial"
|
|
581 |
$ echo "entered on master branch" > file.txt
|
|
582 |
$ brz stat
|
|
583 |
modified:
|
|
584 |
file.txt
|
|
585 |
$ brz switch -b other
|
|
586 |
2>Tree is up to date at revision 1.
|
|
587 |
2>Switched to branch other
|
|
588 |
$ cat file.txt
|
|
589 |
entered on master branch
|
|
590 |
""") |
|
591 |
||
592 |
||
|
7143.17.1
by Jelmer Vernooij
Fix grep in git working trees. |
593 |
class GrepTests(ExternalBase): |
594 |
||
595 |
def test_simple_grep(self): |
|
596 |
tree = self.make_branch_and_tree('.', format='git') |
|
597 |
self.build_tree_contents([('a', 'text for a\n')]) |
|
598 |
tree.add(['a']) |
|
599 |
output, error = self.run_bzr('grep text') |
|
600 |
self.assertEqual(output, 'a:text for a\n') |
|
601 |
self.assertEqual(error, '') |
|
|
7211.8.1
by Jelmer Vernooij
Fix stats in Python3 git repositories. |
602 |
|
603 |
||
|
7206.6.4
by Jelmer Vernooij
Move reconcile logic to breezy.bzr.reconcile. |
604 |
class ReconcileTests(ExternalBase): |
605 |
||
606 |
def test_simple_reconcile(self): |
|
607 |
tree = self.make_branch_and_tree('.', format='git') |
|
608 |
self.build_tree_contents([('a', 'text for a\n')]) |
|
609 |
tree.add(['a']) |
|
610 |
output, error = self.run_bzr('reconcile') |
|
611 |
self.assertContainsRe( |
|
612 |
output, |
|
613 |
'Reconciling branch file://.*\n' |
|
614 |
'Reconciling repository file://.*\n' |
|
615 |
'Reconciliation complete.\n') |
|
616 |
self.assertEqual(error, '') |
|
|
7206.6.6
by Jelmer Vernooij
Merge trunk. |
617 |
|
618 |
||
|
7211.10.1
by Jelmer Vernooij
Add test for status with an empty dir. |
619 |
class StatusTests(ExternalBase): |
620 |
||
621 |
def test_empty_dir(self): |
|
622 |
tree = self.make_branch_and_tree('.', format='git') |
|
623 |
self.build_tree(['a/', 'a/foo']) |
|
624 |
self.build_tree_contents([('.gitignore', 'foo\n')]) |
|
625 |
tree.add(['.gitignore']) |
|
626 |
tree.commit('add ignore') |
|
627 |
output, error = self.run_bzr('st') |
|
|
7211.10.5
by Jelmer Vernooij
Fix handling of directories. |
628 |
self.assertEqual(output, '') |
|
7211.10.1
by Jelmer Vernooij
Add test for status with an empty dir. |
629 |
self.assertEqual(error, '') |
|
7211.10.6
by Jelmer Vernooij
Merge trunk. |
630 |
|
631 |
||
|
7211.8.1
by Jelmer Vernooij
Fix stats in Python3 git repositories. |
632 |
class StatsTests(ExternalBase): |
633 |
||
634 |
def test_simple_stats(self): |
|
635 |
self.requireFeature(PluginLoadedFeature('stats')) |
|
636 |
tree = self.make_branch_and_tree('.', format='git') |
|
637 |
self.build_tree_contents([('a', 'text for a\n')]) |
|
638 |
tree.add(['a']) |
|
639 |
tree.commit('a commit', committer='Somebody <somebody@example.com>') |
|
640 |
output, error = self.run_bzr('stats') |
|
641 |
self.assertEqual(output, ' 1 Somebody <somebody@example.com>\n') |
|
|
7233.2.1
by Jelmer Vernooij
Fix import for git-objects. |
642 |
|
643 |
||
644 |
class GitObjectsTests(ExternalBase): |
|
645 |
||
646 |
def run_simple(self, format): |
|
647 |
tree = self.make_branch_and_tree('.', format=format) |
|
648 |
self.build_tree(['a/', 'a/foo']) |
|
649 |
tree.add(['a']) |
|
650 |
tree.commit('add a') |
|
651 |
output, error = self.run_bzr('git-objects') |
|
652 |
shas = list(output.splitlines()) |
|
653 |
self.assertEqual([40, 40], [len(s) for s in shas]) |
|
654 |
self.assertEqual(error, '') |
|
655 |
||
656 |
output, error = self.run_bzr('git-object %s' % shas[0]) |
|
657 |
self.assertEqual('', error) |
|
658 |
||
659 |
def test_in_native(self): |
|
660 |
self.run_simple(format='git') |
|
661 |
||
662 |
def test_in_bzr(self): |
|
663 |
self.run_simple(format='2a') |
|
|
7268.7.1
by Jelmer Vernooij
Fix git-apply. |
664 |
|
665 |
||
666 |
class GitApplyTests(ExternalBase): |
|
667 |
||
668 |
def test_apply(self): |
|
669 |
b = self.make_branch_and_tree('.') |
|
670 |
||
671 |
with open('foo.patch', 'w') as f: |
|
672 |
f.write("""\ |
|
673 |
From bdefb25fab801e6af0a70e965f60cb48f2b759fa Mon Sep 17 00:00:00 2001
|
|
674 |
From: Dmitry Bogatov <KAction@debian.org>
|
|
675 |
Date: Fri, 8 Feb 2019 23:28:30 +0000
|
|
676 |
Subject: [PATCH] Add fixed for out-of-date-standards-version
|
|
677 |
||
678 |
---
|
|
679 |
message | 3 +++
|
|
680 |
1 files changed, 14 insertions(+)
|
|
681 |
create mode 100644 message
|
|
682 |
||
683 |
diff --git a/message b/message
|
|
684 |
new file mode 100644
|
|
685 |
index 0000000..05ec0b1
|
|
686 |
--- /dev/null
|
|
687 |
+++ b/message
|
|
688 |
@@ -0,0 +1,3 @@
|
|
689 |
+Update standards version, no changes needed.
|
|
690 |
+Certainty: certain
|
|
691 |
+Fixed-Lintian-Tags: out-of-date-standards-version
|
|
692 |
""") |
|
693 |
output, error = self.run_bzr('git-apply foo.patch') |
|
694 |
self.assertContainsRe( |
|
695 |
error, |
|
696 |
'Committing to: .*\n' |
|
697 |
'Committed revision 1.\n') |