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 |
||
|
0.200.1642
by Jelmer Vernooij
Use relative imports in tests. |
28 |
from .... import ( |
|
0.200.1646
by Jelmer Vernooij
Rename bzrlib to breezy. |
29 |
version_info as breezy_version, |
|
0.200.1267
by Jelmer Vernooij
Disable test on 2.3 which is known failing. |
30 |
)
|
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
31 |
from ....controldir import ( |
32 |
ControlDir, |
|
|
0.200.769
by Jelmer Vernooij
Cope with open_branch() actually checking whether there is a branch present. |
33 |
)
|
34 |
||
|
0.200.1642
by Jelmer Vernooij
Use relative imports in tests. |
35 |
from ....tests.blackbox import ExternalBase |
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
36 |
|
|
0.200.1642
by Jelmer Vernooij
Use relative imports in tests. |
37 |
from .. import ( |
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
38 |
tests, |
39 |
)
|
|
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 |
|
|
0.200.294
by Jelmer Vernooij
Add test for nick. |
52 |
def test_nick(self): |
|
0.200.1559
by Jelmer Vernooij
Fix compatibility with bzr 2.5. |
53 |
r = GitRepo.init(self.test_dir) |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
54 |
dir = ControlDir.open(self.test_dir) |
|
0.200.769
by Jelmer Vernooij
Cope with open_branch() actually checking whether there is a branch present. |
55 |
dir.create_branch() |
|
0.200.294
by Jelmer Vernooij
Add test for nick. |
56 |
output, error = self.run_bzr(['nick']) |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
57 |
self.assertEqual(b"master\n", output) |
|
0.200.294
by Jelmer Vernooij
Add test for nick. |
58 |
|
|
0.327.1
by Jelmer Vernooij
Add test for branches command. |
59 |
def test_branches(self): |
60 |
self.simple_commit() |
|
61 |
output, error = self.run_bzr(['branches']) |
|
|
6964.2.3
by Jelmer Vernooij
Review comments. |
62 |
self.assertEqual(b"* master\n", output) |
|
0.327.1
by Jelmer Vernooij
Add test for branches command. |
63 |
|
|
0.200.68
by Jelmer Vernooij
Add blackbox test for info. |
64 |
def test_info(self): |
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
65 |
self.simple_commit() |
|
0.200.68
by Jelmer Vernooij
Add blackbox test for info. |
66 |
output, error = self.run_bzr(['info']) |
|
7018.3.2
by Jelmer Vernooij
Fix some git tests. |
67 |
self.assertEqual(error, b'') |
|
6964.2.1
by Jelmer Vernooij
Initial work to support brz-git on python3. |
68 |
self.assertTrue(b"Standalone tree (format: git)" in output) |
|
0.200.68
by Jelmer Vernooij
Add blackbox test for info. |
69 |
|
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
70 |
def test_branch(self): |
71 |
os.mkdir("gitbranch") |
|
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
72 |
GitRepo.init(os.path.join(self.test_dir, "gitbranch")) |
73 |
os.chdir('gitbranch') |
|
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
74 |
builder = tests.GitBranchBuilder() |
|
6964.2.1
by Jelmer Vernooij
Initial work to support brz-git on python3. |
75 |
builder.set_file(b'a', b'text for a\n', False) |
76 |
builder.commit(b'Joe Foo <joe@foo.com>', b'<The commit message>') |
|
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
77 |
builder.finish() |
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
78 |
os.chdir('..') |
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
79 |
|
80 |
output, error = self.run_bzr(['branch', 'gitbranch', 'bzrbranch']) |
|
|
0.200.1382
by Jelmer Vernooij
Fix test after i18n fixes in bzr.dev. |
81 |
self.assertTrue( |
|
6964.2.1
by Jelmer Vernooij
Initial work to support brz-git on python3. |
82 |
(error == b'Branched 1 revision(s).\n') or |
83 |
(error == b'Branched 1 revision.\n'), |
|
|
0.200.1382
by Jelmer Vernooij
Fix test after i18n fixes in bzr.dev. |
84 |
error) |
|
0.200.89
by Jelmer Vernooij
Support sprouting branches. |
85 |
|
|
0.200.1151
by Jelmer Vernooij
Update NEWS, add test for bug fixed earlier. |
86 |
def test_checkout(self): |
87 |
os.mkdir("gitbranch") |
|
88 |
GitRepo.init(os.path.join(self.test_dir, "gitbranch")) |
|
89 |
os.chdir('gitbranch') |
|
90 |
builder = tests.GitBranchBuilder() |
|
|
6964.2.1
by Jelmer Vernooij
Initial work to support brz-git on python3. |
91 |
builder.set_file(b'a', b'text for a\n', False) |
92 |
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. |
93 |
builder.finish() |
94 |
os.chdir('..') |
|
95 |
||
96 |
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. |
97 |
self.assertEqual(error, |
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
98 |
b'Fetching from Git to Bazaar repository. ' |
99 |
b'For better performance, fetch into a Git repository.\n') |
|
100 |
self.assertEqual(output, b'') |
|
|
0.200.1151
by Jelmer Vernooij
Update NEWS, add test for bug fixed earlier. |
101 |
|
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
102 |
def test_branch_ls(self): |
|
0.200.78
by Jelmer Vernooij
Add blackbox test for ls. |
103 |
self.simple_commit() |
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
104 |
output, error = self.run_bzr(['ls', '-r-1']) |
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
105 |
self.assertEqual(error, b'') |
106 |
self.assertEqual(output, b"a\n") |
|
|
0.200.78
by Jelmer Vernooij
Add blackbox test for ls. |
107 |
|
|
0.200.108
by Jelmer Vernooij
Support bzr init --git. |
108 |
def test_init(self): |
|
0.200.1653
by Jelmer Vernooij
--git is now --format=git. |
109 |
self.run_bzr("init --format=git repo") |
|
0.200.108
by Jelmer Vernooij
Support bzr init --git. |
110 |
|
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
111 |
def test_info_verbose(self): |
112 |
self.simple_commit() |
|
113 |
||
114 |
output, error = self.run_bzr(['info', '-v']) |
|
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
115 |
self.assertEqual(error, b'') |
116 |
self.assertTrue(b"Standalone tree (format: git)" in output) |
|
117 |
self.assertTrue(b"control: Local Git Repository" in output) |
|
118 |
self.assertTrue(b"branch: Local Git Branch" in output) |
|
119 |
self.assertTrue(b"repository: Git Repository" in output) |
|
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
120 |
|
|
0.200.1325
by Jelmer Vernooij
More test fixes. |
121 |
def test_push_roundtripping(self): |
|
0.267.1
by Martin
Don't raise the deprecated KnownFailure from tests |
122 |
self.knownFailure("roundtripping is not yet supported") |
|
0.200.1325
by Jelmer Vernooij
More test fixes. |
123 |
self.with_roundtripping() |
|
0.200.291
by Jelmer Vernooij
Print proper error about not supporting push. |
124 |
os.mkdir("bla") |
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
125 |
GitRepo.init(os.path.join(self.test_dir, "bla")) |
|
0.200.291
by Jelmer Vernooij
Print proper error about not supporting push. |
126 |
self.run_bzr(['init', 'foo']) |
127 |
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo']) |
|
|
0.200.1156
by Jelmer Vernooij
Disable push. |
128 |
# when roundtripping is supported
|
|
0.252.12
by Jelmer Vernooij
Fix push blackbox test. |
129 |
output, error = self.run_bzr(['push', '-d', 'foo', 'bla']) |
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
130 |
self.assertEqual(b"", output) |
131 |
self.assertTrue(error.endswith(b"Created new branch.\n")) |
|
|
0.200.291
by Jelmer Vernooij
Print proper error about not supporting push. |
132 |
|
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
133 |
def test_log(self): |
134 |
# Smoke test for "bzr log" in a git repository.
|
|
|
0.200.76
by Jelmer Vernooij
Add blackbox test for info -v |
135 |
self.simple_commit() |
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
136 |
|
137 |
# Check that bzr log does not fail and includes the revision.
|
|
138 |
output, error = self.run_bzr(['log']) |
|
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
139 |
self.assertEqual(error, b'') |
|
0.200.39
by David Allouche
Black-box text for "bzr log" in a git tree. Further simplification of GitRevisionTree. |
140 |
self.assertTrue( |
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
141 |
b'<The commit message>' in output, |
142 |
b"Commit message was not found in output:\n%s" % (output,)) |
|
|
0.200.80
by Jelmer Vernooij
Add blackbox test for bzr log -v. |
143 |
|
144 |
def test_log_verbose(self): |
|
145 |
# Smoke test for "bzr log -v" in a git repository.
|
|
146 |
self.simple_commit() |
|
147 |
||
148 |
# Check that bzr log does not fail and includes the revision.
|
|
149 |
output, error = self.run_bzr(['log', '-v']) |
|
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
150 |
|
|
0.200.83
by Jelmer Vernooij
Add blackbox test for 'bzr tags' |
151 |
def test_tags(self): |
|
0.200.444
by Jelmer Vernooij
Stop running git in blackbox tests. |
152 |
git_repo, commit_sha1 = self.simple_commit() |
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
153 |
git_repo.refs[b"refs/tags/foo"] = commit_sha1 |
|
0.200.83
by Jelmer Vernooij
Add blackbox test for 'bzr tags' |
154 |
|
155 |
output, error = self.run_bzr(['tags']) |
|
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
156 |
self.assertEqual(error, b'') |
157 |
self.assertEqual(output, b"foo 1\n") |
|
|
0.200.83
by Jelmer Vernooij
Add blackbox test for 'bzr tags' |
158 |
|
|
0.200.85
by Jelmer Vernooij
Add test for creating new tags. |
159 |
def test_tag(self): |
160 |
self.simple_commit() |
|
161 |
||
162 |
output, error = self.run_bzr(["tag", "bar"]) |
|
163 |
||
|
0.258.1
by Max Bowsher
Make tests tolerant to bzr <= 2.2. |
164 |
# bzr <= 2.2 emits this message in the output stream
|
165 |
# bzr => 2.3 emits this message in the error stream
|
|
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
166 |
self.assertEqual(error + output, b'Created tag bar.\n') |
|
0.200.85
by Jelmer Vernooij
Add test for creating new tags. |
167 |
|
|
0.200.288
by Jelmer Vernooij
Add test for init-repo. |
168 |
def test_init_repo(self): |
|
0.200.1653
by Jelmer Vernooij
--git is now --format=git. |
169 |
output, error = self.run_bzr(["init", "--format=git", "bla.git"]) |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
170 |
self.assertEqual(error, b'') |
171 |
self.assertEqual(output, b'Created a standalone tree (format: git)\n') |
|
|
0.200.288
by Jelmer Vernooij
Add test for init-repo. |
172 |
|
|
0.200.1332
by Jelmer Vernooij
Add smoke test for 'bzr diff --format=git'. |
173 |
def test_diff_format(self): |
174 |
tree = self.make_branch_and_tree('.') |
|
175 |
self.build_tree(['a']) |
|
176 |
tree.add(['a']) |
|
177 |
output, error = self.run_bzr(['diff', '--format=git'], retcode=1) |
|
|
6964.2.1
by Jelmer Vernooij
Initial work to support brz-git on python3. |
178 |
self.assertEqual(error, b'') |
|
0.200.1332
by Jelmer Vernooij
Add smoke test for 'bzr diff --format=git'. |
179 |
self.assertEqual(output, |
|
6964.2.1
by Jelmer Vernooij
Initial work to support brz-git on python3. |
180 |
b'diff --git /dev/null b/a\n' |
181 |
b'old mode 0\n' |
|
182 |
b'new mode 100644\n' |
|
183 |
b'index 0000000..c197bd8 100644\n' |
|
184 |
b'--- /dev/null\n' |
|
185 |
b'+++ b/a\n' |
|
186 |
b'@@ -0,0 +1 @@\n' |
|
187 |
b'+contents of a\n') |
|
|
0.200.1450
by Jelmer Vernooij
Fix git-import after branch refactoring. |
188 |
|
|
0.200.1609
by Jelmer Vernooij
Only create colocated branches in git-import if the --colocated option is specified. |
189 |
def test_git_import_uncolocated(self): |
190 |
r = GitRepo.init("a", mkdir=True) |
|
191 |
self.build_tree(["a/file"]) |
|
192 |
r.stage("file") |
|
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
193 |
r.do_commit(ref=b"refs/heads/abranch", committer=b"Joe <joe@example.com>", message=b"Dummy") |
194 |
r.do_commit(ref=b"refs/heads/bbranch", 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. |
195 |
self.run_bzr(["git-import", "a", "b"]) |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
196 |
self.assertEqual(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. |
197 |
|
|
0.200.1450
by Jelmer Vernooij
Fix git-import after branch refactoring. |
198 |
def test_git_import(self): |
199 |
r = GitRepo.init("a", mkdir=True) |
|
200 |
self.build_tree(["a/file"]) |
|
201 |
r.stage("file") |
|
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
202 |
r.do_commit(ref=b"refs/heads/abranch", committer=b"Joe <joe@example.com>", message=b"Dummy") |
203 |
r.do_commit(ref=b"refs/heads/bbranch", 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. |
204 |
self.run_bzr(["git-import", "--colocated", "a", "b"]) |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
205 |
self.assertEqual(set([".bzr"]), set(os.listdir("b"))) |
206 |
self.assertEqual(set(["abranch", "bbranch"]), |
|
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
207 |
set(ControlDir.open("b").get_branches().keys())) |
|
0.200.1451
by Jelmer Vernooij
Add some more tests for git-import. |
208 |
|
209 |
def test_git_import_incremental(self): |
|
210 |
r = GitRepo.init("a", mkdir=True) |
|
211 |
self.build_tree(["a/file"]) |
|
212 |
r.stage("file") |
|
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
213 |
r.do_commit(ref=b"refs/heads/abranch", 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. |
214 |
self.run_bzr(["git-import", "--colocated", "a", "b"]) |
215 |
self.run_bzr(["git-import", "--colocated", "a", "b"]) |
|
|
6964.2.3
by Jelmer Vernooij
Review comments. |
216 |
self.assertEqual(set([".bzr"]), set(os.listdir("b"))) |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
217 |
b = ControlDir.open("b") |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
218 |
self.assertEqual(["abranch"], b.get_branches().keys()) |
|
0.200.1451
by Jelmer Vernooij
Add some more tests for git-import. |
219 |
|
220 |
def test_git_import_tags(self): |
|
221 |
r = GitRepo.init("a", mkdir=True) |
|
222 |
self.build_tree(["a/file"]) |
|
223 |
r.stage("file") |
|
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
224 |
cid = r.do_commit(ref=b"refs/heads/abranch", committer=b"Joe <joe@example.com>", message=b"Dummy") |
225 |
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. |
226 |
self.run_bzr(["git-import", "--colocated", "a", "b"]) |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
227 |
self.assertEqual(set([".bzr"]), set(os.listdir("b"))) |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
228 |
b = ControlDir.open("b") |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
229 |
self.assertEqual(["abranch"], b.get_branches().keys()) |
230 |
self.assertEqual(["atag"], |
|
|
0.200.1567
by Jelmer Vernooij
Fix support for colocated branches. |
231 |
b.open_branch("abranch").tags.get_tag_dict().keys()) |
|
0.200.1452
by Jelmer Vernooij
Support colocated branches in 'bzr git-import', flatten namespace. |
232 |
|
233 |
def test_git_import_colo(self): |
|
234 |
r = GitRepo.init("a", mkdir=True) |
|
235 |
self.build_tree(["a/file"]) |
|
236 |
r.stage("file") |
|
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
237 |
r.do_commit(ref=b"refs/heads/abranch", committer=b"Joe <joe@example.com>", message=b"Dummy") |
238 |
r.do_commit(ref=b"refs/heads/bbranch", committer=b"Joe <joe@example.com>", message=b"Dummy") |
|
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
239 |
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. |
240 |
self.run_bzr(["git-import", "--colocated", "a", "b"]) |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
241 |
self.assertEqual( |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
242 |
set([b.name for b in ControlDir.open("b").list_branches()]), |
|
0.200.1501
by Jelmer Vernooij
Provide ControlDir.get_branches. |
243 |
set(["abranch", "bbranch"])) |
|
0.200.1521
by Jelmer Vernooij
Fix git-refs command. |
244 |
|
245 |
def test_git_refs_from_git(self): |
|
246 |
r = GitRepo.init("a", mkdir=True) |
|
247 |
self.build_tree(["a/file"]) |
|
248 |
r.stage("file") |
|
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
249 |
cid = r.do_commit(ref=b"refs/heads/abranch", committer=b"Joe <joe@example.com>", message=b"Dummy") |
250 |
r[b"refs/tags/atag"] = cid |
|
|
0.200.1521
by Jelmer Vernooij
Fix git-refs command. |
251 |
(stdout, stderr) = self.run_bzr(["git-refs", "a"]) |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
252 |
self.assertEqual(stderr, b"") |
253 |
self.assertEqual(stdout, |
|
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
254 |
b'refs/heads/abranch -> ' + cid + b'\n' |
255 |
b'refs/tags/atag -> ' + cid + b'\n') |
|
|
0.200.1521
by Jelmer Vernooij
Fix git-refs command. |
256 |
|
257 |
def test_git_refs_from_bzr(self): |
|
258 |
tree = self.make_branch_and_tree('a') |
|
259 |
self.build_tree(["a/file"]) |
|
260 |
tree.add(["file"]) |
|
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
261 |
revid = tree.commit(committer=b"Joe <joe@example.com>", message=b"Dummy") |
|
0.200.1521
by Jelmer Vernooij
Fix git-refs command. |
262 |
tree.branch.tags.set_tag("atag", revid) |
263 |
(stdout, stderr) = self.run_bzr(["git-refs", "a"]) |
|
|
6964.2.3
by Jelmer Vernooij
Review comments. |
264 |
self.assertEqual(stderr, b"") |
|
6964.2.1
by Jelmer Vernooij
Initial work to support brz-git on python3. |
265 |
self.assertTrue(b"refs/tags/atag -> " in stdout) |
266 |
self.assertTrue(b"HEAD -> " in stdout) |
|
|
0.200.1591
by Jelmer Vernooij
Add basic test for dpush. |
267 |
|
|
0.425.1
by Jelmer Vernooij
Add really basic check implementation. |
268 |
def test_check(self): |
269 |
r = GitRepo.init("gitr", mkdir=True) |
|
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
270 |
self.build_tree_contents([("gitr/foo", b"hello from git")]) |
|
0.425.1
by Jelmer Vernooij
Add really basic check implementation. |
271 |
r.stage("foo") |
|
7018.3.7
by Jelmer Vernooij
Fix remaining git tests. |
272 |
r.do_commit(b"message", committer=b"Somebody <user@example.com>") |
|
0.425.1
by Jelmer Vernooij
Add really basic check implementation. |
273 |
out, err = self.run_bzr(["check", "gitr"]) |
274 |
self.maxDiff = None |
|
|
7018.3.8
by Jelmer Vernooij
Disable some flaky tests on python3, allow running without fastimport. |
275 |
self.assertEqual(out, b'') |
|
6964.2.1
by Jelmer Vernooij
Initial work to support brz-git on python3. |
276 |
self.assertTrue(err.endswith, b'3 objects\n') |
|
6965.1.2
by Jelmer Vernooij
Add test. |
277 |
|
|
6968.1.1
by Jelmer Vernooij
Support 'bzr version-info' in horizon branches. |
278 |
|
279 |
class ShallowTests(ExternalBase): |
|
280 |
||
281 |
def setUp(self): |
|
282 |
super(ShallowTests, self).setUp() |
|
283 |
# Smoke test for "bzr log" in a git repository with shallow depth.
|
|
284 |
self.repo = GitRepo.init('gitr', mkdir=True) |
|
|
7018.3.2
by Jelmer Vernooij
Fix some git tests. |
285 |
self.build_tree_contents([("gitr/foo", b"hello from git")]) |
|
6968.1.1
by Jelmer Vernooij
Support 'bzr version-info' in horizon branches. |
286 |
self.repo.stage("foo") |
287 |
self.repo.do_commit( |
|
|
7018.3.2
by Jelmer Vernooij
Fix some git tests. |
288 |
b"message", committer=b"Somebody <user@example.com>", |
|
6968.1.1
by Jelmer Vernooij
Support 'bzr version-info' in horizon branches. |
289 |
commit_timestamp=1526330165, commit_timezone=0, |
290 |
author_timestamp=1526330165, author_timezone=0, |
|
291 |
merge_heads=[b'aa' * 20]) |
|
292 |
||
|
6965.1.2
by Jelmer Vernooij
Add test. |
293 |
def test_log_shallow(self): |
294 |
# Check that bzr log does not fail and includes the revision.
|
|
295 |
output, error = self.run_bzr(['log', 'gitr'], retcode=3) |
|
|
7018.3.2
by Jelmer Vernooij
Fix some git tests. |
296 |
self.assertEqual(error, b'brz: ERROR: Further revision history missing.\n') |
|
6965.1.2
by Jelmer Vernooij
Add test. |
297 |
self.assertEqual(output, |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
298 |
b'------------------------------------------------------------\n' |
299 |
b'revision-id: git-v1:' + self.repo.head() + b'\n' |
|
300 |
b'git commit: ' + self.repo.head() + b'\n' |
|
301 |
b'committer: Somebody <user@example.com>\n' |
|
302 |
b'timestamp: Mon 2018-05-14 20:36:05 +0000\n' |
|
303 |
b'message:\n' |
|
304 |
b' message\n') |
|
|
6968.1.1
by Jelmer Vernooij
Support 'bzr version-info' in horizon branches. |
305 |
|
306 |
def test_version_info_rio(self): |
|
307 |
output, error = self.run_bzr(['version-info', '--rio', 'gitr']) |
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
308 |
self.assertEqual(error, b'') |
309 |
self.assertNotIn(b'revno:', output) |
|
|
6968.1.1
by Jelmer Vernooij
Support 'bzr version-info' in horizon branches. |
310 |
|
311 |
def test_version_info_python(self): |
|
312 |
output, error = self.run_bzr(['version-info', '--python', 'gitr']) |
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
313 |
self.assertEqual(error, b'') |
314 |
self.assertNotIn(b'revno:', output) |
|
|
6968.1.1
by Jelmer Vernooij
Support 'bzr version-info' in horizon branches. |
315 |
|
316 |
def test_version_info_custom_with_revno(self): |
|
317 |
output, error = self.run_bzr( |
|
318 |
['version-info', '--custom', |
|
319 |
'--template=VERSION_INFO r{revno})\n', 'gitr'], retcode=3) |
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
320 |
self.assertEqual(error, b'brz: ERROR: Variable {revno} is not available.\n') |
321 |
self.assertEqual(output, b'VERSION_INFO r') |
|
|
6968.1.1
by Jelmer Vernooij
Support 'bzr version-info' in horizon branches. |
322 |
|
323 |
def test_version_info_custom_without_revno(self): |
|
324 |
output, error = self.run_bzr( |
|
325 |
['version-info', '--custom', '--template=VERSION_INFO \n', |
|
326 |
'gitr']) |
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
327 |
self.assertEqual(error, b'') |
328 |
self.assertEqual(output, b'VERSION_INFO \n') |