[MERGE REVIEW] pending merges on empty tree

John A Meinel john at arbash-meinel.com
Wed May 17 13:27:47 BST 2006


Aaron Bentley wrote:
> This patch fixes the admittedly unusual case of doing status on a tree
> with no commits, but pending merges.
> 
> Aaron

It looks very simple, and you have a test case, so +1, except you need a
copyright statement and extra whitespace:

------------------------------------------------------------------------

=== added file 'bzrlib/tests/test_status.py'
--- /dev/null	
+++ bzrlib/tests/test_status.py	
@@ -0,0 +1,16 @@

# Copyright here

+from StringIO import StringIO
+
+from bzrlib.bzrdir import BzrDir
+from bzrlib.status import show_pending_merges
+from bzrlib.tests import TestCaseInTempDir
+

Extra space here

+class TestStatus(TestCaseInTempDir):
+    def test_pending_none(self):
+        tree = BzrDir.create_standalone_workingtree('a')
+        tree.commit('empty commit')
+        tree2 = BzrDir.create_standalone_workingtree('b')
+        tree2.branch.fetch(tree.branch)
+        tree2.set_pending_merges([tree.last_revision()])
+        output = StringIO()
+        show_pending_merges(tree2, output)
+        self.assertContainsRe(output.getvalue(), 'empty commit')

=== modified file 'bzrlib/status.py'
--- bzrlib/status.py	
+++ bzrlib/status.py	
@@ -164,7 +164,7 @@
     if last_revision is not None:
         ignore = set(branch.repository.get_ancestry(last_revision))
     else:
-        ignore = set()
+        ignore = set([None])
     for merge in new.pending_merges():
         ignore.add(merge)
         try:

=== modified file 'bzrlib/tests/__init__.py'
--- bzrlib/tests/__init__.py	
+++ bzrlib/tests/__init__.py	
@@ -1092,6 +1092,7 @@
                    'bzrlib.tests.test_sftp_transport',
                    'bzrlib.tests.test_smart_add',
                    'bzrlib.tests.test_source',
+                   'bzrlib.tests.test_status',
                    'bzrlib.tests.test_store',
                    'bzrlib.tests.test_symbol_versioning',
                    'bzrlib.tests.test_testament',



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060517/b768a0d4/attachment.pgp 


More information about the bazaar mailing list