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