Merge lp:~jelmer/brz/fetch-limit-unsupported into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 6864
Merge reported by: Vincent Ladeuil
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/fetch-limit-unsupported
Merge into: lp:brz
Diff against target: 56 lines (+18/-2)
2 files modified
breezy/errors.py (+8/-0)
breezy/tests/per_interbranch/test_fetch.py (+10/-2)
To merge this branch: bzr merge lp:~jelmer/brz/fetch-limit-unsupported
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+340021@code.launchpad.net

Commit message

Allow InterBranch implementations to not provide support for limit= parameter.

Description of the change

Allow InterBranch implementations to not provide support for limit= parameter.

To post a comment you must log in.
6864. By Jelmer Vernooij

Move to errors.

Revision history for this message
Martin Packman (gz) wrote :

Hm, not worth a new class as is, but presume you'll want to catch this exception somewhere outside tests? Where's the code that will raise this live, in foreign format plugins?

review: Approve
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

> Hm, not worth a new class as is, but presume you'll want to catch this
> exception somewhere outside tests? Where's the code that will raise this live,
> in foreign format plugins?
Yep, Git will raise this.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/errors.py'
2--- breezy/errors.py 2017-12-23 09:56:39 +0000
3+++ breezy/errors.py 2018-02-27 14:41:23 +0000
4@@ -1867,6 +1867,14 @@
5 self.tname = type(method_self).__name__
6
7
8+class FetchLimitUnsupported(UnsupportedOperation):
9+
10+ fmt = ("InterBranch %(interbranch)r does not support fetching limits.")
11+
12+ def __init__(self, interbranch):
13+ BzrError.__init__(self, interbranch=interbranch)
14+
15+
16 class NonAsciiRevisionId(UnsupportedOperation):
17 """Raised when a commit is attempting to set a non-ascii revision id
18 but cant.
19
20=== modified file 'breezy/tests/per_interbranch/test_fetch.py'
21--- breezy/tests/per_interbranch/test_fetch.py 2017-11-12 17:53:35 +0000
22+++ breezy/tests/per_interbranch/test_fetch.py 2018-02-27 14:41:23 +0000
23@@ -16,7 +16,9 @@
24
25 """Tests for InterBranch.fetch."""
26
27+from breezy.errors import FetchLimitUnsupported
28 from breezy.revision import NULL_REVISION
29+from breezy.tests import TestNotApplicable
30 from breezy.tests.per_interbranch import (
31 TestCaseWithInterBranch,
32 )
33@@ -55,7 +57,10 @@
34 builder.finish_series()
35 b1 = builder.get_branch()
36 b2 = self.make_to_branch('b2')
37- b2.fetch(b1, limit=1)
38+ try:
39+ b2.fetch(b1, limit=1)
40+ except FetchLimitUnsupported:
41+ raise TestNotApplicable('interbranch does not support fetch limits')
42
43 # fetch does not update the last revision
44 self.assertEqual(NULL_REVISION, b2.last_revision())
45@@ -72,7 +77,10 @@
46 rev1 = wt.commit('lala!', allow_pointless=False)
47
48 b2 = self.make_to_branch('b2')
49- b2.fetch(b1, limit=1)
50+ try:
51+ b2.fetch(b1, limit=1)
52+ except FetchLimitUnsupported:
53+ raise TestNotApplicable('interbranch does not support fetch limits')
54
55 self.assertEqual(
56 {rev1},

Subscribers

People subscribed via source and target branches