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