# HG changeset patch # User Steve Losh # Date 1254872729 14400 # Node ID ab4cc556087dc944a839fe08b0b32f14f3c05e63 # Parent 34caeeba9ae2c0bbb8e5cb4d69e7a9ce1a2c40cc Add signoff type counts to review output. diff -r 34caeeba9ae2 -r ab4cc556087d review/extension_ui.py --- 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=''): diff -r 34caeeba9ae2 -r ab4cc556087d review/messages.py --- 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 = '''\ diff -r 34caeeba9ae2 -r ab4cc556087d review/tests/test_signoff.py --- 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 +