Status: | Merged |
---|---|
Approved by: | Jelmer Vernooij |
Approved revision: | no longer in the source branch. |
Merged at revision: | 6992 |
Proposed branch: | lp:~jelmer/brz/python3-c |
Merge into: | lp:brz |
Diff against target: |
9825 lines (+2403/-1185) 82 files modified
breezy/branch.py (+4/-1) breezy/bzr/_dirstate_helpers_py.py (+2/-2) breezy/bzr/branch.py (+7/-1) breezy/bzr/btree_index.py (+9/-0) breezy/bzr/chk_map.py (+1/-1) breezy/bzr/dirstate.py (+6/-6) breezy/bzr/smart/branch.py (+4/-4) breezy/bzr/smart/repository.py (+2/-2) breezy/bzr/workingtree_4.py (+2/-2) breezy/bzr/xml_serializer.py (+2/-3) breezy/conflicts.py (+3/-1) breezy/info.py (+1/-1) breezy/mail_client.py (+6/-3) breezy/plugins/git/cache.py (+2/-2) breezy/plugins/git/git_remote_helper.py (+7/-7) breezy/plugins/git/tests/test_branch.py (+2/-2) breezy/plugins/git/tests/test_memorytree.py (+3/-3) breezy/plugins/git/tests/test_object_store.py (+2/-2) breezy/plugins/repodebug/file_refs.py (+3/-3) breezy/plugins/repodebug/missing_keys_for_stacking_fixer.py (+2/-1) breezy/plugins/repodebug/tests/__init__.py (+17/-17) breezy/plugins/upload/tests/test_upload.py (+50/-50) breezy/tests/__init__.py (+2/-1) breezy/tests/blackbox/test_branch.py (+6/-6) breezy/tests/blackbox/test_merge.py (+4/-4) breezy/tests/blackbox/test_push.py (+12/-12) breezy/tests/blackbox/test_tags.py (+2/-2) breezy/tests/per_bzrdir/test_bzrdir.py (+4/-4) breezy/tests/per_controldir/test_controldir.py (+2/-2) breezy/tests/per_interrepository/test_fetch.py (+69/-72) breezy/tests/per_interrepository/test_interrepository.py (+21/-21) breezy/tests/per_pack_repository.py (+20/-20) breezy/tests/per_repository/test_repository.py (+2/-2) breezy/tests/per_repository_chk/test_supported.py (+25/-24) breezy/tests/per_repository_reference/test_commit_with_stacking.py (+1/-1) breezy/tests/per_repository_reference/test_fetch.py (+4/-4) breezy/tests/per_repository_reference/test_get_record_stream.py (+50/-50) breezy/tests/per_repository_reference/test_graph.py (+6/-6) breezy/tests/per_repository_reference/test_unlock.py (+3/-3) breezy/tests/per_repository_vf/helpers.py (+1/-1) breezy/tests/per_repository_vf/test_fetch.py (+1/-1) breezy/tests/per_repository_vf/test_fileid_involved.py (+5/-5) breezy/tests/per_repository_vf/test_merge_directive.py (+1/-1) breezy/tests/per_repository_vf/test_reconcile.py (+28/-28) breezy/tests/per_repository_vf/test_repository.py (+22/-22) breezy/tests/per_repository_vf/test_write_group.py (+12/-12) breezy/tests/per_workingtree/test_pull.py (+4/-4) breezy/tests/test_annotate.py (+19/-19) breezy/tests/test_branchbuilder.py (+45/-45) breezy/tests/test_bundle.py (+28/-28) breezy/tests/test_commit.py (+16/-16) breezy/tests/test_commit_merge.py (+3/-3) breezy/tests/test_conflicts.py (+4/-4) breezy/tests/test_diff.py (+9/-9) breezy/tests/test_dirstate.py (+1/-1) breezy/tests/test_fetch.py (+11/-11) breezy/tests/test_fetch_ghosts.py (+3/-3) breezy/tests/test_inv.py (+6/-6) breezy/tests/test_knit.py (+1/-1) breezy/tests/test_log.py (+6/-6) breezy/tests/test_matchers.py (+8/-8) breezy/tests/test_merge.py (+181/-181) breezy/tests/test_merge_core.py (+5/-5) breezy/tests/test_merge_directive.py (+3/-3) breezy/tests/test_reconfigure.py (+7/-7) breezy/tests/test_repository.py (+28/-28) breezy/tests/test_revert.py (+1/-1) breezy/tests/test_revision.py (+12/-12) breezy/tests/test_revisionspec.py (+79/-79) breezy/tests/test_smart.py (+65/-65) breezy/tests/test_smart_transport.py (+15/-15) breezy/tests/test_tag.py (+6/-6) breezy/tests/test_testament.py (+3/-3) breezy/tests/test_transform.py (+168/-168) breezy/tests/test_transport.py (+13/-13) breezy/tests/test_urlutils.py (+1/-1) breezy/tests/test_vf_search.py (+4/-4) breezy/tests/test_workingtree_4.py (+6/-6) breezy/trace.py (+2/-2) breezy/transport/remote.py (+4/-1) breezy/views.py (+3/-3) python3.passing (+1193/-0) |
To merge this branch: | bzr merge lp:~jelmer/brz/python3-c |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Packman | Approve | ||
Review via email: mp+347966@code.launchpad.net |
Commit message
Fix handling of bytestrings in Python3 in more tests.
Description of the change
More bees!
% wc -l python3.passing
12519 python3.passing
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'breezy/branch.py' |
2 | --- breezy/branch.py 2018-05-20 13:30:41 +0000 |
3 | +++ breezy/branch.py 2018-06-21 08:27:55 +0000 |
4 | @@ -16,6 +16,8 @@ |
5 | |
6 | from __future__ import absolute_import |
7 | |
8 | +import sys |
9 | + |
10 | from . import errors |
11 | |
12 | from .lazy_import import lazy_import |
13 | @@ -772,7 +774,8 @@ |
14 | # FIXUP this and get_parent in a future branch format bump: |
15 | # read and rewrite the file. RBC 20060125 |
16 | if url is not None: |
17 | - if isinstance(url, text_type): |
18 | + # TODO(jelmer): Clean this up for pad.lv/1696545 |
19 | + if isinstance(url, text_type) and sys.version_info[0] == 2: |
20 | try: |
21 | url = url.encode('ascii') |
22 | except UnicodeEncodeError: |
23 | |
24 | === modified file 'breezy/bzr/_dirstate_helpers_py.py' |
25 | --- breezy/bzr/_dirstate_helpers_py.py 2018-05-13 02:18:13 +0000 |
26 | +++ breezy/bzr/_dirstate_helpers_py.py 2018-06-21 08:27:55 +0000 |
27 | @@ -270,9 +270,9 @@ |
28 | next() |
29 | # The two blocks here are deliberate: the root block and the |
30 | # contents-of-root block. |
31 | - state._dirblocks = [('', []), ('', [])] |
32 | + state._dirblocks = [(b'', []), (b'', [])] |
33 | current_block = state._dirblocks[0][1] |
34 | - current_dirname = '' |
35 | + current_dirname = b'' |
36 | append_entry = current_block.append |
37 | for count in range(state._num_entries): |
38 | dirname = next() |
39 | |
40 | === modified file 'breezy/bzr/branch.py' |
41 | --- breezy/bzr/branch.py 2018-05-13 12:30:09 +0000 |
42 | +++ breezy/bzr/branch.py 2018-06-21 08:27:55 +0000 |
43 | @@ -17,6 +17,8 @@ |
44 | |
45 | from __future__ import absolute_import |
46 | |
47 | +import sys |
48 | + |
49 | from ..lazy_import import lazy_import |
50 | lazy_import(globals(), """ |
51 | from breezy import ( |
52 | @@ -617,7 +619,11 @@ |
53 | config=conf) |
54 | if stacked_url is None: |
55 | raise errors.NotStacked(self) |
56 | - return stacked_url.encode('utf-8') |
57 | + # TODO(jelmer): Clean this up for pad.lv/1696545 |
58 | + if sys.version_info[0] == 2: |
59 | + return stacked_url.encode('utf-8') |
60 | + else: |
61 | + return stacked_url |
62 | |
63 | def get_rev_id(self, revno, history=None): |
64 | """Find the revision id of the specified revno.""" |
65 | |
66 | === modified file 'breezy/bzr/btree_index.py' |
67 | --- breezy/bzr/btree_index.py 2017-07-31 22:36:57 +0000 |
68 | +++ breezy/bzr/btree_index.py 2018-06-21 08:27:55 +0000 |
69 | @@ -698,6 +698,15 @@ |
70 | self._name == other._name and |
71 | self._size == other._size) |
72 | |
73 | + def __lt__(self, other): |
74 | + if isinstance(other, type(self)): |
75 | + return ((self._transport, self._name, self._size) < |
76 | + (other._transport, other._name, other._size)) |
77 | + # Always sort existing indexes before ones that are still being built. |
78 | + if isinstance(other, index.GraphIndexBuilder): |
79 | + return True |
80 | + raise TypeError |
81 | + |
82 | def __ne__(self, other): |
83 | return not self.__eq__(other) |
84 | |
85 | |
86 | === modified file 'breezy/bzr/chk_map.py' |
87 | --- breezy/bzr/chk_map.py 2018-05-13 02:18:13 +0000 |
88 | +++ breezy/bzr/chk_map.py 2018-06-21 08:27:55 +0000 |
89 | @@ -182,7 +182,7 @@ |
90 | return _get_cache()[key] |
91 | except KeyError: |
92 | stream = self._store.get_record_stream([key], 'unordered', True) |
93 | - bytes = stream.next().get_bytes_as('fulltext') |
94 | + bytes = next(stream).get_bytes_as('fulltext') |
95 | _get_cache()[key] = bytes |
96 | return bytes |
97 | |
98 | |
99 | === modified file 'breezy/bzr/dirstate.py' |
100 | --- breezy/bzr/dirstate.py 2018-02-18 19:18:40 +0000 |
101 | +++ breezy/bzr/dirstate.py 2018-06-21 08:27:55 +0000 |
102 | @@ -301,7 +301,7 @@ |
103 | |
104 | def stat_and_sha1(self, abspath): |
105 | """Return the stat and sha1 of a file given its absolute path.""" |
106 | - with file(abspath, 'rb') as file_obj: |
107 | + with open(abspath, 'rb') as file_obj: |
108 | statvalue = os.fstat(file_obj.fileno()) |
109 | sha1 = osutils.sha_file(file_obj) |
110 | return statvalue, sha1 |
111 | @@ -1815,17 +1815,17 @@ |
112 | 'mismatched file_id in tree 1') |
113 | dir_block = () |
114 | old_kind = entry[1][1][0] |
115 | - if active_kind in 'ar': |
116 | + if active_kind in b'ar': |
117 | # The active tree doesn't have this file_id. |
118 | # The basis tree is changing this record. If this is a |
119 | # rename, then we don't want the record here at all |
120 | # anymore. If it is just an in-place change, we want the |
121 | # record here, but we'll add it if we need to. So we just |
122 | # delete it |
123 | - if active_kind == 'r': |
124 | + if active_kind == b'r': |
125 | active_path = entry[1][0][1] |
126 | active_entry = self._get_entry(0, file_id, active_path) |
127 | - if active_entry[1][1][0] != 'r': |
128 | + if active_entry[1][1][0] != b'r': |
129 | self._raise_invalid(old_path, file_id, |
130 | "Dirstate did not have matching rename entries") |
131 | elif active_entry[1][0][0] in 'ar': |
132 | @@ -1834,7 +1834,7 @@ |
133 | " tree0") |
134 | active_entry[1][1] = null |
135 | del self._dirblocks[block_index][1][entry_index] |
136 | - if old_kind == 'd': |
137 | + if old_kind == b'd': |
138 | # This was a directory, and the active tree says it |
139 | # doesn't exist, and now the basis tree says it doesn't |
140 | # exist. Remove its dirblock if present |
141 | @@ -1877,7 +1877,7 @@ |
142 | self._raise_invalid(dirname_utf8.decode('utf8'), |
143 | file_id, "This parent is not present.") |
144 | # Parents of things must be directories |
145 | - if entry[1][index][0] != 'd': |
146 | + if entry[1][index][0] != b'd': |
147 | self._raise_invalid(dirname_utf8.decode('utf8'), |
148 | file_id, "This parent is not a directory.") |
149 | |
150 | |
151 | === modified file 'breezy/bzr/smart/branch.py' |
152 | --- breezy/bzr/smart/branch.py 2018-05-21 01:27:32 +0000 |
153 | +++ breezy/bzr/smart/branch.py 2018-06-21 08:27:55 +0000 |
154 | @@ -190,7 +190,7 @@ |
155 | |
156 | def do_with_branch(self, branch): |
157 | stacked_on_url = branch.get_stacked_on_url() |
158 | - return SuccessfulSmartServerResponse((b'ok', stacked_on_url)) |
159 | + return SuccessfulSmartServerResponse((b'ok', stacked_on_url.encode('ascii'))) |
160 | |
161 | |
162 | class SmartServerRequestRevisionHistory(SmartServerBranchRequest): |
163 | @@ -236,7 +236,7 @@ |
164 | except errors.NoSuchRevision: |
165 | return FailedSmartServerResponse((b'NoSuchRevision', revid)) |
166 | return SuccessfulSmartServerResponse( |
167 | - (b'ok', ) + tuple([str(x).encode('ascii') for x in dotted_revno])) |
168 | + (b'ok', ) + tuple([b'%d' % x for x in dotted_revno])) |
169 | |
170 | |
171 | class SmartServerSetTipRequest(SmartServerLockedBranchRequest): |
172 | @@ -251,7 +251,7 @@ |
173 | msg = e.msg |
174 | if isinstance(msg, unicode): |
175 | msg = msg.encode('utf-8') |
176 | - return FailedSmartServerResponse(('TipChangeRejected', msg)) |
177 | + return FailedSmartServerResponse((b'TipChangeRejected', msg)) |
178 | |
179 | |
180 | class SmartServerBranchRequestSetConfigOption(SmartServerLockedBranchRequest): |
181 | @@ -328,7 +328,7 @@ |
182 | relation = branch._revision_relations( |
183 | last_rev, new_last_revision_id, graph) |
184 | if relation == 'diverged' and not allow_divergence: |
185 | - return FailedSmartServerResponse(('Diverged',)) |
186 | + return FailedSmartServerResponse((b'Diverged',)) |
187 | if relation == 'a_descends_from_b' and do_not_overwrite_descendant: |
188 | return SuccessfulSmartServerResponse( |
189 | (b'ok', last_revno, last_rev)) |
190 | |
191 | === modified file 'breezy/bzr/smart/repository.py' |
192 | --- breezy/bzr/smart/repository.py 2018-05-21 01:27:32 +0000 |
193 | +++ breezy/bzr/smart/repository.py 2018-06-21 08:27:55 +0000 |
194 | @@ -308,12 +308,12 @@ |
195 | # Note that we return an empty body, rather than omitting the body. |
196 | # This way the client knows that it can always expect to find a body |
197 | # in the response for this method, even in the error case. |
198 | - return FailedSmartServerResponse((b'nosuchrevision', revision_id), '') |
199 | + return FailedSmartServerResponse((b'nosuchrevision', revision_id), b'') |
200 | |
201 | for revision, parents in revision_graph.items(): |
202 | lines.append(b' '.join((revision, ) + tuple(parents))) |
203 | |
204 | - return SuccessfulSmartServerResponse((b'ok', ), '\n'.join(lines)) |
205 | + return SuccessfulSmartServerResponse((b'ok', ), b'\n'.join(lines)) |
206 | |
207 | |
208 | class SmartServerRepositoryGetRevIdForRevno(SmartServerRepositoryReadLocked): |
209 | |
210 | === modified file 'breezy/bzr/workingtree_4.py' |
211 | --- breezy/bzr/workingtree_4.py 2018-06-04 11:35:48 +0000 |
212 | +++ breezy/bzr/workingtree_4.py 2018-06-21 08:27:55 +0000 |
213 | @@ -1379,7 +1379,7 @@ |
214 | """See dirstate.SHA1Provider.stat_and_sha1().""" |
215 | filters = self.tree._content_filter_stack( |
216 | self.tree.relpath(osutils.safe_unicode(abspath))) |
217 | - with file(abspath, 'rb', 65000) as file_obj: |
218 | + with open(abspath, 'rb', 65000) as file_obj: |
219 | statvalue = os.fstat(file_obj.fileno()) |
220 | if filters: |
221 | file_obj = _mod_filters.filtered_input_file(file_obj, filters) |
222 | @@ -1797,7 +1797,7 @@ |
223 | parent_index = self._dirstate.get_parent_ids().index(self._revision_id) + 1 |
224 | # This is identical now to the WorkingTree _generate_inventory except |
225 | # for the tree index use. |
226 | - root_key, current_entry = self._dirstate._get_entry(parent_index, path_utf8='') |
227 | + root_key, current_entry = self._dirstate._get_entry(parent_index, path_utf8=b'') |
228 | current_id = root_key[2] |
229 | if current_entry[parent_index][0] != b'd': |
230 | raise AssertionError() |
231 | |
232 | === modified file 'breezy/bzr/xml_serializer.py' |
233 | --- breezy/bzr/xml_serializer.py 2018-06-12 16:49:43 +0000 |
234 | +++ breezy/bzr/xml_serializer.py 2018-06-21 08:27:55 +0000 |
235 | @@ -346,9 +346,8 @@ |
236 | if elt.tag != 'inventory': |
237 | raise errors.UnexpectedInventoryFormat('Root tag is %r' % elt.tag) |
238 | format = elt.get('format') |
239 | - if format is not None: |
240 | - format = format.encode() |
241 | - if format != format_num: |
242 | + if ((format is None and format_num is not None) |
243 | + or format.encode() != format_num): |
244 | raise errors.UnexpectedInventoryFormat('Invalid format version %r' |
245 | % format) |
246 | revision_id = elt.get('revision_id') |
247 | |
248 | === modified file 'breezy/conflicts.py' |
249 | --- breezy/conflicts.py 2017-11-12 20:07:32 +0000 |
250 | +++ breezy/conflicts.py 2018-06-21 08:27:55 +0000 |
251 | @@ -386,7 +386,9 @@ |
252 | def __cmp__(self, other): |
253 | if getattr(other, "_cmp_list", None) is None: |
254 | return -1 |
255 | - return cmp(self._cmp_list(), other._cmp_list()) |
256 | + x = self._cmp_list() |
257 | + y = other._cmp_list() |
258 | + return (x > y) - (x < y) |
259 | |
260 | def __hash__(self): |
261 | return hash((type(self), self.path, self.file_id)) |
262 | |
263 | === modified file 'breezy/info.py' |
264 | --- breezy/info.py 2018-06-14 10:06:05 +0000 |
265 | +++ breezy/info.py 2018-06-21 08:27:55 +0000 |
266 | @@ -339,7 +339,7 @@ |
267 | f.write(' %8d KiB\n' % (stats['size']/1024)) |
268 | for hook in hooks['repository']: |
269 | hook(repository, stats, f) |
270 | - if f.getvalue() != "": |
271 | + if f.getvalue() != b"": |
272 | outfile.write('\n') |
273 | outfile.write('Repository:\n') |
274 | outfile.write(f.getvalue()) |
275 | |
276 | === modified file 'breezy/mail_client.py' |
277 | --- breezy/mail_client.py 2017-07-16 01:55:39 +0000 |
278 | +++ breezy/mail_client.py 2018-06-21 08:27:55 +0000 |
279 | @@ -30,7 +30,10 @@ |
280 | msgeditor, |
281 | osutils, |
282 | urlutils, |
283 | - registry |
284 | + registry, |
285 | + ) |
286 | +from .sixish import ( |
287 | + text_type, |
288 | ) |
289 | |
290 | mail_client_registry = registry.Registry() |
291 | @@ -232,7 +235,7 @@ |
292 | :param u: possible unicode string. |
293 | :return: encoded string if u is unicode, u itself otherwise. |
294 | """ |
295 | - if isinstance(u, unicode): |
296 | + if isinstance(u, text_type): |
297 | return u.encode(osutils.get_user_encoding(), 'replace') |
298 | return u |
299 | |
300 | @@ -245,7 +248,7 @@ |
301 | path itself otherwise. |
302 | :raise: UnableEncodePath. |
303 | """ |
304 | - if isinstance(path, unicode): |
305 | + if isinstance(path, text_type): |
306 | try: |
307 | return path.encode(osutils.get_user_encoding()) |
308 | except UnicodeEncodeError: |
309 | |
310 | === modified file 'breezy/plugins/git/cache.py' |
311 | --- breezy/plugins/git/cache.py 2018-05-13 22:54:28 +0000 |
312 | +++ breezy/plugins/git/cache.py 2018-06-21 08:27:55 +0000 |
313 | @@ -414,7 +414,7 @@ |
314 | if path is None: |
315 | self.db = sqlite3.connect(":memory:") |
316 | else: |
317 | - if not mapdbs().has_key(path): |
318 | + if path not in mapdbs(): |
319 | mapdbs()[path] = sqlite3.connect(path) |
320 | self.db = mapdbs()[path] |
321 | self.db.text_factory = str |
322 | @@ -616,7 +616,7 @@ |
323 | else: |
324 | if type(path) is not str: |
325 | raise TypeError(path) |
326 | - if not mapdbs().has_key(path): |
327 | + if path not in mapdbs(): |
328 | mapdbs()[path] = tdb.Tdb(path, self.TDB_HASH_SIZE, tdb.DEFAULT, |
329 | os.O_RDWR|os.O_CREAT) |
330 | self.db = mapdbs()[path] |
331 | |
332 | === modified file 'breezy/plugins/git/git_remote_helper.py' |
333 | --- breezy/plugins/git/git_remote_helper.py 2018-03-26 22:28:24 +0000 |
334 | +++ breezy/plugins/git/git_remote_helper.py 2018-06-21 08:27:55 +0000 |
335 | @@ -79,7 +79,7 @@ |
336 | else: |
337 | lossy = True |
338 | inter.fetch_objects(revs, lossy=lossy) |
339 | - outf.write("\n") |
340 | + outf.write(b"\n") |
341 | |
342 | |
343 | def push(outf, wants, shortname, remote_dir, local_dir): |
344 | @@ -93,8 +93,8 @@ |
345 | except NotBranchError: |
346 | remote_branch = remote_dir.create_branch(name=dest_branch_name) |
347 | local_branch.push(remote_branch) |
348 | - outf.write("ok %s\n" % dest_ref) |
349 | - outf.write("\n") |
350 | + outf.write(b"ok %s\n" % dest_ref) |
351 | + outf.write(b"\n") |
352 | |
353 | |
354 | class RemoteHelper(object): |
355 | @@ -108,7 +108,7 @@ |
356 | self.wants = [] |
357 | |
358 | def cmd_capabilities(self, outf, argv): |
359 | - outf.write("\n".join(CAPABILITIES)+"\n\n") |
360 | + outf.write(b"\n".join([c.encode() for c in CAPABILITIES])+b"\n\n") |
361 | |
362 | def cmd_list(self, outf, argv): |
363 | try: |
364 | @@ -120,11 +120,11 @@ |
365 | refs = get_refs_container(self.remote_dir, object_store) |
366 | for ref, git_sha1 in refs.as_dict().iteritems(): |
367 | ref = ref.replace("~", "_") |
368 | - outf.write("%s %s\n" % (git_sha1, ref)) |
369 | - outf.write("\n") |
370 | + outf.write(b"%s %s\n" % (git_sha1, ref)) |
371 | + outf.write(b"\n") |
372 | |
373 | def cmd_option(self, outf, argv): |
374 | - outf.write("unsupported\n") |
375 | + outf.write(b"unsupported\n") |
376 | |
377 | def cmd_fetch(self, outf, argv): |
378 | if self.batchcmd not in (None, "fetch"): |
379 | |
380 | === modified file 'breezy/plugins/git/tests/test_branch.py' |
381 | --- breezy/plugins/git/tests/test_branch.py 2018-05-14 20:02:30 +0000 |
382 | +++ breezy/plugins/git/tests/test_branch.py 2018-06-21 08:27:55 +0000 |
383 | @@ -100,7 +100,7 @@ |
384 | r = GitRepo.init('.') |
385 | self.build_tree(['a']) |
386 | r.stage(["a"]) |
387 | - return r.do_commit("a", committer="Somebody <foo@example.com>") |
388 | + return r.do_commit("a", committer=b"Somebody <foo@example.com>") |
389 | |
390 | def test_last_revision_is_valid(self): |
391 | head = self.simple_commit_a() |
392 | @@ -113,7 +113,7 @@ |
393 | self.build_tree(['b']) |
394 | r = GitRepo(".") |
395 | r.stage("b") |
396 | - revb = r.do_commit("b", committer="Somebody <foo@example.com>") |
397 | + revb = r.do_commit("b", committer=b"Somebody <foo@example.com>") |
398 | |
399 | thebranch = Branch.open('.') |
400 | self.assertEqual((2, default_mapping.revision_id_foreign_to_bzr(revb)), thebranch.last_revision_info()) |
401 | |
402 | === modified file 'breezy/plugins/git/tests/test_memorytree.py' |
403 | --- breezy/plugins/git/tests/test_memorytree.py 2018-05-13 22:54:28 +0000 |
404 | +++ breezy/plugins/git/tests/test_memorytree.py 2018-06-21 08:27:55 +0000 |
405 | @@ -170,18 +170,18 @@ |
406 | self.addCleanup(tree.unlock) |
407 | tree.add(['', 'foo'], ['root-id', 'foo-id'], ['directory', 'file']) |
408 | tree.put_file_bytes_non_atomic('foo', 'content\n') |
409 | - tree.commit('one', rev_id='rev-one') |
410 | + tree.commit('one', rev_id=b'rev-one') |
411 | tree.rename_one('foo', 'bar') |
412 | self.assertEqual('bar', tree.id2path('foo-id')) |
413 | self.assertEqual('content\n', tree._file_transport.get_bytes('bar')) |
414 | self.assertRaises(errors.NoSuchFile, |
415 | tree._file_transport.get_bytes, 'foo') |
416 | - tree.commit('two', rev_id='rev-two') |
417 | + tree.commit('two', rev_id=b'rev-two') |
418 | self.assertEqual('content\n', tree._file_transport.get_bytes('bar')) |
419 | self.assertRaises(errors.NoSuchFile, |
420 | tree._file_transport.get_bytes, 'foo') |
421 | |
422 | - rev_tree2 = tree.branch.repository.revision_tree('rev-two') |
423 | + rev_tree2 = tree.branch.repository.revision_tree(b'rev-two') |
424 | self.assertEqual('bar', rev_tree2.id2path('foo-id')) |
425 | self.assertEqual('content\n', rev_tree2.get_file_text('bar')) |
426 | |
427 | |
428 | === modified file 'breezy/plugins/git/tests/test_object_store.py' |
429 | --- breezy/plugins/git/tests/test_object_store.py 2018-05-14 20:02:30 +0000 |
430 | +++ breezy/plugins/git/tests/test_object_store.py 2018-06-21 08:27:55 +0000 |
431 | @@ -148,7 +148,7 @@ |
432 | |
433 | def test_get_blob(self): |
434 | b = Blob() |
435 | - b.data = 'a\nb\nc\nd\ne\n' |
436 | + b.data = b'a\nb\nc\nd\ne\n' |
437 | self.store.lock_read() |
438 | self.addCleanup(self.store.unlock) |
439 | self.assertRaises(KeyError, self.store.__getitem__, b.id) |
440 | @@ -167,7 +167,7 @@ |
441 | |
442 | def test_get_raw(self): |
443 | b = Blob() |
444 | - b.data = 'a\nb\nc\nd\ne\n' |
445 | + b.data = b'a\nb\nc\nd\ne\n' |
446 | self.store.lock_read() |
447 | self.addCleanup(self.store.unlock) |
448 | self.assertRaises(KeyError, self.store.get_raw, b.id) |
449 | |
450 | === modified file 'breezy/plugins/repodebug/file_refs.py' |
451 | --- breezy/plugins/repodebug/file_refs.py 2018-03-24 23:36:29 +0000 |
452 | +++ breezy/plugins/repodebug/file_refs.py 2018-06-21 08:27:55 +0000 |
453 | @@ -32,8 +32,8 @@ |
454 | takes_options = ['directory'] |
455 | |
456 | def run(self, file_id, rev_id, directory=u'.'): |
457 | - file_id = file_id.decode('ascii') |
458 | - rev_id = rev_id.decode('ascii') |
459 | + file_id = file_id.encode() |
460 | + rev_id = rev_id.encode() |
461 | bd, relpath = controldir.ControlDir.open_containing(directory) |
462 | repo = bd.find_repository() |
463 | self.add_cleanup(repo.lock_read().unlock) |
464 | @@ -47,4 +47,4 @@ |
465 | # This file doesn't even appear in this inv. |
466 | continue |
467 | if entry.revision == rev_id: |
468 | - self.outf.write(inv.revision_id + '\n') |
469 | + self.outf.write(inv.revision_id + b'\n') |
470 | |
471 | === modified file 'breezy/plugins/repodebug/missing_keys_for_stacking_fixer.py' |
472 | --- breezy/plugins/repodebug/missing_keys_for_stacking_fixer.py 2017-09-07 08:21:29 +0000 |
473 | +++ breezy/plugins/repodebug/missing_keys_for_stacking_fixer.py 2018-06-21 08:27:55 +0000 |
474 | @@ -19,6 +19,7 @@ |
475 | from ...controldir import ControlDir |
476 | from ...commands import Command, Option |
477 | from ... import errors |
478 | +from ...sixish import viewvalues |
479 | from ...bzr.vf_search import PendingAncestryResult |
480 | from ...revision import NULL_REVISION |
481 | |
482 | @@ -63,7 +64,7 @@ |
483 | revs = raw_r.all_revision_ids() |
484 | rev_parents = raw_r.get_graph().get_parent_map(revs) |
485 | needed = set() |
486 | - map(needed.update, rev_parents.itervalues()) |
487 | + map(needed.update, viewvalues(rev_parents)) |
488 | needed.discard(NULL_REVISION) |
489 | needed = set((rev,) for rev in needed) |
490 | needed = needed - raw_r.inventories.keys() |
491 | |
492 | === modified file 'breezy/plugins/repodebug/tests/__init__.py' |
493 | --- breezy/plugins/repodebug/tests/__init__.py 2017-09-07 08:21:29 +0000 |
494 | +++ breezy/plugins/repodebug/tests/__init__.py 2018-06-21 08:27:55 +0000 |
495 | @@ -24,21 +24,21 @@ |
496 | |
497 | def test_check_chk(self): |
498 | out, err = self.run_bzr('check-chk') |
499 | - self.assertEqual(out, '') |
500 | - self.assertEqual(err, '') |
501 | + self.assertEqual(out, b'') |
502 | + self.assertEqual(err, b'') |
503 | |
504 | def test_chk_used_by(self): |
505 | self.make_branch_and_tree('.') |
506 | out, err = self.run_bzr('chk-used-by chk') |
507 | - self.assertEqual(out, '') |
508 | - self.assertEqual(err, '') |
509 | + self.assertEqual(out, b'') |
510 | + self.assertEqual(err, b'') |
511 | |
512 | def test_fetch_all_records(self): |
513 | self.make_branch_and_tree('source') |
514 | self.make_branch_and_tree('dest') |
515 | out, err = self.run_bzr('fetch-all-records source -d dest') |
516 | - self.assertEqual(out, 'Done.\n') |
517 | - self.assertEqual(err, '') |
518 | + self.assertEqual(out, b'Done.\n') |
519 | + self.assertEqual(err, b'') |
520 | |
521 | def test_file_refs(self): |
522 | tree = self.make_branch_and_tree('.') |
523 | @@ -46,35 +46,35 @@ |
524 | tree.add('foo') |
525 | revid = tree.commit('a commit') |
526 | out, err = self.run_bzr( |
527 | - 'file-refs ' + tree.path2id('foo') + ' ' + revid) |
528 | - self.assertEqual(out, revid + '\n') |
529 | - self.assertEqual(err, '') |
530 | + 'file-refs ' + tree.path2id('foo').decode() + ' ' + revid.decode()) |
531 | + self.assertEqual(out, revid + b'\n') |
532 | + self.assertEqual(err, b'') |
533 | |
534 | def test_fix_missing_keys_for_stacking(self): |
535 | self.make_branch_and_tree('stacked') |
536 | self.run_bzr('branch --stacked stacked new') |
537 | out, err = self.run_bzr('fix-missing-keys-for-stacking new') |
538 | - self.assertEqual(out, '') |
539 | - self.assertEqual(err, '') |
540 | + self.assertEqual(out, b'') |
541 | + self.assertEqual(err, b'') |
542 | |
543 | def test_mirror_revs_into(self): |
544 | self.make_branch_and_tree('source') |
545 | self.make_branch_and_tree('dest') |
546 | out, err = self.run_bzr('mirror-revs-into source dest') |
547 | - self.assertEqual(out, '') |
548 | - self.assertEqual(err, '') |
549 | + self.assertEqual(out, b'') |
550 | + self.assertEqual(err, b'') |
551 | |
552 | def test_repo_has_key(self): |
553 | self.make_branch_and_tree('repo') |
554 | out, err = self.run_bzr('repo-has-key repo revisions revid', retcode=1) |
555 | - self.assertEqual(out, 'False\n') |
556 | - self.assertEqual(err, '') |
557 | + self.assertEqual(out, b'False\n') |
558 | + self.assertEqual(err, b'') |
559 | |
560 | def test_repo_keys(self): |
561 | self.make_branch_and_tree('a') |
562 | out, err = self.run_bzr('repo-keys a texts') |
563 | - self.assertEqual(out, '') |
564 | - self.assertEqual(err, '') |
565 | + self.assertEqual(out, b'') |
566 | + self.assertEqual(err, b'') |
567 | |
568 | |
569 | def test_suite(): |
570 | |
571 | === modified file 'breezy/plugins/upload/tests/test_upload.py' |
572 | --- breezy/plugins/upload/tests/test_upload.py 2018-05-11 10:17:28 +0000 |
573 | +++ breezy/plugins/upload/tests/test_upload.py 2018-06-21 08:27:55 +0000 |
574 | @@ -220,7 +220,7 @@ |
575 | def _test_create_file(self, file_name): |
576 | self.make_branch_and_working_tree() |
577 | self.do_full_upload() |
578 | - self.add_file(file_name, 'foo') |
579 | + self.add_file(file_name, b'foo') |
580 | |
581 | self.do_upload() |
582 | |
583 | @@ -238,7 +238,7 @@ |
584 | self.do_full_upload() |
585 | self.add_dir(dir_name) |
586 | fpath = '%s/%s' % (dir_name, file_name) |
587 | - self.add_file(fpath, 'baz') |
588 | + self.add_file(fpath, b'baz') |
589 | |
590 | self.assertUpPathDoesNotExist(fpath) |
591 | |
592 | @@ -256,7 +256,7 @@ |
593 | |
594 | def test_modify_file(self): |
595 | self.make_branch_and_working_tree() |
596 | - self.add_file('hello', 'foo') |
597 | + self.add_file('hello', b'foo') |
598 | self.do_full_upload() |
599 | self.modify_file('hello', 'bar') |
600 | |
601 | @@ -268,7 +268,7 @@ |
602 | |
603 | def _test_rename_one_file(self, old_name, new_name): |
604 | self.make_branch_and_working_tree() |
605 | - self.add_file(old_name, 'foo') |
606 | + self.add_file(old_name, b'foo') |
607 | self.do_full_upload() |
608 | self.rename_any(old_name, new_name) |
609 | |
610 | @@ -287,7 +287,7 @@ |
611 | |
612 | def test_rename_and_change_file(self): |
613 | self.make_branch_and_working_tree() |
614 | - self.add_file('hello', 'foo') |
615 | + self.add_file('hello', b'foo') |
616 | self.do_full_upload() |
617 | self.rename_any('hello', 'goodbye') |
618 | self.modify_file('goodbye', 'bar') |
619 | @@ -300,8 +300,8 @@ |
620 | |
621 | def test_rename_two_files(self): |
622 | self.make_branch_and_working_tree() |
623 | - self.add_file('a', 'foo') |
624 | - self.add_file('b', 'qux') |
625 | + self.add_file('a', b'foo') |
626 | + self.add_file('b', b'qux') |
627 | self.do_full_upload() |
628 | # We rely on the assumption that bzr will topologically sort the |
629 | # renames which will cause a -> b to appear *before* b -> c |
630 | @@ -319,8 +319,8 @@ |
631 | def test_upload_revision(self): |
632 | self.make_branch_and_working_tree() # rev1 |
633 | self.do_full_upload() |
634 | - self.add_file('hello', 'foo') # rev2 |
635 | - self.modify_file('hello', 'bar') # rev3 |
636 | + self.add_file('hello', b'foo') # rev2 |
637 | + self.modify_file('hello', b'bar') # rev3 |
638 | |
639 | self.assertUpPathDoesNotExist('hello') |
640 | |
641 | @@ -331,18 +331,18 @@ |
642 | |
643 | def test_no_upload_when_changes(self): |
644 | self.make_branch_and_working_tree() |
645 | - self.add_file('a', 'foo') |
646 | - self.set_file_content('a', 'bar') |
647 | + self.add_file('a', b'foo') |
648 | + self.set_file_content('a', b'bar') |
649 | |
650 | self.assertRaises(errors.UncommittedChanges, self.do_upload) |
651 | |
652 | def test_no_upload_when_conflicts(self): |
653 | self.make_branch_and_working_tree() |
654 | - self.add_file('a', 'foo') |
655 | + self.add_file('a', b'foo') |
656 | self.run_bzr('branch branch other') |
657 | - self.modify_file('a', 'bar') |
658 | + self.modify_file('a', b'bar') |
659 | other_tree = workingtree.WorkingTree.open('other') |
660 | - self.set_file_content('a', 'baz', 'other/') |
661 | + self.set_file_content('a', 'baz', b'other/') |
662 | other_tree.commit('modify file a') |
663 | |
664 | self.run_bzr('merge -d branch other', retcode=1) |
665 | @@ -351,11 +351,11 @@ |
666 | |
667 | def _test_change_file_into_dir(self, file_name): |
668 | self.make_branch_and_working_tree() |
669 | - self.add_file(file_name, 'foo') |
670 | + self.add_file(file_name, b'foo') |
671 | self.do_full_upload() |
672 | self.transform_file_into_dir(file_name) |
673 | fpath = '%s/%s' % (file_name, 'file') |
674 | - self.add_file(fpath, 'bar') |
675 | + self.add_file(fpath, b'bar') |
676 | |
677 | self.assertUpFileEqual('foo', file_name) |
678 | |
679 | @@ -373,7 +373,7 @@ |
680 | def test_change_dir_into_file(self): |
681 | self.make_branch_and_working_tree() |
682 | self.add_dir('hello') |
683 | - self.add_file('hello/file', 'foo') |
684 | + self.add_file('hello/file', b'foo') |
685 | self.do_full_upload() |
686 | self.delete_any('hello/file') |
687 | self.transform_dir_into_file('hello', 'bar') |
688 | @@ -386,7 +386,7 @@ |
689 | |
690 | def _test_make_file_executable(self, file_name): |
691 | self.make_branch_and_working_tree() |
692 | - self.add_file(file_name, 'foo') |
693 | + self.add_file(file_name, b'foo') |
694 | self.chmod_file(file_name, 0o664) |
695 | self.do_full_upload() |
696 | self.chmod_file(file_name, 0o755) |
697 | @@ -434,14 +434,14 @@ |
698 | """Test that upload --auto sets the upload_auto option""" |
699 | self.make_branch_and_working_tree() |
700 | |
701 | - self.add_file('hello', 'foo') |
702 | + self.add_file('hello', b'foo') |
703 | self.assertFalse(self.get_upload_auto()) |
704 | self.do_full_upload(auto=True) |
705 | self.assertUpFileEqual('foo', 'hello') |
706 | self.assertTrue(self.get_upload_auto()) |
707 | |
708 | # and check that it stays set until it is unset |
709 | - self.add_file('bye', 'bar') |
710 | + self.add_file('bye', b'bar') |
711 | self.do_full_upload() |
712 | self.assertUpFileEqual('bar', 'bye') |
713 | self.assertTrue(self.get_upload_auto()) |
714 | @@ -450,18 +450,18 @@ |
715 | """Test that upload --no-auto unsets the upload_auto option""" |
716 | self.make_branch_and_working_tree() |
717 | |
718 | - self.add_file('hello', 'foo') |
719 | + self.add_file('hello', b'foo') |
720 | self.do_full_upload(auto=True) |
721 | self.assertUpFileEqual('foo', 'hello') |
722 | self.assertTrue(self.get_upload_auto()) |
723 | |
724 | - self.add_file('bye', 'bar') |
725 | + self.add_file('bye', b'bar') |
726 | self.do_full_upload(auto=False) |
727 | self.assertUpFileEqual('bar', 'bye') |
728 | self.assertFalse(self.get_upload_auto()) |
729 | |
730 | # and check that it stays unset until it is set |
731 | - self.add_file('again', 'baz') |
732 | + self.add_file('again', b'baz') |
733 | self.do_full_upload() |
734 | self.assertUpFileEqual('baz', 'again') |
735 | self.assertFalse(self.get_upload_auto()) |
736 | @@ -476,7 +476,7 @@ |
737 | def test_upload_revid_path_in_dir(self): |
738 | self.make_branch_and_working_tree() |
739 | self.add_dir('dir') |
740 | - self.add_file('dir/goodbye', 'baz') |
741 | + self.add_file('dir/goodbye', b'baz') |
742 | |
743 | revid_path = 'dir/revid-path' |
744 | self.tree.branch.get_config_stack( |
745 | @@ -485,7 +485,7 @@ |
746 | |
747 | self.do_full_upload() |
748 | |
749 | - self.add_file('dir/hello', 'foo') |
750 | + self.add_file('dir/hello', b'foo') |
751 | |
752 | self.do_upload() |
753 | |
754 | @@ -496,8 +496,8 @@ |
755 | def test_ignore_file(self): |
756 | self.make_branch_and_working_tree() |
757 | self.do_full_upload() |
758 | - self.add_file('.bzrignore-upload', 'foo') |
759 | - self.add_file('foo', 'bar') |
760 | + self.add_file('.bzrignore-upload', b'foo') |
761 | + self.add_file('foo', b'bar') |
762 | |
763 | self.do_upload() |
764 | |
765 | @@ -506,8 +506,8 @@ |
766 | def test_ignore_regexp(self): |
767 | self.make_branch_and_working_tree() |
768 | self.do_full_upload() |
769 | - self.add_file('.bzrignore-upload', 'f*') |
770 | - self.add_file('foo', 'bar') |
771 | + self.add_file('.bzrignore-upload', b'f*') |
772 | + self.add_file('foo', b'bar') |
773 | |
774 | self.do_upload() |
775 | |
776 | @@ -516,7 +516,7 @@ |
777 | def test_ignore_directory(self): |
778 | self.make_branch_and_working_tree() |
779 | self.do_full_upload() |
780 | - self.add_file('.bzrignore-upload', 'dir') |
781 | + self.add_file('.bzrignore-upload', b'dir') |
782 | self.add_dir('dir') |
783 | |
784 | self.do_upload() |
785 | @@ -526,10 +526,10 @@ |
786 | def test_ignore_nested_directory(self): |
787 | self.make_branch_and_working_tree() |
788 | self.do_full_upload() |
789 | - self.add_file('.bzrignore-upload', 'dir') |
790 | + self.add_file('.bzrignore-upload', b'dir') |
791 | self.add_dir('dir') |
792 | self.add_dir('dir/foo') |
793 | - self.add_file('dir/foo/bar', 'bar contents') |
794 | + self.add_file('dir/foo/bar', b'bar contents') |
795 | |
796 | self.do_upload() |
797 | |
798 | @@ -538,11 +538,11 @@ |
799 | |
800 | def test_ignore_change_file_into_dir(self): |
801 | self.make_branch_and_working_tree() |
802 | - self.add_file('hello', 'foo') |
803 | + self.add_file('hello', b'foo') |
804 | self.do_full_upload() |
805 | - self.add_file('.bzrignore-upload', 'hello') |
806 | + self.add_file('.bzrignore-upload', b'hello') |
807 | self.transform_file_into_dir('hello') |
808 | - self.add_file('hello/file', 'bar') |
809 | + self.add_file('hello/file', b'bar') |
810 | |
811 | self.assertUpFileEqual('foo', 'hello') |
812 | |
813 | @@ -553,10 +553,10 @@ |
814 | def test_ignore_change_dir_into_file(self): |
815 | self.make_branch_and_working_tree() |
816 | self.add_dir('hello') |
817 | - self.add_file('hello/file', 'foo') |
818 | + self.add_file('hello/file', b'foo') |
819 | self.do_full_upload() |
820 | |
821 | - self.add_file('.bzrignore-upload', 'hello') |
822 | + self.add_file('.bzrignore-upload', b'hello') |
823 | self.delete_any('hello/file') |
824 | self.transform_dir_into_file('hello', 'bar') |
825 | |
826 | @@ -570,9 +570,9 @@ |
827 | self.make_branch_and_working_tree() |
828 | self.add_dir('dir') |
829 | self.add_dir('dir/subdir') |
830 | - self.add_file('dir/subdir/a', 'foo') |
831 | + self.add_file('dir/subdir/a', b'foo') |
832 | self.do_full_upload() |
833 | - self.add_file('.bzrignore-upload', 'dir/subdir') |
834 | + self.add_file('.bzrignore-upload', b'dir/subdir') |
835 | self.rename_any('dir/subdir/a', 'dir/a') |
836 | self.delete_any('dir/subdir') |
837 | |
838 | @@ -611,7 +611,7 @@ |
839 | self.make_branch_and_working_tree() |
840 | self.add_dir('dir') |
841 | self.do_full_upload() |
842 | - self.add_file('dir/goodbye', 'baz') |
843 | + self.add_file('dir/goodbye', b'baz') |
844 | |
845 | self.assertUpPathDoesNotExist('dir/goodbye') |
846 | |
847 | @@ -629,7 +629,7 @@ |
848 | |
849 | def test_delete_one_file(self): |
850 | self.make_branch_and_working_tree() |
851 | - self.add_file('hello', 'foo') |
852 | + self.add_file('hello', b'foo') |
853 | self.do_full_upload() |
854 | self.delete_any('hello') |
855 | |
856 | @@ -643,7 +643,7 @@ |
857 | self.make_branch_and_working_tree() |
858 | self.add_dir('dir') |
859 | self.add_dir('dir/subdir') |
860 | - self.add_file('dir/subdir/a', 'foo') |
861 | + self.add_file('dir/subdir/a', b'foo') |
862 | self.do_full_upload() |
863 | self.rename_any('dir/subdir/a', 'a') |
864 | self.delete_any('dir/subdir') |
865 | @@ -660,8 +660,8 @@ |
866 | |
867 | def test_delete_one_file_rename_to_deleted(self): |
868 | self.make_branch_and_working_tree() |
869 | - self.add_file('a', 'foo') |
870 | - self.add_file('b', 'bar') |
871 | + self.add_file('a', b'foo') |
872 | + self.add_file('b', b'bar') |
873 | self.do_full_upload() |
874 | self.delete_any('a') |
875 | self.rename_any('b', 'a') |
876 | @@ -676,7 +676,7 @@ |
877 | def test_rename_outside_dir_delete_dir(self): |
878 | self.make_branch_and_working_tree() |
879 | self.add_dir('dir') |
880 | - self.add_file('dir/a', 'foo') |
881 | + self.add_file('dir/a', b'foo') |
882 | self.do_full_upload() |
883 | self.rename_any('dir/a', 'a') |
884 | self.delete_any('dir') |
885 | @@ -701,7 +701,7 @@ |
886 | |
887 | def test_upload_for_the_first_time_do_a_full_upload(self): |
888 | self.make_branch_and_working_tree() |
889 | - self.add_file('hello', 'bar') |
890 | + self.add_file('hello', b'bar') |
891 | |
892 | revid_path = self.tree.branch.get_config_stack( |
893 | ).get('upload_revid_location') |
894 | @@ -713,9 +713,9 @@ |
895 | |
896 | def test_ignore_delete_one_file(self): |
897 | self.make_branch_and_working_tree() |
898 | - self.add_file('hello', 'foo') |
899 | + self.add_file('hello', b'foo') |
900 | self.do_full_upload() |
901 | - self.add_file('.bzrignore-upload', 'hello') |
902 | + self.add_file('.bzrignore-upload', b'hello') |
903 | self.delete_any('hello') |
904 | |
905 | self.assertUpFileEqual('foo', 'hello') |
906 | @@ -773,7 +773,7 @@ |
907 | working tree. |
908 | """ |
909 | self.make_branch_and_working_tree() |
910 | - self.add_file('hello', 'foo') |
911 | + self.add_file('hello', b'foo') |
912 | |
913 | remote_branch_url = self.get_url(self.remote_branch_dir) |
914 | self.run_bzr(['push', remote_branch_url, |
915 | @@ -836,6 +836,6 @@ |
916 | t = self.get_transport(self.upload_dir) |
917 | t.put_bytes('.bzr-upload.revid', 'fake') |
918 | # Make a change |
919 | - self.add_file('foo', 'bar\n') |
920 | + self.add_file('foo', b'bar\n') |
921 | self.assertRaises(cmds.DivergedUploadedTree, self.do_full_upload) |
922 | |
923 | |
924 | === modified file 'breezy/tests/__init__.py' |
925 | --- breezy/tests/__init__.py 2018-05-11 00:02:31 +0000 |
926 | +++ breezy/tests/__init__.py 2018-06-21 08:27:55 +0000 |
927 | @@ -1538,7 +1538,8 @@ |
928 | |
929 | def assertPathExists(self, path): |
930 | """Fail unless path or paths, which may be abs or relative, exist.""" |
931 | - if not isinstance(path, (str, text_type)): |
932 | + # TODO(jelmer): Clean this up for pad.lv/1696545 |
933 | + if not isinstance(path, (bytes, str, text_type)): |
934 | for p in path: |
935 | self.assertPathExists(p) |
936 | else: |
937 | |
938 | === modified file 'breezy/tests/blackbox/test_branch.py' |
939 | --- breezy/tests/blackbox/test_branch.py 2018-03-25 00:39:16 +0000 |
940 | +++ breezy/tests/blackbox/test_branch.py 2018-06-21 08:27:55 +0000 |
941 | @@ -227,18 +227,18 @@ |
942 | tree_b.add('file') |
943 | tree_b.commit('commit b-1', rev_id=b'b-1') |
944 | |
945 | - self.assertTrue(shared_repo.has_revision('a-1')) |
946 | - self.assertTrue(shared_repo.has_revision('a-2')) |
947 | - self.assertTrue(shared_repo.has_revision('b-1')) |
948 | + self.assertTrue(shared_repo.has_revision(b'a-1')) |
949 | + self.assertTrue(shared_repo.has_revision(b'a-2')) |
950 | + self.assertTrue(shared_repo.has_revision(b'b-1')) |
951 | |
952 | # Now that we have a repository with shared files, make sure |
953 | # that things aren't copied out by a 'branch' |
954 | self.run_bzr('branch repo/b branch-b') |
955 | pushed_tree = WorkingTree.open('branch-b') |
956 | pushed_repo = pushed_tree.branch.repository |
957 | - self.assertFalse(pushed_repo.has_revision('a-1')) |
958 | - self.assertFalse(pushed_repo.has_revision('a-2')) |
959 | - self.assertTrue(pushed_repo.has_revision('b-1')) |
960 | + self.assertFalse(pushed_repo.has_revision(b'a-1')) |
961 | + self.assertFalse(pushed_repo.has_revision(b'a-2')) |
962 | + self.assertTrue(pushed_repo.has_revision(b'b-1')) |
963 | |
964 | def test_branch_hardlink(self): |
965 | self.requireFeature(HardlinkFeature) |
966 | |
967 | === modified file 'breezy/tests/blackbox/test_merge.py' |
968 | --- breezy/tests/blackbox/test_merge.py 2018-05-13 02:18:13 +0000 |
969 | +++ breezy/tests/blackbox/test_merge.py 2018-06-21 08:27:55 +0000 |
970 | @@ -688,16 +688,16 @@ |
971 | target_bzrdir = source.controldir.sprout('target') |
972 | # Add a non-ancestry tag to source |
973 | builder.build_commit(message="Rev 2a", rev_id=b'rev-2a') |
974 | - source.tags.set_tag('tag-a', 'rev-2a') |
975 | - source.set_last_revision_info(1, 'rev-1') |
976 | + source.tags.set_tag('tag-a', b'rev-2a') |
977 | + source.set_last_revision_info(1, b'rev-1') |
978 | source.get_config_stack().set('branch.fetch_tags', True) |
979 | builder.build_commit(message="Rev 2b", rev_id=b'rev-2b') |
980 | # Merge from source |
981 | self.run_bzr('merge -d target source') |
982 | target = target_bzrdir.open_branch() |
983 | # The tag is present, and so is its revision. |
984 | - self.assertEqual('rev-2a', target.tags.lookup_tag('tag-a')) |
985 | - target.repository.get_revision('rev-2a') |
986 | + self.assertEqual(b'rev-2a', target.tags.lookup_tag('tag-a')) |
987 | + target.repository.get_revision(b'rev-2a') |
988 | |
989 | |
990 | class TestMergeRevisionRange(tests.TestCaseWithTransport): |
991 | |
992 | === modified file 'breezy/tests/blackbox/test_push.py' |
993 | --- breezy/tests/blackbox/test_push.py 2018-03-26 00:54:10 +0000 |
994 | +++ breezy/tests/blackbox/test_push.py 2018-06-21 08:27:55 +0000 |
995 | @@ -210,7 +210,7 @@ |
996 | tree_a.add('file') |
997 | tree_a.commit('commit a-1', rev_id=b'a-1') |
998 | f = open('repo/a/file', 'ab') |
999 | - f.write('more stuff\n') |
1000 | + f.write(b'more stuff\n') |
1001 | f.close() |
1002 | tree_a.commit('commit a-2', rev_id=b'a-2') |
1003 | |
1004 | @@ -219,18 +219,18 @@ |
1005 | tree_b.add('file') |
1006 | tree_b.commit('commit b-1', rev_id=b'b-1') |
1007 | |
1008 | - self.assertTrue(shared_repo.has_revision('a-1')) |
1009 | - self.assertTrue(shared_repo.has_revision('a-2')) |
1010 | - self.assertTrue(shared_repo.has_revision('b-1')) |
1011 | + self.assertTrue(shared_repo.has_revision(b'a-1')) |
1012 | + self.assertTrue(shared_repo.has_revision(b'a-2')) |
1013 | + self.assertTrue(shared_repo.has_revision(b'b-1')) |
1014 | |
1015 | # Now that we have a repository with shared files, make sure |
1016 | # that things aren't copied out by a 'push' |
1017 | self.run_bzr('push ../../push-b', working_dir='repo/b') |
1018 | pushed_tree = workingtree.WorkingTree.open('push-b') |
1019 | pushed_repo = pushed_tree.branch.repository |
1020 | - self.assertFalse(pushed_repo.has_revision('a-1')) |
1021 | - self.assertFalse(pushed_repo.has_revision('a-2')) |
1022 | - self.assertTrue(pushed_repo.has_revision('b-1')) |
1023 | + self.assertFalse(pushed_repo.has_revision(b'a-1')) |
1024 | + self.assertFalse(pushed_repo.has_revision(b'a-2')) |
1025 | + self.assertTrue(pushed_repo.has_revision(b'b-1')) |
1026 | |
1027 | def test_push_funky_id(self): |
1028 | t = self.make_branch_and_tree('tree') |
1029 | @@ -445,16 +445,16 @@ |
1030 | def test_push_with_revisionspec(self): |
1031 | """We should be able to push a revision older than the tip.""" |
1032 | tree_from = self.make_branch_and_tree('from') |
1033 | - tree_from.commit("One.", rev_id="from-1") |
1034 | - tree_from.commit("Two.", rev_id="from-2") |
1035 | + tree_from.commit("One.", rev_id=b"from-1") |
1036 | + tree_from.commit("Two.", rev_id=b"from-2") |
1037 | |
1038 | self.run_bzr('push -r1 ../to', working_dir='from') |
1039 | |
1040 | tree_to = workingtree.WorkingTree.open('to') |
1041 | repo_to = tree_to.branch.repository |
1042 | - self.assertTrue(repo_to.has_revision('from-1')) |
1043 | - self.assertFalse(repo_to.has_revision('from-2')) |
1044 | - self.assertEqual(tree_to.branch.last_revision_info()[1], 'from-1') |
1045 | + self.assertTrue(repo_to.has_revision(b'from-1')) |
1046 | + self.assertFalse(repo_to.has_revision(b'from-2')) |
1047 | + self.assertEqual(tree_to.branch.last_revision_info()[1], b'from-1') |
1048 | self.assertFalse( |
1049 | tree_to.changes_from(tree_to.basis_tree()).has_changed()) |
1050 | |
1051 | |
1052 | === modified file 'breezy/tests/blackbox/test_tags.py' |
1053 | --- breezy/tests/blackbox/test_tags.py 2018-02-18 15:21:06 +0000 |
1054 | +++ breezy/tests/blackbox/test_tags.py 2018-06-21 08:27:55 +0000 |
1055 | @@ -181,8 +181,8 @@ |
1056 | self.assertEqual(expected_tag_dict, child.branch.tags.get_tag_dict()) |
1057 | self.assertEqual(expected_tag_dict, master.tags.get_tag_dict()) |
1058 | # Revisions not in ancestry but named in tags are present |
1059 | - child.branch.repository.get_revision('fork-0') |
1060 | - master.repository.get_revision('fork-0') |
1061 | + child.branch.repository.get_revision(b'fork-0') |
1062 | + master.repository.get_revision(b'fork-0') |
1063 | |
1064 | def test_commit_in_heavyweight_checkout_reports_tag_conflict(self): |
1065 | master, child = self.make_master_and_checkout() |
1066 | |
1067 | === modified file 'breezy/tests/per_bzrdir/test_bzrdir.py' |
1068 | --- breezy/tests/per_bzrdir/test_bzrdir.py 2018-02-18 15:21:06 +0000 |
1069 | +++ breezy/tests/per_bzrdir/test_bzrdir.py 2018-06-21 08:27:55 +0000 |
1070 | @@ -236,7 +236,7 @@ |
1071 | dir = self.make_controldir('source') |
1072 | repo = dir.create_repository() |
1073 | repo.fetch(tree.branch.repository) |
1074 | - self.assertTrue(repo.has_revision('1')) |
1075 | + self.assertTrue(repo.has_revision(b'1')) |
1076 | try: |
1077 | self.make_repository('target', shared=True) |
1078 | except errors.IncompatibleFormat: |
1079 | @@ -302,7 +302,7 @@ |
1080 | dir = self.make_controldir('source') |
1081 | repo = dir.create_repository() |
1082 | repo.fetch(tree.branch.repository) |
1083 | - self.assertTrue(repo.has_revision('1')) |
1084 | + self.assertTrue(repo.has_revision(b'1')) |
1085 | target = dir.clone(self.get_url('target')) |
1086 | self.assertNotEqual(dir.transport.base, target.transport.base) |
1087 | self.assertDirectoriesEqual(dir.root_transport, target.root_transport, |
1088 | @@ -430,7 +430,7 @@ |
1089 | dir = self.make_controldir('source') |
1090 | repo = dir.create_repository() |
1091 | repo.fetch(tree.branch.repository) |
1092 | - self.assertTrue(repo.has_revision('1')) |
1093 | + self.assertTrue(repo.has_revision(b'1')) |
1094 | try: |
1095 | self.assertTrue( |
1096 | _mod_revision.is_null(_mod_revision.ensure_null( |
1097 | @@ -458,7 +458,7 @@ |
1098 | inventory_f = file(local_inventory, 'rb') |
1099 | self.addCleanup(inventory_f.close) |
1100 | self.assertContainsRe(inventory_f.read(), |
1101 | - '<inventory format="5">\n</inventory>\n') |
1102 | + b'<inventory format="5">\n</inventory>\n') |
1103 | except IOError as e: |
1104 | if e.errno != errno.ENOENT: |
1105 | raise |
1106 | |
1107 | === modified file 'breezy/tests/per_controldir/test_controldir.py' |
1108 | --- breezy/tests/per_controldir/test_controldir.py 2018-03-24 14:47:01 +0000 |
1109 | +++ breezy/tests/per_controldir/test_controldir.py 2018-06-21 08:27:55 +0000 |
1110 | @@ -870,7 +870,7 @@ |
1111 | self.assertEqual('missing-rev', new_branch.tags.lookup_tag('tag-a')) |
1112 | |
1113 | def test_sprout_bzrdir_passing_rev_not_source_branch_copies_tags(self): |
1114 | - # dir.sprout(..., revision_id='rev1') copies rev1, and all the tags of |
1115 | + # dir.sprout(..., revision_id=b'rev1') copies rev1, and all the tags of |
1116 | # the branch at that bzrdir, the ancestry of all of those, but no other |
1117 | # revs (not even the tip of the source branch). |
1118 | builder = self.make_branch_builder('source') |
1119 | @@ -1293,7 +1293,7 @@ |
1120 | made_control = self.bzrdir_format.initialize(t.base) |
1121 | made_repo = made_control.create_repository() |
1122 | # Check that we have a repository object. |
1123 | - made_repo.has_revision('foo') |
1124 | + made_repo.has_revision(b'foo') |
1125 | self.assertEqual(made_control, made_repo.controldir) |
1126 | |
1127 | def test_create_repository_shared(self): |
1128 | |
1129 | === modified file 'breezy/tests/per_interrepository/test_fetch.py' |
1130 | --- breezy/tests/per_interrepository/test_fetch.py 2018-05-13 02:45:58 +0000 |
1131 | +++ breezy/tests/per_interrepository/test_fetch.py 2018-06-21 08:27:55 +0000 |
1132 | @@ -64,17 +64,17 @@ |
1133 | tree_a.commit('rev1', rev_id=b'rev1') |
1134 | def check_push_rev1(repo): |
1135 | # ensure the revision is missing. |
1136 | - self.assertRaises(NoSuchRevision, repo.get_revision, 'rev1') |
1137 | + self.assertRaises(NoSuchRevision, repo.get_revision, b'rev1') |
1138 | # fetch with a limit of NULL_REVISION |
1139 | repo.fetch(tree_a.branch.repository, |
1140 | revision_id=NULL_REVISION) |
1141 | # nothing should have been pushed |
1142 | - self.assertFalse(repo.has_revision('rev1')) |
1143 | + self.assertFalse(repo.has_revision(b'rev1')) |
1144 | # fetch with a default limit (grab everything) |
1145 | repo.fetch(tree_a.branch.repository) |
1146 | # check that b now has all the data from a's first commit. |
1147 | - rev = repo.get_revision('rev1') |
1148 | - tree = repo.revision_tree('rev1') |
1149 | + rev = repo.get_revision(b'rev1') |
1150 | + tree = repo.revision_tree(b'rev1') |
1151 | tree.lock_read() |
1152 | self.addCleanup(tree.unlock) |
1153 | tree.get_file_text('foo') |
1154 | @@ -207,7 +207,7 @@ |
1155 | builder.start_series() |
1156 | builder.build_snapshot(None, [ |
1157 | ('add', ('', b'root-id', 'directory', '')), |
1158 | - ('add', ('file', b'file-id', 'file', 'content\n'))], |
1159 | + ('add', ('file', b'file-id', 'file', b'content\n'))], |
1160 | revision_id=b'base') |
1161 | builder.build_snapshot([b'base'], [ |
1162 | ('modify', ('file', b'left content\n'))], |
1163 | @@ -222,30 +222,30 @@ |
1164 | branch = builder.get_branch() |
1165 | repo = self.make_to_repository('trunk') |
1166 | trunk = repo.controldir.create_branch() |
1167 | - trunk.repository.fetch(branch.repository, 'left') |
1168 | - trunk.repository.fetch(branch.repository, 'right') |
1169 | + trunk.repository.fetch(branch.repository, b'left') |
1170 | + trunk.repository.fetch(branch.repository, b'right') |
1171 | repo = self.make_to_repository('stacked') |
1172 | stacked_branch = repo.controldir.create_branch() |
1173 | stacked_branch.set_stacked_on_url(trunk.base) |
1174 | - stacked_branch.repository.fetch(branch.repository, 'merge') |
1175 | + stacked_branch.repository.fetch(branch.repository, b'merge') |
1176 | unstacked_repo = stacked_branch.controldir.open_repository() |
1177 | unstacked_repo.lock_read() |
1178 | self.addCleanup(unstacked_repo.unlock) |
1179 | - self.assertFalse(unstacked_repo.has_revision('left')) |
1180 | - self.assertFalse(unstacked_repo.has_revision('right')) |
1181 | + self.assertFalse(unstacked_repo.has_revision(b'left')) |
1182 | + self.assertFalse(unstacked_repo.has_revision(b'right')) |
1183 | self.assertEqual( |
1184 | - {('left',), ('right',), ('merge',)}, |
1185 | + {(b'left',), (b'right',), (b'merge',)}, |
1186 | unstacked_repo.inventories.keys()) |
1187 | # And the basis inventories have been copied correctly |
1188 | trunk.lock_read() |
1189 | self.addCleanup(trunk.unlock) |
1190 | left_tree, right_tree = trunk.repository.revision_trees( |
1191 | - ['left', 'right']) |
1192 | + [b'left', b'right']) |
1193 | stacked_branch.lock_read() |
1194 | self.addCleanup(stacked_branch.unlock) |
1195 | (stacked_left_tree, |
1196 | stacked_right_tree) = stacked_branch.repository.revision_trees( |
1197 | - ['left', 'right']) |
1198 | + [b'left', b'right']) |
1199 | self.assertEqual( |
1200 | left_tree.root_inventory, stacked_left_tree.root_inventory) |
1201 | self.assertEqual( |
1202 | @@ -255,15 +255,15 @@ |
1203 | # present. The texts introduced in merge (and only those) should be |
1204 | # present, and also generating a stream should succeed without blowing |
1205 | # up. |
1206 | - self.assertTrue(unstacked_repo.has_revision('merge')) |
1207 | - expected_texts = {('file-id', 'merge')} |
1208 | - if stacked_branch.repository.texts.get_parent_map([('root-id', |
1209 | - 'merge')]): |
1210 | + self.assertTrue(unstacked_repo.has_revision(b'merge')) |
1211 | + expected_texts = {(b'file-id', b'merge')} |
1212 | + if stacked_branch.repository.texts.get_parent_map([(b'root-id', |
1213 | + b'merge')]): |
1214 | # If a (root-id,merge) text exists, it should be in the stacked |
1215 | # repo. |
1216 | - expected_texts.add(('root-id', 'merge')) |
1217 | + expected_texts.add((b'root-id', b'merge')) |
1218 | self.assertEqual(expected_texts, unstacked_repo.texts.keys()) |
1219 | - self.assertCanStreamRevision(unstacked_repo, 'merge') |
1220 | + self.assertCanStreamRevision(unstacked_repo, b'merge') |
1221 | |
1222 | def assertCanStreamRevision(self, repo, revision_id): |
1223 | exclude_keys = set(repo.all_revision_ids()) - {revision_id} |
1224 | @@ -293,40 +293,40 @@ |
1225 | branch = builder.get_branch() |
1226 | repo = self.make_to_repository('trunk') |
1227 | trunk = repo.controldir.create_branch() |
1228 | - trunk.repository.fetch(branch.repository, 'second') |
1229 | + trunk.repository.fetch(branch.repository, b'second') |
1230 | repo = self.make_to_repository('stacked') |
1231 | stacked_branch = repo.controldir.create_branch() |
1232 | stacked_branch.set_stacked_on_url(trunk.base) |
1233 | - stacked_branch.repository.fetch(branch.repository, 'third') |
1234 | + stacked_branch.repository.fetch(branch.repository, b'third') |
1235 | unstacked_repo = stacked_branch.controldir.open_repository() |
1236 | unstacked_repo.lock_read() |
1237 | self.addCleanup(unstacked_repo.unlock) |
1238 | - self.assertFalse(unstacked_repo.has_revision('second')) |
1239 | - self.assertFalse(unstacked_repo.has_revision('ghost')) |
1240 | + self.assertFalse(unstacked_repo.has_revision(b'second')) |
1241 | + self.assertFalse(unstacked_repo.has_revision(b'ghost')) |
1242 | self.assertEqual( |
1243 | - {('second',), ('third',)}, |
1244 | + {(b'second',), (b'third',)}, |
1245 | unstacked_repo.inventories.keys()) |
1246 | # And the basis inventories have been copied correctly |
1247 | trunk.lock_read() |
1248 | self.addCleanup(trunk.unlock) |
1249 | - second_tree = trunk.repository.revision_tree('second') |
1250 | + second_tree = trunk.repository.revision_tree(b'second') |
1251 | stacked_branch.lock_read() |
1252 | self.addCleanup(stacked_branch.unlock) |
1253 | - stacked_second_tree = stacked_branch.repository.revision_tree('second') |
1254 | + stacked_second_tree = stacked_branch.repository.revision_tree(b'second') |
1255 | self.assertEqual(second_tree, stacked_second_tree) |
1256 | # Finally, it's not enough to see that the basis inventories are |
1257 | # present. The texts introduced in merge (and only those) should be |
1258 | # present, and also generating a stream should succeed without blowing |
1259 | # up. |
1260 | - self.assertTrue(unstacked_repo.has_revision('third')) |
1261 | + self.assertTrue(unstacked_repo.has_revision(b'third')) |
1262 | expected_texts = {('file-id', 'third')} |
1263 | - if stacked_branch.repository.texts.get_parent_map([('root-id', |
1264 | - 'third')]): |
1265 | + if stacked_branch.repository.texts.get_parent_map([(b'root-id', |
1266 | + b'third')]): |
1267 | # If a (root-id,third) text exists, it should be in the stacked |
1268 | # repo. |
1269 | - expected_texts.add(('root-id', 'third')) |
1270 | + expected_texts.add((b'root-id', b'third')) |
1271 | self.assertEqual(expected_texts, unstacked_repo.texts.keys()) |
1272 | - self.assertCanStreamRevision(unstacked_repo, 'third') |
1273 | + self.assertCanStreamRevision(unstacked_repo, b'third') |
1274 | |
1275 | def test_fetch_from_stacked_to_stacked_copies_parent_inventories(self): |
1276 | """Fetch from a stacked branch copies inventories for parents of |
1277 | @@ -344,8 +344,8 @@ |
1278 | builder = self.make_branch_builder('branch') |
1279 | builder.start_series() |
1280 | builder.build_snapshot(None, [ |
1281 | - ('add', ('', 'root-id', 'directory', '')), |
1282 | - ('add', ('file', 'file-id', 'file', 'content\n'))], |
1283 | + ('add', ('', b'root-id', 'directory', '')), |
1284 | + ('add', ('file', b'file-id', 'file', b'content\n'))], |
1285 | revision_id=b'base') |
1286 | builder.build_snapshot([b'base'], [ |
1287 | ('modify', ('file', b'left content\n'))], |
1288 | @@ -361,18 +361,18 @@ |
1289 | repo = self.make_repository('old-trunk') |
1290 | # Make a pair of equivalent trunk repos in the from and to formats. |
1291 | old_trunk = repo.controldir.create_branch() |
1292 | - old_trunk.repository.fetch(branch.repository, 'left') |
1293 | - old_trunk.repository.fetch(branch.repository, 'right') |
1294 | + old_trunk.repository.fetch(branch.repository, b'left') |
1295 | + old_trunk.repository.fetch(branch.repository, b'right') |
1296 | repo = self.make_to_repository('new-trunk') |
1297 | new_trunk = repo.controldir.create_branch() |
1298 | - new_trunk.repository.fetch(branch.repository, 'left') |
1299 | - new_trunk.repository.fetch(branch.repository, 'right') |
1300 | + new_trunk.repository.fetch(branch.repository, b'left') |
1301 | + new_trunk.repository.fetch(branch.repository, b'right') |
1302 | # Make the source; a repo stacked on old_trunk contained just the data |
1303 | # for 'merge'. |
1304 | repo = self.make_repository('old-stacked') |
1305 | old_stacked_branch = repo.controldir.create_branch() |
1306 | old_stacked_branch.set_stacked_on_url(old_trunk.base) |
1307 | - old_stacked_branch.repository.fetch(branch.repository, 'merge') |
1308 | + old_stacked_branch.repository.fetch(branch.repository, b'merge') |
1309 | # Make the target, a repo stacked on new_trunk. |
1310 | repo = self.make_to_repository('new-stacked') |
1311 | new_stacked_branch = repo.controldir.create_branch() |
1312 | @@ -381,41 +381,41 @@ |
1313 | new_unstacked_repo = new_stacked_branch.controldir.open_repository() |
1314 | # Reopen the source and target repos without any fallbacks, and fetch |
1315 | # 'merge'. |
1316 | - new_unstacked_repo.fetch(old_unstacked_repo, 'merge') |
1317 | + new_unstacked_repo.fetch(old_unstacked_repo, b'merge') |
1318 | # Now check the results. new_unstacked_repo should contain all the |
1319 | # data necessary to stream 'merge' (i.e. the parent inventories). |
1320 | new_unstacked_repo.lock_read() |
1321 | self.addCleanup(new_unstacked_repo.unlock) |
1322 | - self.assertFalse(new_unstacked_repo.has_revision('left')) |
1323 | - self.assertFalse(new_unstacked_repo.has_revision('right')) |
1324 | + self.assertFalse(new_unstacked_repo.has_revision(b'left')) |
1325 | + self.assertFalse(new_unstacked_repo.has_revision(b'right')) |
1326 | self.assertEqual( |
1327 | - {('left',), ('right',), ('merge',)}, |
1328 | + {(b'left',), (b'right',), (b'merge',)}, |
1329 | new_unstacked_repo.inventories.keys()) |
1330 | # And the basis inventories have been copied correctly |
1331 | new_trunk.lock_read() |
1332 | self.addCleanup(new_trunk.unlock) |
1333 | left_tree, right_tree = new_trunk.repository.revision_trees( |
1334 | - ['left', 'right']) |
1335 | + [b'left', b'right']) |
1336 | new_stacked_branch.lock_read() |
1337 | self.addCleanup(new_stacked_branch.unlock) |
1338 | (stacked_left_tree, |
1339 | stacked_right_tree) = new_stacked_branch.repository.revision_trees( |
1340 | - ['left', 'right']) |
1341 | + [b'left', b'right']) |
1342 | self.assertEqual(left_tree, stacked_left_tree) |
1343 | self.assertEqual(right_tree, stacked_right_tree) |
1344 | # Finally, it's not enough to see that the basis inventories are |
1345 | # present. The texts introduced in merge (and only those) should be |
1346 | # present, and also generating a stream should succeed without blowing |
1347 | # up. |
1348 | - self.assertTrue(new_unstacked_repo.has_revision('merge')) |
1349 | - expected_texts = {('file-id', 'merge')} |
1350 | - if new_stacked_branch.repository.texts.get_parent_map([('root-id', |
1351 | - 'merge')]): |
1352 | + self.assertTrue(new_unstacked_repo.has_revision(b'merge')) |
1353 | + expected_texts = {(b'file-id', b'merge')} |
1354 | + if new_stacked_branch.repository.texts.get_parent_map([(b'root-id', |
1355 | + b'merge')]): |
1356 | # If a (root-id,merge) text exists, it should be in the stacked |
1357 | # repo. |
1358 | - expected_texts.add(('root-id', 'merge')) |
1359 | + expected_texts.add((b'root-id', b'merge')) |
1360 | self.assertEqual(expected_texts, new_unstacked_repo.texts.keys()) |
1361 | - self.assertCanStreamRevision(new_unstacked_repo, 'merge') |
1362 | + self.assertCanStreamRevision(new_unstacked_repo, b'merge') |
1363 | |
1364 | def test_fetch_missing_basis_text(self): |
1365 | """If fetching a delta, we should die if a basis is not present.""" |
1366 | @@ -429,27 +429,24 @@ |
1367 | to_repo = self.make_to_repository('to_repo') |
1368 | # We build a broken revision so that we can test the fetch code dies |
1369 | # properly. So copy the inventory and revision, but not the text. |
1370 | - to_repo.lock_write() |
1371 | - try: |
1372 | + with to_repo.lock_write(): |
1373 | to_repo.start_write_group() |
1374 | try: |
1375 | - inv = tree.branch.repository.get_inventory('rev-one') |
1376 | - to_repo.add_inventory('rev-one', inv, []) |
1377 | - rev = tree.branch.repository.get_revision('rev-one') |
1378 | - to_repo.add_revision('rev-one', rev, inv=inv) |
1379 | + inv = tree.branch.repository.get_inventory(b'rev-one') |
1380 | + to_repo.add_inventory(b'rev-one', inv, []) |
1381 | + rev = tree.branch.repository.get_revision(b'rev-one') |
1382 | + to_repo.add_revision(b'rev-one', rev, inv=inv) |
1383 | self.disable_commit_write_group_paranoia(to_repo) |
1384 | to_repo.commit_write_group() |
1385 | except: |
1386 | to_repo.abort_write_group(suppress_errors=True) |
1387 | raise |
1388 | - finally: |
1389 | - to_repo.unlock() |
1390 | |
1391 | # Implementations can either ensure that the target of the delta is |
1392 | # reconstructable, or raise an exception (which stream based copies |
1393 | # generally do). |
1394 | try: |
1395 | - to_repo.fetch(tree.branch.repository, 'rev-two') |
1396 | + to_repo.fetch(tree.branch.repository, b'rev-two') |
1397 | except (errors.BzrCheckError, errors.RevisionNotPresent) as e: |
1398 | # If an exception is raised, the revision should not be in the |
1399 | # target. |
1400 | @@ -457,14 +454,14 @@ |
1401 | # Can also just raise a generic check errors; stream insertion |
1402 | # does this to include all the missing data |
1403 | self.assertRaises((errors.NoSuchRevision, errors.RevisionNotPresent), |
1404 | - to_repo.revision_tree, 'rev-two') |
1405 | + to_repo.revision_tree, b'rev-two') |
1406 | else: |
1407 | # If not exception is raised, then the text should be |
1408 | # available. |
1409 | to_repo.lock_read() |
1410 | try: |
1411 | - rt = to_repo.revision_tree('rev-two') |
1412 | - self.assertEqual('new contents\n', |
1413 | + rt = to_repo.revision_tree(b'rev-two') |
1414 | + self.assertEqual(b'new contents\n', |
1415 | rt.get_file_text('a')) |
1416 | finally: |
1417 | to_repo.unlock() |
1418 | @@ -488,31 +485,31 @@ |
1419 | # start by adding a file so the data knit for the file exists in |
1420 | # repositories that have specific files for each fileid. |
1421 | self.build_tree(['source/id']) |
1422 | - source_tree.add(['id'], ['id']) |
1423 | + source_tree.add(['id'], [b'id']) |
1424 | source_tree.commit('a', rev_id=b'a') |
1425 | # now we manually insert a revision with an inventory referencing |
1426 | # file 'id' at revision 'b', but we do not insert revision b. |
1427 | # this should ensure that the new versions of files are being checked |
1428 | # for during pull operations |
1429 | - inv = source.get_inventory('a') |
1430 | + inv = source.get_inventory(b'a') |
1431 | source.lock_write() |
1432 | self.addCleanup(source.unlock) |
1433 | source.start_write_group() |
1434 | - inv.get_entry('id').revision = 'b' |
1435 | - inv.revision_id = 'b' |
1436 | - sha1 = source.add_inventory('b', inv, ['a']) |
1437 | + inv.get_entry(b'id').revision = b'b' |
1438 | + inv.revision_id = b'b' |
1439 | + sha1 = source.add_inventory(b'b', inv, [b'a']) |
1440 | rev = Revision(timestamp=0, |
1441 | timezone=None, |
1442 | committer="Foo Bar <foo@example.com>", |
1443 | message="Message", |
1444 | inventory_sha1=sha1, |
1445 | revision_id=b'b') |
1446 | - rev.parent_ids = ['a'] |
1447 | - source.add_revision('b', rev) |
1448 | + rev.parent_ids = [b'a'] |
1449 | + source.add_revision(b'b', rev) |
1450 | self.disable_commit_write_group_paranoia(source) |
1451 | source.commit_write_group() |
1452 | self.assertRaises(errors.RevisionNotPresent, target.fetch, source) |
1453 | - self.assertFalse(target.has_revision('b')) |
1454 | + self.assertFalse(target.has_revision(b'b')) |
1455 | |
1456 | def test_fetch_funky_file_id(self): |
1457 | from_tree = self.make_branch_and_tree('tree') |
1458 | @@ -531,10 +528,10 @@ |
1459 | from_tree.commit('foo', rev_id=b'foo-id') |
1460 | to_repo = self.make_to_repository('to') |
1461 | to_repo.fetch(from_tree.branch.repository) |
1462 | - recorded_inv_sha1 = to_repo.get_revision('foo-id').inventory_sha1 |
1463 | + recorded_inv_sha1 = to_repo.get_revision(b'foo-id').inventory_sha1 |
1464 | to_repo.lock_read() |
1465 | self.addCleanup(to_repo.unlock) |
1466 | - stream = to_repo.inventories.get_record_stream([('foo-id',)], |
1467 | + stream = to_repo.inventories.get_record_stream([(b'foo-id',)], |
1468 | 'unordered', True) |
1469 | bytes = stream.next().get_bytes_as('fulltext') |
1470 | computed_inv_sha1 = osutils.sha_string(bytes) |
1471 | |
1472 | === modified file 'breezy/tests/per_interrepository/test_interrepository.py' |
1473 | --- breezy/tests/per_interrepository/test_interrepository.py 2018-02-18 15:21:06 +0000 |
1474 | +++ breezy/tests/per_interrepository/test_interrepository.py 2018-06-21 08:27:55 +0000 |
1475 | @@ -89,12 +89,12 @@ |
1476 | # make a repository to compare against that claims to have rev1 |
1477 | repo_b = self.make_to_repository('rev1_only') |
1478 | repo_a = self.controldir.open_repository() |
1479 | - repo_b.fetch(repo_a, 'rev1') |
1480 | + repo_b.fetch(repo_a, b'rev1') |
1481 | # check the test will be valid |
1482 | - self.assertFalse(repo_b.has_revision('rev2')) |
1483 | + self.assertFalse(repo_b.has_revision(b'rev2')) |
1484 | result = repo_b.search_missing_revision_ids(repo_a) |
1485 | - self.assertEqual({'rev2'}, result.get_keys()) |
1486 | - self.assertEqual(('search', {'rev2'}, {'rev1'}, 1), |
1487 | + self.assertEqual({b'rev2'}, result.get_keys()) |
1488 | + self.assertEqual(('search', {b'rev2'}, {b'rev1'}, 1), |
1489 | result.get_recipe()) |
1490 | |
1491 | def test_absent_requested_raises(self): |
1492 | @@ -103,14 +103,14 @@ |
1493 | repo_b = self.make_to_repository('target') |
1494 | repo_a = self.controldir.open_repository() |
1495 | # No pizza revisions anywhere |
1496 | - self.assertFalse(repo_a.has_revision('pizza')) |
1497 | - self.assertFalse(repo_b.has_revision('pizza')) |
1498 | + self.assertFalse(repo_a.has_revision(b'pizza')) |
1499 | + self.assertFalse(repo_b.has_revision(b'pizza')) |
1500 | # Asking specifically for an absent revision errors. |
1501 | self.assertRaises(errors.NoSuchRevision, |
1502 | - repo_b.search_missing_revision_ids, repo_a, revision_ids=['pizza'], |
1503 | + repo_b.search_missing_revision_ids, repo_a, revision_ids=[b'pizza'], |
1504 | find_ghosts=True) |
1505 | self.assertRaises(errors.NoSuchRevision, |
1506 | - repo_b.search_missing_revision_ids, repo_a, revision_ids=['pizza'], |
1507 | + repo_b.search_missing_revision_ids, repo_a, revision_ids=[b'pizza'], |
1508 | find_ghosts=False) |
1509 | |
1510 | def test_search_missing_rev_limited(self): |
1511 | @@ -131,9 +131,9 @@ |
1512 | repo_b = self.make_to_repository('rev1_only') |
1513 | repo_a = self.controldir.open_repository() |
1514 | # check the test will be valid |
1515 | - self.assertFalse(repo_b.has_revision('rev2')) |
1516 | + self.assertFalse(repo_b.has_revision(b'rev2')) |
1517 | result = repo_b.search_missing_revision_ids(repo_a, limit=1) |
1518 | - self.assertEqual(('search', {'rev1'}, {'null:'}, 1), |
1519 | + self.assertEqual(('search', {b'rev1'}, {b'null:'}, 1), |
1520 | result.get_recipe()) |
1521 | |
1522 | def test_fetch_fetches_signatures_too(self): |
1523 | @@ -184,16 +184,16 @@ |
1524 | repo.add_revision(revision_id, rev) |
1525 | repo.commit_write_group() |
1526 | repo.unlock() |
1527 | - add_commit(has_ghost, 'ghost', []) |
1528 | - add_commit(has_ghost, 'references', ['ghost']) |
1529 | - add_commit(missing_ghost, 'references', ['ghost']) |
1530 | - add_commit(has_ghost, 'tip', ['references']) |
1531 | - missing_ghost.fetch(has_ghost, 'tip', find_ghosts=True) |
1532 | + add_commit(has_ghost, b'ghost', []) |
1533 | + add_commit(has_ghost, b'references', [b'ghost']) |
1534 | + add_commit(missing_ghost, b'references', [b'ghost']) |
1535 | + add_commit(has_ghost, b'tip', [b'references']) |
1536 | + missing_ghost.fetch(has_ghost, b'tip', find_ghosts=True) |
1537 | # missing ghost now has tip and ghost. |
1538 | - rev = missing_ghost.get_revision('tip') |
1539 | - inv = missing_ghost.get_inventory('tip') |
1540 | - rev = missing_ghost.get_revision('ghost') |
1541 | - inv = missing_ghost.get_inventory('ghost') |
1542 | + rev = missing_ghost.get_revision(b'tip') |
1543 | + inv = missing_ghost.get_inventory(b'tip') |
1544 | + rev = missing_ghost.get_revision(b'ghost') |
1545 | + inv = missing_ghost.get_inventory(b'ghost') |
1546 | # rev must not be corrupt now |
1547 | - self.assertThat(['ghost', 'references', 'tip'], |
1548 | - MatchesAncestry(missing_ghost, 'tip')) |
1549 | + self.assertThat([b'ghost', b'references', b'tip'], |
1550 | + MatchesAncestry(missing_ghost, b'tip')) |
1551 | |
1552 | === modified file 'breezy/tests/per_pack_repository.py' |
1553 | --- breezy/tests/per_pack_repository.py 2018-03-26 00:54:10 +0000 |
1554 | +++ breezy/tests/per_pack_repository.py 2018-06-21 08:27:55 +0000 |
1555 | @@ -318,10 +318,10 @@ |
1556 | builder = self.make_branch_builder('source', format=format) |
1557 | builder.start_series() |
1558 | builder.build_snapshot(None, [ |
1559 | - ('add', ('', 'root-id', 'directory', None))], |
1560 | + ('add', ('', b'root-id', 'directory', None))], |
1561 | revision_id=b'A-id') |
1562 | builder.build_snapshot(None, [ |
1563 | - ('add', ('file', 'file-id', 'file', 'B content\n'))], |
1564 | + ('add', ('file', b'file-id', 'file', b'B content\n'))], |
1565 | revision_id=b'B-id') |
1566 | builder.build_snapshot(None, [ |
1567 | ('modify', ('file', b'C content\n'))], |
1568 | @@ -334,17 +334,17 @@ |
1569 | repo.lock_write() |
1570 | self.addCleanup(repo.unlock) |
1571 | repo.fetch(b.repository, revision_id=b'B-id') |
1572 | - inv = next(b.repository.iter_inventories(['C-id'])) |
1573 | + inv = next(b.repository.iter_inventories([b'C-id'])) |
1574 | repo.start_write_group() |
1575 | - repo.add_inventory('C-id', inv, ['B-id']) |
1576 | + repo.add_inventory(b'C-id', inv, [b'B-id']) |
1577 | repo.commit_write_group() |
1578 | - self.assertEqual([('A-id',), ('B-id',), ('C-id',)], |
1579 | + self.assertEqual([(b'A-id',), (b'B-id',), (b'C-id',)], |
1580 | sorted(repo.inventories.keys())) |
1581 | repo.pack() |
1582 | - self.assertEqual([('A-id',), ('B-id',), ('C-id',)], |
1583 | + self.assertEqual([(b'A-id',), (b'B-id',), (b'C-id',)], |
1584 | sorted(repo.inventories.keys())) |
1585 | # Content should be preserved as well |
1586 | - self.assertEqual(inv, next(repo.iter_inventories(['C-id']))) |
1587 | + self.assertEqual(inv, next(repo.iter_inventories([b'C-id']))) |
1588 | |
1589 | def test_pack_layout(self): |
1590 | # Test that the ordering of revisions in pack repositories is |
1591 | @@ -657,18 +657,18 @@ |
1592 | repo.add_revision(revision_id, rev) |
1593 | repo.commit_write_group() |
1594 | repo.unlock() |
1595 | - add_commit(has_ghost, 'ghost', []) |
1596 | - add_commit(has_ghost, 'references', ['ghost']) |
1597 | - add_commit(missing_ghost, 'references', ['ghost']) |
1598 | - add_commit(has_ghost, 'tip', ['references']) |
1599 | - missing_ghost.fetch(has_ghost, 'tip') |
1600 | + add_commit(has_ghost, b'ghost', []) |
1601 | + add_commit(has_ghost, b'references', [b'ghost']) |
1602 | + add_commit(missing_ghost, b'references', [b'ghost']) |
1603 | + add_commit(has_ghost, b'tip', [b'references']) |
1604 | + missing_ghost.fetch(has_ghost, b'tip') |
1605 | # missing ghost now has tip and not ghost. |
1606 | - rev = missing_ghost.get_revision('tip') |
1607 | - inv = missing_ghost.get_inventory('tip') |
1608 | - self.assertRaises(errors.NoSuchRevision, |
1609 | - missing_ghost.get_revision, 'ghost') |
1610 | - self.assertRaises(errors.NoSuchRevision, |
1611 | - missing_ghost.get_inventory, 'ghost') |
1612 | + rev = missing_ghost.get_revision(b'tip') |
1613 | + inv = missing_ghost.get_inventory(b'tip') |
1614 | + self.assertRaises(errors.NoSuchRevision, |
1615 | + missing_ghost.get_revision, b'ghost') |
1616 | + self.assertRaises(errors.NoSuchRevision, |
1617 | + missing_ghost.get_inventory, b'ghost') |
1618 | |
1619 | def make_write_ready_repo(self): |
1620 | format = self.get_format() |
1621 | @@ -1012,10 +1012,10 @@ |
1622 | builder = self.make_branch_builder('source', format=self.get_format()) |
1623 | builder.start_series() |
1624 | builder.build_snapshot(None, [ |
1625 | - ('add', ('', 'root-id', 'directory', None))], |
1626 | + ('add', ('', b'root-id', 'directory', None))], |
1627 | revision_id=b'A-id') |
1628 | builder.build_snapshot( |
1629 | - ['A-id', 'ghost-id'], [], |
1630 | + [b'A-id', b'ghost-id'], [], |
1631 | revision_id=b'B-id', ) |
1632 | builder.finish_series() |
1633 | repo = self.make_repository('target', format=self.get_format()) |
1634 | |
1635 | === modified file 'breezy/tests/per_repository/test_repository.py' |
1636 | --- breezy/tests/per_repository/test_repository.py 2018-06-14 10:06:05 +0000 |
1637 | +++ breezy/tests/per_repository/test_repository.py 2018-06-21 08:27:55 +0000 |
1638 | @@ -277,7 +277,7 @@ |
1639 | # may only be shared in some circumstances. |
1640 | return |
1641 | # Check that we have a repository object. |
1642 | - made_repo.has_revision('foo') |
1643 | + made_repo.has_revision(b'foo') |
1644 | self.assertEqual(made_control, made_repo.controldir) |
1645 | self.assertTrue(made_repo.is_shared()) |
1646 | |
1647 | @@ -350,7 +350,7 @@ |
1648 | return |
1649 | result = made_control.clone(self.get_url('target')) |
1650 | # Check that we have a repository object. |
1651 | - made_repo.has_revision('foo') |
1652 | + made_repo.has_revision(b'foo') |
1653 | |
1654 | self.assertEqual(made_control, made_repo.controldir) |
1655 | self.assertTrue(result.open_repository().is_shared()) |
1656 | |
1657 | === modified file 'breezy/tests/per_repository_chk/test_supported.py' |
1658 | --- breezy/tests/per_repository_chk/test_supported.py 2018-03-07 20:29:23 +0000 |
1659 | +++ breezy/tests/per_repository_chk/test_supported.py 2018-06-21 08:27:55 +0000 |
1660 | @@ -171,7 +171,7 @@ |
1661 | builder.build_snapshot(None, [ |
1662 | ('add', ('', 'root-id', 'directory', None)), |
1663 | ('add', ('file', 'file-id', 'file', 'content\n'))], |
1664 | - revision_id='A-id') |
1665 | + revision_id=b'A-id') |
1666 | b = builder.get_branch() |
1667 | b.lock_read() |
1668 | self.addCleanup(b.unlock) |
1669 | @@ -216,17 +216,17 @@ |
1670 | # inventories. |
1671 | builder = self.make_branch_builder('simple-branch') |
1672 | builder.build_snapshot(None, [ |
1673 | - ('add', ('', 'root-id', 'directory', None)), |
1674 | - ('add', ('file', 'file-id', 'file', 'content\n'))], |
1675 | - revision_id='A-id') |
1676 | - builder.build_snapshot(None, [], revision_id='B-id') |
1677 | - builder.build_snapshot(None, [], revision_id='C-id') |
1678 | + ('add', ('', b'root-id', 'directory', None)), |
1679 | + ('add', ('file', b'file-id', 'file', b'content\n'))], |
1680 | + revision_id=b'A-id') |
1681 | + builder.build_snapshot(None, [], revision_id=b'B-id') |
1682 | + builder.build_snapshot(None, [], revision_id=b'C-id') |
1683 | b = builder.get_branch() |
1684 | b.lock_read() |
1685 | self.addCleanup(b.unlock) |
1686 | # check our setup: B-id and C-id should have identical chk root keys. |
1687 | - inv_b = b.repository.get_inventory('B-id') |
1688 | - inv_c = b.repository.get_inventory('C-id') |
1689 | + inv_b = b.repository.get_inventory(b'B-id') |
1690 | + inv_c = b.repository.get_inventory(b'C-id') |
1691 | if not isinstance(repo, RemoteRepository): |
1692 | # Remote repositories always return plain inventories |
1693 | self.assertEqual(inv_b.id_to_entry.key(), inv_c.id_to_entry.key()) |
1694 | @@ -240,10 +240,10 @@ |
1695 | src_repo = b.repository |
1696 | repo.inventories.insert_record_stream( |
1697 | src_repo.inventories.get_record_stream( |
1698 | - [('B-id',), ('C-id',)], 'unordered', True)) |
1699 | + [(b'B-id',), (b'C-id',)], 'unordered', True)) |
1700 | repo.revisions.insert_record_stream( |
1701 | src_repo.revisions.get_record_stream( |
1702 | - [('C-id',)], 'unordered', True)) |
1703 | + [(b'C-id',)], 'unordered', True)) |
1704 | # Make sure the presence of the missing data in a fallback does not |
1705 | # avoid the error. |
1706 | repo.add_fallback_repository(b.repository) |
1707 | @@ -267,8 +267,8 @@ |
1708 | self.addCleanup(src_repo.unlock) |
1709 | # Now, manually insert objects for a stacked repo with only revision |
1710 | # C-id, *except* drop the non-root chk records. |
1711 | - inv_b = src_repo.get_inventory('B-id') |
1712 | - inv_c = src_repo.get_inventory('C-id') |
1713 | + inv_b = src_repo.get_inventory(b'B-id') |
1714 | + inv_c = src_repo.get_inventory(b'C-id') |
1715 | chk_root_keys_only = [ |
1716 | inv_b.id_to_entry.key(), inv_b.parent_id_basename_to_file_id.key(), |
1717 | inv_c.id_to_entry.key(), inv_c.parent_id_basename_to_file_id.key()] |
1718 | @@ -286,10 +286,10 @@ |
1719 | src_repo.texts.keys(), 'unordered', True)) |
1720 | repo.inventories.insert_record_stream( |
1721 | src_repo.inventories.get_record_stream( |
1722 | - [('B-id',), ('C-id',)], 'unordered', True)) |
1723 | + [(b'B-id',), (b'C-id',)], 'unordered', True)) |
1724 | repo.revisions.insert_record_stream( |
1725 | src_repo.revisions.get_record_stream( |
1726 | - [('C-id',)], 'unordered', True)) |
1727 | + [(b'C-id',)], 'unordered', True)) |
1728 | # Make sure the presence of the missing data in a fallback does not |
1729 | # avoid the error. |
1730 | repo.add_fallback_repository(b.repository) |
1731 | @@ -315,7 +315,7 @@ |
1732 | # We need ('revisions', 'C-id'), ('inventories', 'C-id'), |
1733 | # ('inventories', 'B-id'), and the corresponding chk roots for those |
1734 | # inventories. |
1735 | - inv_c = b.repository.get_inventory('C-id') |
1736 | + inv_c = b.repository.get_inventory(b'C-id') |
1737 | chk_keys_for_c_only = [ |
1738 | inv_c.id_to_entry.key(), inv_c.parent_id_basename_to_file_id.key()] |
1739 | repo.lock_write() |
1740 | @@ -326,10 +326,10 @@ |
1741 | chk_keys_for_c_only, 'unordered', True)) |
1742 | repo.inventories.insert_record_stream( |
1743 | src_repo.inventories.get_record_stream( |
1744 | - [('B-id',), ('C-id',)], 'unordered', True)) |
1745 | + [(b'B-id',), (b'C-id',)], 'unordered', True)) |
1746 | repo.revisions.insert_record_stream( |
1747 | src_repo.revisions.get_record_stream( |
1748 | - [('C-id',)], 'unordered', True)) |
1749 | + [(b'C-id',)], 'unordered', True)) |
1750 | # Make sure the presence of the missing data in a fallback does not |
1751 | # avoid the error. |
1752 | repo.add_fallback_repository(b.repository) |
1753 | @@ -348,16 +348,17 @@ |
1754 | for char in 'abc': |
1755 | name = char * 10000 |
1756 | file_adds.append( |
1757 | - ('add', ('file-' + name, 'file-%s-id' % name, 'file', |
1758 | - 'content %s\n' % name))) |
1759 | + ('add', ('file-' + name, ('file-%s-id' % name).encode(), 'file', |
1760 | + ('content %s\n' % name).encode()))) |
1761 | file_modifies.append( |
1762 | - ('modify', ('file-' + name, 'new content %s\n' % name))) |
1763 | + ('modify', (('file-' + name).encode(), |
1764 | + ('new content %s\n' % name).encode()))) |
1765 | builder.build_snapshot(None, [ |
1766 | - ('add', ('', 'root-id', 'directory', None))] + |
1767 | + ('add', ('', b'root-id', 'directory', None))] + |
1768 | file_adds, |
1769 | - revision_id='A-id') |
1770 | - builder.build_snapshot(None, [], revision_id='B-id') |
1771 | - builder.build_snapshot(None, file_modifies, revision_id='C-id') |
1772 | + revision_id=b'A-id') |
1773 | + builder.build_snapshot(None, [], revision_id=b'B-id') |
1774 | + builder.build_snapshot(None, file_modifies, revision_id=b'C-id') |
1775 | return builder.get_branch() |
1776 | |
1777 | def test_missing_text_record(self): |
1778 | |
1779 | === modified file 'breezy/tests/per_repository_reference/test_commit_with_stacking.py' |
1780 | --- breezy/tests/per_repository_reference/test_commit_with_stacking.py 2018-02-18 15:21:06 +0000 |
1781 | +++ breezy/tests/per_repository_reference/test_commit_with_stacking.py 2018-06-21 08:27:55 +0000 |
1782 | @@ -95,7 +95,7 @@ |
1783 | stacked2_branch = base_tree.controldir.sprout('stacked2', |
1784 | stacked=True).open_branch() |
1785 | stacked2_branch.repository.fetch(stacked_only_repo, |
1786 | - revision_id='new-rev-id') |
1787 | + revision_id=b'new-rev-id') |
1788 | |
1789 | def test_merge_commit(self): |
1790 | base_tree, stacked_tree = self.make_stacked_target() |
1791 | |
1792 | === modified file 'breezy/tests/per_repository_reference/test_fetch.py' |
1793 | --- breezy/tests/per_repository_reference/test_fetch.py 2018-03-26 00:54:10 +0000 |
1794 | +++ breezy/tests/per_repository_reference/test_fetch.py 2018-06-21 08:27:55 +0000 |
1795 | @@ -87,7 +87,7 @@ |
1796 | transport = self.make_smart_server('server') |
1797 | transport.ensure_base() |
1798 | url = transport.abspath('') |
1799 | - stack_b = source_b.controldir.sprout(url + '/stack-on', revision_id='B-id') |
1800 | + stack_b = source_b.controldir.sprout(url + '/stack-on', revision_id=b'B-id') |
1801 | # self.make_branch only takes relative paths, so we do it the 'hard' |
1802 | # way |
1803 | target_transport = transport.clone('target') |
1804 | @@ -107,7 +107,7 @@ |
1805 | # revision_id versus not. If you supply revision_id, then you get a |
1806 | # PendingAncestryResult for the search, versus a SearchResult... |
1807 | final2_b = target_b.controldir.sprout('final2', |
1808 | - revision_id='C-id').open_branch() |
1809 | + revision_id=b'C-id').open_branch() |
1810 | self.assertEqual('C-id', final_b.last_revision()) |
1811 | |
1812 | def make_source_with_ghost_and_stacked_target(self): |
1813 | @@ -116,8 +116,8 @@ |
1814 | builder.build_snapshot(None, [ |
1815 | ('add', ('', 'root-id', 'directory', None)), |
1816 | ('add', ('file', 'file-id', 'file', 'content\n'))], |
1817 | - revision_id='A-id') |
1818 | - builder.build_snapshot(['A-id', 'ghost-id'], [], revision_id='B-id') |
1819 | + revision_id=b'A-id') |
1820 | + builder.build_snapshot(['A-id', 'ghost-id'], [], revision_id=b'B-id') |
1821 | builder.finish_series() |
1822 | source_b = builder.get_branch() |
1823 | source_b.lock_read() |
1824 | |
1825 | === modified file 'breezy/tests/per_repository_reference/test_get_record_stream.py' |
1826 | --- breezy/tests/per_repository_reference/test_get_record_stream.py 2018-03-07 20:29:23 +0000 |
1827 | +++ breezy/tests/per_repository_reference/test_get_record_stream.py 2018-06-21 08:27:55 +0000 |
1828 | @@ -46,39 +46,39 @@ |
1829 | # |
1830 | |
1831 | builder.build_snapshot(None, [ |
1832 | - ('add', ('', 'root-id', 'directory', None)), |
1833 | - ('add', ('file', 'f-id', 'file', 'initial content\n')), |
1834 | - ], revision_id='A') |
1835 | - builder.build_snapshot(['A'], [ |
1836 | - ('modify', ('file', 'initial content\n' |
1837 | - 'and B content\n')), |
1838 | - ], revision_id='B') |
1839 | - builder.build_snapshot(['A'], [ |
1840 | - ('modify', ('file', 'initial content\n' |
1841 | - 'and C content\n')), |
1842 | - ], revision_id='C') |
1843 | + ('add', ('', b'root-id', 'directory', None)), |
1844 | + ('add', ('file', b'f-id', 'file', b'initial content\n')), |
1845 | + ], revision_id=b'A') |
1846 | + builder.build_snapshot([b'A'], [ |
1847 | + ('modify', ('file', b'initial content\n' |
1848 | + b'and B content\n')), |
1849 | + ], revision_id=b'B') |
1850 | + builder.build_snapshot([b'A'], [ |
1851 | + ('modify', ('file', b'initial content\n' |
1852 | + b'and C content\n')), |
1853 | + ], revision_id=b'C') |
1854 | builder.build_snapshot(['B', 'C'], [ |
1855 | - ('modify', ('file', 'initial content\n' |
1856 | - 'and B content\n' |
1857 | - 'and C content\n')), |
1858 | - ], revision_id='D') |
1859 | - builder.build_snapshot(['C'], [ |
1860 | - ('modify', ('file', 'initial content\n' |
1861 | - 'and C content\n' |
1862 | - 'and E content\n')), |
1863 | - ], revision_id='E') |
1864 | - builder.build_snapshot(['D'], [ |
1865 | - ('modify', ('file', 'initial content\n' |
1866 | - 'and B content\n' |
1867 | - 'and C content\n' |
1868 | - 'and F content\n')), |
1869 | - ], revision_id='F') |
1870 | - builder.build_snapshot(['E', 'D'], [ |
1871 | - ('modify', ('file', 'initial content\n' |
1872 | - 'and B content\n' |
1873 | - 'and C content\n' |
1874 | - 'and E content\n')), |
1875 | - ], revision_id='G') |
1876 | + ('modify', ('file', b'initial content\n' |
1877 | + b'and B content\n' |
1878 | + b'and C content\n')), |
1879 | + ], revision_id=b'D') |
1880 | + builder.build_snapshot([b'C'], [ |
1881 | + ('modify', ('file', b'initial content\n' |
1882 | + b'and C content\n' |
1883 | + b'and E content\n')), |
1884 | + ], revision_id=b'E') |
1885 | + builder.build_snapshot([b'D'], [ |
1886 | + ('modify', ('file', b'initial content\n' |
1887 | + b'and B content\n' |
1888 | + b'and C content\n' |
1889 | + b'and F content\n')), |
1890 | + ], revision_id=b'F') |
1891 | + builder.build_snapshot([b'E', b'D'], [ |
1892 | + ('modify', ('file', b'initial content\n' |
1893 | + b'and B content\n' |
1894 | + b'and C content\n' |
1895 | + b'and E content\n')), |
1896 | + ], revision_id=b'G') |
1897 | builder.finish_series() |
1898 | self.all_repo = builder.get_branch().repository |
1899 | self.all_repo.lock_read() |
1900 | @@ -88,8 +88,8 @@ |
1901 | |
1902 | def make_simple_split(self): |
1903 | """Set up the repositories so that everything is in base except F""" |
1904 | - self.base_repo.fetch(self.all_repo, revision_id='G') |
1905 | - self.stacked_repo.fetch(self.all_repo, revision_id='F') |
1906 | + self.base_repo.fetch(self.all_repo, revision_id=b'G') |
1907 | + self.stacked_repo.fetch(self.all_repo, revision_id=b'F') |
1908 | |
1909 | def make_complex_split(self): |
1910 | """intermix the revisions so that base holds left stacked holds right. |
1911 | @@ -99,14 +99,14 @@ |
1912 | referring will hold |
1913 | C E G (only) |
1914 | """ |
1915 | - self.base_repo.fetch(self.all_repo, revision_id='B') |
1916 | - self.stacked_repo.fetch(self.all_repo, revision_id='C') |
1917 | - self.base_repo.fetch(self.all_repo, revision_id='F') |
1918 | - self.stacked_repo.fetch(self.all_repo, revision_id='G') |
1919 | + self.base_repo.fetch(self.all_repo, revision_id=b'B') |
1920 | + self.stacked_repo.fetch(self.all_repo, revision_id=b'C') |
1921 | + self.base_repo.fetch(self.all_repo, revision_id=b'F') |
1922 | + self.stacked_repo.fetch(self.all_repo, revision_id=b'G') |
1923 | |
1924 | def test_unordered_fetch_simple_split(self): |
1925 | self.make_simple_split() |
1926 | - keys = [('f-id', r) for r in 'ABCDF'] |
1927 | + keys = [(b'f-id', r) for r in 'ABCDF'] |
1928 | self.stacked_repo.lock_read() |
1929 | self.addCleanup(self.stacked_repo.unlock) |
1930 | stream = self.stacked_repo.texts.get_record_stream( |
1931 | @@ -121,7 +121,7 @@ |
1932 | |
1933 | def test_unordered_fetch_complex_split(self): |
1934 | self.make_complex_split() |
1935 | - keys = [('f-id', r) for r in 'ABCDEG'] |
1936 | + keys = [(b'f-id', r) for r in 'ABCDEG'] |
1937 | self.stacked_repo.lock_read() |
1938 | self.addCleanup(self.stacked_repo.unlock) |
1939 | stream = self.stacked_repo.texts.get_record_stream( |
1940 | @@ -139,10 +139,10 @@ |
1941 | # Topological ordering allows B & C and D & E to be returned with |
1942 | # either one first, so the required ordering is: |
1943 | # [A (B C) (D E) G] |
1944 | - keys = [('f-id', r) for r in 'ABCDEG'] |
1945 | - alt_1 = [('f-id', r) for r in 'ACBDEG'] |
1946 | - alt_2 = [('f-id', r) for r in 'ABCEDG'] |
1947 | - alt_3 = [('f-id', r) for r in 'ACBEDG'] |
1948 | + keys = [(b'f-id', r) for r in 'ABCDEG'] |
1949 | + alt_1 = [(b'f-id', r) for r in 'ACBDEG'] |
1950 | + alt_2 = [(b'f-id', r) for r in 'ABCEDG'] |
1951 | + alt_3 = [(b'f-id', r) for r in 'ACBEDG'] |
1952 | self.stacked_repo.lock_read() |
1953 | self.addCleanup(self.stacked_repo.unlock) |
1954 | stream = self.stacked_repo.texts.get_record_stream( |
1955 | @@ -162,8 +162,8 @@ |
1956 | # Topological ordering allows B & C and D & E to be returned with |
1957 | # either one first, so the required ordering is: |
1958 | # [A (B C) D F] |
1959 | - keys = [('f-id', r) for r in 'ABCDF'] |
1960 | - alt_1 = [('f-id', r) for r in 'ACBDF'] |
1961 | + keys = [(b'f-id', r) for r in 'ABCDF'] |
1962 | + alt_1 = [(b'f-id', r) for r in 'ACBDF'] |
1963 | self.stacked_repo.lock_read() |
1964 | self.addCleanup(self.stacked_repo.unlock) |
1965 | stream = self.stacked_repo.texts.get_record_stream( |
1966 | @@ -180,10 +180,10 @@ |
1967 | # Topological ordering allows B & C and D & E to be returned with |
1968 | # either one first, so the required ordering is: |
1969 | # [A (B C) (D E) G] |
1970 | - keys = [('f-id', r) for r in 'ABCDEG'] |
1971 | - alt_1 = [('f-id', r) for r in 'ACBDEG'] |
1972 | - alt_2 = [('f-id', r) for r in 'ABCEDG'] |
1973 | - alt_3 = [('f-id', r) for r in 'ACBEDG'] |
1974 | + keys = [(b'f-id', r) for r in 'ABCDEG'] |
1975 | + alt_1 = [(b'f-id', r) for r in 'ACBDEG'] |
1976 | + alt_2 = [(b'f-id', r) for r in 'ABCEDG'] |
1977 | + alt_3 = [(b'f-id', r) for r in 'ACBEDG'] |
1978 | self.stacked_repo.lock_read() |
1979 | self.addCleanup(self.stacked_repo.unlock) |
1980 | stream = self.stacked_repo.texts.get_record_stream( |
1981 | |
1982 | === modified file 'breezy/tests/per_repository_reference/test_graph.py' |
1983 | --- breezy/tests/per_repository_reference/test_graph.py 2017-11-16 00:39:04 +0000 |
1984 | +++ breezy/tests/per_repository_reference/test_graph.py 2018-06-21 08:27:55 +0000 |
1985 | @@ -58,12 +58,12 @@ |
1986 | builder.start_series() |
1987 | builder.build_snapshot(None, [ |
1988 | ('add', ('', 'directory', 'root-id', None))], |
1989 | - revision_id='A') |
1990 | - builder.build_snapshot(['A'], [], revision_id='B') |
1991 | - builder.build_snapshot(['B'], [], revision_id='C') |
1992 | - builder.build_snapshot(['C'], [], revision_id='D') |
1993 | - builder.build_snapshot(['D'], [], revision_id='E') |
1994 | - builder.build_snapshot(['E'], [], revision_id='F') |
1995 | + revision_id=b'A') |
1996 | + builder.build_snapshot(['A'], [], revision_id=b'B') |
1997 | + builder.build_snapshot(['B'], [], revision_id=b'C') |
1998 | + builder.build_snapshot(['C'], [], revision_id=b'D') |
1999 | + builder.build_snapshot(['D'], [], revision_id=b'E') |
2000 | + builder.build_snapshot(['E'], [], revision_id=b'F') |
2001 | source_b = builder.get_branch() |
2002 | master_b = self.make_branch('master') |
2003 | master_b.pull(source_b, stop_revision='E') |
2004 | |
2005 | === modified file 'breezy/tests/per_repository_reference/test_unlock.py' |
2006 | --- breezy/tests/per_repository_reference/test_unlock.py 2018-03-07 20:29:23 +0000 |
2007 | +++ breezy/tests/per_repository_reference/test_unlock.py 2018-06-21 08:27:55 +0000 |
2008 | @@ -37,13 +37,13 @@ |
2009 | builder.build_snapshot(None, [ |
2010 | ('add', ('', 'root-id', 'directory', None)), |
2011 | ('add', ('file', 'file-id', 'file', 'contents\n'))], |
2012 | - revision_id='A-id') |
2013 | + revision_id=b'A-id') |
2014 | builder.build_snapshot(['A-id'], [ |
2015 | ('modify', ('file', 'new-content\n'))], |
2016 | - revision_id='B-id') |
2017 | + revision_id=b'B-id') |
2018 | builder.build_snapshot(['B-id'], [ |
2019 | ('modify', ('file', 'yet more content\n'))], |
2020 | - revision_id='C-id') |
2021 | + revision_id=b'C-id') |
2022 | builder.finish_series() |
2023 | source_b = builder.get_branch() |
2024 | source_b.lock_read() |
2025 | |
2026 | === modified file 'breezy/tests/per_repository_vf/helpers.py' |
2027 | --- breezy/tests/per_repository_vf/helpers.py 2017-06-10 02:09:46 +0000 |
2028 | +++ breezy/tests/per_repository_vf/helpers.py 2018-06-21 08:27:55 +0000 |
2029 | @@ -53,7 +53,7 @@ |
2030 | repo.lock_write() |
2031 | repo.start_write_group() |
2032 | try: |
2033 | - inv = inventory.Inventory(revision_id='revision-id') |
2034 | + inv = inventory.Inventory(revision_id=b'revision-id') |
2035 | inv.root.revision = 'revision-id' |
2036 | inv_sha1 = repo.add_inventory('revision-id', inv, []) |
2037 | if repo.supports_rich_root(): |
2038 | |
2039 | === modified file 'breezy/tests/per_repository_vf/test_fetch.py' |
2040 | --- breezy/tests/per_repository_vf/test_fetch.py 2017-11-16 00:39:04 +0000 |
2041 | +++ breezy/tests/per_repository_vf/test_fetch.py 2018-06-21 08:27:55 +0000 |
2042 | @@ -42,7 +42,7 @@ |
2043 | builder.start_series() |
2044 | builder.build_snapshot(['ghost'], |
2045 | [('add', ('', 'ROOT_ID', 'directory', ''))], |
2046 | - allow_leftmost_as_ghost=True, revision_id='tip') |
2047 | + allow_leftmost_as_ghost=True, revision_id=b'tip') |
2048 | builder.finish_series() |
2049 | b = builder.get_branch() |
2050 | b.lock_read() |
2051 | |
2052 | === modified file 'breezy/tests/per_repository_vf/test_fileid_involved.py' |
2053 | --- breezy/tests/per_repository_vf/test_fileid_involved.py 2018-05-13 02:18:13 +0000 |
2054 | +++ breezy/tests/per_repository_vf/test_fileid_involved.py 2018-06-21 08:27:55 +0000 |
2055 | @@ -46,9 +46,9 @@ |
2056 | builder.build_snapshot(None, [ |
2057 | ('add', ('', 'root-id', 'directory', None)), |
2058 | ('add', ('a', 'a-file-id', 'file', 'some content\n'))], |
2059 | - revision_id='A-id') |
2060 | + revision_id=b'A-id') |
2061 | b = builder.get_branch() |
2062 | - old_rt = b.repository.revision_tree('A-id') |
2063 | + old_rt = b.repository.revision_tree(b'A-id') |
2064 | new_inv = inventory.mutable_inventory_from_tree(old_rt) |
2065 | new_inv.revision_id = 'B-id' |
2066 | new_inv.get_entry('a-file-id').revision = 'ghost-id' |
2067 | @@ -98,13 +98,13 @@ |
2068 | builder.build_snapshot(None, [ |
2069 | ('add', ('', 'root-id', 'directory', None)), |
2070 | ('add', ('file', 'file-id', 'file', 'contents\n'))], |
2071 | - revision_id='A-id') |
2072 | + revision_id=b'A-id') |
2073 | builder.build_snapshot(['A-id'], [ |
2074 | ('modify', ('file', 'new-content\n'))], |
2075 | - revision_id='B-id') |
2076 | + revision_id=b'B-id') |
2077 | builder.build_snapshot(['B-id'], [ |
2078 | ('modify', ('file', 'yet more content\n'))], |
2079 | - revision_id='C-id') |
2080 | + revision_id=b'C-id') |
2081 | builder.finish_series() |
2082 | source_b = builder.get_branch() |
2083 | source_b.lock_read() |
2084 | |
2085 | === modified file 'breezy/tests/per_repository_vf/test_merge_directive.py' |
2086 | --- breezy/tests/per_repository_vf/test_merge_directive.py 2018-05-13 02:18:13 +0000 |
2087 | +++ breezy/tests/per_repository_vf/test_merge_directive.py 2018-06-21 08:27:55 +0000 |
2088 | @@ -75,7 +75,7 @@ |
2089 | target_branch.base) |
2090 | chk_map.clear_cache() |
2091 | directive.install_revisions(target_branch.repository) |
2092 | - rt = target_branch.repository.revision_tree('B') |
2093 | + rt = target_branch.repository.revision_tree(b'B') |
2094 | rt.lock_read() |
2095 | self.assertEqualDiff(b'new content\n', rt.get_file_text('f', b'f-id')) |
2096 | rt.unlock() |
2097 | |
2098 | === modified file 'breezy/tests/per_repository_vf/test_reconcile.py' |
2099 | --- breezy/tests/per_repository_vf/test_reconcile.py 2018-02-18 15:21:06 +0000 |
2100 | +++ breezy/tests/per_repository_vf/test_reconcile.py 2018-06-21 08:27:55 +0000 |
2101 | @@ -94,7 +94,7 @@ |
2102 | repo = self.make_repository('inventory_without_revision') |
2103 | repo.lock_write() |
2104 | repo.start_write_group() |
2105 | - inv = Inventory(revision_id='missing') |
2106 | + inv = Inventory(revision_id=b'missing') |
2107 | inv.root.revision = 'missing' |
2108 | repo.add_inventory('missing', inv, []) |
2109 | repo.commit_write_group() |
2110 | @@ -198,7 +198,7 @@ |
2111 | **kwargs): |
2112 | # actual low level test. |
2113 | repo = aBzrDir.open_repository() |
2114 | - if not repo.has_revision('missing'): |
2115 | + if not repo.has_revision(b'missing'): |
2116 | # the repo handles ghosts without corruption, so reconcile has |
2117 | # nothing to do here. Specifically, this test has the inventory |
2118 | # 'missing' present and the revision 'missing' missing, so clearly |
2119 | @@ -218,7 +218,7 @@ |
2120 | self.check_missing_was_removed(repo) |
2121 | # and the parent list for 'references_missing' should have that |
2122 | # revision a ghost now. |
2123 | - self.assertFalse(repo.has_revision('missing')) |
2124 | + self.assertFalse(repo.has_revision(b'missing')) |
2125 | |
2126 | def check_missing_was_removed(self, repo): |
2127 | if repo._reconcile_backsup_inventory: |
2128 | @@ -266,18 +266,18 @@ |
2129 | self.assertEqual(0, reconciler.garbage_inventories) |
2130 | # now the current inventory should still have 'ghost' |
2131 | repo = d.open_repository() |
2132 | - repo.get_inventory('ghost') |
2133 | - self.assertThat(['ghost', 'the_ghost'], MatchesAncestry(repo, 'ghost')) |
2134 | + repo.get_inventory(b'ghost') |
2135 | + self.assertThat([b'ghost', b'the_ghost'], MatchesAncestry(repo, b'ghost')) |
2136 | |
2137 | def test_reweave_inventory_fixes_ancestryfor_a_present_ghost(self): |
2138 | d = BzrDir.open(self.get_url('inventory_ghost_present')) |
2139 | repo = d.open_repository() |
2140 | - m = MatchesAncestry(repo, 'ghost') |
2141 | - if m.match(['the_ghost', 'ghost']) is None: |
2142 | + m = MatchesAncestry(repo, b'ghost') |
2143 | + if m.match([b'the_ghost', b'ghost']) is None: |
2144 | # the repo handles ghosts without corruption, so reconcile has |
2145 | # nothing to do |
2146 | return |
2147 | - self.assertThat(['ghost'], m) |
2148 | + self.assertThat([b'ghost'], m) |
2149 | reconciler = repo.reconcile() |
2150 | # this is a data corrupting error, so a normal reconcile should fix it. |
2151 | # one inconsistent parents should have been found : the |
2152 | @@ -287,35 +287,35 @@ |
2153 | self.assertEqual(0, reconciler.garbage_inventories) |
2154 | # now the current inventory should still have 'ghost' |
2155 | repo = d.open_repository() |
2156 | - repo.get_inventory('ghost') |
2157 | - repo.get_inventory('the_ghost') |
2158 | - self.assertThat(['the_ghost', 'ghost'], |
2159 | - MatchesAncestry(repo, 'ghost')) |
2160 | - self.assertThat(['the_ghost'], |
2161 | - MatchesAncestry(repo, 'the_ghost')) |
2162 | + repo.get_inventory(b'ghost') |
2163 | + repo.get_inventory(b'the_ghost') |
2164 | + self.assertThat([b'the_ghost', b'ghost'], |
2165 | + MatchesAncestry(repo, b'ghost')) |
2166 | + self.assertThat([b'the_ghost'], |
2167 | + MatchesAncestry(repo, b'the_ghost')) |
2168 | |
2169 | def test_text_from_ghost_revision(self): |
2170 | repo = self.make_repository('text-from-ghost') |
2171 | - inv = Inventory(revision_id='final-revid') |
2172 | - inv.root.revision = 'root-revid' |
2173 | - ie = inv.add_path('bla', 'file', 'myfileid') |
2174 | - ie.revision = 'ghostrevid' |
2175 | + inv = Inventory(revision_id=b'final-revid') |
2176 | + inv.root.revision = b'root-revid' |
2177 | + ie = inv.add_path('bla', 'file', b'myfileid') |
2178 | + ie.revision = b'ghostrevid' |
2179 | ie.text_size = 42 |
2180 | - ie.text_sha1 = "bee68c8acd989f5f1765b4660695275948bf5c00" |
2181 | + ie.text_sha1 = b"bee68c8acd989f5f1765b4660695275948bf5c00" |
2182 | rev = breezy.revision.Revision(timestamp=0, |
2183 | timezone=None, |
2184 | committer="Foo Bar <foo@example.com>", |
2185 | message="Message", |
2186 | - revision_id='final-revid') |
2187 | + revision_id=b'final-revid') |
2188 | repo.lock_write() |
2189 | try: |
2190 | repo.start_write_group() |
2191 | try: |
2192 | - repo.add_revision('final-revid', rev, inv) |
2193 | + repo.add_revision(b'final-revid', rev, inv) |
2194 | try: |
2195 | - repo.texts.add_lines(('myfileid', 'ghostrevid'), |
2196 | - (('myfileid', 'ghost-text-parent'),), |
2197 | - ["line1\n", "line2\n"]) |
2198 | + repo.texts.add_lines((b'myfileid', b'ghostrevid'), |
2199 | + ((b'myfileid', b'ghost-text-parent'),), |
2200 | + [b"line1\n", b"line2\n"]) |
2201 | except errors.RevisionNotPresent: |
2202 | raise TestSkipped("text ghost parents not supported") |
2203 | if repo.supports_rich_root(): |
2204 | @@ -370,7 +370,7 @@ |
2205 | repo = self.first_tree.branch.repository |
2206 | repo.lock_write() |
2207 | repo.start_write_group() |
2208 | - inv = Inventory(revision_id='wrong-first-parent') |
2209 | + inv = Inventory(revision_id=b'wrong-first-parent') |
2210 | inv.root.revision = 'wrong-first-parent' |
2211 | if repo.supports_rich_root(): |
2212 | root_id = inv.root.file_id |
2213 | @@ -381,7 +381,7 @@ |
2214 | committer="Foo Bar <foo@example.com>", |
2215 | message="Message", |
2216 | inventory_sha1=sha1, |
2217 | - revision_id='wrong-first-parent') |
2218 | + revision_id=b'wrong-first-parent') |
2219 | rev.parent_ids = ['1', '2'] |
2220 | repo.add_revision('wrong-first-parent', rev) |
2221 | repo.commit_write_group() |
2222 | @@ -391,7 +391,7 @@ |
2223 | repo = repo_secondary |
2224 | repo.lock_write() |
2225 | repo.start_write_group() |
2226 | - inv = Inventory(revision_id='wrong-secondary-parent') |
2227 | + inv = Inventory(revision_id=b'wrong-secondary-parent') |
2228 | inv.root.revision = 'wrong-secondary-parent' |
2229 | if repo.supports_rich_root(): |
2230 | root_id = inv.root.file_id |
2231 | @@ -402,7 +402,7 @@ |
2232 | committer="Foo Bar <foo@example.com>", |
2233 | message="Message", |
2234 | inventory_sha1=sha1, |
2235 | - revision_id='wrong-secondary-parent') |
2236 | + revision_id=b'wrong-secondary-parent') |
2237 | rev.parent_ids = ['1', '2', '3'] |
2238 | repo.add_revision('wrong-secondary-parent', rev) |
2239 | repo.commit_write_group() |
2240 | |
2241 | === modified file 'breezy/tests/per_repository_vf/test_repository.py' |
2242 | --- breezy/tests/per_repository_vf/test_repository.py 2018-02-18 15:21:06 +0000 |
2243 | +++ breezy/tests/per_repository_vf/test_repository.py 2018-06-21 08:27:55 +0000 |
2244 | @@ -144,7 +144,7 @@ |
2245 | self.assertEqual(repo._serializer.format_num, format) |
2246 | |
2247 | def test_add_revision_inventory_sha1(self): |
2248 | - inv = inventory.Inventory(revision_id='A') |
2249 | + inv = inventory.Inventory(revision_id=b'A') |
2250 | inv.root.revision = 'A' |
2251 | inv.root.file_id = 'fixed-root' |
2252 | # Insert the inventory on its own to an identical repository, to get |
2253 | @@ -152,7 +152,7 @@ |
2254 | reference_repo = self.make_repository('reference_repo') |
2255 | reference_repo.lock_write() |
2256 | reference_repo.start_write_group() |
2257 | - inv_sha1 = reference_repo.add_inventory('A', inv, []) |
2258 | + inv_sha1 = reference_repo.add_inventory(b'A', inv, []) |
2259 | reference_repo.abort_write_group() |
2260 | reference_repo.unlock() |
2261 | # Now insert a revision with this inventory, and it should get the same |
2262 | @@ -162,13 +162,13 @@ |
2263 | repo.start_write_group() |
2264 | root_id = inv.root.file_id |
2265 | repo.texts.add_lines(('fixed-root', 'A'), [], []) |
2266 | - repo.add_revision('A', _mod_revision.Revision( |
2267 | - 'A', committer='B', timestamp=0, |
2268 | + repo.add_revision(b'A', _mod_revision.Revision( |
2269 | + b'A', committer='B', timestamp=0, |
2270 | timezone=0, message='C'), inv=inv) |
2271 | repo.commit_write_group() |
2272 | repo.unlock() |
2273 | repo.lock_read() |
2274 | - self.assertEqual(inv_sha1, repo.get_revision('A').inventory_sha1) |
2275 | + self.assertEqual(inv_sha1, repo.get_revision(b'A').inventory_sha1) |
2276 | repo.unlock() |
2277 | |
2278 | def test_install_revisions(self): |
2279 | @@ -183,14 +183,14 @@ |
2280 | repo.lock_read() |
2281 | self.addCleanup(repo.unlock) |
2282 | repo2 = self.make_repository('repo2') |
2283 | - revision = repo.get_revision('A') |
2284 | - tree = repo.revision_tree('A') |
2285 | - signature = repo.get_signature_text('A') |
2286 | + revision = repo.get_revision(b'A') |
2287 | + tree = repo.revision_tree(b'A') |
2288 | + signature = repo.get_signature_text(b'A') |
2289 | repo2.lock_write() |
2290 | self.addCleanup(repo2.unlock) |
2291 | vf_repository.install_revisions(repo2, [(revision, tree, signature)]) |
2292 | - self.assertEqual(revision, repo2.get_revision('A')) |
2293 | - self.assertEqual(signature, repo2.get_signature_text('A')) |
2294 | + self.assertEqual(revision, repo2.get_revision(b'A')) |
2295 | + self.assertEqual(signature, repo2.get_signature_text(b'A')) |
2296 | |
2297 | def test_attribute_text_store(self): |
2298 | """Test the existence of the texts attribute.""" |
2299 | @@ -216,17 +216,17 @@ |
2300 | # Make a repo with one revision and one versioned file. |
2301 | tree = self.make_branch_and_tree('t') |
2302 | self.build_tree(['t/foo']) |
2303 | - tree.add('foo', 'file1') |
2304 | + tree.add('foo', b'file1') |
2305 | tree.commit('message', rev_id=b'rev_id') |
2306 | repo = tree.branch.repository |
2307 | repo.lock_write() |
2308 | repo.start_write_group() |
2309 | try: |
2310 | - repo.sign_revision('rev_id', gpg.LoopbackGPGStrategy(None)) |
2311 | + repo.sign_revision(b'rev_id', gpg.LoopbackGPGStrategy(None)) |
2312 | except errors.UnsupportedOperation: |
2313 | signature_texts = [] |
2314 | else: |
2315 | - signature_texts = ['rev_id'] |
2316 | + signature_texts = [b'rev_id'] |
2317 | repo.commit_write_group() |
2318 | repo.unlock() |
2319 | repo.lock_read() |
2320 | @@ -239,11 +239,11 @@ |
2321 | # * signatures |
2322 | # * revisions |
2323 | expected_item_keys = [ |
2324 | - ('file', 'file1', ['rev_id']), |
2325 | - ('inventory', None, ['rev_id']), |
2326 | - ('signatures', None, signature_texts), |
2327 | - ('revisions', None, ['rev_id'])] |
2328 | - item_keys = list(repo.item_keys_introduced_by(['rev_id'])) |
2329 | + (b'file', b'file1', [b'rev_id']), |
2330 | + (b'inventory', None, [b'rev_id']), |
2331 | + (b'signatures', None, signature_texts), |
2332 | + (b'revisions', None, [b'rev_id'])] |
2333 | + item_keys = list(repo.item_keys_introduced_by([b'rev_id'])) |
2334 | item_keys = [ |
2335 | (kind, file_id, list(versions)) |
2336 | for (kind, file_id, versions) in item_keys] |
2337 | @@ -254,8 +254,8 @@ |
2338 | # expected_record_names. |
2339 | # Note that the file keys can be in any order, so this test is |
2340 | # written to allow that. |
2341 | - inv = repo.get_inventory('rev_id') |
2342 | - root_item_key = ('file', inv.root.file_id, ['rev_id']) |
2343 | + inv = repo.get_inventory(b'rev_id') |
2344 | + root_item_key = (b'file', inv.root.file_id, [b'rev_id']) |
2345 | self.assertTrue(root_item_key in item_keys) |
2346 | item_keys.remove(root_item_key) |
2347 | |
2348 | @@ -419,7 +419,7 @@ |
2349 | sha1 = repo.add_inventory('ghost', inv, []) |
2350 | rev = _mod_revision.Revision( |
2351 | timestamp=0, timezone=None, committer="Foo Bar <foo@example.com>", |
2352 | - message="Message", inventory_sha1=sha1, revision_id='ghost') |
2353 | + message="Message", inventory_sha1=sha1, revision_id=b'ghost') |
2354 | rev.parent_ids = ['the_ghost'] |
2355 | try: |
2356 | repo.add_revision('ghost', rev) |
2357 | @@ -435,7 +435,7 @@ |
2358 | sha1 = repo.add_inventory('the_ghost', inv, []) |
2359 | rev = _mod_revision.Revision( |
2360 | timestamp=0, timezone=None, committer="Foo Bar <foo@example.com>", |
2361 | - message="Message", inventory_sha1=sha1, revision_id='the_ghost') |
2362 | + message="Message", inventory_sha1=sha1, revision_id=b'the_ghost') |
2363 | rev.parent_ids = [] |
2364 | repo.add_revision('the_ghost', rev) |
2365 | # check its setup usefully |
2366 | |
2367 | === modified file 'breezy/tests/per_repository_vf/test_write_group.py' |
2368 | --- breezy/tests/per_repository_vf/test_write_group.py 2018-06-14 10:06:05 +0000 |
2369 | +++ breezy/tests/per_repository_vf/test_write_group.py 2018-06-21 08:27:55 +0000 |
2370 | @@ -59,7 +59,7 @@ |
2371 | tree = self.make_branch_and_memory_tree('branch') |
2372 | trunk_repo.lock_read() |
2373 | self.addCleanup(trunk_repo.unlock) |
2374 | - tree.branch.repository.fetch(trunk_repo, revision_id='rev-1') |
2375 | + tree.branch.repository.fetch(trunk_repo, revision_id=b'rev-1') |
2376 | tree.set_parent_ids(['rev-1']) |
2377 | return tree |
2378 | |
2379 | @@ -193,13 +193,13 @@ |
2380 | self.assertEqual(set(), |
2381 | repo.inventories.get_missing_compression_parent_keys()) |
2382 | self.assertEqual( |
2383 | - {('inventories', b'rev-1')}, |
2384 | + {(b'inventories', b'rev-1')}, |
2385 | repo.get_missing_parent_inventories()) |
2386 | # Resuming the write group does not affect |
2387 | # get_missing_parent_inventories. |
2388 | reopened_repo = self.reopen_repo_and_resume_write_group(repo) |
2389 | self.assertEqual( |
2390 | - {('inventories', b'rev-1')}, |
2391 | + {(b'inventories', b'rev-1')}, |
2392 | reopened_repo.get_missing_parent_inventories()) |
2393 | # Adding the parent inventory satisfies get_missing_parent_inventories. |
2394 | reopened_repo.inventories.insert_record_stream( |
2395 | @@ -211,10 +211,10 @@ |
2396 | |
2397 | def test_get_missing_parent_inventories_check(self): |
2398 | builder = self.make_branch_builder('test') |
2399 | - builder.build_snapshot(['ghost-parent-id'], [ |
2400 | - ('add', ('', 'root-id', 'directory', None)), |
2401 | - ('add', ('file', 'file-id', 'file', 'content\n'))], |
2402 | - allow_leftmost_as_ghost=True, revision_id='A-id') |
2403 | + builder.build_snapshot([b'ghost-parent-id'], [ |
2404 | + ('add', ('', b'root-id', 'directory', None)), |
2405 | + ('add', ('file', b'file-id', 'file', b'content\n'))], |
2406 | + allow_leftmost_as_ghost=True, revision_id=b'A-id') |
2407 | b = builder.get_branch() |
2408 | b.lock_read() |
2409 | self.addCleanup(b.unlock) |
2410 | @@ -224,17 +224,17 @@ |
2411 | repo.start_write_group() |
2412 | self.addCleanup(repo.abort_write_group) |
2413 | # Now, add the objects manually |
2414 | - text_keys = [('file-id', 'A-id')] |
2415 | + text_keys = [(b'file-id', b'A-id')] |
2416 | if repo.supports_rich_root(): |
2417 | - text_keys.append(('root-id', 'A-id')) |
2418 | + text_keys.append((b'root-id', b'A-id')) |
2419 | # Directly add the texts, inventory, and revision object for 'A-id' |
2420 | repo.texts.insert_record_stream(b.repository.texts.get_record_stream( |
2421 | text_keys, 'unordered', True)) |
2422 | - repo.add_revision('A-id', b.repository.get_revision('A-id'), |
2423 | - b.repository.get_inventory('A-id')) |
2424 | + repo.add_revision(b'A-id', b.repository.get_revision(b'A-id'), |
2425 | + b.repository.get_inventory(b'A-id')) |
2426 | get_missing = repo.get_missing_parent_inventories |
2427 | if repo._format.supports_external_lookups: |
2428 | - self.assertEqual({('inventories', 'ghost-parent-id')}, |
2429 | + self.assertEqual({('inventories', b'ghost-parent-id')}, |
2430 | get_missing(check_for_missing_texts=False)) |
2431 | self.assertEqual(set(), get_missing(check_for_missing_texts=True)) |
2432 | self.assertEqual(set(), get_missing()) |
2433 | |
2434 | === modified file 'breezy/tests/per_workingtree/test_pull.py' |
2435 | --- breezy/tests/per_workingtree/test_pull.py 2018-03-26 00:54:10 +0000 |
2436 | +++ breezy/tests/per_workingtree/test_pull.py 2018-06-21 08:27:55 +0000 |
2437 | @@ -84,14 +84,14 @@ |
2438 | # Create an empty trunk |
2439 | builder.build_snapshot(None, [ |
2440 | ('add', ('', 'root-id', 'directory', ''))], |
2441 | - revision_id='1') |
2442 | + revision_id=b'1') |
2443 | builder.build_snapshot(['1'], [ |
2444 | ('add', ('dir', 'dir-id', 'directory', '')), |
2445 | ('add', ('file', 'file-id', 'file', 'trunk content\n')),], |
2446 | - revision_id='2') |
2447 | + revision_id=b'2') |
2448 | builder.build_snapshot(['2'], [ |
2449 | ('unversion', 'dir'),], |
2450 | - revision_id='3') |
2451 | + revision_id=b'3') |
2452 | builder.finish_series() |
2453 | return builder.get_branch() |
2454 | |
2455 | @@ -101,7 +101,7 @@ |
2456 | '%r does not support missing parent conflicts' % |
2457 | self.workingtree_format) |
2458 | trunk = self.make_branch_deleting_dir('trunk') |
2459 | - work = trunk.controldir.sprout('work', revision_id='2').open_workingtree() |
2460 | + work = trunk.controldir.sprout('work', revision_id=b'2').open_workingtree() |
2461 | work.branch.get_config_stack().set( |
2462 | 'transform.orphan_policy', 'move') |
2463 | # Add some unversioned files in dir |
2464 | |
2465 | === modified file 'breezy/tests/test_annotate.py' |
2466 | --- breezy/tests/test_annotate.py 2018-03-26 00:54:10 +0000 |
2467 | +++ breezy/tests/test_annotate.py 2018-06-21 08:27:55 +0000 |
2468 | @@ -183,19 +183,19 @@ |
2469 | ('add', ('', 'root-id', 'directory', None)), |
2470 | ('add', ('a', 'a-id', 'file', 'first\n')), |
2471 | ], timestamp=1166046000.00, timezone=0, committer="joe@foo.com", |
2472 | - revision_id='rev-1') |
2473 | + revision_id=b'rev-1') |
2474 | builder.build_snapshot(['rev-1'], [ |
2475 | ('modify', ('a', 'first\nsecond\n')), |
2476 | ], timestamp=1166046001.00, timezone=0, committer="joe@foo.com", |
2477 | - revision_id='rev-2') |
2478 | + revision_id=b'rev-2') |
2479 | builder.build_snapshot(['rev-1'], [ |
2480 | ('modify', ('a', 'first\nthird\n')), |
2481 | ], timestamp=1166046002.00, timezone=0, committer="barry@foo.com", |
2482 | - revision_id='rev-1_1_1') |
2483 | + revision_id=b'rev-1_1_1') |
2484 | builder.build_snapshot(['rev-2', 'rev-1_1_1'], [ |
2485 | ('modify', ('a', 'first\nsecond\nthird\n')), |
2486 | ], timestamp=1166046003.00, timezone=0, committer="sal@foo.com", |
2487 | - revision_id='rev-3') |
2488 | + revision_id=b'rev-3') |
2489 | return builder |
2490 | |
2491 | def create_deeply_merged_trees(self): |
2492 | @@ -222,27 +222,27 @@ |
2493 | rev-6 |
2494 | """ |
2495 | builder = self.create_merged_trees() |
2496 | - builder.build_snapshot(['rev-1_1_1'], [], revision_id='rev-1_1_2') |
2497 | - builder.build_snapshot(['rev-3', 'rev-1_1_2'], [], revision_id='rev-4') |
2498 | + builder.build_snapshot(['rev-1_1_1'], [], revision_id=b'rev-1_1_2') |
2499 | + builder.build_snapshot(['rev-3', 'rev-1_1_2'], [], revision_id=b'rev-4') |
2500 | builder.build_snapshot(['rev-1_1_1'], [ |
2501 | ('modify', ('a', 'first\nthird\nfourth\n')), |
2502 | ], timestamp=1166046003.00, timezone=0, committer="jerry@foo.com", |
2503 | - revision_id='rev-1_2_1') |
2504 | + revision_id=b'rev-1_2_1') |
2505 | builder.build_snapshot(['rev-1_2_1'], [], |
2506 | timestamp=1166046004.00, timezone=0, committer="jerry@foo.com", |
2507 | - revision_id='rev-1_2_2') |
2508 | + revision_id=b'rev-1_2_2') |
2509 | builder.build_snapshot(['rev-4', 'rev-1_2_2'], [ |
2510 | ('modify', ('a', 'first\nsecond\nthird\nfourth\n')), |
2511 | ], timestamp=1166046004.00, timezone=0, committer="jerry@foo.com", |
2512 | - revision_id='rev-5') |
2513 | + revision_id=b'rev-5') |
2514 | builder.build_snapshot(['rev-1_2_1'], [ |
2515 | ('modify', ('a', 'first\nthird\nfourth\nfifth\nsixth\n')), |
2516 | ], timestamp=1166046005.00, timezone=0, committer="george@foo.com", |
2517 | - revision_id='rev-1_3_1') |
2518 | + revision_id=b'rev-1_3_1') |
2519 | builder.build_snapshot(['rev-5', 'rev-1_3_1'], [ |
2520 | ('modify', ('a', |
2521 | 'first\nsecond\nthird\nfourth\nfifth\nsixth\n')), |
2522 | - ], revision_id='rev-6') |
2523 | + ], revision_id=b'rev-6') |
2524 | return builder |
2525 | |
2526 | def create_duplicate_lines_tree(self): |
2527 | @@ -258,22 +258,22 @@ |
2528 | builder.build_snapshot(None, [ |
2529 | ('add', ('', 'root-id', 'directory', None)), |
2530 | ('add', ('file', 'file-id', 'file', base_text)), |
2531 | - ], revision_id='rev-base') |
2532 | + ], revision_id=b'rev-base') |
2533 | builder.build_snapshot(['rev-base'], [ |
2534 | ('modify', ('file', a_text))], |
2535 | - revision_id='rev-A') |
2536 | + revision_id=b'rev-A') |
2537 | builder.build_snapshot(['rev-base'], [ |
2538 | ('modify', ('file', b_text))], |
2539 | - revision_id='rev-B') |
2540 | + revision_id=b'rev-B') |
2541 | builder.build_snapshot(['rev-A'], [ |
2542 | ('modify', ('file', c_text))], |
2543 | - revision_id='rev-C') |
2544 | + revision_id=b'rev-C') |
2545 | builder.build_snapshot(['rev-B', 'rev-A'], [ |
2546 | ('modify', ('file', d_text))], |
2547 | - revision_id='rev-D') |
2548 | + revision_id=b'rev-D') |
2549 | builder.build_snapshot(['rev-C', 'rev-D'], [ |
2550 | ('modify', ('file', e_text))], |
2551 | - revision_id='rev-E') |
2552 | + revision_id=b'rev-E') |
2553 | return builder |
2554 | |
2555 | def assertAnnotateEqualDiff(self, actual, expected): |
2556 | @@ -414,8 +414,8 @@ |
2557 | tree1.lock_read() |
2558 | self.addCleanup(tree1.unlock) |
2559 | |
2560 | - revtree_1 = tree1.branch.repository.revision_tree('rev-1') |
2561 | - revtree_2 = tree1.branch.repository.revision_tree('rev-2') |
2562 | + revtree_1 = tree1.branch.repository.revision_tree(b'rev-1') |
2563 | + revtree_2 = tree1.branch.repository.revision_tree(b'rev-2') |
2564 | |
2565 | # this passes if no exception is raised |
2566 | to_file = BytesIO() |
2567 | |
2568 | === modified file 'breezy/tests/test_branchbuilder.py' |
2569 | --- breezy/tests/test_branchbuilder.py 2018-03-26 00:54:10 +0000 |
2570 | +++ breezy/tests/test_branchbuilder.py 2018-06-21 08:27:55 +0000 |
2571 | @@ -119,7 +119,7 @@ |
2572 | rev_id1 = builder.build_snapshot(None, |
2573 | [('add', ('', 'a-root-id', 'directory', None)), |
2574 | ('add', ('a', 'a-id', 'file', 'contents'))], |
2575 | - revision_id='A-id') |
2576 | + revision_id=b'A-id') |
2577 | self.assertEqual('A-id', rev_id1) |
2578 | return builder |
2579 | |
2580 | @@ -127,7 +127,7 @@ |
2581 | builder = self.build_a_rev() |
2582 | branch = builder.get_branch() |
2583 | self.assertEqual((1, 'A-id'), branch.last_revision_info()) |
2584 | - rev_tree = branch.repository.revision_tree('A-id') |
2585 | + rev_tree = branch.repository.revision_tree(b'A-id') |
2586 | rev_tree.lock_read() |
2587 | self.addCleanup(rev_tree.unlock) |
2588 | self.assertTreeShape([(u'', 'a-root-id', 'directory'), |
2589 | @@ -138,7 +138,7 @@ |
2590 | builder = self.build_a_rev() |
2591 | rev_id2 = builder.build_snapshot(None, |
2592 | [('add', ('b', 'b-id', 'file', 'content_b'))], |
2593 | - revision_id='B-id') |
2594 | + revision_id=b'B-id') |
2595 | self.assertEqual('B-id', rev_id2) |
2596 | branch = builder.get_branch() |
2597 | self.assertEqual((2, rev_id2), branch.last_revision_info()) |
2598 | @@ -154,8 +154,8 @@ |
2599 | builder = self.build_a_rev() |
2600 | rev_id2 = builder.build_snapshot(None, |
2601 | [('add', ('b', 'b-id', 'directory', None))], |
2602 | - revision_id='B-id') |
2603 | - rev_tree = builder.get_branch().repository.revision_tree('B-id') |
2604 | + revision_id=b'B-id') |
2605 | + rev_tree = builder.get_branch().repository.revision_tree(b'B-id') |
2606 | self.assertTreeShape([(u'', 'a-root-id', 'directory'), |
2607 | (u'a', 'a-id', 'file'), |
2608 | (u'b', 'b-id', 'directory'), |
2609 | @@ -201,7 +201,7 @@ |
2610 | builder = self.build_a_rev() |
2611 | rev_id2 = builder.build_snapshot(None, |
2612 | [('modify', ('a', 'new\ncontent\n'))], |
2613 | - revision_id='B-id') |
2614 | + revision_id=b'B-id') |
2615 | self.assertEqual('B-id', rev_id2) |
2616 | branch = builder.get_branch() |
2617 | rev_tree = branch.repository.revision_tree(rev_id2) |
2618 | @@ -213,7 +213,7 @@ |
2619 | def test_delete_file(self): |
2620 | builder = self.build_a_rev() |
2621 | rev_id2 = builder.build_snapshot(None, |
2622 | - [('unversion', 'a')], revision_id='B-id') |
2623 | + [('unversion', 'a')], revision_id=b'B-id') |
2624 | self.assertEqual('B-id', rev_id2) |
2625 | branch = builder.get_branch() |
2626 | rev_tree = branch.repository.revision_tree(rev_id2) |
2627 | @@ -228,8 +228,8 @@ |
2628 | ('add', ('b/c', 'c-id', 'file', 'foo\n')), |
2629 | ('add', ('b/d', 'd-id', 'directory', None)), |
2630 | ('add', ('b/d/e', 'e-id', 'file', 'eff\n')), |
2631 | - ], revision_id='B-id') |
2632 | - rev_tree = builder.get_branch().repository.revision_tree('B-id') |
2633 | + ], revision_id=b'B-id') |
2634 | + rev_tree = builder.get_branch().repository.revision_tree(b'B-id') |
2635 | self.assertTreeShape([(u'', 'a-root-id', 'directory'), |
2636 | (u'a', 'a-id', 'file'), |
2637 | (u'b', 'b-id', 'directory'), |
2638 | @@ -239,8 +239,8 @@ |
2639 | # Removing a directory removes all child dirs |
2640 | builder.build_snapshot( |
2641 | None, [('unversion', 'b')], |
2642 | - revision_id='C-id') |
2643 | - rev_tree = builder.get_branch().repository.revision_tree('C-id') |
2644 | + revision_id=b'C-id') |
2645 | + rev_tree = builder.get_branch().repository.revision_tree(b'C-id') |
2646 | self.assertTreeShape([(u'', 'a-root-id', 'directory'), |
2647 | (u'a', 'a-id', 'file'), |
2648 | ], rev_tree) |
2649 | @@ -249,14 +249,14 @@ |
2650 | builder = self.build_a_rev() |
2651 | e = self.assertRaises(ValueError, |
2652 | builder.build_snapshot, None, [('weirdo', ('foo',))], |
2653 | - revision_id='B-id') |
2654 | + revision_id=b'B-id') |
2655 | self.assertEqual('Unknown build action: "weirdo"', str(e)) |
2656 | |
2657 | def test_rename(self): |
2658 | builder = self.build_a_rev() |
2659 | builder.build_snapshot(None, |
2660 | - [('rename', ('a', 'b'))], revision_id='B-id') |
2661 | - rev_tree = builder.get_branch().repository.revision_tree('B-id') |
2662 | + [('rename', ('a', 'b'))], revision_id=b'B-id') |
2663 | + rev_tree = builder.get_branch().repository.revision_tree(b'B-id') |
2664 | self.assertTreeShape([(u'', 'a-root-id', 'directory'), |
2665 | (u'b', 'a-id', 'file')], rev_tree) |
2666 | |
2667 | @@ -264,8 +264,8 @@ |
2668 | builder = self.build_a_rev() |
2669 | builder.build_snapshot(None, |
2670 | [('add', ('dir', 'dir-id', 'directory', None)), |
2671 | - ('rename', ('a', 'dir/a'))], revision_id='B-id') |
2672 | - rev_tree = builder.get_branch().repository.revision_tree('B-id') |
2673 | + ('rename', ('a', 'dir/a'))], revision_id=b'B-id') |
2674 | + rev_tree = builder.get_branch().repository.revision_tree(b'B-id') |
2675 | self.assertTreeShape([(u'', 'a-root-id', 'directory'), |
2676 | (u'dir', 'dir-id', 'directory'), |
2677 | (u'dir/a', 'a-id', 'file')], rev_tree) |
2678 | @@ -275,11 +275,11 @@ |
2679 | builder.build_snapshot(None, |
2680 | [('add', ('dir', 'dir-id', 'directory', None)), |
2681 | ('rename', ('a', 'dir/a'))], |
2682 | - revision_id='B-id') |
2683 | + revision_id=b'B-id') |
2684 | builder.build_snapshot(None, |
2685 | [('rename', ('dir/a', 'a')), |
2686 | - ('unversion', 'dir')], revision_id='C-id') |
2687 | - rev_tree = builder.get_branch().repository.revision_tree('C-id') |
2688 | + ('unversion', 'dir')], revision_id=b'C-id') |
2689 | + rev_tree = builder.get_branch().repository.revision_tree(b'C-id') |
2690 | self.assertTreeShape([(u'', 'a-root-id', 'directory'), |
2691 | (u'a', 'a-id', 'file')], rev_tree) |
2692 | |
2693 | @@ -289,10 +289,10 @@ |
2694 | self.addCleanup(builder.finish_series) |
2695 | builder.build_snapshot(['A-id'], |
2696 | [('modify', ('a', 'new\ncontent\n'))], |
2697 | - revision_id='B-id') |
2698 | + revision_id=b'B-id') |
2699 | builder.build_snapshot(['A-id'], |
2700 | [('add', ('c', 'c-id', 'file', 'alt\ncontent\n'))], |
2701 | - revision_id='C-id') |
2702 | + revision_id=b'C-id') |
2703 | # We should now have a graph: |
2704 | # A |
2705 | # |\ |
2706 | @@ -301,14 +301,14 @@ |
2707 | repo = builder.get_branch().repository |
2708 | self.assertEqual({'B-id': ('A-id',), 'C-id': ('A-id',)}, |
2709 | repo.get_parent_map(['B-id', 'C-id'])) |
2710 | - b_tree = repo.revision_tree('B-id') |
2711 | + b_tree = repo.revision_tree(b'B-id') |
2712 | self.assertTreeShape([(u'', 'a-root-id', 'directory'), |
2713 | (u'a', 'a-id', 'file'), |
2714 | ], b_tree) |
2715 | self.assertEqual('new\ncontent\n', b_tree.get_file_text('a')) |
2716 | |
2717 | # We should still be using the content from A in C, not from B |
2718 | - c_tree = repo.revision_tree('C-id') |
2719 | + c_tree = repo.revision_tree(b'C-id') |
2720 | self.assertTreeShape([(u'', 'a-root-id', 'directory'), |
2721 | (u'a', 'a-id', 'file'), |
2722 | (u'c', 'c-id', 'file'), |
2723 | @@ -322,16 +322,16 @@ |
2724 | self.addCleanup(builder.finish_series) |
2725 | builder.build_snapshot(['A-id'], |
2726 | [('add', ('b', 'b-id', 'file', 'b\ncontent\n'))], |
2727 | - revision_id='B-id') |
2728 | + revision_id=b'B-id') |
2729 | builder.build_snapshot(['A-id'], |
2730 | [('add', ('c', 'c-id', 'file', 'alt\ncontent\n'))], |
2731 | - revision_id='C-id') |
2732 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
2733 | + revision_id=b'C-id') |
2734 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
2735 | repo = builder.get_branch().repository |
2736 | self.assertEqual({'B-id': ('A-id',), 'C-id': ('A-id',), |
2737 | 'D-id': ('B-id', 'C-id')}, |
2738 | repo.get_parent_map(['B-id', 'C-id', 'D-id'])) |
2739 | - d_tree = repo.revision_tree('D-id') |
2740 | + d_tree = repo.revision_tree(b'D-id') |
2741 | # Note: by default a merge node does *not* pull in the changes from the |
2742 | # merged tree, you have to supply it yourself. |
2743 | self.assertTreeShape([(u'', 'a-root-id', 'directory'), |
2744 | @@ -345,18 +345,18 @@ |
2745 | self.addCleanup(builder.finish_series) |
2746 | builder.build_snapshot(['A-id'], |
2747 | [('add', ('b', 'b-id', 'file', 'b\ncontent\n'))], |
2748 | - revision_id='B-id') |
2749 | + revision_id=b'B-id') |
2750 | builder.build_snapshot(['A-id'], |
2751 | [('add', ('c', 'c-id', 'file', 'alt\ncontent\n'))], |
2752 | - revision_id='C-id') |
2753 | + revision_id=b'C-id') |
2754 | builder.build_snapshot(['B-id', 'C-id'], |
2755 | [('add', ('c', 'c-id', 'file', 'alt\ncontent\n'))], |
2756 | - revision_id='D-id') |
2757 | + revision_id=b'D-id') |
2758 | repo = builder.get_branch().repository |
2759 | self.assertEqual({'B-id': ('A-id',), 'C-id': ('A-id',), |
2760 | 'D-id': ('B-id', 'C-id')}, |
2761 | repo.get_parent_map(['B-id', 'C-id', 'D-id'])) |
2762 | - d_tree = repo.revision_tree('D-id') |
2763 | + d_tree = repo.revision_tree(b'D-id') |
2764 | self.assertTreeShape([(u'', 'a-root-id', 'directory'), |
2765 | (u'a', 'a-id', 'file'), |
2766 | (u'b', 'b-id', 'file'), |
2767 | @@ -372,7 +372,7 @@ |
2768 | self.addCleanup(builder.finish_series) |
2769 | builder.build_snapshot([], |
2770 | [('add', ('', None, 'directory', None))], |
2771 | - revision_id='B-id') |
2772 | + revision_id=b'B-id') |
2773 | # We should now have a graph: |
2774 | # A B |
2775 | # And not A => B |
2776 | @@ -400,7 +400,7 @@ |
2777 | try: |
2778 | builder.build_snapshot(['ghost'], |
2779 | [('add', ('', 'ROOT_ID', 'directory', ''))], |
2780 | - allow_leftmost_as_ghost=True, revision_id='tip') |
2781 | + allow_leftmost_as_ghost=True, revision_id=b'tip') |
2782 | finally: |
2783 | builder.finish_series() |
2784 | b = builder.get_branch() |
2785 | @@ -414,13 +414,13 @@ |
2786 | builder.start_series() |
2787 | builder.build_snapshot(None, |
2788 | [('add', ('', 'TREE_ROOT', 'directory', ''))], |
2789 | - revision_id='rev-1') |
2790 | + revision_id=b'rev-1') |
2791 | builder.build_snapshot(None, |
2792 | [('unversion', ''), |
2793 | ('add', ('', 'my-root', 'directory', ''))], |
2794 | - revision_id='rev-2') |
2795 | + revision_id=b'rev-2') |
2796 | builder.finish_series() |
2797 | - rev_tree = builder.get_branch().repository.revision_tree('rev-2') |
2798 | + rev_tree = builder.get_branch().repository.revision_tree(b'rev-2') |
2799 | self.assertTreeShape([(u'', 'my-root', 'directory')], rev_tree) |
2800 | |
2801 | def test_empty_flush(self): |
2802 | @@ -429,10 +429,10 @@ |
2803 | builder.start_series() |
2804 | builder.build_snapshot(None, |
2805 | [('add', ('', 'TREE_ROOT', 'directory', ''))], |
2806 | - revision_id='rev-1') |
2807 | - builder.build_snapshot(None, [('flush', None)], revision_id='rev-2') |
2808 | + revision_id=b'rev-1') |
2809 | + builder.build_snapshot(None, [('flush', None)], revision_id=b'rev-2') |
2810 | builder.finish_series() |
2811 | - rev_tree = builder.get_branch().repository.revision_tree('rev-2') |
2812 | + rev_tree = builder.get_branch().repository.revision_tree(b'rev-2') |
2813 | self.assertTreeShape([(u'', 'TREE_ROOT', 'directory')], rev_tree) |
2814 | |
2815 | def test_kind_change(self): |
2816 | @@ -444,14 +444,14 @@ |
2817 | builder.build_snapshot(None, |
2818 | [('add', (u'', 'a-root-id', 'directory', None)), |
2819 | ('add', (u'a', 'a-id', 'file', 'content\n'))], |
2820 | - revision_id='A-id') |
2821 | + revision_id=b'A-id') |
2822 | builder.build_snapshot(None, |
2823 | [('unversion', 'a'), |
2824 | ('flush', None), |
2825 | ('add', (u'a', 'a-id', 'directory', None))], |
2826 | - revision_id='B-id') |
2827 | + revision_id=b'B-id') |
2828 | builder.finish_series() |
2829 | - rev_tree = builder.get_branch().repository.revision_tree('B-id') |
2830 | + rev_tree = builder.get_branch().repository.revision_tree(b'B-id') |
2831 | self.assertTreeShape( |
2832 | [(u'', 'a-root-id', 'directory'), (u'a', 'a-id', 'directory')], |
2833 | rev_tree) |
2834 | @@ -465,13 +465,13 @@ |
2835 | builder.build_snapshot(None, |
2836 | [('add', (u'', 'orig-root', 'directory', None)), |
2837 | ('add', (u'dir', 'dir-id', 'directory', None))], |
2838 | - revision_id='A-id') |
2839 | + revision_id=b'A-id') |
2840 | builder.build_snapshot(None, |
2841 | [('unversion', ''), # implicitly unversions all children |
2842 | ('flush', None), |
2843 | ('add', (u'', 'dir-id', 'directory', None))], |
2844 | - revision_id='B-id') |
2845 | + revision_id=b'B-id') |
2846 | builder.finish_series() |
2847 | - rev_tree = builder.get_branch().repository.revision_tree('B-id') |
2848 | + rev_tree = builder.get_branch().repository.revision_tree(b'B-id') |
2849 | self.assertTreeShape([(u'', 'dir-id', 'directory')], rev_tree) |
2850 | |
2851 | |
2852 | === modified file 'breezy/tests/test_bundle.py' |
2853 | --- breezy/tests/test_bundle.py 2018-05-27 16:53:07 +0000 |
2854 | +++ breezy/tests/test_bundle.py 2018-06-21 08:27:55 +0000 |
2855 | @@ -988,12 +988,12 @@ |
2856 | self.tree1 = self.make_branch_and_tree('b1') |
2857 | self.b1 = self.tree1.branch |
2858 | self.tree1.commit('message', rev_id=b'rev2a') |
2859 | - bundle = self.get_valid_bundle('null:', 'rev2a') |
2860 | + bundle = self.get_valid_bundle(b'null:', b'rev2a') |
2861 | branch2 = self.make_branch('b2') |
2862 | - self.assertFalse(branch2.repository.has_revision('rev2a')) |
2863 | + self.assertFalse(branch2.repository.has_revision(b'rev2a')) |
2864 | target_revision = bundle.install_revisions(branch2.repository) |
2865 | - self.assertTrue(branch2.repository.has_revision('rev2a')) |
2866 | - self.assertEqual('rev2a', target_revision) |
2867 | + self.assertTrue(branch2.repository.has_revision(b'rev2a')) |
2868 | + self.assertEqual(b'rev2a', target_revision) |
2869 | |
2870 | def test_bundle_empty_property(self): |
2871 | """Test serializing revision properties with an empty value.""" |
2872 | @@ -1003,10 +1003,10 @@ |
2873 | tree.add([''], [b'TREE_ROOT']) |
2874 | tree.commit('One', revprops={'one':'two', 'empty':''}, rev_id=b'rev1') |
2875 | self.b1 = tree.branch |
2876 | - bundle_sio, revision_ids = self.create_bundle_text('null:', 'rev1') |
2877 | + bundle_sio, revision_ids = self.create_bundle_text(b'null:', b'rev1') |
2878 | bundle = read_bundle(bundle_sio) |
2879 | revision_info = bundle.revisions[0] |
2880 | - self.assertEqual('rev1', revision_info.revision_id) |
2881 | + self.assertEqual(b'rev1', revision_info.revision_id) |
2882 | rev = revision_info.as_revision() |
2883 | self.assertEqual({'branch-nick':'tree', 'empty':'', 'one':'two'}, |
2884 | rev.properties) |
2885 | @@ -1085,26 +1085,26 @@ |
2886 | tree = self.make_simple_tree('knit') |
2887 | tree.commit('hello', rev_id=b'rev1') |
2888 | tree.commit('hello', rev_id=b'rev2') |
2889 | - bundle = read_bundle(self.create_bundle_text('null:', 'rev2')[0]) |
2890 | + bundle = read_bundle(self.create_bundle_text(b'null:', b'rev2')[0]) |
2891 | repo = self.make_repository('repo', format='dirstate-with-subtree') |
2892 | bundle.install_revisions(repo) |
2893 | return repo |
2894 | |
2895 | def test_across_models(self): |
2896 | repo = self.make_repo_with_installed_revisions() |
2897 | - inv = repo.get_inventory('rev2') |
2898 | - self.assertEqual('rev2', inv.root.revision) |
2899 | + inv = repo.get_inventory(b'rev2') |
2900 | + self.assertEqual(b'rev2', inv.root.revision) |
2901 | root_id = inv.root.file_id |
2902 | repo.lock_read() |
2903 | self.addCleanup(repo.unlock) |
2904 | - self.assertEqual({(root_id, 'rev1'):(), |
2905 | - (root_id, 'rev2'):((root_id, 'rev1'),)}, |
2906 | - repo.texts.get_parent_map([(root_id, 'rev1'), (root_id, 'rev2')])) |
2907 | + self.assertEqual({(root_id, b'rev1'):(), |
2908 | + (root_id, b'rev2'):((root_id, b'rev1'),)}, |
2909 | + repo.texts.get_parent_map([(root_id, b'rev1'), (root_id, b'rev2')])) |
2910 | |
2911 | def test_inv_hash_across_serializers(self): |
2912 | repo = self.make_repo_with_installed_revisions() |
2913 | - recorded_inv_sha1 = repo.get_revision('rev2').inventory_sha1 |
2914 | - xml = repo._get_inventory_xml('rev2') |
2915 | + recorded_inv_sha1 = repo.get_revision(b'rev2').inventory_sha1 |
2916 | + xml = repo._get_inventory_xml(b'rev2') |
2917 | self.assertEqual(osutils.sha_string(xml), recorded_inv_sha1) |
2918 | |
2919 | def test_across_models_incompatible(self): |
2920 | @@ -1410,7 +1410,7 @@ |
2921 | tree.commit('changed file', rev_id=b'rev2') |
2922 | s = BytesIO() |
2923 | serializer = BundleSerializerV4('1.0') |
2924 | - serializer.write(tree.branch.repository, ['rev1', 'rev2'], {}, s) |
2925 | + serializer.write(tree.branch.repository, [b'rev1', b'rev2'], {}, s) |
2926 | s.seek(0) |
2927 | tree2 = self.make_branch_and_tree('target') |
2928 | target_repo = tree2.branch.repository |
2929 | @@ -1420,19 +1420,19 @@ |
2930 | # Turn the 'iterators_of_bytes' back into simple strings for comparison |
2931 | repo_texts = dict((i, ''.join(content)) for i, content |
2932 | in target_repo.iter_files_bytes( |
2933 | - [('fileid-2', 'rev1', '1'), |
2934 | - ('fileid-2', 'rev2', '2')])) |
2935 | - self.assertEqual({'1':'contents1\nstatic\n', |
2936 | - '2':'contents2\nstatic\n'}, |
2937 | + [(b'fileid-2', b'rev1', '1'), |
2938 | + (b'fileid-2', b'rev2', '2')])) |
2939 | + self.assertEqual({'1':b'contents1\nstatic\n', |
2940 | + '2':b'contents2\nstatic\n'}, |
2941 | repo_texts) |
2942 | - rtree = target_repo.revision_tree('rev2') |
2943 | + rtree = target_repo.revision_tree(b'rev2') |
2944 | inventory_vf = target_repo.inventories |
2945 | # If the inventory store has a graph, it must match the revision graph. |
2946 | self.assertSubset( |
2947 | - [inventory_vf.get_parent_map([('rev2',)])[('rev2',)]], |
2948 | - [None, (('rev1',),)]) |
2949 | + [inventory_vf.get_parent_map([(b'rev2',)])[(b'rev2',)]], |
2950 | + [None, ((b'rev1',),)]) |
2951 | self.assertEqual('changed file', |
2952 | - target_repo.get_revision('rev2').message) |
2953 | + target_repo.get_revision(b'rev2').message) |
2954 | |
2955 | @staticmethod |
2956 | def get_raw(bundle_file): |
2957 | @@ -1515,16 +1515,16 @@ |
2958 | builder.build_snapshot(None, [ |
2959 | ('add', ('', 'root-id', 'directory', None)), |
2960 | ('add', ('file', 'file-id', 'file', 'original content\n')), |
2961 | - ], revision_id='a@cset-0-1') |
2962 | + ], revision_id=b'a@cset-0-1') |
2963 | builder.build_snapshot(['a@cset-0-1'], [ |
2964 | ('modify', ('file', 'new-content\n')), |
2965 | - ], revision_id='a@cset-0-2a') |
2966 | + ], revision_id=b'a@cset-0-2a') |
2967 | builder.build_snapshot(['a@cset-0-1'], [ |
2968 | ('add', ('other-file', 'file2-id', 'file', 'file2-content\n')), |
2969 | - ], revision_id='a@cset-0-2b') |
2970 | + ], revision_id=b'a@cset-0-2b') |
2971 | builder.build_snapshot(['a@cset-0-2a', 'a@cset-0-2b'], [ |
2972 | ('add', ('other-file', 'file2-id', 'file', 'file2-content\n')), |
2973 | - ], revision_id='a@cset-0-3') |
2974 | + ], revision_id=b'a@cset-0-3') |
2975 | builder.finish_series() |
2976 | self.b1 = builder.get_branch() |
2977 | self.b1.lock_read() |
2978 | @@ -1657,7 +1657,7 @@ |
2979 | def test_creating_bundle_preserves_chk_pages(self): |
2980 | self.make_merged_branch() |
2981 | target = self.b1.controldir.sprout('target', |
2982 | - revision_id='a@cset-0-2a').open_branch() |
2983 | + revision_id=b'a@cset-0-2a').open_branch() |
2984 | bundle_txt, rev_ids = self.create_bundle_text('a@cset-0-2a', |
2985 | 'a@cset-0-3') |
2986 | self.assertEqual(['a@cset-0-2b', 'a@cset-0-3'], rev_ids) |
2987 | |
2988 | === modified file 'breezy/tests/test_commit.py' |
2989 | --- breezy/tests/test_commit.py 2018-03-25 11:39:36 +0000 |
2990 | +++ breezy/tests/test_commit.py 2018-06-21 08:27:55 +0000 |
2991 | @@ -163,7 +163,7 @@ |
2992 | [('missing', u'hello'), ('deleted', u'hello')], |
2993 | reporter.calls) |
2994 | |
2995 | - tree = b.repository.revision_tree('rev2') |
2996 | + tree = b.repository.revision_tree(b'rev2') |
2997 | self.assertFalse(tree.has_id(b'hello-id')) |
2998 | |
2999 | def test_partial_commit_move(self): |
3000 | @@ -238,14 +238,14 @@ |
3001 | eq = self.assertEqual |
3002 | eq(b.revno(), 3) |
3003 | |
3004 | - tree2 = b.repository.revision_tree('test@rev-2') |
3005 | + tree2 = b.repository.revision_tree(b'test@rev-2') |
3006 | tree2.lock_read() |
3007 | self.addCleanup(tree2.unlock) |
3008 | self.assertTrue(tree2.has_filename('hello')) |
3009 | self.assertEqual(tree2.get_file_text('hello'), 'hello') |
3010 | self.assertEqual(tree2.get_file_text('buongia'), 'new text') |
3011 | |
3012 | - tree3 = b.repository.revision_tree('test@rev-3') |
3013 | + tree3 = b.repository.revision_tree(b'test@rev-3') |
3014 | tree3.lock_read() |
3015 | self.addCleanup(tree3.unlock) |
3016 | self.assertFalse(tree3.has_filename('hello')) |
3017 | @@ -345,8 +345,8 @@ |
3018 | wt.remove('hello') |
3019 | wt.commit('removed hello', rev_id=b'rev2') |
3020 | |
3021 | - tree = b.repository.revision_tree('rev2') |
3022 | - self.assertFalse(tree.has_id('hello-id')) |
3023 | + tree = b.repository.revision_tree(b'rev2') |
3024 | + self.assertFalse(tree.has_id(b'hello-id')) |
3025 | |
3026 | def test_committed_ancestry(self): |
3027 | """Test commit appends revisions to ancestry.""" |
3028 | @@ -370,13 +370,13 @@ |
3029 | b = wt.branch |
3030 | self.build_tree(['dir/', 'dir/file1', 'dir/file2']) |
3031 | wt.add(['dir', 'dir/file1', 'dir/file2'], |
3032 | - ['dirid', 'file1id', 'file2id']) |
3033 | + [b'dirid', b'file1id', b'file2id']) |
3034 | wt.commit('dir/file1', specific_files=['dir/file1'], rev_id=b'1') |
3035 | - inv = b.repository.get_inventory('1') |
3036 | - self.assertEqual('1', inv.get_entry('dirid').revision) |
3037 | - self.assertEqual('1', inv.get_entry('file1id').revision) |
3038 | + inv = b.repository.get_inventory(b'1') |
3039 | + self.assertEqual(b'1', inv.get_entry(b'dirid').revision) |
3040 | + self.assertEqual(b'1', inv.get_entry(b'file1id').revision) |
3041 | # FIXME: This should raise a KeyError I think, rbc20051006 |
3042 | - self.assertRaises(BzrError, inv.get_entry, 'file2id') |
3043 | + self.assertRaises(BzrError, inv.get_entry, b'file2id') |
3044 | |
3045 | def test_strict_commit(self): |
3046 | """Try and commit with unknown files and strict = True, should fail.""" |
3047 | @@ -450,7 +450,7 @@ |
3048 | wt = self.make_branch_and_tree('.') |
3049 | branch = wt.branch |
3050 | wt.commit("base", allow_pointless=True, rev_id=b'A') |
3051 | - self.assertFalse(branch.repository.has_signature_for_revision_id('A')) |
3052 | + self.assertFalse(branch.repository.has_signature_for_revision_id(b'A')) |
3053 | try: |
3054 | # monkey patch gpg signing mechanism |
3055 | breezy.gpg.GPGStrategy = breezy.gpg.DisabledGPGStrategy |
3056 | @@ -464,8 +464,8 @@ |
3057 | rev_id=b'B', |
3058 | working_tree=wt) |
3059 | branch = Branch.open(self.get_url('.')) |
3060 | - self.assertEqual(branch.last_revision(), 'A') |
3061 | - self.assertFalse(branch.repository.has_revision('B')) |
3062 | + self.assertEqual(branch.last_revision(), b'A') |
3063 | + self.assertFalse(branch.repository.has_revision(b'B')) |
3064 | finally: |
3065 | breezy.gpg.GPGStrategy = oldstrategy |
3066 | |
3067 | @@ -628,7 +628,7 @@ |
3068 | tree.commit('added a', timestamp=1153248633.4186721, timezone=0, |
3069 | rev_id=b'a1') |
3070 | |
3071 | - rev = tree.branch.repository.get_revision('a1') |
3072 | + rev = tree.branch.repository.get_revision(b'a1') |
3073 | self.assertEqual(1153248633.419, rev.timestamp) |
3074 | |
3075 | def test_commit_has_1ms_resolution(self): |
3076 | @@ -638,7 +638,7 @@ |
3077 | tree.add('a') |
3078 | tree.commit('added a', rev_id=b'a1') |
3079 | |
3080 | - rev = tree.branch.repository.get_revision('a1') |
3081 | + rev = tree.branch.repository.get_revision(b'a1') |
3082 | timestamp = rev.timestamp |
3083 | timestamp_1ms = round(timestamp, 3) |
3084 | self.assertEqual(timestamp_1ms, timestamp) |
3085 | @@ -830,7 +830,7 @@ |
3086 | branch = controldir.ControlDir.create_branch_convenience('repo/branch') |
3087 | tree2 = branch.create_checkout('repo/tree2') |
3088 | tree2.commit('message', rev_id=b'rev1') |
3089 | - self.assertTrue(tree2.branch.repository.has_revision('rev1')) |
3090 | + self.assertTrue(tree2.branch.repository.has_revision(b'rev1')) |
3091 | |
3092 | |
3093 | class FilterExcludedTests(TestCase): |
3094 | |
3095 | === modified file 'breezy/tests/test_commit_merge.py' |
3096 | --- breezy/tests/test_commit_merge.py 2018-02-18 15:21:06 +0000 |
3097 | +++ breezy/tests/test_commit_merge.py 2018-06-21 08:27:55 +0000 |
3098 | @@ -62,11 +62,11 @@ |
3099 | graph = wty.branch.repository.get_graph() |
3100 | self.addCleanup(wty.lock_read().unlock) |
3101 | self.assertThat(by, |
3102 | - RevisionHistoryMatches([base_rev, 'y@u-0-1', 'y@u-0-2']) |
3103 | + RevisionHistoryMatches([base_rev, b'y@u-0-1', b'y@u-0-2']) |
3104 | ) |
3105 | - rev = by.repository.get_revision('y@u-0-2') |
3106 | + rev = by.repository.get_revision(b'y@u-0-2') |
3107 | self.assertEqual(rev.parent_ids, |
3108 | - ['y@u-0-1', 'x@u-0-1']) |
3109 | + [b'y@u-0-1', b'x@u-0-1']) |
3110 | |
3111 | def test_merge_new_file(self): |
3112 | """Commit merge of two trees with no overlapping files.""" |
3113 | |
3114 | === modified file 'breezy/tests/test_conflicts.py' |
3115 | --- breezy/tests/test_conflicts.py 2018-03-27 00:23:34 +0000 |
3116 | +++ breezy/tests/test_conflicts.py 2018-06-21 08:27:55 +0000 |
3117 | @@ -304,16 +304,16 @@ |
3118 | # Create an empty trunk |
3119 | builder.build_snapshot(None, [ |
3120 | ('add', ('', 'root-id', 'directory', ''))], |
3121 | - revision_id='start') |
3122 | + revision_id=b'start') |
3123 | # Add a minimal base content |
3124 | base_actions = self._get_actions(self._base_actions)() |
3125 | - builder.build_snapshot(['start'], base_actions, revision_id='base') |
3126 | + builder.build_snapshot(['start'], base_actions, revision_id=b'base') |
3127 | # Modify the base content in branch |
3128 | actions_other = self._get_actions(self._other['actions'])() |
3129 | - builder.build_snapshot(['base'], actions_other, revision_id='other') |
3130 | + builder.build_snapshot(['base'], actions_other, revision_id=b'other') |
3131 | # Modify the base content in trunk |
3132 | actions_this = self._get_actions(self._this['actions'])() |
3133 | - builder.build_snapshot(['base'], actions_this, revision_id='this') |
3134 | + builder.build_snapshot(['base'], actions_this, revision_id=b'this') |
3135 | # builder.get_branch() tip is now 'this' |
3136 | |
3137 | builder.finish_series() |
3138 | |
3139 | === modified file 'breezy/tests/test_diff.py' |
3140 | --- breezy/tests/test_diff.py 2018-02-18 15:21:06 +0000 |
3141 | +++ breezy/tests/test_diff.py 2018-06-21 08:27:55 +0000 |
3142 | @@ -403,8 +403,8 @@ |
3143 | ''') |
3144 | |
3145 | def test_diff_rev_tree_rev_tree(self): |
3146 | - tree1 = self.b.repository.revision_tree('rev-2') |
3147 | - tree2 = self.b.repository.revision_tree('rev-3') |
3148 | + tree1 = self.b.repository.revision_tree(b'rev-2') |
3149 | + tree2 = self.b.repository.revision_tree(b'rev-3') |
3150 | output = get_diff_as_string(tree1, tree2) |
3151 | self.assertEqualDiff(output, '''\ |
3152 | === modified file 'file2' |
3153 | @@ -418,7 +418,7 @@ |
3154 | |
3155 | def test_diff_add_files(self): |
3156 | tree1 = self.b.repository.revision_tree(_mod_revision.NULL_REVISION) |
3157 | - tree2 = self.b.repository.revision_tree('rev-1') |
3158 | + tree2 = self.b.repository.revision_tree(b'rev-1') |
3159 | output = get_diff_as_string(tree1, tree2) |
3160 | # the files have the epoch time stamp for the tree in which |
3161 | # they don't exist. |
3162 | @@ -438,8 +438,8 @@ |
3163 | ''') |
3164 | |
3165 | def test_diff_remove_files(self): |
3166 | - tree1 = self.b.repository.revision_tree('rev-3') |
3167 | - tree2 = self.b.repository.revision_tree('rev-4') |
3168 | + tree1 = self.b.repository.revision_tree(b'rev-3') |
3169 | + tree2 = self.b.repository.revision_tree(b'rev-4') |
3170 | output = get_diff_as_string(tree1, tree2) |
3171 | # the file has the epoch time stamp for the tree in which |
3172 | # it doesn't exist. |
3173 | @@ -455,8 +455,8 @@ |
3174 | def test_show_diff_specified(self): |
3175 | """A working tree filename can be used to identify a file""" |
3176 | self.wt.rename_one('file1', 'file1b') |
3177 | - old_tree = self.b.repository.revision_tree('rev-1') |
3178 | - new_tree = self.b.repository.revision_tree('rev-4') |
3179 | + old_tree = self.b.repository.revision_tree(b'rev-1') |
3180 | + new_tree = self.b.repository.revision_tree(b'rev-4') |
3181 | out = get_diff_as_string(old_tree, new_tree, specific_files=['file1b'], |
3182 | working_tree=self.wt) |
3183 | self.assertContainsRe(out, 'file1\t') |
3184 | @@ -467,8 +467,8 @@ |
3185 | os.mkdir('dir2') |
3186 | self.wt.add(['dir1', 'dir2']) |
3187 | self.wt.rename_one('file1', 'dir1/file1') |
3188 | - old_tree = self.b.repository.revision_tree('rev-1') |
3189 | - new_tree = self.b.repository.revision_tree('rev-4') |
3190 | + old_tree = self.b.repository.revision_tree(b'rev-1') |
3191 | + new_tree = self.b.repository.revision_tree(b'rev-4') |
3192 | out = get_diff_as_string(old_tree, new_tree, specific_files=['dir1'], |
3193 | working_tree=self.wt) |
3194 | self.assertContainsRe(out, 'file1\t') |
3195 | |
3196 | === modified file 'breezy/tests/test_dirstate.py' |
3197 | --- breezy/tests/test_dirstate.py 2018-03-25 11:39:36 +0000 |
3198 | +++ breezy/tests/test_dirstate.py 2018-06-21 08:27:55 +0000 |
3199 | @@ -974,7 +974,7 @@ |
3200 | # in case the default tree format uses a different root id |
3201 | mt.set_root_id(b'TREE_ROOT') |
3202 | mt.commit('foo', rev_id=b'parent-revid') |
3203 | - rt = mt.branch.repository.revision_tree('parent-revid') |
3204 | + rt = mt.branch.repository.revision_tree(b'parent-revid') |
3205 | state = dirstate.DirState.initialize('dirstate') |
3206 | state._validate() |
3207 | try: |
3208 | |
3209 | === modified file 'breezy/tests/test_fetch.py' |
3210 | --- breezy/tests/test_fetch.py 2018-02-18 15:21:06 +0000 |
3211 | +++ breezy/tests/test_fetch.py 2018-06-21 08:27:55 +0000 |
3212 | @@ -289,7 +289,7 @@ |
3213 | source.inventories) |
3214 | # precondition |
3215 | self.assertTrue(target._format._fetch_uses_deltas) |
3216 | - target.fetch(source, revision_id='rev-one') |
3217 | + target.fetch(source, revision_id=b'rev-one') |
3218 | self.assertEqual(('get_record_stream', [('file-id', 'rev-one')], |
3219 | target._format._fetch_order, False), |
3220 | self.find_get_record_stream(source.texts.calls)) |
3221 | @@ -329,7 +329,7 @@ |
3222 | source.inventories) |
3223 | # XXX: This won't work in general, but for the dirstate format it does. |
3224 | self.overrideAttr(target._format, '_fetch_uses_deltas', False) |
3225 | - target.fetch(source, revision_id='rev-one') |
3226 | + target.fetch(source, revision_id=b'rev-one') |
3227 | self.assertEqual(('get_record_stream', [('file-id', 'rev-one')], |
3228 | target._format._fetch_order, True), |
3229 | self.find_get_record_stream(source.texts.calls)) |
3230 | @@ -373,7 +373,7 @@ |
3231 | record = next(source.revisions.get_record_stream([('rev-two',)], |
3232 | 'unordered', False)) |
3233 | self.assertEqual('knit-delta-gz', record.storage_kind) |
3234 | - target.fetch(tree.branch.repository, revision_id='rev-two') |
3235 | + target.fetch(tree.branch.repository, revision_id=b'rev-two') |
3236 | # The record should get expanded back to a fulltext |
3237 | target.lock_read() |
3238 | self.addCleanup(target.unlock) |
3239 | @@ -407,15 +407,15 @@ |
3240 | fname = 'file%03d' % (i,) |
3241 | fileid = '%s-%s' % (fname, osutils.rand_chars(64)) |
3242 | to_add.append(('add', (fname, fileid, 'file', 'content\n'))) |
3243 | - builder.build_snapshot(None, to_add, revision_id='A') |
3244 | - builder.build_snapshot(['A'], [], revision_id='B') |
3245 | - builder.build_snapshot(['A'], [], revision_id='C') |
3246 | - builder.build_snapshot(['C'], [], revision_id='D') |
3247 | - builder.build_snapshot(['D'], [], revision_id='E') |
3248 | - builder.build_snapshot(['E', 'B'], [], revision_id='F') |
3249 | + builder.build_snapshot(None, to_add, revision_id=b'A') |
3250 | + builder.build_snapshot(['A'], [], revision_id=b'B') |
3251 | + builder.build_snapshot(['A'], [], revision_id=b'C') |
3252 | + builder.build_snapshot(['C'], [], revision_id=b'D') |
3253 | + builder.build_snapshot(['D'], [], revision_id=b'E') |
3254 | + builder.build_snapshot(['E', 'B'], [], revision_id=b'F') |
3255 | builder.finish_series() |
3256 | source_branch = builder.get_branch() |
3257 | - source_branch.controldir.sprout('base', revision_id='B') |
3258 | + source_branch.controldir.sprout('base', revision_id=b'B') |
3259 | target_branch = self.make_branch('target', format='1.6') |
3260 | target_branch.set_stacked_on_url('../base') |
3261 | source = source_branch.repository |
3262 | @@ -437,7 +437,7 @@ |
3263 | target_branch.lock_write() |
3264 | self.addCleanup(target_branch.unlock) |
3265 | target = target_branch.repository |
3266 | - target.fetch(source, revision_id='F') |
3267 | + target.fetch(source, revision_id=b'F') |
3268 | # 'C' should be expanded to a fulltext, but D and E should still be |
3269 | # deltas |
3270 | stream = target.inventories.get_record_stream( |
3271 | |
3272 | === modified file 'breezy/tests/test_fetch_ghosts.py' |
3273 | --- breezy/tests/test_fetch_ghosts.py 2018-02-18 15:21:06 +0000 |
3274 | +++ breezy/tests/test_fetch_ghosts.py 2018-06-21 08:27:55 +0000 |
3275 | @@ -25,7 +25,7 @@ |
3276 | def prepare_with_ghosts(self): |
3277 | tree = self.make_branch_and_tree('.') |
3278 | tree.commit('rev1', rev_id=b'rev1-id') |
3279 | - tree.set_parent_ids(['rev1-id', 'ghost-id']) |
3280 | + tree.set_parent_ids([b'rev1-id', b'ghost-id']) |
3281 | tree.commit('rev2') |
3282 | return tree |
3283 | |
3284 | @@ -33,11 +33,11 @@ |
3285 | tree = self.prepare_with_ghosts() |
3286 | branch = self.make_branch('branch') |
3287 | GhostFetcher(tree.branch, branch).run() |
3288 | - self.assertFalse(tree.branch.repository.has_revision('ghost-id')) |
3289 | + self.assertFalse(tree.branch.repository.has_revision(b'ghost-id')) |
3290 | |
3291 | def test_fetch_ghosts_success(self): |
3292 | tree = self.prepare_with_ghosts() |
3293 | ghost_tree = self.make_branch_and_tree('ghost_tree') |
3294 | ghost_tree.commit('ghost', rev_id=b'ghost-id') |
3295 | GhostFetcher(tree.branch, ghost_tree.branch).run() |
3296 | - self.assertTrue(tree.branch.repository.has_revision('ghost-id')) |
3297 | + self.assertTrue(tree.branch.repository.has_revision(b'ghost-id')) |
3298 | |
3299 | === modified file 'breezy/tests/test_inv.py' |
3300 | --- breezy/tests/test_inv.py 2018-05-13 02:18:13 +0000 |
3301 | +++ breezy/tests/test_inv.py 2018-06-21 08:27:55 +0000 |
3302 | @@ -251,11 +251,11 @@ |
3303 | try: |
3304 | repo.start_write_group() |
3305 | try: |
3306 | - rev = revision.Revision('basis', timestamp=0, timezone=None, |
3307 | + rev = revision.Revision(b'basis', timestamp=0, timezone=None, |
3308 | message="", committer="foo@example.com") |
3309 | - basis.revision_id = 'basis' |
3310 | + basis.revision_id = b'basis' |
3311 | create_texts_for_inv(repo, basis) |
3312 | - repo.add_revision('basis', rev, basis) |
3313 | + repo.add_revision(b'basis', rev, basis) |
3314 | repo.commit_write_group() |
3315 | except: |
3316 | repo.abort_write_group() |
3317 | @@ -266,8 +266,8 @@ |
3318 | try: |
3319 | repo.start_write_group() |
3320 | try: |
3321 | - inv_sha1 = repo.add_inventory_by_delta('basis', delta, |
3322 | - 'result', ['basis']) |
3323 | + inv_sha1 = repo.add_inventory_by_delta(b'basis', delta, |
3324 | + b'result', [b'basis']) |
3325 | except: |
3326 | repo.abort_write_group() |
3327 | raise |
3328 | @@ -279,7 +279,7 @@ |
3329 | repo = repo.controldir.open_repository() |
3330 | repo.lock_read() |
3331 | self.addCleanup(repo.unlock) |
3332 | - return repo.get_inventory('result') |
3333 | + return repo.get_inventory(b'result') |
3334 | |
3335 | |
3336 | class TestInventoryUpdates(TestCase): |
3337 | |
3338 | === modified file 'breezy/tests/test_knit.py' |
3339 | --- breezy/tests/test_knit.py 2018-06-14 10:06:05 +0000 |
3340 | +++ breezy/tests/test_knit.py 2018-06-21 08:27:55 +0000 |
3341 | @@ -419,7 +419,7 @@ |
3342 | ], revision_id=b'rev-1') |
3343 | builder.build_snapshot([b'rev-1'], [ |
3344 | ('modify', ('file', b'content\nrev 2\n')), |
3345 | - ], revision_id='rev-2') |
3346 | + ], revision_id=b'rev-2') |
3347 | builder.build_snapshot([b'rev-2'], [ |
3348 | ('modify', ('file', b'content\nrev 3\n')), |
3349 | ], revision_id=b'rev-3') |
3350 | |
3351 | === modified file 'breezy/tests/test_log.py' |
3352 | --- breezy/tests/test_log.py 2018-05-15 00:26:31 +0000 |
3353 | +++ breezy/tests/test_log.py 2018-06-21 08:27:55 +0000 |
3354 | @@ -1613,12 +1613,12 @@ |
3355 | builder.start_series() |
3356 | builder.build_snapshot(None, [ |
3357 | ('add', ('', 'TREE_ROOT', 'directory', '')),], |
3358 | - revision_id='1') |
3359 | - builder.build_snapshot(['1'], [], revision_id='1.1.1') |
3360 | - builder.build_snapshot(['1'], [], revision_id='2') |
3361 | - builder.build_snapshot(['1.1.1'], [], revision_id='1.2.1') |
3362 | - builder.build_snapshot(['1.1.1', '1.2.1'], [], revision_id='1.1.2') |
3363 | - builder.build_snapshot(['2', '1.1.2'], [], revision_id='3') |
3364 | + revision_id=b'1') |
3365 | + builder.build_snapshot(['1'], [], revision_id=b'1.1.1') |
3366 | + builder.build_snapshot(['1'], [], revision_id=b'2') |
3367 | + builder.build_snapshot(['1.1.1'], [], revision_id=b'1.2.1') |
3368 | + builder.build_snapshot(['1.1.1', '1.2.1'], [], revision_id=b'1.1.2') |
3369 | + builder.build_snapshot(['2', '1.1.2'], [], revision_id=b'3') |
3370 | builder.finish_series() |
3371 | br = builder.get_branch() |
3372 | br.lock_read() |
3373 | |
3374 | === modified file 'breezy/tests/test_matchers.py' |
3375 | --- breezy/tests/test_matchers.py 2018-03-25 00:39:16 +0000 |
3376 | +++ breezy/tests/test_matchers.py 2018-06-21 08:27:55 +0000 |
3377 | @@ -72,10 +72,10 @@ |
3378 | class TestMatchesAncestry(TestCaseWithTransport): |
3379 | |
3380 | def test__str__(self): |
3381 | - matcher = MatchesAncestry("A repository", "arevid") |
3382 | + matcher = MatchesAncestry("A repository", b"arevid") |
3383 | self.assertEqual( |
3384 | "MatchesAncestry(repository='A repository', " |
3385 | - "revision_id='arevid')", |
3386 | + "revision_id=%r)" % (b'arevid', ), |
3387 | str(matcher)) |
3388 | |
3389 | def test_match(self): |
3390 | @@ -90,8 +90,8 @@ |
3391 | self.assertThat([revid1, revid2], m) |
3392 | m = MatchesAncestry(branch.repository, revid1) |
3393 | self.assertThat([revid1], m) |
3394 | - m = MatchesAncestry(branch.repository, "unknown") |
3395 | - self.assertThat(["unknown"], m) |
3396 | + m = MatchesAncestry(branch.repository, b"unknown") |
3397 | + self.assertThat([b"unknown"], m) |
3398 | |
3399 | def test_mismatch(self): |
3400 | b = self.make_branch_builder('.') |
3401 | @@ -104,7 +104,7 @@ |
3402 | mismatch = m.match([]) |
3403 | self.assertIsNot(None, mismatch) |
3404 | self.assertEqual( |
3405 | - "mismatched ancestry for revision '%s' was ['%s'], expected []" % ( |
3406 | + "mismatched ancestry for revision %r was [%r], expected []" % ( |
3407 | revid1, revid1), |
3408 | mismatch.describe()) |
3409 | |
3410 | @@ -112,8 +112,8 @@ |
3411 | class TestHasLayout(TestCaseWithTransport): |
3412 | |
3413 | def test__str__(self): |
3414 | - matcher = HasLayout([("a", "a-id")]) |
3415 | - self.assertEqual("HasLayout([('a', 'a-id')])", str(matcher)) |
3416 | + matcher = HasLayout([(b"a", b"a-id")]) |
3417 | + self.assertEqual("HasLayout(%r)" % ([(b'a', b'a-id')], ), str(matcher)) |
3418 | |
3419 | def test_match(self): |
3420 | t = self.make_branch_and_tree('.') |
3421 | @@ -156,7 +156,7 @@ |
3422 | def test__str__(self): |
3423 | t = self.make_branch_and_tree('.') |
3424 | matcher = HasPathRelations(t, [("a", "b")]) |
3425 | - self.assertEqual("HasPathRelations(%r, [('a', 'b')])" % t, str(matcher)) |
3426 | + self.assertEqual("HasPathRelations(%r, %r)" % (t, [('a', 'b')]), str(matcher)) |
3427 | |
3428 | def test_match(self): |
3429 | t = self.make_branch_and_tree('.') |
3430 | |
3431 | === modified file 'breezy/tests/test_merge.py' |
3432 | --- breezy/tests/test_merge.py 2018-04-01 18:29:45 +0000 |
3433 | +++ breezy/tests/test_merge.py 2018-06-21 08:27:55 +0000 |
3434 | @@ -308,7 +308,7 @@ |
3435 | tree_a.flush() |
3436 | tree_a.rename_one('a', 'b') |
3437 | tree_a.commit('2') |
3438 | - bzrdir_b = tree_a.controldir.sprout('B', revision_id='rev-1') |
3439 | + bzrdir_b = tree_a.controldir.sprout('B', revision_id=b'rev-1') |
3440 | tree_b = bzrdir_b.open_workingtree() |
3441 | tree_b.lock_write() |
3442 | self.addCleanup(tree_b.unlock) |
3443 | @@ -1245,9 +1245,9 @@ |
3444 | builder = self.get_builder() |
3445 | builder.build_snapshot(None, |
3446 | [('add', ('', None, 'directory', None))], |
3447 | - revision_id='A-id' ) |
3448 | - builder.build_snapshot(['A-id'], [], revision_id='C-id') |
3449 | - builder.build_snapshot(['A-id'], [], revision_id='B-id') |
3450 | + revision_id=b'A-id' ) |
3451 | + builder.build_snapshot(['A-id'], [], revision_id=b'C-id') |
3452 | + builder.build_snapshot(['A-id'], [], revision_id=b'B-id') |
3453 | return builder |
3454 | |
3455 | def setup_criss_cross_graph(self): |
3456 | @@ -1261,8 +1261,8 @@ |
3457 | # |X| |
3458 | # D E |
3459 | builder = self.setup_simple_graph() |
3460 | - builder.build_snapshot(['C-id', 'B-id'], [], revision_id='E-id') |
3461 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
3462 | + builder.build_snapshot(['C-id', 'B-id'], [], revision_id=b'E-id') |
3463 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
3464 | return builder |
3465 | |
3466 | def make_Merger(self, builder, other_revision_id, interesting_files=None): |
3467 | @@ -1295,7 +1295,7 @@ |
3468 | def test_cache_trees_with_revision_ids_having_revision_id(self): |
3469 | merger = self.make_Merger(self.setup_simple_graph(), 'C-id') |
3470 | original_cache = dict(merger._cached_trees) |
3471 | - tree = merger.this_branch.repository.revision_tree('B-id') |
3472 | + tree = merger.this_branch.repository.revision_tree(b'B-id') |
3473 | original_cache['B-id'] = tree |
3474 | merger.cache_trees_with_revision_ids([tree]) |
3475 | self.assertEqual(original_cache, merger._cached_trees) |
3476 | @@ -1314,7 +1314,7 @@ |
3477 | self.assertEqual(['B-id', 'C-id'], [t.get_revision_id() |
3478 | for t in merger._lca_trees]) |
3479 | # If we swap the order, we should get a different lca order |
3480 | - builder.build_snapshot(['E-id'], [], revision_id='F-id') |
3481 | + builder.build_snapshot(['E-id'], [], revision_id=b'F-id') |
3482 | merger = self.make_Merger(builder, 'D-id') |
3483 | self.assertEqual(['C-id', 'B-id'], [t.get_revision_id() |
3484 | for t in merger._lca_trees]) |
3485 | @@ -1330,9 +1330,9 @@ |
3486 | # \| |/ |
3487 | # G H |
3488 | builder = self.setup_criss_cross_graph() |
3489 | - builder.build_snapshot(['A-id'], [], revision_id='F-id') |
3490 | - builder.build_snapshot(['E-id', 'F-id'], [], revision_id='H-id') |
3491 | - builder.build_snapshot(['D-id', 'F-id'], [], revision_id='G-id') |
3492 | + builder.build_snapshot(['A-id'], [], revision_id=b'F-id') |
3493 | + builder.build_snapshot(['E-id', 'F-id'], [], revision_id=b'H-id') |
3494 | + builder.build_snapshot(['D-id', 'F-id'], [], revision_id=b'G-id') |
3495 | merger = self.make_Merger(builder, 'H-id') |
3496 | self.assertEqual(['B-id', 'C-id', 'F-id'], |
3497 | [t.get_revision_id() for t in merger._lca_trees]) |
3498 | @@ -1346,12 +1346,12 @@ |
3499 | builder = self.get_builder() |
3500 | builder.build_snapshot(None, |
3501 | [('add', ('', None, 'directory', None))], |
3502 | - revision_id='A-id') |
3503 | + revision_id=b'A-id') |
3504 | builder.build_snapshot([], |
3505 | [('add', ('', None, 'directory', None))], |
3506 | - revision_id='B-id') |
3507 | - builder.build_snapshot(['A-id', 'B-id'], [], revision_id='D-id') |
3508 | - builder.build_snapshot(['A-id', 'B-id'], [], revision_id='C-id') |
3509 | + revision_id=b'B-id') |
3510 | + builder.build_snapshot(['A-id', 'B-id'], [], revision_id=b'D-id') |
3511 | + builder.build_snapshot(['A-id', 'B-id'], [], revision_id=b'C-id') |
3512 | merger = self.make_Merger(builder, 'D-id') |
3513 | self.assertEqual('A-id', merger.base_rev_id) |
3514 | self.assertTrue(merger._is_criss_cross) |
3515 | @@ -1407,19 +1407,19 @@ |
3516 | builder.build_snapshot(None, |
3517 | [('add', (u'', 'a-root-id', 'directory', None)), |
3518 | ('add', (u'a', 'a-id', 'file', 'a\nb\nc\n'))], |
3519 | - revision_id='A-id') |
3520 | + revision_id=b'A-id') |
3521 | builder.build_snapshot(['A-id'], |
3522 | [('modify', ('a', 'a\nb\nC\nc\n'))], |
3523 | - revision_id='C-id') |
3524 | + revision_id=b'C-id') |
3525 | builder.build_snapshot(['A-id'], |
3526 | [('modify', ('a', 'a\nB\nb\nc\n'))], |
3527 | - revision_id='B-id') |
3528 | + revision_id=b'B-id') |
3529 | builder.build_snapshot(['C-id', 'B-id'], |
3530 | [('modify', ('a', 'a\nB\nb\nC\nc\nE\n'))], |
3531 | - revision_id='E-id') |
3532 | + revision_id=b'E-id') |
3533 | builder.build_snapshot(['B-id', 'C-id'], |
3534 | [('modify', ('a', 'a\nB\nb\nC\nc\n'))], |
3535 | - revision_id='D-id', ) |
3536 | + revision_id=b'D-id', ) |
3537 | merge_obj = self.make_merge_obj(builder, 'E-id') |
3538 | |
3539 | self.assertEqual(['B-id', 'C-id'], [t.get_revision_id() |
3540 | @@ -1452,23 +1452,23 @@ |
3541 | builder = self.get_builder() |
3542 | builder.build_snapshot(None, |
3543 | [('add', (u'', 'a-root-id', 'directory', None))], |
3544 | - revision_id='A-id') |
3545 | + revision_id=b'A-id') |
3546 | builder.build_snapshot(['A-id'], |
3547 | [('add', (u'foo', 'foo-id', 'file', 'a\nb\nc\n'))], |
3548 | - revision_id='B-id') |
3549 | + revision_id=b'B-id') |
3550 | builder.build_snapshot(['A-id'], |
3551 | [('add', (u'bar', 'bar-id', 'file', 'd\ne\nf\n'))], |
3552 | - revision_id='C-id') |
3553 | + revision_id=b'C-id') |
3554 | builder.build_snapshot(['B-id', 'C-id'], |
3555 | [('add', (u'bar', 'bar-id', 'file', 'd\ne\nf\n'))], |
3556 | - revision_id='D-id') |
3557 | + revision_id=b'D-id') |
3558 | builder.build_snapshot(['C-id', 'B-id'], |
3559 | [('add', (u'foo', 'foo-id', 'file', 'a\nb\nc\n'))], |
3560 | - revision_id='E-id') |
3561 | + revision_id=b'E-id') |
3562 | builder.build_snapshot(['E-id', 'D-id'], |
3563 | [('modify', (u'bar', 'd\ne\nf\nG\n'))], |
3564 | - revision_id='G-id') |
3565 | - builder.build_snapshot(['D-id', 'E-id'], [], revision_id='F-id') |
3566 | + revision_id=b'G-id') |
3567 | + builder.build_snapshot(['D-id', 'E-id'], [], revision_id=b'F-id') |
3568 | merge_obj = self.make_merge_obj(builder, 'G-id') |
3569 | |
3570 | self.assertEqual(['D-id', 'E-id'], [t.get_revision_id() |
3571 | @@ -1488,19 +1488,19 @@ |
3572 | builder.build_snapshot(None, |
3573 | [('add', (u'', 'a-root-id', 'directory', None)), |
3574 | ('add', (u'a', 'a-id', 'file', 'a\nb\nc\n'))], |
3575 | - revision_id='A-id') |
3576 | + revision_id=b'A-id') |
3577 | builder.build_snapshot(['A-id'], |
3578 | [('modify', ('a', 'a\nB\nb\nc\n'))], |
3579 | - revision_id='B-id') |
3580 | + revision_id=b'B-id') |
3581 | builder.build_snapshot(['A-id'], |
3582 | [('modify', ('a', 'a\nb\nC\nc\n'))], |
3583 | - revision_id='C-id') |
3584 | + revision_id=b'C-id') |
3585 | builder.build_snapshot(['C-id', 'B-id'], |
3586 | [('modify', ('a', 'a\nB\nb\nC\nc\nE\n'))], |
3587 | - revision_id='E-id') |
3588 | + revision_id=b'E-id') |
3589 | builder.build_snapshot(['B-id', 'C-id'], |
3590 | [('unversion', 'a')], |
3591 | - revision_id='D-id') |
3592 | + revision_id=b'D-id') |
3593 | merge_obj = self.make_merge_obj(builder, 'E-id') |
3594 | |
3595 | self.assertEqual(['B-id', 'C-id'], [t.get_revision_id() |
3596 | @@ -1525,16 +1525,16 @@ |
3597 | builder = self.get_builder() |
3598 | builder.build_snapshot(None, |
3599 | [('add', (u'', 'a-root-id', 'directory', None))], |
3600 | - revision_id='A-id') |
3601 | - builder.build_snapshot(['A-id'], [], revision_id='B-id') |
3602 | + revision_id=b'A-id') |
3603 | + builder.build_snapshot(['A-id'], [], revision_id=b'B-id') |
3604 | builder.build_snapshot(['A-id'], |
3605 | [('add', (u'a', 'a-id', 'file', 'a\nb\nc\n'))], |
3606 | - revision_id='C-id') |
3607 | + revision_id=b'C-id') |
3608 | builder.build_snapshot(['C-id', 'B-id'], |
3609 | - [], revision_id='E-id') # Inherited from C |
3610 | + [], revision_id=b'E-id') # Inherited from C |
3611 | builder.build_snapshot(['B-id', 'C-id'], # Merged from C |
3612 | [('add', (u'a', 'a-id', 'file', 'a\nb\nc\n'))], |
3613 | - revision_id='D-id') |
3614 | + revision_id=b'D-id') |
3615 | merge_obj = self.make_merge_obj(builder, 'E-id') |
3616 | |
3617 | self.assertEqual(['B-id', 'C-id'], [t.get_revision_id() |
3618 | @@ -1549,13 +1549,13 @@ |
3619 | builder.build_snapshot(None, |
3620 | [('add', (u'', 'a-root-id', 'directory', None)), |
3621 | ('add', (u'a', 'a-id', 'file', 'a\nb\nc\n'))], |
3622 | - revision_id='A-id') |
3623 | - builder.build_snapshot(['A-id'], [], revision_id='B-id') |
3624 | - builder.build_snapshot(['A-id'], [], revision_id='C-id') |
3625 | + revision_id=b'A-id') |
3626 | + builder.build_snapshot(['A-id'], [], revision_id=b'B-id') |
3627 | + builder.build_snapshot(['A-id'], [], revision_id=b'C-id') |
3628 | builder.build_snapshot( |
3629 | ['C-id', 'B-id'], |
3630 | - [('unversion', 'a')], revision_id='E-id') |
3631 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
3632 | + [('unversion', 'a')], revision_id=b'E-id') |
3633 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
3634 | merge_obj = self.make_merge_obj(builder, 'E-id') |
3635 | |
3636 | entries = list(merge_obj._entries_lca()) |
3637 | @@ -1583,12 +1583,12 @@ |
3638 | builder.build_snapshot(None, |
3639 | [('add', (u'', 'a-root-id', 'directory', None)), |
3640 | ('add', (u'foo', 'foo-id', 'file', 'content\n'))], |
3641 | - revision_id='A-id') |
3642 | - builder.build_snapshot(['A-id'], [], revision_id='B-id') |
3643 | + revision_id=b'A-id') |
3644 | + builder.build_snapshot(['A-id'], [], revision_id=b'B-id') |
3645 | builder.build_snapshot(['A-id'], |
3646 | - [('unversion', 'foo')], revision_id='C-id') |
3647 | - builder.build_snapshot(['C-id', 'B-id'], [], revision_id='E-id') |
3648 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
3649 | + [('unversion', 'foo')], revision_id=b'C-id') |
3650 | + builder.build_snapshot(['C-id', 'B-id'], [], revision_id=b'E-id') |
3651 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
3652 | merge_obj = self.make_merge_obj(builder, 'E-id') |
3653 | |
3654 | entries = list(merge_obj._entries_lca()) |
3655 | @@ -1613,15 +1613,15 @@ |
3656 | builder.build_snapshot(None, |
3657 | [('add', (u'', 'a-root-id', 'directory', None)), |
3658 | ('add', (u'foo', 'foo-id', 'file', 'content\n'))], |
3659 | - revision_id='A-id') |
3660 | + revision_id=b'A-id') |
3661 | builder.build_snapshot(['A-id'], [ |
3662 | ('modify', ('foo', 'new-content\n'))], |
3663 | - revision_id='B-id') |
3664 | + revision_id=b'B-id') |
3665 | builder.build_snapshot(['A-id'], |
3666 | [('unversion', 'foo')], |
3667 | - revision_id='C-id') |
3668 | - builder.build_snapshot(['C-id', 'B-id'], [], revision_id='E-id') |
3669 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
3670 | + revision_id=b'C-id') |
3671 | + builder.build_snapshot(['C-id', 'B-id'], [], revision_id=b'E-id') |
3672 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
3673 | merge_obj = self.make_merge_obj(builder, 'E-id') |
3674 | |
3675 | entries = list(merge_obj._entries_lca()) |
3676 | @@ -1652,15 +1652,15 @@ |
3677 | builder = self.get_builder() |
3678 | builder.build_snapshot(None, |
3679 | [('add', (u'', 'a-root-id', 'directory', None))], |
3680 | - revision_id='A-id') |
3681 | - builder.build_snapshot(['A-id'], [], revision_id='B-id') |
3682 | + revision_id=b'A-id') |
3683 | + builder.build_snapshot(['A-id'], [], revision_id=b'B-id') |
3684 | builder.build_snapshot(['A-id'], |
3685 | [('add', (u'a', 'a-id', 'file', 'a\nb\nc\n'))], |
3686 | - revision_id='C-id') |
3687 | + revision_id=b'C-id') |
3688 | builder.build_snapshot(['C-id', 'B-id'], |
3689 | [('unversion', 'a')], |
3690 | - revision_id='E-id') |
3691 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
3692 | + revision_id=b'E-id') |
3693 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
3694 | merge_obj = self.make_merge_obj(builder, 'E-id') |
3695 | |
3696 | entries = list(merge_obj._entries_lca()) |
3697 | @@ -1670,13 +1670,13 @@ |
3698 | builder = self.get_builder() |
3699 | builder.build_snapshot(None, |
3700 | [('add', (u'', 'a-root-id', 'directory', None))], |
3701 | - revision_id='A-id') |
3702 | - builder.build_snapshot(['A-id'], [], revision_id='B-id') |
3703 | - builder.build_snapshot(['A-id'], [], revision_id='C-id') |
3704 | + revision_id=b'A-id') |
3705 | + builder.build_snapshot(['A-id'], [], revision_id=b'B-id') |
3706 | + builder.build_snapshot(['A-id'], [], revision_id=b'C-id') |
3707 | builder.build_snapshot(['C-id', 'B-id'], |
3708 | [('add', (u'a', 'a-id', 'file', 'a\nb\nc\n'))], |
3709 | - revision_id='E-id') |
3710 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
3711 | + revision_id=b'E-id') |
3712 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
3713 | merge_obj = self.make_merge_obj(builder, 'E-id') |
3714 | |
3715 | entries = list(merge_obj._entries_lca()) |
3716 | @@ -1706,19 +1706,19 @@ |
3717 | builder.build_snapshot(None, |
3718 | [('add', (u'', 'a-root-id', 'directory', None)), |
3719 | ('add', (u'foo', 'foo-id', 'file', 'A content\n'))], |
3720 | - revision_id='A-id') |
3721 | - builder.build_snapshot(['A-id'], [], revision_id='C-id') |
3722 | + revision_id=b'A-id') |
3723 | + builder.build_snapshot(['A-id'], [], revision_id=b'C-id') |
3724 | builder.build_snapshot(['A-id'], |
3725 | [('modify', ('foo', 'B content\n'))], |
3726 | - revision_id='B-id') |
3727 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
3728 | + revision_id=b'B-id') |
3729 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
3730 | builder.build_snapshot(['C-id', 'B-id'], |
3731 | [('modify', ('foo', 'E content\n'))], |
3732 | - revision_id='E-id') |
3733 | - builder.build_snapshot(['E-id', 'D-id'], [], revision_id='G-id') |
3734 | + revision_id=b'E-id') |
3735 | + builder.build_snapshot(['E-id', 'D-id'], [], revision_id=b'G-id') |
3736 | builder.build_snapshot(['D-id', 'E-id'], |
3737 | [('modify', ('foo', 'F content\n'))], |
3738 | - revision_id='F-id') |
3739 | + revision_id=b'F-id') |
3740 | merge_obj = self.make_merge_obj(builder, 'G-id') |
3741 | |
3742 | self.assertEqual([], list(merge_obj._entries_lca())) |
3743 | @@ -1756,21 +1756,21 @@ |
3744 | builder.build_snapshot(None, |
3745 | [('add', (u'', 'a-root-id', 'directory', None)), |
3746 | ('add', (u'foo', 'foo-id', 'file', 'A content\n'))], |
3747 | - revision_id='A-id') |
3748 | - builder.build_snapshot(['A-id'], [], revision_id='C-id') |
3749 | + revision_id=b'A-id') |
3750 | + builder.build_snapshot(['A-id'], [], revision_id=b'C-id') |
3751 | builder.build_snapshot(['A-id'], |
3752 | [('rename', ('foo', 'bar'))], |
3753 | - revision_id='B-id') |
3754 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
3755 | + revision_id=b'B-id') |
3756 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
3757 | builder.build_snapshot(['C-id', 'B-id'], |
3758 | [('rename', ('foo', 'bing'))], |
3759 | - revision_id='E-id') # override to bing |
3760 | + revision_id=b'E-id') # override to bing |
3761 | builder.build_snapshot(['E-id', 'D-id'], |
3762 | [('rename', ('bing', 'barry'))], |
3763 | - revision_id='G-id') # override to barry |
3764 | + revision_id=b'G-id') # override to barry |
3765 | builder.build_snapshot(['D-id', 'E-id'], |
3766 | [('rename', ('bar', 'bing'))], |
3767 | - revision_id='F-id') # Merge in E's change |
3768 | + revision_id=b'F-id') # Merge in E's change |
3769 | merge_obj = self.make_merge_obj(builder, 'G-id') |
3770 | |
3771 | self.expectFailure("We don't do an actual heads() check on lca values," |
3772 | @@ -1794,19 +1794,19 @@ |
3773 | builder.build_snapshot(None, |
3774 | [('add', (u'', 'a-root-id', 'directory', None)), |
3775 | ('add', (u'foo', 'foo-id', 'file', 'A content\n'))], |
3776 | - revision_id='A-id') |
3777 | - builder.build_snapshot(['A-id'], [], revision_id='C-id') |
3778 | + revision_id=b'A-id') |
3779 | + builder.build_snapshot(['A-id'], [], revision_id=b'C-id') |
3780 | builder.build_snapshot(['A-id'], |
3781 | [('rename', ('foo', 'bar'))], |
3782 | - revision_id='B-id') |
3783 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
3784 | - builder.build_snapshot(['C-id', 'B-id'], [], revision_id='E-id') |
3785 | + revision_id=b'B-id') |
3786 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
3787 | + builder.build_snapshot(['C-id', 'B-id'], [], revision_id=b'E-id') |
3788 | builder.build_snapshot(['E-id', 'D-id'], |
3789 | [('rename', ('foo', 'bar'))], |
3790 | - revision_id='G-id') |
3791 | + revision_id=b'G-id') |
3792 | builder.build_snapshot(['D-id', 'E-id'], |
3793 | [('rename', ('bar', 'bing'))], |
3794 | - revision_id='F-id') # should end up conflicting |
3795 | + revision_id=b'F-id') # should end up conflicting |
3796 | merge_obj = self.make_merge_obj(builder, 'G-id') |
3797 | |
3798 | entries = list(merge_obj._entries_lca()) |
3799 | @@ -1831,15 +1831,15 @@ |
3800 | builder.build_snapshot(None, |
3801 | [('add', (u'', 'a-root-id', 'directory', None)), |
3802 | ('add', (u'foo', 'foo-id', 'file', 'A content\n'))], |
3803 | - revision_id='A-id') |
3804 | + revision_id=b'A-id') |
3805 | builder.build_snapshot(['A-id'], |
3806 | [('modify', ('foo', 'B content\n'))], |
3807 | - revision_id='B-id') |
3808 | + revision_id=b'B-id') |
3809 | builder.build_snapshot(['A-id'], |
3810 | [('modify', ('foo', 'C content\n'))], |
3811 | - revision_id='C-id') |
3812 | - builder.build_snapshot(['C-id', 'B-id'], [], revision_id='E-id') |
3813 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
3814 | + revision_id=b'C-id') |
3815 | + builder.build_snapshot(['C-id', 'B-id'], [], revision_id=b'E-id') |
3816 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
3817 | merge_obj = self.make_merge_obj(builder, 'E-id') |
3818 | |
3819 | entries = list(merge_obj._entries_lca()) |
3820 | @@ -1866,18 +1866,18 @@ |
3821 | builder.build_snapshot(None, |
3822 | [('add', (u'', 'a-root-id', 'directory', None)), |
3823 | ('add', (u'foo', 'foo-id', 'file', 'A content\n'))], |
3824 | - revision_id='A-id') |
3825 | + revision_id=b'A-id') |
3826 | builder.build_snapshot(['A-id'], |
3827 | [('modify', ('foo', 'B content\n'))], |
3828 | - revision_id='B-id') |
3829 | + revision_id=b'B-id') |
3830 | builder.build_snapshot(['A-id'], |
3831 | [('modify', ('foo', 'C content\n'))], |
3832 | - revision_id='C-id', ) |
3833 | - builder.build_snapshot(['C-id', 'B-id'], [], revision_id='E-id') |
3834 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
3835 | + revision_id=b'C-id', ) |
3836 | + builder.build_snapshot(['C-id', 'B-id'], [], revision_id=b'E-id') |
3837 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
3838 | builder.build_snapshot(['D-id'], |
3839 | [('modify', ('foo', 'F content\n'))], |
3840 | - revision_id='F-id') |
3841 | + revision_id=b'F-id') |
3842 | merge_obj = self.make_merge_obj(builder, 'E-id') |
3843 | |
3844 | entries = list(merge_obj._entries_lca()) |
3845 | @@ -1907,20 +1907,20 @@ |
3846 | builder.build_snapshot(None, |
3847 | [('add', (u'', 'a-root-id', 'directory', None)), |
3848 | ('add', (u'foo', 'foo-id', 'file', 'A content\n'))], |
3849 | - revision_id='A-id') |
3850 | + revision_id=b'A-id') |
3851 | builder.build_snapshot(['A-id'], |
3852 | [('modify', ('foo', 'B content\n'))], |
3853 | - revision_id='B-id') |
3854 | + revision_id=b'B-id') |
3855 | builder.build_snapshot(['A-id'], |
3856 | [('modify', ('foo', 'C content\n'))], |
3857 | - revision_id='C-id') |
3858 | - builder.build_snapshot(['C-id', 'B-id'], [], revision_id='E-id') |
3859 | + revision_id=b'C-id') |
3860 | + builder.build_snapshot(['C-id', 'B-id'], [], revision_id=b'E-id') |
3861 | builder.build_snapshot(['B-id', 'C-id'], |
3862 | [('modify', ('foo', 'C content\n'))], |
3863 | - revision_id='D-id') # Same as E |
3864 | + revision_id=b'D-id') # Same as E |
3865 | builder.build_snapshot(['D-id'], |
3866 | [('modify', ('foo', 'F content\n'))], |
3867 | - revision_id='F-id') |
3868 | + revision_id=b'F-id') |
3869 | merge_obj = self.make_merge_obj(builder, 'E-id') |
3870 | |
3871 | entries = list(merge_obj._entries_lca()) |
3872 | @@ -1933,13 +1933,13 @@ |
3873 | builder.build_snapshot(None, |
3874 | [('add', (u'', 'a-root-id', 'directory', None)), |
3875 | ('add', (u'a', 'a-id', 'file', 'content\n'))], |
3876 | - revision_id='A-id') |
3877 | - builder.build_snapshot(['A-id'], [], revision_id='B-id') |
3878 | - builder.build_snapshot(['A-id'], [], revision_id='C-id') |
3879 | + revision_id=b'A-id') |
3880 | + builder.build_snapshot(['A-id'], [], revision_id=b'B-id') |
3881 | + builder.build_snapshot(['A-id'], [], revision_id=b'C-id') |
3882 | builder.build_snapshot(['C-id', 'B-id'], |
3883 | [('rename', (u'a', u'b'))], |
3884 | - revision_id='E-id') |
3885 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
3886 | + revision_id=b'E-id') |
3887 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
3888 | merge_obj = self.make_merge_obj(builder, 'E-id') |
3889 | entries = list(merge_obj._entries_lca()) |
3890 | root_id = 'a-root-id' |
3891 | @@ -1957,15 +1957,15 @@ |
3892 | builder.build_snapshot(None, |
3893 | [('add', (u'', 'a-root-id', 'directory', None)), |
3894 | ('add', (u'a', 'a-id', 'file', 'content\n'))], |
3895 | - revision_id='A-id') |
3896 | - builder.build_snapshot(['A-id'], [], revision_id='B-id') |
3897 | - builder.build_snapshot(['A-id'], [], revision_id='C-id') |
3898 | + revision_id=b'A-id') |
3899 | + builder.build_snapshot(['A-id'], [], revision_id=b'B-id') |
3900 | + builder.build_snapshot(['A-id'], [], revision_id=b'C-id') |
3901 | builder.build_snapshot(['C-id', 'B-id'], |
3902 | [('unversion', 'a'), |
3903 | ('flush', None), |
3904 | ('add', (u'a', 'a-id', 'directory', None))], |
3905 | - revision_id='E-id') |
3906 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
3907 | + revision_id=b'E-id') |
3908 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
3909 | merge_obj = self.make_merge_obj(builder, 'E-id') |
3910 | entries = list(merge_obj._entries_lca()) |
3911 | root_id = 'a-root-id' |
3912 | @@ -1983,15 +1983,15 @@ |
3913 | builder.build_snapshot(None, |
3914 | [('add', (u'', 'a-root-id', 'directory', None)), |
3915 | ('add', (u'a', 'a-id', 'file', 'content\n'))], |
3916 | - revision_id='A-id') |
3917 | - builder.build_snapshot(['A-id'], [], revision_id='B-id') |
3918 | - builder.build_snapshot(['A-id'], [], revision_id='C-id') |
3919 | - builder.build_snapshot(['C-id', 'B-id'], [], revision_id='E-id') |
3920 | + revision_id=b'A-id') |
3921 | + builder.build_snapshot(['A-id'], [], revision_id=b'B-id') |
3922 | + builder.build_snapshot(['A-id'], [], revision_id=b'C-id') |
3923 | + builder.build_snapshot(['C-id', 'B-id'], [], revision_id=b'E-id') |
3924 | builder.build_snapshot(['B-id', 'C-id'], |
3925 | [('unversion', 'a'), |
3926 | ('flush', None), |
3927 | ('add', (u'a', 'a-id', 'directory', None))], |
3928 | - revision_id='D-id') |
3929 | + revision_id=b'D-id') |
3930 | merge_obj = self.make_merge_obj(builder, 'E-id') |
3931 | entries = list(merge_obj._entries_lca()) |
3932 | # Only the kind was changed (content) |
3933 | @@ -2004,14 +2004,14 @@ |
3934 | [('add', (u'', 'a-root-id', 'directory', None)), |
3935 | ('add', (u'a', 'a-id', 'file', 'content\n')), |
3936 | ('add', (u'b', 'b-id', 'file', 'content\n'))], |
3937 | - revision_id='A-id') |
3938 | - builder.build_snapshot(['A-id'], [], revision_id='B-id') |
3939 | - builder.build_snapshot(['A-id'], [], revision_id='C-id') |
3940 | + revision_id=b'A-id') |
3941 | + builder.build_snapshot(['A-id'], [], revision_id=b'B-id') |
3942 | + builder.build_snapshot(['A-id'], [], revision_id=b'C-id') |
3943 | builder.build_snapshot(['C-id', 'B-id'], |
3944 | [('modify', ('a', 'new-content\n')), |
3945 | ('modify', ('b', 'new-content\n'))], |
3946 | - revision_id='E-id') |
3947 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
3948 | + revision_id=b'E-id') |
3949 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
3950 | merge_obj = self.make_merge_obj(builder, 'E-id', |
3951 | interesting_files=['b']) |
3952 | entries = list(merge_obj._entries_lca()) |
3953 | @@ -2030,16 +2030,16 @@ |
3954 | [('add', (u'', 'a-root-id', 'directory', None)), |
3955 | ('add', (u'a', 'a-id', 'file', 'content\n')), |
3956 | ('add', (u'b', 'b-id', 'file', 'content\n'))], |
3957 | - revision_id='A-id') |
3958 | - builder.build_snapshot(['A-id'], [], revision_id='B-id') |
3959 | - builder.build_snapshot(['A-id'], [], revision_id='C-id') |
3960 | + revision_id=b'A-id') |
3961 | + builder.build_snapshot(['A-id'], [], revision_id=b'B-id') |
3962 | + builder.build_snapshot(['A-id'], [], revision_id=b'C-id') |
3963 | builder.build_snapshot(['C-id', 'B-id'], |
3964 | [('modify', ('a', 'new-content\n')), |
3965 | ('modify', ('b', 'new-content\n'))], |
3966 | - revision_id='E-id') |
3967 | + revision_id=b'E-id') |
3968 | builder.build_snapshot(['B-id', 'C-id'], |
3969 | [('rename', ('b', 'c'))], |
3970 | - revision_id='D-id') |
3971 | + revision_id=b'D-id') |
3972 | merge_obj = self.make_merge_obj(builder, 'E-id', |
3973 | interesting_files=['c']) |
3974 | entries = list(merge_obj._entries_lca()) |
3975 | @@ -2058,18 +2058,18 @@ |
3976 | [('add', (u'', 'a-root-id', 'directory', None)), |
3977 | ('add', (u'a', 'a-id', 'file', 'content\n')), |
3978 | ('add', (u'c', 'c-id', 'file', 'content\n'))], |
3979 | - revision_id='A-id') |
3980 | - builder.build_snapshot(['A-id'], |
3981 | - [('rename', ('c', 'b'))], |
3982 | - revision_id='B-id') |
3983 | - builder.build_snapshot(['A-id'], |
3984 | - [('rename', ('c', 'b'))], |
3985 | - revision_id='C-id') |
3986 | + revision_id=b'A-id') |
3987 | + builder.build_snapshot(['A-id'], |
3988 | + [('rename', ('c', 'b'))], |
3989 | + revision_id=b'B-id') |
3990 | + builder.build_snapshot(['A-id'], |
3991 | + [('rename', ('c', 'b'))], |
3992 | + revision_id=b'C-id') |
3993 | builder.build_snapshot(['C-id', 'B-id'], |
3994 | [('modify', ('a', 'new-content\n')), |
3995 | ('modify', ('b', 'new-content\n'))], |
3996 | - revision_id='E-id') |
3997 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
3998 | + revision_id=b'E-id') |
3999 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
4000 | merge_obj = self.make_merge_obj(builder, 'E-id', |
4001 | interesting_files=['c']) |
4002 | entries = list(merge_obj._entries_lca()) |
4003 | @@ -2088,16 +2088,16 @@ |
4004 | [('add', (u'', 'a-root-id', 'directory', None)), |
4005 | ('add', (u'a', 'a-id', 'file', 'content\n')), |
4006 | ('add', (u'b', 'b-id', 'file', 'content\n'))], |
4007 | - revision_id='A-id') |
4008 | + revision_id=b'A-id') |
4009 | builder.build_snapshot(['A-id'], |
4010 | - [('rename', ('b', 'c'))], revision_id='B-id') |
4011 | - builder.build_snapshot(['A-id'], [], revision_id='C-id') |
4012 | + [('rename', ('b', 'c'))], revision_id=b'B-id') |
4013 | + builder.build_snapshot(['A-id'], [], revision_id=b'C-id') |
4014 | builder.build_snapshot(['C-id', 'B-id'], |
4015 | [('modify', ('a', 'new-content\n')), |
4016 | ('modify', ('b', 'new-content\n'))], |
4017 | - revision_id='E-id') |
4018 | + revision_id=b'E-id') |
4019 | builder.build_snapshot(['B-id', 'C-id'], |
4020 | - [('rename', ('c', 'b'))], revision_id='D-id') |
4021 | + [('rename', ('c', 'b'))], revision_id=b'D-id') |
4022 | merge_obj = self.make_merge_obj(builder, 'E-id', |
4023 | interesting_files=['c']) |
4024 | entries = list(merge_obj._entries_lca()) |
4025 | @@ -2116,13 +2116,13 @@ |
4026 | [('add', (u'', 'a-root-id', 'directory', None)), |
4027 | ('add', (u'a', 'a-id', 'file', 'content\n')), |
4028 | ('add', (u'b', 'b-id', 'file', 'content\n'))], |
4029 | - revision_id='A-id') |
4030 | - builder.build_snapshot(['A-id'], [], revision_id='B-id') |
4031 | - builder.build_snapshot(['A-id'], [], revision_id='C-id') |
4032 | + revision_id=b'A-id') |
4033 | + builder.build_snapshot(['A-id'], [], revision_id=b'B-id') |
4034 | + builder.build_snapshot(['A-id'], [], revision_id=b'C-id') |
4035 | builder.build_snapshot(['C-id', 'B-id'], |
4036 | [('modify', ('a', 'new-content\n')), |
4037 | - ('modify', ('b', 'new-content\n'))], revision_id='E-id') |
4038 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
4039 | + ('modify', ('b', 'new-content\n'))], revision_id=b'E-id') |
4040 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
4041 | merge_obj = self.make_merge_obj(builder, 'E-id', |
4042 | interesting_files=['b']) |
4043 | entries = list(merge_obj._entries_lca()) |
4044 | @@ -2169,13 +2169,13 @@ |
4045 | builder.build_snapshot(None, |
4046 | [('add', (u'', 'a-root-id', 'directory', None)), |
4047 | ('add', (u'a', 'a-id', 'file', 'a\nb\nc\n'))], |
4048 | - revision_id='A-id') |
4049 | - builder.build_snapshot(['A-id'], [], revision_id='C-id') |
4050 | - builder.build_snapshot(['A-id'], [], revision_id='B-id') |
4051 | - builder.build_snapshot(['C-id', 'B-id'], [], revision_id='E-id') |
4052 | + revision_id=b'A-id') |
4053 | + builder.build_snapshot(['A-id'], [], revision_id=b'C-id') |
4054 | + builder.build_snapshot(['A-id'], [], revision_id=b'B-id') |
4055 | + builder.build_snapshot(['C-id', 'B-id'], [], revision_id=b'E-id') |
4056 | builder.build_snapshot(['B-id', 'C-id'], |
4057 | [('modify', ('a', 'a\nb\nc\nd\ne\nf\n'))], |
4058 | - revision_id='D-id') |
4059 | + revision_id=b'D-id') |
4060 | wt, conflicts = self.do_merge(builder, 'E-id') |
4061 | self.assertEqual(0, conflicts) |
4062 | # The merge should have simply update the contents of 'a' |
4063 | @@ -2197,15 +2197,15 @@ |
4064 | builder.build_snapshot(None, |
4065 | [('add', (u'', 'a-root-id', 'directory', None)), |
4066 | ('add', (u'foo', 'foo-id', 'file', 'a\nb\nc\n'))], |
4067 | - revision_id='A-id') |
4068 | - builder.build_snapshot(['A-id'], [], revision_id='C-id') |
4069 | + revision_id=b'A-id') |
4070 | + builder.build_snapshot(['A-id'], [], revision_id=b'C-id') |
4071 | builder.build_snapshot(['A-id'], |
4072 | - [('rename', ('foo', 'bar'))], revision_id='B-id', ) |
4073 | + [('rename', ('foo', 'bar'))], revision_id=b'B-id', ) |
4074 | builder.build_snapshot(['C-id', 'B-id'], # merge the rename |
4075 | - [('rename', ('foo', 'bar'))], revision_id='E-id') |
4076 | + [('rename', ('foo', 'bar'))], revision_id=b'E-id') |
4077 | builder.build_snapshot(['E-id'], |
4078 | - [('rename', ('bar', 'baz'))], revision_id='F-id') |
4079 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
4080 | + [('rename', ('bar', 'baz'))], revision_id=b'F-id') |
4081 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
4082 | wt, conflicts = self.do_merge(builder, 'F-id') |
4083 | self.assertEqual(0, conflicts) |
4084 | # The merge should simply recognize that the final rename takes |
4085 | @@ -2228,15 +2228,15 @@ |
4086 | builder.build_snapshot(None, |
4087 | [('add', (u'', 'a-root-id', 'directory', None)), |
4088 | ('add', (u'foo', 'foo-id', 'file', 'a\nb\nc\n'))], |
4089 | - revision_id='A-id') |
4090 | - builder.build_snapshot(['A-id'], [], revision_id='C-id') |
4091 | + revision_id=b'A-id') |
4092 | + builder.build_snapshot(['A-id'], [], revision_id=b'C-id') |
4093 | builder.build_snapshot(['A-id'], |
4094 | - [('rename', ('foo', 'bar'))], revision_id='B-id') |
4095 | + [('rename', ('foo', 'bar'))], revision_id=b'B-id') |
4096 | builder.build_snapshot(['C-id', 'B-id'], # merge the rename |
4097 | - [('rename', ('foo', 'bar'))], revision_id='E-id') |
4098 | + [('rename', ('foo', 'bar'))], revision_id=b'E-id') |
4099 | builder.build_snapshot(['E-id'], |
4100 | - [('unversion', 'bar')], revision_id='F-id') |
4101 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
4102 | + [('unversion', 'bar')], revision_id=b'F-id') |
4103 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
4104 | wt, conflicts = self.do_merge(builder, 'F-id') |
4105 | self.assertEqual(0, conflicts) |
4106 | self.assertRaises(errors.NoSuchId, wt.id2path, 'foo-id') |
4107 | @@ -2255,11 +2255,11 @@ |
4108 | builder.build_snapshot(None, |
4109 | [('add', (u'', 'a-root-id', 'directory', None)), |
4110 | ('add', (u'foo', 'foo-id', 'file', 'a\nb\nc\n'))], |
4111 | - revision_id='A-id') |
4112 | - builder.build_snapshot(['A-id'], [], revision_id='C-id') |
4113 | - builder.build_snapshot(['A-id'], [], revision_id='B-id') |
4114 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
4115 | - builder.build_snapshot(['C-id', 'B-id'], [], revision_id='E-id') |
4116 | + revision_id=b'A-id') |
4117 | + builder.build_snapshot(['A-id'], [], revision_id=b'C-id') |
4118 | + builder.build_snapshot(['A-id'], [], revision_id=b'B-id') |
4119 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
4120 | + builder.build_snapshot(['C-id', 'B-id'], [], revision_id=b'E-id') |
4121 | # Have to use a real WT, because BranchBuilder doesn't support exec bit |
4122 | wt = self.get_wt_from_builder(builder) |
4123 | tt = transform.TreeTransform(wt) |
4124 | @@ -2296,11 +2296,11 @@ |
4125 | builder = self.get_builder() |
4126 | builder.build_snapshot(None, |
4127 | [('add', (u'', 'a-root-id', 'directory', None))], |
4128 | - revision_id='A-id') |
4129 | - builder.build_snapshot(['A-id'], [], revision_id='C-id') |
4130 | - builder.build_snapshot(['A-id'], [], revision_id='B-id') |
4131 | - builder.build_snapshot(['B-id', 'C-id'], [], revision_id='D-id') |
4132 | - builder.build_snapshot(['C-id', 'B-id'], [], revision_id='E-id') |
4133 | + revision_id=b'A-id') |
4134 | + builder.build_snapshot(['A-id'], [], revision_id=b'C-id') |
4135 | + builder.build_snapshot(['A-id'], [], revision_id=b'B-id') |
4136 | + builder.build_snapshot(['B-id', 'C-id'], [], revision_id=b'D-id') |
4137 | + builder.build_snapshot(['C-id', 'B-id'], [], revision_id=b'E-id') |
4138 | # Have to use a real WT, because BranchBuilder doesn't support exec bit |
4139 | wt = self.get_wt_from_builder(builder) |
4140 | os.symlink('bar', 'path/foo') |
4141 | @@ -2331,17 +2331,17 @@ |
4142 | builder.build_snapshot(None, |
4143 | [('add', (u'', 'a-root-id', 'directory', None)), |
4144 | ('add', (u'foo', 'foo-id', 'file', 'A content\n'))], |
4145 | - revision_id='A-id') |
4146 | + revision_id=b'A-id') |
4147 | builder.build_snapshot(['A-id'], |
4148 | [('modify', ('foo', 'B content\n'))], |
4149 | - revision_id='B-id') |
4150 | + revision_id=b'B-id') |
4151 | builder.build_snapshot(['A-id'], |
4152 | [('modify', ('foo', 'C content\n'))], |
4153 | - revision_id='C-id') |
4154 | + revision_id=b'C-id') |
4155 | builder.build_snapshot(['C-id', 'B-id'], [], |
4156 | - revision_id='E-id') |
4157 | + revision_id=b'E-id') |
4158 | builder.build_snapshot(['B-id', 'C-id'], [], |
4159 | - revision_id='D-id') |
4160 | + revision_id=b'D-id') |
4161 | wt, conflicts = self.do_merge(builder, 'E-id') |
4162 | self.assertEqual(1, conflicts) |
4163 | self.assertEqualDiff('<<<<<<< TREE\n' |
4164 | @@ -2703,19 +2703,19 @@ |
4165 | [('add', (u'', 'a-root-id', 'directory', None)), |
4166 | ('add', (u'a', 'a-id', 'file', 'base content\n')), |
4167 | ('add', (u'foo', 'foo-id', 'file', 'base content\n'))], |
4168 | - revision_id='A-id') |
4169 | + revision_id=b'A-id') |
4170 | builder.build_snapshot(['A-id'], |
4171 | [('modify', ('foo', 'B content\n'))], |
4172 | - revision_id='B-id') |
4173 | + revision_id=b'B-id') |
4174 | builder.build_snapshot(['A-id'], |
4175 | [('rename', ('a', 'b'))], |
4176 | - revision_id='C-id') |
4177 | + revision_id=b'C-id') |
4178 | builder.build_snapshot(['C-id', 'B-id'], |
4179 | [('rename', ('b', 'c')), |
4180 | ('modify', ('foo', 'E content\n'))], |
4181 | - revision_id='E-id') |
4182 | + revision_id=b'E-id') |
4183 | builder.build_snapshot(['B-id', 'C-id'], |
4184 | - [('rename', ('a', 'b'))], revision_id='D-id') # merged change |
4185 | + [('rename', ('a', 'b'))], revision_id=b'D-id') # merged change |
4186 | wt_this = self.get_wt_from_builder(builder) |
4187 | wt_base = wt_this.controldir.sprout('base', 'A-id').open_workingtree() |
4188 | wt_base.lock_read() |
4189 | |
4190 | === modified file 'breezy/tests/test_merge_core.py' |
4191 | --- breezy/tests/test_merge_core.py 2018-03-26 00:54:10 +0000 |
4192 | +++ breezy/tests/test_merge_core.py 2018-06-21 08:27:55 +0000 |
4193 | @@ -526,17 +526,17 @@ |
4194 | # attributes like 'executable' in A. |
4195 | builder.build_snapshot(None, [ |
4196 | ('add', ('', 'TREE_ROOT', 'directory', None))], |
4197 | - revision_id='A-id') |
4198 | - builder.build_snapshot(['A-id'], [], revision_id='B-id') |
4199 | + revision_id=b'A-id') |
4200 | + builder.build_snapshot(['A-id'], [], revision_id=b'B-id') |
4201 | builder.build_snapshot(['A-id'], [ |
4202 | ('add', ('foo', 'foo-id', 'file', 'orig\ncontents\n'))], |
4203 | - revision_id='C-id') |
4204 | + revision_id=b'C-id') |
4205 | builder.build_snapshot(['B-id', 'C-id'], [ |
4206 | ('add', ('foo', 'foo-id', 'file', 'orig\ncontents\nand D\n'))], |
4207 | - revision_id='D-id') |
4208 | + revision_id=b'D-id') |
4209 | builder.build_snapshot(['C-id', 'B-id'], [ |
4210 | ('modify', ('foo', 'orig\ncontents\nand E\n'))], |
4211 | - revision_id='E-id') |
4212 | + revision_id=b'E-id') |
4213 | builder.finish_series() |
4214 | tree = builder.get_branch().create_checkout('tree', lightweight=True) |
4215 | self.assertEqual(1, tree.merge_from_branch(tree.branch, |
4216 | |
4217 | === modified file 'breezy/tests/test_merge_directive.py' |
4218 | --- breezy/tests/test_merge_directive.py 2018-02-18 15:21:06 +0000 |
4219 | +++ breezy/tests/test_merge_directive.py 2018-06-21 08:27:55 +0000 |
4220 | @@ -278,7 +278,7 @@ |
4221 | |
4222 | def make_merge_directive(self, revision_id, testament_sha1, time, timezone, |
4223 | target_branch, patch=None, patch_type=None, |
4224 | - source_branch=None, message=None, base_revision_id='null:'): |
4225 | + source_branch=None, message=None, base_revision_id=b'null:'): |
4226 | if patch_type == 'bundle': |
4227 | bundle = patch |
4228 | patch = None |
4229 | @@ -639,7 +639,7 @@ |
4230 | |
4231 | def make_merge_directive(self, revision_id, testament_sha1, time, timezone, |
4232 | target_branch, patch=None, patch_type=None, |
4233 | - source_branch=None, message=None, base_revision_id='null:'): |
4234 | + source_branch=None, message=None, base_revision_id=b'null:'): |
4235 | if patch_type == 'bundle': |
4236 | bundle = patch |
4237 | patch = None |
4238 | @@ -657,7 +657,7 @@ |
4239 | self.assertEqual(b'rev1', md.base_revision_id) |
4240 | md = self.from_objects(tree_a.branch.repository, b'rev2a', 500, 60, |
4241 | tree_b.branch.base, patch_type='bundle', |
4242 | - public_branch=tree_a.branch.base, base_revision_id='null:') |
4243 | + public_branch=tree_a.branch.base, base_revision_id=b'null:') |
4244 | self.assertEqual('null:', md.base_revision_id) |
4245 | lines = md.to_lines() |
4246 | md2 = merge_directive.MergeDirective.from_lines(lines) |
4247 | |
4248 | === modified file 'breezy/tests/test_reconfigure.py' |
4249 | --- breezy/tests/test_reconfigure.py 2018-05-13 02:18:13 +0000 |
4250 | +++ breezy/tests/test_reconfigure.py 2018-06-21 08:27:55 +0000 |
4251 | @@ -92,9 +92,9 @@ |
4252 | checkout_branch = checkout.controldir.open_branch() |
4253 | self.assertEqual(checkout_branch.controldir.root_transport.base, |
4254 | checkout.controldir.root_transport.base) |
4255 | - self.assertEqual('rev1', checkout_branch.last_revision()) |
4256 | + self.assertEqual(b'rev1', checkout_branch.last_revision()) |
4257 | repo = checkout.controldir.open_repository() |
4258 | - repo.get_revision('rev1') |
4259 | + repo.get_revision(b'rev1') |
4260 | |
4261 | def test_lightweight_checkout_to_branch_tags(self): |
4262 | reconfiguration, checkout = \ |
4263 | @@ -245,7 +245,7 @@ |
4264 | wt = checkout.controldir.open_workingtree() |
4265 | self.assertTrue(parent.repository.has_same_location( |
4266 | wt.branch.repository)) |
4267 | - parent.repository.get_revision('new-commit') |
4268 | + parent.repository.get_revision(b'new-commit') |
4269 | self.assertRaises(errors.NoRepositoryPresent, |
4270 | checkout.controldir.open_repository) |
4271 | |
4272 | @@ -267,7 +267,7 @@ |
4273 | wt = child.controldir.open_workingtree() |
4274 | self.assertTrue(parent.repository.has_same_location( |
4275 | wt.branch.repository)) |
4276 | - parent.repository.get_revision('new-commit') |
4277 | + parent.repository.get_revision(b'new-commit') |
4278 | self.assertRaises(errors.NoRepositoryPresent, |
4279 | child.controldir.open_repository) |
4280 | |
4281 | @@ -335,7 +335,7 @@ |
4282 | reconfiguration.apply() |
4283 | tree = workingtree.WorkingTree.open('root/tree') |
4284 | self.assertTrue(repo.has_same_location(tree.branch.repository)) |
4285 | - self.assertEqual('Hello', repo.get_revision('hello-id').message) |
4286 | + self.assertEqual('Hello', repo.get_revision(b'hello-id').message) |
4287 | |
4288 | def add_dead_head(self, tree): |
4289 | revno, revision_id = tree.branch.last_revision_info() |
4290 | @@ -352,7 +352,7 @@ |
4291 | reconfiguration = reconfigure.Reconfigure.to_use_shared(tree.controldir) |
4292 | reconfiguration.apply() |
4293 | tree = workingtree.WorkingTree.open('root/tree') |
4294 | - message = repo.get_revision('dead-head-id').message |
4295 | + message = repo.get_revision(b'dead-head-id').message |
4296 | self.assertEqual('Dead head', message) |
4297 | |
4298 | def make_repository_tree(self): |
4299 | @@ -375,7 +375,7 @@ |
4300 | repo = tree.branch.repository |
4301 | self.assertEqual(repo.controldir.root_transport.base, |
4302 | tree.controldir.root_transport.base) |
4303 | - self.assertEqual('Hello', repo.get_revision('hello-id').message) |
4304 | + self.assertEqual('Hello', repo.get_revision(b'hello-id').message) |
4305 | |
4306 | def test_use_shared_to_standalone_preserves_dead_heads(self): |
4307 | tree = self.make_repository_tree() |
4308 | |
4309 | === modified file 'breezy/tests/test_repository.py' |
4310 | --- breezy/tests/test_repository.py 2018-03-26 00:54:10 +0000 |
4311 | +++ breezy/tests/test_repository.py 2018-06-21 08:27:55 +0000 |
4312 | @@ -501,7 +501,7 @@ |
4313 | format.repository_format = knitrepo.RepositoryFormatKnit1() |
4314 | tree = self.make_branch_and_tree('.', format) |
4315 | tree.commit("Dull commit", rev_id="dull") |
4316 | - revision_tree = tree.branch.repository.revision_tree('dull') |
4317 | + revision_tree = tree.branch.repository.revision_tree(b'dull') |
4318 | revision_tree.lock_read() |
4319 | try: |
4320 | self.assertRaises(errors.NoSuchFile, revision_tree.get_file_lines, |
4321 | @@ -512,14 +512,14 @@ |
4322 | format.repository_format = knitrepo.RepositoryFormatKnit3() |
4323 | upgrade.Convert('.', format) |
4324 | tree = workingtree.WorkingTree.open('.') |
4325 | - revision_tree = tree.branch.repository.revision_tree('dull') |
4326 | + revision_tree = tree.branch.repository.revision_tree(b'dull') |
4327 | revision_tree.lock_read() |
4328 | try: |
4329 | revision_tree.get_file_lines(u'', revision_tree.get_root_id()) |
4330 | finally: |
4331 | revision_tree.unlock() |
4332 | tree.commit("Another dull commit", rev_id=b'dull2') |
4333 | - revision_tree = tree.branch.repository.revision_tree('dull2') |
4334 | + revision_tree = tree.branch.repository.revision_tree(b'dull2') |
4335 | revision_tree.lock_read() |
4336 | self.addCleanup(revision_tree.unlock) |
4337 | self.assertEqual('dull', |
4338 | @@ -555,7 +555,7 @@ |
4339 | builder.build_snapshot(None, [ |
4340 | ('add', ('', b'root-id', 'directory', '')), |
4341 | ('add', ('file', b'file-id', 'file', b'content\n'))], |
4342 | - revision_id='1') |
4343 | + revision_id=b'1') |
4344 | builder.build_snapshot([b'1'], [ |
4345 | ('modify', ('file', b'content-2\n'))], |
4346 | revision_id=b'2') |
4347 | @@ -834,7 +834,7 @@ |
4348 | self.builder.start_series() |
4349 | self.builder.build_snapshot(None, |
4350 | [('add', ('', 'tree-root', 'directory', None))], |
4351 | - revision_id='initial') |
4352 | + revision_id=b'initial') |
4353 | self.repo = self.builder.get_branch().repository |
4354 | self.addCleanup(self.builder.finish_series) |
4355 | |
4356 | @@ -843,15 +843,15 @@ |
4357 | sorted(self.repo._find_parent_ids_of_revisions(rev_set))) |
4358 | |
4359 | def test_simple(self): |
4360 | - self.builder.build_snapshot(None, [], revision_id='revid1') |
4361 | - self.builder.build_snapshot(['revid1'], [], revision_id='revid2') |
4362 | + self.builder.build_snapshot(None, [], revision_id=b'revid1') |
4363 | + self.builder.build_snapshot(['revid1'], [], revision_id=b'revid2') |
4364 | rev_set = ['revid2'] |
4365 | self.assertParentIds(['revid1'], rev_set) |
4366 | |
4367 | def test_not_first_parent(self): |
4368 | - self.builder.build_snapshot(None, [], revision_id='revid1') |
4369 | - self.builder.build_snapshot(['revid1'], [], revision_id='revid2') |
4370 | - self.builder.build_snapshot(['revid2'], [], revision_id='revid3') |
4371 | + self.builder.build_snapshot(None, [], revision_id=b'revid1') |
4372 | + self.builder.build_snapshot(['revid1'], [], revision_id=b'revid2') |
4373 | + self.builder.build_snapshot(['revid2'], [], revision_id=b'revid3') |
4374 | rev_set = ['revid3', 'revid2'] |
4375 | self.assertParentIds(['revid1'], rev_set) |
4376 | |
4377 | @@ -860,27 +860,27 @@ |
4378 | self.assertParentIds([], rev_set) |
4379 | |
4380 | def test_not_null_set(self): |
4381 | - self.builder.build_snapshot(None, [], revision_id='revid1') |
4382 | + self.builder.build_snapshot(None, [], revision_id=b'revid1') |
4383 | rev_set = [_mod_revision.NULL_REVISION] |
4384 | self.assertParentIds([], rev_set) |
4385 | |
4386 | def test_ghost(self): |
4387 | - self.builder.build_snapshot(None, [], revision_id='revid1') |
4388 | + self.builder.build_snapshot(None, [], revision_id=b'revid1') |
4389 | rev_set = ['ghost', 'revid1'] |
4390 | self.assertParentIds(['initial'], rev_set) |
4391 | |
4392 | def test_ghost_parent(self): |
4393 | - self.builder.build_snapshot(None, [], revision_id='revid1') |
4394 | - self.builder.build_snapshot(['revid1', 'ghost'], [], revision_id='revid2') |
4395 | + self.builder.build_snapshot(None, [], revision_id=b'revid1') |
4396 | + self.builder.build_snapshot(['revid1', 'ghost'], [], revision_id=b'revid2') |
4397 | rev_set = ['revid2', 'revid1'] |
4398 | self.assertParentIds(['ghost', 'initial'], rev_set) |
4399 | |
4400 | def test_righthand_parent(self): |
4401 | - self.builder.build_snapshot(None, [], revision_id='revid1') |
4402 | - self.builder.build_snapshot(['revid1'], [], revision_id='revid2a') |
4403 | - self.builder.build_snapshot(['revid1'], [], revision_id='revid2b') |
4404 | + self.builder.build_snapshot(None, [], revision_id=b'revid1') |
4405 | + self.builder.build_snapshot(['revid1'], [], revision_id=b'revid2a') |
4406 | + self.builder.build_snapshot(['revid1'], [], revision_id=b'revid2b') |
4407 | self.builder.build_snapshot(['revid2a', 'revid2b'], [], |
4408 | - revision_id='revid3') |
4409 | + revision_id=b'revid3') |
4410 | rev_set = ['revid3', 'revid2a'] |
4411 | self.assertParentIds(['revid1', 'revid2b'], rev_set) |
4412 | |
4413 | @@ -900,7 +900,7 @@ |
4414 | repo.start_write_group() |
4415 | cleanups.append(repo.commit_write_group) |
4416 | # make rev1a: A well-formed revision, containing 'file1' |
4417 | - inv = inventory.Inventory(revision_id='rev1a') |
4418 | + inv = inventory.Inventory(revision_id=b'rev1a') |
4419 | inv.root.revision = 'rev1a' |
4420 | self.add_file(repo, inv, 'file1', 'rev1a', []) |
4421 | repo.texts.add_lines((inv.root.file_id, 'rev1a'), [], []) |
4422 | @@ -912,7 +912,7 @@ |
4423 | |
4424 | # make rev1b, which has no Revision, but has an Inventory, and |
4425 | # file1 |
4426 | - inv = inventory.Inventory(revision_id='rev1b') |
4427 | + inv = inventory.Inventory(revision_id=b'rev1b') |
4428 | inv.root.revision = 'rev1b' |
4429 | self.add_file(repo, inv, 'file1', 'rev1b', []) |
4430 | repo.add_inventory('rev1b', inv, []) |
4431 | @@ -1475,16 +1475,16 @@ |
4432 | builder.build_snapshot(None, [ |
4433 | ('add', ('', 'root-id', 'directory', None)), |
4434 | ('add', ('f', 'f-id', 'file', 'content\n'))], |
4435 | - revision_id='A') |
4436 | + revision_id=b'A') |
4437 | builder.build_snapshot(['A'], |
4438 | [('modify', ('f', 'new-content\n'))], |
4439 | - revision_id='B') |
4440 | + revision_id=b'B') |
4441 | builder.build_snapshot(['B'], |
4442 | [('modify', ('f', 'third-content\n'))], |
4443 | - revision_id='C') |
4444 | + revision_id=b'C') |
4445 | builder.build_snapshot(['C'], |
4446 | [('modify', ('f', 'fourth-content\n'))], |
4447 | - revision_id='D') |
4448 | + revision_id=b'D') |
4449 | b = builder.get_branch() |
4450 | b.lock_read() |
4451 | builder.finish_series() |
4452 | @@ -1532,13 +1532,13 @@ |
4453 | builder.build_snapshot(None, [ |
4454 | ('add', ('', 'root-id', 'directory', None)), |
4455 | ('add', ('file', 'file-id', 'file', 'content\n')), |
4456 | - ], revision_id='A') |
4457 | + ], revision_id=b'A') |
4458 | builder.build_snapshot(['A'], [ |
4459 | ('add', ('dir', 'dir-id', 'directory', None))], |
4460 | - revision_id='B') |
4461 | + revision_id=b'B') |
4462 | builder.build_snapshot(['B'], [ |
4463 | ('modify', ('file', 'new content\n'))], |
4464 | - revision_id='C') |
4465 | + revision_id=b'C') |
4466 | builder.finish_series() |
4467 | return builder.get_branch() |
4468 | |
4469 | @@ -1554,7 +1554,7 @@ |
4470 | pack_name_with_rev_C_content) |
4471 | """ |
4472 | b_source = self.make_abc_branch() |
4473 | - b_base = b_source.controldir.sprout('base', revision_id='A').open_branch() |
4474 | + b_base = b_source.controldir.sprout('base', revision_id=b'A').open_branch() |
4475 | b_stacked = b_base.controldir.sprout('stacked', stacked=True).open_branch() |
4476 | b_stacked.lock_write() |
4477 | self.addCleanup(b_stacked.unlock) |
4478 | |
4479 | === modified file 'breezy/tests/test_revert.py' |
4480 | --- breezy/tests/test_revert.py 2018-03-25 00:39:16 +0000 |
4481 | +++ breezy/tests/test_revert.py 2018-06-21 08:27:55 +0000 |
4482 | @@ -128,7 +128,7 @@ |
4483 | os.unlink('file') |
4484 | tree.commit('removed file') |
4485 | self.assertPathDoesNotExist('file') |
4486 | - tree.revert(old_tree=tree.branch.repository.revision_tree('rev1')) |
4487 | + tree.revert(old_tree=tree.branch.repository.revision_tree(b'rev1')) |
4488 | self.assertPathExists('file') |
4489 | tree.revert() |
4490 | self.assertPathDoesNotExist('file') |
4491 | |
4492 | === modified file 'breezy/tests/test_revision.py' |
4493 | --- breezy/tests/test_revision.py 2017-11-12 13:53:51 +0000 |
4494 | +++ breezy/tests/test_revision.py 2018-06-21 08:27:55 +0000 |
4495 | @@ -165,18 +165,18 @@ |
4496 | # indicator. i.e. NULL_REVISION |
4497 | # RBC 20060608 |
4498 | tree = self.make_branch_and_tree('.') |
4499 | - tree.commit('1', rev_id = '1', allow_pointless=True) |
4500 | - tree.commit('2', rev_id = '2', allow_pointless=True) |
4501 | - tree.commit('3', rev_id = '3', allow_pointless=True) |
4502 | - rev = tree.branch.repository.get_revision('1') |
4503 | - history = rev.get_history(tree.branch.repository) |
4504 | - self.assertEqual([None, '1'], history) |
4505 | - rev = tree.branch.repository.get_revision('2') |
4506 | - history = rev.get_history(tree.branch.repository) |
4507 | - self.assertEqual([None, '1', '2'], history) |
4508 | - rev = tree.branch.repository.get_revision('3') |
4509 | - history = rev.get_history(tree.branch.repository) |
4510 | - self.assertEqual([None, '1', '2', '3'], history) |
4511 | + tree.commit('1', rev_id=b'1', allow_pointless=True) |
4512 | + tree.commit('2', rev_id=b'2', allow_pointless=True) |
4513 | + tree.commit('3', rev_id=b'3', allow_pointless=True) |
4514 | + rev = tree.branch.repository.get_revision(b'1') |
4515 | + history = rev.get_history(tree.branch.repository) |
4516 | + self.assertEqual([None, b'1'], history) |
4517 | + rev = tree.branch.repository.get_revision(b'2') |
4518 | + history = rev.get_history(tree.branch.repository) |
4519 | + self.assertEqual([None, b'1', b'2'], history) |
4520 | + rev = tree.branch.repository.get_revision(b'3') |
4521 | + history = rev.get_history(tree.branch.repository) |
4522 | + self.assertEqual([None, b'1', b'2', b'3'], history) |
4523 | |
4524 | |
4525 | class TestReservedId(TestCase): |
4526 | |
4527 | === modified file 'breezy/tests/test_revisionspec.py' |
4528 | --- breezy/tests/test_revisionspec.py 2018-02-18 15:21:06 +0000 |
4529 | +++ breezy/tests/test_revisionspec.py 2018-06-21 08:27:55 +0000 |
4530 | @@ -151,14 +151,14 @@ |
4531 | # covers that well for us |
4532 | def test_dwim_spec_revno(self): |
4533 | self.assertInHistoryIs(2, 'r2', '2') |
4534 | - self.assertAsRevisionId('alt_r2', '1.1.1') |
4535 | + self.assertAsRevisionId(b'alt_r2', '1.1.1') |
4536 | |
4537 | def test_dwim_spec_revid(self): |
4538 | self.assertInHistoryIs(2, 'r2', 'r2') |
4539 | |
4540 | def test_dwim_spec_tag(self): |
4541 | self.tree.branch.tags.set_tag('footag', 'r1') |
4542 | - self.assertAsRevisionId('r1', 'footag') |
4543 | + self.assertAsRevisionId(b'r1', 'footag') |
4544 | self.tree.branch.tags.delete_tag('footag') |
4545 | self.assertRaises(errors.InvalidRevisionSpec, |
4546 | self.get_in_history, 'footag') |
4547 | @@ -168,14 +168,14 @@ |
4548 | # but aren't. Tags are convenient for testing this since we can |
4549 | # make them look however we want. |
4550 | self.tree.branch.tags.set_tag('3', 'r2') |
4551 | - self.assertAsRevisionId('r2', '3') |
4552 | + self.assertAsRevisionId(b'r2', '3') |
4553 | self.build_tree(['tree/b']) |
4554 | self.tree.add(['b']) |
4555 | self.tree.commit('b', rev_id=b'r3') |
4556 | - self.assertAsRevisionId('r3', '3') |
4557 | + self.assertAsRevisionId(b'r3', '3') |
4558 | |
4559 | def test_dwim_spec_date(self): |
4560 | - self.assertAsRevisionId('r1', 'today') |
4561 | + self.assertAsRevisionId(b'r1', 'today') |
4562 | |
4563 | def test_dwim_spec_branch(self): |
4564 | self.assertInHistoryIs(None, 'alt_r2', 'tree2') |
4565 | @@ -194,7 +194,7 @@ |
4566 | RevisionSpec_dwim._possible_revspecs = original_dwim_revspecs |
4567 | self.addCleanup(reset_dwim_revspecs) |
4568 | RevisionSpec_dwim.append_possible_revspec(RevisionSpec_bork) |
4569 | - self.assertAsRevisionId('r1', 'bork') |
4570 | + self.assertAsRevisionId(b'r1', 'bork') |
4571 | |
4572 | def test_append_lazy_dwim_revspec(self): |
4573 | original_dwim_revspecs = list(RevisionSpec_dwim._possible_revspecs) |
4574 | @@ -203,7 +203,7 @@ |
4575 | self.addCleanup(reset_dwim_revspecs) |
4576 | RevisionSpec_dwim.append_possible_lazy_revspec( |
4577 | "breezy.tests.test_revisionspec", "RevisionSpec_bork") |
4578 | - self.assertAsRevisionId('r1', 'bork') |
4579 | + self.assertAsRevisionId(b'r1', 'bork') |
4580 | |
4581 | |
4582 | class TestRevisionSpec_revno(TestRevisionSpec): |
4583 | @@ -341,26 +341,26 @@ |
4584 | spec_in_history('revno:2:b/', None)) |
4585 | |
4586 | def test_as_revision_id(self): |
4587 | - self.assertAsRevisionId('null:', '0') |
4588 | - self.assertAsRevisionId('r1', '1') |
4589 | - self.assertAsRevisionId('r2', '2') |
4590 | - self.assertAsRevisionId('r1', '-2') |
4591 | - self.assertAsRevisionId('r2', '-1') |
4592 | - self.assertAsRevisionId('alt_r2', '1.1.1') |
4593 | + self.assertAsRevisionId(b'null:', '0') |
4594 | + self.assertAsRevisionId(b'r1', '1') |
4595 | + self.assertAsRevisionId(b'r2', '2') |
4596 | + self.assertAsRevisionId(b'r1', '-2') |
4597 | + self.assertAsRevisionId(b'r2', '-1') |
4598 | + self.assertAsRevisionId(b'alt_r2', '1.1.1') |
4599 | |
4600 | def test_as_tree(self): |
4601 | tree = self.get_as_tree('0') |
4602 | self.assertEqual(_mod_revision.NULL_REVISION, tree.get_revision_id()) |
4603 | tree = self.get_as_tree('1') |
4604 | - self.assertEqual('r1', tree.get_revision_id()) |
4605 | + self.assertEqual(b'r1', tree.get_revision_id()) |
4606 | tree = self.get_as_tree('2') |
4607 | - self.assertEqual('r2', tree.get_revision_id()) |
4608 | + self.assertEqual(b'r2', tree.get_revision_id()) |
4609 | tree = self.get_as_tree('-2') |
4610 | - self.assertEqual('r1', tree.get_revision_id()) |
4611 | + self.assertEqual(b'r1', tree.get_revision_id()) |
4612 | tree = self.get_as_tree('-1') |
4613 | - self.assertEqual('r2', tree.get_revision_id()) |
4614 | + self.assertEqual(b'r2', tree.get_revision_id()) |
4615 | tree = self.get_as_tree('1.1.1') |
4616 | - self.assertEqual('alt_r2', tree.get_revision_id()) |
4617 | + self.assertEqual(b'alt_r2', tree.get_revision_id()) |
4618 | |
4619 | |
4620 | class TestRevisionSpec_revid(TestRevisionSpec): |
4621 | @@ -368,15 +368,15 @@ |
4622 | def test_in_history(self): |
4623 | # We should be able to access revisions that are directly |
4624 | # in the history. |
4625 | - self.assertInHistoryIs(1, 'r1', 'revid:r1') |
4626 | - self.assertInHistoryIs(2, 'r2', 'revid:r2') |
4627 | + self.assertInHistoryIs(1, b'r1', 'revid:r1') |
4628 | + self.assertInHistoryIs(2, b'r2', 'revid:r2') |
4629 | |
4630 | def test_missing(self): |
4631 | self.assertInvalid('revid:r3', invalid_as_revision_id=False) |
4632 | |
4633 | def test_merged(self): |
4634 | """We can reach revisions in the ancestry""" |
4635 | - self.assertInHistoryIs(None, 'alt_r2', 'revid:alt_r2') |
4636 | + self.assertInHistoryIs(None, b'alt_r2', 'revid:alt_r2') |
4637 | |
4638 | def test_not_here(self): |
4639 | self.tree2.commit('alt third', rev_id=b'alt_r3') |
4640 | @@ -387,31 +387,31 @@ |
4641 | """We can get any revision id in the repository""" |
4642 | # XXX: This may change in the future, but for now, it is true |
4643 | self.tree2.commit('alt third', rev_id=b'alt_r3') |
4644 | - self.tree.branch.fetch(self.tree2.branch, 'alt_r3') |
4645 | - self.assertInHistoryIs(None, 'alt_r3', 'revid:alt_r3') |
4646 | + self.tree.branch.fetch(self.tree2.branch, b'alt_r3') |
4647 | + self.assertInHistoryIs(None, b'alt_r3', 'revid:alt_r3') |
4648 | |
4649 | def test_unicode(self): |
4650 | """We correctly convert a unicode ui string to an encoded revid.""" |
4651 | revision_id = u'\N{SNOWMAN}'.encode('utf-8') |
4652 | self.tree.commit('unicode', rev_id=revision_id) |
4653 | self.assertInHistoryIs(3, revision_id, u'revid:\N{SNOWMAN}') |
4654 | - self.assertInHistoryIs(3, revision_id, 'revid:' + revision_id) |
4655 | + self.assertInHistoryIs(3, revision_id, b'revid:' + revision_id) |
4656 | |
4657 | def test_as_revision_id(self): |
4658 | - self.assertAsRevisionId('r1', 'revid:r1') |
4659 | - self.assertAsRevisionId('r2', 'revid:r2') |
4660 | - self.assertAsRevisionId('alt_r2', 'revid:alt_r2') |
4661 | + self.assertAsRevisionId(b'r1', 'revid:r1') |
4662 | + self.assertAsRevisionId(b'r2', 'revid:r2') |
4663 | + self.assertAsRevisionId(b'alt_r2', 'revid:alt_r2') |
4664 | |
4665 | |
4666 | class TestRevisionSpec_last(TestRevisionSpec): |
4667 | |
4668 | def test_positive(self): |
4669 | - self.assertInHistoryIs(2, 'r2', 'last:1') |
4670 | - self.assertInHistoryIs(1, 'r1', 'last:2') |
4671 | - self.assertInHistoryIs(0, 'null:', 'last:3') |
4672 | + self.assertInHistoryIs(2, b'r2', 'last:1') |
4673 | + self.assertInHistoryIs(1, b'r1', 'last:2') |
4674 | + self.assertInHistoryIs(0, b'null:', 'last:3') |
4675 | |
4676 | def test_empty(self): |
4677 | - self.assertInHistoryIs(2, 'r2', 'last:') |
4678 | + self.assertInHistoryIs(2, b'r2', 'last:') |
4679 | |
4680 | def test_negative(self): |
4681 | self.assertInvalid('last:-1', |
4682 | @@ -434,44 +434,44 @@ |
4683 | self.assertInvalid('last:Y', extra='\n' + str(e)) |
4684 | |
4685 | def test_as_revision_id(self): |
4686 | - self.assertAsRevisionId('r2', 'last:1') |
4687 | - self.assertAsRevisionId('r1', 'last:2') |
4688 | + self.assertAsRevisionId(b'r2', 'last:1') |
4689 | + self.assertAsRevisionId(b'r1', 'last:2') |
4690 | |
4691 | |
4692 | class TestRevisionSpec_before(TestRevisionSpec): |
4693 | |
4694 | def test_int(self): |
4695 | - self.assertInHistoryIs(1, 'r1', 'before:2') |
4696 | - self.assertInHistoryIs(1, 'r1', 'before:-1') |
4697 | + self.assertInHistoryIs(1, b'r1', 'before:2') |
4698 | + self.assertInHistoryIs(1, b'r1', 'before:-1') |
4699 | |
4700 | def test_before_one(self): |
4701 | - self.assertInHistoryIs(0, 'null:', 'before:1') |
4702 | + self.assertInHistoryIs(0, b'null:', 'before:1') |
4703 | |
4704 | def test_before_none(self): |
4705 | self.assertInvalid('before:0', |
4706 | extra='\ncannot go before the null: revision') |
4707 | |
4708 | def test_revid(self): |
4709 | - self.assertInHistoryIs(1, 'r1', 'before:revid:r2') |
4710 | + self.assertInHistoryIs(1, b'r1', 'before:revid:r2') |
4711 | |
4712 | def test_last(self): |
4713 | - self.assertInHistoryIs(1, 'r1', 'before:last:1') |
4714 | + self.assertInHistoryIs(1, b'r1', 'before:last:1') |
4715 | |
4716 | def test_alt_revid(self): |
4717 | # This will grab the left-most ancestor for alternate histories |
4718 | - self.assertInHistoryIs(1, 'r1', 'before:revid:alt_r2') |
4719 | + self.assertInHistoryIs(1, b'r1', 'before:revid:alt_r2') |
4720 | |
4721 | def test_alt_no_parents(self): |
4722 | new_tree = self.make_branch_and_tree('new_tree') |
4723 | new_tree.commit('first', rev_id=b'new_r1') |
4724 | self.tree.branch.fetch(new_tree.branch, 'new_r1') |
4725 | - self.assertInHistoryIs(0, 'null:', 'before:revid:new_r1') |
4726 | + self.assertInHistoryIs(0, b'null:', 'before:revid:new_r1') |
4727 | |
4728 | def test_as_revision_id(self): |
4729 | - self.assertAsRevisionId('r1', 'before:revid:r2') |
4730 | - self.assertAsRevisionId('r1', 'before:2') |
4731 | - self.assertAsRevisionId('r1', 'before:1.1.1') |
4732 | - self.assertAsRevisionId('r1', 'before:revid:alt_r2') |
4733 | + self.assertAsRevisionId(b'r1', 'before:revid:r2') |
4734 | + self.assertAsRevisionId(b'r1', 'before:2') |
4735 | + self.assertAsRevisionId(b'r1', 'before:1.1.1') |
4736 | + self.assertAsRevisionId(b'r1', 'before:revid:alt_r2') |
4737 | |
4738 | |
4739 | class TestRevisionSpec_tag(TestRevisionSpec): |
4740 | @@ -487,10 +487,10 @@ |
4741 | self.assertEqual(spec.spec, 'bzr-0.14') |
4742 | |
4743 | def test_lookup_tag(self): |
4744 | - self.tree.branch.tags.set_tag('bzr-0.14', 'r1') |
4745 | - self.assertInHistoryIs(1, 'r1', 'tag:bzr-0.14') |
4746 | - self.tree.branch.tags.set_tag('null_rev', 'null:') |
4747 | - self.assertInHistoryIs(0, 'null:', 'tag:null_rev') |
4748 | + self.tree.branch.tags.set_tag('bzr-0.14', b'r1') |
4749 | + self.assertInHistoryIs(1, b'r1', 'tag:bzr-0.14') |
4750 | + self.tree.branch.tags.set_tag('null_rev', b'null:') |
4751 | + self.assertInHistoryIs(0, b'null:', 'tag:null_rev') |
4752 | |
4753 | def test_failed_lookup(self): |
4754 | # tags that don't exist give a specific message: arguably we should |
4755 | @@ -500,11 +500,11 @@ |
4756 | 'tag:some-random-tag') |
4757 | |
4758 | def test_as_revision_id(self): |
4759 | - self.tree.branch.tags.set_tag('my-tag', 'r2') |
4760 | - self.tree.branch.tags.set_tag('null_rev', 'null:') |
4761 | - self.assertAsRevisionId('r2', 'tag:my-tag') |
4762 | - self.assertAsRevisionId('null:', 'tag:null_rev') |
4763 | - self.assertAsRevisionId('r1', 'before:tag:my-tag') |
4764 | + self.tree.branch.tags.set_tag('my-tag', b'r2') |
4765 | + self.tree.branch.tags.set_tag('null_rev', b'null:') |
4766 | + self.assertAsRevisionId(b'r2', 'tag:my-tag') |
4767 | + self.assertAsRevisionId(b'null:', 'tag:null_rev') |
4768 | + self.assertAsRevisionId(b'r1', 'before:tag:my-tag') |
4769 | |
4770 | |
4771 | class TestRevisionSpec_date(TestRevisionSpec): |
4772 | @@ -524,11 +524,11 @@ |
4773 | self.assertInvalid('date:tomorrow') |
4774 | |
4775 | def test_today(self): |
4776 | - self.assertInHistoryIs(2, 'new_r2', 'date:today') |
4777 | - self.assertInHistoryIs(1, 'new_r1', 'before:date:today') |
4778 | + self.assertInHistoryIs(2, b'new_r2', 'date:today') |
4779 | + self.assertInHistoryIs(1, b'new_r1', 'before:date:today') |
4780 | |
4781 | def test_yesterday(self): |
4782 | - self.assertInHistoryIs(1, 'new_r1', 'date:yesterday') |
4783 | + self.assertInHistoryIs(1, b'new_r1', 'date:yesterday') |
4784 | |
4785 | def test_invalid(self): |
4786 | self.assertInvalid('date:foobar', extra='\ninvalid date') |
4787 | @@ -539,11 +539,11 @@ |
4788 | |
4789 | def test_day(self): |
4790 | now = datetime.datetime.now() |
4791 | - self.assertInHistoryIs(2, 'new_r2', |
4792 | + self.assertInHistoryIs(2, b'new_r2', |
4793 | 'date:%04d-%02d-%02d' % (now.year, now.month, now.day)) |
4794 | |
4795 | def test_as_revision_id(self): |
4796 | - self.assertAsRevisionId('new_r2', 'date:today') |
4797 | + self.assertAsRevisionId(b'new_r2', 'date:today') |
4798 | |
4799 | |
4800 | class TestRevisionSpec_ancestor(TestRevisionSpec): |
4801 | @@ -556,16 +556,16 @@ |
4802 | |
4803 | def test_simple(self): |
4804 | # Common ancestor of trees is 'alt_r2' |
4805 | - self.assertInHistoryIs(None, 'alt_r2', 'ancestor:tree2') |
4806 | + self.assertInHistoryIs(None, b'alt_r2', 'ancestor:tree2') |
4807 | |
4808 | # Going the other way, we get a valid revno |
4809 | tmp = self.tree |
4810 | self.tree = self.tree2 |
4811 | self.tree2 = tmp |
4812 | - self.assertInHistoryIs(2, 'alt_r2', 'ancestor:tree') |
4813 | + self.assertInHistoryIs(2, b'alt_r2', 'ancestor:tree') |
4814 | |
4815 | def test_self(self): |
4816 | - self.assertInHistoryIs(2, 'r2', 'ancestor:tree') |
4817 | + self.assertInHistoryIs(2, b'r2', 'ancestor:tree') |
4818 | |
4819 | def test_unrelated(self): |
4820 | new_tree = self.make_branch_and_tree('new_tree') |
4821 | @@ -589,7 +589,7 @@ |
4822 | new_tree.branch) |
4823 | |
4824 | def test_as_revision_id(self): |
4825 | - self.assertAsRevisionId('alt_r2', 'ancestor:tree2') |
4826 | + self.assertAsRevisionId(b'alt_r2', 'ancestor:tree2') |
4827 | |
4828 | def test_default(self): |
4829 | # We don't have a parent to default to |
4830 | @@ -600,7 +600,7 @@ |
4831 | tree3 = self.tree.controldir.sprout('tree3').open_workingtree() |
4832 | tree3.commit('foo', rev_id=b'r3') |
4833 | self.tree = tree3 |
4834 | - self.assertInHistoryIs(2, 'r2', 'ancestor:') |
4835 | + self.assertInHistoryIs(2, b'r2', 'ancestor:') |
4836 | |
4837 | |
4838 | class TestRevisionSpec_branch(TestRevisionSpec): |
4839 | @@ -612,10 +612,10 @@ |
4840 | self.get_in_history, 'branch:tree2/a') |
4841 | |
4842 | def test_simple(self): |
4843 | - self.assertInHistoryIs(None, 'alt_r2', 'branch:tree2') |
4844 | + self.assertInHistoryIs(None, b'alt_r2', 'branch:tree2') |
4845 | |
4846 | def test_self(self): |
4847 | - self.assertInHistoryIs(2, 'r2', 'branch:tree') |
4848 | + self.assertInHistoryIs(2, b'r2', 'branch:tree') |
4849 | |
4850 | def test_unrelated(self): |
4851 | new_tree = self.make_branch_and_tree('new_tree') |
4852 | @@ -624,12 +624,12 @@ |
4853 | new_tree.commit('Commit two', rev_id=b'new_r2') |
4854 | new_tree.commit('Commit three', rev_id=b'new_r3') |
4855 | |
4856 | - self.assertInHistoryIs(None, 'new_r3', 'branch:new_tree') |
4857 | + self.assertInHistoryIs(None, b'new_r3', 'branch:new_tree') |
4858 | |
4859 | # XXX: Right now, we use fetch() to make sure the remote revisions |
4860 | # have been pulled into the local branch. We may change that |
4861 | # behavior in the future. |
4862 | - self.assertTrue(self.tree.branch.repository.has_revision('new_r3')) |
4863 | + self.assertTrue(self.tree.branch.repository.has_revision(b'new_r3')) |
4864 | |
4865 | def test_no_commits(self): |
4866 | new_tree = self.make_branch_and_tree('new_tree') |
4867 | @@ -639,12 +639,12 @@ |
4868 | self.get_as_tree, 'branch:new_tree') |
4869 | |
4870 | def test_as_revision_id(self): |
4871 | - self.assertAsRevisionId('alt_r2', 'branch:tree2') |
4872 | + self.assertAsRevisionId(b'alt_r2', 'branch:tree2') |
4873 | |
4874 | def test_as_tree(self): |
4875 | tree = self.get_as_tree('branch:tree', self.tree2) |
4876 | - self.assertEqual('r2', tree.get_revision_id()) |
4877 | - self.assertFalse(self.tree2.branch.repository.has_revision('r2')) |
4878 | + self.assertEqual(b'r2', tree.get_revision_id()) |
4879 | + self.assertFalse(self.tree2.branch.repository.has_revision(b'r2')) |
4880 | |
4881 | |
4882 | class TestRevisionSpec_submit(TestRevisionSpec): |
4883 | @@ -654,25 +654,25 @@ |
4884 | self.assertRaises(errors.NoSubmitBranch, self.get_in_history, |
4885 | 'submit:') |
4886 | self.tree.branch.set_parent('../tree2') |
4887 | - self.assertInHistoryIs(None, 'alt_r2', 'submit:') |
4888 | + self.assertInHistoryIs(None, b'alt_r2', 'submit:') |
4889 | self.tree.branch.set_parent('bogus') |
4890 | self.assertRaises(errors.NotBranchError, self.get_in_history, |
4891 | 'submit:') |
4892 | # submit branch overrides parent branch |
4893 | self.tree.branch.set_submit_branch('tree2') |
4894 | - self.assertInHistoryIs(None, 'alt_r2', 'submit:') |
4895 | + self.assertInHistoryIs(None, b'alt_r2', 'submit:') |
4896 | |
4897 | def test_as_revision_id(self): |
4898 | self.tree.branch.set_submit_branch('tree2') |
4899 | - self.assertAsRevisionId('alt_r2', 'branch:tree2') |
4900 | + self.assertAsRevisionId(b'alt_r2', 'branch:tree2') |
4901 | |
4902 | |
4903 | class TestRevisionSpec_mainline(TestRevisionSpec): |
4904 | |
4905 | def test_as_revision_id(self): |
4906 | - self.assertAsRevisionId('r1', 'mainline:1') |
4907 | - self.assertAsRevisionId('r2', 'mainline:1.1.1') |
4908 | - self.assertAsRevisionId('r2', 'mainline:revid:alt_r2') |
4909 | + self.assertAsRevisionId(b'r1', 'mainline:1') |
4910 | + self.assertAsRevisionId(b'r2', 'mainline:1.1.1') |
4911 | + self.assertAsRevisionId(b'r2', 'mainline:revid:alt_r2') |
4912 | spec = RevisionSpec.from_string('mainline:revid:alt_r22') |
4913 | e = self.assertRaises(errors.InvalidRevisionSpec, |
4914 | spec.as_revision_id, self.tree.branch) |
4915 | @@ -681,7 +681,7 @@ |
4916 | " branch: ") |
4917 | |
4918 | def test_in_history(self): |
4919 | - self.assertInHistoryIs(2, 'r2', 'mainline:revid:alt_r2') |
4920 | + self.assertInHistoryIs(2, b'r2', 'mainline:revid:alt_r2') |
4921 | |
4922 | |
4923 | class TestRevisionSpec_annotate(TestRevisionSpec): |
4924 | @@ -697,10 +697,10 @@ |
4925 | self.build_tree_contents([('annotate-tree/file1', b'2\n1\n3\n')]) |
4926 | |
4927 | def test_as_revision_id_r1(self): |
4928 | - self.assertAsRevisionId('r1', 'annotate:annotate-tree/file1:2') |
4929 | + self.assertAsRevisionId(b'r1', 'annotate:annotate-tree/file1:2') |
4930 | |
4931 | def test_as_revision_id_r2(self): |
4932 | - self.assertAsRevisionId('r2', 'annotate:annotate-tree/file1:1') |
4933 | + self.assertAsRevisionId(b'r2', 'annotate:annotate-tree/file1:1') |
4934 | |
4935 | def test_as_revision_id_uncommitted(self): |
4936 | spec = RevisionSpec.from_string('annotate:annotate-tree/file1:3') |
4937 | |
4938 | === modified file 'breezy/tests/test_smart.py' |
4939 | --- breezy/tests/test_smart.py 2018-05-19 17:31:48 +0000 |
4940 | +++ breezy/tests/test_smart.py 2018-06-21 08:27:55 +0000 |
4941 | @@ -121,9 +121,9 @@ |
4942 | |
4943 | def test_repeated_substreams_same_kind_are_one_stream(self): |
4944 | # Make a stream - an iterable of bytestrings. |
4945 | - stream = [('text', [versionedfile.FulltextContentFactory(('k1',), None, |
4946 | - None, 'foo')]), ('text', [ |
4947 | - versionedfile.FulltextContentFactory(('k2',), None, None, 'bar')])] |
4948 | + stream = [('text', [versionedfile.FulltextContentFactory((b'k1',), None, |
4949 | + None, b'foo')]), ('text', [ |
4950 | + versionedfile.FulltextContentFactory((b'k2',), None, None, b'bar')])] |
4951 | fmt = controldir.format_registry.get('pack-0.92')().repository_format |
4952 | bytes = smart_repo._stream_to_byte_stream(stream, fmt) |
4953 | streams = [] |
4954 | @@ -141,11 +141,11 @@ |
4955 | def test__eq__(self): |
4956 | self.assertEqual(smart_req.SmartServerResponse((b'ok', )), |
4957 | smart_req.SmartServerResponse((b'ok', ))) |
4958 | - self.assertEqual(smart_req.SmartServerResponse((b'ok', ), 'body'), |
4959 | - smart_req.SmartServerResponse((b'ok', ), 'body')) |
4960 | + self.assertEqual(smart_req.SmartServerResponse((b'ok', ), b'body'), |
4961 | + smart_req.SmartServerResponse((b'ok', ), b'body')) |
4962 | self.assertNotEqual(smart_req.SmartServerResponse((b'ok', )), |
4963 | smart_req.SmartServerResponse((b'notok', ))) |
4964 | - self.assertNotEqual(smart_req.SmartServerResponse((b'ok', ), 'body'), |
4965 | + self.assertNotEqual(smart_req.SmartServerResponse((b'ok', ), b'body'), |
4966 | smart_req.SmartServerResponse((b'ok', ))) |
4967 | self.assertNotEqual(None, |
4968 | smart_req.SmartServerResponse((b'ok', ))) |
4969 | @@ -167,17 +167,17 @@ |
4970 | def test_translate_client_path(self): |
4971 | transport = self.get_transport() |
4972 | request = smart_req.SmartServerRequest(transport, 'foo/') |
4973 | - self.assertEqual('./', request.translate_client_path('foo/')) |
4974 | - self.assertRaises( |
4975 | - urlutils.InvalidURLJoin, request.translate_client_path, 'foo/..') |
4976 | - self.assertRaises( |
4977 | - errors.PathNotChild, request.translate_client_path, '/') |
4978 | - self.assertRaises( |
4979 | - errors.PathNotChild, request.translate_client_path, 'bar/') |
4980 | - self.assertEqual('./baz', request.translate_client_path('foo/baz')) |
4981 | + self.assertEqual('./', request.translate_client_path(b'foo/')) |
4982 | + self.assertRaises( |
4983 | + urlutils.InvalidURLJoin, request.translate_client_path, b'foo/..') |
4984 | + self.assertRaises( |
4985 | + errors.PathNotChild, request.translate_client_path, b'/') |
4986 | + self.assertRaises( |
4987 | + errors.PathNotChild, request.translate_client_path, b'bar/') |
4988 | + self.assertEqual('./baz', request.translate_client_path(b'foo/baz')) |
4989 | e_acute = u'\N{LATIN SMALL LETTER E WITH ACUTE}'.encode('utf-8') |
4990 | self.assertEqual('./' + urlutils.escape(e_acute), |
4991 | - request.translate_client_path('foo/' + e_acute)) |
4992 | + request.translate_client_path(b'foo/' + e_acute)) |
4993 | |
4994 | def test_translate_client_path_vfs(self): |
4995 | """VfsRequests receive escaped paths rather than raw UTF-8.""" |
4996 | @@ -210,8 +210,8 @@ |
4997 | expected = smart_req.SuccessfulSmartServerResponse( |
4998 | (local_result.network_name(), |
4999 | local_result.repository_format.network_name(), |
5000 | - ('branch', local_result.get_branch_format().network_name()))) |
The diff has been truncated for viewing.
Thanks! Some griping inline, but no changes needed.