bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.200.51
by Jelmer Vernooij
Fix copyright. |
1 |
# Copyright (C) 2007 Jelmer Vernooij <jelmer@samba.org>
|
|
0.200.727
by Jelmer Vernooij
Cope with different encodings better, rather than just stripping out |
2 |
# -*- encoding: utf-8 -*-
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
3 |
#
|
|
0.201.1
by Jelmer Vernooij
Add very small initial testsuite. |
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.
|
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
8 |
#
|
|
0.201.1
by Jelmer Vernooij
Add very small initial testsuite. |
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.
|
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
13 |
#
|
|
0.201.1
by Jelmer Vernooij
Add very small initial testsuite. |
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
|
|
16 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
17 |
||
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
18 |
from ....bzr.inventory import ( |
|
0.200.588
by Jelmer Vernooij
Cope with empty directories that are not allowed in git. |
19 |
InventoryDirectory, |
20 |
InventoryFile, |
|
21 |
)
|
|
|
0.200.1642
by Jelmer Vernooij
Use relative imports in tests. |
22 |
from ....revision import ( |
|
0.252.7
by Jelmer Vernooij
Add basic test for roundtripping from Bazaar. |
23 |
Revision, |
24 |
)
|
|
|
0.200.588
by Jelmer Vernooij
Cope with empty directories that are not allowed in git. |
25 |
|
|
0.200.264
by Jelmer Vernooij
Add more tests. |
26 |
from dulwich.objects import ( |
|
0.200.588
by Jelmer Vernooij
Cope with empty directories that are not allowed in git. |
27 |
Blob, |
|
0.200.264
by Jelmer Vernooij
Add more tests. |
28 |
Commit, |
|
0.200.588
by Jelmer Vernooij
Cope with empty directories that are not allowed in git. |
29 |
Tree, |
|
0.200.1589
by Jelmer Vernooij
Add test to make sure that certain invalid timezones are roundtripped correctly. |
30 |
parse_timezone, |
|
0.200.264
by Jelmer Vernooij
Add more tests. |
31 |
)
|
32 |
||
|
0.200.1642
by Jelmer Vernooij
Use relative imports in tests. |
33 |
from .. import tests |
34 |
from ..errors import UnknownCommitExtra |
|
35 |
from ..mapping import ( |
|
|
0.200.258
by Jelmer Vernooij
add tests for file id escape/unescape. |
36 |
BzrGitMappingv1, |
|
0.200.588
by Jelmer Vernooij
Cope with empty directories that are not allowed in git. |
37 |
directory_to_tree, |
|
0.200.258
by Jelmer Vernooij
add tests for file id escape/unescape. |
38 |
escape_file_id, |
39 |
unescape_file_id, |
|
40 |
)
|
|
|
0.200.190
by Jelmer Vernooij
Bless current mapping as v1. |
41 |
|
42 |
||
43 |
class TestRevidConversionV1(tests.TestCase): |
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
44 |
|
45 |
def test_simple_git_to_bzr_revision_id(self): |
|
|
0.200.190
by Jelmer Vernooij
Bless current mapping as v1. |
46 |
self.assertEqual("git-v1:" |
|
0.204.1
by James Westby
Fix id tests to match new revid prefix. |
47 |
"c6a4d8f1fa4ac650748e647c4b1b368f589a7356", |
|
0.200.190
by Jelmer Vernooij
Bless current mapping as v1. |
48 |
BzrGitMappingv1().revision_id_foreign_to_bzr( |
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
49 |
"c6a4d8f1fa4ac650748e647c4b1b368f589a7356")) |
50 |
||
51 |
def test_simple_bzr_to_git_revision_id(self): |
|
|
0.200.195
by Jelmer Vernooij
Return mapping in revision_id_bzr_to_foreign() as required by the interface. |
52 |
self.assertEqual(("c6a4d8f1fa4ac650748e647c4b1b368f589a7356", |
53 |
BzrGitMappingv1()), |
|
|
0.200.190
by Jelmer Vernooij
Bless current mapping as v1. |
54 |
BzrGitMappingv1().revision_id_bzr_to_foreign( |
55 |
"git-v1:"
|
|
|
0.204.1
by James Westby
Fix id tests to match new revid prefix. |
56 |
"c6a4d8f1fa4ac650748e647c4b1b368f589a7356")) |
|
0.200.258
by Jelmer Vernooij
add tests for file id escape/unescape. |
57 |
|
|
0.252.26
by Jelmer Vernooij
Add is_control_file method to BzrGitMapping. |
58 |
def test_is_control_file(self): |
59 |
mapping = BzrGitMappingv1() |
|
|
0.200.920
by Jelmer Vernooij
Fix some more tests. |
60 |
if mapping.roundtripping: |
61 |
self.assertTrue(mapping.is_control_file(".bzrdummy")) |
|
62 |
self.assertTrue(mapping.is_control_file(".bzrfileids")) |
|
|
0.252.26
by Jelmer Vernooij
Add is_control_file method to BzrGitMapping. |
63 |
self.assertFalse(mapping.is_control_file(".bzrfoo")) |
64 |
||
|
0.200.973
by Jelmer Vernooij
Add tests for generate_file_id. |
65 |
def test_generate_file_id(self): |
66 |
mapping = BzrGitMappingv1() |
|
67 |
self.assertIsInstance(mapping.generate_file_id("la"), str) |
|
68 |
self.assertIsInstance(mapping.generate_file_id(u"é"), str) |
|
69 |
||
|
0.200.258
by Jelmer Vernooij
add tests for file id escape/unescape. |
70 |
|
71 |
class FileidTests(tests.TestCase): |
|
72 |
||
73 |
def test_escape_space(self): |
|
74 |
self.assertEquals("bla_s", escape_file_id("bla ")) |
|
75 |
||
|
0.200.1419
by Jelmer Vernooij
Escape/unescape ^L characters. |
76 |
def test_escape_control_l(self): |
77 |
self.assertEquals("bla_c", escape_file_id("bla\x0c")) |
|
78 |
||
79 |
def test_unescape_control_l(self): |
|
80 |
self.assertEquals("bla\x0c", unescape_file_id("bla_c")) |
|
81 |
||
|
0.200.258
by Jelmer Vernooij
add tests for file id escape/unescape. |
82 |
def test_escape_underscore(self): |
83 |
self.assertEquals("bla__", escape_file_id("bla_")) |
|
84 |
||
85 |
def test_escape_underscore_space(self): |
|
86 |
self.assertEquals("bla___s", escape_file_id("bla_ ")) |
|
87 |
||
88 |
def test_unescape_underscore(self): |
|
89 |
self.assertEquals("bla ", unescape_file_id("bla_s")) |
|
90 |
||
91 |
def test_unescape_underscore_space(self): |
|
92 |
self.assertEquals("bla _", unescape_file_id("bla_s__")) |
|
|
0.200.264
by Jelmer Vernooij
Add more tests. |
93 |
|
94 |
||
95 |
class TestImportCommit(tests.TestCase): |
|
96 |
||
97 |
def test_commit(self): |
|
98 |
c = Commit() |
|
|
0.200.416
by Jelmer Vernooij
Use public properties to set git objects values. |
99 |
c.tree = "cc9462f7f8263ef5adfbeff2fb936bb36b504cba" |
100 |
c.message = "Some message" |
|
101 |
c.committer = "Committer" |
|
102 |
c.commit_time = 4 |
|
103 |
c.author_time = 5 |
|
|
0.200.440
by Jelmer Vernooij
Remove silly mapping of timezones; dulwich uses offsets now as well. |
104 |
c.commit_timezone = 60 * 5 |
105 |
c.author_timezone = 60 * 3 |
|
|
0.200.416
by Jelmer Vernooij
Use public properties to set git objects values. |
106 |
c.author = "Author" |
|
0.252.44
by Jelmer Vernooij
Properly look up Bazaar revision ids for revision parents in case they are round-tripped. |
107 |
mapping = BzrGitMappingv1() |
|
0.200.1029
by Jelmer Vernooij
Use dictionary with verifiers rather than requiring testament3-sha1 everywhere. |
108 |
rev, roundtrip_revid, verifiers = mapping.import_commit(c, |
|
0.200.1021
by Jelmer Vernooij
Put testament sha1 in revisions. |
109 |
mapping.revision_id_foreign_to_bzr) |
110 |
self.assertEquals(None, roundtrip_revid) |
|
|
0.200.1029
by Jelmer Vernooij
Use dictionary with verifiers rather than requiring testament3-sha1 everywhere. |
111 |
self.assertEquals({}, verifiers) |
|
0.200.264
by Jelmer Vernooij
Add more tests. |
112 |
self.assertEquals("Some message", rev.message) |
113 |
self.assertEquals("Committer", rev.committer) |
|
114 |
self.assertEquals("Author", rev.properties['author']) |
|
|
0.200.368
by Jelmer Vernooij
Cope with more granular timezones. |
115 |
self.assertEquals(300, rev.timezone) |
|
0.200.264
by Jelmer Vernooij
Add more tests. |
116 |
self.assertEquals((), rev.parent_ids) |
|
0.200.351
by Jelmer Vernooij
Add roundtrip tests. |
117 |
self.assertEquals("5", rev.properties['author-timestamp']) |
|
0.200.440
by Jelmer Vernooij
Remove silly mapping of timezones; dulwich uses offsets now as well. |
118 |
self.assertEquals("180", rev.properties['author-timezone']) |
|
0.200.264
by Jelmer Vernooij
Add more tests. |
119 |
self.assertEquals("git-v1:" + c.id, rev.revision_id) |
|
0.200.351
by Jelmer Vernooij
Add roundtrip tests. |
120 |
|
|
0.200.727
by Jelmer Vernooij
Cope with different encodings better, rather than just stripping out |
121 |
def test_explicit_encoding(self): |
122 |
c = Commit() |
|
123 |
c.tree = "cc9462f7f8263ef5adfbeff2fb936bb36b504cba" |
|
124 |
c.message = "Some message" |
|
125 |
c.committer = "Committer" |
|
126 |
c.commit_time = 4 |
|
127 |
c.author_time = 5 |
|
128 |
c.commit_timezone = 60 * 5 |
|
129 |
c.author_timezone = 60 * 3 |
|
130 |
c.author = u"Authér".encode("iso8859-1") |
|
131 |
c.encoding = "iso8859-1" |
|
|
0.252.44
by Jelmer Vernooij
Properly look up Bazaar revision ids for revision parents in case they are round-tripped. |
132 |
mapping = BzrGitMappingv1() |
|
0.200.1029
by Jelmer Vernooij
Use dictionary with verifiers rather than requiring testament3-sha1 everywhere. |
133 |
rev, roundtrip_revid, verifiers = mapping.import_commit(c, |
|
0.200.1021
by Jelmer Vernooij
Put testament sha1 in revisions. |
134 |
mapping.revision_id_foreign_to_bzr) |
135 |
self.assertEquals(None, roundtrip_revid) |
|
|
0.200.1029
by Jelmer Vernooij
Use dictionary with verifiers rather than requiring testament3-sha1 everywhere. |
136 |
self.assertEquals({}, verifiers) |
|
0.200.727
by Jelmer Vernooij
Cope with different encodings better, rather than just stripping out |
137 |
self.assertEquals(u"Authér", rev.properties['author']) |
138 |
self.assertEquals("iso8859-1", rev.properties["git-explicit-encoding"]) |
|
139 |
self.assertTrue("git-implicit-encoding" not in rev.properties) |
|
140 |
||
141 |
def test_implicit_encoding_fallback(self): |
|
142 |
c = Commit() |
|
143 |
c.tree = "cc9462f7f8263ef5adfbeff2fb936bb36b504cba" |
|
144 |
c.message = "Some message" |
|
145 |
c.committer = "Committer" |
|
146 |
c.commit_time = 4 |
|
147 |
c.author_time = 5 |
|
148 |
c.commit_timezone = 60 * 5 |
|
149 |
c.author_timezone = 60 * 3 |
|
150 |
c.author = u"Authér".encode("latin1") |
|
|
0.252.44
by Jelmer Vernooij
Properly look up Bazaar revision ids for revision parents in case they are round-tripped. |
151 |
mapping = BzrGitMappingv1() |
|
0.200.1029
by Jelmer Vernooij
Use dictionary with verifiers rather than requiring testament3-sha1 everywhere. |
152 |
rev, roundtrip_revid, verifiers = mapping.import_commit(c, |
|
0.200.1021
by Jelmer Vernooij
Put testament sha1 in revisions. |
153 |
mapping.revision_id_foreign_to_bzr) |
154 |
self.assertEquals(None, roundtrip_revid) |
|
|
0.200.1029
by Jelmer Vernooij
Use dictionary with verifiers rather than requiring testament3-sha1 everywhere. |
155 |
self.assertEquals({}, verifiers) |
|
0.200.727
by Jelmer Vernooij
Cope with different encodings better, rather than just stripping out |
156 |
self.assertEquals(u"Authér", rev.properties['author']) |
157 |
self.assertEquals("latin1", rev.properties["git-implicit-encoding"]) |
|
158 |
self.assertTrue("git-explicit-encoding" not in rev.properties) |
|
159 |
||
160 |
def test_implicit_encoding_utf8(self): |
|
161 |
c = Commit() |
|
162 |
c.tree = "cc9462f7f8263ef5adfbeff2fb936bb36b504cba" |
|
163 |
c.message = "Some message" |
|
164 |
c.committer = "Committer" |
|
165 |
c.commit_time = 4 |
|
166 |
c.author_time = 5 |
|
167 |
c.commit_timezone = 60 * 5 |
|
168 |
c.author_timezone = 60 * 3 |
|
169 |
c.author = u"Authér".encode("utf-8") |
|
|
0.252.44
by Jelmer Vernooij
Properly look up Bazaar revision ids for revision parents in case they are round-tripped. |
170 |
mapping = BzrGitMappingv1() |
|
0.200.1029
by Jelmer Vernooij
Use dictionary with verifiers rather than requiring testament3-sha1 everywhere. |
171 |
rev, roundtrip_revid, verifiers = mapping.import_commit(c, |
|
0.200.1021
by Jelmer Vernooij
Put testament sha1 in revisions. |
172 |
mapping.revision_id_foreign_to_bzr) |
173 |
self.assertEquals(None, roundtrip_revid) |
|
|
0.200.1029
by Jelmer Vernooij
Use dictionary with verifiers rather than requiring testament3-sha1 everywhere. |
174 |
self.assertEquals({}, verifiers) |
|
0.200.727
by Jelmer Vernooij
Cope with different encodings better, rather than just stripping out |
175 |
self.assertEquals(u"Authér", rev.properties['author']) |
176 |
self.assertTrue("git-explicit-encoding" not in rev.properties) |
|
177 |
self.assertTrue("git-implicit-encoding" not in rev.properties) |
|
|
0.200.351
by Jelmer Vernooij
Add roundtrip tests. |
178 |
|
|
0.200.1598
by Jelmer Vernooij
Print proper error when unknown fields are encountered. |
179 |
def test_unknown_extra(self): |
180 |
c = Commit() |
|
181 |
c.tree = "cc9462f7f8263ef5adfbeff2fb936bb36b504cba" |
|
182 |
c.message = "Some message" |
|
183 |
c.committer = "Committer" |
|
184 |
c.commit_time = 4 |
|
185 |
c.author_time = 5 |
|
186 |
c.commit_timezone = 60 * 5 |
|
187 |
c.author_timezone = 60 * 3 |
|
188 |
c.author = "Author" |
|
|
0.200.1639
by Jelmer Vernooij
Properly roundtrip HG:rename-source fields. |
189 |
c._extra.append(("iamextra", "foo")) |
|
0.200.1598
by Jelmer Vernooij
Print proper error when unknown fields are encountered. |
190 |
mapping = BzrGitMappingv1() |
191 |
self.assertRaises(UnknownCommitExtra, mapping.import_commit, c, |
|
192 |
mapping.revision_id_foreign_to_bzr) |
|
193 |
||
|
0.200.351
by Jelmer Vernooij
Add roundtrip tests. |
194 |
|
|
0.252.7
by Jelmer Vernooij
Add basic test for roundtripping from Bazaar. |
195 |
class RoundtripRevisionsFromBazaar(tests.TestCase): |
196 |
||
197 |
def setUp(self): |
|
198 |
super(RoundtripRevisionsFromBazaar, self).setUp() |
|
199 |
self.mapping = BzrGitMappingv1() |
|
|
0.252.8
by Jelmer Vernooij
Support ghost revisions while roundtripping. |
200 |
self._parent_map = {} |
201 |
self._lookup_parent = self._parent_map.__getitem__ |
|
|
0.252.7
by Jelmer Vernooij
Add basic test for roundtripping from Bazaar. |
202 |
|
|
0.252.22
by Jelmer Vernooij
Fix file id map (de)serialization. |
203 |
def assertRoundtripRevision(self, orig_rev): |
|
0.252.8
by Jelmer Vernooij
Support ghost revisions while roundtripping. |
204 |
commit = self.mapping.export_commit(orig_rev, "mysha", |
|
0.200.1023
by Jelmer Vernooij
Set and verify testament. |
205 |
self._lookup_parent, True, "testamentsha") |
|
0.200.1029
by Jelmer Vernooij
Use dictionary with verifiers rather than requiring testament3-sha1 everywhere. |
206 |
rev, roundtrip_revid, verifiers = self.mapping.import_commit( |
|
0.200.1021
by Jelmer Vernooij
Put testament sha1 in revisions. |
207 |
commit, self.mapping.revision_id_foreign_to_bzr) |
208 |
self.assertEquals(rev.revision_id, |
|
209 |
self.mapping.revision_id_foreign_to_bzr(commit.id)) |
|
|
0.200.912
by Jelmer Vernooij
Merge roundtrip support. |
210 |
if self.mapping.roundtripping: |
|
0.200.1029
by Jelmer Vernooij
Use dictionary with verifiers rather than requiring testament3-sha1 everywhere. |
211 |
self.assertEquals({"testament3-sha1": "testamentsha"} , verifiers) |
|
0.200.1021
by Jelmer Vernooij
Put testament sha1 in revisions. |
212 |
self.assertEquals(orig_rev.revision_id, roundtrip_revid) |
|
0.200.912
by Jelmer Vernooij
Merge roundtrip support. |
213 |
self.assertEquals(orig_rev.properties, rev.properties) |
214 |
self.assertEquals(orig_rev.committer, rev.committer) |
|
215 |
self.assertEquals(orig_rev.timestamp, rev.timestamp) |
|
216 |
self.assertEquals(orig_rev.timezone, rev.timezone) |
|
217 |
self.assertEquals(orig_rev.message, rev.message) |
|
218 |
self.assertEquals(list(orig_rev.parent_ids), list(rev.parent_ids)) |
|
|
0.200.1023
by Jelmer Vernooij
Set and verify testament. |
219 |
else: |
|
0.200.1029
by Jelmer Vernooij
Use dictionary with verifiers rather than requiring testament3-sha1 everywhere. |
220 |
self.assertEquals({}, verifiers) |
|
0.252.7
by Jelmer Vernooij
Add basic test for roundtripping from Bazaar. |
221 |
|
222 |
def test_simple_commit(self): |
|
223 |
r = Revision(self.mapping.revision_id_foreign_to_bzr("edf99e6c56495c620f20d5dacff9859ff7119261")) |
|
224 |
r.message = "MyCommitMessage" |
|
225 |
r.parent_ids = [] |
|
226 |
r.committer = "Jelmer Vernooij <jelmer@apache.org>" |
|
227 |
r.timestamp = 453543543 |
|
228 |
r.timezone = 0 |
|
229 |
r.properties = {} |
|
|
0.252.22
by Jelmer Vernooij
Fix file id map (de)serialization. |
230 |
self.assertRoundtripRevision(r) |
|
0.252.7
by Jelmer Vernooij
Add basic test for roundtripping from Bazaar. |
231 |
|
|
0.252.8
by Jelmer Vernooij
Support ghost revisions while roundtripping. |
232 |
def test_revision_id(self): |
233 |
r = Revision("myrevid") |
|
234 |
r.message = "MyCommitMessage" |
|
235 |
r.parent_ids = [] |
|
236 |
r.committer = "Jelmer Vernooij <jelmer@apache.org>" |
|
237 |
r.timestamp = 453543543 |
|
238 |
r.timezone = 0 |
|
239 |
r.properties = {} |
|
|
0.252.22
by Jelmer Vernooij
Fix file id map (de)serialization. |
240 |
self.assertRoundtripRevision(r) |
|
0.252.8
by Jelmer Vernooij
Support ghost revisions while roundtripping. |
241 |
|
242 |
def test_ghost_parent(self): |
|
243 |
r = Revision("myrevid") |
|
244 |
r.message = "MyCommitMessage" |
|
245 |
r.parent_ids = ["iamaghost"] |
|
246 |
r.committer = "Jelmer Vernooij <jelmer@apache.org>" |
|
247 |
r.timestamp = 453543543 |
|
248 |
r.timezone = 0 |
|
249 |
r.properties = {} |
|
|
0.252.22
by Jelmer Vernooij
Fix file id map (de)serialization. |
250 |
self.assertRoundtripRevision(r) |
|
0.252.8
by Jelmer Vernooij
Support ghost revisions while roundtripping. |
251 |
|
|
0.252.10
by Jelmer Vernooij
Support roundtripping custom revision properties. |
252 |
def test_custom_property(self): |
253 |
r = Revision("myrevid") |
|
254 |
r.message = "MyCommitMessage" |
|
255 |
r.parent_ids = [] |
|
256 |
r.properties = {"fool": "bar"} |
|
257 |
r.committer = "Jelmer Vernooij <jelmer@apache.org>" |
|
258 |
r.timestamp = 453543543 |
|
259 |
r.timezone = 0 |
|
|
0.252.22
by Jelmer Vernooij
Fix file id map (de)serialization. |
260 |
self.assertRoundtripRevision(r) |
|
0.252.16
by Jelmer Vernooij
make sure file ids are roundtripped properly. |
261 |
|
|
0.252.7
by Jelmer Vernooij
Add basic test for roundtripping from Bazaar. |
262 |
|
|
0.200.351
by Jelmer Vernooij
Add roundtrip tests. |
263 |
class RoundtripRevisionsFromGit(tests.TestCase): |
264 |
||
265 |
def setUp(self): |
|
266 |
super(RoundtripRevisionsFromGit, self).setUp() |
|
267 |
self.mapping = BzrGitMappingv1() |
|
268 |
||
269 |
def assertRoundtripTree(self, tree): |
|
270 |
raise NotImplementedError(self.assertRoundtripTree) |
|
271 |
||
272 |
def assertRoundtripBlob(self, blob): |
|
273 |
raise NotImplementedError(self.assertRoundtripBlob) |
|
274 |
||
275 |
def assertRoundtripCommit(self, commit1): |
|
|
0.200.1029
by Jelmer Vernooij
Use dictionary with verifiers rather than requiring testament3-sha1 everywhere. |
276 |
rev, roundtrip_revid, verifiers = self.mapping.import_commit( |
|
0.200.1021
by Jelmer Vernooij
Put testament sha1 in revisions. |
277 |
commit1, self.mapping.revision_id_foreign_to_bzr) |
|
0.252.7
by Jelmer Vernooij
Add basic test for roundtripping from Bazaar. |
278 |
commit2 = self.mapping.export_commit(rev, "12341212121212", None, |
|
0.200.1023
by Jelmer Vernooij
Set and verify testament. |
279 |
True, None) |
|
0.200.351
by Jelmer Vernooij
Add roundtrip tests. |
280 |
self.assertEquals(commit1.committer, commit2.committer) |
281 |
self.assertEquals(commit1.commit_time, commit2.commit_time) |
|
|
0.200.362
by Jelmer Vernooij
Fix tests. |
282 |
self.assertEquals(commit1.commit_timezone, commit2.commit_timezone) |
|
0.200.351
by Jelmer Vernooij
Add roundtrip tests. |
283 |
self.assertEquals(commit1.author, commit2.author) |
284 |
self.assertEquals(commit1.author_time, commit2.author_time) |
|
|
0.200.362
by Jelmer Vernooij
Fix tests. |
285 |
self.assertEquals(commit1.author_timezone, commit2.author_timezone) |
|
0.200.351
by Jelmer Vernooij
Add roundtrip tests. |
286 |
self.assertEquals(commit1.message, commit2.message) |
|
0.200.727
by Jelmer Vernooij
Cope with different encodings better, rather than just stripping out |
287 |
self.assertEquals(commit1.encoding, commit2.encoding) |
|
0.200.351
by Jelmer Vernooij
Add roundtrip tests. |
288 |
|
289 |
def test_commit(self): |
|
290 |
c = Commit() |
|
|
0.200.416
by Jelmer Vernooij
Use public properties to set git objects values. |
291 |
c.tree = "cc9462f7f8263ef5adfbeff2fb936bb36b504cba" |
292 |
c.message = "Some message" |
|
293 |
c.committer = "Committer <Committer>" |
|
294 |
c.commit_time = 4 |
|
|
0.200.440
by Jelmer Vernooij
Remove silly mapping of timezones; dulwich uses offsets now as well. |
295 |
c.commit_timezone = -60 * 3 |
|
0.200.416
by Jelmer Vernooij
Use public properties to set git objects values. |
296 |
c.author_time = 5 |
|
0.200.440
by Jelmer Vernooij
Remove silly mapping of timezones; dulwich uses offsets now as well. |
297 |
c.author_timezone = 60 * 2 |
|
0.200.416
by Jelmer Vernooij
Use public properties to set git objects values. |
298 |
c.author = "Author <author>" |
|
0.200.351
by Jelmer Vernooij
Add roundtrip tests. |
299 |
self.assertRoundtripCommit(c) |
300 |
||
|
0.200.1589
by Jelmer Vernooij
Add test to make sure that certain invalid timezones are roundtripped correctly. |
301 |
def test_commit_double_negative_timezone(self): |
302 |
c = Commit() |
|
303 |
c.tree = "cc9462f7f8263ef5adfbeff2fb936bb36b504cba" |
|
304 |
c.message = "Some message" |
|
305 |
c.committer = "Committer <Committer>" |
|
306 |
c.commit_time = 4 |
|
307 |
(c.commit_timezone, c._commit_timezone_neg_utc) = parse_timezone("--700") |
|
308 |
c.author_time = 5 |
|
309 |
c.author_timezone = 60 * 2 |
|
310 |
c.author = "Author <author>" |
|
311 |
self.assertRoundtripCommit(c) |
|
312 |
||
|
0.200.884
by Jelmer Vernooij
Cope with -0000 as timezone in Git commits. |
313 |
def test_commit_zero_utc_timezone(self): |
314 |
c = Commit() |
|
315 |
c.tree = "cc9462f7f8263ef5adfbeff2fb936bb36b504cba" |
|
316 |
c.message = "Some message" |
|
317 |
c.committer = "Committer <Committer>" |
|
318 |
c.commit_time = 4 |
|
319 |
c.commit_timezone = 0 |
|
320 |
c._commit_timezone_neg_utc = True |
|
321 |
c.author_time = 5 |
|
322 |
c.author_timezone = 60 * 2 |
|
323 |
c.author = "Author <author>" |
|
324 |
self.assertRoundtripCommit(c) |
|
325 |
||
|
0.200.727
by Jelmer Vernooij
Cope with different encodings better, rather than just stripping out |
326 |
def test_commit_encoding(self): |
327 |
c = Commit() |
|
328 |
c.tree = "cc9462f7f8263ef5adfbeff2fb936bb36b504cba" |
|
329 |
c.message = "Some message" |
|
330 |
c.committer = "Committer <Committer>" |
|
331 |
c.encoding = 'iso8859-1' |
|
332 |
c.commit_time = 4 |
|
333 |
c.commit_timezone = -60 * 3 |
|
334 |
c.author_time = 5 |
|
335 |
c.author_timezone = 60 * 2 |
|
336 |
c.author = "Author <author>" |
|
337 |
self.assertRoundtripCommit(c) |
|
338 |
||
|
0.200.1639
by Jelmer Vernooij
Properly roundtrip HG:rename-source fields. |
339 |
def test_commit_extra(self): |
340 |
c = Commit() |
|
341 |
c.tree = "cc9462f7f8263ef5adfbeff2fb936bb36b504cba" |
|
342 |
c.message = "Some message" |
|
343 |
c.committer = "Committer <Committer>" |
|
344 |
c.commit_time = 4 |
|
345 |
c.commit_timezone = -60 * 3 |
|
346 |
c.author_time = 5 |
|
347 |
c.author_timezone = 60 * 2 |
|
348 |
c.author = "Author <author>" |
|
349 |
c._extra = [("HG:rename-source", "hg")] |
|
350 |
self.assertRoundtripCommit(c) |
|
351 |
||
|
0.200.588
by Jelmer Vernooij
Cope with empty directories that are not allowed in git. |
352 |
|
353 |
class DirectoryToTreeTests(tests.TestCase): |
|
354 |
||
355 |
def test_empty(self): |
|
|
0.275.4
by Jelmer Vernooij
Pass children list to directory_to_tree . |
356 |
t = directory_to_tree({}, None, {}, None, allow_empty=False) |
|
0.200.589
by Jelmer Vernooij
Fix handling of empty trees. |
357 |
self.assertEquals(None, t) |
|
0.200.588
by Jelmer Vernooij
Cope with empty directories that are not allowed in git. |
358 |
|
359 |
def test_empty_dir(self): |
|
360 |
child_ie = InventoryDirectory('bar', 'bar', 'bar') |
|
|
0.275.4
by Jelmer Vernooij
Pass children list to directory_to_tree . |
361 |
children = {'bar': child_ie} |
362 |
t = directory_to_tree(children, lambda x: None, {}, None, |
|
363 |
allow_empty=False) |
|
|
0.200.589
by Jelmer Vernooij
Fix handling of empty trees. |
364 |
self.assertEquals(None, t) |
365 |
||
|
0.252.30
by Jelmer Vernooij
Support creating dummy files for empty directories. |
366 |
def test_empty_dir_dummy_files(self): |
367 |
child_ie = InventoryDirectory('bar', 'bar', 'bar') |
|
|
0.275.4
by Jelmer Vernooij
Pass children list to directory_to_tree . |
368 |
children = {'bar':child_ie} |
369 |
t = directory_to_tree(children, lambda x: None, {}, ".mydummy", |
|
370 |
allow_empty=False) |
|
|
0.252.30
by Jelmer Vernooij
Support creating dummy files for empty directories. |
371 |
self.assertTrue(".mydummy" in t) |
372 |
||
|
0.200.589
by Jelmer Vernooij
Fix handling of empty trees. |
373 |
def test_empty_root(self): |
374 |
child_ie = InventoryDirectory('bar', 'bar', 'bar') |
|
|
0.275.4
by Jelmer Vernooij
Pass children list to directory_to_tree . |
375 |
children = {'bar': child_ie} |
376 |
t = directory_to_tree(children, lambda x: None, {}, None, |
|
377 |
allow_empty=True) |
|
|
0.200.588
by Jelmer Vernooij
Cope with empty directories that are not allowed in git. |
378 |
self.assertEquals(Tree(), t) |
379 |
||
380 |
def test_with_file(self): |
|
381 |
child_ie = InventoryFile('bar', 'bar', 'bar') |
|
|
0.275.4
by Jelmer Vernooij
Pass children list to directory_to_tree . |
382 |
children = {"bar": child_ie} |
|
0.200.588
by Jelmer Vernooij
Cope with empty directories that are not allowed in git. |
383 |
b = Blob.from_string("bla") |
|
0.275.4
by Jelmer Vernooij
Pass children list to directory_to_tree . |
384 |
t1 = directory_to_tree(children, lambda x: b.id, {}, None, |
385 |
allow_empty=False) |
|
|
0.200.588
by Jelmer Vernooij
Cope with empty directories that are not allowed in git. |
386 |
t2 = Tree() |
|
0.200.1152
by Jelmer Vernooij
Require dulwich 0.7.1. |
387 |
t2.add("bar", 0100644, b.id) |
|
0.200.588
by Jelmer Vernooij
Cope with empty directories that are not allowed in git. |
388 |
self.assertEquals(t1, t2) |