Rev 6477: (jelmer) Fix 'bzr info -v' for a control directory without a repository. in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/2.5/

Patch Queue Manager pqm at pqm.ubuntu.com
Tue Feb 21 10:14:00 UTC 2012


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/2.5/

------------------------------------------------------------
revno: 6477 [merge]
revision-id: pqm at pqm.ubuntu.com-20120221101358-9cdw1ica619x0n62
parent: pqm at pqm.ubuntu.com-20120220120245-bvo53gwgx3n9lmw0
parent: jelmer at samba.org-20120220134232-hqcu4hi2vozi4mfl
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.5
timestamp: Tue 2012-02-21 10:13:58 +0000
message:
  (jelmer) Fix 'bzr info -v' for a control directory without a repository.
   (Jelmer Vernooij)
modified:
  bzrlib/info.py                 info.py-20050323235939-6bbfe7d9700b0b9b
  bzrlib/tests/blackbox/test_info.py test_info.py-20060215045507-bbdd2d34efab9e0a
  doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
=== modified file 'bzrlib/info.py'
--- a/bzrlib/info.py	2012-01-18 20:47:13 +0000
+++ b/bzrlib/info.py	2012-02-20 13:38:56 +0000
@@ -200,9 +200,10 @@
             repository._format.get_format_description())
 
 
-def _show_locking_info(repository, branch=None, working=None, outfile=None):
+def _show_locking_info(repository=None, branch=None, working=None,
+        outfile=None):
     """Show locking status of working, branch and repository."""
-    if (repository.get_physical_lock_status() or
+    if (repository and repository.get_physical_lock_status() or
         (branch and branch.get_physical_lock_status()) or
         (working and working.get_physical_lock_status())):
         outfile.write('\n')
@@ -413,11 +414,12 @@
     if branch is not None:
         show_committers = verbose >= 2
         stats = _show_branch_stats(branch, show_committers, outfile)
-    else:
+    elif repository is not None:
         stats = repository.gather_stats()
-    if branch is None and working is None:
+    if branch is None and working is None and repository is not None:
         _show_repository_info(repository, outfile)
-    _show_repository_stats(repository, stats, outfile)
+    if repository is not None:
+        _show_repository_stats(repository, stats, outfile)
 
 
 def describe_layout(repository=None, branch=None, tree=None, control=None):

=== modified file 'bzrlib/tests/blackbox/test_info.py'
--- a/bzrlib/tests/blackbox/test_info.py	2012-01-26 15:36:39 +0000
+++ b/bzrlib/tests/blackbox/test_info.py	2012-02-20 13:42:32 +0000
@@ -57,6 +57,19 @@
             '  control directory: ctrl\n')
         self.assertEquals(err, '')
 
+    def test_info_empty_controldir_verbose(self):
+        self.make_bzrdir('ctrl')
+        out, err = self.run_bzr('info -v ctrl')
+        self.assertEqualDiff(out,
+            'Empty control directory (format: 2a or pack-0.92)\n'
+            'Location:\n'
+            '  control directory: ctrl\n\n'
+            'Format:\n'
+            '       control: Meta directory format 1\n\n'
+            'Control directory:\n'
+            '         0 branches\n')
+        self.assertEquals(err, '')
+
     def test_info_dangling_branch_reference(self):
         br = self.make_branch('target')
         br.create_checkout('from', lightweight=True)

=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt	2012-02-16 18:01:57 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2012-02-20 13:30:09 +0000
@@ -36,6 +36,9 @@
 .. Fixes for situations where bzr would previously crash or give incorrect
    or undesirable results.
 
+* Show locks in ``bzr info`` on control directories without a
+  repository. (Jelmer Vernooij, #936767)
+
 * Disable ssl certificate verification on osx and windows until a native
   access to the the root certificates is provided there.
   (Vincent Ladeuil, #929179)




More information about the bazaar-commits mailing list