Merge lp:~jelmer/bzr/info-lock-without-repo into lp:bzr/2.5

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 6477
Proposed branch: lp:~jelmer/bzr/info-lock-without-repo
Merge into: lp:bzr/2.5
Diff against target: 70 lines (+23/-5)
3 files modified
bzrlib/info.py (+7/-5)
bzrlib/tests/blackbox/test_info.py (+13/-0)
doc/en/release-notes/bzr-2.5.txt (+3/-0)
To merge this branch: bzr merge lp:~jelmer/bzr/info-lock-without-repo
Reviewer Review Type Date Requested Status
Martin Pool Approve
Vincent Ladeuil Approve
Review via email: mp+93837@code.launchpad.net

Commit message

Fix 'bzr info -v' for a control directory without a repository.

Description of the change

Fix "bzr info -v" when run on an empty control directory without a repository, branch or working tree.

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) :
review: Approve
Revision history for this message
Martin Pool (mbp) wrote :

great, thankyou!

  vote approve

review: Approve
Revision history for this message
Jelmer Vernooij (jelmer) 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/info.py'
2--- bzrlib/info.py 2012-01-18 20:47:13 +0000
3+++ bzrlib/info.py 2012-02-20 13:48:17 +0000
4@@ -200,9 +200,10 @@
5 repository._format.get_format_description())
6
7
8-def _show_locking_info(repository, branch=None, working=None, outfile=None):
9+def _show_locking_info(repository=None, branch=None, working=None,
10+ outfile=None):
11 """Show locking status of working, branch and repository."""
12- if (repository.get_physical_lock_status() or
13+ if (repository and repository.get_physical_lock_status() or
14 (branch and branch.get_physical_lock_status()) or
15 (working and working.get_physical_lock_status())):
16 outfile.write('\n')
17@@ -413,11 +414,12 @@
18 if branch is not None:
19 show_committers = verbose >= 2
20 stats = _show_branch_stats(branch, show_committers, outfile)
21- else:
22+ elif repository is not None:
23 stats = repository.gather_stats()
24- if branch is None and working is None:
25+ if branch is None and working is None and repository is not None:
26 _show_repository_info(repository, outfile)
27- _show_repository_stats(repository, stats, outfile)
28+ if repository is not None:
29+ _show_repository_stats(repository, stats, outfile)
30
31
32 def describe_layout(repository=None, branch=None, tree=None, control=None):
33
34=== modified file 'bzrlib/tests/blackbox/test_info.py'
35--- bzrlib/tests/blackbox/test_info.py 2012-01-26 15:36:39 +0000
36+++ bzrlib/tests/blackbox/test_info.py 2012-02-20 13:48:17 +0000
37@@ -57,6 +57,19 @@
38 ' control directory: ctrl\n')
39 self.assertEquals(err, '')
40
41+ def test_info_empty_controldir_verbose(self):
42+ self.make_bzrdir('ctrl')
43+ out, err = self.run_bzr('info -v ctrl')
44+ self.assertEqualDiff(out,
45+ 'Empty control directory (format: 2a or pack-0.92)\n'
46+ 'Location:\n'
47+ ' control directory: ctrl\n\n'
48+ 'Format:\n'
49+ ' control: Meta directory format 1\n\n'
50+ 'Control directory:\n'
51+ ' 0 branches\n')
52+ self.assertEquals(err, '')
53+
54 def test_info_dangling_branch_reference(self):
55 br = self.make_branch('target')
56 br.create_checkout('from', lightweight=True)
57
58=== modified file 'doc/en/release-notes/bzr-2.5.txt'
59--- doc/en/release-notes/bzr-2.5.txt 2012-02-16 18:01:57 +0000
60+++ doc/en/release-notes/bzr-2.5.txt 2012-02-20 13:48:17 +0000
61@@ -36,6 +36,9 @@
62 .. Fixes for situations where bzr would previously crash or give incorrect
63 or undesirable results.
64
65+* Show locks in ``bzr info`` on control directories without a
66+ repository. (Jelmer Vernooij, #936767)
67+
68 * Disable ssl certificate verification on osx and windows until a native
69 access to the the root certificates is provided there.
70 (Vincent Ladeuil, #929179)

Subscribers

People subscribed via source and target branches