Merge lp:~vila/bzr/1022160-show-base-no-tree into lp:bzr

Proposed by Vincent Ladeuil
Status: Merged
Approved by: Martin Packman
Approved revision: no longer in the source branch.
Merged at revision: 6557
Proposed branch: lp:~vila/bzr/1022160-show-base-no-tree
Merge into: lp:bzr
Diff against target: 55 lines (+11/-10)
3 files modified
bzrlib/builtins.py (+2/-3)
bzrlib/tests/blackbox/test_pull.py (+6/-7)
doc/en/release-notes/bzr-2.6.txt (+3/-0)
To merge this branch: bzr merge lp:~vila/bzr/1022160-show-base-no-tree
Reviewer Review Type Date Requested Status
Martin Packman (community) Approve
Review via email: mp+122913@code.launchpad.net

Commit message

Warn rather than erroring if pull --show-base is used without a tree

Description of the change

As reported, --show-base makes no sense while pulling in a treeless branch,
so better warn than fail.

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

Seems good to me. We'd like a way of silencing warnings really, but that's not a job for this branch, and warning is the right thing I'd say. The test is slightly funky, but your change to it is fine.

review: Approve
Revision history for this message
Martin Packman (gz) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/builtins.py'
2--- bzrlib/builtins.py 2012-07-31 08:46:40 +0000
3+++ bzrlib/builtins.py 2012-09-05 17:01:20 +0000
4@@ -1184,9 +1184,8 @@
5 tree_to = None
6 branch_to = Branch.open_containing(directory)[0]
7 self.add_cleanup(branch_to.lock_write().unlock)
8-
9- if tree_to is None and show_base:
10- raise errors.BzrCommandError(gettext("Need working tree for --show-base."))
11+ if show_base:
12+ warning(gettext("No working tree, ignoring --show-base"))
13
14 if local and not branch_to.get_bound_location():
15 raise errors.LocalRequiresBoundBranch()
16
17=== modified file 'bzrlib/tests/blackbox/test_pull.py'
18--- bzrlib/tests/blackbox/test_pull.py 2012-04-16 11:08:11 +0000
19+++ bzrlib/tests/blackbox/test_pull.py 2012-09-05 17:01:20 +0000
20@@ -501,16 +501,15 @@
21 'fee>>>>>>> MERGE-SOURCE\n',
22 open(osutils.pathjoin('b', 'hello')).read())
23
24- def test_pull_show_base_working_tree_only(self):
25- """--show-base only allowed if there's a working tree
26+ def test_pull_warns_about_show_base_when_no_working_tree(self):
27+ """--show-base is useless if there's no working tree
28
29- see https://bugs.launchpad.net/bzr/+bug/202374"""
30- # create a branch, see that --show-base fails
31+ see https://bugs.launchpad.net/bzr/+bug/1022160"""
32 self.make_branch('from')
33 self.make_branch('to')
34- out=self.run_bzr(['pull','-d','to','from','--show-base'],retcode=3)
35- self.assertEqual(
36- out, ('','bzr: ERROR: Need working tree for --show-base.\n'))
37+ out = self.run_bzr(['pull','-d','to','from','--show-base'])
38+ self.assertEqual(out, ('No revisions or tags to pull.\n',
39+ 'No working tree, ignoring --show-base\n'))
40
41 def test_pull_tag_conflicts(self):
42 """pulling tags with conflicts will change the exit code"""
43
44=== modified file 'doc/en/release-notes/bzr-2.6.txt'
45--- doc/en/release-notes/bzr-2.6.txt 2012-08-23 15:58:32 +0000
46+++ doc/en/release-notes/bzr-2.6.txt 2012-09-05 17:01:20 +0000
47@@ -47,6 +47,9 @@
48 and would be ignored.
49 (Haw Loeung, #932515)
50
51+* Warn when ``--show-base`` is used for ``pull`` in a treeless branch
52+ instead of failing. It's useless but harmless. (Vincent Ladeuil, #1022160)
53+
54 * When a missing referenced chk root error is encountered, bzr now suggests
55 running ``bzr reconcile --canonicalize-chks``. (Jelmer Vernooij, #1021537)
56