Merge lp:~jelmer/brz/wt-righthand-ghost-parents into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 6862
Merge reported by: Vincent Ladeuil
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/wt-righthand-ghost-parents
Merge into: lp:brz
Diff against target: 79 lines (+28/-9)
2 files modified
breezy/tests/per_workingtree/test_parents.py (+26/-9)
breezy/workingtree.py (+2/-0)
To merge this branch: bzr merge lp:~jelmer/brz/wt-righthand-ghost-parents
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+339496@code.launchpad.net

Commit message

Allow working tree formats to specify that they don't support righthand ghost parents.

Description of the change

Allow working tree formats to specify that they don't support righthand ghost parents.

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

Okay, fair enough.

review: Approve
Revision history for this message
Vincent Ladeuil (vila) wrote :

Running landing tests failed

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/tests/per_workingtree/test_parents.py'
2--- breezy/tests/per_workingtree/test_parents.py 2018-02-03 13:39:29 +0000
3+++ breezy/tests/per_workingtree/test_parents.py 2018-02-25 15:43:15 +0000
4@@ -102,9 +102,14 @@
5 # remove the tree's history
6 uncommit(t.branch, tree=t)
7 rev_tree = t.branch.repository.revision_tree(revision_in_repo)
8- t.set_parent_trees([(revision_in_repo, rev_tree),
9- ('another-missing', None)])
10- self.assertConsistentParents([revision_in_repo, 'another-missing'], t)
11+ if t._format.supports_righthand_parent_id_as_ghost:
12+ t.set_parent_trees([(revision_in_repo, rev_tree),
13+ ('another-missing', None)])
14+ self.assertConsistentParents([revision_in_repo, 'another-missing'], t)
15+ else:
16+ self.assertRaises(errors.GhostRevisionUnusableHere,
17+ t.set_parent_trees, [(revision_in_repo, rev_tree),
18+ ('another-missing', None)])
19
20 def test_set_three_parents(self):
21 t = self.make_branch_and_tree('.')
22@@ -154,8 +159,12 @@
23 # remove the tree's history
24 uncommit(t.branch, tree=t)
25 rev_tree = t.branch.repository.revision_tree(revision_in_repo)
26- t.set_parent_ids([revision_in_repo, 'another-missing'])
27- self.assertConsistentParents([revision_in_repo, 'another-missing'], t)
28+ if t._format.supports_righthand_parent_id_as_ghost:
29+ t.set_parent_ids([revision_in_repo, 'another-missing'])
30+ self.assertConsistentParents([revision_in_repo, 'another-missing'], t)
31+ else:
32+ self.assertRaises(errors.GhostRevisionUnusableHere,
33+ t.set_parent_ids, [revision_in_repo, 'another-missing'])
34
35 def test_set_three_parents_ids(self):
36 t = self.make_branch_and_tree('.')
37@@ -316,8 +325,12 @@
38 """Test adding the second parent id - as a ghost"""
39 tree = self.make_branch_and_tree('.')
40 first_revision = tree.commit('first post')
41- tree.add_parent_tree_id('second')
42- self.assertConsistentParents([first_revision, 'second'], tree)
43+ if tree._format.supports_righthand_parent_id_as_ghost:
44+ tree.add_parent_tree_id('second')
45+ self.assertConsistentParents([first_revision, 'second'], tree)
46+ else:
47+ self.assertRaises(errors.GhostRevisionUnusableHere,
48+ tree.add_parent_tree_id, 'second')
49
50 def test_add_first_parent_tree(self):
51 """Test adding the first parent id"""
52@@ -360,8 +373,12 @@
53 """Test adding the second parent id - as a ghost"""
54 tree = self.make_branch_and_tree('.')
55 first_revision = tree.commit('first post')
56- tree.add_parent_tree(('second', None))
57- self.assertConsistentParents([first_revision, 'second'], tree)
58+ if tree._format.supports_righthand_parent_id_as_ghost:
59+ tree.add_parent_tree(('second', None))
60+ self.assertConsistentParents([first_revision, 'second'], tree)
61+ else:
62+ self.assertRaises(errors.GhostRevisionUnusableHere,
63+ tree.add_parent_tree, ('second', None))
64
65
66 class UpdateToOneParentViaDeltaTests(TestCaseWithWorkingTree):
67
68=== modified file 'breezy/workingtree.py'
69--- breezy/workingtree.py 2018-02-17 02:57:14 +0000
70+++ breezy/workingtree.py 2018-02-25 15:43:15 +0000
71@@ -1419,6 +1419,8 @@
72
73 supports_leftmost_parent_id_as_ghost = True
74
75+ supports_righthand_parent_id_as_ghost = True
76+
77 def initialize(self, controldir, revision_id=None, from_branch=None,
78 accelerator_tree=None, hardlink=False):
79 """Initialize a new working tree in controldir.

Subscribers

People subscribed via source and target branches