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

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 7889
Merged at revision: 7894
Proposed branch: lp:~jelmer/brz/clippy
Merge into: lp:brz
Diff against target: 158 lines (+29/-16)
9 files modified
breezy/transport/http/response.py (+7/-3)
crates/bazaar/src/bencode_serializer.rs (+1/-0)
crates/bazaar/src/dirstate.rs (+2/-1)
crates/bazaar/src/groupcompress/delta.rs (+1/-1)
crates/bazaar/src/xml_serializer.rs (+1/-0)
crates/urlutils/src/lib.rs (+3/-3)
src/bedding.rs (+6/-6)
src/help.rs (+2/-2)
src/treebuilder.rs (+6/-0)
To merge this branch: bzr merge lp:~jelmer/brz/clippy
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+454270@code.launchpad.net

Commit message

Fix some clippy errors

Description of the change

Fix some clippy errors

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Download full text (178.9 KiB)

The attempt to merge lp:~jelmer/brz/clippy into lp:brz failed. Command exited with 2.
Below is the output from the failed tests.

Collecting setuptools-gettext
  Using cached setuptools_gettext-0.1.7-py3-none-any.whl.metadata (1.5 kB)
Requirement already satisfied: setuptools>=46.1 in ./lib/python3.11/site-packages (from setuptools-gettext) (68.1.2)
Using cached setuptools_gettext-0.1.7-py3-none-any.whl (5.5 kB)
Installing collected packages: setuptools-gettext
Successfully installed setuptools-gettext-0.1.7
Obtaining file:///tmp/tarmac/branch.v96kn59x
  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'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing editable metadata (pyproject.toml): started
  Preparing editable metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: configobj in /usr/lib/python3/dist-packages (5.0.8)
Requirement already satisfied: fastbencode in /usr/lib/python3/dist-packages (0.2)
Requirement already satisfied: patiencediff in /usr/lib/python3/dist-packages (0.2.13)
Requirement already satisfied: merge3 in /usr/lib/python3/dist-packages (0.0.8)
Collecting dulwich>=0.21.6
  Using cached dulwich-0.21.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.3 kB)
Requirement already satisfied: urllib3>=1.24.1 in /usr/lib/python3/dist-packages (1.26.12)
Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (6.0)
Collecting testtools>=0.9.5
  Using cached testtools-2.6.0-py3-none-any.whl (182 kB)
Collecting testscenarios
  Using cached testscenarios-0.5.0-py2.py3-none-any.whl (21 kB)
Collecting python-subunit
  Using cached python_subunit-1.4.3-py3-none-any.whl.metadata (22 kB)
Requirement already satisfied: flake8 in /usr/lib/python3/dist-packages (5.0.4)
Collecting cython>=0.29
  Using cached Cython-3.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.2 kB)
Collecting ruff
  Using cached ruff-0.1.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (22 kB)
Collecting docutils
  Using cached docutils-0.20.1-py3-none-any.whl.metadata (2.8 kB)
Requirement already satisfied: setuptools in ./lib/python3.11/site-packages (68.1.2)
Collecting sphinx
  Using cached sphinx-7.2.6-py3-none-any.whl.metadata (5.9 kB)
Collecting sphinx-epytext
  Using cached sphinx_epytext-0.0.4-py3-none-any.whl
Collecting fastimport
  Using cached fastimport-0.9.14-py2.py3-none-any.whl
Requirement already satisfied: launchpadlib>=1.6.3 in /usr/lib/python3/dist-packages (1.11.0)
Requirement already satisfied: paramiko>=1.6.2 in /usr/local/lib/python3.11/dist-packages (3.1.0)
Requirement already satisfied: gpg in /usr/lib/python3/dist-packages (1.18.0)
Requirement already satisfied: httplib2 in /usr/lib/python3/dist-packages (from launchpadlib>=1.6.3) (0.20.4)
Requirement already sa...

Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Download full text (87.5 KiB)

The attempt to merge lp:~jelmer/brz/clippy into lp:brz failed. Command exited with 1.
Below is the output from the failed tests.

... OUTPUT TRIMMED ...

  File "/tmp/tarmac/branch.ofg_xzyw/breezy/bzr/bundle/serializer/v08.py", line 370, in _validate
    self.info.complete_info()
  File "/tmp/tarmac/branch.ofg_xzyw/breezy/bzr/bundle/bundle_data.py", line 139, in complete_info
    osutils.unpack_highres_date(rev.date)
ValueError: Failed to parse datetime string (2023-11-02 00:32:56): input is not enough for unique date and time

======================================================================
ERROR: breezy.bzr.tests.test_bundle.V09BundleKnit1Tester.test_across_models
----------------------------------------------------------------------
testtools.testresult.real._StringException: log: {{{
0.004 creating repository in file:///tmp/testbzr-bybsairr.tmp/breezy.bzr.tests.test_bundle.V09BundleKnit1Tester.test_across_models/work/b1/.bzr/.
0.006 creating branch <breezy.bzr.fullhistory.BzrBranchFormat5 object at 0x7efc3f38e1d0> in file:///tmp/testbzr-bybsairr.tmp/breezy.bzr.tests.test_bundle.V09BundleKnit1Tester.test_across_models/work/b1/
0.011 opening working tree '/tmp/testbzr-bybsairr.tmp/breezy.bzr.tests.test_bundle.V09BundleKnit1Tester.test_across_models/work/b1'
0.011 write hc
0.017 preparing to commit
    INFO Committing to: /tmp/testbzr-bybsairr.tmp/breezy.bzr.tests.test_bundle.V09BundleKnit1Tester.test_across_models/work/b1/
0.018 Selecting files for commit with filter None
    INFO added file
    INFO Committed revision 1.
0.021 Committed revid b'rev1' as revno 1.
0.024 preparing to commit
    INFO Committing to: /tmp/testbzr-bybsairr.tmp/breezy.bzr.tests.test_bundle.V09BundleKnit1Tester.test_across_models/work/b1/
0.026 Selecting files for commit with filter None
    INFO Committed revision 2.
0.029 Committed revid b'rev2' as revno 2.
0.034 _handle_next 'message' => ['hello']
0.034 _handle_next 'committer' => '<email address hidden>'
0.034 _handle_next 'date' => 'Thu 2023-11-02 00:32:56.111000061 +0000'
0.034 _handle_next 'revision_id' => 'rev2'
0.034 _handle_next 'sha1' => '3701f43b341d1575e1f1ccce9e39a0b15f6caa9e'
0.034 _handle_next 'inventory_sha1' => '369f8c330b66fa7f4783b0084d3495718d28f15e'
0.034 _handle_next 'parent_ids' => ['rev1']
0.034 _handle_next 'base_id' => 'null:'
0.034 _handle_next 'properties' => ['branch-nick: b1']
0.034 _handle_next 'message' => ['hello']
0.034 _handle_next 'committer' => '<email address hidden>'
0.034 _handle_next 'date' => 'Thu 2023-11-02 00:32:56.104000092 +0000'
0.034 _handle_next 'revision_id' => 'rev1'
0.034 _handle_next 'sha1' => '8aa72b67f3b84e45ec612bd35b4a10c702ce0b37'
0.034 _handle_next 'inventory_sha1' => 'a8440513bdbbbf40538d03bc48989a80df575812'
0.034 _handle_next 'properties' => ['branch-nick: b1']
}}}

Traceback (most recent call last):
  File "/tmp/tarmac/branch.ofg_xzyw/breezy/bzr/tests/test_bundle.py", line 1038, in test_across_models
    repo = self.make_repo_with_installed_revisions()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/tarmac/branch.ofg_xzyw/breezy/bzr/tests/test_bundle.py", line 1032, in make_repo_with_installed_revis...

Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :

Fixup command "sudo apt -y update && sudo apt -y install git quilt cargo rustc python3-venv python3-tdb python3-pyinotify python3-gpg libpython3-dev make python3-setuptools-rust openssh-client patch mypy rustfmt xz-utils" failed: Command exited with 2

Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Download full text (191.0 KiB)

The attempt to merge lp:~jelmer/brz/clippy into lp:brz failed. Command exited with 2.
Below is the output from the failed tests.

Collecting setuptools-gettext
  Downloading setuptools_gettext-0.1.7-py3-none-any.whl.metadata (1.5 kB)
Requirement already satisfied: setuptools>=46.1 in ./lib/python3.11/site-packages (from setuptools-gettext) (68.1.2)
Downloading setuptools_gettext-0.1.7-py3-none-any.whl (5.5 kB)
Installing collected packages: setuptools-gettext
Successfully installed setuptools-gettext-0.1.7
Obtaining file:///tmp/tarmac/branch.ixyrb5i_
  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'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing editable metadata (pyproject.toml): started
  Preparing editable metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: configobj in /usr/lib/python3/dist-packages (5.0.8)
Requirement already satisfied: fastbencode in /usr/lib/python3/dist-packages (0.2)
Requirement already satisfied: patiencediff in /usr/lib/python3/dist-packages (0.2.13)
Requirement already satisfied: merge3 in /usr/lib/python3/dist-packages (0.0.8)
Requirement already satisfied: dulwich>=0.21.6 in /usr/lib/python3/dist-packages (0.21.6)
Requirement already satisfied: urllib3>=1.24.1 in /usr/lib/python3/dist-packages (1.26.18)
Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (6.0.1)
Collecting testtools>=0.9.5
  Downloading testtools-2.7.1-py3-none-any.whl.metadata (5.3 kB)
Collecting testscenarios
  Downloading testscenarios-0.5.0-py2.py3-none-any.whl (21 kB)
Collecting python-subunit
  Downloading python_subunit-1.4.3-py3-none-any.whl.metadata (22 kB)
Collecting cython>=0.29
  Using cached Cython-3.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.2 kB)
Requirement already satisfied: ruff in /usr/local/lib/python3.11/dist-packages (0.1.4)
Collecting docutils
  Downloading docutils-0.20.1-py3-none-any.whl.metadata (2.8 kB)
Requirement already satisfied: setuptools in ./lib/python3.11/site-packages (68.1.2)
Collecting sphinx
  Downloading sphinx-7.2.6-py3-none-any.whl.metadata (5.9 kB)
Collecting sphinx-epytext
  Downloading sphinx-epytext-0.0.4.tar.gz (3.6 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting fastimport
  Downloading fastimport-0.9.14.tar.gz (41 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.8/41.8 kB 2.2 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: launchpadlib>=1.6.3 in /usr/lib/python3/dist-packages (1.11.0)
Requirement already satisfied: paramiko>=1.6.2 in /usr/local/lib/python3.11/dist-packages (3.3.1)
Requirement already satisfied: gpg in /usr/lib/python3/dist-packages (1.18.0)
Requi...

Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Download full text (15.9 KiB)

The attempt to merge lp:~jelmer/brz/clippy into lp:brz failed. Command exited with 1.
Below is the output from the failed tests.

Collecting setuptools-gettext
  Downloading setuptools_gettext-0.1.7-py3-none-any.whl.metadata (1.5 kB)
Requirement already satisfied: setuptools>=46.1 in ./lib/python3.11/site-packages (from setuptools-gettext) (68.1.2)
Downloading setuptools_gettext-0.1.7-py3-none-any.whl (5.5 kB)
Installing collected packages: setuptools-gettext
Successfully installed setuptools-gettext-0.1.7
Obtaining file:///tmp/tarmac/branch.a8b0_o87
  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'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing editable metadata (pyproject.toml): started
  Preparing editable metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: configobj in /usr/lib/python3/dist-packages (5.0.8)
Requirement already satisfied: fastbencode in /usr/lib/python3/dist-packages (0.2)
Requirement already satisfied: patiencediff in /usr/lib/python3/dist-packages (0.2.13)
Requirement already satisfied: merge3 in /usr/lib/python3/dist-packages (0.0.8)
Requirement already satisfied: dulwich>=0.21.6 in /usr/lib/python3/dist-packages (0.21.6)
Requirement already satisfied: urllib3>=1.24.1 in /usr/lib/python3/dist-packages (1.26.18)
Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (6.0.1)
Collecting testtools>=0.9.5
  Downloading testtools-2.7.1-py3-none-any.whl.metadata (5.3 kB)
Collecting testscenarios
  Downloading testscenarios-0.5.0-py2.py3-none-any.whl (21 kB)
Collecting python-subunit
  Downloading python_subunit-1.4.3-py3-none-any.whl.metadata (22 kB)
Collecting cython>=0.29
  Using cached Cython-3.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.2 kB)
Requirement already satisfied: ruff in /usr/local/lib/python3.11/dist-packages (0.1.4)
Collecting docutils
  Downloading docutils-0.20.1-py3-none-any.whl.metadata (2.8 kB)
Requirement already satisfied: setuptools in ./lib/python3.11/site-packages (68.1.2)
Collecting sphinx
  Downloading sphinx-7.2.6-py3-none-any.whl.metadata (5.9 kB)
Collecting sphinx-epytext
  Downloading sphinx-epytext-0.0.4.tar.gz (3.6 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting fastimport
  Downloading fastimport-0.9.14.tar.gz (41 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.8/41.8 kB 2.3 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: launchpadlib>=1.6.3 in /usr/lib/python3/dist-packages (1.11.0)
Requirement already satisfied: paramiko>=1.6.2 in /usr/local/lib/python3.11/dist-packages (3.3.1)
Requirement already satisfied: gpg in /usr/lib/python3/dist-packages (1.18.0)
Requi...

lp:~jelmer/brz/clippy updated
7889. By Jelmer Vernooij

Fix test

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/transport/http/response.py'
2--- breezy/transport/http/response.py 2023-11-07 10:54:10 +0000
3+++ breezy/transport/http/response.py 2023-11-08 21:11:21 +0000
4@@ -21,7 +21,6 @@
5 responses.
6 """
7
8-import cgi
9 import email.utils as email_utils
10 import http.client as http_client
11 import os
12@@ -392,9 +391,14 @@
13 # 7.2.1.
14 # Therefore it is obviously not multipart
15 content_type = getheader("content-type", "application/octet-stream")
16- mimetype, options = cgi.parse_header(content_type)
17+ from email.message import EmailMessage
18+
19+ msg = EmailMessage()
20+ msg["content-type"] = content_type
21+ params = msg["content-type"].params
22+ mimetype = msg.get_content_type()
23 if mimetype == "multipart/byteranges":
24- rfile.set_boundary(options["boundary"].encode("ascii"))
25+ rfile.set_boundary(params["boundary"].encode("ascii"))
26 else:
27 # A response to a range request, but not multipart
28 content_range = getheader("content-range", None)
29
30=== modified file 'crates/bazaar/src/bencode_serializer.rs'
31--- crates/bazaar/src/bencode_serializer.rs 2023-05-10 11:59:06 +0000
32+++ crates/bazaar/src/bencode_serializer.rs 2023-11-08 21:11:21 +0000
33@@ -311,4 +311,5 @@
34 }
35 }
36
37+#[allow(dead_code)]
38 const BENCODE_REVISION_SERIALIZER_V1: BEncodeRevisionSerializer1 = BEncodeRevisionSerializer1 {};
39
40=== modified file 'crates/bazaar/src/dirstate.rs'
41--- crates/bazaar/src/dirstate.rs 2023-06-27 09:33:46 +0000
42+++ crates/bazaar/src/dirstate.rs 2023-11-08 21:11:21 +0000
43@@ -1,5 +1,6 @@
44 use crate::inventory::Entry as InventoryEntry;
45 use crate::FileId;
46+use base64::engine::Engine;
47 use breezy_osutils::sha::{sha_file, sha_file_by_name};
48 use std::cmp::Ordering;
49 use std::collections::HashMap;
50@@ -158,7 +159,7 @@
51 mode as u8,
52 ];
53
54- base64::encode(packed_data)
55+ base64::engine::general_purpose::STANDARD_NO_PAD.encode(packed_data)
56 }
57
58 pub fn stat_to_minikind(metadata: &Metadata) -> char {
59
60=== modified file 'crates/bazaar/src/groupcompress/delta.rs'
61--- crates/bazaar/src/groupcompress/delta.rs 2023-05-23 09:09:19 +0000
62+++ crates/bazaar/src/groupcompress/delta.rs 2023-11-08 21:11:21 +0000
63@@ -1,4 +1,4 @@
64-use std::io::Read;
65+#![allow(dead_code)]
66
67 /// diff-delta.rs: generate a delta between two buffers
68 ///
69
70=== modified file 'crates/bazaar/src/xml_serializer.rs'
71--- crates/bazaar/src/xml_serializer.rs 2023-07-17 20:32:51 +0000
72+++ crates/bazaar/src/xml_serializer.rs 2023-11-08 21:11:21 +0000
73@@ -1,3 +1,4 @@
74+#![allow(dead_code)]
75 use crate::revision::Revision;
76 use crate::serializer::{Error, RevisionSerializer};
77 use crate::RevisionId;
78
79=== modified file 'crates/urlutils/src/lib.rs'
80--- crates/urlutils/src/lib.rs 2023-11-07 11:23:42 +0000
81+++ crates/urlutils/src/lib.rs 2023-11-08 21:11:21 +0000
82@@ -712,10 +712,10 @@
83
84 pub fn local_path_from_url(url: &str) -> std::result::Result<PathBuf, super::Error> {
85 let url = super::strip_segment_parameters(url);
86- let path = if url.starts_with(FILE_LOCALHOST_PREFIX) {
87- &url[FILE_LOCALHOST_PREFIX.len()..]
88+ let path = if let Some(suffix) = url.strip_prefix(FILE_LOCALHOST_PREFIX) {
89+ suffix
90 } else if url.starts_with(PLAIN_FILE_PREFIX) {
91- &url[7..]
92+ &url[PLAIN_FILE_PREFIX.len() - 1..]
93 } else {
94 return Err(super::Error::NotLocalUrl(url.to_string()));
95 };
96
97=== modified file 'src/bedding.rs'
98--- src/bedding.rs 2023-11-07 16:08:34 +0000
99+++ src/bedding.rs 2023-11-08 21:11:21 +0000
100@@ -210,11 +210,11 @@
101 }
102
103 pub fn cache_dir() -> std::io::Result<PathBuf> {
104- // Return the cache directory to use.
105- let mut base: Option<PathBuf> = env::var("BRZ_HOME").ok().map(PathBuf::from);
106+ let mut base: Option<PathBuf>;
107
108 #[cfg(windows)]
109 {
110+ let mut base: Option<PathBuf> = env::var("BRZ_HOME").ok().map(PathBuf::from);
111 if base.is_none() {
112 base = win32utils::get_local_appdata_location();
113 }
114@@ -225,11 +225,11 @@
115
116 #[cfg(not(windows))]
117 {
118- if let Ok(xdg_cache_home) = env::var("XDG_CACHE_HOME") {
119- base = Some(PathBuf::from(xdg_cache_home));
120+ base = if let Ok(xdg_cache_home) = env::var("XDG_CACHE_HOME") {
121+ Some(PathBuf::from(xdg_cache_home))
122 } else {
123- base = None;
124- }
125+ None
126+ };
127 if base.is_none() {
128 base = Some(
129 breezy_osutils::get_home_dir()
130
131=== modified file 'src/help.rs'
132--- src/help.rs 2023-06-24 13:01:43 +0000
133+++ src/help.rs 2023-11-08 21:11:21 +0000
134@@ -144,8 +144,8 @@
135 let lines = text.split('\n');
136 let mut ret = lines
137 .map(|l| {
138- let l = if l.starts_with(':') {
139- l[1..].to_string()
140+ let l = if let Some(suffix) = l.strip_prefix(':') {
141+ suffix.to_string()
142 } else if l.ends_with("::") {
143 l[..l.len() - 1].to_string()
144 } else {
145
146=== modified file 'src/treebuilder.rs'
147--- src/treebuilder.rs 2023-06-08 19:35:24 +0000
148+++ src/treebuilder.rs 2023-11-08 21:11:21 +0000
149@@ -66,3 +66,9 @@
150 Ok(())
151 }
152 }
153+
154+impl<T: MutableTree> Default for TreeBuilder<T> {
155+ fn default() -> Self {
156+ Self::new()
157+ }
158+}

Subscribers

People subscribed via source and target branches