Rev 6557: Warn instead of failing on pull --show-base in a treeless branch in file:///home/vila/src/bzr/bugs/1022160-show-base-no-tree/

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed Sep 5 16:53:59 UTC 2012


At file:///home/vila/src/bzr/bugs/1022160-show-base-no-tree/

------------------------------------------------------------
revno: 6557
revision-id: v.ladeuil+lp at free.fr-20120905165358-ft2r357y5mznczeu
parent: pqm at pqm.ubuntu.com-20120828211731-5di1tveevpzcdtd9
fixes bug: https://launchpad.net/bugs/1022160
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 1022160-show-base-no-tree
timestamp: Wed 2012-09-05 18:53:58 +0200
message:
  Warn instead of failing on pull --show-base in a treeless branch
-------------- next part --------------
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2012-07-31 08:46:40 +0000
+++ b/bzrlib/builtins.py	2012-09-05 16:53:58 +0000
@@ -1184,9 +1184,8 @@
             tree_to = None
             branch_to = Branch.open_containing(directory)[0]
             self.add_cleanup(branch_to.lock_write().unlock)
-
-        if tree_to is None and show_base:
-            raise errors.BzrCommandError(gettext("Need working tree for --show-base."))
+            if show_base:
+                warning(gettext("No working tree, ignoring --show-base"))
 
         if local and not branch_to.get_bound_location():
             raise errors.LocalRequiresBoundBranch()

=== modified file 'bzrlib/tests/blackbox/test_pull.py'
--- a/bzrlib/tests/blackbox/test_pull.py	2012-04-16 11:08:11 +0000
+++ b/bzrlib/tests/blackbox/test_pull.py	2012-09-05 16:53:58 +0000
@@ -501,16 +501,15 @@
                              'fee>>>>>>> MERGE-SOURCE\n',
                              open(osutils.pathjoin('b', 'hello')).read())
 
-    def test_pull_show_base_working_tree_only(self):
-        """--show-base only allowed if there's a working tree
+    def test_pull_warns_about_show_base_when_no_working_tree(self):
+        """--show-base is useless if there's no working tree
 
-        see https://bugs.launchpad.net/bzr/+bug/202374"""
-        # create a branch, see that --show-base fails
+        see https://bugs.launchpad.net/bzr/+bug/1022160"""
         self.make_branch('from')
         self.make_branch('to')
-        out=self.run_bzr(['pull','-d','to','from','--show-base'],retcode=3)
-        self.assertEqual(
-            out, ('','bzr: ERROR: Need working tree for --show-base.\n'))
+        out = self.run_bzr(['pull','-d','to','from','--show-base'])
+        self.assertEqual(out, ('No revisions or tags to pull.\n',
+                               'No working tree, ignoring --show-base\n'))
 
     def test_pull_tag_conflicts(self):
         """pulling tags with conflicts will change the exit code"""

=== modified file 'doc/en/release-notes/bzr-2.6.txt'
--- a/doc/en/release-notes/bzr-2.6.txt	2012-08-23 15:58:32 +0000
+++ b/doc/en/release-notes/bzr-2.6.txt	2012-09-05 16:53:58 +0000
@@ -47,6 +47,9 @@
   and would be ignored.
   (Haw Loeung, #932515)
 
+* Warn when ``--show-base`` is used for ``pull`` in a treeless branch
+  instead of failing. It's useless but harmless. (Vincent Ladeuil, #1022160)
+
 * When a missing referenced chk root error is encountered, bzr now suggests
   running ``bzr reconcile --canonicalize-chks``. (Jelmer Vernooij, #1021537)
 



More information about the bazaar-commits mailing list