Status: | Merged |
---|---|
Approved by: | Martin Packman |
Approved revision: | no longer in the source branch. |
Merge reported by: | The Breezy Bot |
Merged at revision: | not available |
Proposed branch: | lp:~gz/brz/unmapped |
Merge into: | lp:brz |
Prerequisite: | lp:~gz/brz/i_unzipping |
Diff against target: |
444 lines (+56/-51) 24 files modified
breezy/btree_index.py (+6/-3) breezy/dirstate.py (+2/-2) breezy/export_pot.py (+1/-2) breezy/groupcompress.py (+4/-1) breezy/mutabletree.py (+1/-1) breezy/osutils.py (+2/-1) breezy/plugin.py (+2/-2) breezy/plugins/changelog_merge/changelog_merge.py (+3/-3) breezy/plugins/weave_fmt/bzrdir.py (+1/-1) breezy/repository.py (+2/-2) breezy/smart/repository.py (+2/-2) breezy/tests/per_pack_repository.py (+1/-1) breezy/tests/per_versionedfile.py (+4/-4) breezy/tests/per_workingtree/test_paths2ids.py (+4/-4) breezy/tests/test_diff.py (+4/-4) breezy/tests/test_http.py (+2/-2) breezy/tests/test_rio.py (+2/-2) breezy/transport/memory.py (+2/-2) breezy/transport/sftp.py (+1/-1) breezy/util/simplemapi.py (+3/-4) breezy/versionedfile.py (+3/-3) breezy/vf_repository.py (+2/-2) breezy/weave.py (+1/-1) breezy/weavefile.py (+1/-1) |
To merge this branch: | bzr merge lp:~gz/brz/unmapped |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij | Approve | ||
Review via email: mp+324568@code.launchpad.net |
This proposal supersedes a proposal from 2017-05-24.
Commit message
Make use of map Python 3 compatible
Description of the change
Cope with the builtin map function becoming imap in Python 3.
Worse case the fixer throws in an extra pointless list copy, where it looked like that might matter I refactored or pulled in the iterator version from future_builtins.
There are a few changes on somewhat hot paths, where larger refactors/rewrites are probably called for, but avoided doing so for now.
The static tuple intern change is somewhat driveby, we can't use sys.intern on bytestrings in Python 3 anyway, and a better interface would be constructing the tuple with a new method like from_bytes_interned or something to mega-intern the result.
Same as before just with prereq branch set correctly.
Jelmer Vernooij (jelmer) : Posted in a previous version of this proposal | # |
Jelmer Vernooij (jelmer) : | # |
Preview Diff
1 | === modified file 'breezy/btree_index.py' | |||
2 | --- breezy/btree_index.py 2017-05-22 00:56:52 +0000 | |||
3 | +++ breezy/btree_index.py 2017-05-24 23:42:41 +0000 | |||
4 | @@ -42,6 +42,7 @@ | |||
5 | 42 | from .index import _OPTION_NODE_REFS, _OPTION_KEY_ELEMENTS, _OPTION_LEN | 42 | from .index import _OPTION_NODE_REFS, _OPTION_KEY_ELEMENTS, _OPTION_LEN |
6 | 43 | from .sixish import ( | 43 | from .sixish import ( |
7 | 44 | BytesIO, | 44 | BytesIO, |
8 | 45 | map, | ||
9 | 45 | ) | 46 | ) |
10 | 46 | 47 | ||
11 | 47 | 48 | ||
12 | @@ -662,7 +663,9 @@ | |||
13 | 662 | for line in lines[2:]: | 663 | for line in lines[2:]: |
14 | 663 | if line == '': | 664 | if line == '': |
15 | 664 | break | 665 | break |
17 | 665 | nodes.append(as_st(map(intern, line.split('\0'))).intern()) | 666 | # GZ 2017-05-24: Used to intern() each chunk of line as well, need |
18 | 667 | # to recheck performance and perhaps adapt StaticTuple to adjust. | ||
19 | 668 | nodes.append(as_st(line.split(b'\0')).intern()) | ||
20 | 666 | return nodes | 669 | return nodes |
21 | 667 | 670 | ||
22 | 668 | 671 | ||
23 | @@ -1497,9 +1500,9 @@ | |||
24 | 1497 | if not options_line.startswith(_OPTION_ROW_LENGTHS): | 1500 | if not options_line.startswith(_OPTION_ROW_LENGTHS): |
25 | 1498 | raise errors.BadIndexOptions(self) | 1501 | raise errors.BadIndexOptions(self) |
26 | 1499 | try: | 1502 | try: |
28 | 1500 | self._row_lengths = map(int, [length for length in | 1503 | self._row_lengths = [int(length) for length in |
29 | 1501 | options_line[len(_OPTION_ROW_LENGTHS):].split(',') | 1504 | options_line[len(_OPTION_ROW_LENGTHS):].split(',') |
31 | 1502 | if len(length)]) | 1505 | if length] |
32 | 1503 | except ValueError: | 1506 | except ValueError: |
33 | 1504 | raise errors.BadIndexOptions(self) | 1507 | raise errors.BadIndexOptions(self) |
34 | 1505 | self._compute_row_offsets() | 1508 | self._compute_row_offsets() |
35 | 1506 | 1509 | ||
36 | === modified file 'breezy/dirstate.py' | |||
37 | --- breezy/dirstate.py 2017-05-22 11:22:28 +0000 | |||
38 | +++ breezy/dirstate.py 2017-05-24 23:42:41 +0000 | |||
39 | @@ -1953,7 +1953,7 @@ | |||
40 | 1953 | lines = [] | 1953 | lines = [] |
41 | 1954 | lines.append(self._get_parents_line(self.get_parent_ids())) | 1954 | lines.append(self._get_parents_line(self.get_parent_ids())) |
42 | 1955 | lines.append(self._get_ghosts_line(self._ghosts)) | 1955 | lines.append(self._get_ghosts_line(self._ghosts)) |
44 | 1956 | lines.extend(self._get_entry_lines()) | 1956 | lines.extend(self._iter_entry_lines()) |
45 | 1957 | return self._get_output_lines(lines) | 1957 | return self._get_output_lines(lines) |
46 | 1958 | 1958 | ||
47 | 1959 | def _get_ghosts_line(self, ghost_ids): | 1959 | def _get_ghosts_line(self, ghost_ids): |
48 | @@ -1964,7 +1964,7 @@ | |||
49 | 1964 | """Create a line for the state file for parents information.""" | 1964 | """Create a line for the state file for parents information.""" |
50 | 1965 | return '\0'.join([str(len(parent_ids))] + parent_ids) | 1965 | return '\0'.join([str(len(parent_ids))] + parent_ids) |
51 | 1966 | 1966 | ||
53 | 1967 | def _get_entry_lines(self): | 1967 | def _iter_entry_lines(self): |
54 | 1968 | """Create lines for entries.""" | 1968 | """Create lines for entries.""" |
55 | 1969 | return map(self._entry_to_line, self._iter_entries()) | 1969 | return map(self._entry_to_line, self._iter_entries()) |
56 | 1970 | 1970 | ||
57 | 1971 | 1971 | ||
58 | === modified file 'breezy/export_pot.py' | |||
59 | --- breezy/export_pot.py 2017-05-22 00:56:52 +0000 | |||
60 | +++ breezy/export_pot.py 2017-05-24 23:42:41 +0000 | |||
61 | @@ -65,9 +65,8 @@ | |||
62 | 65 | if not lines[-1]: | 65 | if not lines[-1]: |
63 | 66 | del lines[-1] | 66 | del lines[-1] |
64 | 67 | lines[-1] = lines[-1] + '\n' | 67 | lines[-1] = lines[-1] + '\n' |
65 | 68 | lines = map(_escape, lines) | ||
66 | 69 | lineterm = '\\n"\n"' | 68 | lineterm = '\\n"\n"' |
68 | 70 | s = '""\n"' + lineterm.join(lines) + '"' | 69 | s = '""\n"' + lineterm.join(map(_escape, lines)) + '"' |
69 | 71 | return s | 70 | return s |
70 | 72 | 71 | ||
71 | 73 | 72 | ||
72 | 74 | 73 | ||
73 | === modified file 'breezy/groupcompress.py' | |||
74 | --- breezy/groupcompress.py 2017-05-22 00:56:52 +0000 | |||
75 | +++ breezy/groupcompress.py 2017-05-24 23:42:41 +0000 | |||
76 | @@ -42,6 +42,9 @@ | |||
77 | 42 | 42 | ||
78 | 43 | from .btree_index import BTreeBuilder | 43 | from .btree_index import BTreeBuilder |
79 | 44 | from .lru_cache import LRUSizeCache | 44 | from .lru_cache import LRUSizeCache |
80 | 45 | from .sixish import ( | ||
81 | 46 | map, | ||
82 | 47 | ) | ||
83 | 45 | from .versionedfile import ( | 48 | from .versionedfile import ( |
84 | 46 | _KeyRefs, | 49 | _KeyRefs, |
85 | 47 | adapter_registry, | 50 | adapter_registry, |
86 | @@ -300,7 +303,7 @@ | |||
87 | 300 | compressor = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION) | 303 | compressor = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION) |
88 | 301 | # Peak in this point is 1 fulltext, 1 compressed text, + zlib overhead | 304 | # Peak in this point is 1 fulltext, 1 compressed text, + zlib overhead |
89 | 302 | # (measured peak is maybe 30MB over the above...) | 305 | # (measured peak is maybe 30MB over the above...) |
91 | 303 | compressed_chunks = map(compressor.compress, chunks) | 306 | compressed_chunks = list(map(compressor.compress, chunks)) |
92 | 304 | compressed_chunks.append(compressor.flush()) | 307 | compressed_chunks.append(compressor.flush()) |
93 | 305 | # Ignore empty chunks | 308 | # Ignore empty chunks |
94 | 306 | self._z_content_chunks = [c for c in compressed_chunks if c] | 309 | self._z_content_chunks = [c for c in compressed_chunks if c] |
95 | 307 | 310 | ||
96 | === modified file 'breezy/mutabletree.py' | |||
97 | --- breezy/mutabletree.py 2017-05-22 00:56:52 +0000 | |||
98 | +++ breezy/mutabletree.py 2017-05-24 23:42:41 +0000 | |||
99 | @@ -667,7 +667,7 @@ | |||
100 | 667 | # filename alone | 667 | # filename alone |
101 | 668 | # only expanding if symlinks are supported avoids windows path bugs | 668 | # only expanding if symlinks are supported avoids windows path bugs |
102 | 669 | if osutils.has_symlinks(): | 669 | if osutils.has_symlinks(): |
104 | 670 | file_list = map(osutils.normalizepath, file_list) | 670 | file_list = list(map(osutils.normalizepath, file_list)) |
105 | 671 | 671 | ||
106 | 672 | user_dirs = {} | 672 | user_dirs = {} |
107 | 673 | # validate user file paths and convert all paths to tree | 673 | # validate user file paths and convert all paths to tree |
108 | 674 | 674 | ||
109 | === modified file 'breezy/osutils.py' | |||
110 | --- breezy/osutils.py 2017-05-22 00:56:52 +0000 | |||
111 | +++ breezy/osutils.py 2017-05-24 23:42:41 +0000 | |||
112 | @@ -811,7 +811,8 @@ | |||
113 | 811 | def sha_strings(strings, _factory=sha): | 811 | def sha_strings(strings, _factory=sha): |
114 | 812 | """Return the sha-1 of concatenation of strings""" | 812 | """Return the sha-1 of concatenation of strings""" |
115 | 813 | s = _factory() | 813 | s = _factory() |
117 | 814 | map(s.update, strings) | 814 | for string in strings: |
118 | 815 | s.update(string) | ||
119 | 815 | return s.hexdigest() | 816 | return s.hexdigest() |
120 | 816 | 817 | ||
121 | 817 | 818 | ||
122 | 818 | 819 | ||
123 | === modified file 'breezy/plugin.py' | |||
124 | --- breezy/plugin.py 2017-05-22 00:56:52 +0000 | |||
125 | +++ breezy/plugin.py 2017-05-24 23:42:41 +0000 | |||
126 | @@ -266,7 +266,7 @@ | |||
127 | 266 | 266 | ||
128 | 267 | # Get rid of trailing slashes, since Python can't handle them when | 267 | # Get rid of trailing slashes, since Python can't handle them when |
129 | 268 | # it tries to import modules. | 268 | # it tries to import modules. |
131 | 269 | paths = map(_strip_trailing_sep, paths) | 269 | paths = list(map(_strip_trailing_sep, paths)) |
132 | 270 | return paths | 270 | return paths |
133 | 271 | 271 | ||
134 | 272 | 272 | ||
135 | @@ -317,7 +317,7 @@ | |||
136 | 317 | # this function, and since it sets plugins.__path__, it should set it to | 317 | # this function, and since it sets plugins.__path__, it should set it to |
137 | 318 | # something that will be valid for Python to use (in case people try to | 318 | # something that will be valid for Python to use (in case people try to |
138 | 319 | # run "import breezy.plugins.PLUGINNAME" after calling this function). | 319 | # run "import breezy.plugins.PLUGINNAME" after calling this function). |
140 | 320 | _mod_plugins.__path__ = map(_strip_trailing_sep, dirs) | 320 | _mod_plugins.__path__ = list(map(_strip_trailing_sep, dirs)) |
141 | 321 | for d in dirs: | 321 | for d in dirs: |
142 | 322 | if not d: | 322 | if not d: |
143 | 323 | continue | 323 | continue |
144 | 324 | 324 | ||
145 | === modified file 'breezy/plugins/changelog_merge/changelog_merge.py' | |||
146 | --- breezy/plugins/changelog_merge/changelog_merge.py 2017-05-22 00:56:52 +0000 | |||
147 | +++ breezy/plugins/changelog_merge/changelog_merge.py 2017-05-24 23:42:41 +0000 | |||
148 | @@ -48,7 +48,7 @@ | |||
149 | 48 | entries.append([]) | 48 | entries.append([]) |
150 | 49 | entry = entries[-1] | 49 | entry = entries[-1] |
151 | 50 | entry.append(line) | 50 | entry.append(line) |
153 | 51 | return map(tuple, entries) | 51 | return list(map(tuple, entries)) |
154 | 52 | 52 | ||
155 | 53 | 53 | ||
156 | 54 | def entries_to_lines(entries): | 54 | def entries_to_lines(entries): |
157 | @@ -106,8 +106,8 @@ | |||
158 | 106 | This algorithm does O(N^2 * logN) SequenceMatcher.ratio() calls, which is | 106 | This algorithm does O(N^2 * logN) SequenceMatcher.ratio() calls, which is |
159 | 107 | pretty bad, but it shouldn't be used very often. | 107 | pretty bad, but it shouldn't be used very often. |
160 | 108 | """ | 108 | """ |
163 | 109 | deleted_entries_as_strs = map(entry_as_str, deleted_entries) | 109 | deleted_entries_as_strs = list(map(entry_as_str, deleted_entries)) |
164 | 110 | new_entries_as_strs = map(entry_as_str, new_entries) | 110 | new_entries_as_strs = list(map(entry_as_str, new_entries)) |
165 | 111 | result_new = list(new_entries) | 111 | result_new = list(new_entries) |
166 | 112 | result_deleted = list(deleted_entries) | 112 | result_deleted = list(deleted_entries) |
167 | 113 | result_edits = [] | 113 | result_edits = [] |
168 | 114 | 114 | ||
169 | === modified file 'breezy/plugins/weave_fmt/bzrdir.py' | |||
170 | --- breezy/plugins/weave_fmt/bzrdir.py 2017-05-22 00:56:52 +0000 | |||
171 | +++ breezy/plugins/weave_fmt/bzrdir.py 2017-05-24 23:42:41 +0000 | |||
172 | @@ -415,7 +415,7 @@ | |||
173 | 415 | Also upgrade the inventory to refer to the text revision ids.""" | 415 | Also upgrade the inventory to refer to the text revision ids.""" |
174 | 416 | rev_id = rev.revision_id | 416 | rev_id = rev.revision_id |
175 | 417 | trace.mutter('converting texts of revision {%s}', rev_id) | 417 | trace.mutter('converting texts of revision {%s}', rev_id) |
177 | 418 | parent_invs = map(self._load_updated_inventory, present_parents) | 418 | parent_invs = list(map(self._load_updated_inventory, present_parents)) |
178 | 419 | entries = inv.iter_entries() | 419 | entries = inv.iter_entries() |
179 | 420 | entries.next() | 420 | entries.next() |
180 | 421 | for path, ie in entries: | 421 | for path, ie in entries: |
181 | 422 | 422 | ||
182 | === modified file 'breezy/repository.py' | |||
183 | --- breezy/repository.py 2017-05-22 00:56:52 +0000 | |||
184 | +++ breezy/repository.py 2017-05-24 23:42:41 +0000 | |||
185 | @@ -924,8 +924,8 @@ | |||
186 | 924 | not part of revision_ids themselves | 924 | not part of revision_ids themselves |
187 | 925 | """ | 925 | """ |
188 | 926 | parent_map = self.get_parent_map(revision_ids) | 926 | parent_map = self.get_parent_map(revision_ids) |
191 | 927 | parent_ids = set() | 927 | parent_ids = set(itertools.chain.from_iterable( |
192 | 928 | map(parent_ids.update, parent_map.itervalues()) | 928 | parent_map.itervalues())) |
193 | 929 | parent_ids.difference_update(revision_ids) | 929 | parent_ids.difference_update(revision_ids) |
194 | 930 | parent_ids.discard(_mod_revision.NULL_REVISION) | 930 | parent_ids.discard(_mod_revision.NULL_REVISION) |
195 | 931 | return parent_ids | 931 | return parent_ids |
196 | 932 | 932 | ||
197 | === modified file 'breezy/smart/repository.py' | |||
198 | --- breezy/smart/repository.py 2017-05-22 00:56:52 +0000 | |||
199 | +++ breezy/smart/repository.py 2017-05-24 23:42:41 +0000 | |||
200 | @@ -19,6 +19,7 @@ | |||
201 | 19 | from __future__ import absolute_import | 19 | from __future__ import absolute_import |
202 | 20 | 20 | ||
203 | 21 | import bz2 | 21 | import bz2 |
204 | 22 | import itertools | ||
205 | 22 | import os | 23 | import os |
206 | 23 | try: | 24 | try: |
207 | 24 | import queue | 25 | import queue |
208 | @@ -307,8 +308,7 @@ | |||
209 | 307 | else: | 308 | else: |
210 | 308 | search_ids = repository.all_revision_ids() | 309 | search_ids = repository.all_revision_ids() |
211 | 309 | search = graph._make_breadth_first_searcher(search_ids) | 310 | search = graph._make_breadth_first_searcher(search_ids) |
214 | 310 | transitive_ids = set() | 311 | transitive_ids = set(itertools.chain.from_iterable(search)) |
213 | 311 | map(transitive_ids.update, list(search)) | ||
215 | 312 | parent_map = graph.get_parent_map(transitive_ids) | 312 | parent_map = graph.get_parent_map(transitive_ids) |
216 | 313 | revision_graph = _strip_NULL_ghosts(parent_map) | 313 | revision_graph = _strip_NULL_ghosts(parent_map) |
217 | 314 | if revision_id and revision_id not in revision_graph: | 314 | if revision_id and revision_id not in revision_graph: |
218 | 315 | 315 | ||
219 | === modified file 'breezy/tests/per_pack_repository.py' | |||
220 | --- breezy/tests/per_pack_repository.py 2017-05-23 14:08:03 +0000 | |||
221 | +++ breezy/tests/per_pack_repository.py 2017-05-24 23:42:41 +0000 | |||
222 | @@ -358,7 +358,7 @@ | |||
223 | 358 | for _1, key, val, refs in pack.revision_index.iter_all_entries(): | 358 | for _1, key, val, refs in pack.revision_index.iter_all_entries(): |
224 | 359 | if isinstance(format.repository_format, RepositoryFormat2a): | 359 | if isinstance(format.repository_format, RepositoryFormat2a): |
225 | 360 | # group_start, group_len, internal_start, internal_len | 360 | # group_start, group_len, internal_start, internal_len |
227 | 361 | pos = map(int, val.split()) | 361 | pos = list(map(int, val.split())) |
228 | 362 | else: | 362 | else: |
229 | 363 | # eol_flag, start, len | 363 | # eol_flag, start, len |
230 | 364 | pos = int(val[1:].split()[0]) | 364 | pos = int(val[1:].split()[0]) |
231 | 365 | 365 | ||
232 | === modified file 'breezy/tests/per_versionedfile.py' | |||
233 | --- breezy/tests/per_versionedfile.py 2017-05-24 23:30:47 +0000 | |||
234 | +++ breezy/tests/per_versionedfile.py 2017-05-24 23:42:41 +0000 | |||
235 | @@ -945,9 +945,9 @@ | |||
236 | 945 | return x + '\n' | 945 | return x + '\n' |
237 | 946 | 946 | ||
238 | 947 | w = self.get_file() | 947 | w = self.get_file() |
242 | 948 | w.add_lines('text0', [], map(addcrlf, base)) | 948 | w.add_lines('text0', [], list(map(addcrlf, base))) |
243 | 949 | w.add_lines('text1', ['text0'], map(addcrlf, a)) | 949 | w.add_lines('text1', ['text0'], list(map(addcrlf, a))) |
244 | 950 | w.add_lines('text2', ['text0'], map(addcrlf, b)) | 950 | w.add_lines('text2', ['text0'], list(map(addcrlf, b))) |
245 | 951 | 951 | ||
246 | 952 | self.log_contents(w) | 952 | self.log_contents(w) |
247 | 953 | 953 | ||
248 | @@ -963,7 +963,7 @@ | |||
249 | 963 | mt.seek(0) | 963 | mt.seek(0) |
250 | 964 | self.log(mt.getvalue()) | 964 | self.log(mt.getvalue()) |
251 | 965 | 965 | ||
253 | 966 | mp = map(addcrlf, mp) | 966 | mp = list(map(addcrlf, mp)) |
254 | 967 | self.assertEqual(mt.readlines(), mp) | 967 | self.assertEqual(mt.readlines(), mp) |
255 | 968 | 968 | ||
256 | 969 | 969 | ||
257 | 970 | 970 | ||
258 | === modified file 'breezy/tests/per_workingtree/test_paths2ids.py' | |||
259 | --- breezy/tests/per_workingtree/test_paths2ids.py 2017-05-21 18:10:28 +0000 | |||
260 | +++ breezy/tests/per_workingtree/test_paths2ids.py 2017-05-24 23:42:41 +0000 | |||
261 | @@ -21,8 +21,6 @@ | |||
262 | 21 | find_ids_across_trees. | 21 | find_ids_across_trees. |
263 | 22 | """ | 22 | """ |
264 | 23 | 23 | ||
265 | 24 | from operator import attrgetter | ||
266 | 25 | |||
267 | 26 | from breezy import errors | 24 | from breezy import errors |
268 | 27 | from breezy.tests import features | 25 | from breezy.tests import features |
269 | 28 | from breezy.tests.per_workingtree import TestCaseWithWorkingTree | 26 | from breezy.tests.per_workingtree import TestCaseWithWorkingTree |
270 | @@ -47,10 +45,12 @@ | |||
271 | 47 | """Run paths2ids for tree, and check the result.""" | 45 | """Run paths2ids for tree, and check the result.""" |
272 | 48 | tree.lock_read() | 46 | tree.lock_read() |
273 | 49 | if trees: | 47 | if trees: |
275 | 50 | map(apply, map(attrgetter('lock_read'), trees)) | 48 | for t in trees: |
276 | 49 | t.lock_read() | ||
277 | 51 | result = tree.paths2ids(paths, trees, | 50 | result = tree.paths2ids(paths, trees, |
278 | 52 | require_versioned=require_versioned) | 51 | require_versioned=require_versioned) |
280 | 53 | map(apply, map(attrgetter('unlock'), trees)) | 52 | for t in trees: |
281 | 53 | t.unlock() | ||
282 | 54 | else: | 54 | else: |
283 | 55 | result = tree.paths2ids(paths, | 55 | result = tree.paths2ids(paths, |
284 | 56 | require_versioned=require_versioned) | 56 | require_versioned=require_versioned) |
285 | 57 | 57 | ||
286 | === modified file 'breezy/tests/test_diff.py' | |||
287 | --- breezy/tests/test_diff.py 2017-05-22 00:56:52 +0000 | |||
288 | +++ breezy/tests/test_diff.py 2017-05-24 23:42:41 +0000 | |||
289 | @@ -1194,8 +1194,8 @@ | |||
290 | 1194 | ] | 1194 | ] |
291 | 1195 | , list(unified_diff(txt_a, txt_b, | 1195 | , list(unified_diff(txt_a, txt_b, |
292 | 1196 | sequencematcher=psm))) | 1196 | sequencematcher=psm))) |
295 | 1197 | txt_a = map(lambda x: x+'\n', 'abcdefghijklmnop') | 1197 | txt_a = [x+'\n' for x in 'abcdefghijklmnop'] |
296 | 1198 | txt_b = map(lambda x: x+'\n', 'abcdefxydefghijklmnop') | 1198 | txt_b = [x+'\n' for x in 'abcdefxydefghijklmnop'] |
297 | 1199 | # This is the result with LongestCommonSubstring matching | 1199 | # This is the result with LongestCommonSubstring matching |
298 | 1200 | self.assertEqual(['--- \n', | 1200 | self.assertEqual(['--- \n', |
299 | 1201 | '+++ \n', | 1201 | '+++ \n', |
300 | @@ -1307,8 +1307,8 @@ | |||
301 | 1307 | , list(unified_diff_files('a1', 'b1', | 1307 | , list(unified_diff_files('a1', 'b1', |
302 | 1308 | sequencematcher=psm))) | 1308 | sequencematcher=psm))) |
303 | 1309 | 1309 | ||
306 | 1310 | txt_a = map(lambda x: x+'\n', 'abcdefghijklmnop') | 1310 | txt_a = [x+'\n' for x in 'abcdefghijklmnop'] |
307 | 1311 | txt_b = map(lambda x: x+'\n', 'abcdefxydefghijklmnop') | 1311 | txt_b = [x+'\n' for x in 'abcdefxydefghijklmnop'] |
308 | 1312 | with open('a2', 'wb') as f: f.writelines(txt_a) | 1312 | with open('a2', 'wb') as f: f.writelines(txt_a) |
309 | 1313 | with open('b2', 'wb') as f: f.writelines(txt_b) | 1313 | with open('b2', 'wb') as f: f.writelines(txt_b) |
310 | 1314 | 1314 | ||
311 | 1315 | 1315 | ||
312 | === modified file 'breezy/tests/test_http.py' | |||
313 | --- breezy/tests/test_http.py 2017-05-22 00:56:52 +0000 | |||
314 | +++ breezy/tests/test_http.py 2017-05-24 23:42:41 +0000 | |||
315 | @@ -1391,8 +1391,8 @@ | |||
316 | 1391 | 1391 | ||
317 | 1392 | def test_range_header(self): | 1392 | def test_range_header(self): |
318 | 1393 | # Valid ranges | 1393 | # Valid ranges |
321 | 1394 | map(self.assertEqual,['0', '234'], | 1394 | self.assertEqual( |
322 | 1395 | list(self._file_contents('a', [(0,0), (2,4)])),) | 1395 | ['0', '234'], list(self._file_contents('a', [(0,0), (2,4)]))) |
323 | 1396 | 1396 | ||
324 | 1397 | def test_range_header_tail(self): | 1397 | def test_range_header_tail(self): |
325 | 1398 | self.assertEqual('789', self._file_tail('a', 3)) | 1398 | self.assertEqual('789', self._file_tail('a', 3)) |
326 | 1399 | 1399 | ||
327 | === modified file 'breezy/tests/test_rio.py' | |||
328 | --- breezy/tests/test_rio.py 2017-05-21 18:10:28 +0000 | |||
329 | +++ breezy/tests/test_rio.py 2017-05-24 23:42:41 +0000 | |||
330 | @@ -130,8 +130,8 @@ | |||
331 | 130 | s.add(k, v) | 130 | s.add(k, v) |
332 | 131 | s2 = read_stanza(s.to_lines()) | 131 | s2 = read_stanza(s.to_lines()) |
333 | 132 | self.assertEqual(s, s2) | 132 | self.assertEqual(s, s2) |
336 | 133 | self.assertEqual(s.get_all('a'), map(str, [10, 100, 1000])) | 133 | self.assertEqual(s.get_all('a'), ['10', '100', '1000']) |
337 | 134 | self.assertEqual(s.get_all('b'), map(str, [20, 200, 2000])) | 134 | self.assertEqual(s.get_all('b'), ['20', '200', '2000']) |
338 | 135 | 135 | ||
339 | 136 | def test_backslash(self): | 136 | def test_backslash(self): |
340 | 137 | s = Stanza(q='\\') | 137 | s = Stanza(q='\\') |
341 | 138 | 138 | ||
342 | === modified file 'breezy/transport/memory.py' | |||
343 | --- breezy/transport/memory.py 2017-05-22 00:56:52 +0000 | |||
344 | +++ breezy/transport/memory.py 2017-05-24 23:42:41 +0000 | |||
345 | @@ -193,8 +193,8 @@ | |||
346 | 193 | if path.startswith(_abspath): | 193 | if path.startswith(_abspath): |
347 | 194 | trailing = path[len(_abspath):] | 194 | trailing = path[len(_abspath):] |
348 | 195 | if trailing and '/' not in trailing: | 195 | if trailing and '/' not in trailing: |
351 | 196 | result.append(trailing) | 196 | result.append(urlutils.escape(trailing)) |
352 | 197 | return map(urlutils.escape, result) | 197 | return result |
353 | 198 | 198 | ||
354 | 199 | def rename(self, rel_from, rel_to): | 199 | def rename(self, rel_from, rel_to): |
355 | 200 | """Rename a file or directory; fail if the destination exists""" | 200 | """Rename a file or directory; fail if the destination exists""" |
356 | 201 | 201 | ||
357 | === modified file 'breezy/transport/sftp.py' | |||
358 | --- breezy/transport/sftp.py 2017-05-24 23:30:47 +0000 | |||
359 | +++ breezy/transport/sftp.py 2017-05-24 23:42:41 +0000 | |||
360 | @@ -282,7 +282,7 @@ | |||
361 | 282 | if data_chunks: | 282 | if data_chunks: |
362 | 283 | if 'sftp' in debug.debug_flags: | 283 | if 'sftp' in debug.debug_flags: |
363 | 284 | mutter('SFTP readv left with %d out-of-order bytes', | 284 | mutter('SFTP readv left with %d out-of-order bytes', |
365 | 285 | sum(map(lambda x: len(x[1]), data_chunks))) | 285 | sum(len(x[1]) for x in data_chunks)) |
366 | 286 | # We've processed all the readv data, at this point, anything we | 286 | # We've processed all the readv data, at this point, anything we |
367 | 287 | # couldn't process is in data_chunks. This doesn't happen often, so | 287 | # couldn't process is in data_chunks. This doesn't happen often, so |
368 | 288 | # this code path isn't optimized | 288 | # this code path isn't optimized |
369 | 289 | 289 | ||
370 | === modified file 'breezy/util/simplemapi.py' | |||
371 | --- breezy/util/simplemapi.py 2017-02-05 16:35:58 +0000 | |||
372 | +++ breezy/util/simplemapi.py 2017-05-24 23:42:41 +0000 | |||
373 | @@ -233,10 +233,9 @@ | |||
374 | 233 | 233 | ||
375 | 234 | attach = [] | 234 | attach = [] |
376 | 235 | AttachWork = attachfiles.split(';') | 235 | AttachWork = attachfiles.split(';') |
381 | 236 | for file in AttachWork: | 236 | for f in AttachWork: |
382 | 237 | if os.path.exists(file): | 237 | if os.path.exists(f): |
383 | 238 | attach.append(file) | 238 | attach.append(os.path.abspath(f)) |
380 | 239 | attach = map(os.path.abspath, attach) | ||
384 | 240 | 239 | ||
385 | 241 | restore = os.getcwd() | 240 | restore = os.getcwd() |
386 | 242 | try: | 241 | try: |
387 | 243 | 242 | ||
388 | === modified file 'breezy/versionedfile.py' | |||
389 | --- breezy/versionedfile.py 2017-05-24 23:42:40 +0000 | |||
390 | +++ breezy/versionedfile.py 2017-05-24 23:42:41 +0000 | |||
391 | @@ -1093,9 +1093,9 @@ | |||
392 | 1093 | while pending: | 1093 | while pending: |
393 | 1094 | this_parent_map = self.get_parent_map(pending) | 1094 | this_parent_map = self.get_parent_map(pending) |
394 | 1095 | parent_map.update(this_parent_map) | 1095 | parent_map.update(this_parent_map) |
398 | 1096 | pending = set() | 1096 | pending = set(itertools.chain.from_iterable( |
399 | 1097 | map(pending.update, this_parent_map.itervalues()) | 1097 | this_parent_map.itervalues())) |
400 | 1098 | pending = pending.difference(parent_map) | 1098 | pending.difference_update(parent_map) |
401 | 1099 | kg = _mod_graph.KnownGraph(parent_map) | 1099 | kg = _mod_graph.KnownGraph(parent_map) |
402 | 1100 | return kg | 1100 | return kg |
403 | 1101 | 1101 | ||
404 | 1102 | 1102 | ||
405 | === modified file 'breezy/vf_repository.py' | |||
406 | --- breezy/vf_repository.py 2017-05-22 00:56:52 +0000 | |||
407 | +++ breezy/vf_repository.py 2017-05-24 23:42:41 +0000 | |||
408 | @@ -1516,8 +1516,8 @@ | |||
409 | 1516 | revision_keys | 1516 | revision_keys |
410 | 1517 | """ | 1517 | """ |
411 | 1518 | parent_map = self.revisions.get_parent_map(revision_keys) | 1518 | parent_map = self.revisions.get_parent_map(revision_keys) |
414 | 1519 | parent_keys = set() | 1519 | parent_keys = set(itertools.chain.from_iterable( |
415 | 1520 | map(parent_keys.update, parent_map.itervalues()) | 1520 | parent_map.itervalues())) |
416 | 1521 | parent_keys.difference_update(revision_keys) | 1521 | parent_keys.difference_update(revision_keys) |
417 | 1522 | parent_keys.discard(_mod_revision.NULL_REVISION) | 1522 | parent_keys.discard(_mod_revision.NULL_REVISION) |
418 | 1523 | return parent_keys | 1523 | return parent_keys |
419 | 1524 | 1524 | ||
420 | === modified file 'breezy/weave.py' | |||
421 | --- breezy/weave.py 2017-05-22 00:56:52 +0000 | |||
422 | +++ breezy/weave.py 2017-05-24 23:42:41 +0000 | |||
423 | @@ -393,7 +393,7 @@ | |||
424 | 393 | def _add_lines(self, version_id, parents, lines, parent_texts, | 393 | def _add_lines(self, version_id, parents, lines, parent_texts, |
425 | 394 | left_matching_blocks, nostore_sha, random_id, check_content): | 394 | left_matching_blocks, nostore_sha, random_id, check_content): |
426 | 395 | """See VersionedFile.add_lines.""" | 395 | """See VersionedFile.add_lines.""" |
428 | 396 | idx = self._add(version_id, lines, map(self._lookup, parents), | 396 | idx = self._add(version_id, lines, list(map(self._lookup, parents)), |
429 | 397 | nostore_sha=nostore_sha) | 397 | nostore_sha=nostore_sha) |
430 | 398 | return sha_strings(lines), sum(map(len, lines)), idx | 398 | return sha_strings(lines), sum(map(len, lines)), idx |
431 | 399 | 399 | ||
432 | 400 | 400 | ||
433 | === modified file 'breezy/weavefile.py' | |||
434 | --- breezy/weavefile.py 2017-05-22 00:56:52 +0000 | |||
435 | +++ breezy/weavefile.py 2017-05-24 23:42:41 +0000 | |||
436 | @@ -135,7 +135,7 @@ | |||
437 | 135 | l = lines.next() | 135 | l = lines.next() |
438 | 136 | if l[0] == 'i': | 136 | if l[0] == 'i': |
439 | 137 | if len(l) > 2: | 137 | if len(l) > 2: |
441 | 138 | w._parents.append(map(int, l[2:].split(' '))) | 138 | w._parents.append(list(map(int, l[2:].split(' ')))) |
442 | 139 | else: | 139 | else: |
443 | 140 | w._parents.append([]) | 140 | w._parents.append([]) |
444 | 141 | l = lines.next()[:-1] | 141 | l = lines.next()[:-1] |