Merge lp:~jelmer/brz/resolve-location into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/resolve-location
Merge into: lp:brz
Diff against target: 87 lines (+61/-0)
3 files modified
breezy/builtins.py (+18/-0)
breezy/tests/blackbox/__init__.py (+1/-0)
breezy/tests/blackbox/test_resolve_location.py (+42/-0)
To merge this branch: bzr merge lp:~jelmer/brz/resolve-location
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+363581@code.launchpad.net

Commit message

Add a 'brz resolve-location' command.

Description of the change

Add a 'brz resolve-location' command.

This command is mostly useful for debugging issues of various kinds, and therefore hidden.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Make sense. Should perhaps go through `urlutils.unescape_for_display()` as well?

review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/builtins.py'
--- breezy/builtins.py 2019-03-03 23:05:11 +0000
+++ breezy/builtins.py 2019-05-26 22:29:00 +0000
@@ -7018,6 +7018,24 @@
7018 grep.versioned_grep(opts)7018 grep.versioned_grep(opts)
70197019
70207020
7021class cmd_resolve_location(Command):
7022 __doc__ = """Expand a location to a full URL.
7023
7024 :Examples:
7025 Look up a Launchpad URL.
7026
7027 brz resolve-location lp:brz
7028 """
7029 takes_args = ['location']
7030 hidden = True
7031
7032 def run(self, location):
7033 from .location import location_to_url
7034 url = location_to_url(location)
7035 display_url = urlutils.unescape_for_display(url, self.outf.encoding)
7036 self.outf.write('%s\n' % url)
7037
7038
7021def _register_lazy_builtins():7039def _register_lazy_builtins():
7022 # register lazy builtins from other modules; called at startup and should7040 # register lazy builtins from other modules; called at startup and should
7023 # be only called once.7041 # be only called once.
70247042
=== modified file 'breezy/tests/blackbox/__init__.py'
--- breezy/tests/blackbox/__init__.py 2018-11-11 04:08:32 +0000
+++ breezy/tests/blackbox/__init__.py 2019-05-26 22:29:00 +0000
@@ -106,6 +106,7 @@
106 'test_remove_tree',106 'test_remove_tree',
107 'test_repair_workingtree',107 'test_repair_workingtree',
108 'test_resolve',108 'test_resolve',
109 'test_resolve_location',
109 'test_revert',110 'test_revert',
110 'test_revno',111 'test_revno',
111 'test_revision_history',112 'test_revision_history',
112113
=== added file 'breezy/tests/blackbox/test_resolve_location.py'
--- breezy/tests/blackbox/test_resolve_location.py 1970-01-01 00:00:00 +0000
+++ breezy/tests/blackbox/test_resolve_location.py 2019-05-26 22:29:00 +0000
@@ -0,0 +1,42 @@
1# Copyright (C) 2019 Breezy Developers
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
17
18from breezy.tests import TestCaseWithTransport
19
20
21class TestCatRevision(TestCaseWithTransport):
22
23 def test_already_url(self):
24 wt = self.make_branch_and_tree('.')
25
26 out, err = self.run_bzr('resolve-location %s' % wt.branch.user_url)
27 self.assertEqual(out, '%s\n' % wt.branch.user_url)
28
29 def test_parent_missing(self):
30 wt = self.make_branch_and_tree('.')
31
32 out, err = self.run_bzr('resolve-location :parent', retcode=3)
33 self.assertEqual(out, '')
34 self.assertEqual(err, 'brz: ERROR: No parent location assigned.\n')
35
36 def test_parent(self):
37 wt = self.make_branch_and_tree('.')
38 wt.branch.set_parent('http://example.com/foo')
39
40 out, err = self.run_bzr('resolve-location :parent')
41 self.assertEqual(out, 'http://example.com/foo\n')
42 self.assertEqual(err, '')

Subscribers

People subscribed via source and target branches