1596046f752c

Add the author count to the review command.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sun, 04 Oct 2009 18:57:18 -0400
parents cdd63ba4a8f8
children e92ab6fb652e
branches/tags (none)
files review/api.py review/extension_ui.py review/tests/util.py

Changes

--- a/review/api.py	Sun Oct 04 18:45:19 2009 -0400
+++ b/review/api.py	Sun Oct 04 18:57:18 2009 -0400
@@ -127,8 +127,6 @@
             ]
             self.signoffs = [ _parse_signoff_data(self.repo['tip'][fn].data())
                               for fn in signofffns ]
-            
-            print self.comments, self.signoffs
         else:
             self.comments = []
             self.signoffs = []
--- a/review/extension_ui.py	Sun Oct 04 18:45:19 2009 -0400
+++ b/review/extension_ui.py	Sun Oct 04 18:57:18 2009 -0400
@@ -33,7 +33,15 @@
     # No other options matched, so we're at the basic review command.
     rev = opts.pop('rev')
     rd = ReviewDatastore(ui, repo)
-    rc = rd[rev]
+    cset = repo[rev]
+    rcset = rd[rev]
+    
+    author_count = len(set(comment.author for comment in rcset.comments))
+    
+    ui.write('comments:  %d comments from %d authors\n' % (
+        len(rcset.comments), author_count))
+    ui.write('signoffs:  %d signoffs\n' % len(rcset.signoffs))
+
 
 cmdtable = {
     'review': (review, [
--- a/review/tests/util.py	Sun Oct 04 18:45:19 2009 -0400
+++ b/review/tests/util.py	Sun Oct 04 18:57:18 2009 -0400
@@ -16,7 +16,7 @@
     os.mkdir(sandbox_path)
     os.chdir(sandbox_path)
     
-    commands.init(ui.ui())
+    commands.init(_ui)
     sandbox = get_sandbox_repo()
     
     opts = { 'addremove': True, 'date': None, 'user': 'Review Tester',
@@ -25,7 +25,7 @@
         for filename in state:
             with open(filename, 'w') as f:
                 f.write(state[filename])
-        commands.commit(ui.ui(), sandbox, **opts)
+        commands.commit(_ui, sandbox, **opts)
 
 def teardown_sandbox():
     os.chdir(os.path.realpath(os.path.join(sandbox_path, os.pardir)))