Merge lp:~jelmer/brz/commit-builder-fixes into lp:brz

Proposed by Jelmer Vernooij on 2018-03-24
Status: Merged
Approved by: Jelmer Vernooij on 2018-03-24
Approved revision: 6917
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/commit-builder-fixes
Merge into: lp:brz
Diff against target: 153 lines (+24/-18)
1 file modified
breezy/tests/per_repository/test_commit_builder.py (+24/-18)
To merge this branch: bzr merge lp:~jelmer/brz/commit-builder-fixes
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve on 2018-03-24
Martin Packman Approve on 2018-03-24
Review via email: mp+342050@code.launchpad.net

This proposal supersedes a proposal from 2018-03-24.

Commit message

Some foreign branch fixes for the commit builder tests.

Description of the change

Some fixes for the commit builder tests.

* Add some entropy to commit messages.
* Skip tests that rely on empty versioned directories

To post a comment you must log in.
Martin Packman (gz) wrote :

Thanks.

review: Approve
Jelmer Vernooij (jelmer) :
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_repository/test_commit_builder.py'
2--- breezy/tests/per_repository/test_commit_builder.py 2018-03-24 13:37:48 +0000
3+++ breezy/tests/per_repository/test_commit_builder.py 2018-03-24 18:25:33 +0000
4@@ -181,7 +181,7 @@
5
6 def test_commit_unchanged_root_record_iter_changes(self):
7 tree = self.make_branch_and_tree(".")
8- old_revision_id = tree.commit('')
9+ old_revision_id = tree.commit('oldrev')
10 tree.lock_write()
11 builder = tree.branch.get_commit_builder([old_revision_id])
12 try:
13@@ -190,7 +190,7 @@
14 # pointless commit.
15 self.assertFalse(builder.any_changes())
16 builder.finish_inventory()
17- builder.commit('')
18+ builder.commit('rev')
19 builder_tree = builder.revision_tree()
20 new_root_id = builder_tree.get_root_id()
21 new_root_revision = builder_tree.get_file_revision(u'')
22@@ -284,8 +284,8 @@
23 # commiting without changing the root does not change the
24 # last modified except on non-rich-root-repositories.
25 tree = self.make_branch_and_tree('.')
26- rev1 = tree.commit('')
27- rev2 = tree.commit('')
28+ rev1 = tree.commit('rev1')
29+ rev2 = tree.commit('rev2')
30 tree1, tree2 = self._get_revtrees(tree, [rev1, rev2])
31 self.assertEqual(rev1, tree1.get_file_revision(u''))
32 if tree.branch.repository.supports_rich_root():
33@@ -298,7 +298,7 @@
34 self._commit_check_unchanged(tree, name, tree.path2id(name))
35
36 def _commit_check_unchanged(self, tree, name, file_id):
37- rev1 = tree.commit('')
38+ rev1 = tree.commit('rev1')
39 rev2 = self.mini_commit_record_iter_changes(tree, name, name, False, False)
40 tree1, tree2 = self._get_revtrees(tree, [rev1, rev2])
41 self.assertEqual(rev1, tree1.get_file_revision(name))
42@@ -323,10 +323,10 @@
43 self.build_tree(['dir/', 'dir/orig'])
44 tree.add(['dir', 'dir/orig'])
45 dir_id = tree.path2id('dir')
46- rev1 = tree.commit('')
47+ rev1 = tree.commit('rev1')
48 self.build_tree(['dir/content'])
49 tree.add(['dir/content'])
50- rev2 = tree.commit('')
51+ rev2 = tree.commit('rev2')
52 tree1, tree2 = self._get_revtrees(tree, [rev1, rev2])
53 self.assertEqual(rev1, tree1.get_file_revision('dir'))
54 self.assertEqual(rev1, tree2.get_file_revision('dir'))
55@@ -376,6 +376,9 @@
56 def test_last_modified_revision_after_rename_dir_changes(self):
57 # renaming a dir changes the last modified.
58 tree = self.make_branch_and_tree('.')
59+ if not tree.has_versioned_directories():
60+ raise tests.TestNotApplicable(
61+ 'Format does not support versioned directories')
62 self.build_tree(['dir/'])
63 self._add_commit_renamed_check_changed(tree, 'dir')
64
65@@ -443,7 +446,7 @@
66
67 def _commit_change_check_changed(self, tree, names, changer,
68 expect_fs_hash=False):
69- rev1 = tree.commit('')
70+ rev1 = tree.commit('rev1')
71 changer()
72 rev2 = self.mini_commit_record_iter_changes(
73 tree, names[0], names[1], expect_fs_hash=expect_fs_hash)
74@@ -501,7 +504,7 @@
75 inv_sha1 = tree.branch.repository.inventories.get_sha1s(
76 [inv_key])[inv_key]
77 self.assertEqual(inv_sha1, builder.inv_sha1)
78- rev2 = builder.commit('')
79+ rev2 = builder.commit('rev2')
80 except BaseException:
81 builder.abort()
82 raise
83@@ -570,12 +573,12 @@
84
85 def _commit_sprout(self, tree, name):
86 tree.add([name])
87- rev_id = tree.commit('')
88+ rev_id = tree.commit('rev')
89 return rev_id, tree.controldir.sprout('t2').open_workingtree()
90
91- def _rename_in_tree(self, tree, name):
92+ def _rename_in_tree(self, tree, name, message):
93 tree.rename_one(name, 'new_' + name)
94- return tree.commit('')
95+ return tree.commit(message)
96
97 def _commit_sprout_rename_merge(self, tree1, name, expect_fs_hash=False):
98 """Do a rename in both trees."""
99@@ -583,8 +586,8 @@
100 file_id = tree2.path2id(name)
101 self.assertIsNot(None, file_id)
102 # change both sides equally
103- rev2 = self._rename_in_tree(tree1, name)
104- rev3 = self._rename_in_tree(tree2, name)
105+ rev2 = self._rename_in_tree(tree1, name, 'rev2')
106+ rev3 = self._rename_in_tree(tree2, name, 'rev3')
107 tree1.merge_from_branch(tree2.branch)
108 rev4 = self.mini_commit_record_iter_changes(tree1, 'new_' + name, 'new_' + name,
109 expect_fs_hash=expect_fs_hash)
110@@ -628,7 +631,7 @@
111 file_id = tree2.path2id(name)
112 self.assertIsNot(None, file_id)
113 # change on the other side to merge back
114- rev2 = self._rename_in_tree(tree2, name)
115+ rev2 = self._rename_in_tree(tree2, name, 'rev2')
116 tree1.merge_from_branch(tree2.branch)
117 def _check_graph(in_tree, changed_in_tree):
118 rev3 = self.mini_commit_record_iter_changes(
119@@ -647,7 +650,7 @@
120 # change to name, branch tree1 and give it an unrelated change, then
121 # merge that to t2.
122 other_tree = tree1.controldir.sprout('t3').open_workingtree()
123- other_rev = other_tree.commit('')
124+ other_rev = other_tree.commit('other_rev')
125 tree2.merge_from_branch(other_tree.branch)
126 _check_graph(tree2, False)
127
128@@ -655,13 +658,13 @@
129 # Make a merge which incorporates the addition of a new object to
130 # another branch. The per-file graph shows no additional change
131 # in the merge because its a straight line.
132- rev1 = tree1.commit('')
133+ rev1 = tree1.commit('rev1')
134 tree2 = tree1.controldir.sprout('t2').open_workingtree()
135 # make and commit on the other side to merge back
136 make('t2/name')
137 tree2.add(['name'])
138 self.assertTrue(tree2.is_versioned('name'))
139- rev2 = tree2.commit('')
140+ rev2 = tree2.commit('rev2')
141 tree1.merge_from_branch(tree2.branch)
142 rev3 = self.mini_commit_record_iter_changes(tree1, None, 'name', False)
143 tree3, = self._get_revtrees(tree1, [rev2])
144@@ -697,6 +700,9 @@
145 def test_last_modified_revision_after_merge_new_dir_unchanged(self):
146 # merge a new dir does not change the last modified.
147 tree1 = self.make_branch_and_tree('t1')
148+ if not tree1.has_versioned_directories():
149+ raise tests.TestNotApplicable(
150+ 'Format does not support versioned directories')
151 self._commit_sprout_make_merge(tree1, self.make_dir)
152
153 def test_last_modified_revision_after_merge_new_file_unchanged(self):

Subscribers

People subscribed via source and target branches