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