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

Proposed by Jelmer Vernooij on 2018-03-05
Status: Merged
Approved by: Jelmer Vernooij on 2018-03-05
Approved revision: 6877
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 2018-03-05 Approve on 2018-03-05
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.
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
=== modified file 'breezy/tests/per_branch/test_branch.py'
--- breezy/tests/per_branch/test_branch.py 2018-03-04 02:57:55 +0000
+++ breezy/tests/per_branch/test_branch.py 2018-03-05 21:47:34 +0000
@@ -424,7 +424,12 @@
424 branch_a = tree_a.branch424 branch_a = tree_a.branch
425 checkout_b = branch_a.create_checkout('b')425 checkout_b = branch_a.create_checkout('b')
426 self.assertEqual('null:', checkout_b.last_revision())426 self.assertEqual('null:', checkout_b.last_revision())
427 rev1 = checkout_b.commit('rev1')427 try:
428 rev1 = checkout_b.commit('rev1')
429 except errors.NoRoundtrippingSupport:
430 raise tests.TestNotApplicable(
431 'roundtripping between %r and %r not supported' %
432 (checkout_b.branch, checkout_b.branch.get_master_branch()))
428 self.assertEqual(rev1, branch_a.last_revision())433 self.assertEqual(rev1, branch_a.last_revision())
429 self.assertNotEqual(checkout_b.branch.base, branch_a.base)434 self.assertNotEqual(checkout_b.branch.base, branch_a.base)
430435
431436
=== modified file 'breezy/tests/per_interbranch/test_copy_content_into.py'
--- breezy/tests/per_interbranch/test_copy_content_into.py 2017-05-21 18:10:28 +0000
+++ breezy/tests/per_interbranch/test_copy_content_into.py 2018-03-05 21:47:34 +0000
@@ -17,6 +17,8 @@
17"""Tests for breezy.branch.InterBranch.copy_content_into."""17"""Tests for breezy.branch.InterBranch.copy_content_into."""
1818
19from breezy import branch19from breezy import branch
20from breezy.errors import NoRoundtrippingSupport
21from breezy.tests import TestNotApplicable
20from breezy.tests.per_interbranch import (22from breezy.tests.per_interbranch import (
21 StubMatchingInter,23 StubMatchingInter,
22 StubWithFormat,24 StubWithFormat,
@@ -30,7 +32,12 @@
30 self.tree1 = self.make_from_branch_and_tree('tree1')32 self.tree1 = self.make_from_branch_and_tree('tree1')
31 rev1 = self.tree1.commit('one')33 rev1 = self.tree1.commit('one')
32 branch2 = self.make_to_branch('tree2')34 branch2 = self.make_to_branch('tree2')
33 branch2.repository.fetch(self.tree1.branch.repository)35 try:
36 branch2.repository.fetch(self.tree1.branch.repository)
37 except NoRoundtrippingSupport:
38 raise TestNotApplicable(
39 'lossless cross-vcs fetch from %r to %r unsupported' %
40 (self.tree1.branch, branch2))
34 self.tree1.branch.copy_content_into(branch2, revision_id=rev1)41 self.tree1.branch.copy_content_into(branch2, revision_id=rev1)
3542
36 def test_inter_is_used(self):43 def test_inter_is_used(self):
3744
=== modified file 'breezy/tests/per_interbranch/test_fetch.py'
--- breezy/tests/per_interbranch/test_fetch.py 2018-02-27 14:36:14 +0000
+++ breezy/tests/per_interbranch/test_fetch.py 2018-03-05 21:47:34 +0000
@@ -16,7 +16,7 @@
1616
17"""Tests for InterBranch.fetch."""17"""Tests for InterBranch.fetch."""
1818
19from breezy.errors import FetchLimitUnsupported19from breezy.errors import FetchLimitUnsupported, NoRoundtrippingSupport
20from breezy.revision import NULL_REVISION20from breezy.revision import NULL_REVISION
21from breezy.tests import TestNotApplicable21from breezy.tests import TestNotApplicable
22from breezy.tests.per_interbranch import (22from breezy.tests.per_interbranch import (
@@ -35,7 +35,12 @@
35 rev1 = wt.commit('lala!', allow_pointless=False)35 rev1 = wt.commit('lala!', allow_pointless=False)
3636
37 b2 = self.make_to_branch('b2')37 b2 = self.make_to_branch('b2')
38 b2.fetch(b1)38 try:
39 b2.fetch(b1)
40 except NoRoundtrippingSupport:
41 raise TestNotApplicable(
42 'lossless cross-vcs fetch %r to %r not supported' %
43 (b1, b2))
3944
40 # fetch does not update the last revision45 # fetch does not update the last revision
41 self.assertEqual(NULL_REVISION, b2.last_revision())46 self.assertEqual(NULL_REVISION, b2.last_revision())
@@ -61,6 +66,10 @@
61 b2.fetch(b1, limit=1)66 b2.fetch(b1, limit=1)
62 except FetchLimitUnsupported:67 except FetchLimitUnsupported:
63 raise TestNotApplicable('interbranch does not support fetch limits')68 raise TestNotApplicable('interbranch does not support fetch limits')
69 except NoRoundtrippingSupport:
70 raise TestNotApplicable(
71 'lossless cross-vcs fetch %r to %r not supported' %
72 (b1, b2))
6473
65 # fetch does not update the last revision74 # fetch does not update the last revision
66 self.assertEqual(NULL_REVISION, b2.last_revision())75 self.assertEqual(NULL_REVISION, b2.last_revision())
@@ -81,6 +90,10 @@
81 b2.fetch(b1, limit=1)90 b2.fetch(b1, limit=1)
82 except FetchLimitUnsupported:91 except FetchLimitUnsupported:
83 raise TestNotApplicable('interbranch does not support fetch limits')92 raise TestNotApplicable('interbranch does not support fetch limits')
93 except NoRoundtrippingSupport:
94 raise TestNotApplicable(
95 'lossless cross-vcs fetch %r to %r not supported' %
96 (b1, b2))
8497
85 self.assertEqual(98 self.assertEqual(
86 {rev1},99 {rev1},

Subscribers

People subscribed via source and target branches