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