Merge lp:~jelmer/brz/lossless-fetch-optional into lp:brz

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/lossless-fetch-optional
Merge into: lp:brz
Diff against target: 93 lines (+29/-4)
3 files modified
breezy/tests/per_branch/test_branch.py (+6/-1)
breezy/tests/per_interbranch/test_copy_content_into.py (+8/-1)
breezy/tests/per_interbranch/test_fetch.py (+15/-2)
To merge this branch: bzr merge lp:~jelmer/brz/lossless-fetch-optional
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+340769@code.launchpad.net

Commit message

Allow InterBranch formats to raise NoRoundtrippingSupport to indicate
that they can't do lossless conversion between two branches.

Description of the change

Allow InterBranch formats to raise NoRoundtrippingSupport to indicate
that they can't do lossless conversion between two branches.

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

Makes sense, thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/tests/per_branch/test_branch.py'
2--- breezy/tests/per_branch/test_branch.py 2018-03-04 02:57:55 +0000
3+++ breezy/tests/per_branch/test_branch.py 2018-03-05 21:47:34 +0000
4@@ -424,7 +424,12 @@
5 branch_a = tree_a.branch
6 checkout_b = branch_a.create_checkout('b')
7 self.assertEqual('null:', checkout_b.last_revision())
8- rev1 = checkout_b.commit('rev1')
9+ try:
10+ rev1 = checkout_b.commit('rev1')
11+ except errors.NoRoundtrippingSupport:
12+ raise tests.TestNotApplicable(
13+ 'roundtripping between %r and %r not supported' %
14+ (checkout_b.branch, checkout_b.branch.get_master_branch()))
15 self.assertEqual(rev1, branch_a.last_revision())
16 self.assertNotEqual(checkout_b.branch.base, branch_a.base)
17
18
19=== modified file 'breezy/tests/per_interbranch/test_copy_content_into.py'
20--- breezy/tests/per_interbranch/test_copy_content_into.py 2017-05-21 18:10:28 +0000
21+++ breezy/tests/per_interbranch/test_copy_content_into.py 2018-03-05 21:47:34 +0000
22@@ -17,6 +17,8 @@
23 """Tests for breezy.branch.InterBranch.copy_content_into."""
24
25 from breezy import branch
26+from breezy.errors import NoRoundtrippingSupport
27+from breezy.tests import TestNotApplicable
28 from breezy.tests.per_interbranch import (
29 StubMatchingInter,
30 StubWithFormat,
31@@ -30,7 +32,12 @@
32 self.tree1 = self.make_from_branch_and_tree('tree1')
33 rev1 = self.tree1.commit('one')
34 branch2 = self.make_to_branch('tree2')
35- branch2.repository.fetch(self.tree1.branch.repository)
36+ try:
37+ branch2.repository.fetch(self.tree1.branch.repository)
38+ except NoRoundtrippingSupport:
39+ raise TestNotApplicable(
40+ 'lossless cross-vcs fetch from %r to %r unsupported' %
41+ (self.tree1.branch, branch2))
42 self.tree1.branch.copy_content_into(branch2, revision_id=rev1)
43
44 def test_inter_is_used(self):
45
46=== modified file 'breezy/tests/per_interbranch/test_fetch.py'
47--- breezy/tests/per_interbranch/test_fetch.py 2018-02-27 14:36:14 +0000
48+++ breezy/tests/per_interbranch/test_fetch.py 2018-03-05 21:47:34 +0000
49@@ -16,7 +16,7 @@
50
51 """Tests for InterBranch.fetch."""
52
53-from breezy.errors import FetchLimitUnsupported
54+from breezy.errors import FetchLimitUnsupported, NoRoundtrippingSupport
55 from breezy.revision import NULL_REVISION
56 from breezy.tests import TestNotApplicable
57 from breezy.tests.per_interbranch import (
58@@ -35,7 +35,12 @@
59 rev1 = wt.commit('lala!', allow_pointless=False)
60
61 b2 = self.make_to_branch('b2')
62- b2.fetch(b1)
63+ try:
64+ b2.fetch(b1)
65+ except NoRoundtrippingSupport:
66+ raise TestNotApplicable(
67+ 'lossless cross-vcs fetch %r to %r not supported' %
68+ (b1, b2))
69
70 # fetch does not update the last revision
71 self.assertEqual(NULL_REVISION, b2.last_revision())
72@@ -61,6 +66,10 @@
73 b2.fetch(b1, limit=1)
74 except FetchLimitUnsupported:
75 raise TestNotApplicable('interbranch does not support fetch limits')
76+ except NoRoundtrippingSupport:
77+ raise TestNotApplicable(
78+ 'lossless cross-vcs fetch %r to %r not supported' %
79+ (b1, b2))
80
81 # fetch does not update the last revision
82 self.assertEqual(NULL_REVISION, b2.last_revision())
83@@ -81,6 +90,10 @@
84 b2.fetch(b1, limit=1)
85 except FetchLimitUnsupported:
86 raise TestNotApplicable('interbranch does not support fetch limits')
87+ except NoRoundtrippingSupport:
88+ raise TestNotApplicable(
89+ 'lossless cross-vcs fetch %r to %r not supported' %
90+ (b1, b2))
91
92 self.assertEqual(
93 {rev1},

Subscribers

People subscribed via source and target branches