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
=== modified file 'bzrlib/info.py'
--- bzrlib/info.py 2011-10-11 12:01:51 +0000
+++ bzrlib/info.py 2011-11-07 10:50:28 +0000
@@ -159,6 +159,14 @@
159 outfile.writelines(locs.get_lines())159 outfile.writelines(locs.get_lines())
160160
161161
162def _show_control_dir_info(control, outfile):
163 """Show control dir information."""
164 if control._format.colocated_branches:
165 outfile.write('\n')
166 outfile.write('Control directory:\n')
167 outfile.write(' %d branches\n' % len(control.list_branches()))
168
169
162def _show_format_info(control=None, repository=None, branch=None,170def _show_format_info(control=None, repository=None, branch=None,
163 working=None, outfile=None):171 working=None, outfile=None):
164 """Show known formats for control, working, branch and repository."""172 """Show known formats for control, working, branch and repository."""
@@ -377,6 +385,7 @@
377 return385 return
378 _show_format_info(control, repository, branch, working, outfile)386 _show_format_info(control, repository, branch, working, outfile)
379 _show_locking_info(repository, branch, working, outfile)387 _show_locking_info(repository, branch, working, outfile)
388 _show_control_dir_info(control, outfile)
380 if branch is not None:389 if branch is not None:
381 _show_missing_revisions_branch(branch, outfile)390 _show_missing_revisions_branch(branch, outfile)
382 if working is not None:391 if working is not None:
383392
=== modified file 'bzrlib/tests/blackbox/test_info.py'
--- bzrlib/tests/blackbox/test_info.py 2011-10-14 13:56:45 +0000
+++ bzrlib/tests/blackbox/test_info.py 2011-11-07 10:50:28 +0000
@@ -1376,3 +1376,30 @@
1376 0 versioned subdirectories1376 0 versioned subdirectories
1377""", out)1377""", out)
1378 self.assertEqual("", err)1378 self.assertEqual("", err)
1379
1380 def test_info_shows_colocated_branches(self):
1381 bzrdir = self.make_branch('.', format='development-colo').bzrdir
1382 bzrdir.create_branch(name="colo1")
1383 bzrdir.create_branch(name="colo2")
1384 bzrdir.create_branch(name="colo3")
1385 out, err = self.run_bzr('info -v .')
1386 self.assertEqualDiff(
1387"""Standalone branch (format: development-colo)
1388Location:
1389 branch root: .
1390
1391Format:
1392 control: Meta directory format 1 with support for colocated branches
1393 branch: Branch format 7
1394 repository: Repository format 2a - rich roots, group compression and chk inventories
1395
1396Control directory:
1397 4 branches
1398
1399Branch history:
1400 0 revisions
1401
1402Repository:
1403 0 revisions
1404""", out)
1405 self.assertEqual("", err)
13791406
=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- doc/en/release-notes/bzr-2.5.txt 2011-11-01 23:06:12 +0000
+++ doc/en/release-notes/bzr-2.5.txt 2011-11-07 10:50:28 +0000
@@ -31,6 +31,10 @@
31.. Improvements to existing commands, especially improved performance 31.. Improvements to existing commands, especially improved performance
32 or memory usage, or better results.32 or memory usage, or better results.
3333
34* ``bzr info -v`` now shows the number of colocated branches
35 for control directories that support them.
36 (Jelmer Vernooij, #863285)
37
34* ``bzr version-info`` now takes a ``--revision`` argument.38* ``bzr version-info`` now takes a ``--revision`` argument.
35 (Jelmer Vernooij, #238705)39 (Jelmer Vernooij, #238705)
3640