[Pkg-bazaar-commits] ./bzr/unstable r21: - bzr info: show summary information on branch history

mbp at sourcefrog.net mbp at sourcefrog.net
Fri Apr 10 07:25:16 UTC 2009


------------------------------------------------------------
revno: 21
committer: mbp at sourcefrog.net
timestamp: Fri 2005-03-11 17:36:25 +1100
message:
  - bzr info: show summary information on branch history
  - nicer plurals
modified:
  bzr.py
-------------- next part --------------
=== modified file 'bzr.py'
--- a/bzr.py	2005-03-11 06:22:16 +0000
+++ b/bzr.py	2005-03-11 06:36:25 +0000
@@ -194,7 +194,14 @@
 def cmd_info():
     b = Branch('.')
     print 'branch format:', b.controlfile('branch-format', 'r').readline().rstrip('\n')
-    print 'revision number:', b.revno()
+
+    def plural(n, base='', pl=None):
+        if n == 1:
+            return base
+        elif pl is not None:
+            return pl
+        else:
+            return 's'
 
     count_version_dirs = 0
 
@@ -212,8 +219,23 @@
                      ('renamed', 'R'), ('unknown', '?'), ('ignored', 'I'),
                      ):
         print '  %5d %s' % (count_status[fs], name)
-    print '  %5d versioned subdirectories' % count_version_dirs
-            
+    print '  %5d versioned subdirector%s' % (count_version_dirs,
+                                             plural(count_version_dirs, 'y', 'ies'))
+
+    print
+    print 'branch history:'
+    history = b.revision_history()
+    revno = len(history)
+    print '  %5d revision%s' % (revno, plural(revno))
+    committers = Set()
+    for rev in history:
+        committers.add(b.get_revision(rev).committer)
+    print '  %5d committer%s' % (len(committers), plural(len(committers)))
+    if revno > 0:
+        firstrev = b.get_revision(history[0])
+        age = int((time.time() - firstrev.timestamp) / 3600 / 24)
+        print '  %5d day%s old' % (age, plural(age))
+    
 
 
 def cmd_remove(file_list, verbose=False):



More information about the Pkg-bazaar-commits mailing list