Rev 6383: Merge trunk in file:///home/vila/src/bzr/experimental/config-location-options/

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed Dec 21 18:40:28 UTC 2011


At file:///home/vila/src/bzr/experimental/config-location-options/

------------------------------------------------------------
revno: 6383 [merge]
revision-id: v.ladeuil+lp at free.fr-20111221184028-eu4adfcetzk5ymvg
parent: v.ladeuil+lp at free.fr-20111221175320-fd0yu40ksjj44n60
parent: pqm at pqm.ubuntu.com-20111221182031-9gf8hr07o64jddxb
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: config-location-options
timestamp: Wed 2011-12-21 19:40:28 +0100
message:
  Merge trunk
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
  doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
-------------- next part --------------
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2011-12-21 16:52:39 +0000
+++ b/bzrlib/builtins.py	2011-12-21 17:54:39 +0000
@@ -1251,8 +1251,16 @@
         if location is None:
             stored_loc = br_from.get_push_location()
             if stored_loc is None:
-                raise errors.BzrCommandError(gettext(
-                    "No push location known or specified."))
+                parent_loc = br_from.get_parent()
+                if parent_loc:
+                    raise errors.BzrCommandError(gettext(
+                        "No push location known or specified. To push to the "
+                        "parent branch (at %s), use 'bzr push :parent'." %
+                        urlutils.unescape_for_display(parent_loc,
+                            self.outf.encoding)))
+                else:
+                    raise errors.BzrCommandError(gettext(
+                        "No push location known or specified."))
             else:
                 display_url = urlutils.unescape_for_display(stored_loc,
                         self.outf.encoding)

=== modified file 'bzrlib/tests/blackbox/test_push.py'
--- a/bzrlib/tests/blackbox/test_push.py	2011-12-20 14:04:21 +0000
+++ b/bzrlib/tests/blackbox/test_push.py	2011-12-21 18:40:28 +0000
@@ -33,12 +33,10 @@
     )
 from bzrlib.repofmt import knitrepo
 from bzrlib.tests import (
-    blackbox,
     http_server,
     scenarios,
     script,
     test_foreign,
-    test_server,
     )
 from bzrlib.transport import memory
 
@@ -58,6 +56,26 @@
                            ['push', public_url],
                            working_dir='source')
 
+    def test_push_suggests_parent_alias(self):
+        """Push suggests using :parent if there is a known parent branch."""
+        tree_a = self.make_branch_and_tree('a')
+        tree_a.commit('this is a commit')
+        tree_b = self.make_branch_and_tree('b')
+
+        # If there is no parent location set, :parent isn't mentioned.
+        out = self.run_bzr('push', working_dir='a', retcode=3)
+        self.assertEquals(out,
+                ('','bzr: ERROR: No push location known or specified.\n'))
+
+        # If there is a parent location set, the error suggests :parent.
+        tree_a.branch.set_parent(tree_b.branch.base)
+        out = self.run_bzr('push', working_dir='a', retcode=3)
+        self.assertEquals(out,
+            ('','bzr: ERROR: No push location known or specified. '
+                'To push to the parent branch '
+                '(at %s), use \'bzr push :parent\'.\n' %
+                urlutils.unescape_for_display(tree_b.branch.base, 'utf-8')))
+
     def test_push_remember(self):
         """Push changes from one branch to another and test push location."""
         transport = self.get_transport()

=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt	2011-12-21 17:42:34 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2011-12-21 17:54:39 +0000
@@ -49,6 +49,9 @@
 * ``bzr branches`` now indicates the active colocated branch.
   (Jelmer Vernooij, #891667)
 
+* ``bzr push`` now suggests using :parent if there is a parent location
+  set. (Jelmer Vernooij)
+
 * ``bzr send`` now only opens a single connection, rather than two,
   to the target branch.  (Jelmer Vernooij)
 



More information about the bazaar-commits mailing list