ab4cc556087d

Add signoff type counts to review output.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 06 Oct 2009 19:45:29 -0400
parents 34caeeba9ae2
children 06d5f75cfb55
branches/tags (none)
files review/extension_ui.py review/messages.py review/tests/test_signoff.py

Changes

--- a/review/extension_ui.py	Tue Oct 06 19:27:47 2009 -0400
+++ b/review/extension_ui.py	Tue Oct 06 19:45:29 2009 -0400
@@ -78,7 +78,16 @@
     ui.write(messages.REVIEW_LOG_AUTHOR % cset.user())
     ui.write(messages.REVIEW_LOG_SUMMARY % cset.description().split('\n')[0])
     
-    ui.write(messages.REVIEW_LOG_SIGNOFFS % len(rcset.signoffs))
+    signoffs = rcset.signoffs
+    signoffs_yes = filter(lambda s: s.opinion == 'yes', signoffs)
+    signoffs_no = filter(lambda s: s.opinion == 'no', signoffs)
+    signoffs_neutral = filter(
+        lambda s: s not in signoffs_yes and s not in signoffs_no, signoffs
+    )
+    
+    ui.write(messages.REVIEW_LOG_SIGNOFFS % (
+        len(signoffs), len(signoffs_yes), len(signoffs_no), len(signoffs_neutral))
+    )
     ui.write(messages.REVIEW_LOG_COMMENTS % (comment_count, author_count))
     
     def _print_comment(comment, before='', after=''):
--- a/review/messages.py	Tue Oct 06 19:27:47 2009 -0400
+++ b/review/messages.py	Tue Oct 06 19:45:29 2009 -0400
@@ -56,7 +56,7 @@
 '''
 
 REVIEW_LOG_SIGNOFFS = '''\
-signoffs:  %d signoffs
+signoffs:  %d signoffs (%d yes, %d no, %d neutral)
 '''
 
 REVIEW_LOG_COMMENTS = '''\
--- a/review/tests/test_signoff.py	Tue Oct 06 19:27:47 2009 -0400
+++ b/review/tests/test_signoff.py	Tue Oct 06 19:45:29 2009 -0400
@@ -7,11 +7,11 @@
 
 
 @with_setup(setup_reviewed_sandbox, teardown_sandbox)
-def test_no_comments():
+def test_no_signoffs():
     sandbox = get_sandbox_repo()
     
     output = review()
-    assert messages.REVIEW_LOG_SIGNOFFS % 0 in output
+    assert messages.REVIEW_LOG_SIGNOFFS % (0, 0, 0, 0) in output
 
 
 @with_setup(setup_reviewed_sandbox, teardown_sandbox)
@@ -34,7 +34,7 @@
     review(signoff=True, message='Test signoff one.')
     
     output = review()
-    assert messages.REVIEW_LOG_SIGNOFFS % 1 in output
+    assert messages.REVIEW_LOG_SIGNOFFS % (1, 0, 0, 1) in output
 
 
 @with_setup(setup_reviewed_sandbox, teardown_sandbox)
@@ -44,10 +44,10 @@
     review(signoff=True, message='Test signoff one.', rev='0')
     
     output = review(rev='0')
-    assert messages.REVIEW_LOG_SIGNOFFS % 1 in output
+    assert messages.REVIEW_LOG_SIGNOFFS % (1, 0, 0, 1) in output
     
     output = review()
-    assert messages.REVIEW_LOG_SIGNOFFS % 0 in output
+    assert messages.REVIEW_LOG_SIGNOFFS % (0, 0, 0, 0) in output
 
 
 @with_setup(setup_reviewed_sandbox, teardown_sandbox)
@@ -67,5 +67,25 @@
     review(signoff=True, message='Test signoff two.', force=True)
     
     output = review()
-    assert messages.REVIEW_LOG_SIGNOFFS % 1 in output
+    assert messages.REVIEW_LOG_SIGNOFFS % (1, 0, 0, 1) in output
+
 
+@with_setup(setup_reviewed_sandbox, teardown_sandbox)
+def test_signoff_yes():
+    sandbox = get_sandbox_repo()
+    
+    review(signoff=True, yes=True, message='Test signoff one.')
+    
+    output = review()
+    assert messages.REVIEW_LOG_SIGNOFFS % (1, 1, 0, 0) in output
+
+
+@with_setup(setup_reviewed_sandbox, teardown_sandbox)
+def test_signoff_no():
+    sandbox = get_sandbox_repo()
+    
+    review(signoff=True, no=True, message='Test signoff one.')
+    
+    output = review()
+    assert messages.REVIEW_LOG_SIGNOFFS % (1, 0, 1, 0) in output
+