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

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
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.
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
=== modified file 'breezy/errors.py'
--- breezy/errors.py 2017-12-23 09:56:39 +0000
+++ breezy/errors.py 2018-02-27 14:41:23 +0000
@@ -1867,6 +1867,14 @@
1867 self.tname = type(method_self).__name__1867 self.tname = type(method_self).__name__
18681868
18691869
1870class FetchLimitUnsupported(UnsupportedOperation):
1871
1872 fmt = ("InterBranch %(interbranch)r does not support fetching limits.")
1873
1874 def __init__(self, interbranch):
1875 BzrError.__init__(self, interbranch=interbranch)
1876
1877
1870class NonAsciiRevisionId(UnsupportedOperation):1878class NonAsciiRevisionId(UnsupportedOperation):
1871 """Raised when a commit is attempting to set a non-ascii revision id1879 """Raised when a commit is attempting to set a non-ascii revision id
1872 but cant.1880 but cant.
18731881
=== modified file 'breezy/tests/per_interbranch/test_fetch.py'
--- breezy/tests/per_interbranch/test_fetch.py 2017-11-12 17:53:35 +0000
+++ breezy/tests/per_interbranch/test_fetch.py 2018-02-27 14:41:23 +0000
@@ -16,7 +16,9 @@
1616
17"""Tests for InterBranch.fetch."""17"""Tests for InterBranch.fetch."""
1818
19from breezy.errors import FetchLimitUnsupported
19from breezy.revision import NULL_REVISION20from breezy.revision import NULL_REVISION
21from breezy.tests import TestNotApplicable
20from breezy.tests.per_interbranch import (22from breezy.tests.per_interbranch import (
21 TestCaseWithInterBranch,23 TestCaseWithInterBranch,
22 )24 )
@@ -55,7 +57,10 @@
55 builder.finish_series()57 builder.finish_series()
56 b1 = builder.get_branch()58 b1 = builder.get_branch()
57 b2 = self.make_to_branch('b2')59 b2 = self.make_to_branch('b2')
58 b2.fetch(b1, limit=1)60 try:
61 b2.fetch(b1, limit=1)
62 except FetchLimitUnsupported:
63 raise TestNotApplicable('interbranch does not support fetch limits')
5964
60 # fetch does not update the last revision65 # fetch does not update the last revision
61 self.assertEqual(NULL_REVISION, b2.last_revision())66 self.assertEqual(NULL_REVISION, b2.last_revision())
@@ -72,7 +77,10 @@
72 rev1 = wt.commit('lala!', allow_pointless=False)77 rev1 = wt.commit('lala!', allow_pointless=False)
7378
74 b2 = self.make_to_branch('b2')79 b2 = self.make_to_branch('b2')
75 b2.fetch(b1, limit=1)80 try:
81 b2.fetch(b1, limit=1)
82 except FetchLimitUnsupported:
83 raise TestNotApplicable('interbranch does not support fetch limits')
7684
77 self.assertEqual(85 self.assertEqual(
78 {rev1},86 {rev1},

Subscribers

People subscribed via source and target branches