Rev 6398: (jelmer) If no location is specified to "bzr push" or remembered, in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/
Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Dec 21 18:20:32 UTC 2011
At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 6398 [merge]
revision-id: pqm at pqm.ubuntu.com-20111221182031-9gf8hr07o64jddxb
parent: pqm at pqm.ubuntu.com-20111221174234-06h0xlw6qqb03al2
parent: jelmer at samba.org-20111221175439-u38mnb6vm18lfu44
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-12-21 18:20:31 +0000
message:
(jelmer) If no location is specified to "bzr push" or remembered,
mention the parent alias to the user. (Jelmer Vernooij)
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
=== 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-10-11 12:01:51 +0000
+++ b/bzrlib/tests/blackbox/test_push.py 2011-12-21 16:58:53 +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