Merge lp:~jelmer/brz/segmentsurl into lp:brz/3.0

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/segmentsurl
Merge into: lp:brz/3.0
Diff against target: 43 lines (+10/-1)
3 files modified
breezy/tests/test_urlutils.py (+3/-0)
breezy/urlutils.py (+4/-1)
doc/en/release-notes/brz-3.0.txt (+3/-0)
To merge this branch: bzr merge lp:~jelmer/brz/segmentsurl
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+363699@code.launchpad.net

Commit message

Raise better error when subsegments lack =.

Description of the change

Raise better error when subsegments lack =.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Thanks!

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/tests/test_urlutils.py'
2--- breezy/tests/test_urlutils.py 2018-11-23 03:06:01 +0000
3+++ breezy/tests/test_urlutils.py 2019-03-04 02:08:13 +0000
4@@ -599,6 +599,9 @@
5 self.assertEqual(("foo/base,key1=val1/other/elements",
6 {"key2": "val2"}), split_segment_parameters(
7 "foo/base,key1=val1/other/elements,key2=val2"))
8+ self.assertRaises(
9+ urlutils.InvalidURL, split_segment_parameters,
10+ "foo/base,key1")
11 # TODO: Check full URLs as well as relative references
12
13 def test_win32_strip_local_trailing_slash(self):
14
15=== modified file 'breezy/urlutils.py'
16--- breezy/urlutils.py 2018-11-12 01:41:38 +0000
17+++ breezy/urlutils.py 2019-03-04 02:08:13 +0000
18@@ -561,7 +561,10 @@
19 (base_url, subsegments) = split_segment_parameters_raw(url)
20 parameters = {}
21 for subsegment in subsegments:
22- (key, value) = subsegment.split("=", 1)
23+ try:
24+ (key, value) = subsegment.split("=", 1)
25+ except ValueError:
26+ raise InvalidURL(url, "missing = in subsegment")
27 if not isinstance(key, str):
28 raise TypeError(key)
29 if not isinstance(value, str):
30
31=== modified file 'doc/en/release-notes/brz-3.0.txt'
32--- doc/en/release-notes/brz-3.0.txt 2019-03-04 00:35:07 +0000
33+++ doc/en/release-notes/brz-3.0.txt 2019-03-04 02:08:13 +0000
34@@ -233,6 +233,9 @@
35 * Don't report .git files as unknown files.
36 (Jelmer Vernooij, Debian Bug #921240)
37
38+* Raise better error when path subsegments lack =.
39+ (Jelmer Vernooij, #891483)
40+
41 * Display correct pull location argument in
42 output of ``brz uncommit``.
43 (Jelmer Vernooij, #386577)

Subscribers

People subscribed via source and target branches