bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.358.2
by Jelmer Vernooij
Refresh copyright headers, add my email. |
1 |
# Copyright (C) 2009-2018 Jelmer Vernooij <jelmer@jelmer.uk>
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
2 |
# Copyright (C) 2007 Canonical Ltd
|
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.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
17 |
|
|
0.200.411
by Jelmer Vernooij
Stop pretending dulwich has the same api as python-git. |
18 |
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
19 |
"""Tests for interfacing with a Git Branch"""
|
20 |
||
|
0.358.3
by Jelmer Vernooij
Enable absolute import. |
21 |
from __future__ import absolute_import |
|
0.200.411
by Jelmer Vernooij
Stop pretending dulwich has the same api as python-git. |
22 |
|
23 |
import dulwich |
|
|
0.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
24 |
from dulwich.objects import ( |
25 |
Commit, |
|
26 |
Tag, |
|
27 |
)
|
|
|
0.200.447
by Jelmer Vernooij
Rely less on command-line git. |
28 |
from dulwich.repo import ( |
29 |
Repo as GitRepo, |
|
30 |
)
|
|
31 |
||
|
0.200.270
by Jelmer Vernooij
add tests for branch sprouting. |
32 |
import os |
33 |
||
|
6986.2.1
by Jelmer Vernooij
Move breezy.plugins.git to breezy.git. |
34 |
from ... import ( |
|
7131.14.4
by Jelmer Vernooij
Fix test. |
35 |
errors, |
|
0.200.270
by Jelmer Vernooij
add tests for branch sprouting. |
36 |
revision, |
|
0.266.1
by Martin
Expect native-style file urls in branch object reprs |
37 |
urlutils, |
|
0.200.270
by Jelmer Vernooij
add tests for branch sprouting. |
38 |
)
|
|
6986.2.1
by Jelmer Vernooij
Move breezy.plugins.git to breezy.git. |
39 |
from ...branch import ( |
|
0.200.270
by Jelmer Vernooij
add tests for branch sprouting. |
40 |
Branch, |
|
0.247.1
by Michael Hudson
test |
41 |
InterBranch, |
|
0.200.1660
by Jelmer Vernooij
Fix imports. |
42 |
UnstackableBranchFormat, |
|
0.200.270
by Jelmer Vernooij
add tests for branch sprouting. |
43 |
)
|
|
6986.2.1
by Jelmer Vernooij
Move breezy.plugins.git to breezy.git. |
44 |
from ...controldir import ( |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
45 |
ControlDir, |
|
0.200.1014
by Jelmer Vernooij
Fix tests. |
46 |
)
|
|
6986.2.1
by Jelmer Vernooij
Move breezy.plugins.git to breezy.git. |
47 |
from ...repository import ( |
|
0.200.270
by Jelmer Vernooij
add tests for branch sprouting. |
48 |
Repository, |
49 |
)
|
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
50 |
|
|
0.200.1642
by Jelmer Vernooij
Use relative imports in tests. |
51 |
from .. import ( |
|
0.200.94
by Jelmer Vernooij
Eliminate (duplicate) git_ prefix. |
52 |
branch, |
|
0.200.97
by Jelmer Vernooij
use mapping object. |
53 |
tests, |
|
0.200.20
by John Arbash Meinel
All tests are passing again |
54 |
)
|
|
0.200.1642
by Jelmer Vernooij
Use relative imports in tests. |
55 |
from ..dir import ( |
|
0.200.1140
by Jelmer Vernooij
Update now that the control dir formats are no longer in __init__. |
56 |
LocalGitControlDirFormat, |
57 |
)
|
|
|
0.200.1642
by Jelmer Vernooij
Use relative imports in tests. |
58 |
from ..mapping import ( |
|
0.243.1
by Jelmer Vernooij
Use foreign branch testing infrastructure. |
59 |
default_mapping, |
60 |
)
|
|
|
0.200.123
by Jelmer Vernooij
Use central git module. |
61 |
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
62 |
|
63 |
class TestGitBranch(tests.TestCaseInTempDir): |
|
64 |
||
|
0.200.1361
by Jelmer Vernooij
Support branches where the ref can't be mapped back to a branch name. |
65 |
def test_open_by_ref(self): |
66 |
GitRepo.init('.') |
|
|
0.200.1427
by Jelmer Vernooij
fix 2.3 and 2.4 compatibility. |
67 |
url = "%s,ref=%s" % ( |
|
0.200.1361
by Jelmer Vernooij
Support branches where the ref can't be mapped back to a branch name. |
68 |
urlutils.local_path_to_url(self.test_dir), |
|
7018.3.8
by Jelmer Vernooij
Disable some flaky tests on python3, allow running without fastimport. |
69 |
urlutils.quote("refs/remotes/origin/unstable", safe='') |
|
0.200.1427
by Jelmer Vernooij
fix 2.3 and 2.4 compatibility. |
70 |
)
|
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
71 |
d = ControlDir.open(url) |
|
0.200.1361
by Jelmer Vernooij
Support branches where the ref can't be mapped back to a branch name. |
72 |
b = d.create_branch() |
|
7045.4.2
by Jelmer Vernooij
Fix some more gitty tests. |
73 |
self.assertEqual(b.ref, b"refs/remotes/origin/unstable") |
|
0.200.1361
by Jelmer Vernooij
Support branches where the ref can't be mapped back to a branch name. |
74 |
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
75 |
def test_open_existing(self): |
|
0.200.1559
by Jelmer Vernooij
Fix compatibility with bzr 2.5. |
76 |
r = GitRepo.init('.') |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
77 |
d = ControlDir.open('.') |
|
0.200.769
by Jelmer Vernooij
Cope with open_branch() actually checking whether there is a branch present. |
78 |
thebranch = d.create_branch() |
|
0.200.94
by Jelmer Vernooij
Eliminate (duplicate) git_ prefix. |
79 |
self.assertIsInstance(thebranch, branch.GitBranch) |
|
0.200.19
by John Arbash Meinel
More refactoring. Add some direct tests for GitModel. |
80 |
|
|
0.200.412
by Jelmer Vernooij
Implement GitBranch.__repr__. |
81 |
def test_repr(self): |
|
0.200.1559
by Jelmer Vernooij
Fix compatibility with bzr 2.5. |
82 |
r = GitRepo.init('.') |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
83 |
d = ControlDir.open('.') |
|
0.200.769
by Jelmer Vernooij
Cope with open_branch() actually checking whether there is a branch present. |
84 |
thebranch = d.create_branch() |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
85 |
self.assertEqual( |
|
7045.4.1
by Jelmer Vernooij
Some brz-git fixes. |
86 |
"<LocalGitBranch('%s/', %r)>" % ( |
87 |
urlutils.local_path_to_url(self.test_dir), |
|
88 |
u'master'), |
|
|
0.266.1
by Martin
Expect native-style file urls in branch object reprs |
89 |
repr(thebranch)) |
|
0.200.412
by Jelmer Vernooij
Implement GitBranch.__repr__. |
90 |
|
|
0.200.19
by John Arbash Meinel
More refactoring. Add some direct tests for GitModel. |
91 |
def test_last_revision_is_null(self): |
|
0.200.1559
by Jelmer Vernooij
Fix compatibility with bzr 2.5. |
92 |
r = GitRepo.init('.') |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
93 |
thedir = ControlDir.open('.') |
|
0.200.769
by Jelmer Vernooij
Cope with open_branch() actually checking whether there is a branch present. |
94 |
thebranch = thedir.create_branch() |
|
0.200.19
by John Arbash Meinel
More refactoring. Add some direct tests for GitModel. |
95 |
self.assertEqual(revision.NULL_REVISION, thebranch.last_revision()) |
96 |
self.assertEqual((0, revision.NULL_REVISION), |
|
97 |
thebranch.last_revision_info()) |
|
|
0.200.20
by John Arbash Meinel
All tests are passing again |
98 |
|
|
0.200.82
by Jelmer Vernooij
Support listing tags. |
99 |
def simple_commit_a(self): |
|
0.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
100 |
r = GitRepo.init('.') |
|
0.200.82
by Jelmer Vernooij
Support listing tags. |
101 |
self.build_tree(['a']) |
|
0.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
102 |
r.stage(["a"]) |
|
7018.3.8
by Jelmer Vernooij
Disable some flaky tests on python3, allow running without fastimport. |
103 |
return r.do_commit(b"a", committer=b"Somebody <foo@example.com>") |
|
0.200.82
by Jelmer Vernooij
Support listing tags. |
104 |
|
|
0.200.20
by John Arbash Meinel
All tests are passing again |
105 |
def test_last_revision_is_valid(self): |
|
0.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
106 |
head = self.simple_commit_a() |
|
0.200.94
by Jelmer Vernooij
Eliminate (duplicate) git_ prefix. |
107 |
thebranch = Branch.open('.') |
|
0.200.104
by Jelmer Vernooij
Use bzr-foreign function names for converting between git and bzr revids. |
108 |
self.assertEqual(default_mapping.revision_id_foreign_to_bzr(head), |
|
0.200.20
by John Arbash Meinel
All tests are passing again |
109 |
thebranch.last_revision()) |
|
0.200.58
by Jelmer Vernooij
Fix remaining tests. |
110 |
|
|
0.200.1602
by Jelmer Vernooij
Remove Branch.revision_history. |
111 |
def test_last_revision_info(self): |
|
0.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
112 |
reva = self.simple_commit_a() |
|
0.200.59
by Jelmer Vernooij
Add more tests, fix revision history. |
113 |
self.build_tree(['b']) |
|
0.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
114 |
r = GitRepo(".") |
115 |
r.stage("b") |
|
|
7018.3.8
by Jelmer Vernooij
Disable some flaky tests on python3, allow running without fastimport. |
116 |
revb = r.do_commit(b"b", committer=b"Somebody <foo@example.com>") |
|
0.200.58
by Jelmer Vernooij
Fix remaining tests. |
117 |
|
|
0.200.94
by Jelmer Vernooij
Eliminate (duplicate) git_ prefix. |
118 |
thebranch = Branch.open('.') |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
119 |
self.assertEqual((2, default_mapping.revision_id_foreign_to_bzr( |
120 |
revb)), thebranch.last_revision_info()) |
|
|
0.200.82
by Jelmer Vernooij
Support listing tags. |
121 |
|
|
0.200.271
by Jelmer Vernooij
Stop importing tags as branches as part of git-import. |
122 |
def test_tag_annotated(self): |
|
0.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
123 |
reva = self.simple_commit_a() |
124 |
o = Tag() |
|
|
7018.3.8
by Jelmer Vernooij
Disable some flaky tests on python3, allow running without fastimport. |
125 |
o.name = b"foo" |
126 |
o.tagger = b"Jelmer <foo@example.com>" |
|
127 |
o.message = b"add tag" |
|
|
0.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
128 |
o.object = (Commit, reva) |
129 |
o.tag_timezone = 0 |
|
130 |
o.tag_time = 42 |
|
131 |
r = GitRepo(".") |
|
132 |
r.object_store.add_object(o) |
|
|
7018.3.8
by Jelmer Vernooij
Disable some flaky tests on python3, allow running without fastimport. |
133 |
r[b'refs/tags/foo'] = o.id |
|
0.200.271
by Jelmer Vernooij
Stop importing tags as branches as part of git-import. |
134 |
thebranch = Branch.open('.') |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
135 |
self.assertEqual({"foo": default_mapping.revision_id_foreign_to_bzr(reva)}, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
136 |
thebranch.tags.get_tag_dict()) |
|
0.200.271
by Jelmer Vernooij
Stop importing tags as branches as part of git-import. |
137 |
|
138 |
def test_tag(self): |
|
|
0.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
139 |
reva = self.simple_commit_a() |
140 |
r = GitRepo(".") |
|
|
7018.3.8
by Jelmer Vernooij
Disable some flaky tests on python3, allow running without fastimport. |
141 |
r.refs[b"refs/tags/foo"] = reva |
|
0.200.271
by Jelmer Vernooij
Stop importing tags as branches as part of git-import. |
142 |
thebranch = Branch.open('.') |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
143 |
self.assertEqual({"foo": default_mapping.revision_id_foreign_to_bzr(reva)}, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
144 |
thebranch.tags.get_tag_dict()) |
|
0.200.956
by Jelmer Vernooij
Add some more format tests. |
145 |
|
|
0.200.66
by Jelmer Vernooij
Implement branch.get_parent(). |
146 |
|
147 |
class TestWithGitBranch(tests.TestCaseWithTransport): |
|
148 |
||
149 |
def setUp(self): |
|
150 |
tests.TestCaseWithTransport.setUp(self) |
|
|
0.200.1559
by Jelmer Vernooij
Fix compatibility with bzr 2.5. |
151 |
r = dulwich.repo.Repo.create(self.test_dir) |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
152 |
d = ControlDir.open(self.test_dir) |
|
0.200.769
by Jelmer Vernooij
Cope with open_branch() actually checking whether there is a branch present. |
153 |
self.git_branch = d.create_branch() |
|
0.200.66
by Jelmer Vernooij
Implement branch.get_parent(). |
154 |
|
155 |
def test_get_parent(self): |
|
156 |
self.assertIs(None, self.git_branch.get_parent()) |
|
|
0.200.67
by Jelmer Vernooij
Implement Branch.get_stacked_on_url. |
157 |
|
158 |
def test_get_stacked_on_url(self): |
|
|
0.200.1660
by Jelmer Vernooij
Fix imports. |
159 |
self.assertRaises(UnstackableBranchFormat, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
160 |
self.git_branch.get_stacked_on_url) |
|
0.200.70
by Jelmer Vernooij
Implement GitBranchFormat.get_format_description. |
161 |
|
|
0.200.72
by Jelmer Vernooij
Implement Branch.get_physical_lock_status. |
162 |
def test_get_physical_lock_status(self): |
163 |
self.assertFalse(self.git_branch.get_physical_lock_status()) |
|
164 |
||
|
0.200.70
by Jelmer Vernooij
Implement GitBranchFormat.get_format_description. |
165 |
|
|
0.295.1
by Jelmer Vernooij
Split up branch formats. |
166 |
class TestLocalGitBranchFormat(tests.TestCase): |
|
0.200.70
by Jelmer Vernooij
Implement GitBranchFormat.get_format_description. |
167 |
|
168 |
def setUp(self): |
|
|
0.295.1
by Jelmer Vernooij
Split up branch formats. |
169 |
super(TestLocalGitBranchFormat, self).setUp() |
170 |
self.format = branch.LocalGitBranchFormat() |
|
|
0.200.70
by Jelmer Vernooij
Implement GitBranchFormat.get_format_description. |
171 |
|
172 |
def test_get_format_description(self): |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
173 |
self.assertEqual("Local Git Branch", |
174 |
self.format.get_format_description()) |
|
|
0.200.270
by Jelmer Vernooij
add tests for branch sprouting. |
175 |
|
|
0.200.956
by Jelmer Vernooij
Add some more format tests. |
176 |
def test_get_network_name(self): |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
177 |
self.assertEqual(b"git", self.format.network_name()) |
|
0.200.956
by Jelmer Vernooij
Add some more format tests. |
178 |
|
179 |
def test_supports_tags(self): |
|
180 |
self.assertTrue(self.format.supports_tags()) |
|
|
0.200.270
by Jelmer Vernooij
add tests for branch sprouting. |
181 |
|
182 |
||
|
0.200.271
by Jelmer Vernooij
Stop importing tags as branches as part of git-import. |
183 |
class BranchTests(tests.TestCaseInTempDir): |
|
0.200.270
by Jelmer Vernooij
add tests for branch sprouting. |
184 |
|
185 |
def make_onerev_branch(self): |
|
186 |
os.mkdir("d") |
|
187 |
os.chdir("d") |
|
|
0.200.447
by Jelmer Vernooij
Rely less on command-line git. |
188 |
GitRepo.init('.') |
|
0.200.270
by Jelmer Vernooij
add tests for branch sprouting. |
189 |
bb = tests.GitBranchBuilder() |
|
7018.3.8
by Jelmer Vernooij
Disable some flaky tests on python3, allow running without fastimport. |
190 |
bb.set_file("foobar", b"foo\nbar\n", False) |
191 |
mark = bb.commit(b"Somebody <somebody@someorg.org>", b"mymsg") |
|
|
0.200.270
by Jelmer Vernooij
add tests for branch sprouting. |
192 |
gitsha = bb.finish()[mark] |
193 |
os.chdir("..") |
|
|
0.200.1373
by Jelmer Vernooij
Prevent accidentally removing branch. |
194 |
return os.path.abspath("d"), gitsha |
|
0.200.270
by Jelmer Vernooij
add tests for branch sprouting. |
195 |
|
|
0.247.1
by Michael Hudson
test |
196 |
def make_tworev_branch(self): |
197 |
os.mkdir("d") |
|
198 |
os.chdir("d") |
|
199 |
GitRepo.init('.') |
|
200 |
bb = tests.GitBranchBuilder() |
|
|
7018.3.8
by Jelmer Vernooij
Disable some flaky tests on python3, allow running without fastimport. |
201 |
bb.set_file("foobar", b"foo\nbar\n", False) |
202 |
mark1 = bb.commit(b"Somebody <somebody@someorg.org>", b"mymsg") |
|
203 |
mark2 = bb.commit(b"Somebody <somebody@someorg.org>", b"mymsg") |
|
|
0.247.1
by Michael Hudson
test |
204 |
marks = bb.finish() |
205 |
os.chdir("..") |
|
206 |
return "d", (marks[mark1], marks[mark2]) |
|
207 |
||
|
0.200.270
by Jelmer Vernooij
add tests for branch sprouting. |
208 |
def clone_git_branch(self, from_url, to_url): |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
209 |
from_dir = ControlDir.open(from_url) |
|
0.200.270
by Jelmer Vernooij
add tests for branch sprouting. |
210 |
to_dir = from_dir.sprout(to_url) |
211 |
return to_dir.open_branch() |
|
212 |
||
213 |
def test_single_rev(self): |
|
214 |
path, gitsha = self.make_onerev_branch() |
|
215 |
oldrepo = Repository.open(path) |
|
216 |
revid = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha) |
|
|
7018.3.8
by Jelmer Vernooij
Disable some flaky tests on python3, allow running without fastimport. |
217 |
self.assertEqual(gitsha, oldrepo._git.get_refs()[b"refs/heads/master"]) |
|
0.200.270
by Jelmer Vernooij
add tests for branch sprouting. |
218 |
newbranch = self.clone_git_branch(path, "f") |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
219 |
self.assertEqual([revid], newbranch.repository.all_revision_ids()) |
|
0.200.271
by Jelmer Vernooij
Stop importing tags as branches as part of git-import. |
220 |
|
221 |
def test_sprouted_tags(self): |
|
222 |
path, gitsha = self.make_onerev_branch() |
|
|
0.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
223 |
r = GitRepo(path) |
|
7018.3.8
by Jelmer Vernooij
Disable some flaky tests on python3, allow running without fastimport. |
224 |
r.refs[b"refs/tags/lala"] = r.head() |
|
0.200.271
by Jelmer Vernooij
Stop importing tags as branches as part of git-import. |
225 |
oldrepo = Repository.open(path) |
226 |
revid = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha) |
|
227 |
newbranch = self.clone_git_branch(path, "f") |
|
|
6964.2.3
by Jelmer Vernooij
Review comments. |
228 |
self.assertEqual({"lala": revid}, newbranch.tags.get_tag_dict()) |
229 |
self.assertEqual([revid], newbranch.repository.all_revision_ids()) |
|
|
0.243.1
by Jelmer Vernooij
Use foreign branch testing infrastructure. |
230 |
|
|
7240.2.1
by Jelmer Vernooij
Don't copy tags that don't point to valid objects. |
231 |
def test_sprouted_ghost_tags(self): |
232 |
path, gitsha = self.make_onerev_branch() |
|
233 |
r = GitRepo(path) |
|
234 |
r.refs[b"refs/tags/lala"] = b"aa" * 20 |
|
235 |
oldrepo = Repository.open(path) |
|
236 |
revid = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha) |
|
237 |
warnings, newbranch = self.callCatchWarnings( |
|
238 |
self.clone_git_branch, path, "f") |
|
239 |
self.assertEqual({}, newbranch.tags.get_tag_dict()) |
|
240 |
# Dulwich raises a UserWarning for tags with invalid target
|
|
241 |
self.assertEqual(1, len(warnings)) |
|
242 |
||
|
0.247.1
by Michael Hudson
test |
243 |
def test_interbranch_pull(self): |
244 |
path, (gitsha1, gitsha2) = self.make_tworev_branch() |
|
245 |
oldrepo = Repository.open(path) |
|
246 |
revid2 = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha2) |
|
247 |
newbranch = self.make_branch('g') |
|
248 |
inter_branch = InterBranch.get(Branch.open(path), newbranch) |
|
249 |
inter_branch.pull() |
|
|
6964.2.3
by Jelmer Vernooij
Review comments. |
250 |
self.assertEqual(revid2, newbranch.last_revision()) |
|
0.247.1
by Michael Hudson
test |
251 |
|
|
0.247.5
by Michael Hudson
test and fix for noop pull case |
252 |
def test_interbranch_pull_noop(self): |
253 |
path, (gitsha1, gitsha2) = self.make_tworev_branch() |
|
254 |
oldrepo = Repository.open(path) |
|
255 |
revid2 = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha2) |
|
256 |
newbranch = self.make_branch('g') |
|
257 |
inter_branch = InterBranch.get(Branch.open(path), newbranch) |
|
258 |
inter_branch.pull() |
|
259 |
# This is basically "assertNotRaises"
|
|
260 |
inter_branch.pull() |
|
|
6964.2.3
by Jelmer Vernooij
Review comments. |
261 |
self.assertEqual(revid2, newbranch.last_revision()) |
|
0.247.5
by Michael Hudson
test and fix for noop pull case |
262 |
|
|
0.247.3
by Michael Hudson
oh, so it wasn't (particularly) wrong, but it was a bit obscure |
263 |
def test_interbranch_pull_stop_revision(self): |
264 |
path, (gitsha1, gitsha2) = self.make_tworev_branch() |
|
265 |
oldrepo = Repository.open(path) |
|
266 |
revid1 = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha1) |
|
267 |
newbranch = self.make_branch('g') |
|
268 |
inter_branch = InterBranch.get(Branch.open(path), newbranch) |
|
269 |
inter_branch.pull(stop_revision=revid1) |
|
|
6964.2.3
by Jelmer Vernooij
Review comments. |
270 |
self.assertEqual(revid1, newbranch.last_revision()) |
|
0.247.3
by Michael Hudson
oh, so it wasn't (particularly) wrong, but it was a bit obscure |
271 |
|
|
0.259.8
by Jelmer Vernooij
Add test. |
272 |
def test_interbranch_pull_with_tags(self): |
273 |
path, (gitsha1, gitsha2) = self.make_tworev_branch() |
|
274 |
gitrepo = GitRepo(path) |
|
|
7018.3.8
by Jelmer Vernooij
Disable some flaky tests on python3, allow running without fastimport. |
275 |
gitrepo.refs[b"refs/tags/sometag"] = gitsha2 |
|
0.259.8
by Jelmer Vernooij
Add test. |
276 |
oldrepo = Repository.open(path) |
277 |
revid1 = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha1) |
|
278 |
revid2 = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha2) |
|
279 |
newbranch = self.make_branch('g') |
|
|
0.200.1305
by Jelmer Vernooij
Only actually fetch tags if "branch.fetch_tags" is set to true. |
280 |
source_branch = Branch.open(path) |
281 |
source_branch.get_config().set_user_option("branch.fetch_tags", True) |
|
282 |
inter_branch = InterBranch.get(source_branch, newbranch) |
|
|
0.259.8
by Jelmer Vernooij
Add test. |
283 |
inter_branch.pull(stop_revision=revid1) |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
284 |
self.assertEqual(revid1, newbranch.last_revision()) |
|
0.259.8
by Jelmer Vernooij
Add test. |
285 |
self.assertTrue(newbranch.repository.has_revision(revid2)) |
286 |
||
|
7131.14.1
by Jelmer Vernooij
Fix committing to a bzr branch bound to a git branch. |
287 |
def test_bzr_branch_bound_to_git(self): |
288 |
path, (gitsha1, gitsha2) = self.make_tworev_branch() |
|
|
7131.14.2
by Jelmer Vernooij
Make sure resulting branch is correct too. |
289 |
wt = Branch.open(path).create_checkout('co') |
|
7131.14.1
by Jelmer Vernooij
Fix committing to a bzr branch bound to a git branch. |
290 |
self.build_tree_contents([('co/foobar', b'blah')]) |
|
7131.14.4
by Jelmer Vernooij
Fix test. |
291 |
self.assertRaises( |
292 |
errors.NoRoundtrippingSupport, wt.commit, |
|
|
7131.14.1
by Jelmer Vernooij
Fix committing to a bzr branch bound to a git branch. |
293 |
'commit from bound branch.') |
|
7131.14.2
by Jelmer Vernooij
Make sure resulting branch is correct too. |
294 |
revid = wt.commit('commit from bound branch.', lossy=True) |
295 |
self.assertEqual(revid, wt.branch.last_revision()) |
|
296 |
self.assertEqual( |
|
|
7131.14.4
by Jelmer Vernooij
Fix test. |
297 |
revid, |
298 |
wt.branch.get_master_branch().last_revision()) |
|
|
7131.14.1
by Jelmer Vernooij
Fix committing to a bzr branch bound to a git branch. |
299 |
|
|
0.243.1
by Jelmer Vernooij
Use foreign branch testing infrastructure. |
300 |
|
301 |
class ForeignTestsBranchFactory(object): |
|
302 |
||
303 |
def make_empty_branch(self, transport): |
|
|
0.200.1012
by Jelmer Vernooij
Rename BzrDir to ControlDir. |
304 |
d = LocalGitControlDirFormat().initialize_on_transport(transport) |
|
0.200.769
by Jelmer Vernooij
Cope with open_branch() actually checking whether there is a branch present. |
305 |
return d.create_branch() |
|
0.243.1
by Jelmer Vernooij
Use foreign branch testing infrastructure. |
306 |
|
307 |
make_branch = make_empty_branch |