Exemple #1
0
 def test_up_not_merged(self):
     """up-thread from a thread with new work."""
     tree = self.get_tree_with_loom('tree')
     tree.branch.new_thread('bottom')
     tree.branch._set_nick('bottom')
     bottom_rev1 = tree.commit('bottom_commit')
     tree.branch.new_thread('top', 'bottom')
     tree.branch._set_nick('top')
     top_rev1 = tree.commit('top_commit', allow_pointless=True)
     tree_loom_tree = breezy.plugins.loom.tree.LoomTreeDecorator(tree)
     tree_loom_tree.down_thread()
     # check the test will be valid
     tree.lock_read()
     try:
         graph = tree.branch.repository.get_graph()
         self.assertEqual(
             [top_rev1, bottom_rev1, NULL_REVISION],
             [r for (r, ps) in graph.iter_ancestry([top_rev1])])
         self.assertEqual([bottom_rev1], tree.get_parent_ids())
     finally:
         tree.unlock()
     bottom_rev2 = tree.commit('bottom_two', allow_pointless=True)
     tree_loom_tree.up_thread()
     self.assertEqual('top', tree.branch.nick)
     self.assertEqual([top_rev1, bottom_rev2], tree.get_parent_ids())
Exemple #2
0
 def test_up_to_no_commits(self):
     tree = self.get_tree_with_loom('tree')
     tree.branch.new_thread('bottom')
     tree.branch.new_thread('top')
     tree.branch._set_nick('bottom')
     bottom_rev1 = tree.commit('bottom_commit')
     tree_loom_tree = breezy.plugins.loom.tree.LoomTreeDecorator(tree)
     tree_loom_tree.up_thread()
     self.assertEqual('top', tree.branch.nick)
     self.assertEqual([bottom_rev1], tree.get_parent_ids())
Exemple #3
0
 def test_down_named_thread(self):
     tree = self.get_tree_with_loom('source')
     loom_tree = breezy.plugins.loom.tree.LoomTreeDecorator(tree)
     bottom_id = self._add_thread(tree, 'bottom')
     self._add_thread(tree, 'middle')
     self._add_thread(tree, 'top')
     self.assertNotEqual(bottom_id, tree.last_revision())
     loom_tree.down_thread('bottom')
     self.assertEqual('bottom', tree.branch.nick)
     self.assertEqual([bottom_id], tree.get_parent_ids())
Exemple #4
0
 def test_up_many_halts_on_conflicts(self):
     loom_tree = self.get_loom_with_three_threads()
     tree = loom_tree.tree
     self.build_tree_contents([('source/file', 'contents-a')])
     tree.add('file')
     tree.commit('bottom', rev_id=b'bottom-1')
     loom_tree.up_thread()
     self.build_tree_contents([('source/file', 'contents-b')])
     tree.commit('middle', rev_id=b'middle-1')
     loom_tree.down_thread()
     self.build_tree_contents([('source/file', 'contents-c')])
     tree.commit('bottom', rev_id=b'bottom-2')
     loom_tree.up_many()
     self.assertEqual('middle', tree.branch.nick)
     self.assertEqual([b'middle-1', b'bottom-2'], tree.get_parent_ids())
     self.assertEqual(1, len(tree.conflicts()))
Exemple #5
0
 def test_up_thread(self):
     loom_tree = self.get_loom_with_two_threads()
     tree = loom_tree.tree
     loom_tree.up_thread()
     self.assertEqual('top', tree.branch.nick)
     self.assertEqual([], tree.get_parent_ids())