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) 2010-2018 Jelmer Vernooij <jelmer@jelmer.uk>
|
|
0.200.709
by Jelmer Vernooij
When unpacking URLs, strip leftmost slash to match gits behaviour. |
2 |
#
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
|
0.358.1
by Jelmer Vernooij
Fix FSF address. |
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
0.200.709
by Jelmer Vernooij
When unpacking URLs, strip leftmost slash to match gits behaviour. |
16 |
|
17 |
"""Test the smart client."""
|
|
18 |
||
|
6964.2.1
by Jelmer Vernooij
Initial work to support brz-git on python3. |
19 |
from io import BytesIO |
|
0.406.3
by Jelmer Vernooij
Add extra tests. |
20 |
|
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
21 |
import os |
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
22 |
import time |
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
23 |
|
|
6986.2.1
by Jelmer Vernooij
Move breezy.plugins.git to breezy.git. |
24 |
from ...controldir import ControlDir |
25 |
from ...errors import ( |
|
|
0.404.5
by Jelmer Vernooij
Check for diverged branches during push. |
26 |
DivergedBranches, |
|
0.200.1275
by Jelmer Vernooij
recognize missing repositories |
27 |
NotBranchError, |
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
28 |
NoSuchTag, |
|
7103.1.2
by Jelmer Vernooij
Handle PermissionDenied. |
29 |
PermissionDenied, |
|
0.200.1275
by Jelmer Vernooij
recognize missing repositories |
30 |
)
|
31 |
||
|
6986.2.1
by Jelmer Vernooij
Move breezy.plugins.git to breezy.git. |
32 |
from ...tests import ( |
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
33 |
TestCase, |
34 |
TestCaseWithTransport, |
|
35 |
)
|
|
|
6986.2.1
by Jelmer Vernooij
Move breezy.plugins.git to breezy.git. |
36 |
from ...tests.features import ExecutableFeature |
|
0.200.709
by Jelmer Vernooij
When unpacking URLs, strip leftmost slash to match gits behaviour. |
37 |
|
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
38 |
from ..mapping import default_mapping |
|
0.200.1642
by Jelmer Vernooij
Use relative imports in tests. |
39 |
from ..remote import ( |
|
0.200.709
by Jelmer Vernooij
When unpacking URLs, strip leftmost slash to match gits behaviour. |
40 |
split_git_url, |
|
0.200.1275
by Jelmer Vernooij
recognize missing repositories |
41 |
parse_git_error, |
|
7490.29.12
by Jelmer Vernooij
Parse stderr from remote git servers when they hang up. |
42 |
parse_git_hangup, |
|
7103.1.1
by Jelmer Vernooij
Improved error parsing for Git branches. |
43 |
HeadUpdateFailed, |
44 |
RemoteGitError, |
|
|
0.295.1
by Jelmer Vernooij
Split up branch formats. |
45 |
RemoteGitBranchFormat, |
|
7371.3.2
by Jelmer Vernooij
Fix URL parsing for Git. |
46 |
_git_url_and_path_from_transport, |
|
0.200.709
by Jelmer Vernooij
When unpacking URLs, strip leftmost slash to match gits behaviour. |
47 |
)
|
48 |
||
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
49 |
from dulwich import porcelain |
|
7490.29.12
by Jelmer Vernooij
Parse stderr from remote git servers when they hang up. |
50 |
from dulwich.errors import HangupException |
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
51 |
from dulwich.repo import Repo as GitRepo |
52 |
||
53 |
||
|
0.200.709
by Jelmer Vernooij
When unpacking URLs, strip leftmost slash to match gits behaviour. |
54 |
class SplitUrlTests(TestCase): |
55 |
||
56 |
def test_simple(self): |
|
|
6964.2.3
by Jelmer Vernooij
Review comments. |
57 |
self.assertEqual(("foo", None, None, "/bar"), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
58 |
split_git_url("git://foo/bar")) |
|
0.200.709
by Jelmer Vernooij
When unpacking URLs, strip leftmost slash to match gits behaviour. |
59 |
|
60 |
def test_port(self): |
|
|
6964.2.3
by Jelmer Vernooij
Review comments. |
61 |
self.assertEqual(("foo", 343, None, "/bar"), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
62 |
split_git_url("git://foo:343/bar")) |
|
0.200.709
by Jelmer Vernooij
When unpacking URLs, strip leftmost slash to match gits behaviour. |
63 |
|
64 |
def test_username(self): |
|
|
6964.2.3
by Jelmer Vernooij
Review comments. |
65 |
self.assertEqual(("foo", None, "la", "/bar"), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
66 |
split_git_url("git://la@foo/bar")) |
|
0.200.709
by Jelmer Vernooij
When unpacking URLs, strip leftmost slash to match gits behaviour. |
67 |
|
|
7290.38.1
by Jelmer Vernooij
Backport python3.8 support patch to breezy 3.0. |
68 |
def test_username_password(self): |
69 |
self.assertEqual( |
|
70 |
("foo", None, "la", "/bar"), |
|
71 |
split_git_url("git://la:passwd@foo/bar")) |
|
72 |
||
|
0.200.709
by Jelmer Vernooij
When unpacking URLs, strip leftmost slash to match gits behaviour. |
73 |
def test_nopath(self): |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
74 |
self.assertEqual(("foo", None, None, "/"), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
75 |
split_git_url("git://foo/")) |
|
0.200.709
by Jelmer Vernooij
When unpacking URLs, strip leftmost slash to match gits behaviour. |
76 |
|
77 |
def test_slashpath(self): |
|
|
6964.2.3
by Jelmer Vernooij
Review comments. |
78 |
self.assertEqual(("foo", None, None, "//bar"), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
79 |
split_git_url("git://foo//bar")) |
|
0.246.2
by Jelmer Vernooij
Improve the fix dealing with git repo's in home directories. |
80 |
|
81 |
def test_homedir(self): |
|
|
6964.2.3
by Jelmer Vernooij
Review comments. |
82 |
self.assertEqual(("foo", None, None, "~bar"), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
83 |
split_git_url("git://foo/~bar")) |
|
0.200.1275
by Jelmer Vernooij
recognize missing repositories |
84 |
|
|
7290.38.1
by Jelmer Vernooij
Backport python3.8 support patch to breezy 3.0. |
85 |
def test_file(self): |
|
7290.38.2
by Jelmer Vernooij
More fixes. |
86 |
self.assertEqual( |
87 |
("", None, None, "/bar"), |
|
88 |
split_git_url("file:///bar")) |
|
|
7290.38.1
by Jelmer Vernooij
Backport python3.8 support patch to breezy 3.0. |
89 |
|
|
0.200.1275
by Jelmer Vernooij
recognize missing repositories |
90 |
|
91 |
class ParseGitErrorTests(TestCase): |
|
92 |
||
93 |
def test_unknown(self): |
|
94 |
e = parse_git_error("url", "foo") |
|
|
7103.1.1
by Jelmer Vernooij
Improved error parsing for Git branches. |
95 |
self.assertIsInstance(e, RemoteGitError) |
|
0.200.1275
by Jelmer Vernooij
recognize missing repositories |
96 |
|
97 |
def test_notbrancherror(self): |
|
98 |
e = parse_git_error("url", "\n Could not find Repository foo/bar") |
|
99 |
self.assertIsInstance(e, NotBranchError) |
|
|
0.295.1
by Jelmer Vernooij
Split up branch formats. |
100 |
|
|
7104.2.1
by Jelmer Vernooij
Handle another way of formatting Git "repository not found" errors. |
101 |
def test_notbrancherror_launchpad(self): |
102 |
e = parse_git_error("url", "Repository 'foo/bar' not found.") |
|
103 |
self.assertIsInstance(e, NotBranchError) |
|
104 |
||
|
7103.1.1
by Jelmer Vernooij
Improved error parsing for Git branches. |
105 |
def test_notbrancherror_github(self): |
106 |
e = parse_git_error("url", "Repository not found.\n") |
|
107 |
self.assertIsInstance(e, NotBranchError) |
|
108 |
||
|
7131.7.3
by Jelmer Vernooij
Handle one more error. |
109 |
def test_notbrancherror_normal(self): |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
110 |
e = parse_git_error( |
111 |
"url", "fatal: '/srv/git/lintian-brush' does not appear to be a git repository") |
|
|
7131.7.3
by Jelmer Vernooij
Handle one more error. |
112 |
self.assertIsInstance(e, NotBranchError) |
113 |
||
|
7103.1.1
by Jelmer Vernooij
Improved error parsing for Git branches. |
114 |
def test_head_update(self): |
115 |
e = parse_git_error("url", "HEAD failed to update\n") |
|
116 |
self.assertIsInstance(e, HeadUpdateFailed) |
|
117 |
||
|
7103.1.2
by Jelmer Vernooij
Handle PermissionDenied. |
118 |
def test_permission_dnied(self): |
119 |
e = parse_git_error( |
|
120 |
"url", |
|
121 |
"access denied or repository not exported: /debian/altermime.git") |
|
122 |
self.assertIsInstance(e, PermissionDenied) |
|
123 |
||
|
7131.7.1
by Jelmer Vernooij
Handle permission denied by GitLab. |
124 |
def test_permission_denied_gitlab(self): |
125 |
e = parse_git_error( |
|
126 |
"url", |
|
127 |
'GitLab: You are not allowed to push code to this project.\n') |
|
128 |
self.assertIsInstance(e, PermissionDenied) |
|
129 |
||
|
7131.7.2
by Jelmer Vernooij
Handle github PermissionDenied. |
130 |
def test_permission_denied_github(self): |
131 |
e = parse_git_error( |
|
132 |
"url", |
|
133 |
'Permission to porridge/gaduhistory.git denied to jelmer.') |
|
134 |
self.assertIsInstance(e, PermissionDenied) |
|
135 |
self.assertEqual(e.path, 'porridge/gaduhistory.git') |
|
136 |
self.assertEqual(e.extra, ': denied to jelmer') |
|
137 |
||
|
7379.1.1
by Jelmer Vernooij
Handle invalid repository name on GitHub. |
138 |
def test_invalid_repo_name(self): |
139 |
e = parse_git_error( |
|
140 |
"url", |
|
141 |
"""Gregwar/fatcat/tree/debian is not a valid repository name |
|
142 |
Email support@github.com for help
|
|
143 |
""") |
|
144 |
self.assertIsInstance(e, NotBranchError) |
|
145 |
||
|
7490.91.1
by Jelmer Vernooij
Handle GitLab protected branch errors. |
146 |
def test_invalid_git_error(self): |
147 |
self.assertEqual( |
|
148 |
PermissionDenied( |
|
149 |
'url', |
|
150 |
'GitLab: You are not allowed to push code to protected '
|
|
151 |
'branches on this project.'), |
|
152 |
parse_git_error( |
|
153 |
'url', |
|
154 |
RemoteGitError( |
|
155 |
'GitLab: You are not allowed to push code to '
|
|
156 |
'protected branches on this project.'))) |
|
157 |
||
|
0.295.1
by Jelmer Vernooij
Split up branch formats. |
158 |
|
|
7490.29.12
by Jelmer Vernooij
Parse stderr from remote git servers when they hang up. |
159 |
class ParseHangupTests(TestCase): |
160 |
||
161 |
def setUp(self): |
|
162 |
super(ParseHangupTests, self).setUp() |
|
163 |
try: |
|
|
7490.49.3
by Jelmer Vernooij
Fix tests with newer dulwich. |
164 |
HangupException([b'foo']) |
|
7490.29.12
by Jelmer Vernooij
Parse stderr from remote git servers when they hang up. |
165 |
except TypeError: |
166 |
self.skipTest('dulwich version too old') |
|
167 |
||
168 |
def test_not_set(self): |
|
169 |
self.assertIsInstance( |
|
170 |
parse_git_hangup('http://', HangupException()), HangupException) |
|
171 |
||
172 |
def test_single_line(self): |
|
173 |
self.assertEqual( |
|
174 |
RemoteGitError('foo bar'), |
|
|
7490.49.3
by Jelmer Vernooij
Fix tests with newer dulwich. |
175 |
parse_git_hangup('http://', HangupException([b'foo bar']))) |
|
7490.29.12
by Jelmer Vernooij
Parse stderr from remote git servers when they hang up. |
176 |
|
177 |
def test_multi_lines(self): |
|
178 |
self.assertEqual( |
|
179 |
RemoteGitError('foo bar\nbla bla'), |
|
180 |
parse_git_hangup( |
|
|
7490.49.3
by Jelmer Vernooij
Fix tests with newer dulwich. |
181 |
'http://', HangupException([b'foo bar', b'bla bla']))) |
|
7490.29.12
by Jelmer Vernooij
Parse stderr from remote git servers when they hang up. |
182 |
|
183 |
def test_filter_boring(self): |
|
184 |
self.assertEqual( |
|
185 |
RemoteGitError('foo bar'), parse_git_hangup('http://', HangupException( |
|
|
7490.49.3
by Jelmer Vernooij
Fix tests with newer dulwich. |
186 |
[b'=======', b'foo bar', b'======']))) |
|
7490.50.2
by Jelmer Vernooij
Strip 'remote: ' prefixes. |
187 |
self.assertEqual( |
188 |
RemoteGitError('foo bar'), parse_git_hangup('http://', HangupException( |
|
189 |
[b'remote: =======', b'remote: foo bar', b'remote: ======']))) |
|
|
7490.29.12
by Jelmer Vernooij
Parse stderr from remote git servers when they hang up. |
190 |
|
191 |
def test_permission_denied(self): |
|
192 |
self.assertEqual( |
|
193 |
PermissionDenied('http://', 'You are not allowed to push code to this project.'), |
|
194 |
parse_git_hangup( |
|
195 |
'http://', |
|
196 |
HangupException( |
|
|
7490.49.3
by Jelmer Vernooij
Fix tests with newer dulwich. |
197 |
[b'=======', |
198 |
b'You are not allowed to push code to this project.', b'', b'======']))) |
|
|
7490.29.12
by Jelmer Vernooij
Parse stderr from remote git servers when they hang up. |
199 |
|
200 |
||
|
0.295.1
by Jelmer Vernooij
Split up branch formats. |
201 |
class TestRemoteGitBranchFormat(TestCase): |
202 |
||
203 |
def setUp(self): |
|
204 |
super(TestRemoteGitBranchFormat, self).setUp() |
|
205 |
self.format = RemoteGitBranchFormat() |
|
206 |
||
207 |
def test_get_format_description(self): |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
208 |
self.assertEqual("Remote Git Branch", |
209 |
self.format.get_format_description()) |
|
|
0.295.1
by Jelmer Vernooij
Split up branch formats. |
210 |
|
211 |
def test_get_network_name(self): |
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
212 |
self.assertEqual(b"git", self.format.network_name()) |
|
0.295.1
by Jelmer Vernooij
Split up branch formats. |
213 |
|
214 |
def test_supports_tags(self): |
|
215 |
self.assertTrue(self.format.supports_tags()) |
|
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
216 |
|
217 |
||
|
7131.12.1
by Jelmer Vernooij
Support uncommit on remote git branches. |
218 |
class TestRemoteGitBranch(TestCaseWithTransport): |
219 |
||
|
7183.1.1
by Jelmer Vernooij
Add missing feature for git test that requires git executable. |
220 |
_test_needs_features = [ExecutableFeature('git')] |
221 |
||
|
7131.12.1
by Jelmer Vernooij
Support uncommit on remote git branches. |
222 |
def setUp(self): |
223 |
TestCaseWithTransport.setUp(self) |
|
224 |
self.remote_real = GitRepo.init('remote', mkdir=True) |
|
225 |
self.remote_url = 'git://%s/' % os.path.abspath(self.remote_real.path) |
|
226 |
self.permit_url(self.remote_url) |
|
227 |
||
228 |
def test_set_last_revision_info(self): |
|
229 |
c1 = self.remote_real.do_commit( |
|
|
7143.16.8
by Jelmer Vernooij
Fix E126 |
230 |
message=b'message 1', |
231 |
committer=b'committer <committer@example.com>', |
|
232 |
author=b'author <author@example.com>', |
|
233 |
ref=b'refs/heads/newbranch') |
|
|
7131.12.1
by Jelmer Vernooij
Support uncommit on remote git branches. |
234 |
c2 = self.remote_real.do_commit( |
|
7143.16.8
by Jelmer Vernooij
Fix E126 |
235 |
message=b'message 2', |
236 |
committer=b'committer <committer@example.com>', |
|
237 |
author=b'author <author@example.com>', |
|
238 |
ref=b'refs/heads/newbranch') |
|
|
7131.12.1
by Jelmer Vernooij
Support uncommit on remote git branches. |
239 |
|
240 |
remote = ControlDir.open(self.remote_url) |
|
241 |
newbranch = remote.open_branch('newbranch') |
|
242 |
self.assertEqual(newbranch.lookup_foreign_revision_id(c2), |
|
243 |
newbranch.last_revision()) |
|
244 |
newbranch.set_last_revision_info( |
|
245 |
1, newbranch.lookup_foreign_revision_id(c1)) |
|
|
7131.12.2
by Jelmer Vernooij
Fix tests on python 3. |
246 |
self.assertEqual(c1, self.remote_real.refs[b'refs/heads/newbranch']) |
|
7131.12.1
by Jelmer Vernooij
Support uncommit on remote git branches. |
247 |
self.assertEqual(newbranch.last_revision(), |
248 |
newbranch.lookup_foreign_revision_id(c1)) |
|
249 |
||
250 |
||
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
251 |
class FetchFromRemoteTestBase(object): |
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
252 |
|
253 |
_test_needs_features = [ExecutableFeature('git')] |
|
254 |
||
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
255 |
_to_format = None |
256 |
||
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
257 |
def setUp(self): |
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
258 |
TestCaseWithTransport.setUp(self) |
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
259 |
self.remote_real = GitRepo.init('remote', mkdir=True) |
260 |
self.remote_url = 'git://%s/' % os.path.abspath(self.remote_real.path) |
|
261 |
self.permit_url(self.remote_url) |
|
262 |
||
263 |
def test_sprout_simple(self): |
|
264 |
self.remote_real.do_commit( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
265 |
message=b'message', |
266 |
committer=b'committer <committer@example.com>', |
|
267 |
author=b'author <author@example.com>') |
|
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
268 |
|
269 |
remote = ControlDir.open(self.remote_url) |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
270 |
self.make_controldir('local', format=self._to_format) |
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
271 |
local = remote.sprout('local') |
272 |
self.assertEqual( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
273 |
default_mapping.revision_id_foreign_to_bzr( |
274 |
self.remote_real.head()), |
|
275 |
local.open_branch().last_revision()) |
|
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
276 |
|
277 |
def test_sprout_with_tags(self): |
|
278 |
c1 = self.remote_real.do_commit( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
279 |
message=b'message', |
280 |
committer=b'committer <committer@example.com>', |
|
281 |
author=b'author <author@example.com>') |
|
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
282 |
c2 = self.remote_real.do_commit( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
283 |
message=b'another commit', |
284 |
committer=b'committer <committer@example.com>', |
|
285 |
author=b'author <author@example.com>', |
|
286 |
ref=b'refs/tags/another') |
|
|
7018.3.8
by Jelmer Vernooij
Disable some flaky tests on python3, allow running without fastimport. |
287 |
self.remote_real.refs[b'refs/tags/blah'] = self.remote_real.head() |
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
288 |
|
289 |
remote = ControlDir.open(self.remote_url) |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
290 |
self.make_controldir('local', format=self._to_format) |
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
291 |
local = remote.sprout('local') |
292 |
local_branch = local.open_branch() |
|
293 |
self.assertEqual( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
294 |
default_mapping.revision_id_foreign_to_bzr(c1), |
295 |
local_branch.last_revision()) |
|
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
296 |
self.assertEqual( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
297 |
{'blah': local_branch.last_revision(), |
298 |
'another': default_mapping.revision_id_foreign_to_bzr(c2)}, |
|
299 |
local_branch.tags.get_tag_dict()) |
|
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
300 |
|
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
301 |
def test_sprout_with_annotated_tag(self): |
302 |
c1 = self.remote_real.do_commit( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
303 |
message=b'message', |
304 |
committer=b'committer <committer@example.com>', |
|
305 |
author=b'author <author@example.com>') |
|
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
306 |
c2 = self.remote_real.do_commit( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
307 |
message=b'another commit', |
308 |
committer=b'committer <committer@example.com>', |
|
309 |
author=b'author <author@example.com>', |
|
310 |
ref=b'refs/heads/another') |
|
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
311 |
porcelain.tag_create( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
312 |
self.remote_real, |
313 |
tag=b"blah", |
|
314 |
author=b'author <author@example.com>', |
|
315 |
objectish=c2, |
|
316 |
tag_time=int(time.time()), |
|
317 |
tag_timezone=0, |
|
318 |
annotated=True, |
|
319 |
message=b"Annotated tag") |
|
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
320 |
|
321 |
remote = ControlDir.open(self.remote_url) |
|
322 |
self.make_controldir('local', format=self._to_format) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
323 |
local = remote.sprout( |
324 |
'local', revision_id=default_mapping.revision_id_foreign_to_bzr(c1)) |
|
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
325 |
local_branch = local.open_branch() |
326 |
self.assertEqual( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
327 |
default_mapping.revision_id_foreign_to_bzr(c1), |
328 |
local_branch.last_revision()) |
|
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
329 |
self.assertEqual( |
|
7143.16.8
by Jelmer Vernooij
Fix E126 |
330 |
{'blah': default_mapping.revision_id_foreign_to_bzr(c2)}, |
331 |
local_branch.tags.get_tag_dict()) |
|
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
332 |
|
|
7143.12.1
by Jelmer Vernooij
Support cloning revisions referenced only by an annotated tag. |
333 |
def test_sprout_with_annotated_tag_unreferenced(self): |
334 |
c1 = self.remote_real.do_commit( |
|
|
7143.16.8
by Jelmer Vernooij
Fix E126 |
335 |
message=b'message', |
336 |
committer=b'committer <committer@example.com>', |
|
337 |
author=b'author <author@example.com>') |
|
|
7143.12.1
by Jelmer Vernooij
Support cloning revisions referenced only by an annotated tag. |
338 |
c2 = self.remote_real.do_commit( |
|
7143.16.8
by Jelmer Vernooij
Fix E126 |
339 |
message=b'another commit', |
340 |
committer=b'committer <committer@example.com>', |
|
341 |
author=b'author <author@example.com>') |
|
|
7143.12.1
by Jelmer Vernooij
Support cloning revisions referenced only by an annotated tag. |
342 |
porcelain.tag_create( |
|
7143.16.8
by Jelmer Vernooij
Fix E126 |
343 |
self.remote_real, |
344 |
tag=b"blah", |
|
345 |
author=b'author <author@example.com>', |
|
346 |
objectish=c1, |
|
347 |
tag_time=int(time.time()), |
|
348 |
tag_timezone=0, |
|
349 |
annotated=True, |
|
350 |
message=b"Annotated tag") |
|
|
7143.12.1
by Jelmer Vernooij
Support cloning revisions referenced only by an annotated tag. |
351 |
|
352 |
remote = ControlDir.open(self.remote_url) |
|
353 |
self.make_controldir('local', format=self._to_format) |
|
354 |
local = remote.sprout( |
|
|
7143.16.8
by Jelmer Vernooij
Fix E126 |
355 |
'local', |
356 |
revision_id=default_mapping.revision_id_foreign_to_bzr(c1)) |
|
|
7143.12.1
by Jelmer Vernooij
Support cloning revisions referenced only by an annotated tag. |
357 |
local_branch = local.open_branch() |
358 |
self.assertEqual( |
|
|
7143.16.8
by Jelmer Vernooij
Fix E126 |
359 |
default_mapping.revision_id_foreign_to_bzr(c1), |
360 |
local_branch.last_revision()) |
|
|
7143.12.1
by Jelmer Vernooij
Support cloning revisions referenced only by an annotated tag. |
361 |
self.assertEqual( |
|
7143.16.8
by Jelmer Vernooij
Fix E126 |
362 |
{'blah': default_mapping.revision_id_foreign_to_bzr(c1)}, |
363 |
local_branch.tags.get_tag_dict()) |
|
|
7143.12.1
by Jelmer Vernooij
Support cloning revisions referenced only by an annotated tag. |
364 |
|
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
365 |
|
|
7143.16.21
by Jelmer Vernooij
Fix regressions. |
366 |
class FetchFromRemoteToBzrTests(FetchFromRemoteTestBase, TestCaseWithTransport): |
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
367 |
|
368 |
_to_format = '2a' |
|
369 |
||
370 |
||
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
371 |
class FetchFromRemoteToGitTests(FetchFromRemoteTestBase, TestCaseWithTransport): |
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
372 |
|
373 |
_to_format = 'git' |
|
374 |
||
375 |
||
376 |
class PushToRemoteBase(object): |
|
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
377 |
|
378 |
_test_needs_features = [ExecutableFeature('git')] |
|
379 |
||
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
380 |
_from_format = None |
381 |
||
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
382 |
def setUp(self): |
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
383 |
TestCaseWithTransport.setUp(self) |
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
384 |
self.remote_real = GitRepo.init('remote', mkdir=True) |
385 |
self.remote_url = 'git://%s/' % os.path.abspath(self.remote_real.path) |
|
386 |
self.permit_url(self.remote_url) |
|
387 |
||
|
0.403.3
by Jelmer Vernooij
Test RemoteGitDir.push_branch. |
388 |
def test_push_branch_new(self): |
389 |
remote = ControlDir.open(self.remote_url) |
|
390 |
wt = self.make_branch_and_tree('local', format=self._from_format) |
|
391 |
self.build_tree(['local/blah']) |
|
392 |
wt.add(['blah']) |
|
393 |
revid = wt.commit('blah') |
|
394 |
||
395 |
if self._from_format == 'git': |
|
|
0.406.2
by Jelmer Vernooij
Add tests. |
396 |
result = remote.push_branch(wt.branch, name='newbranch') |
397 |
else: |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
398 |
result = remote.push_branch( |
399 |
wt.branch, lossy=True, name='newbranch') |
|
|
0.406.2
by Jelmer Vernooij
Add tests. |
400 |
|
401 |
self.assertEqual(0, result.old_revno) |
|
402 |
if self._from_format == 'git': |
|
403 |
self.assertEqual(1, result.new_revno) |
|
404 |
else: |
|
405 |
self.assertIs(None, result.new_revno) |
|
|
0.403.3
by Jelmer Vernooij
Test RemoteGitDir.push_branch. |
406 |
|
|
6964.2.1
by Jelmer Vernooij
Initial work to support brz-git on python3. |
407 |
result.report(BytesIO()) |
|
0.406.3
by Jelmer Vernooij
Add extra tests. |
408 |
|
|
0.403.3
by Jelmer Vernooij
Test RemoteGitDir.push_branch. |
409 |
self.assertEqual( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
410 |
{b'refs/heads/newbranch': self.remote_real.refs[b'refs/heads/newbranch'], |
411 |
},
|
|
412 |
self.remote_real.get_refs()) |
|
|
0.403.3
by Jelmer Vernooij
Test RemoteGitDir.push_branch. |
413 |
|
|
7484.1.2
by Jelmer Vernooij
Add some tests. |
414 |
def test_push_branch_symref(self): |
415 |
cfg = self.remote_real.get_config() |
|
416 |
cfg.set((b'core', ), b'bare', True) |
|
417 |
cfg.write_to_path() |
|
418 |
self.remote_real.refs.set_symbolic_ref(b'HEAD', b'refs/heads/master') |
|
419 |
c1 = self.remote_real.do_commit( |
|
420 |
message=b'message', |
|
421 |
committer=b'committer <committer@example.com>', |
|
422 |
author=b'author <author@example.com>', |
|
423 |
ref=b'refs/heads/master') |
|
424 |
remote = ControlDir.open(self.remote_url) |
|
425 |
wt = self.make_branch_and_tree('local', format=self._from_format) |
|
426 |
self.build_tree(['local/blah']) |
|
427 |
wt.add(['blah']) |
|
428 |
revid = wt.commit('blah') |
|
429 |
||
430 |
if self._from_format == 'git': |
|
431 |
result = remote.push_branch(wt.branch, overwrite=True) |
|
432 |
else: |
|
433 |
result = remote.push_branch(wt.branch, lossy=True, overwrite=True) |
|
434 |
||
435 |
self.assertEqual(None, result.old_revno) |
|
436 |
if self._from_format == 'git': |
|
437 |
self.assertEqual(1, result.new_revno) |
|
438 |
else: |
|
439 |
self.assertIs(None, result.new_revno) |
|
440 |
||
441 |
result.report(BytesIO()) |
|
442 |
||
443 |
self.assertEqual( |
|
|
7484.1.3
by Jelmer Vernooij
Fix formatting. |
444 |
{
|
445 |
b'HEAD': self.remote_real.refs[b'refs/heads/master'], |
|
446 |
b'refs/heads/master': self.remote_real.refs[b'refs/heads/master'], |
|
|
7484.1.2
by Jelmer Vernooij
Add some tests. |
447 |
},
|
448 |
self.remote_real.get_refs()) |
|
449 |
||
|
7289.1.2
by Jelmer Vernooij
Fix pushing of tags as part of nascent git branches. |
450 |
def test_push_branch_new_with_tags(self): |
451 |
remote = ControlDir.open(self.remote_url) |
|
452 |
builder = self.make_branch_builder('local', format=self._from_format) |
|
453 |
builder.start_series() |
|
454 |
rev_1 = builder.build_snapshot(None, [ |
|
455 |
('add', ('', None, 'directory', '')), |
|
456 |
('add', ('filename', None, 'file', b'content'))]) |
|
457 |
rev_2 = builder.build_snapshot( |
|
458 |
[rev_1], [('modify', ('filename', b'new-content\n'))]) |
|
459 |
rev_3 = builder.build_snapshot( |
|
460 |
[rev_1], [('modify', ('filename', b'new-new-content\n'))]) |
|
461 |
builder.finish_series() |
|
462 |
branch = builder.get_branch() |
|
463 |
try: |
|
464 |
branch.tags.set_tag('atag', rev_2) |
|
465 |
except TagsNotSupported: |
|
466 |
raise TestNotApplicable('source format does not support tags') |
|
467 |
||
468 |
branch.get_config_stack().set('branch.fetch_tags', True) |
|
469 |
if self._from_format == 'git': |
|
470 |
result = remote.push_branch(branch, name='newbranch') |
|
471 |
else: |
|
472 |
result = remote.push_branch( |
|
473 |
branch, lossy=True, name='newbranch') |
|
474 |
||
475 |
self.assertEqual(0, result.old_revno) |
|
476 |
if self._from_format == 'git': |
|
477 |
self.assertEqual(2, result.new_revno) |
|
478 |
else: |
|
479 |
self.assertIs(None, result.new_revno) |
|
480 |
||
481 |
result.report(BytesIO()) |
|
482 |
||
483 |
self.assertEqual( |
|
484 |
{b'refs/heads/newbranch', b'refs/tags/atag'}, |
|
485 |
set(self.remote_real.get_refs().keys())) |
|
486 |
||
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
487 |
def test_push(self): |
488 |
c1 = self.remote_real.do_commit( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
489 |
message=b'message', |
490 |
committer=b'committer <committer@example.com>', |
|
491 |
author=b'author <author@example.com>') |
|
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
492 |
|
493 |
remote = ControlDir.open(self.remote_url) |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
494 |
self.make_controldir('local', format=self._from_format) |
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
495 |
local = remote.sprout('local') |
496 |
self.build_tree(['local/blah']) |
|
497 |
wt = local.open_workingtree() |
|
498 |
wt.add(['blah']) |
|
499 |
revid = wt.commit('blah') |
|
500 |
wt.branch.tags.set_tag('sometag', revid) |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
501 |
wt.branch.get_config_stack().set('branch.fetch_tags', True) |
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
502 |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
503 |
if self._from_format == 'git': |
|
0.406.2
by Jelmer Vernooij
Add tests. |
504 |
result = wt.branch.push(remote.create_branch('newbranch')) |
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
505 |
else: |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
506 |
result = wt.branch.push( |
507 |
remote.create_branch('newbranch'), lossy=True) |
|
|
0.406.2
by Jelmer Vernooij
Add tests. |
508 |
|
509 |
self.assertEqual(0, result.old_revno) |
|
510 |
self.assertEqual(2, result.new_revno) |
|
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
511 |
|
|
6964.2.1
by Jelmer Vernooij
Initial work to support brz-git on python3. |
512 |
result.report(BytesIO()) |
|
0.406.3
by Jelmer Vernooij
Add extra tests. |
513 |
|
|
0.376.1
by Jelmer Vernooij
Add tests for remote operations. |
514 |
self.assertEqual( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
515 |
{b'refs/heads/master': self.remote_real.head(), |
516 |
b'HEAD': self.remote_real.head(), |
|
517 |
b'refs/heads/newbranch': self.remote_real.refs[b'refs/heads/newbranch'], |
|
518 |
b'refs/tags/sometag': self.remote_real.refs[b'refs/heads/newbranch'], |
|
519 |
},
|
|
520 |
self.remote_real.get_refs()) |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
521 |
|
|
0.404.5
by Jelmer Vernooij
Check for diverged branches during push. |
522 |
def test_push_diverged(self): |
523 |
c1 = self.remote_real.do_commit( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
524 |
message=b'message', |
525 |
committer=b'committer <committer@example.com>', |
|
526 |
author=b'author <author@example.com>', |
|
527 |
ref=b'refs/heads/newbranch') |
|
|
0.404.5
by Jelmer Vernooij
Check for diverged branches during push. |
528 |
|
529 |
remote = ControlDir.open(self.remote_url) |
|
530 |
wt = self.make_branch_and_tree('local', format=self._from_format) |
|
531 |
self.build_tree(['local/blah']) |
|
532 |
wt.add(['blah']) |
|
533 |
revid = wt.commit('blah') |
|
534 |
||
535 |
newbranch = remote.open_branch('newbranch') |
|
536 |
if self._from_format == 'git': |
|
537 |
self.assertRaises(DivergedBranches, wt.branch.push, newbranch) |
|
538 |
else: |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
539 |
self.assertRaises(DivergedBranches, wt.branch.push, |
540 |
newbranch, lossy=True) |
|
|
0.404.5
by Jelmer Vernooij
Check for diverged branches during push. |
541 |
|
542 |
self.assertEqual( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
543 |
{b'refs/heads/newbranch': c1}, |
544 |
self.remote_real.get_refs()) |
|
|
0.404.5
by Jelmer Vernooij
Check for diverged branches during push. |
545 |
|
546 |
if self._from_format == 'git': |
|
547 |
wt.branch.push(newbranch, overwrite=True) |
|
548 |
else: |
|
549 |
wt.branch.push(newbranch, lossy=True, overwrite=True) |
|
550 |
||
|
7018.3.8
by Jelmer Vernooij
Disable some flaky tests on python3, allow running without fastimport. |
551 |
self.assertNotEqual(c1, self.remote_real.refs[b'refs/heads/newbranch']) |
|
0.404.5
by Jelmer Vernooij
Check for diverged branches during push. |
552 |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
553 |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
554 |
class PushToRemoteFromBzrTests(PushToRemoteBase, TestCaseWithTransport): |
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
555 |
|
556 |
_from_format = '2a' |
|
557 |
||
558 |
||
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
559 |
class PushToRemoteFromGitTests(PushToRemoteBase, TestCaseWithTransport): |
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
560 |
|
561 |
_from_format = 'git' |
|
562 |
||
563 |
||
564 |
class RemoteControlDirTests(TestCaseWithTransport): |
|
565 |
||
566 |
_test_needs_features = [ExecutableFeature('git')] |
|
567 |
||
568 |
def setUp(self): |
|
569 |
TestCaseWithTransport.setUp(self) |
|
570 |
self.remote_real = GitRepo.init('remote', mkdir=True) |
|
571 |
self.remote_url = 'git://%s/' % os.path.abspath(self.remote_real.path) |
|
572 |
self.permit_url(self.remote_url) |
|
573 |
||
574 |
def test_remove_branch(self): |
|
575 |
c1 = self.remote_real.do_commit( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
576 |
message=b'message', |
577 |
committer=b'committer <committer@example.com>', |
|
578 |
author=b'author <author@example.com>') |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
579 |
c2 = self.remote_real.do_commit( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
580 |
message=b'another commit', |
581 |
committer=b'committer <committer@example.com>', |
|
582 |
author=b'author <author@example.com>', |
|
583 |
ref=b'refs/heads/blah') |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
584 |
|
585 |
remote = ControlDir.open(self.remote_url) |
|
586 |
remote.destroy_branch(name='blah') |
|
587 |
self.assertEqual( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
588 |
self.remote_real.get_refs(), |
589 |
{b'refs/heads/master': self.remote_real.head(), |
|
590 |
b'HEAD': self.remote_real.head(), |
|
591 |
})
|
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
592 |
|
593 |
def test_list_branches(self): |
|
594 |
c1 = self.remote_real.do_commit( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
595 |
message=b'message', |
596 |
committer=b'committer <committer@example.com>', |
|
597 |
author=b'author <author@example.com>') |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
598 |
c2 = self.remote_real.do_commit( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
599 |
message=b'another commit', |
600 |
committer=b'committer <committer@example.com>', |
|
601 |
author=b'author <author@example.com>', |
|
602 |
ref=b'refs/heads/blah') |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
603 |
|
604 |
remote = ControlDir.open(self.remote_url) |
|
605 |
self.assertEqual( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
606 |
set(['master', 'blah', 'master']), |
607 |
set([b.name for b in remote.list_branches()])) |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
608 |
|
609 |
def test_get_branches(self): |
|
610 |
c1 = self.remote_real.do_commit( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
611 |
message=b'message', |
612 |
committer=b'committer <committer@example.com>', |
|
613 |
author=b'author <author@example.com>') |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
614 |
c2 = self.remote_real.do_commit( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
615 |
message=b'another commit', |
616 |
committer=b'committer <committer@example.com>', |
|
617 |
author=b'author <author@example.com>', |
|
618 |
ref=b'refs/heads/blah') |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
619 |
|
620 |
remote = ControlDir.open(self.remote_url) |
|
621 |
self.assertEqual( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
622 |
{'': 'master', 'blah': 'blah', 'master': 'master'}, |
623 |
{n: b.name for (n, b) in remote.get_branches().items()}) |
|
|
7490.13.6
by Jelmer Vernooij
Fix tests. |
624 |
self.assertEqual( |
625 |
set(['', 'blah', 'master']), set(remote.branch_names())) |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
626 |
|
627 |
def test_remove_tag(self): |
|
628 |
c1 = self.remote_real.do_commit( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
629 |
message=b'message', |
630 |
committer=b'committer <committer@example.com>', |
|
631 |
author=b'author <author@example.com>') |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
632 |
c2 = self.remote_real.do_commit( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
633 |
message=b'another commit', |
634 |
committer=b'committer <committer@example.com>', |
|
635 |
author=b'author <author@example.com>', |
|
636 |
ref=b'refs/tags/blah') |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
637 |
|
638 |
remote = ControlDir.open(self.remote_url) |
|
639 |
remote_branch = remote.open_branch() |
|
640 |
remote_branch.tags.delete_tag('blah') |
|
641 |
self.assertRaises(NoSuchTag, remote_branch.tags.delete_tag, 'blah') |
|
642 |
self.assertEqual( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
643 |
self.remote_real.get_refs(), |
644 |
{b'refs/heads/master': self.remote_real.head(), |
|
645 |
b'HEAD': self.remote_real.head(), |
|
646 |
})
|
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
647 |
|
648 |
def test_set_tag(self): |
|
649 |
c1 = self.remote_real.do_commit( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
650 |
message=b'message', |
651 |
committer=b'committer <committer@example.com>', |
|
652 |
author=b'author <author@example.com>') |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
653 |
c2 = self.remote_real.do_commit( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
654 |
message=b'another commit', |
655 |
committer=b'committer <committer@example.com>', |
|
656 |
author=b'author <author@example.com>') |
|
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
657 |
|
658 |
remote = ControlDir.open(self.remote_url) |
|
659 |
remote.open_branch().tags.set_tag( |
|
|
6964.2.1
by Jelmer Vernooij
Initial work to support brz-git on python3. |
660 |
b'blah', default_mapping.revision_id_foreign_to_bzr(c1)) |
|
0.377.1
by Jelmer Vernooij
Fix some remote operations and add more tests. |
661 |
self.assertEqual( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
662 |
self.remote_real.get_refs(), |
663 |
{b'refs/heads/master': self.remote_real.head(), |
|
664 |
b'refs/tags/blah': c1, |
|
665 |
b'HEAD': self.remote_real.head(), |
|
666 |
})
|
|
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
667 |
|
668 |
def test_annotated_tag(self): |
|
669 |
c1 = self.remote_real.do_commit( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
670 |
message=b'message', |
671 |
committer=b'committer <committer@example.com>', |
|
672 |
author=b'author <author@example.com>') |
|
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
673 |
c2 = self.remote_real.do_commit( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
674 |
message=b'another commit', |
675 |
committer=b'committer <committer@example.com>', |
|
676 |
author=b'author <author@example.com>') |
|
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
677 |
|
678 |
porcelain.tag_create( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
679 |
self.remote_real, |
680 |
tag=b"blah", |
|
681 |
author=b'author <author@example.com>', |
|
682 |
objectish=c2, |
|
683 |
tag_time=int(time.time()), |
|
684 |
tag_timezone=0, |
|
685 |
annotated=True, |
|
686 |
message=b"Annotated tag") |
|
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
687 |
|
688 |
remote = ControlDir.open(self.remote_url) |
|
689 |
remote_branch = remote.open_branch() |
|
690 |
self.assertEqual({ |
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
691 |
'blah': default_mapping.revision_id_foreign_to_bzr(c2)}, |
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
692 |
remote_branch.tags.get_tag_dict()) |
693 |
||
|
7142.3.1
by Jelmer Vernooij
Support .nick on remote branches and fix get_branch_reference. |
694 |
def test_get_branch_reference(self): |
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
695 |
c1 = self.remote_real.do_commit( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
696 |
message=b'message', |
697 |
committer=b'committer <committer@example.com>', |
|
698 |
author=b'author <author@example.com>') |
|
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
699 |
c2 = self.remote_real.do_commit( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
700 |
message=b'another commit', |
701 |
committer=b'committer <committer@example.com>', |
|
702 |
author=b'author <author@example.com>') |
|
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
703 |
|
704 |
remote = ControlDir.open(self.remote_url) |
|
|
6964.2.1
by Jelmer Vernooij
Initial work to support brz-git on python3. |
705 |
self.assertEqual(b'refs/heads/master', remote.get_branch_reference('')) |
|
0.382.1
by Jelmer Vernooij
Various fixes for annotated tags and symrefs. |
706 |
self.assertEqual(None, remote.get_branch_reference('master')) |
|
7142.3.1
by Jelmer Vernooij
Support .nick on remote branches and fix get_branch_reference. |
707 |
|
708 |
def test_get_branch_nick(self): |
|
709 |
c1 = self.remote_real.do_commit( |
|
|
7143.16.21
by Jelmer Vernooij
Fix regressions. |
710 |
message=b'message', |
711 |
committer=b'committer <committer@example.com>', |
|
712 |
author=b'author <author@example.com>') |
|
|
7142.3.1
by Jelmer Vernooij
Support .nick on remote branches and fix get_branch_reference. |
713 |
remote = ControlDir.open(self.remote_url) |
714 |
self.assertEqual('master', remote.open_branch().nick) |
|
|
7371.3.2
by Jelmer Vernooij
Fix URL parsing for Git. |
715 |
|
716 |
||
717 |
class GitUrlAndPathFromTransportTests(TestCase): |
|
718 |
||
719 |
def test_file(self): |
|
720 |
split_url = _git_url_and_path_from_transport('file:///home/blah') |
|
721 |
self.assertEqual(split_url.scheme, 'file') |
|
722 |
self.assertEqual(split_url.path, '/home/blah') |
|
723 |
||
724 |
def test_file_segment_params(self): |
|
725 |
split_url = _git_url_and_path_from_transport('file:///home/blah,branch=master') |
|
726 |
self.assertEqual(split_url.scheme, 'file') |
|
727 |
self.assertEqual(split_url.path, '/home/blah') |
|
728 |
||
729 |
def test_git_smart(self): |
|
730 |
split_url = _git_url_and_path_from_transport( |
|
731 |
'git://github.com/dulwich/dulwich,branch=master') |
|
732 |
self.assertEqual(split_url.scheme, 'git') |
|
733 |
self.assertEqual(split_url.path, '/dulwich/dulwich') |
|
734 |
||
735 |
def test_https(self): |
|
736 |
split_url = _git_url_and_path_from_transport( |
|
737 |
'https://github.com/dulwich/dulwich') |
|
738 |
self.assertEqual(split_url.scheme, 'https') |
|
739 |
self.assertEqual(split_url.path, '/dulwich/dulwich') |
|
740 |
||
741 |
def test_https_segment_params(self): |
|
742 |
split_url = _git_url_and_path_from_transport( |
|
743 |
'https://github.com/dulwich/dulwich,branch=master') |
|
744 |
self.assertEqual(split_url.scheme, 'https') |
|
745 |
self.assertEqual(split_url.path, '/dulwich/dulwich') |