Merge lp:~jelmer/brz/git-host-key-verification into lp:brz/3.2

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/git-host-key-verification
Merge into: lp:brz/3.2
Diff against target: 69 lines (+24/-0)
2 files modified
breezy/git/remote.py (+6/-0)
breezy/git/tests/test_remote.py (+18/-0)
To merge this branch: bzr merge lp:~jelmer/brz/git-host-key-verification
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+415805@code.launchpad.net

Commit message

Special case some more Git error messages.

Description of the change

Special case some more Git error messages.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/git/remote.py'
--- breezy/git/remote.py 2022-01-16 17:15:16 +0000
+++ breezy/git/remote.py 2022-02-18 17:09:50 +0000
@@ -35,6 +35,7 @@
35from ..errors import (35from ..errors import (
36 AlreadyBranchError,36 AlreadyBranchError,
37 BzrError,37 BzrError,
38 ConnectionReset,
38 DivergedBranches,39 DivergedBranches,
39 InProcessTransport,40 InProcessTransport,
40 InvalidRevisionId,41 InvalidRevisionId,
@@ -44,6 +45,7 @@
44 NotBranchError,45 NotBranchError,
45 NotLocalUrl,46 NotLocalUrl,
46 PermissionDenied,47 PermissionDenied,
48 TransportError,
47 UninitializableFormat,49 UninitializableFormat,
48 )50 )
49from ..revision import NULL_REVISION51from ..revision import NULL_REVISION
@@ -215,6 +217,10 @@
215 m = re.match(r'Permission to ([^ ]+) denied to ([^ ]+)\.', message)217 m = re.match(r'Permission to ([^ ]+) denied to ([^ ]+)\.', message)
216 if m:218 if m:
217 return PermissionDenied(m.group(1), 'denied to %s' % m.group(2))219 return PermissionDenied(m.group(1), 'denied to %s' % m.group(2))
220 if message == 'Host key verification failed.':
221 return TransportError('Host key verification failed')
222 if message == '[Errno 104] Connection reset by peer':
223 return ConnectionReset(message)
218 # Don't know, just return it to the user as-is224 # Don't know, just return it to the user as-is
219 return RemoteGitError(message)225 return RemoteGitError(message)
220226
221227
=== modified file 'breezy/git/tests/test_remote.py'
--- breezy/git/tests/test_remote.py 2022-01-24 20:22:05 +0000
+++ breezy/git/tests/test_remote.py 2022-02-18 17:09:50 +0000
@@ -23,10 +23,12 @@
2323
24from ...controldir import ControlDir24from ...controldir import ControlDir
25from ...errors import (25from ...errors import (
26 ConnectionReset,
26 DivergedBranches,27 DivergedBranches,
27 NotBranchError,28 NotBranchError,
28 NoSuchTag,29 NoSuchTag,
29 PermissionDenied,30 PermissionDenied,
31 TransportError,
30 )32 )
3133
32from ...tests import (34from ...tests import (
@@ -164,6 +166,22 @@
164 'GitLab: You are not allowed to push code to '166 'GitLab: You are not allowed to push code to '
165 'protected branches on this project.')))167 'protected branches on this project.')))
166168
169 def test_host_key_verification(self):
170 self.assertEqual(
171 TransportError('Host key verification failed'),
172 parse_git_error(
173 'url',
174 RemoteGitError(
175 'Host key verification failed.')))
176
177 def test_connection_reset_by_peer(self):
178 self.assertEqual(
179 ConnectionReset('[Errno 104] Connection reset by peer'),
180 parse_git_error(
181 'url',
182 RemoteGitError(
183 '[Errno 104] Connection reset by peer')))
184
167185
168class ParseHangupTests(TestCase):186class ParseHangupTests(TestCase):
169187

Subscribers

People subscribed via source and target branches