Exemplo n.º 1
0
 def test_with_pending_ghost(self):
     """Test when a pending merge is itself a ghost"""
     tree = self.make_branch_and_tree('a')
     tree.commit('first')
     tree.add_parent_tree_id('a-ghost-revision')
     tree.lock_read()
     self.addCleanup(tree.unlock)
     output = StringIO()
     show_pending_merges(tree, output)
     self.assertEqualDiff('pending merges:\n'
                          '  (ghost) a-ghost-revision\n',
                          output.getvalue())
Exemplo n.º 2
0
 def test_with_pending_ghost(self):
     """Test when a pending merge is itself a ghost"""
     tree = self.make_branch_and_tree('a')
     tree.commit('first')
     tree.add_parent_tree_id('a-ghost-revision')
     tree.lock_read()
     self.addCleanup(tree.unlock)
     output = StringIO()
     show_pending_merges(tree, output)
     self.assertEqualDiff(
         'pending merges:\n'
         '  (ghost) a-ghost-revision\n', output.getvalue())
Exemplo n.º 3
0
 def test_multiple_pending(self):
     tree = self.make_multiple_pending_tree()
     output = StringIO()
     tree.lock_read()
     self.addCleanup(tree.unlock)
     show_pending_merges(tree, output)
     # 2b doesn't appear because it's an ancestor of 3b
     self.assertEqualDiff(
         'pending merge tips: (use -v to see all merge revisions)\n'
         '  Joe Foo 2007-12-04 commit 3b\n'
         '  Joe Foo 2007-12-04 commit 3c\n',
         output.getvalue())
Exemplo n.º 4
0
 def test_multiple_pending_verbose(self):
     tree = self.make_multiple_pending_tree()
     output = StringIO()
     tree.lock_read()
     self.addCleanup(tree.unlock)
     show_pending_merges(tree, output, verbose=True)
     # Even though 2b is in the ancestry of 3c, it should only be displayed
     # under the first merge parent.
     self.assertEqualDiff('pending merges:\n'
                          '  Joe Foo 2007-12-04 commit 3b\n'
                          '    Joe Foo 2007-12-04 commit 2b\n'
                          '  Joe Foo 2007-12-04 commit 3c\n',
                          output.getvalue())
Exemplo n.º 5
0
 def test_pending_none(self):
     # Test whether show_pending_merges works in a tree with no commits
     tree = self.make_branch_and_tree('a')
     tree.commit('empty commit')
     tree2 = self.make_branch_and_tree('b')
     # set a left most parent that is not a present commit
     tree2.add_parent_tree_id('some-ghost', allow_leftmost_as_ghost=True)
     # do a merge
     tree2.merge_from_branch(tree.branch)
     output = StringIO()
     tree2.lock_read()
     try:
         show_pending_merges(tree2, output)
     finally:
         tree2.unlock()
     self.assertContainsRe(output.getvalue(), 'empty commit')
Exemplo n.º 6
0
 def test_pending_none(self):
     # Test whether show_pending_merges works in a tree with no commits
     tree = self.make_branch_and_tree('a')
     tree.commit('empty commit')
     tree2 = self.make_branch_and_tree('b')
     # set a left most parent that is not a present commit
     tree2.add_parent_tree_id('some-ghost', allow_leftmost_as_ghost=True)
     # do a merge
     tree2.merge_from_branch(tree.branch)
     output = StringIO()
     tree2.lock_read()
     try:
         show_pending_merges(tree2, output)
     finally:
         tree2.unlock()
     self.assertContainsRe(output.getvalue(), 'empty commit')
Exemplo n.º 7
0
 def test_pending_with_ghosts(self):
     """Test when a pending merge's ancestry includes ghosts."""
     config.GlobalConfig().set_user_option('email', 'Joe Foo <*****@*****.**>')
     tree = self.make_branch_and_tree('a')
     tree.commit('empty commit')
     tree2 = tree.bzrdir.clone('b').open_workingtree()
     tree2.commit('a non-ghost', timestamp=1196796819, timezone=0)
     tree2.add_parent_tree_id('a-ghost-revision')
     tree2.commit('commit with ghost', timestamp=1196796819, timezone=0)
     tree2.commit('another non-ghost', timestamp=1196796819, timezone=0)
     tree.merge_from_branch(tree2.branch)
     tree.lock_read()
     self.addCleanup(tree.unlock)
     output = StringIO()
     show_pending_merges(tree, output)
     self.assertEqualDiff(
         'pending merges:\n'
         '  Joe Foo 2007-12-04 another non-ghost\n'
         '    Joe Foo 2007-12-04 commit with ghost\n'
         '    (ghost) a-ghost-revision\n'
         '    Joe Foo 2007-12-04 a non-ghost\n', output.getvalue())
Exemplo n.º 8
0
 def test_pending_with_ghosts(self):
     """Test when a pending merge's ancestry includes ghosts."""
     config.GlobalConfig().set_user_option('email', 'Joe Foo <*****@*****.**>')
     tree = self.make_branch_and_tree('a')
     tree.commit('empty commit')
     tree2 = tree.bzrdir.clone('b').open_workingtree()
     tree2.commit('a non-ghost', timestamp=1196796819, timezone=0)
     tree2.add_parent_tree_id('a-ghost-revision')
     tree2.commit('commit with ghost', timestamp=1196796819, timezone=0)
     tree2.commit('another non-ghost', timestamp=1196796819, timezone=0)
     tree.merge_from_branch(tree2.branch)
     tree.lock_read()
     self.addCleanup(tree.unlock)
     output = StringIO()
     show_pending_merges(tree, output)
     self.assertEqualDiff('pending merges:\n'
                          '  Joe Foo 2007-12-04 another non-ghost\n'
                          '    Joe Foo 2007-12-04 commit with ghost\n'
                          '    (ghost) a-ghost-revision\n'
                          '    Joe Foo 2007-12-04 a non-ghost\n',
                          output.getvalue())
Exemplo n.º 9
0
 def test_multiple_pending(self):
     config.GlobalConfig().set_user_option('email', 'Joe Foo <*****@*****.**>')
     tree = self.make_branch_and_tree('a')
     tree.commit('commit 1', timestamp=1196796819, timezone=0)
     tree2 = tree.bzrdir.clone('b').open_workingtree()
     tree.commit('commit 2', timestamp=1196796819, timezone=0)
     tree2.commit('commit 2b', timestamp=1196796819, timezone=0)
     tree3 = tree2.bzrdir.clone('c').open_workingtree()
     tree2.commit('commit 3b', timestamp=1196796819, timezone=0)
     tree3.commit('commit 3c', timestamp=1196796819, timezone=0)
     tree.merge_from_branch(tree2.branch)
     tree.merge_from_branch(tree3.branch)
     output = StringIO()
     tree.lock_read()
     self.addCleanup(tree.unlock)
     show_pending_merges(tree, output)
     # Even though 2b is in the ancestry of 3c, it should only be displayed
     # under the first merge parent.
     self.assertEqualDiff(
         'pending merges:\n'
         '  Joe Foo 2007-12-04 commit 3b\n'
         '    Joe Foo 2007-12-04 commit 2b\n'
         '  Joe Foo 2007-12-04 commit 3c\n', output.getvalue())
Exemplo n.º 10
0
 def test_multiple_pending(self):
     config.GlobalConfig().set_user_option('email', 'Joe Foo <*****@*****.**>')
     tree = self.make_branch_and_tree('a')
     tree.commit('commit 1', timestamp=1196796819, timezone=0)
     tree2 = tree.bzrdir.clone('b').open_workingtree()
     tree.commit('commit 2', timestamp=1196796819, timezone=0)
     tree2.commit('commit 2b', timestamp=1196796819, timezone=0)
     tree3 = tree2.bzrdir.clone('c').open_workingtree()
     tree2.commit('commit 3b', timestamp=1196796819, timezone=0)
     tree3.commit('commit 3c', timestamp=1196796819, timezone=0)
     tree.merge_from_branch(tree2.branch)
     tree.merge_from_branch(tree3.branch)
     output = StringIO()
     tree.lock_read()
     self.addCleanup(tree.unlock)
     show_pending_merges(tree, output)
     # Even though 2b is in the ancestry of 3c, it should only be displayed
     # under the first merge parent.
     self.assertEqualDiff('pending merges:\n'
                          '  Joe Foo 2007-12-04 commit 3b\n'
                          '    Joe Foo 2007-12-04 commit 2b\n'
                          '  Joe Foo 2007-12-04 commit 3c\n',
                          output.getvalue())