Merge lp:~jelmer/bzr/info-shows-colocated-branches into lp:bzr

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 6246
Proposed branch: lp:~jelmer/bzr/info-shows-colocated-branches
Merge into: lp:bzr
Diff against target: 75 lines (+40/-0)
3 files modified
bzrlib/info.py (+9/-0)
bzrlib/tests/blackbox/test_info.py (+27/-0)
doc/en/release-notes/bzr-2.5.txt (+4/-0)
To merge this branch: bzr merge lp:~jelmer/bzr/info-shows-colocated-branches
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+81438@code.launchpad.net

Commit message

Print the number of colocated branches in 'bzr info'.

Description of the change

Show the number of colocated branches in 'bzr info -v'.

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

12 + outfile.write('Control directory:\n')
13 + outfile.write(' %d branches\n' % len(control.list_branches()))

Urgh, what a weird indendation ! Even lp removed the spaces before '%d' when I pasted the line above...

Yeah, I realise this is *required* to align with the 'Branch history' and 'Repository' lines, just wanted to let you know I share the feeling (if not with you, at least with lp ;)

Yet, Riddell showed us how to handle plural form for the above, care to fix that ?

Ha crap, nothing in the command have been localized yet, forget about that :-/

Do we really want to mention 'Control directory' to our users ? I'm +1 for adding the _show_control_dir_info() so we have a single place for everything related to the control dir that is not already covered by the other functions, but I'm less convinced that we should tell our users about it...

I don't have a good alternative to propose so I won't block on it though.

review: Approve
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Thanks for the review. :-)

> 12 + outfile.write('Control directory:\n')
> 13 + outfile.write(' %d branches\n' % len(control.list_branches()))
>
> Do we really want to mention 'Control directory' to our users ? I'm +1 for
> adding the _show_control_dir_info() so we have a single place for everything
> related to the control dir that is not already covered by the other functions,
> but I'm less convinced that we should tell our users about it...
>
> I don't have a good alternative to propose so I won't block on it though.
We only print this if there is a bare control directory present, without a repository, branch or working tree. I think we should tell the user *something* in this case - previously we were not outputting anything at all.

Cheers,

Jelmer

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

> Thanks for the review. :-)
>
> > 12 + outfile.write('Control directory:\n')
> > 13 + outfile.write(' %d branches\n' % len(control.list_branches()))
> >
> > Do we really want to mention 'Control directory' to our users ? I'm +1 for
> > adding the _show_control_dir_info() so we have a single place for everything
> > related to the control dir that is not already covered by the other
> functions,
> > but I'm less convinced that we should tell our users about it...
> >
> > I don't have a good alternative to propose so I won't block on it though.
> We only print this if there is a bare control directory present, without a
> repository, branch or working tree. I think we should tell the user
> *something* in this case - previously we were not outputting anything at all.
Scratch that, wrong MP! Sorry.

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 2011-10-11 12:01:51 +0000
3+++ bzrlib/info.py 2011-11-07 10:50:28 +0000
4@@ -159,6 +159,14 @@
5 outfile.writelines(locs.get_lines())
6
7
8+def _show_control_dir_info(control, outfile):
9+ """Show control dir information."""
10+ if control._format.colocated_branches:
11+ outfile.write('\n')
12+ outfile.write('Control directory:\n')
13+ outfile.write(' %d branches\n' % len(control.list_branches()))
14+
15+
16 def _show_format_info(control=None, repository=None, branch=None,
17 working=None, outfile=None):
18 """Show known formats for control, working, branch and repository."""
19@@ -377,6 +385,7 @@
20 return
21 _show_format_info(control, repository, branch, working, outfile)
22 _show_locking_info(repository, branch, working, outfile)
23+ _show_control_dir_info(control, outfile)
24 if branch is not None:
25 _show_missing_revisions_branch(branch, outfile)
26 if working is not None:
27
28=== modified file 'bzrlib/tests/blackbox/test_info.py'
29--- bzrlib/tests/blackbox/test_info.py 2011-10-14 13:56:45 +0000
30+++ bzrlib/tests/blackbox/test_info.py 2011-11-07 10:50:28 +0000
31@@ -1376,3 +1376,30 @@
32 0 versioned subdirectories
33 """, out)
34 self.assertEqual("", err)
35+
36+ def test_info_shows_colocated_branches(self):
37+ bzrdir = self.make_branch('.', format='development-colo').bzrdir
38+ bzrdir.create_branch(name="colo1")
39+ bzrdir.create_branch(name="colo2")
40+ bzrdir.create_branch(name="colo3")
41+ out, err = self.run_bzr('info -v .')
42+ self.assertEqualDiff(
43+"""Standalone branch (format: development-colo)
44+Location:
45+ branch root: .
46+
47+Format:
48+ control: Meta directory format 1 with support for colocated branches
49+ branch: Branch format 7
50+ repository: Repository format 2a - rich roots, group compression and chk inventories
51+
52+Control directory:
53+ 4 branches
54+
55+Branch history:
56+ 0 revisions
57+
58+Repository:
59+ 0 revisions
60+""", out)
61+ self.assertEqual("", err)
62
63=== modified file 'doc/en/release-notes/bzr-2.5.txt'
64--- doc/en/release-notes/bzr-2.5.txt 2011-11-01 23:06:12 +0000
65+++ doc/en/release-notes/bzr-2.5.txt 2011-11-07 10:50:28 +0000
66@@ -31,6 +31,10 @@
67 .. Improvements to existing commands, especially improved performance
68 or memory usage, or better results.
69
70+* ``bzr info -v`` now shows the number of colocated branches
71+ for control directories that support them.
72+ (Jelmer Vernooij, #863285)
73+
74 * ``bzr version-info`` now takes a ``--revision`` argument.
75 (Jelmer Vernooij, #238705)
76