Merge lp:~jelmer/brz/mypy into lp:brz

Proposed by Jelmer Vernooij
Status: Superseded
Proposed branch: lp:~jelmer/brz/mypy
Merge into: lp:brz
Diff against target: 3816 lines (+481/-605) (has conflicts)
131 files modified
.github/workflows/pythonpackage.yml (+5/-2)
Makefile (+3/-0)
breezy/__init__.py (+1/-1)
breezy/__main__.py (+1/-1)
breezy/_known_graph_py.py (+1/-1)
breezy/annotate.py (+0/-1)
breezy/branch.py (+9/-3)
breezy/builtins.py (+4/-8)
breezy/bzr/_static_tuple_py.py (+2/-1)
breezy/bzr/branch.py (+1/-1)
breezy/bzr/btree_index.py (+2/-2)
breezy/bzr/bzrdir.py (+3/-20)
breezy/bzr/groupcompress.py (+9/-5)
breezy/bzr/inventory.py (+1/-1)
breezy/bzr/inventorytree.py (+7/-3)
breezy/bzr/knit.py (+3/-1)
breezy/bzr/knitrepo.py (+11/-6)
breezy/bzr/pack_repo.py (+23/-20)
breezy/bzr/remote.py (+9/-0)
breezy/bzr/smart/client.py (+1/-1)
breezy/bzr/smart/medium.py (+1/-4)
breezy/bzr/smart/message.py (+1/-1)
breezy/bzr/smart/protocol.py (+1/-1)
breezy/bzr/smart/server.py (+1/-1)
breezy/bzr/tests/test__simple_set.py (+1/-1)
breezy/bzr/tests/test__static_tuple.py (+1/-4)
breezy/bzr/tests/test_btree_index.py (+0/-20)
breezy/bzr/tests/test_bundle.py (+2/-2)
breezy/bzr/tests/test_inv.py (+1/-1)
breezy/bzr/tests/test_pack.py (+0/-10)
breezy/bzr/tests/test_repository.py (+2/-48)
breezy/bzr/tests/test_smart_transport.py (+8/-7)
breezy/bzr/versionedfile.py (+4/-1)
breezy/bzr/workingtree.py (+36/-2)
breezy/bzr/workingtree_4.py (+4/-4)
breezy/bzr/xml8.py (+4/-4)
breezy/bzr/xml_serializer.py (+7/-19)
breezy/cache_utf8.py (+7/-6)
breezy/commands.py (+21/-19)
breezy/config.py (+3/-3)
breezy/conflicts.py (+1/-1)
breezy/controldir.py (+8/-4)
breezy/diff.py (+3/-1)
breezy/doc_generate/conf.py (+5/-2)
breezy/errors.py (+2/-0)
breezy/filters/__init__.py (+8/-2)
breezy/foreign.py (+2/-2)
breezy/forge.py (+5/-5)
breezy/git/branch.py (+2/-1)
breezy/git/cache.py (+8/-33)
breezy/git/dir.py (+1/-1)
breezy/git/filegraph.py (+1/-5)
breezy/git/mapping.py (+1/-0)
breezy/git/remote.py (+1/-2)
breezy/git/repository.py (+2/-1)
breezy/git/tests/test_remote.py (+2/-2)
breezy/git/tests/test_repository.py (+1/-1)
breezy/git/transportgit.py (+1/-1)
breezy/git/tree.py (+5/-3)
breezy/git/workingtree.py (+1/-1)
breezy/graph.py (+1/-1)
breezy/hooks.py (+3/-1)
breezy/ignores.py (+2/-1)
breezy/lock.py (+7/-5)
breezy/lsprof.py (+3/-5)
breezy/merge.py (+1/-1)
breezy/merge_directive.py (+2/-2)
breezy/mutabletree.py (+1/-1)
breezy/option.py (+3/-2)
breezy/osutils.py (+8/-7)
breezy/plugins/darcs/__init__.py (+0/-4)
breezy/plugins/flake8/__init__.py (+1/-1)
breezy/plugins/launchpad/forge.py (+0/-2)
breezy/plugins/launchpad/lp_registration.py (+3/-4)
breezy/plugins/repodebug/check_chk.py (+0/-1)
breezy/plugins/weave_fmt/bzrdir.py (+1/-1)
breezy/plugins/weave_fmt/test_store.py (+1/-1)
breezy/plugins/weave_fmt/xml4.py (+3/-1)
breezy/repository.py (+26/-24)
breezy/revision.py (+6/-6)
breezy/revisionspec.py (+9/-22)
breezy/tag.py (+2/-1)
breezy/tests/TestUtil.py (+2/-1)
breezy/tests/__init__.py (+7/-6)
breezy/tests/blackbox/test_push.py (+1/-1)
breezy/tests/blackbox/test_remember_option.py (+5/-4)
breezy/tests/blackbox/test_serve.py (+1/-2)
breezy/tests/blackbox/test_switch.py (+0/-15)
breezy/tests/blackbox/test_upgrade.py (+2/-2)
breezy/tests/fake_command.py (+1/-1)
breezy/tests/https_server.py (+2/-2)
breezy/tests/per_interbranch/__init__.py (+3/-1)
breezy/tests/per_transport.py (+0/-8)
breezy/tests/stub_sftp.py (+1/-1)
breezy/tests/test__annotator.py (+2/-2)
breezy/tests/test_atomicfile.py (+0/-3)
breezy/tests/test_commands.py (+1/-2)
breezy/tests/test_config.py (+1/-8)
breezy/tests/test_conflicts.py (+9/-4)
breezy/tests/test_foreign.py (+2/-1)
breezy/tests/test_forge.py (+2/-1)
breezy/tests/test_hooks.py (+5/-2)
breezy/tests/test_http.py (+3/-3)
breezy/tests/test_lazy_import.py (+1/-1)
breezy/tests/test_lazy_regex.py (+2/-2)
breezy/tests/test_lsprof.py (+1/-4)
breezy/tests/test_merge.py (+0/-27)
breezy/tests/test_osutils_encodings.py (+3/-2)
breezy/tests/test_patch.py (+0/-3)
breezy/tests/test_plugins.py (+2/-1)
breezy/tests/test_shelf.py (+0/-9)
breezy/tests/test_ssh_transport.py (+1/-1)
breezy/tests/test_tree.py (+3/-2)
breezy/tests/test_url_policy_open.py (+3/-1)
breezy/tests/test_utextwrap.py (+3/-3)
breezy/tests/test_win32utils.py (+2/-1)
breezy/transport/__init__.py (+2/-1)
breezy/transport/decorator.py (+2/-1)
breezy/transport/http/urllib.py (+4/-4)
breezy/transport/memory.py (+4/-9)
breezy/transport/ssh.py (+6/-5)
breezy/tree.py (+14/-10)
breezy/util/simplemapi.py (+2/-2)
breezy/version_info_formats/format_rio.py (+1/-1)
breezy/version_info_formats/format_yaml.py (+1/-1)
breezy/workingtree.py (+5/-34)
breezy/workspace.py (+3/-2)
byov.conf (+4/-3)
profile_imports.py (+6/-5)
pyproject.toml (+10/-0)
setup.cfg (+2/-2)
Text conflict in pyproject.toml
To merge this branch: bzr merge lp:~jelmer/brz/mypy
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+430408@code.launchpad.net

This proposal has been superseded by a proposal from 2022-10-27.

Commit message

Add basic typing, make mypy pass

Description of the change

Add basic typing, make mypy pass.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
lp:~jelmer/brz/mypy updated
7657. By Jelmer Vernooij

Merge trunk.

7658. By Jelmer Vernooij

Merge typing.

7659. By Jelmer Vernooij

Fix typing.

7660. By Jelmer Vernooij

merge lp:brz/3.3

7661. By Jelmer Vernooij

Merge lp:brz/3.3

7662. By Jelmer Vernooij

Fix type.

7663. By Jelmer Vernooij

Fix some more tests.

7664. By Jelmer Vernooij

Fix remaining tests.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.github/workflows/pythonpackage.yml'
2--- .github/workflows/pythonpackage.yml 2022-07-09 12:49:21 +0000
3+++ .github/workflows/pythonpackage.yml 2022-10-19 15:51:12 +0000
4@@ -10,7 +10,7 @@
5 strategy:
6 matrix:
7 os: [ubuntu-latest]
8- python-version: [3.6, 3.7, 3.8]
9+ python-version: [3.6, 3.7, 3.8, 3.9, '3.10']
10 experimental: [false]
11 # See https://github.com/actions/toolkit/issues/399
12 # include:
13@@ -33,7 +33,7 @@
14 run: |
15 python -m pip install --upgrade pip
16 pip install -U pip setuptools
17- pip install -U pip coverage codecov flake8 testtools paramiko fastbencode fastimport configobj cython testscenarios six docutils $TEST_REQUIRE sphinx sphinx_epytext launchpadlib patiencediff pyinotify git+https://github.com/dulwich/dulwich setuptools-rust pyyaml merge3
18+ pip install -U pip coverage codecov flake8 testtools paramiko fastbencode fastimport configobj cython testscenarios six docutils $TEST_REQUIRE sphinx sphinx_epytext launchpadlib patiencediff pyinotify git+https://github.com/dulwich/dulwich setuptools-rust pyyaml merge3 mypy
19 - name: Build docs
20 run: |
21 make docs PYTHON=python
22@@ -48,3 +48,6 @@
23 PYTHONHASHSEED: random
24 BRZ_PLUGIN_PATH: -site:-user
25 PYTHONPATH: .
26+ - name: Run mypy
27+ run: |
28+ python -m mypy breezy
29
30=== modified file 'Makefile'
31--- Makefile 2022-10-18 18:12:47 +0000
32+++ Makefile 2022-10-19 15:51:12 +0000
33@@ -71,6 +71,9 @@
34 flake8:
35 flake8
36
37+mypy:
38+ mypy breezy
39+
40 clean:
41 $(PYTHON) setup.py clean
42 -find . -name "*.pyc" -o -name "*.pyo" -o -name "*.so" | xargs rm -f
43
44=== modified file 'breezy/__init__.py'
45--- breezy/__init__.py 2022-10-08 07:04:57 +0000
46+++ breezy/__init__.py 2022-10-19 15:51:12 +0000
47@@ -156,7 +156,7 @@
48 _fs_enc = sys.getfilesystemencoding()
49 if getattr(sys, "_brz_default_fs_enc", None) is not None:
50 if (_fs_enc is None or codecs.lookup(_fs_enc).name == "ascii"):
51- _fs_enc = _patch_filesystem_default_encoding(sys._brz_default_fs_enc)
52+ _fs_enc = _patch_filesystem_default_encoding(sys._brz_default_fs_enc) # type: ignore
53 if _fs_enc is None:
54 _fs_enc = "ascii"
55 else:
56
57=== modified file 'breezy/__main__.py'
58--- breezy/__main__.py 2021-11-17 20:10:55 +0000
59+++ breezy/__main__.py 2022-10-19 15:51:12 +0000
60@@ -45,7 +45,7 @@
61 # Use better default than ascii with posix filesystems that deal in bytes
62 # natively even when the C locale or no locale at all is given. Note that
63 # we need an immortal string for the hack, hence the lack of a hyphen.
64- sys._brz_default_fs_enc = "utf8"
65+ sys._brz_default_fs_enc = "utf8" # type: ignore
66
67
68 def main():
69
70=== modified file 'breezy/_known_graph_py.py'
71--- breezy/_known_graph_py.py 2020-02-18 01:57:45 +0000
72+++ breezy/_known_graph_py.py 2022-10-19 15:51:12 +0000
73@@ -18,7 +18,7 @@
74 """
75
76 try:
77- from collections.abc import deque
78+ from collections.abc import deque # type: ignore
79 except ImportError: # python < 3.7
80 from collections import deque
81 from . import (
82
83=== modified file 'breezy/annotate.py'
84--- breezy/annotate.py 2020-02-18 01:57:45 +0000
85+++ breezy/annotate.py 2022-10-19 15:51:12 +0000
86@@ -30,7 +30,6 @@
87
88 from .lazy_import import lazy_import
89 lazy_import(globals(), """
90-
91 import patiencediff
92
93 from breezy import (
94
95=== modified file 'breezy/branch.py'
96--- breezy/branch.py 2022-09-12 13:37:25 +0000
97+++ breezy/branch.py 2022-10-19 15:51:12 +0000
98@@ -14,7 +14,7 @@
99 # along with this program; if not, write to the Free Software
100 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
101
102-from typing import Optional, Tuple
103+from typing import Optional, Tuple, List, Type
104
105 from .lazy_import import lazy_import
106 lazy_import(globals(), """
107@@ -83,6 +83,12 @@
108
109 name: Optional[str]
110
111+ base: str
112+
113+ _format: "BranchFormat"
114+
115+ _last_revision_info_cache: Optional[Tuple[int, RevisionID]]
116+
117 @property
118 def control_transport(self):
119 return self._transport
120@@ -1758,7 +1764,7 @@
121
122
123 # install the default hooks into the Branch class.
124-Branch.hooks = BranchHooks()
125+Branch.hooks = BranchHooks() # type: ignore
126
127
128 class ChangeBranchTipParams(object):
129@@ -2063,7 +2069,7 @@
130 can be carried out on.
131 """
132
133- _optimisers = []
134+ _optimisers: List[Type["InterBranch"]] = []
135 """The available optimised InterBranch types."""
136
137 @classmethod
138
139=== modified file 'breezy/builtins.py'
140--- breezy/builtins.py 2022-08-22 18:19:46 +0000
141+++ breezy/builtins.py 2022-10-19 15:51:12 +0000
142@@ -24,6 +24,7 @@
143 import breezy.git
144
145 from . import (
146+ controldir,
147 errors,
148 transport,
149 )
150@@ -36,7 +37,6 @@
151 from breezy import (
152 branch as _mod_branch,
153 bugtracker,
154- controldir,
155 directory_service,
156 delta,
157 config as _mod_config,
158@@ -924,7 +924,6 @@
159 """
160
161 takes_args = ['names*']
162- takes_options = []
163 aliases = ['copy']
164 encoding_type = 'replace'
165
166@@ -2084,7 +2083,7 @@
167 help='Specify a format for this branch. '
168 'See "help formats" for a full list.',
169 lazy_registry=('breezy.controldir', 'format_registry'),
170- converter=lambda name: controldir.format_registry.make_controldir(
171+ converter=lambda name: controldir.format_registry.make_controldir( # type: ignore
172 name),
173 value_switches=True,
174 title="Branch format",
175@@ -2207,7 +2206,7 @@
176 ' "brz help formats" for details.',
177 lazy_registry=(
178 'breezy.controldir', 'format_registry'),
179- converter=lambda name: controldir.format_registry.make_controldir(
180+ converter=lambda name: controldir.format_registry.make_controldir( # type: ignore
181 name),
182 value_switches=True, title='Repository format'),
183 Option('no-trees',
184@@ -3894,7 +3893,7 @@
185 help='Upgrade to a specific format. See "brz help'
186 ' formats" for details.',
187 lazy_registry=('breezy.controldir', 'format_registry'),
188- converter=lambda name: controldir.format_registry.make_controldir(
189+ converter=lambda name: controldir.format_registry.make_controldir( # type: ignore
190 name),
191 value_switches=True, title='Branch format'),
192 Option('clean',
193@@ -5414,7 +5413,6 @@
194 """
195
196 _see_also = ['checkouts', 'bind']
197- takes_args = []
198 takes_options = ['directory']
199
200 def run(self, directory=u'.'):
201@@ -5455,7 +5453,6 @@
202 ),
203 ]
204 takes_args = ['location?']
205- aliases = []
206 encoding_type = 'replace'
207
208 def run(self, location=None, dry_run=False, verbose=False,
209@@ -6455,7 +6452,6 @@
210 brz view --delete --all
211 """
212
213- _see_also = []
214 takes_args = ['file*']
215 takes_options = [
216 Option('all',
217
218=== modified file 'breezy/bzr/_static_tuple_py.py'
219--- breezy/bzr/_static_tuple_py.py 2022-07-16 12:50:01 +0000
220+++ breezy/bzr/_static_tuple_py.py 2022-10-19 15:51:12 +0000
221@@ -21,6 +21,7 @@
222 """
223
224 import sys
225+from typing import Dict
226
227
228 class StaticTuple(tuple):
229@@ -80,4 +81,4 @@
230 # the _empty_tuple singleton has been created yet or not.
231 _empty_tuple = None
232 _empty_tuple = StaticTuple()
233-_interned_tuples = {}
234+_interned_tuples: Dict[StaticTuple, StaticTuple] = {}
235
236=== modified file 'breezy/bzr/branch.py'
237--- breezy/bzr/branch.py 2022-08-22 18:19:46 +0000
238+++ breezy/bzr/branch.py 2022-10-19 15:51:12 +0000
239@@ -107,7 +107,7 @@
240 """Returns the directory containing the control directory."""
241 return self._base
242
243- base = property(_get_base, doc="The URL for the root of this branch.")
244+ base = property(_get_base, doc="The URL for the root of this branch.") # type: ignore
245
246 @property
247 def user_transport(self):
248
249=== modified file 'breezy/bzr/btree_index.py'
250--- breezy/bzr/btree_index.py 2022-07-16 12:50:01 +0000
251+++ breezy/bzr/btree_index.py 2022-10-19 15:51:12 +0000
252@@ -1557,8 +1557,8 @@
253 _gcchk_factory = _LeafNode
254
255 try:
256- from . import _btree_serializer_pyx as _btree_serializer
257- _gcchk_factory = _btree_serializer._parse_into_chk
258+ from . import _btree_serializer_pyx as _btree_serializer # type: ignore
259+ _gcchk_factory = _btree_serializer._parse_into_chk # type: ignore
260 except ImportError as e:
261 osutils.failed_to_load_extension(e)
262 from . import _btree_serializer_py as _btree_serializer
263
264=== modified file 'breezy/bzr/bzrdir.py'
265--- breezy/bzr/bzrdir.py 2022-08-22 18:19:46 +0000
266+++ breezy/bzr/bzrdir.py 2022-10-19 15:51:12 +0000
267@@ -26,6 +26,7 @@
268 """
269
270 import sys
271+from typing import Set
272
273 from ..lazy_import import lazy_import
274 lazy_import(globals(), """
275@@ -34,7 +35,6 @@
276 from breezy import (
277 branch as _mod_branch,
278 lockable_files,
279- lockdir,
280 osutils,
281 repository,
282 revision as _mod_revision,
283@@ -65,6 +65,7 @@
284 config,
285 controldir,
286 errors,
287+ lockdir,
288 transport as _mod_transport,
289 )
290 from ..transport import (
291@@ -1144,7 +1145,7 @@
292 :ivar features: Dictionary mapping feature names to their necessity
293 """
294
295- _present_features = set()
296+ _present_features: Set[str] = set()
297
298 def __init__(self):
299 self.features = {}
300@@ -1850,24 +1851,6 @@
301 return BzrDir.open_from_transport(to_convert.root_transport)
302
303
304-class ConvertMetaToColo(controldir.Converter):
305- """Convert a 'development-colo' bzrdir to a '2a' bzrdir."""
306-
307- def __init__(self, target_format):
308- """Create a converter that converts a 'development-colo' metadir
309- to a '2a' metadir.
310-
311- :param target_format: The final metadir format that is desired.
312- """
313- self.target_format = target_format
314-
315- def convert(self, to_convert, pb):
316- """See Converter.convert()."""
317- to_convert.transport.put_bytes('branch-format',
318- self.target_format.as_string())
319- return BzrDir.open_from_transport(to_convert.root_transport)
320-
321-
322 class CreateRepository(controldir.RepositoryAcquisitionPolicy):
323 """A policy of creating a new repository"""
324
325
326=== modified file 'breezy/bzr/groupcompress.py'
327--- breezy/bzr/groupcompress.py 2022-07-16 21:26:08 +0000
328+++ breezy/bzr/groupcompress.py 2022-10-19 15:51:12 +0000
329@@ -17,6 +17,7 @@
330 """Core compression logic for compressing streams of related files."""
331
332 import time
333+from typing import Type
334 import zlib
335
336 from ..lazy_import import lazy_import
337@@ -25,8 +26,6 @@
338 annotate,
339 config,
340 debug,
341- osutils,
342- trace,
343 tsort,
344 )
345 from breezy.bzr import (
346@@ -41,7 +40,9 @@
347
348 from .. import (
349 errors,
350- )
351+ osutils,
352+ trace,
353+)
354 from .btree_index import BTreeBuilder
355 from ..lru_cache import LRUSizeCache
356 from .versionedfile import (
357@@ -53,7 +54,7 @@
358 FulltextContentFactory,
359 VersionedFilesWithFallbacks,
360 UnavailableRepresentation,
361- )
362+)
363
364 # Minimum number of uncompressed bytes to try fetch at once when retrieving
365 # groupcompress blocks.
366@@ -2244,6 +2245,9 @@
367 key_dependencies.add_references(node[1], node[3][0])
368
369
370+GroupCompressor: Type[_CommonGroupCompressor]
371+
372+
373 from ._groupcompress_py import (
374 apply_delta,
375 apply_delta_to_source,
376@@ -2253,7 +2257,7 @@
377 LinesDeltaIndex,
378 )
379 try:
380- from ._groupcompress_pyx import (
381+ from ._groupcompress_pyx import ( # type: ignore
382 apply_delta,
383 apply_delta_to_source,
384 DeltaIndex,
385
386=== modified file 'breezy/bzr/inventory.py'
387--- breezy/bzr/inventory.py 2022-07-16 12:50:01 +0000
388+++ breezy/bzr/inventory.py 2022-10-19 15:51:12 +0000
389@@ -28,7 +28,7 @@
390 ROOT_ID = b"TREE_ROOT"
391
392 try:
393- from collections.abc import deque
394+ from collections.abc import deque # type: ignore
395 except ImportError: # python < 3.7
396 from collections import deque
397
398
399=== modified file 'breezy/bzr/inventorytree.py'
400--- breezy/bzr/inventorytree.py 2022-08-22 18:19:46 +0000
401+++ breezy/bzr/inventorytree.py 2022-10-19 15:51:12 +0000
402@@ -18,12 +18,13 @@
403 """
404
405 try:
406- from collections.abc import deque
407+ from collections.abc import deque # type: ignore
408 except ImportError: # python < 3.7
409 from collections import deque
410
411 import os
412 import re
413+from typing import Type, TYPE_CHECKING
414
415
416 from .. import (
417@@ -1143,11 +1144,14 @@
418 """InterTree implementation for InventoryTree objects.
419
420 """
421+ if TYPE_CHECKING:
422+ from ..workingtree import WorkingTreeFormat
423+
424 # Formats that will be used to test this InterTree. If both are
425 # None, this InterTree will not be tested (e.g. because a complex
426 # setup is required)
427- _matching_from_tree_format = None
428- _matching_to_tree_format = None
429+ _matching_from_tree_format: "WorkingTreeFormat"
430+ _matching_to_tree_format: "WorkingTreeFormat"
431
432 @classmethod
433 def is_compatible(kls, source, target):
434
435=== modified file 'breezy/bzr/knit.py'
436--- breezy/bzr/knit.py 2022-08-22 18:19:46 +0000
437+++ breezy/bzr/knit.py 2022-10-19 15:51:12 +0000
438@@ -68,7 +68,6 @@
439 ui,
440 )
441 from breezy.bzr import (
442- index as _mod_index,
443 pack,
444 static_tuple,
445 tuned_gzip,
446@@ -108,6 +107,9 @@
447 UnavailableRepresentation,
448 VersionedFilesWithFallbacks,
449 )
450+from . import (
451+ index as _mod_index,
452+ )
453
454
455 # TODO: Split out code specific to this format into an associated object.
456
457=== modified file 'breezy/bzr/knitrepo.py'
458--- breezy/bzr/knitrepo.py 2022-08-22 18:19:46 +0000
459+++ breezy/bzr/knitrepo.py 2022-10-19 15:51:12 +0000
460@@ -14,6 +14,8 @@
461 # along with this program; if not, write to the Free Software
462 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
463
464+from typing import Type
465+
466 from ..lazy_import import lazy_import
467 lazy_import(globals(), """
468 import itertools
469@@ -30,6 +32,7 @@
470 from breezy.bzr import (
471 knit as _mod_knit,
472 versionedfile,
473+ serializer,
474 xml5,
475 xml6,
476 xml7,
477@@ -42,11 +45,13 @@
478 from ..repository import (
479 InterRepository,
480 IsInWriteGroupError,
481+ Repository,
482 )
483-from ..bzr.repository import (
484+from .repository import (
485 RepositoryFormatMetaDir,
486 )
487-from ..bzr.vf_repository import (
488+from .serializer import Serializer
489+from .vf_repository import (
490 InterSameDataRepository,
491 MetaDirVersionedFileRepository,
492 MetaDirVersionedFileRepositoryFormat,
493@@ -118,8 +123,8 @@
494 # them to None ensures that if the constructor is changed to not initialize
495 # them, or a subclass fails to call the constructor, that an error will
496 # occur rather than the system working but generating incorrect data.
497- _commit_builder_class = None
498- _serializer = None
499+ _commit_builder_class: Type[VersionedFileCommitBuilder]
500+ _serializer: Serializer
501
502 def __init__(self, _format, a_controldir, control_files, _commit_builder_class,
503 _serializer):
504@@ -231,11 +236,11 @@
505
506 # Set this attribute in derived classes to control the repository class
507 # created by open and initialize.
508- repository_class = None
509+ repository_class: Type[Repository]
510 # Set this attribute in derived classes to control the
511 # _commit_builder_class that the repository objects will have passed to
512 # their constructor.
513- _commit_builder_class = None
514+ _commit_builder_class: Type[VersionedFileCommitBuilder]
515 # Set this attribute in derived clases to control the _serializer that the
516 # repository objects will have passed to their constructor.
517
518
519=== modified file 'breezy/bzr/pack_repo.py'
520--- breezy/bzr/pack_repo.py 2022-08-22 18:19:46 +0000
521+++ breezy/bzr/pack_repo.py 2022-10-19 15:51:12 +0000
522@@ -16,6 +16,7 @@
523
524 import re
525 import sys
526+from typing import Type
527
528 from ..lazy_import import lazy_import
529 lazy_import(globals(), """
530@@ -44,6 +45,7 @@
531 transport as _mod_transport,
532 )
533 from ..bzr import (
534+ index,
535 btree_index,
536 )
537
538@@ -55,11 +57,12 @@
539 _LazyListJoin,
540 RepositoryWriteLockResult,
541 )
542-from ..bzr.repository import (
543+from .repository import (
544 MetaDirRepository,
545 RepositoryFormatMetaDir,
546 )
547-from ..bzr.vf_repository import (
548+from .serializer import Serializer
549+from .vf_repository import (
550 MetaDirVersionedFileRepository,
551 MetaDirVersionedFileRepositoryFormat,
552 VersionedFileCommitBuilder,
553@@ -811,10 +814,10 @@
554 :ivar _names: map of {pack_name: (index_size,)}
555 """
556
557- pack_factory = None
558- resumed_pack_factory = None
559- normal_packer_class = None
560- optimising_packer_class = None
561+ pack_factory: Type[NewPack]
562+ resumed_pack_factory: Type[ResumedPack]
563+ normal_packer_class: Type[Packer]
564+ optimising_packer_class: Type[Packer]
565
566 def __init__(self, repo, transport, index_transport, upload_transport,
567 pack_transport, index_builder_class, index_class,
568@@ -1721,8 +1724,8 @@
569 # them to None ensures that if the constructor is changed to not initialize
570 # them, or a subclass fails to call the constructor, that an error will
571 # occur rather than the system working but generating incorrect data.
572- _commit_builder_class = None
573- _serializer = None
574+ _commit_builder_class: Type[VersionedFileCommitBuilder]
575+ _serializer: Serializer
576
577 def __init__(self, _format, a_controldir, control_files, _commit_builder_class,
578 _serializer):
579@@ -1912,27 +1915,27 @@
580
581 # Set this attribute in derived classes to control the repository class
582 # created by open and initialize.
583- repository_class = None
584+ repository_class: Type[PackRepository]
585 # Set this attribute in derived classes to control the
586 # _commit_builder_class that the repository objects will have passed to
587 # their constructor.
588- _commit_builder_class = None
589+ _commit_builder_class: Type[VersionedFileCommitBuilder]
590 # Set this attribute in derived clases to control the _serializer that the
591 # repository objects will have passed to their constructor.
592- _serializer = None
593+ _serializer: Serializer
594 # Packs are not confused by ghosts.
595- supports_ghosts = True
596+ supports_ghosts: bool = True
597 # External references are not supported in pack repositories yet.
598- supports_external_lookups = False
599+ supports_external_lookups: bool = False
600 # Most pack formats do not use chk lookups.
601- supports_chks = False
602+ supports_chks: bool = False
603 # What index classes to use
604- index_builder_class = None
605- index_class = None
606- _fetch_uses_deltas = True
607- fast_deltas = False
608- supports_funky_characters = True
609- revision_graph_can_have_wrong_parents = True
610+ index_builder_class: Type[index.GraphIndexBuilder]
611+ index_class: Type[object]
612+ _fetch_uses_deltas: bool = True
613+ fast_deltas: bool = False
614+ supports_funky_characters: bool = True
615+ revision_graph_can_have_wrong_parents: bool = True
616
617 def initialize(self, a_controldir, shared=False):
618 """Create a pack based repository.
619
620=== modified file 'breezy/bzr/remote.py'
621--- breezy/bzr/remote.py 2022-09-22 22:55:28 +0000
622+++ breezy/bzr/remote.py 2022-10-19 15:51:12 +0000
623@@ -1059,6 +1059,7 @@
624 self._supports_chks = None
625 self._supports_external_lookups = None
626 self._supports_tree_reference = None
627+ self._supports_ghosts = None
628 self._supports_funky_characters = None
629 self._supports_nesting_repositories = None
630 self._rich_root_data = None
631@@ -1119,6 +1120,14 @@
632 return self._supports_tree_reference
633
634 @property
635+ def supports_ghosts(self):
636+ if self._supports_ghosts is None:
637+ self._ensure_real()
638+ self._supports_ghosts = \
639+ self._custom_format.supports_ghosts
640+ return self._supports_ghosts
641+
642+ @property
643 def revision_graph_can_have_wrong_parents(self):
644 if self._revision_graph_can_have_wrong_parents is None:
645 self._ensure_real()
646
647=== modified file 'breezy/bzr/smart/client.py'
648--- breezy/bzr/smart/client.py 2020-02-18 01:57:45 +0000
649+++ breezy/bzr/smart/client.py 2022-10-19 15:51:12 +0000
650@@ -329,7 +329,7 @@
651 "accessible.", None)
652
653
654-_SmartClient.hooks = SmartClientHooks()
655+_SmartClient.hooks = SmartClientHooks() # type: ignore
656
657
658 class CallHookParams(object):
659
660=== modified file 'breezy/bzr/smart/medium.py'
661--- breezy/bzr/smart/medium.py 2022-07-15 14:06:55 +0000
662+++ breezy/bzr/smart/medium.py 2022-10-19 15:51:12 +0000
663@@ -30,10 +30,7 @@
664 import sys
665 import time
666
667-try:
668- import _thread
669-except ImportError:
670- import thread as _thread
671+import _thread
672
673 import breezy
674 from ...lazy_import import lazy_import
675
676=== modified file 'breezy/bzr/smart/message.py'
677--- breezy/bzr/smart/message.py 2020-02-18 01:57:45 +0000
678+++ breezy/bzr/smart/message.py 2022-10-19 15:51:12 +0000
679@@ -15,7 +15,7 @@
680 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
681
682 try:
683- from collections.abc import deque
684+ from collections.abc import deque # type: ignore
685 except ImportError: # python < 3.7
686 from collections import deque
687
688
689=== modified file 'breezy/bzr/smart/protocol.py'
690--- breezy/bzr/smart/protocol.py 2022-07-15 14:13:49 +0000
691+++ breezy/bzr/smart/protocol.py 2022-10-19 15:51:12 +0000
692@@ -20,7 +20,7 @@
693
694
695 try:
696- from collections.abc import deque
697+ from collections.abc import deque # type: ignore
698 except ImportError: # python < 3.7
699 from collections import deque
700
701
702=== modified file 'breezy/bzr/smart/server.py'
703--- breezy/bzr/smart/server.py 2022-07-04 15:43:01 +0000
704+++ breezy/bzr/smart/server.py 2022-10-19 15:51:12 +0000
705@@ -348,7 +348,7 @@
706 "in which case the server will exit normally.", (2, 4))
707
708
709-SmartTCPServer.hooks = SmartServerHooks()
710+SmartTCPServer.hooks = SmartServerHooks() # type: ignore
711
712
713 def _local_path_for_transport(transport):
714
715=== modified file 'breezy/bzr/tests/test__simple_set.py'
716--- breezy/bzr/tests/test__simple_set.py 2022-07-16 13:33:49 +0000
717+++ breezy/bzr/tests/test__simple_set.py 2022-10-19 15:51:12 +0000
718@@ -26,7 +26,7 @@
719 )
720
721 try:
722- from .. import _simple_set_pyx
723+ from .. import _simple_set_pyx # type: ignore
724 except ImportError:
725 _simple_set_pyx = None
726
727
728=== modified file 'breezy/bzr/tests/test__static_tuple.py'
729--- breezy/bzr/tests/test__static_tuple.py 2022-07-16 12:50:01 +0000
730+++ breezy/bzr/tests/test__static_tuple.py 2022-10-19 15:51:12 +0000
731@@ -16,10 +16,7 @@
732
733 """Tests for the StaticTuple type."""
734
735-try:
736- import cPickle as pickle
737-except ImportError:
738- import pickle
739+import pickle
740 import operator
741 import sys
742
743
744=== modified file 'breezy/bzr/tests/test_btree_index.py'
745--- breezy/bzr/tests/test_btree_index.py 2020-06-10 03:30:11 +0000
746+++ breezy/bzr/tests/test_btree_index.py 2022-10-19 15:51:12 +0000
747@@ -1273,26 +1273,6 @@
748 ], node.keys)
749 self.assertEqual(1, node.offset)
750
751- def test_LeafNode_2_2(self):
752- node_bytes = (b"type=leaf\n"
753- b"00\x0000\x00\t00\x00ref00\x00value:0\n"
754- b"00\x0011\x0000\x00ref00\t00\x00ref00\r01\x00ref01\x00value:1\n"
755- b"11\x0033\x0011\x00ref22\t11\x00ref22\r11\x00ref22\x00value:3\n"
756- b"11\x0044\x00\t11\x00ref00\x00value:4\n"
757- b""
758- )
759- node = btree_index._LeafNode(node_bytes, 2, 2)
760- # We do direct access, or don't care about order, to leaf nodes most of
761- # the time, so a dict is useful:
762- self.assertEqual({
763- (b'00', b'00'): (b'value:0', ((), ((b'00', b'ref00'),))),
764- (b'00', b'11'): (b'value:1', (((b'00', b'ref00'),),
765- ((b'00', b'ref00'), (b'01', b'ref01')))),
766- (b'11', b'33'): (b'value:3', (((b'11', b'ref22'),),
767- ((b'11', b'ref22'), (b'11', b'ref22')))),
768- (b'11', b'44'): (b'value:4', ((), ((b'11', b'ref00'),)))
769- }, dict(node.all_items()))
770-
771 def assertFlattened(self, expected, key, value, refs):
772 flat_key, flat_line = self.parse_btree._flatten_node(
773 (None, key, value, refs), bool(refs))
774
775=== modified file 'breezy/bzr/tests/test_bundle.py'
776--- breezy/bzr/tests/test_bundle.py 2022-09-22 22:55:28 +0000
777+++ breezy/bzr/tests/test_bundle.py 2022-10-19 15:51:12 +0000
778@@ -393,10 +393,10 @@
779 return tests.TestCaseWithTransport.make_branch_and_tree(
780 self, path, format)
781
782- def make_branch(self, path, format=None):
783+ def make_branch(self, path, format=None, name=None):
784 if format is None:
785 format = self.bzrdir_format()
786- return tests.TestCaseWithTransport.make_branch(self, path, format)
787+ return tests.TestCaseWithTransport.make_branch(self, path, format, name=name)
788
789 def create_bundle_text(self, base_rev_id, rev_id):
790 bundle_txt = BytesIO()
791
792=== modified file 'breezy/bzr/tests/test_inv.py'
793--- breezy/bzr/tests/test_inv.py 2022-07-02 13:44:01 +0000
794+++ breezy/bzr/tests/test_inv.py 2022-10-19 15:51:12 +0000
795@@ -716,7 +716,7 @@
796 dir = inventory.InventoryLink(b'123', 'hello.c', ROOT_ID)
797 self.assertEqual(dir.kind_character(), '')
798
799- def test_link_kind_character(self):
800+ def test_tree_ref_kind_character(self):
801 dir = TreeReference(b'123', 'hello.c', ROOT_ID)
802 self.assertEqual(dir.kind_character(), '+')
803
804
805=== modified file 'breezy/bzr/tests/test_pack.py'
806--- breezy/bzr/tests/test_pack.py 2022-07-16 17:53:49 +0000
807+++ breezy/bzr/tests/test_pack.py 2022-10-19 15:51:12 +0000
808@@ -178,16 +178,6 @@
809 b'Bazaar pack format 1 (introduced in 0.18)\n'
810 b'B3\nname1\nname2\n\nabc')
811
812- def test_add_bytes_record_two_names(self):
813- """Add a bytes record with two names."""
814- self.writer.begin()
815- offset, length = self.writer.add_bytes_record(
816- [b'abc'], len(b'abc'), names=[(b'name1', ), (b'name2', )])
817- self.assertEqual((42, 19), (offset, length))
818- self.assertOutput(
819- b'Bazaar pack format 1 (introduced in 0.18)\n'
820- b'B3\nname1\nname2\n\nabc')
821-
822 def test_add_bytes_record_two_element_name(self):
823 """Add a bytes record with a two-element name."""
824 self.writer.begin()
825
826=== modified file 'breezy/bzr/tests/test_repository.py'
827--- breezy/bzr/tests/test_repository.py 2022-08-22 18:19:46 +0000
828+++ breezy/bzr/tests/test_repository.py 2022-10-19 15:51:12 +0000
829@@ -403,9 +403,11 @@
830 dummy_a = DummyRepository()
831 dummy_a._format = RepositoryFormat()
832 dummy_a._format.supports_full_versioned_files = True
833+ dummy_a._format.rich_root_data = True
834 dummy_b = DummyRepository()
835 dummy_b._format = RepositoryFormat()
836 dummy_b._format.supports_full_versioned_files = True
837+ dummy_b._format.rich_root_data = True
838 self.assertGetsDefaultInterRepository(dummy_a, dummy_b)
839
840 def assertGetsDefaultInterRepository(self, repo_a, repo_b):
841@@ -585,54 +587,6 @@
842 # versions of the file.
843 self.assertEqual(file_1_details[0][:3], file_2_details[0][:3])
844
845- def test_fetch_combines_groups(self):
846- builder = self.make_branch_builder('source', format='2a')
847- builder.start_series()
848- builder.build_snapshot(None, [
849- ('add', ('', b'root-id', 'directory', '')),
850- ('add', ('file', b'file-id', 'file', b'content\n'))],
851- revision_id=b'1')
852- builder.build_snapshot([b'1'], [
853- ('modify', ('file', b'content-2\n'))],
854- revision_id=b'2')
855- builder.finish_series()
856- source = builder.get_branch()
857- target = self.make_repository('target', format='2a')
858- target.fetch(source.repository)
859- target.lock_read()
860- self.addCleanup(target.unlock)
861- details = target.texts._index.get_build_details(
862- [(b'file-id', b'1',), (b'file-id', b'2',)])
863- file_1_details = details[(b'file-id', b'1')]
864- file_2_details = details[(b'file-id', b'2')]
865- # The index, and what to read off disk, should be the same for both
866- # versions of the file.
867- self.assertEqual(file_1_details[0][:3], file_2_details[0][:3])
868-
869- def test_fetch_combines_groups(self):
870- builder = self.make_branch_builder('source', format='2a')
871- builder.start_series()
872- builder.build_snapshot(None, [
873- ('add', ('', b'root-id', 'directory', '')),
874- ('add', ('file', b'file-id', 'file', b'content\n'))],
875- revision_id=b'1')
876- builder.build_snapshot([b'1'], [
877- ('modify', ('file', b'content-2\n'))],
878- revision_id=b'2')
879- builder.finish_series()
880- source = builder.get_branch()
881- target = self.make_repository('target', format='2a')
882- target.fetch(source.repository)
883- target.lock_read()
884- self.addCleanup(target.unlock)
885- details = target.texts._index.get_build_details(
886- [(b'file-id', b'1',), (b'file-id', b'2',)])
887- file_1_details = details[(b'file-id', b'1')]
888- file_2_details = details[(b'file-id', b'2')]
889- # The index, and what to read off disk, should be the same for both
890- # versions of the file.
891- self.assertEqual(file_1_details[0][:3], file_2_details[0][:3])
892-
893 def test_format_pack_compresses_True(self):
894 repo = self.make_repository('repo', format='2a')
895 self.assertTrue(repo._format.pack_compresses)
896
897=== modified file 'breezy/bzr/tests/test_smart_transport.py'
898--- breezy/bzr/tests/test_smart_transport.py 2022-08-22 18:19:46 +0000
899+++ breezy/bzr/tests/test_smart_transport.py 2022-10-19 15:51:12 +0000
900@@ -26,6 +26,7 @@
901 import sys
902 import threading
903 import time
904+from typing import Type, Optional
905
906 from testtools.matchers import DocTestMatches
907
908@@ -1936,10 +1937,10 @@
909 Subclasses can override client_protocol_class and server_protocol_class.
910 """
911
912- request_encoder = None
913- response_decoder = None
914- server_protocol_class = None
915- client_protocol_class = None
916+ request_encoder: object
917+ response_decoder: Type[protocol._StatefulDecoder]
918+ server_protocol_class: Type[protocol.SmartProtocolBase]
919+ client_protocol_class: Optional[Type[protocol.SmartProtocolBase]] = None
920
921 def make_client_protocol_and_output(self, input_bytes=None):
922 """
923@@ -2785,7 +2786,7 @@
924 # method. So we make server_protocol_class be a static method, rather than
925 # simply doing:
926 # "server_protocol_class = protocol.build_server_protocol_three".
927- server_protocol_class = staticmethod(protocol.build_server_protocol_three)
928+ server_protocol_class = staticmethod(protocol.build_server_protocol_three) # type: ignore
929
930 def setUp(self):
931 super(TestVersionOneFeaturesInProtocolThree, self).setUp()
932@@ -2835,7 +2836,7 @@
933
934 request_encoder = protocol.ProtocolThreeRequester
935 response_decoder = protocol.ProtocolThreeDecoder
936- server_protocol_class = protocol.ProtocolThreeDecoder
937+ server_protocol_class = protocol.ProtocolThreeDecoder # type: ignore
938
939 def test_trivial_request(self):
940 """Smoke test for the simplest possible v3 request: empty headers, no
941@@ -3207,7 +3208,7 @@
942
943 request_encoder = protocol.ProtocolThreeRequester
944 response_decoder = protocol.ProtocolThreeDecoder
945- server_protocol_class = protocol.ProtocolThreeDecoder
946+ server_protocol_class = protocol.ProtocolThreeDecoder # type: ignore
947
948 def make_client_encoder_and_output(self):
949 result = self.make_client_protocol_and_output()
950
951=== modified file 'breezy/bzr/versionedfile.py'
952--- breezy/bzr/versionedfile.py 2022-09-08 14:15:34 +0000
953+++ breezy/bzr/versionedfile.py 2022-10-19 15:51:12 +0000
954@@ -39,7 +39,6 @@
955 )
956 from breezy.bzr import (
957 groupcompress,
958- index,
959 knit,
960 )
961 """)
962@@ -50,6 +49,10 @@
963 from ..registry import Registry
964 from ..textmerge import TextMerge
965
966+from . import (
967+ index,
968+ )
969+
970
971 adapter_registry = Registry()
972 adapter_registry.register_lazy(('knit-annotated-delta-gz', 'knit-delta-gz'),
973
974=== modified file 'breezy/bzr/workingtree.py'
975--- breezy/bzr/workingtree.py 2022-08-22 18:19:46 +0000
976+++ breezy/bzr/workingtree.py 2022-10-19 15:51:12 +0000
977@@ -33,7 +33,7 @@
978 from bisect import bisect_left
979 import breezy
980 try:
981- from collections.abc import deque
982+ from collections.abc import deque # type: ignore
983 except ImportError: # python < 3.7
984 from collections import deque
985 import errno
986@@ -57,7 +57,6 @@
987 globbing,
988 ignores,
989 merge,
990- revision as _mod_revision,
991 )
992 from breezy.bzr import (
993 conflicts as _mod_bzr_conflicts,
994@@ -73,6 +72,7 @@
995 from .. import (
996 errors,
997 osutils,
998+ revision as _mod_revision,
999 transport as _mod_transport,
1000 )
1001 from ..controldir import ControlDir
1002@@ -767,6 +767,40 @@
1003 raise _mod_transport.NoSuchFile(path)
1004 raise
1005
1006+ def path_content_summary(self, path, _lstat=os.lstat,
1007+ _mapper=osutils.file_kind_from_stat_mode):
1008+ """See Tree.path_content_summary."""
1009+ abspath = self.abspath(path)
1010+ try:
1011+ stat_result = _lstat(abspath)
1012+ except OSError as e:
1013+ if getattr(e, 'errno', None) == errno.ENOENT:
1014+ # no file.
1015+ return ('missing', None, None, None)
1016+ # propagate other errors
1017+ raise
1018+ kind = _mapper(stat_result.st_mode)
1019+ if kind == 'file':
1020+ return self._file_content_summary(path, stat_result)
1021+ elif kind == 'directory':
1022+ # perhaps it looks like a plain directory, but it's really a
1023+ # reference.
1024+ if self._directory_is_tree_reference(path):
1025+ kind = 'tree-reference'
1026+ return kind, None, None, None
1027+ elif kind == 'symlink':
1028+ target = osutils.readlink(abspath)
1029+ return ('symlink', None, None, target)
1030+ else:
1031+ return (kind, None, None, None)
1032+
1033+ def _file_content_summary(self, path, stat_result):
1034+ size = stat_result.st_size
1035+ executable = self._is_executable_from_path_and_stat(path, stat_result)
1036+ # try for a stat cache lookup
1037+ return ('file', size, executable, self._sha_from_stat(
1038+ path, stat_result))
1039+
1040 def _is_executable_from_path_and_stat_from_basis(self, path, stat_result):
1041 try:
1042 return self._path2ie(path).executable
1043
1044=== modified file 'breezy/bzr/workingtree_4.py'
1045--- breezy/bzr/workingtree_4.py 2022-08-22 18:19:46 +0000
1046+++ breezy/bzr/workingtree_4.py 2022-10-19 15:51:12 +0000
1047@@ -38,13 +38,11 @@
1048 debug,
1049 filters as _mod_filters,
1050 osutils,
1051- revision as _mod_revision,
1052 revisiontree,
1053 trace,
1054 views,
1055 )
1056 from breezy.bzr import (
1057- dirstate,
1058 generate_ids,
1059 transform as bzr_transform,
1060 )
1061@@ -52,8 +50,8 @@
1062
1063 from .. import (
1064 errors,
1065+ revision as _mod_revision,
1066 )
1067-from .inventory import Inventory, ROOT_ID, entry_factory
1068 from ..lock import LogicalLockResult
1069 from ..lockable_files import LockableFiles
1070 from ..lockdir import LockDir
1071@@ -83,10 +81,12 @@
1072 from ..workingtree import (
1073 WorkingTree,
1074 )
1075+from .inventory import Inventory, ROOT_ID, entry_factory
1076 from .workingtree import (
1077 InventoryWorkingTree,
1078 WorkingTreeFormatMetaDir,
1079 )
1080+from . import dirstate
1081
1082
1083 class DirStateWorkingTree(InventoryWorkingTree):
1084@@ -453,7 +453,7 @@
1085 return self._inventory
1086
1087 root_inventory = property(_get_root_inventory,
1088- "Root inventory of this tree")
1089+ doc="Root inventory of this tree")
1090
1091 def get_parent_ids(self):
1092 """See Tree.get_parent_ids.
1093
1094=== modified file 'breezy/bzr/xml8.py'
1095--- breezy/bzr/xml8.py 2021-11-13 12:44:39 +0000
1096+++ breezy/bzr/xml8.py 2022-10-19 15:51:12 +0000
1097@@ -14,7 +14,7 @@
1098 # along with this program; if not, write to the Free Software
1099 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1100
1101-from io import BytesIO
1102+from typing import List, Optional
1103
1104 from .. import (
1105 lazy_regex,
1106@@ -69,16 +69,16 @@
1107 Its revision format number matches its inventory number.
1108 """
1109
1110- __slots__ = []
1111+ __slots__: List[str] = []
1112
1113- root_id = None
1114+ root_id: Optional[bytes] = None
1115 support_altered_by_hack = True
1116 # This format supports the altered-by hack that reads file ids directly out
1117 # of the versionedfile, without doing XML parsing.
1118
1119 supported_kinds = {'file', 'directory', 'symlink'}
1120 format_num = b'8'
1121- revision_format_num = None
1122+ revision_format_num: Optional[bytes] = None
1123
1124 # The search regex used by xml based repositories to determine what things
1125 # where changed in a single commit.
1126
1127=== modified file 'breezy/bzr/xml_serializer.py'
1128--- breezy/bzr/xml_serializer.py 2022-01-21 17:19:24 +0000
1129+++ breezy/bzr/xml_serializer.py 2022-10-19 15:51:12 +0000
1130@@ -23,24 +23,12 @@
1131 # ElementTree bits
1132
1133 import re
1134-
1135-try:
1136- import xml.etree.cElementTree as elementtree
1137- from xml.etree.ElementTree import ParseError
1138-except ImportError:
1139- # Fall back to pure python implementation if C extension is unavailable
1140- import xml.etree.ElementTree as elementtree
1141- try:
1142- from xml.etree.ElementTree import ParseError
1143- except ImportError:
1144- from xml.parsers.expat import ExpatError as ParseError
1145-
1146-(ElementTree, SubElement, Element, fromstringlist, tostringlist, tostring,
1147- fromstring) = (
1148- elementtree.ElementTree, elementtree.SubElement, elementtree.Element,
1149- elementtree.fromstringlist, elementtree.tostringlist, elementtree.tostring,
1150- elementtree.fromstring)
1151-
1152+from typing import Dict, Union
1153+
1154+from xml.etree.ElementTree import (
1155+ ElementTree, SubElement, Element,
1156+ fromstringlist, tostringlist, tostring,
1157+ fromstring, ParseError)
1158
1159 from .. import (
1160 errors,
1161@@ -193,7 +181,7 @@
1162 for uni_chr in match.group().decode('utf8'))
1163
1164
1165-_to_escaped_map = {}
1166+_to_escaped_map: Dict[Union[bytes, str], str] = {}
1167
1168
1169 def encode_and_escape(unicode_or_utf8_str, _map=_to_escaped_map):
1170
1171=== modified file 'breezy/cache_utf8.py'
1172--- breezy/cache_utf8.py 2020-02-18 01:57:45 +0000
1173+++ breezy/cache_utf8.py 2022-10-19 15:51:12 +0000
1174@@ -19,10 +19,11 @@
1175
1176 """Some functions to enable caching the conversion between unicode to utf8"""
1177
1178-import codecs
1179-
1180-_utf8_encode = codecs.utf_8_encode
1181-_utf8_decode = codecs.utf_8_decode
1182+from codecs import (
1183+ utf_8_encode as _utf8_encode,
1184+ utf_8_decode as _utf8_decode,
1185+)
1186+from typing import Dict
1187
1188
1189 def _utf8_decode_with_None(bytestring, _utf8_decode=_utf8_decode):
1190@@ -40,8 +41,8 @@
1191 # Map revisions from and to utf8 encoding
1192 # Whenever we do an encode/decode operation, we save the result, so that
1193 # we don't have to do it again.
1194-_unicode_to_utf8_map = {}
1195-_utf8_to_unicode_map = {}
1196+_unicode_to_utf8_map: Dict[str, bytes] = {}
1197+_utf8_to_unicode_map: Dict[bytes, str] = {}
1198
1199
1200 def encode(unicode_str,
1201
1202=== modified file 'breezy/commands.py'
1203--- breezy/commands.py 2022-07-02 13:44:01 +0000
1204+++ breezy/commands.py 2022-10-19 15:51:12 +0000
1205@@ -24,6 +24,7 @@
1206 import contextlib
1207 import os
1208 import sys
1209+from typing import Type, List, Union, Optional
1210
1211 from . import (
1212 i18n,
1213@@ -33,7 +34,6 @@
1214
1215 from .lazy_import import lazy_import
1216 lazy_import(globals(), """
1217-import errno
1218
1219 import breezy
1220 from breezy import (
1221@@ -50,11 +50,6 @@
1222 from . import errors, registry
1223
1224
1225-class BzrOptionError(errors.CommandError):
1226-
1227- _fmt = "Error in command line options"
1228-
1229-
1230 class CommandAvailableInPlugin(Exception):
1231
1232 internal_error = False
1233@@ -284,7 +279,8 @@
1234 return candidate
1235
1236
1237-def get_cmd_object(cmd_name, plugins_override=True):
1238+def get_cmd_object(
1239+ cmd_name: str, plugins_override: bool = True) -> Command:
1240 """Return the command object for a command.
1241
1242 plugins_override
1243@@ -303,7 +299,9 @@
1244 % cmd_name)
1245
1246
1247-def _get_cmd_object(cmd_name, plugins_override=True, check_missing=True):
1248+def _get_cmd_object(
1249+ cmd_name: str, plugins_override: bool = True,
1250+ check_missing: bool = True) -> Command:
1251 """Get a command object.
1252
1253 :param cmd_name: The name of the command.
1254@@ -317,7 +315,7 @@
1255 # in a Unicode name. In that case, they should just get a
1256 # 'command not found' error later.
1257 # In the future, we may actually support Unicode command names.
1258- cmd = None
1259+ cmd: Optional[Command] = None
1260 # Get a command
1261 for hook in Command.hooks['get_command']:
1262 cmd = hook(cmd, cmd_name)
1263@@ -469,14 +467,17 @@
1264 class Foo(Command):
1265 __doc__ = "My help goes here"
1266 """
1267- aliases = []
1268- takes_args = []
1269- takes_options = []
1270- encoding_type = 'strict'
1271- invoked_as = None
1272- l10n = True
1273-
1274- hidden = False
1275+ aliases: List[str] = []
1276+ takes_args: List[str] = []
1277+ takes_options: List[Union[str, option.Option]] = []
1278+ encoding_type: str = 'strict'
1279+ invoked_as: Optional[str] = None
1280+ l10n: bool = True
1281+ _see_also: List[str]
1282+
1283+ hidden: bool = False
1284+
1285+ hooks: Hooks
1286
1287 def __init__(self):
1288 """Construct an instance of this command."""
1289@@ -783,7 +784,7 @@
1290 hook(self)
1291 self.run = run
1292
1293- def run(self):
1294+ def run(self): # type: ignore
1295 """Actually run the command.
1296
1297 This is invoked with the options and arguments bound to
1298@@ -884,7 +885,7 @@
1299 "object.", (2, 6))
1300
1301
1302-Command.hooks = CommandHooks()
1303+Command.hooks = CommandHooks() # type: ignore
1304
1305
1306 def parse_args(command, argv, alias_argv=None):
1307@@ -1222,6 +1223,7 @@
1308 sys.stdout.flush()
1309 return result
1310 except IOError as e:
1311+ import errno
1312 if getattr(e, 'errno', None) is None:
1313 raise
1314 if e.errno != errno.EPIPE:
1315
1316=== modified file 'breezy/config.py'
1317--- breezy/config.py 2022-09-01 19:17:39 +0000
1318+++ breezy/config.py 2022-10-19 15:51:12 +0000
1319@@ -82,7 +82,7 @@
1320 import configobj
1321 from io import BytesIO
1322
1323-from typing import Tuple, Iterable
1324+from typing import Tuple, Iterable, Dict
1325
1326 import breezy
1327 from .lazy_import import lazy_import
1328@@ -3035,7 +3035,7 @@
1329 for hook in ConfigHooks['save']:
1330 hook(self)
1331
1332- def get_sections(self) -> Iterable[Tuple[Store, str]]:
1333+ def get_sections(self) -> Iterable[Tuple[Store, Section]]:
1334 """Get the configobj section in the file order.
1335
1336 Returns: An iterable of (store, section).
1337@@ -3433,7 +3433,7 @@
1338
1339 # FIXME: _shared_stores should be an attribute of a library state once a
1340 # library_state object is always available.
1341-_shared_stores = {}
1342+_shared_stores: Dict[str, Store] = {}
1343 _shared_stores_at_exit_installed = False
1344
1345
1346
1347=== modified file 'breezy/conflicts.py'
1348--- breezy/conflicts.py 2021-11-13 13:01:39 +0000
1349+++ breezy/conflicts.py 2022-10-19 15:51:12 +0000
1350@@ -311,7 +311,7 @@
1351 class Conflict(object):
1352 """Base class for conflicts."""
1353
1354- typestring = None
1355+ typestring: str
1356
1357 def __init__(self, path):
1358 self.path = path
1359
1360=== modified file 'breezy/controldir.py'
1361--- breezy/controldir.py 2022-09-12 18:35:44 +0000
1362+++ breezy/controldir.py 2022-10-19 15:51:12 +0000
1363@@ -24,13 +24,14 @@
1364
1365 """
1366
1367+from typing import List, Type, Optional
1368+
1369 from .lazy_import import lazy_import
1370 lazy_import(globals(), """
1371 import textwrap
1372
1373 from breezy import (
1374 branch as _mod_branch,
1375- hooks,
1376 revision as _mod_revision,
1377 ui,
1378 urlutils,
1379@@ -42,6 +43,7 @@
1380
1381 from . import (
1382 errors,
1383+ hooks,
1384 registry,
1385 trace,
1386 transport as _mod_transport,
1387@@ -125,6 +127,8 @@
1388 API users to check for magic attributes to see what features are supported.
1389 """
1390
1391+ hooks: hooks.Hooks
1392+
1393 def can_convert_format(self):
1394 """Return true if this controldir is one whose format we can convert
1395 from."""
1396@@ -948,7 +952,7 @@
1397
1398
1399 # install the default hooks
1400-ControlDir.hooks = ControlDirHooks()
1401+ControlDir.hooks = ControlDirHooks() # type: ignore
1402
1403
1404 class ControlComponentFormat(object):
1405@@ -1099,10 +1103,10 @@
1406 working tree.
1407 """
1408
1409- _default_format = None
1410+ _default_format: Optional["ControlDirFormat"] = None
1411 """The default format used for new control directories."""
1412
1413- _probers = []
1414+ _probers: List[Type["Prober"]] = []
1415 """The registered format probers, e.g. BzrProber.
1416
1417 This is a list of Prober-derived classes.
1418
1419=== modified file 'breezy/diff.py'
1420--- breezy/diff.py 2022-09-22 22:55:28 +0000
1421+++ breezy/diff.py 2022-10-19 15:51:12 +0000
1422@@ -26,7 +26,6 @@
1423 import errno
1424 import patiencediff
1425 import subprocess
1426-import tempfile
1427
1428 from breezy import (
1429 controldir,
1430@@ -255,6 +254,7 @@
1431 def external_diff(old_label, oldlines, new_label, newlines, to_file,
1432 diff_opts):
1433 """Display a diff by calling out to the external diff program."""
1434+ import tempfile
1435 # make sure our own output is properly ordered before the diff
1436 to_file.flush()
1437
1438@@ -775,8 +775,10 @@
1439 def __init__(self, command_template: Union[str, List[str]],
1440 old_tree: Tree, new_tree: Tree, to_file,
1441 path_encoding='utf-8'):
1442+ import tempfile
1443 DiffPath.__init__(self, old_tree, new_tree, to_file, path_encoding)
1444 self.command_template = command_template
1445+ import tempfile
1446 self._root = tempfile.mkdtemp(prefix='brz-diff-')
1447
1448 @classmethod
1449
1450=== modified file 'breezy/doc_generate/conf.py'
1451--- breezy/doc_generate/conf.py 2020-02-18 01:57:45 +0000
1452+++ breezy/doc_generate/conf.py 2022-10-19 15:51:12 +0000
1453@@ -1,4 +1,7 @@
1454 # -*- coding: utf-8 -*-
1455+
1456+from typing import Dict, Any, List
1457+
1458 #
1459 # Bazaar documentation build configuration file, created by
1460 # sphinx-quickstart on Tue Jul 21 17:04:52 2009.
1461@@ -100,7 +103,7 @@
1462 # Theme options are theme-specific and customize the look and feel of a theme
1463 # further. For a list of options available for each theme, see the
1464 # documentation.
1465-html_theme_options = {
1466+html_theme_options: Dict[str, Any] = {
1467 # Unfortunately, the right sidebar breaks under IE6 and maybe IE7.
1468 # So we stick with the default left placement to cater for users stuck
1469 # on those browsers.
1470@@ -196,7 +199,7 @@
1471
1472 # Grouping the document tree into LaTeX files. List of tuples
1473 # (source start file, target name, title, author, documentclass [howto/manual]).
1474-latex_documents = []
1475+latex_documents: List[Any] = []
1476
1477 # The name of an image file (relative to this directory) to place at the top of
1478 # the title page.
1479
1480=== modified file 'breezy/errors.py'
1481--- breezy/errors.py 2022-08-22 18:19:46 +0000
1482+++ breezy/errors.py 2022-10-19 15:51:12 +0000
1483@@ -875,6 +875,8 @@
1484
1485 class NoSuchRevision(InternalBzrError):
1486
1487+ revision: bytes
1488+
1489 _fmt = "%(branch)s has no revision %(revision)s"
1490
1491 def __init__(self, branch, revision):
1492
1493=== modified file 'breezy/filters/__init__.py'
1494--- breezy/filters/__init__.py 2022-07-02 13:44:01 +0000
1495+++ breezy/filters/__init__.py 2022-10-19 15:51:12 +0000
1496@@ -43,6 +43,8 @@
1497 BytesIO,
1498 )
1499
1500+from typing import List, Tuple, Dict
1501+
1502 from .. import (
1503 errors,
1504 osutils,
1505@@ -65,6 +67,10 @@
1506 return "reader: %s, writer: %s" % (self.reader, self.writer)
1507
1508
1509+Preferences = List[Tuple[str, str]]
1510+Stack = List[ContentFilter]
1511+
1512+
1513 class ContentFilterContext(object):
1514 """Object providing information that filters can use."""
1515
1516@@ -168,7 +174,7 @@
1517
1518 # Cache of preferences -> stack
1519 # TODO: make this per branch (say) rather than global
1520-_stack_cache = {}
1521+_stack_cache: Dict[Preferences, Stack] = {}
1522
1523
1524 def _get_registered_names():
1525@@ -178,7 +184,7 @@
1526 return filter_stacks_registry.keys()
1527
1528
1529-def _get_filter_stack_for(preferences):
1530+def _get_filter_stack_for(preferences: Preferences) -> Stack:
1531 """Get the filter stack given a sequence of preferences.
1532
1533 :param preferences: a sequence of (name,value) tuples where
1534
1535=== modified file 'breezy/foreign.py'
1536--- breezy/foreign.py 2020-02-18 01:57:45 +0000
1537+++ breezy/foreign.py 2022-10-19 15:51:12 +0000
1538@@ -39,7 +39,7 @@
1539
1540 # Prefix used when importing revisions native to the foreign VCS (as
1541 # opposed to roundtripping bzr-native revisions) using this mapping.
1542- revid_prefix = None
1543+ revid_prefix: bytes
1544
1545 def __init__(self, vcs):
1546 """Create a new VcsMapping.
1547@@ -191,7 +191,7 @@
1548 """
1549
1550 # This repository's native version control system
1551- vcs = None
1552+ vcs: ForeignVcs
1553
1554 def has_foreign_revision(self, foreign_revid):
1555 """Check whether the specified foreign revision is present.
1556
1557=== modified file 'breezy/forge.py'
1558--- breezy/forge.py 2022-07-17 01:52:51 +0000
1559+++ breezy/forge.py 2022-10-19 15:51:12 +0000
1560@@ -259,7 +259,7 @@
1561
1562 # Does this forge support arbitrary labels being attached to merge
1563 # proposals?
1564- supports_merge_proposal_labels = None
1565+ supports_merge_proposal_labels: bool
1566
1567 @property
1568 def name(self):
1569@@ -268,18 +268,18 @@
1570
1571 # Does this forge support suggesting a commit message in the
1572 # merge proposal?
1573- supports_merge_proposal_commit_message = None
1574+ supports_merge_proposal_commit_message: bool
1575
1576 # The base_url that would be visible to users. I.e. https://github.com/
1577 # rather than https://api.github.com/
1578- base_url = None
1579+ base_url: str
1580
1581 # The syntax to use for formatting merge proposal descriptions.
1582 # Common values: 'plain', 'markdown'
1583- merge_proposal_description_format = None
1584+ merge_proposal_description_format: str
1585
1586 # Does this forge support the allow_collaboration flag?
1587- supports_allow_collaboration = False
1588+ supports_allow_collaboration: bool = False
1589
1590 def publish_derived(self, new_branch, base_branch, name, project=None,
1591 owner=None, revision_id=None, overwrite=False,
1592
1593=== modified file 'breezy/git/branch.py'
1594--- breezy/git/branch.py 2022-08-28 18:54:11 +0000
1595+++ breezy/git/branch.py 2022-10-19 15:51:12 +0000
1596@@ -21,6 +21,7 @@
1597 import contextlib
1598 from io import BytesIO
1599 from collections import defaultdict
1600+from typing import Dict
1601
1602 from dulwich.config import (
1603 ConfigFile as GitConfigFile,
1604@@ -465,7 +466,7 @@
1605 self._user_transport = controldir.user_transport.clone('.')
1606 self._control_transport = controldir.control_transport.clone('.')
1607 self._tag_refs = None
1608- params = {}
1609+ params: Dict[str, str] = {}
1610 try:
1611 self.name = ref_to_branch_name(ref)
1612 except ValueError:
1613
1614=== modified file 'breezy/git/cache.py'
1615--- breezy/git/cache.py 2022-08-22 18:19:46 +0000
1616+++ breezy/git/cache.py 2022-10-19 15:51:12 +0000
1617@@ -16,16 +16,14 @@
1618
1619 """Map from Git sha's to Bazaar objects."""
1620
1621+import os
1622+import threading
1623+
1624 from dulwich.objects import (
1625 sha_to_hex,
1626 hex_to_sha,
1627- )
1628-import os
1629-import threading
1630-
1631-from dulwich.objects import (
1632 ShaFile,
1633- )
1634+)
1635
1636 from .. import (
1637 bedding,
1638@@ -33,17 +31,17 @@
1639 osutils,
1640 registry,
1641 trace,
1642- )
1643+)
1644 from ..bzr import (
1645 btree_index as _mod_btree_index,
1646 index as _mod_index,
1647 versionedfile,
1648- )
1649+)
1650 from ..transport import (
1651 get_transport_from_path,
1652 FileExists,
1653 NoSuchFile,
1654- )
1655+)
1656
1657
1658 def get_cache_dir():
1659@@ -67,30 +65,6 @@
1660 return get_transport_from_path(path)
1661
1662
1663-def check_pysqlite_version(sqlite3):
1664- """Check that sqlite library is compatible.
1665-
1666- """
1667- if (sqlite3.sqlite_version_info[0] < 3
1668- or (sqlite3.sqlite_version_info[0] == 3 and
1669- sqlite3.sqlite_version_info[1] < 3)):
1670- trace.warning('Needs at least sqlite 3.3.x')
1671- raise bzr_errors.BzrError("incompatible sqlite library")
1672-
1673-
1674-try:
1675- try:
1676- import sqlite3
1677- check_pysqlite_version(sqlite3)
1678- except (ImportError, bzr_errors.BzrError):
1679- from pysqlite2 import dbapi2 as sqlite3
1680- check_pysqlite_version(sqlite3)
1681-except BaseException:
1682- trace.warning('Needs at least Python2.5 or Python2.4 with the pysqlite2 '
1683- 'module')
1684- raise bzr_errors.BzrError("missing sqlite library")
1685-
1686-
1687 _mapdbs = threading.local()
1688
1689
1690@@ -420,6 +394,7 @@
1691 """Bazaar GIT Sha map that uses a sqlite database for storage."""
1692
1693 def __init__(self, path=None):
1694+ import sqlite3
1695 self.path = path
1696 if path is None:
1697 self.db = sqlite3.connect(":memory:")
1698
1699=== modified file 'breezy/git/dir.py'
1700--- breezy/git/dir.py 2022-08-22 18:19:46 +0000
1701+++ breezy/git/dir.py 2022-10-19 15:51:12 +0000
1702@@ -23,7 +23,7 @@
1703 try:
1704 from dulwich.refs import SymrefLoop
1705 except ImportError:
1706- SymrefLoop = KeyError
1707+ SymrefLoop = KeyError # type: ignore
1708
1709 from .. import (
1710 branch as _mod_branch,
1711
1712=== modified file 'breezy/git/filegraph.py'
1713--- breezy/git/filegraph.py 2022-01-04 18:23:48 +0000
1714+++ breezy/git/filegraph.py 2022-10-19 15:51:12 +0000
1715@@ -23,11 +23,7 @@
1716 from dulwich.errors import (
1717 NotTreeError,
1718 )
1719-try:
1720- from dulwich.objects import SubmoduleEncountered
1721-except ImportError:
1722- class SubmoduleEncountered(Exception):
1723- pass
1724+from dulwich.objects import SubmoduleEncountered
1725 from dulwich.object_store import (
1726 tree_lookup_path,
1727 )
1728
1729=== modified file 'breezy/git/mapping.py'
1730--- breezy/git/mapping.py 2022-08-26 08:53:40 +0000
1731+++ breezy/git/mapping.py 2022-10-19 15:51:12 +0000
1732@@ -20,6 +20,7 @@
1733
1734 import base64
1735 import stat
1736+from typing import Optional
1737
1738 import fastbencode as bencode
1739
1740
1741=== modified file 'breezy/git/remote.py'
1742--- breezy/git/remote.py 2022-09-14 19:01:01 +0000
1743+++ breezy/git/remote.py 2022-10-19 15:51:12 +0000
1744@@ -22,7 +22,7 @@
1745 try:
1746 from dulwich.refs import SymrefLoop
1747 except ImportError:
1748- SymrefLoop = KeyError
1749+ SymrefLoop = KeyError # type: ignore
1750
1751 from .. import (
1752 config,
1753@@ -125,7 +125,6 @@
1754 import select
1755
1756 import urllib.parse as urlparse
1757-from urllib.parse import splituser
1758
1759 # urlparse only supports a limited number of schemes by default
1760 register_urlparse_netloc_protocol('git')
1761
1762=== modified file 'breezy/git/repository.py'
1763--- breezy/git/repository.py 2022-01-24 20:22:05 +0000
1764+++ breezy/git/repository.py 2022-10-19 15:51:12 +0000
1765@@ -115,7 +115,6 @@
1766 class GitRepository(ForeignRepository):
1767 """An adapter to git repositories for bzr."""
1768
1769- _serializer = None
1770 vcs = foreign_vcs_git
1771 chk_bytes = None
1772
1773@@ -583,6 +582,8 @@
1774 supports_custom_revision_properties = False
1775 records_per_file_revision = False
1776 supports_multiple_authors = False
1777+ supports_ghosts = False
1778+ supports_chks = False
1779
1780 @property
1781 def _matchingcontroldir(self):
1782
1783=== modified file 'breezy/git/tests/test_remote.py'
1784--- breezy/git/tests/test_remote.py 2022-09-14 13:52:36 +0000
1785+++ breezy/git/tests/test_remote.py 2022-10-19 15:51:12 +0000
1786@@ -308,7 +308,7 @@
1787
1788 _test_needs_features = [ExecutableFeature('git')]
1789
1790- _to_format = None
1791+ _to_format: str
1792
1793 def setUp(self):
1794 TestCaseWithTransport.setUp(self)
1795@@ -495,7 +495,7 @@
1796
1797 _test_needs_features = [ExecutableFeature('git')]
1798
1799- _from_format = None
1800+ _from_format: str
1801
1802 def setUp(self):
1803 TestCaseWithTransport.setUp(self)
1804
1805=== modified file 'breezy/git/tests/test_repository.py'
1806--- breezy/git/tests/test_repository.py 2022-09-30 23:41:52 +0000
1807+++ breezy/git/tests/test_repository.py 2022-10-19 15:51:12 +0000
1808@@ -240,7 +240,7 @@
1809 r = dulwich.repo.Repo('.')
1810 self.assertEqual(b'Joe Example <joe@example.com>', r[r.head()].author)
1811
1812- def test_authors(self):
1813+ def test_authors_single_author(self):
1814 wt = self.make_branch_and_tree('.', format='git')
1815 revid = wt.commit(
1816 "base", allow_pointless=True,
1817
1818=== modified file 'breezy/git/transportgit.py'
1819--- breezy/git/transportgit.py 2022-09-14 13:52:36 +0000
1820+++ breezy/git/transportgit.py 2022-10-19 15:51:12 +0000
1821@@ -54,7 +54,7 @@
1822 try:
1823 from dulwich.refs import SymrefLoop
1824 except ImportError: # dulwich < 0.20.46
1825- SymrefLoop = KeyError
1826+ SymrefLoop = KeyError # type: ignore
1827 from dulwich.repo import (
1828 BaseRepo,
1829 InfoRefsContainer,
1830
1831=== modified file 'breezy/git/tree.py'
1832--- breezy/git/tree.py 2022-10-02 16:57:16 +0000
1833+++ breezy/git/tree.py 2022-10-19 15:51:12 +0000
1834@@ -996,8 +996,6 @@
1835 class InterGitTrees(_mod_tree.InterTree):
1836 """InterTree that works between two git trees."""
1837
1838- _matching_from_tree_format = None
1839- _matching_to_tree_format = None
1840 _test_mutable_trees_to_test_trees = None
1841
1842 def __init__(self, source, target):
1843@@ -1618,7 +1616,11 @@
1844 raise
1845 kind = mode_kind(stat_result.st_mode)
1846 if kind == 'file':
1847- return self._file_content_summary(path, stat_result)
1848+ size = stat_result.st_size
1849+ executable = self._is_executable_from_path_and_stat(path, stat_result)
1850+ # try for a stat cache lookup
1851+ return ('file', size, executable, self._sha_from_stat(
1852+ path, stat_result))
1853 elif kind == 'directory':
1854 # perhaps it looks like a plain directory, but it's really a
1855 # reference.
1856
1857=== modified file 'breezy/git/workingtree.py'
1858--- breezy/git/workingtree.py 2022-08-22 18:19:46 +0000
1859+++ breezy/git/workingtree.py 2022-10-19 15:51:12 +0000
1860@@ -1303,7 +1303,7 @@
1861 def _read_submodule_head(self, path):
1862 return read_submodule_head(self.abspath(path))
1863
1864- def get_reference_revision(self, path, branch=None):
1865+ def get_reference_revision(self, path):
1866 hexsha = self._read_submodule_head(path)
1867 if hexsha is None:
1868 (index, subpath) = self._lookup_index(
1869
1870=== modified file 'breezy/graph.py'
1871--- breezy/graph.py 2020-02-18 01:57:45 +0000
1872+++ breezy/graph.py 2022-10-19 15:51:12 +0000
1873@@ -722,7 +722,7 @@
1874 all_unique_searcher._iterations)
1875 unique_tip_searchers = next_unique_searchers
1876
1877- def get_parent_map(self, revisions):
1878+ def get_parent_map(self, revisions): # type: ignore
1879 """Get a map of key:parent_list for revisions.
1880
1881 This implementation delegates to get_parents, for old parent_providers
1882
1883=== modified file 'breezy/hooks.py'
1884--- breezy/hooks.py 2022-07-09 20:29:40 +0000
1885+++ breezy/hooks.py 2022-10-19 15:51:12 +0000
1886@@ -18,6 +18,8 @@
1887
1888 """Support for plugin hooking logic."""
1889
1890+from typing import Dict, Tuple, List
1891+
1892 from . import (
1893 errors,
1894 registry,
1895@@ -436,7 +438,7 @@
1896
1897 # Lazily registered hooks. Maps (module, name, hook_name) tuples
1898 # to lists of tuples with objectgetters and names
1899-_lazy_hooks = {}
1900+_lazy_hooks: Dict[Tuple[str, str, str], List[Tuple[registry._ObjectGetter, str]]] = {}
1901
1902
1903 def install_lazy_named_hook(hookpoints_module, hookpoints_name, hook_name,
1904
1905=== modified file 'breezy/ignores.py'
1906--- breezy/ignores.py 2020-02-18 01:57:45 +0000
1907+++ breezy/ignores.py 2022-10-19 15:51:12 +0000
1908@@ -19,6 +19,7 @@
1909 import errno
1910 from io import BytesIO
1911 import os
1912+from typing import Set
1913
1914 import breezy
1915 from .lazy_import import lazy_import
1916@@ -154,7 +155,7 @@
1917 return to_add
1918
1919
1920-_runtime_ignores = set()
1921+_runtime_ignores: Set[str] = set()
1922
1923
1924 def add_runtime_ignores(ignores):
1925
1926=== modified file 'breezy/lock.py'
1927--- breezy/lock.py 2022-05-15 14:17:32 +0000
1928+++ breezy/lock.py 2022-10-19 15:51:12 +0000
1929@@ -37,6 +37,7 @@
1930 import errno
1931 import os
1932 import sys
1933+from typing import Dict, Set, List, Tuple, Type, Any
1934 import warnings
1935
1936 from . import (
1937@@ -184,7 +185,7 @@
1938 raise NotImplementedError()
1939
1940
1941-_lock_classes = []
1942+_lock_classes: List[Tuple[str, Any, Any]] = []
1943
1944
1945 if have_fcntl:
1946@@ -197,7 +198,7 @@
1947
1948 class _fcntl_WriteLock(_fcntl_FileLock):
1949
1950- _open_locks = set()
1951+ _open_locks: Set[str] = set()
1952
1953 def __init__(self, filename):
1954 super(_fcntl_WriteLock, self).__init__()
1955@@ -237,7 +238,7 @@
1956
1957 class _fcntl_ReadLock(_fcntl_FileLock):
1958
1959- _open_locks = {}
1960+ _open_locks: Dict[str, int] = {}
1961
1962 def __init__(self, filename):
1963 super(_fcntl_ReadLock, self).__init__()
1964@@ -349,12 +350,13 @@
1965
1966 if have_ctypes_win32:
1967 from ctypes.wintypes import DWORD, LPWSTR
1968+ import ctypes
1969 LPSECURITY_ATTRIBUTES = ctypes.c_void_p # used as NULL no need to declare
1970 HANDLE = ctypes.c_int # rather than unsigned as in ctypes.wintypes
1971 _function_name = "CreateFileW"
1972
1973 # CreateFile <http://msdn.microsoft.com/en-us/library/aa363858.aspx>
1974- _CreateFile = ctypes.WINFUNCTYPE(
1975+ _CreateFile = ctypes.WINFUNCTYPE( # type: ignore
1976 HANDLE, # return value
1977 LPWSTR, # lpFileName
1978 DWORD, # dwDesiredAccess
1979@@ -363,7 +365,7 @@
1980 DWORD, # dwCreationDisposition
1981 DWORD, # dwFlagsAndAttributes
1982 HANDLE # hTemplateFile
1983- )((_function_name, ctypes.windll.kernel32))
1984+ )((_function_name, ctypes.windll.kernel32)) # type: ignore
1985
1986 INVALID_HANDLE_VALUE = -1
1987
1988
1989=== modified file 'breezy/lsprof.py'
1990--- breezy/lsprof.py 2020-02-18 01:57:45 +0000
1991+++ breezy/lsprof.py 2022-10-19 15:51:12 +0000
1992@@ -4,15 +4,13 @@
1993 # instead of just the Stats object
1994
1995 import codecs
1996-try:
1997- import cPickle as pickle
1998-except ImportError:
1999- import pickle
2000+import pickle
2001 import operator
2002 import os
2003 import sys
2004 import _thread
2005 import threading
2006+from typing import Dict
2007 from _lsprof import Profiler, profiler_entry
2008
2009 from . import errors
2010@@ -291,7 +289,7 @@
2011 out_file.write('%d %d\n' % (lineno, totaltime))
2012
2013
2014-_fn2mod = {}
2015+_fn2mod: Dict[str, object] = {}
2016
2017
2018 def label(code, calltree=False):
2019
2020=== modified file 'breezy/merge.py'
2021--- breezy/merge.py 2022-09-22 23:36:26 +0000
2022+++ breezy/merge.py 2022-10-19 15:51:12 +0000
2023@@ -167,7 +167,7 @@
2024 is present.
2025 """
2026
2027- name_prefix = None
2028+ name_prefix: str
2029 default_files = None
2030
2031 def __init__(self, merger):
2032
2033=== modified file 'breezy/merge_directive.py'
2034--- breezy/merge_directive.py 2022-07-07 15:57:20 +0000
2035+++ breezy/merge_directive.py 2022-10-19 15:51:12 +0000
2036@@ -26,8 +26,6 @@
2037 diff,
2038 email_message,
2039 gpg,
2040- hooks,
2041- registry,
2042 revision as _mod_revision,
2043 timestamp,
2044 trace,
2045@@ -42,6 +40,8 @@
2046 """)
2047 from . import (
2048 errors,
2049+ hooks,
2050+ registry,
2051 )
2052
2053
2054
2055=== modified file 'breezy/mutabletree.py'
2056--- breezy/mutabletree.py 2022-07-04 16:45:36 +0000
2057+++ breezy/mutabletree.py 2022-10-19 15:51:12 +0000
2058@@ -356,7 +356,7 @@
2059
2060
2061 # install the default hooks into the MutableTree class.
2062-MutableTree.hooks = MutableTreeHooks()
2063+MutableTree.hooks = MutableTreeHooks() # type: ignore
2064
2065
2066 class PostCommitHookParams(object):
2067
2068=== modified file 'breezy/option.py'
2069--- breezy/option.py 2020-06-23 01:02:30 +0000
2070+++ breezy/option.py 2022-10-19 15:51:12 +0000
2071@@ -19,6 +19,7 @@
2072
2073 import optparse
2074 import re
2075+from typing import Dict
2076
2077 from . import (
2078 errors,
2079@@ -141,12 +142,12 @@
2080 """
2081
2082 # The dictionary of standard options. These are always legal.
2083- STD_OPTIONS = {}
2084+ STD_OPTIONS: Dict[str, "Option"] = {}
2085
2086 # The dictionary of commonly used options. these are only legal
2087 # if a command explicitly references them by name in the list
2088 # of supported options.
2089- OPTIONS = {}
2090+ OPTIONS: Dict[str, "Option"] = {}
2091
2092 def __init__(self, name, help='', type=None, argname=None,
2093 short_name=None, param_name=None, custom_callback=None,
2094
2095=== modified file 'breezy/osutils.py'
2096--- breezy/osutils.py 2022-09-22 22:55:28 +0000
2097+++ breezy/osutils.py 2022-10-19 15:51:12 +0000
2098@@ -21,6 +21,7 @@
2099 import sys
2100 import time
2101 import codecs
2102+from typing import Dict, List
2103
2104 from .lazy_import import lazy_import
2105 lazy_import(globals(), """
2106@@ -795,7 +796,7 @@
2107
2108
2109 # Cache of formatted offset strings
2110-_offset_cache = {}
2111+_offset_cache: Dict[int, str] = {}
2112
2113
2114 def format_date_with_offset_in_original_timezone(t, offset=0,
2115@@ -999,7 +1000,7 @@
2116 return pathjoin(*p)
2117
2118
2119-def parent_directories(filename):
2120+def parent_directories(filename: str):
2121 """Return the list of parent directories, deepest first.
2122
2123 For example, parent_directories("a/b/c") -> ["a/b", "a"].
2124@@ -2017,12 +2018,12 @@
2125 # data at once.
2126 MAX_SOCKET_CHUNK = 64 * 1024
2127
2128-_end_of_stream_errors = [errno.ECONNRESET, errno.EPIPE, errno.EINVAL]
2129+_end_of_stream_errors: List[int] = [errno.ECONNRESET, errno.EPIPE, errno.EINVAL]
2130 for _eno in ['WSAECONNRESET', 'WSAECONNABORTED']:
2131- _eno = getattr(errno, _eno, None)
2132- if _eno is not None:
2133- _end_of_stream_errors.append(_eno)
2134-del _eno
2135+ try:
2136+ _end_of_stream_errors.append(getattr(errno, _eno))
2137+ except AttributeError:
2138+ pass
2139
2140
2141 def read_bytes_from_socket(sock, report_activity=None,
2142
2143=== modified file 'breezy/plugins/darcs/__init__.py'
2144--- breezy/plugins/darcs/__init__.py 2020-08-10 15:00:17 +0000
2145+++ breezy/plugins/darcs/__init__.py 2022-10-19 15:51:12 +0000
2146@@ -54,10 +54,6 @@
2147 def _known_formats(self):
2148 return set([DarcsDirFormat()])
2149
2150- def open(self, transport, _found=False):
2151- """Open this directory."""
2152- raise DarcsUnsupportedError()
2153-
2154 def check_support_status(self, allow_unsupported, recommend_upgrade=True,
2155 basedir=None):
2156 raise DarcsUnsupportedError()
2157
2158=== modified file 'breezy/plugins/flake8/__init__.py'
2159--- breezy/plugins/flake8/__init__.py 2022-05-15 14:17:32 +0000
2160+++ breezy/plugins/flake8/__init__.py 2022-10-19 15:51:12 +0000
2161@@ -130,4 +130,4 @@
2162
2163
2164 from breezy.branch import Branch
2165-Branch.hooks.install_named_hook("pre_commit", _check_flake8, "Check flake8")
2166+Branch.hooks.install_named_hook("pre_commit", _check_flake8, "Check flake8") # type: ignore
2167
2168=== modified file 'breezy/plugins/launchpad/forge.py'
2169--- breezy/plugins/launchpad/forge.py 2022-09-06 20:41:25 +0000
2170+++ breezy/plugins/launchpad/forge.py 2022-10-19 15:51:12 +0000
2171@@ -215,8 +215,6 @@
2172 class Launchpad(Forge):
2173 """The Launchpad hosting service."""
2174
2175- name = 'launchpad'
2176-
2177 # https://bugs.launchpad.net/launchpad/+bug/397676
2178 supports_merge_proposal_labels = False
2179
2180
2181=== modified file 'breezy/plugins/launchpad/lp_registration.py'
2182--- breezy/plugins/launchpad/lp_registration.py 2022-05-15 14:17:32 +0000
2183+++ breezy/plugins/launchpad/lp_registration.py 2022-10-19 15:51:12 +0000
2184@@ -20,7 +20,6 @@
2185 from urllib.parse import urlsplit, urlunsplit
2186 import urllib
2187 from xmlrpc.client import (
2188- __version__ as xmlrpc_version,
2189 Fault,
2190 ProtocolError,
2191 ServerProxy,
2192@@ -100,8 +99,8 @@
2193 # NB: these should always end in a slash to avoid xmlrpclib appending
2194 # '/RPC2'
2195 LAUNCHPAD_INSTANCE = {}
2196- for instance, domain in LAUNCHPAD_DOMAINS.items():
2197- LAUNCHPAD_INSTANCE[instance] = 'https://xmlrpc.%s/bazaar/' % domain
2198+ for instance, _domain in LAUNCHPAD_DOMAINS.items():
2199+ LAUNCHPAD_INSTANCE[instance] = 'https://xmlrpc.%s/bazaar/' % _domain
2200
2201 DEFAULT_SERVICE_URL = LAUNCHPAD_INSTANCE[DEFAULT_INSTANCE]
2202
2203@@ -214,7 +213,7 @@
2204 """Base request for talking to a XMLRPC server."""
2205
2206 # Set this to the XMLRPC method name.
2207- _methodname = None
2208+ _methodname: str
2209
2210 def _request_params(self):
2211 """Return the arguments to pass to the method"""
2212
2213=== modified file 'breezy/plugins/repodebug/check_chk.py'
2214--- breezy/plugins/repodebug/check_chk.py 2020-02-18 01:57:45 +0000
2215+++ breezy/plugins/repodebug/check_chk.py 2022-10-19 15:51:12 +0000
2216@@ -36,7 +36,6 @@
2217 """
2218
2219 hidden = True
2220- takes_args = []
2221 takes_options = ['directory', 'revision']
2222
2223 def run(self, directory='.', revision=None):
2224
2225=== modified file 'breezy/plugins/weave_fmt/bzrdir.py'
2226--- breezy/plugins/weave_fmt/bzrdir.py 2022-08-22 18:19:46 +0000
2227+++ breezy/plugins/weave_fmt/bzrdir.py 2022-10-19 15:51:12 +0000
2228@@ -32,6 +32,7 @@
2229 )
2230 from ... import (
2231 errors,
2232+ lockable_files,
2233 )
2234 from ...transport import (
2235 get_transport,
2236@@ -46,7 +47,6 @@
2237 from breezy import (
2238 branch as _mod_branch,,
2239 graph,
2240- lockable_files,
2241 lockdir,
2242 osutils,
2243 revision as _mod_revision,
2244
2245=== modified file 'breezy/plugins/weave_fmt/test_store.py'
2246--- breezy/plugins/weave_fmt/test_store.py 2022-05-03 20:36:36 +0000
2247+++ breezy/plugins/weave_fmt/test_store.py 2022-10-19 15:51:12 +0000
2248@@ -287,7 +287,7 @@
2249 my_store.add(stream, b"foo", b'dsc')
2250 self.assertEqual([("_add", "foo.dsc", stream)], my_store._calls)
2251
2252- def test_add_simple_suffixed(self):
2253+ def test_add_simple_suffixed_dir(self):
2254 stream = BytesIO(b"content")
2255 my_store = InstrumentedTransportStore(MockTransport(), True)
2256 my_store.register_suffix('dsc')
2257
2258=== modified file 'breezy/plugins/weave_fmt/xml4.py'
2259--- breezy/plugins/weave_fmt/xml4.py 2020-02-18 01:57:45 +0000
2260+++ breezy/plugins/weave_fmt/xml4.py 2022-10-19 15:51:12 +0000
2261@@ -14,6 +14,8 @@
2262 # along with this program; if not, write to the Free Software
2263 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2264
2265+from typing import List
2266+
2267 from ...bzr.xml_serializer import (
2268 Element,
2269 SubElement,
2270@@ -34,7 +36,7 @@
2271 v4 serialisation is no longer supported, only deserialisation.
2272 """
2273
2274- __slots__ = []
2275+ __slots__: List[str] = []
2276
2277 def _pack_entry(self, ie):
2278 """Convert InventoryEntry to XML element"""
2279
2280=== modified file 'breezy/repository.py'
2281--- breezy/repository.py 2022-07-02 13:44:01 +0000
2282+++ breezy/repository.py 2022-10-19 15:51:12 +0000
2283@@ -14,6 +14,8 @@
2284 # along with this program; if not, write to the Free Software
2285 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2286
2287+from typing import List, Type
2288+
2289 from .lazy_import import lazy_import
2290 lazy_import(globals(), """
2291 import time
2292@@ -1276,61 +1278,61 @@
2293
2294 # Set to True or False in derived classes. True indicates that the format
2295 # supports ghosts gracefully.
2296- supports_ghosts = None
2297+ supports_ghosts: bool
2298 # Can this repository be given external locations to lookup additional
2299 # data. Set to True or False in derived classes.
2300- supports_external_lookups = None
2301+ supports_external_lookups: bool
2302 # Does this format support CHK bytestring lookups. Set to True or False in
2303 # derived classes.
2304- supports_chks = None
2305+ supports_chks: bool
2306 # Should fetch trigger a reconcile after the fetch? Only needed for
2307 # some repository formats that can suffer internal inconsistencies.
2308- _fetch_reconcile = False
2309+ _fetch_reconcile: bool = False
2310 # Does this format have < O(tree_size) delta generation. Used to hint what
2311 # code path for commit, amongst other things.
2312- fast_deltas = None
2313+ fast_deltas: bool
2314 # Does doing a pack operation compress data? Useful for the pack UI command
2315 # (so if there is one pack, the operation can still proceed because it may
2316 # help), and for fetching when data won't have come from the same
2317 # compressor.
2318- pack_compresses = False
2319+ pack_compresses: bool = False
2320 # Does the repository storage understand references to trees?
2321- supports_tree_reference = None
2322+ supports_tree_reference: bool
2323 # Is the format experimental ?
2324- experimental = False
2325+ experimental: bool = False
2326 # Does this repository format escape funky characters, or does it create
2327 # files with similar names as the versioned files in its contents on disk
2328 # ?
2329- supports_funky_characters = None
2330+ supports_funky_characters: bool
2331 # Does this repository format support leaving locks?
2332- supports_leaving_lock = None
2333+ supports_leaving_lock: bool
2334 # Does this format support the full VersionedFiles interface?
2335- supports_full_versioned_files = None
2336+ supports_full_versioned_files: bool
2337 # Does this format support signing revision signatures?
2338- supports_revision_signatures = True
2339+ supports_revision_signatures: bool = True
2340 # Can the revision graph have incorrect parents?
2341- revision_graph_can_have_wrong_parents = None
2342+ revision_graph_can_have_wrong_parents: bool
2343 # Does this format support setting revision ids?
2344- supports_setting_revision_ids = True
2345+ supports_setting_revision_ids: bool = True
2346 # Does this format support rich root data?
2347- rich_root_data = None
2348+ rich_root_data: bool
2349 # Does this format support explicitly versioned directories?
2350- supports_versioned_directories = None
2351+ supports_versioned_directories: bool
2352 # Can other repositories be nested into one of this format?
2353- supports_nesting_repositories = None
2354+ supports_nesting_repositories: bool
2355 # Is it possible for revisions to be present without being referenced
2356 # somewhere ?
2357- supports_unreferenced_revisions = None
2358+ supports_unreferenced_revisions: bool
2359 # Does this format store the current Branch.nick in a revision when
2360 # creating commits?
2361- supports_storing_branch_nick = True
2362+ supports_storing_branch_nick: bool = True
2363 # Does the format support overriding the transport to use
2364- supports_overriding_transport = True
2365+ supports_overriding_transport: bool = True
2366 # Does the format support setting custom revision properties?
2367- supports_custom_revision_properties = True
2368+ supports_custom_revision_properties: bool = True
2369 # Does the format record per-file revision metadata?
2370- records_per_file_revision = True
2371- supports_multiple_authors = True
2372+ records_per_file_revision: bool = True
2373+ supports_multiple_authors: bool = True
2374
2375 def __repr__(self):
2376 return "%s()" % self.__class__.__name__
2377@@ -1513,7 +1515,7 @@
2378 InterRepository.get(other).method_name(parameters).
2379 """
2380
2381- _optimisers = []
2382+ _optimisers: List[Type["InterRepository"]] = []
2383 """The available optimised InterRepository types."""
2384
2385 def copy_content(self, revision_id=None):
2386
2387=== modified file 'breezy/revision.py'
2388--- breezy/revision.py 2022-07-09 20:29:40 +0000
2389+++ breezy/revision.py 2022-10-19 15:51:12 +0000
2390@@ -19,7 +19,7 @@
2391
2392 __docformat__ = "google"
2393
2394-from typing import List, Optional, Dict
2395+from typing import List, Optional, Dict, Tuple
2396
2397 from . import (
2398 errors,
2399@@ -59,7 +59,7 @@
2400 timestamp: float
2401 timezone: int
2402
2403- def __init__(self, revision_id: RevisionID, properties=None, **args):
2404+ def __init__(self, revision_id: RevisionID, properties=None, **args) -> None:
2405 self.revision_id = revision_id
2406 if properties is None:
2407 self.properties = {}
2408@@ -69,7 +69,7 @@
2409 self.committer = None
2410 self.parent_ids = []
2411 self.parent_sha1s = []
2412- """Not used anymore - legacy from for 4."""
2413+ # Not used anymore - legacy from for 4.
2414 self.__dict__.update(args)
2415
2416 def __repr__(self):
2417@@ -166,7 +166,7 @@
2418 ancestors = [revision_id]
2419 distance = 0
2420 while len(ancestors) > 0:
2421- new_ancestors = []
2422+ new_ancestors: List[bytes] = []
2423 for ancestor in ancestors:
2424 if not only_present:
2425 yield ancestor, distance
2426@@ -184,13 +184,13 @@
2427 distance += 1
2428
2429
2430-def find_present_ancestors(revision_id: RevisionID, revision_source) -> List[RevisionID]:
2431+def find_present_ancestors(revision_id: RevisionID, revision_source) -> Dict[RevisionID, Tuple[int, int]]:
2432 """Return the ancestors of a revision present in a branch.
2433
2434 It's possible that a branch won't have the complete ancestry of
2435 one of its revisions.
2436 """
2437- found_ancestors = {}
2438+ found_ancestors: Dict[RevisionID, Tuple[int, int]] = {}
2439 anc_iter = enumerate(iter_ancestors(revision_id, revision_source,
2440 only_present=True))
2441 for anc_order, (anc_id, anc_distance) in anc_iter:
2442
2443=== modified file 'breezy/revisionspec.py'
2444--- breezy/revisionspec.py 2022-07-03 21:06:21 +0000
2445+++ breezy/revisionspec.py 2022-10-19 15:51:12 +0000
2446@@ -14,6 +14,7 @@
2447 # along with this program; if not, write to the Free Software
2448 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2449
2450+from typing import List, Type, Optional
2451
2452 from breezy import (
2453 revision,
2454@@ -44,20 +45,6 @@
2455 self.extra = ''
2456
2457
2458-class InvalidRevisionSpec(errors.BzrError):
2459-
2460- _fmt = ("Requested revision: '%(spec)s' does not exist in branch:"
2461- " %(branch_url)s%(extra)s")
2462-
2463- def __init__(self, spec, branch, extra=None):
2464- errors.BzrError.__init__(self, branch=branch, spec=spec)
2465- self.branch_url = getattr(branch, 'user_url', str(branch))
2466- if extra:
2467- self.extra = '\n' + str(extra)
2468- else:
2469- self.extra = ''
2470-
2471-
2472 class RevisionInfo(object):
2473 """The results of applying a revision specification to a branch."""
2474
2475@@ -156,8 +143,8 @@
2476 (Equivalent to the old Branch method get_revision_info())
2477 """
2478
2479- prefix = None
2480- dwim_catchable_exceptions = (InvalidRevisionSpec,)
2481+ prefix: Optional[str] = None
2482+ dwim_catchable_exceptions: List[Type[Exception]] = [InvalidRevisionSpec]
2483 """Exceptions that RevisionSpec_dwim._match_on will catch.
2484
2485 If the revspec is part of ``dwim_revspecs``, it may be tried with an
2486@@ -300,12 +287,12 @@
2487 is called so the string describing the revision is kept here until needed.
2488 """
2489
2490- help_txt = None
2491+ help_txt: str
2492
2493 _revno_regex = lazy_regex.lazy_compile(r'^(?:(\d+(\.\d+)*)|-\d+)(:.*)?$')
2494
2495 # The revspecs to try
2496- _possible_revspecs = []
2497+ _possible_revspecs: List[Type[registry._ObjectGetter]] = []
2498
2499 def _try_spectype(self, rstype, branch):
2500 rs = rstype(self.spec, _internal=True)
2501@@ -320,7 +307,7 @@
2502 if self._revno_regex.match(self.spec) is not None:
2503 try:
2504 return self._try_spectype(RevisionSpec_revno, branch)
2505- except RevisionSpec_revno.dwim_catchable_exceptions:
2506+ except tuple(RevisionSpec_revno.dwim_catchable_exceptions):
2507 pass
2508
2509 # Next see what has been registered
2510@@ -328,7 +315,7 @@
2511 rs_class = objgetter.get_obj()
2512 try:
2513 return self._try_spectype(rs_class, branch)
2514- except rs_class.dwim_catchable_exceptions:
2515+ except tuple(rs_class.dwim_catchable_exceptions):
2516 pass
2517
2518 # Well, I dunno what it is. Note that we don't try to keep track of the
2519@@ -621,7 +608,7 @@
2520 """
2521
2522 prefix = 'tag:'
2523- dwim_catchable_exceptions = (errors.NoSuchTag, errors.TagsNotSupported)
2524+ dwim_catchable_exceptions = [errors.NoSuchTag, errors.TagsNotSupported]
2525
2526 def _match_on(self, branch, revs):
2527 # Can raise tags not supported, NoSuchTag, etc
2528@@ -826,7 +813,7 @@
2529 branch:/path/to/branch
2530 """
2531 prefix = 'branch:'
2532- dwim_catchable_exceptions = (errors.NotBranchError,)
2533+ dwim_catchable_exceptions = [errors.NotBranchError]
2534
2535 def _match_on(self, branch, revs):
2536 from .branch import Branch
2537
2538=== modified file 'breezy/tag.py'
2539--- breezy/tag.py 2020-02-21 03:58:42 +0000
2540+++ breezy/tag.py 2022-10-19 15:51:12 +0000
2541@@ -27,6 +27,7 @@
2542 import itertools
2543 import re
2544 import sys
2545+from typing import List, Type
2546
2547 # NOTE: I was going to call this tags.py, but vim seems to think all files
2548 # called tags* are ctags files... mbp 20070220.
2549@@ -186,7 +187,7 @@
2550 """Operations between sets of tags.
2551 """
2552
2553- _optimisers = []
2554+ _optimisers: List[Type["InterTags"]] = []
2555 """The available optimised InterTags types."""
2556
2557 @classmethod
2558
2559=== modified file 'breezy/tests/TestUtil.py'
2560--- breezy/tests/TestUtil.py 2018-11-12 01:41:38 +0000
2561+++ breezy/tests/TestUtil.py 2022-10-19 15:51:12 +0000
2562@@ -18,6 +18,7 @@
2563
2564 import logging
2565 import unittest
2566+from typing import List, Dict
2567 import weakref
2568
2569 from .. import pyutils
2570@@ -133,7 +134,7 @@
2571
2572 suiteClass = TestSuite
2573 # Memoize test names by test class dict
2574- test_func_names = {}
2575+ test_func_names: Dict[str, List[str]] = {}
2576
2577 def loadTestsFromModuleNames(self, names):
2578 """use a custom means to load tests from modules.
2579
2580=== modified file 'breezy/tests/__init__.py'
2581--- breezy/tests/__init__.py 2022-09-22 22:55:28 +0000
2582+++ breezy/tests/__init__.py 2022-10-19 15:51:12 +0000
2583@@ -51,6 +51,7 @@
2584 import threading
2585 import time
2586 import traceback
2587+from typing import Set
2588 import unittest
2589 import warnings
2590
2591@@ -835,7 +836,7 @@
2592 % (type(suite), suite))
2593
2594
2595-TestSkipped = testtools.testcase.TestSkipped
2596+from testtools.testcase import TestSkipped
2597
2598
2599 class TestNotApplicable(TestSkipped):
2600@@ -860,7 +861,7 @@
2601 return '<unprintable %s object>' % type(value).__name__
2602
2603
2604-traceback._some_str = _clever_some_str
2605+traceback._some_str = _clever_some_str # type: ignore
2606
2607
2608 # deprecated - use self.knownFailure(), or self.expectFailure.
2609@@ -2432,7 +2433,7 @@
2610 # client frames. Beyond this we could get more clever, but this is good
2611 # enough for now.
2612 stack = traceback.extract_stack()[prefix_length:-5]
2613- self.stack = ''.join(traceback.format_list(stack))
2614+ self._stack = ''.join(traceback.format_list(stack))
2615
2616 def __str__(self):
2617 return self.call.method.decode('utf-8')
2618@@ -2441,7 +2442,7 @@
2619 return self.call.method.decode('utf-8')
2620
2621 def stack(self):
2622- return self.stack
2623+ return self._stack
2624
2625
2626 class TestCaseWithMemoryTransport(TestCase):
2627@@ -3457,7 +3458,7 @@
2628 self.addTest(suite)
2629
2630 # Don't need subclass run method with suite emptying
2631- run = unittest.TestSuite.run
2632+ run = unittest.TestSuite.run # type: ignore
2633
2634
2635 class CountingDecorator(TestDecorator):
2636@@ -3726,7 +3727,7 @@
2637 # -Euncollected_cases Display the identity of any test cases that weren't
2638 # deallocated after being completed.
2639 # -Econfig_stats Will collect statistics using addDetail
2640-selftest_debug_flags = set()
2641+selftest_debug_flags: Set[str] = set()
2642
2643
2644 def selftest(verbose=False, pattern=".*", stop_on_failure=True,
2645
2646=== modified file 'breezy/tests/blackbox/test_push.py'
2647--- breezy/tests/blackbox/test_push.py 2022-07-02 13:44:01 +0000
2648+++ breezy/tests/blackbox/test_push.py 2022-10-19 15:51:12 +0000
2649@@ -429,7 +429,7 @@
2650 self.assertPublished(branch_tree.last_revision(),
2651 trunk_tree.branch.base)
2652
2653- def test_push_new_branch_stacked_on(self):
2654+ def test_push_new_branch_stacked_on_can_use_dir_urls(self):
2655 """Pushing a new branch with --stacked-on can use directory URLs."""
2656 trunk_tree, branch_tree = self.create_trunk_and_feature_branch()
2657 class FooDirectory(object):
2658
2659=== modified file 'breezy/tests/blackbox/test_remember_option.py'
2660--- breezy/tests/blackbox/test_remember_option.py 2020-05-15 01:31:05 +0000
2661+++ breezy/tests/blackbox/test_remember_option.py 2022-10-19 15:51:12 +0000
2662@@ -14,6 +14,7 @@
2663 # along with this program; if not, write to the Free Software
2664 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2665
2666+from typing import List
2667
2668 from breezy import (
2669 branch,
2670@@ -28,14 +29,14 @@
2671 """--remember and --no-remember set locations or not."""
2672
2673 # the command to run (expecting additional arguments from the tests
2674- command = []
2675+ command: List[str] = []
2676 # the dir where the command should be run (it should contain a branch for
2677 # which the tested locations are/will be set)
2678- working_dir = None
2679+ working_dir: str
2680 # argument list for the first command invocation
2681- first_use_args = []
2682+ first_use_args: List[str] = []
2683 # argument list for the next command invocation
2684- next_uses_args = []
2685+ next_uses_args: List[str] = []
2686
2687 def do_command(self, *args):
2688 # We always expect the same result here and care only about the
2689
2690=== modified file 'breezy/tests/blackbox/test_serve.py'
2691--- breezy/tests/blackbox/test_serve.py 2021-11-15 17:27:44 +0000
2692+++ breezy/tests/blackbox/test_serve.py 2022-10-19 15:51:12 +0000
2693@@ -17,10 +17,9 @@
2694
2695 """Tests of the brz serve command."""
2696
2697-import os
2698 import signal
2699 import sys
2700-from _thread import interrupt_main
2701+from _thread import interrupt_main # type: ignore
2702
2703 import threading
2704
2705
2706=== modified file 'breezy/tests/blackbox/test_switch.py'
2707--- breezy/tests/blackbox/test_switch.py 2020-06-13 02:58:24 +0000
2708+++ breezy/tests/blackbox/test_switch.py 2022-10-19 15:51:12 +0000
2709@@ -172,21 +172,6 @@
2710 checkout = checkout.controldir.open_workingtree()
2711 self.assertEqual(tree2.branch.base, checkout.branch.base)
2712
2713- def test_switch_finds_relative_unicode_branch(self):
2714- """Switch will find 'foo' relative to the branch the checkout is of."""
2715- self.requireFeature(UnicodeFilenameFeature)
2716- self.build_tree(['repo/'])
2717- tree1 = self.make_branch_and_tree('repo/brancha')
2718- tree1.commit('foo')
2719- tree2 = self.make_branch_and_tree(u'repo/branch\xe9')
2720- tree2.pull(tree1.branch)
2721- branchb_id = tree2.commit('bar')
2722- checkout = tree1.branch.create_checkout('checkout', lightweight=True)
2723- self.run_bzr(['switch', u'branch\xe9'], working_dir='checkout')
2724- self.assertEqual(branchb_id, checkout.last_revision())
2725- checkout = checkout.controldir.open_workingtree()
2726- self.assertEqual(tree2.branch.base, checkout.branch.base)
2727-
2728 def test_switch_revision(self):
2729 tree = self._create_sample_tree()
2730 checkout = tree.branch.create_checkout('checkout', lightweight=True)
2731
2732=== modified file 'breezy/tests/blackbox/test_upgrade.py'
2733--- breezy/tests/blackbox/test_upgrade.py 2019-09-01 15:33:59 +0000
2734+++ breezy/tests/blackbox/test_upgrade.py 2022-10-19 15:51:12 +0000
2735@@ -21,7 +21,7 @@
2736 from breezy import (
2737 bzr,
2738 controldir,
2739- lockable_files,
2740+ lockdir,
2741 ui,
2742 urlutils,
2743 )
2744@@ -57,7 +57,7 @@
2745
2746 class OldBzrDirFormat(bzrdir.BzrDirMetaFormat1):
2747
2748- _lock_class = lockable_files.TransportLock
2749+ _lock_class = lockdir.LockDir
2750
2751 def get_converter(self, format=None):
2752 return ConvertOldTestToMeta()
2753
2754=== modified file 'breezy/tests/fake_command.py'
2755--- breezy/tests/fake_command.py 2017-05-22 00:56:52 +0000
2756+++ breezy/tests/fake_command.py 2022-10-19 15:51:12 +0000
2757@@ -15,7 +15,7 @@
2758 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2759
2760 from . import test_commands
2761-test_commands.lazy_command_imported = True
2762+test_commands.lazy_command_imported = True # type: ignore
2763
2764
2765 class cmd_fake(object):
2766
2767=== modified file 'breezy/tests/https_server.py'
2768--- breezy/tests/https_server.py 2022-05-02 11:39:09 +0000
2769+++ breezy/tests/https_server.py 2022-10-19 15:51:12 +0000
2770@@ -97,8 +97,8 @@
2771 _url_protocol = 'https'
2772
2773 # The real servers depending on the protocol
2774- http_server_class = {'HTTP/1.0': TestingHTTPSServer,
2775- 'HTTP/1.1': TestingThreadingHTTPSServer,
2776+ http_server_class = {'HTTP/1.0': TestingHTTPSServer, # type: ignore
2777+ 'HTTP/1.1': TestingThreadingHTTPSServer, # type: ignore
2778 }
2779
2780 # Provides usable defaults since an https server requires both a
2781
2782=== modified file 'breezy/tests/per_interbranch/__init__.py'
2783--- breezy/tests/per_interbranch/__init__.py 2020-06-22 01:07:05 +0000
2784+++ breezy/tests/per_interbranch/__init__.py 2022-10-19 15:51:12 +0000
2785@@ -24,6 +24,8 @@
2786 itself rather than in tests/per_interbranch/*.py.
2787 """
2788
2789+from typing import List, Any
2790+
2791
2792 from breezy import (
2793 branchbuilder,
2794@@ -165,7 +167,7 @@
2795 and added rather than actually trying to do something.
2796 """
2797
2798- _uses = []
2799+ _uses: List[Any] = []
2800
2801 def __init__(self, source, target):
2802 self.source = source
2803
2804=== modified file 'breezy/tests/per_transport.py'
2805--- breezy/tests/per_transport.py 2022-08-22 18:19:46 +0000
2806+++ breezy/tests/per_transport.py 2022-10-19 15:51:12 +0000
2807@@ -232,14 +232,6 @@
2808 t = self.get_transport()
2809 self.assertRaises(NoSuchFile, t.get_bytes, 'c')
2810
2811- def test_get_with_open_write_stream_sees_all_content(self):
2812- t = self.get_transport()
2813- if t.is_readonly():
2814- return
2815- with t.open_write_stream('foo') as handle:
2816- handle.write(b'b')
2817- self.assertEqual(b'b', t.get_bytes('foo'))
2818-
2819 def test_get_bytes_with_open_write_stream_sees_all_content(self):
2820 t = self.get_transport()
2821 if t.is_readonly():
2822
2823=== modified file 'breezy/tests/stub_sftp.py'
2824--- breezy/tests/stub_sftp.py 2020-02-07 02:14:30 +0000
2825+++ breezy/tests/stub_sftp.py 2022-10-19 15:51:12 +0000
2826@@ -551,7 +551,7 @@
2827 self._vendor = ssh.LoopbackVendor()
2828 self.request_handler_class = TestingSFTPWithoutSSHConnectionHandler
2829
2830- def get_host_key():
2831+ def get_host_key(self):
2832 return None
2833
2834
2835
2836=== modified file 'breezy/tests/test__annotator.py'
2837--- breezy/tests/test__annotator.py 2018-11-11 04:08:32 +0000
2838+++ breezy/tests/test__annotator.py 2022-10-19 15:51:12 +0000
2839@@ -192,7 +192,7 @@
2840 (self.fc_key, b'content\n'),
2841 ], self.ann.annotate_flat(self.fd_key))
2842
2843- def test_annotate_common_merge_text(self):
2844+ def test_annotate_common_merge_text_more(self):
2845 self.make_common_merge_text()
2846 # there is no common point, so we just pick the lexicographical lowest
2847 # and b'b-id' comes before b'c-id'
2848@@ -200,7 +200,7 @@
2849 (self.fb_key, b'new content\n'),
2850 ], self.ann.annotate_flat(self.fd_key))
2851
2852- def test_annotate_many_way_common_merge_text(self):
2853+ def test_annotate_many_way_common_merge_text_more(self):
2854 self.make_many_way_common_merge_text()
2855 self.assertEqual([(self.fa_key, b'simple\n'),
2856 (self.fb_key, b'new content\n')],
2857
2858=== modified file 'breezy/tests/test_atomicfile.py'
2859--- breezy/tests/test_atomicfile.py 2022-05-03 18:47:58 +0000
2860+++ breezy/tests/test_atomicfile.py 2022-10-19 15:51:12 +0000
2861@@ -101,9 +101,6 @@
2862 def test_mode_0660(self):
2863 self._test_mode(0o660)
2864
2865- def test_mode_0660(self):
2866- self._test_mode(0o660)
2867-
2868 def test_mode_0640(self):
2869 self._test_mode(0o640)
2870
2871
2872=== modified file 'breezy/tests/test_commands.py'
2873--- breezy/tests/test_commands.py 2020-06-21 02:15:25 +0000
2874+++ breezy/tests/test_commands.py 2022-10-19 15:51:12 +0000
2875@@ -458,8 +458,7 @@
2876
2877 def pre_command(cmd):
2878 hook_calls.append('pre')
2879- # verify that all subclasses of CommandError caught too
2880- raise commands.BzrOptionError()
2881+ raise errors.CommandError()
2882
2883 def post_command(cmd, e):
2884 self.fail('post_command should not be called')
2885
2886=== modified file 'breezy/tests/test_config.py'
2887--- breezy/tests/test_config.py 2022-08-22 18:19:46 +0000
2888+++ breezy/tests/test_config.py 2022-10-19 15:51:12 +0000
2889@@ -1293,7 +1293,7 @@
2890 'http://www.example.com/norecurse', 'normal_option'),
2891 config.POLICY_NORECURSE)
2892
2893- def test__get_option_policy_normal(self):
2894+ def test__get_option_policy_normal_appendpath(self):
2895 self.get_branch_config('http://www.example.com')
2896 self.assertEqual(
2897 self.my_location_config._get_option_policy(
2898@@ -1482,13 +1482,6 @@
2899 self.assertEqual("Robert Collins <robertc@example.org>",
2900 my_config.username())
2901
2902- def test_BRZ_EMAIL_OVERRIDES(self):
2903- self.overrideEnv('BZR_EMAIL', "Robert Collins <robertc@example.org>")
2904- branch = FakeBranch()
2905- my_config = config.BranchConfig(branch)
2906- self.assertEqual("Robert Collins <robertc@example.org>",
2907- my_config.username())
2908-
2909 def test_get_user_option_global(self):
2910 my_config = self.get_branch_config(global_config=sample_config_text)
2911 self.assertEqual('something',
2912
2913=== modified file 'breezy/tests/test_conflicts.py'
2914--- breezy/tests/test_conflicts.py 2022-07-02 16:15:20 +0000
2915+++ breezy/tests/test_conflicts.py 2022-10-19 15:51:12 +0000
2916@@ -15,6 +15,7 @@
2917 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2918
2919 import os
2920+from typing import List, Tuple, Dict, Any, Callable, Type
2921
2922 from .. import (
2923 conflicts,
2924@@ -24,6 +25,7 @@
2925 tests,
2926 transform,
2927 )
2928+from ..workingtree import WorkingTree
2929 from ..bzr import conflicts as bzr_conflicts
2930 from . import (
2931 script,
2932@@ -159,7 +161,7 @@
2933 # FIXME: Tests missing for DuplicateID conflict type
2934 class TestResolveConflicts(script.TestCaseWithTransportAndScript):
2935
2936- preamble = None # The setup script set by daughter classes
2937+ preamble: str # The setup script set by daughter classes
2938
2939 def setUp(self):
2940 super(TestResolveConflicts, self).setUp()
2941@@ -236,15 +238,18 @@
2942 """
2943
2944 # Set by daughter classes
2945- _conflict_type = None
2946- _assert_conflict = None
2947+ _conflict_type: Type[conflicts.Conflict]
2948+ _assert_conflict: Callable[[Any, Any, Any], Any]
2949
2950 # Set by load_tests
2951 _base_actions = None
2952 _this = None
2953 _other = None
2954
2955- scenarios = []
2956+ scenarios: List[Tuple[
2957+ Dict[str, Any],
2958+ Tuple[str, Dict[str, Any]],
2959+ Tuple[str, Dict[str, Any]]]] = []
2960 """The scenario list for the conflict type defined by the class.
2961
2962 Each scenario is of the form:
2963
2964=== modified file 'breezy/tests/test_foreign.py'
2965--- breezy/tests/test_foreign.py 2022-08-22 18:19:46 +0000
2966+++ breezy/tests/test_foreign.py 2022-10-19 15:51:12 +0000
2967@@ -38,6 +38,7 @@
2968 )
2969
2970 from ..bzr import groupcompress_repo
2971+from ..bzr.pack_repo import PackCommitBuilder
2972
2973 # This is the dummy foreign revision control system, used
2974 # mainly here in the testsuite to test the foreign VCS infrastructure.
2975@@ -124,7 +125,7 @@
2976 return (revno, revid)
2977
2978
2979-class DummyForeignCommitBuilder(vf_repository.VersionedFileCommitBuilder):
2980+class DummyForeignCommitBuilder(PackCommitBuilder):
2981
2982 def _generate_revision_if_needed(self, revid):
2983 mapping = DummyForeignVcsMapping(DummyForeignVcs())
2984
2985=== modified file 'breezy/tests/test_forge.py'
2986--- breezy/tests/test_forge.py 2022-07-12 09:23:34 +0000
2987+++ breezy/tests/test_forge.py 2022-10-19 15:51:12 +0000
2988@@ -15,6 +15,7 @@
2989 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2990
2991 import os
2992+from typing import List
2993
2994 from ..forge import (
2995 determine_title,
2996@@ -41,7 +42,7 @@
2997
2998 class SampleForge(Forge):
2999
3000- _locations = []
3001+ _locations: List[str] = []
3002
3003 @classmethod
3004 def _add_location(cls, url):
3005
3006=== modified file 'breezy/tests/test_hooks.py'
3007--- breezy/tests/test_hooks.py 2018-11-11 04:08:32 +0000
3008+++ breezy/tests/test_hooks.py 2022-10-19 15:51:12 +0000
3009@@ -158,7 +158,9 @@
3010 self.assertEqual("demo", set_rh_lazy_hooks[0][1])
3011 self.assertEqual(list(TestHooks.hooks['set_rh']), [set_rh])
3012
3013- def set_rh(): return None
3014+ @classmethod
3015+ def set_rh(cls):
3016+ return None
3017
3018 def test_install_named_hook_lazy(self):
3019 hooks = Hooks("breezy.tests.hooks", "some_hooks")
3020@@ -221,7 +223,8 @@
3021 hook.hook(callback, "my callback")
3022 self.assertEqual([callback], list(hook))
3023
3024- def lazy_callback():
3025+ @classmethod
3026+ def lazy_callback(cls):
3027 pass
3028
3029 def test_lazy_hook(self):
3030
3031=== modified file 'breezy/tests/test_http.py'
3032--- breezy/tests/test_http.py 2021-01-10 00:25:52 +0000
3033+++ breezy/tests/test_http.py 2022-10-19 15:51:12 +0000
3034@@ -649,7 +649,7 @@
3035 Both implementations raises the same error as for a bad status.
3036 """
3037
3038- _req_handler_class = InvalidStatusRequestHandler
3039+ _req_handler_class = InvalidStatusRequestHandler # type: ignore
3040
3041
3042 class BadProtocolRequestHandler(http_server.TestingHTTPRequestHandler):
3043@@ -1853,7 +1853,7 @@
3044 self.assertEndsWith(response, expected_end_of_response)
3045
3046
3047-class ForbiddenRequestHandler(http_server.TestingHTTPRequestHandler):
3048+class NotSmartServerRequestHandler(http_server.TestingHTTPRequestHandler):
3049 """No smart server here request handler."""
3050
3051 def do_POST(self):
3052@@ -1863,7 +1863,7 @@
3053 class SmartClientAgainstNotSmartServer(TestSpecificRequestHandler):
3054 """Test smart client behaviour against an http server without smarts."""
3055
3056- _req_handler_class = ForbiddenRequestHandler
3057+ _req_handler_class = NotSmartServerRequestHandler
3058
3059 def test_probe_smart_server(self):
3060 """Test error handling against server refusing smart requests."""
3061
3062=== modified file 'breezy/tests/test_lazy_import.py'
3063--- breezy/tests/test_lazy_import.py 2020-01-11 17:41:33 +0000
3064+++ breezy/tests/test_lazy_import.py 2022-10-19 15:51:12 +0000
3065@@ -972,7 +972,7 @@
3066 ' two,\n'
3067 ' )\n')
3068
3069- def test_from_one_import_two(self):
3070+ def test_from_one_import_two_two(self):
3071 exp = {'two': (['one'], 'two', {})}
3072 self.check(exp, 'from one import two\n')
3073 self.check(exp, 'from one import (two)\n')
3074
3075=== modified file 'breezy/tests/test_lazy_regex.py'
3076--- breezy/tests/test_lazy_regex.py 2018-11-16 19:09:31 +0000
3077+++ breezy/tests/test_lazy_regex.py 2022-10-19 15:51:12 +0000
3078@@ -18,8 +18,8 @@
3079
3080 import pickle
3081 import re
3082+from typing import List, Tuple
3083
3084-from .. import errors
3085 from .. import (
3086 lazy_regex,
3087 tests,
3088@@ -37,7 +37,7 @@
3089 class InstrumentedLazyRegex(lazy_regex.LazyRegex):
3090 """Keep track of actions on the lazy regex"""
3091
3092- _actions = []
3093+ _actions: List[Tuple[str, ...]] = []
3094
3095 @classmethod
3096 def use_actions(cls, actions):
3097
3098=== modified file 'breezy/tests/test_lsprof.py'
3099--- breezy/tests/test_lsprof.py 2018-11-11 04:08:32 +0000
3100+++ breezy/tests/test_lsprof.py 2022-10-19 15:51:12 +0000
3101@@ -17,10 +17,7 @@
3102 """Tests for profiling data collection."""
3103
3104
3105-try:
3106- import cPickle as pickle
3107-except ImportError:
3108- import pickle
3109+import pickle
3110 import threading
3111
3112 from .. import (
3113
3114=== modified file 'breezy/tests/test_merge.py'
3115--- breezy/tests/test_merge.py 2022-07-15 14:04:05 +0000
3116+++ breezy/tests/test_merge.py 2022-10-19 15:51:12 +0000
3117@@ -2006,33 +2006,6 @@
3118 # Only the kind was changed (content)
3119 self.assertEqual([], entries)
3120
3121- def test_interesting_files(self):
3122- # Two files modified, but we should filter one of them
3123- builder = self.get_builder()
3124- builder.build_snapshot(None,
3125- [('add', (u'', b'a-root-id', 'directory', None)),
3126- ('add', (u'a', b'a-id', 'file', b'content\n')),
3127- ('add', (u'b', b'b-id', 'file', b'content\n'))],
3128- revision_id=b'A-id')
3129- builder.build_snapshot([b'A-id'], [], revision_id=b'B-id')
3130- builder.build_snapshot([b'A-id'], [], revision_id=b'C-id')
3131- builder.build_snapshot([b'C-id', b'B-id'],
3132- [('modify', ('a', b'new-content\n')),
3133- ('modify', ('b', b'new-content\n'))],
3134- revision_id=b'E-id')
3135- builder.build_snapshot([b'B-id', b'C-id'], [], revision_id=b'D-id')
3136- merge_obj = self.make_merge_obj(builder, b'E-id',
3137- interesting_files=['b'])
3138- entries = list(merge_obj._entries_lca())
3139- root_id = b'a-root-id'
3140- self.assertEqual([(b'b-id', True,
3141- ((u'b', [u'b', u'b']), u'b', u'b'),
3142- ((root_id, [root_id, root_id]), root_id, root_id),
3143- ((u'b', [u'b', u'b']), u'b', u'b'),
3144- ((False, [False, False]), False, False),
3145- False),
3146- ], entries)
3147-
3148 def test_interesting_file_in_this(self):
3149 # This renamed the file, but it should still match the entry in other
3150 builder = self.get_builder()
3151
3152=== modified file 'breezy/tests/test_osutils_encodings.py'
3153--- breezy/tests/test_osutils_encodings.py 2020-02-07 02:14:30 +0000
3154+++ breezy/tests/test_osutils_encodings.py 2022-10-19 15:51:12 +0000
3155@@ -19,6 +19,7 @@
3156 import codecs
3157 import locale
3158 import sys
3159+from typing import Set
3160
3161 from .. import (
3162 osutils,
3163@@ -39,8 +40,8 @@
3164 implemented they cannot be removed. Be careful with naming to avoid
3165 collisions between tests.
3166 """
3167- _registered = False
3168- _enabled_encodings = set()
3169+ _registered: bool = False
3170+ _enabled_encodings: Set[str] = set()
3171
3172 def add(self, encoding_name):
3173 """Adding encoding name to fake.
3174
3175=== modified file 'breezy/tests/test_patch.py'
3176--- breezy/tests/test_patch.py 2019-11-22 04:59:15 +0000
3177+++ breezy/tests/test_patch.py 2022-10-19 15:51:12 +0000
3178@@ -35,9 +35,6 @@
3179 f.write(b'\x00')
3180 self.assertRaises(BinaryFile, diff3, 'unused', 'this', 'other', 'base')
3181
3182-
3183-class TestPatch(TestCaseInTempDir):
3184-
3185 def test_missing_patch(self):
3186 self.assertRaises(PatchInvokeError, run_patch, '.', [],
3187 _patch_cmd='/unlikely/to/exist')
3188
3189=== modified file 'breezy/tests/test_plugins.py'
3190--- breezy/tests/test_plugins.py 2022-01-04 23:53:15 +0000
3191+++ breezy/tests/test_plugins.py 2022-10-19 15:51:12 +0000
3192@@ -23,6 +23,7 @@
3193 import os
3194 import sys
3195 import types
3196+from typing import Dict, List, Any
3197
3198 import breezy
3199 from .. import (
3200@@ -153,7 +154,7 @@
3201
3202 class TestLoadingPlugins(BaseTestPlugins):
3203
3204- activeattributes = {}
3205+ activeattributes: Dict[str, List[Any]] = {}
3206
3207 def test_plugins_with_the_same_name_are_not_loaded(self):
3208 # This test tests that having two plugins in different directories does
3209
3210=== modified file 'breezy/tests/test_shelf.py'
3211--- breezy/tests/test_shelf.py 2022-07-02 13:44:01 +0000
3212+++ breezy/tests/test_shelf.py 2022-10-19 15:51:12 +0000
3213@@ -534,15 +534,6 @@
3214 self.addCleanup(creator.finalize)
3215 self.assertEqual([], list(creator.iter_shelvable()))
3216
3217- def test_shelve_skips_added_root(self):
3218- """Skip adds of the root when iterating through shelvable changes."""
3219- tree = self.make_branch_and_tree('tree')
3220- tree.lock_tree_write()
3221- self.addCleanup(tree.unlock)
3222- creator = shelf.ShelfCreator(tree, tree.basis_tree())
3223- self.addCleanup(creator.finalize)
3224- self.assertEqual([], list(creator.iter_shelvable()))
3225-
3226
3227 class TestUnshelver(tests.TestCaseWithTransport):
3228
3229
3230=== modified file 'breezy/tests/test_ssh_transport.py'
3231--- breezy/tests/test_ssh_transport.py 2019-06-26 00:13:55 +0000
3232+++ breezy/tests/test_ssh_transport.py 2022-10-19 15:51:12 +0000
3233@@ -230,7 +230,7 @@
3234 "-s", "--", "host", "sftp"]
3235 )
3236
3237- def test_openssh_command_tricked(self):
3238+ def test_openssh_command_strange_hostname(self):
3239 vendor = SSHCorpSubprocessVendor()
3240 self.assertRaises(
3241 StrangeHostname,
3242
3243=== modified file 'breezy/tests/test_tree.py'
3244--- breezy/tests/test_tree.py 2021-02-19 21:27:44 +0000
3245+++ breezy/tests/test_tree.py 2022-10-19 15:51:12 +0000
3246@@ -16,10 +16,11 @@
3247
3248 """Tests for Tree and InterTree."""
3249
3250+from typing import List, Tuple
3251+
3252 from breezy import (
3253 errors,
3254 revision,
3255- tree as _mod_tree,
3256 )
3257 from breezy.tests import (
3258 TestCase,
3259@@ -80,7 +81,7 @@
3260
3261 class RecordingOptimiser(InterTree):
3262
3263- calls = []
3264+ calls: List[Tuple[str, ...]] = []
3265
3266 def compare(self, want_unchanged=False, specific_files=None,
3267 extra_trees=None, require_versioned=False, include_root=False,
3268
3269=== modified file 'breezy/tests/test_url_policy_open.py'
3270--- breezy/tests/test_url_policy_open.py 2019-06-09 14:00:10 +0000
3271+++ breezy/tests/test_url_policy_open.py 2022-10-19 15:51:12 +0000
3272@@ -16,6 +16,8 @@
3273
3274 """Tests for the branch open with specific URL policy code."""
3275
3276+from typing import List
3277+
3278 from .. import urlutils
3279 from ..branch import (
3280 Branch,
3281@@ -157,7 +159,7 @@
3282 class TrackingProber(BzrProber):
3283 """Subclass of BzrProber which tracks URLs it has been asked to open."""
3284
3285- seen_urls = []
3286+ seen_urls: List[str] = []
3287
3288 @classmethod
3289 def probe_transport(klass, transport):
3290
3291=== modified file 'breezy/tests/test_utextwrap.py'
3292--- breezy/tests/test_utextwrap.py 2022-05-15 14:17:32 +0000
3293+++ breezy/tests/test_utextwrap.py 2022-10-19 15:51:12 +0000
3294@@ -194,17 +194,17 @@
3295
3296 except ImportError:
3297
3298- class TestWrap(tests.TestCase):
3299+ class TestWrap(tests.TestCase): # type: ignore
3300
3301 def test_wrap(self):
3302 raise tests.TestSkipped("test.test_textwrap is not available.")
3303
3304- class TestLongWord(tests.TestCase):
3305+ class TestLongWord(tests.TestCase): # type: ignore
3306
3307 def test_longword(self):
3308 raise tests.TestSkipped("test.test_textwrap is not available.")
3309
3310- class TestIndent(tests.TestCase):
3311+ class TestIndent(tests.TestCase): # type: ignore
3312
3313 def test_indent(self):
3314 raise tests.TestSkipped("test.test_textwrap is not available.")
3315
3316=== modified file 'breezy/tests/test_win32utils.py'
3317--- breezy/tests/test_win32utils.py 2022-01-09 13:12:27 +0000
3318+++ breezy/tests/test_win32utils.py 2022-10-19 15:51:12 +0000
3319@@ -17,6 +17,7 @@
3320 """Tests for win32utils."""
3321
3322 import os
3323+from typing import List
3324
3325 from .. import (
3326 osutils,
3327@@ -40,7 +41,7 @@
3328
3329 class TestWin32UtilsGlobExpand(TestCaseInTempDir):
3330
3331- _test_needs_features = []
3332+ _test_needs_features: List[features.Feature] = []
3333
3334 def test_empty_tree(self):
3335 self.build_tree([])
3336
3337=== modified file 'breezy/transport/__init__.py'
3338--- breezy/transport/__init__.py 2022-09-22 23:12:07 +0000
3339+++ breezy/transport/__init__.py 2022-10-19 15:51:12 +0000
3340@@ -29,6 +29,7 @@
3341 import errno
3342 from io import BytesIO
3343 import sys
3344+from typing import Dict, Any
3345
3346 from stat import S_ISDIR
3347
3348@@ -47,7 +48,7 @@
3349
3350 # a dictionary of open file streams. Keys are absolute paths, values are
3351 # transport defined.
3352-_file_streams = {}
3353+_file_streams: Dict[str, Any] = {}
3354
3355
3356 def _get_protocol_handlers():
3357
3358=== modified file 'breezy/transport/decorator.py'
3359--- breezy/transport/decorator.py 2020-02-18 01:57:45 +0000
3360+++ breezy/transport/decorator.py 2022-10-19 15:51:12 +0000
3361@@ -163,7 +163,8 @@
3362 self._decorated.segment_parameters = value
3363
3364 segment_parameters = property(_get_segment_parameters,
3365- _set_segment_parameters, "See Transport.segment_parameters")
3366+ _set_segment_parameters,
3367+ doc="See Transport.segment_parameters")
3368
3369 def stat(self, relpath):
3370 """See Transport.stat()."""
3371
3372=== modified file 'breezy/transport/http/urllib.py'
3373--- breezy/transport/http/urllib.py 2022-08-31 14:25:13 +0000
3374+++ breezy/transport/http/urllib.py 2022-10-19 15:51:12 +0000
3375@@ -86,7 +86,7 @@
3376 return host, None
3377
3378
3379-class addinfourl(urllib_request.addinfourl):
3380+class addinfourl(urllib_request.addinfourl): # type: ignore
3381 '''Replacement addinfourl class compatible with python-2.7's xmlrpclib
3382
3383 In python-2.7, xmlrpclib expects that the response object that it receives
3384@@ -317,7 +317,7 @@
3385 self.sock = _ReportingSocket(sock, self._report_activity)
3386
3387
3388-class HTTPConnection(AbstractHTTPConnection, http_client.HTTPConnection):
3389+class HTTPConnection(AbstractHTTPConnection, http_client.HTTPConnection): # type: ignore
3390
3391 # XXX: Needs refactoring at the caller level.
3392 def __init__(self, host, port=None, proxied_host=None,
3393@@ -334,7 +334,7 @@
3394 self._wrap_socket_for_reporting(self.sock)
3395
3396
3397-class HTTPSConnection(AbstractHTTPConnection, http_client.HTTPSConnection):
3398+class HTTPSConnection(AbstractHTTPConnection, http_client.HTTPSConnection): # type: ignore
3399
3400 def __init__(self, host, port=None, key_file=None, cert_file=None,
3401 proxied_host=None,
3402@@ -1128,7 +1128,7 @@
3403 successful and the request authentication parameters have been updated.
3404 """
3405
3406- scheme = None
3407+ scheme: str
3408 """The scheme as it appears in the server header (lower cased)"""
3409
3410 _max_retry = 3
3411
3412=== modified file 'breezy/transport/memory.py'
3413--- breezy/transport/memory.py 2022-08-22 18:19:46 +0000
3414+++ breezy/transport/memory.py 2022-10-19 15:51:12 +0000
3415@@ -162,10 +162,11 @@
3416 self._files[_abspath] = (raw_bytes, mode)
3417 return len(raw_bytes)
3418
3419- def symlink(self, source, target):
3420- _abspath = self._resolve_symlinks(target)
3421+ def symlink(self, source, link_name):
3422+ """Create a symlink pointing to source named link_name."""
3423+ _abspath = self._abspath(link_name)
3424 self._check_parent(_abspath)
3425- self._symlinks[_abspath] = self._abspath(source)
3426+ self._symlinks[_abspath] = source.split('/')
3427
3428 def mkdir(self, relpath, mode=None):
3429 """See Transport.mkdir()."""
3430@@ -315,12 +316,6 @@
3431 r = self._symlinks.get('/'.join(r), r)
3432 return '/' + '/'.join(r)
3433
3434- def symlink(self, source, link_name):
3435- """Create a symlink pointing to source named link_name."""
3436- _abspath = self._abspath(link_name)
3437- self._check_parent(_abspath)
3438- self._symlinks[_abspath] = source.split('/')
3439-
3440 def readlink(self, link_name):
3441 _abspath = self._abspath(link_name)
3442 try:
3443
3444=== modified file 'breezy/transport/ssh.py'
3445--- breezy/transport/ssh.py 2022-05-15 14:17:32 +0000
3446+++ breezy/transport/ssh.py 2022-10-19 15:51:12 +0000
3447@@ -24,6 +24,7 @@
3448 import socket
3449 import subprocess
3450 import sys
3451+from typing import Tuple, Type, Set, Dict, Optional
3452 from binascii import hexlify
3453
3454 from .. import (
3455@@ -40,7 +41,7 @@
3456 except ModuleNotFoundError as e:
3457 # If we have an ssh subprocess, we don't strictly need paramiko for all ssh
3458 # access
3459- paramiko = None
3460+ paramiko = None # type: ignore
3461 else:
3462 from paramiko.sftp_client import SFTPClient
3463
3464@@ -49,8 +50,8 @@
3465 _fmt = "Refusing to connect to strange SSH hostname %(hostname)s"
3466
3467
3468-SYSTEM_HOSTKEYS = {}
3469-BRZ_HOSTKEYS = {}
3470+SYSTEM_HOSTKEYS: Dict[str, Dict[str, str]] = {}
3471+BRZ_HOSTKEYS: Dict[str, Dict[str, str]] = {}
3472
3473
3474 class SSHVendorManager(object):
3475@@ -333,7 +334,7 @@
3476 msg='Unable to invoke remote bzr')
3477
3478
3479-_ssh_connection_errors = (EOFError, OSError, IOError, socket.error)
3480+_ssh_connection_errors: Tuple[Type[Exception], ...] = (EOFError, OSError, IOError, socket.error)
3481 if paramiko is not None:
3482 vendor = ParamikoVendor()
3483 register_ssh_vendor('paramiko', vendor)
3484@@ -671,7 +672,7 @@
3485
3486
3487 import weakref
3488-_subproc_weakrefs = set()
3489+_subproc_weakrefs: Set[weakref.ref] = set()
3490
3491
3492 def _close_ssh_proc(proc, sock):
3493
3494=== modified file 'breezy/tree.py'
3495--- breezy/tree.py 2022-07-08 22:26:28 +0000
3496+++ breezy/tree.py 2022-10-19 15:51:12 +0000
3497@@ -17,6 +17,8 @@
3498 """Tree classes, representing directory at point in time.
3499 """
3500
3501+from typing import List, Type, TYPE_CHECKING
3502+
3503 from . import (
3504 errors,
3505 lock,
3506@@ -49,14 +51,14 @@
3507 """An entry that implements the minimum interface used by commands.
3508 """
3509
3510- __slots__ = []
3511+ __slots__: List[str] = []
3512
3513 def __eq__(self, other):
3514 # yes, this is ugly, TODO: best practice __eq__ style.
3515 return (isinstance(other, TreeEntry)
3516 and other.__class__ == self.__class__)
3517
3518- kind = None
3519+ kind: str
3520
3521 def kind_character(self):
3522 return "???"
3523@@ -73,7 +75,7 @@
3524 class TreeDirectory(TreeEntry):
3525 """See TreeEntry. This is a directory in a working tree."""
3526
3527- __slots__ = []
3528+ __slots__: List[str] = []
3529
3530 kind = 'directory'
3531
3532@@ -84,7 +86,7 @@
3533 class TreeFile(TreeEntry):
3534 """See TreeEntry. This is a regular file in a working tree."""
3535
3536- __slots__ = []
3537+ __slots__: List[str] = []
3538
3539 kind = 'file'
3540
3541@@ -95,7 +97,7 @@
3542 class TreeLink(TreeEntry):
3543 """See TreeEntry. This is a symlink in a working tree."""
3544
3545- __slots__ = []
3546+ __slots__: List[str] = []
3547
3548 kind = 'symlink'
3549
3550@@ -106,7 +108,7 @@
3551 class TreeReference(TreeEntry):
3552 """See TreeEntry. This is a reference to a nested tree in a working tree."""
3553
3554- __slots__ = []
3555+ __slots__: List[str] = []
3556
3557 kind = 'tree-reference'
3558
3559@@ -402,7 +404,7 @@
3560 """
3561 raise NotImplementedError(self.path_content_summary)
3562
3563- def get_reference_revision(self, path, branch=None):
3564+ def get_reference_revision(self, path):
3565 raise NotImplementedError("Tree subclass %s must implement "
3566 "get_reference_revision"
3567 % self.__class__.__name__)
3568@@ -753,10 +755,12 @@
3569 # Formats that will be used to test this InterTree. If both are
3570 # None, this InterTree will not be tested (e.g. because a complex
3571 # setup is required)
3572- _matching_from_tree_format = None
3573- _matching_to_tree_format = None
3574+ if TYPE_CHECKING:
3575+ from .workingtree import WorkingTreeFormat
3576+ _matching_from_tree_format: "WorkingTreeFormat"
3577+ _matching_to_tree_format: "WorkingTreeFormat"
3578
3579- _optimisers = []
3580+ _optimisers: List[Type["InterTree"]] = []
3581
3582 @classmethod
3583 def is_compatible(kls, source, target):
3584
3585=== modified file 'breezy/util/simplemapi.py'
3586--- breezy/util/simplemapi.py 2020-02-18 01:57:45 +0000
3587+++ breezy/util/simplemapi.py 2022-10-19 15:51:12 +0000
3588@@ -129,7 +129,7 @@
3589
3590 lpMapiMessage = POINTER(MapiMessage)
3591
3592-MAPI = windll.mapi32
3593+MAPI = windll.mapi32 # type: ignore
3594 MAPISendMail = MAPI.MAPISendMail
3595 MAPISendMail.restype = c_ulong
3596 MAPISendMail.argtypes = (LHANDLE, c_ulong, lpMapiMessage, FLAGS, c_ulong)
3597@@ -152,7 +152,7 @@
3598 MAPILogoff.argtypes = (LHANDLE, c_ulong, FLAGS, c_ulong)
3599
3600
3601-class MAPIError(WindowsError):
3602+class MAPIError(WindowsError): # type: ignore
3603
3604 def __init__(self, code):
3605 WindowsError.__init__(self)
3606
3607=== modified file 'breezy/version_info_formats/format_rio.py'
3608--- breezy/version_info_formats/format_rio.py 2022-07-07 15:57:20 +0000
3609+++ breezy/version_info_formats/format_rio.py 2022-10-19 15:51:12 +0000
3610@@ -97,4 +97,4 @@
3611 " revision object and a RIO stanza.", (1, 15))
3612
3613
3614-RioVersionInfoBuilder.hooks = RioVersionInfoBuilderHooks()
3615+RioVersionInfoBuilder.hooks = RioVersionInfoBuilderHooks() # type: ignore
3616
3617=== modified file 'breezy/version_info_formats/format_yaml.py'
3618--- breezy/version_info_formats/format_yaml.py 2022-07-07 15:36:19 +0000
3619+++ breezy/version_info_formats/format_yaml.py 2022-10-19 15:51:12 +0000
3620@@ -103,4 +103,4 @@
3621 " revision object and a YAML stanza.", (3, 3))
3622
3623
3624-YamlVersionInfoBuilder.hooks = YamlVersionInfoBuilderHooks()
3625+YamlVersionInfoBuilder.hooks = YamlVersionInfoBuilderHooks() # type: ignore
3626
3627=== modified file 'breezy/workingtree.py'
3628--- breezy/workingtree.py 2022-08-22 18:19:46 +0000
3629+++ breezy/workingtree.py 2022-10-19 15:51:12 +0000
3630@@ -33,6 +33,7 @@
3631 import errno
3632 import os
3633 import sys
3634+from typing import Optional
3635
3636 import breezy
3637
3638@@ -537,39 +538,9 @@
3639 if updated:
3640 self.set_parent_ids(parents, allow_leftmost_as_ghost=True)
3641
3642- def path_content_summary(self, path, _lstat=os.lstat,
3643- _mapper=osutils.file_kind_from_stat_mode):
3644+ def path_content_summary(self, path):
3645 """See Tree.path_content_summary."""
3646- abspath = self.abspath(path)
3647- try:
3648- stat_result = _lstat(abspath)
3649- except OSError as e:
3650- if getattr(e, 'errno', None) == errno.ENOENT:
3651- # no file.
3652- return ('missing', None, None, None)
3653- # propagate other errors
3654- raise
3655- kind = _mapper(stat_result.st_mode)
3656- if kind == 'file':
3657- return self._file_content_summary(path, stat_result)
3658- elif kind == 'directory':
3659- # perhaps it looks like a plain directory, but it's really a
3660- # reference.
3661- if self._directory_is_tree_reference(path):
3662- kind = 'tree-reference'
3663- return kind, None, None, None
3664- elif kind == 'symlink':
3665- target = osutils.readlink(abspath)
3666- return ('symlink', None, None, target)
3667- else:
3668- return (kind, None, None, None)
3669-
3670- def _file_content_summary(self, path, stat_result):
3671- size = stat_result.st_size
3672- executable = self._is_executable_from_path_and_stat(path, stat_result)
3673- # try for a stat cache lookup
3674- return ('file', size, executable, self._sha_from_stat(
3675- path, stat_result))
3676+ raise NotImplementedError(self.path_content_summary)
3677
3678 def _check_parents_for_ghosts(self, revision_ids, allow_leftmost_as_ghost):
3679 """Common ghost checking functionality from set_parent_*.
3680@@ -1326,7 +1297,7 @@
3681 missing_parent_conflicts = False
3682 """If this format supports missing parent conflicts."""
3683
3684- supports_versioned_directories = None
3685+ supports_versioned_directories: bool
3686
3687 supports_merge_modified = True
3688 """If this format supports storing merge modified hashes."""
3689@@ -1341,7 +1312,7 @@
3690
3691 supports_righthand_parent_id_as_ghost = True
3692
3693- ignore_filename = None
3694+ ignore_filename: Optional[str] = None
3695 """Name of file with ignore patterns, if any. """
3696
3697 def initialize(self, controldir, revision_id=None, from_branch=None,
3698
3699=== modified file 'breezy/workspace.py'
3700--- breezy/workspace.py 2022-08-22 18:19:46 +0000
3701+++ breezy/workspace.py 2022-10-19 15:51:12 +0000
3702@@ -52,7 +52,7 @@
3703 local_tree: WorkingTree,
3704 basis_tree: Optional[Tree] = None,
3705 subpath: str = "",
3706- dirty_tracker: "DirtyTracker" = None,
3707+ dirty_tracker=None,
3708 ) -> None:
3709 """Reset a tree back to its basis tree.
3710
3711@@ -216,7 +216,8 @@
3712 if self._dirty_tracker is not None:
3713 self._dirty_tracker.mark_clean()
3714
3715- def _stage(self) -> List[str]:
3716+ def _stage(self) -> Optional[List[str]]:
3717+ changed: Optional[List[str]]
3718 if self._dirty_tracker:
3719 relpaths = self._dirty_tracker.relpaths()
3720 # Sort paths so that directories get added before the files they
3721
3722=== modified file 'byov.conf'
3723--- byov.conf 2022-09-08 17:24:19 +0000
3724+++ byov.conf 2022-10-19 15:51:12 +0000
3725@@ -4,7 +4,8 @@
3726 # External sources dependencies, packages are not recent enough
3727 subunit.clone = (git clone https://github.com/testing-cabal/subunit.git ../subunit)
3728 sphinx_epytext.install = (pip3 install sphinx_epytext)
3729-flake8.install3 = (pip3 install flake8)
3730+flake8.install = (pip3 install flake8)
3731+mypy.install = (pip3 install mypy types-PyYAML types-paramiko types-setuptools)
3732 brz.extras = fastimport,launchpad,workspace,git,cext,doc
3733
3734 [brz]
3735@@ -22,9 +23,9 @@
3736 vm.packages = {brz.build_deps}, {subunit.build_deps}, bzr, git, python-junitxml
3737 [brz-xenial]
3738 vm.release = bionic
3739-byoci.setup.command = (pip3 install --upgrade pip && pip3 install --upgrade "pyopenssl>=0.22" cython setuptools-rust sphinx paramiko merge3 && {subunit.clone} && {flake8.install3} && PATH="$HOME/.local/bin:$PATH" python3 setup.py develop --user && pip3 install -e '.[{brz.extras}]')
3740+byoci.setup.command = (pip3 install --upgrade pip && pip3 install --upgrade "pyopenssl>=0.22" cython setuptools-rust sphinx paramiko merge3 && {subunit.clone} && {flake8.install} && {mypy.install} && PATH="$HOME/.local/bin:$PATH" python3 setup.py develop --user && pip3 install -e '.[{brz.extras}]')
3741 # FIXME: bzr log -l2 should be by default -- vila 2018-03-09
3742-byoci.tests.command = bash -o pipefail -c "bzr log -l2 && PYTHONPATH=tools:$PYTHONPATH python3 -m flake8 && PYTHONPATH=../subunit/python:$PYTHONPATH PATH=../subunit/filters:$HOME/.local/bin:$PATH make check-ci | subunit2junitxml -o ../results.xml -f | subunit2pyunit"
3743+byoci.tests.command = bash -o pipefail -c "bzr log -l2 && PYTHONPATH=tools:$PYTHONPATH python3 -m flake8 && PYTHONPATH=tools:$PYTHONPATH python3 -m mypy breezy && PYTHONPATH=../subunit/python:$PYTHONPATH PATH=../subunit/filters:$HOME/.local/bin:$PATH make check-ci | subunit2junitxml -o ../results.xml -f | subunit2pyunit"
3744 [brz-cosmic]
3745 vm.release = cosmic
3746 [brz-disco]
3747
3748=== modified file 'profile_imports.py'
3749--- profile_imports.py 2020-02-18 01:57:45 +0000
3750+++ profile_imports.py 2022-10-19 15:51:12 +0000
3751@@ -20,10 +20,11 @@
3752 import re
3753 import sys
3754 import time
3755-
3756-
3757-_parent_stack = []
3758-_total_stack = {}
3759+from typing import Dict, Tuple, List
3760+
3761+
3762+_parent_stack: List[Tuple[int, str]] = []
3763+_total_stack: Dict[str, str] = {}
3764 _info = {}
3765 _cur_id = 0
3766 _timer = time.time
3767@@ -158,7 +159,7 @@
3768 return repr(pattern)
3769
3770
3771-_real_compile = re._compile
3772+_real_compile = re._compile # type: ignore
3773
3774
3775 def timed_compile(*args, **kwargs):
3776
3777=== modified file 'pyproject.toml'
3778--- pyproject.toml 2022-10-18 19:30:24 +0000
3779+++ pyproject.toml 2022-10-19 15:51:12 +0000
3780@@ -8,4 +8,14 @@
3781 "cython>=0.29",
3782 "pyyaml",
3783 ]
3784+<<<<<<< TREE
3785 build-backend = "setuptools.build_meta"
3786+=======
3787+
3788+[tool.mypy]
3789+python_version = "3.6"
3790+ignore_missing_imports = true
3791+warn_return_any = true
3792+warn_unused_configs = true
3793+exclude = ['^breezy/util/simplemapi\.py$']
3794+>>>>>>> MERGE-SOURCE
3795
3796=== modified file 'setup.cfg'
3797--- setup.cfg 2022-10-18 19:30:24 +0000
3798+++ setup.cfg 2022-10-19 15:51:12 +0000
3799@@ -31,7 +31,7 @@
3800 merge3
3801 # Technically, Breezy works without these two dependencies too. But there's
3802 # no way to enable them by default and let users opt out.
3803- dulwich>=0.20.23
3804+ dulwich>=0.20.46
3805 urllib3>=1.24.1
3806 pyyaml
3807 tests_require =
3808@@ -51,7 +51,7 @@
3809 [options.extras_require]
3810 cext = cython>=0.29
3811 fastimport = fastimport
3812-git = dulwich>=0.20.23
3813+git = dulwich>=0.20.46
3814 launchpad = launchpadlib>=1.6.3
3815 workspace = pyinotify
3816 doc =

Subscribers

People subscribed via source and target branches