# HG changeset patch # User Steve Losh # Date 1255057406 14400 # Node ID 9df20fad65148a77e7a1334de6bbd7760c556d07 # Parent 21e11e7dfca56d31e6d5f4426d072cb56e8289f1 Add and reformat strings and documentation. diff -r 21e11e7dfca5 -r 9df20fad6514 review/__init__.py --- a/review/__init__.py Thu Oct 08 18:23:23 2009 -0400 +++ b/review/__init__.py Thu Oct 08 23:03:26 2009 -0400 @@ -1,4 +1,3 @@ -'''A Mercurial extension for code reviewing changesets. -''' +"""A Mercurial extension for code reviewing changesets.""" from extension_ui import * \ No newline at end of file diff -r 21e11e7dfca5 -r 9df20fad6514 review/api.py --- a/review/api.py Thu Oct 08 18:23:23 2009 -0400 +++ b/review/api.py Thu Oct 08 23:03:26 2009 -0400 @@ -1,6 +1,6 @@ from __future__ import with_statement -"""The data structures used by hg-review.""" +"""The API for interacting with code review data.""" import os import messages, templates diff -r 21e11e7dfca5 -r 9df20fad6514 review/extension_ui.py --- a/review/extension_ui.py Thu Oct 08 18:23:23 2009 -0400 +++ b/review/extension_ui.py Thu Oct 08 23:03:26 2009 -0400 @@ -1,4 +1,9 @@ -'''The review extension's UI.''' +"""The review extension's command-line UI. + +This module is imported in __init__.py so that Mercurial will add the +review command to its own UI when you add the extension in ~/.hgrc. + +""" import os import messages @@ -136,8 +141,8 @@ def review(ui, repo, *fnames, **opts): - '''code review a changeset in the current repository - ''' + """code review a changeset in the current repository + """ if opts.pop('init'): return _init_command(ui, repo, **opts) elif opts.pop('comment'): diff -r 21e11e7dfca5 -r 9df20fad6514 review/messages.py --- a/review/messages.py Thu Oct 08 18:23:23 2009 -0400 +++ b/review/messages.py Thu Oct 08 23:03:26 2009 -0400 @@ -1,78 +1,84 @@ -#!/usr/bin/env python +"""Messages used by the command-line UI of hg-review. -INIT_START = '''\ +These are kept in a separate module to avoid repeating them over and over +in the extension_ui module, and to make checking for proper output in the +unit tests much easier. + +""" + +INIT_START = """\ initializing the code review data store and config -''' +""" -INIT_SUCCESS = '''\ +INIT_SUCCESS = """\ the review data has been initialized run "hg commit .hgreview -m'initialize code review'" to record it permanently -''' +""" -INIT_EXISTS_COMMITTED = '''\ +INIT_EXISTS_COMMITTED = """\ the review data was already initialized by someone else -''' +""" -INIT_EXISTS_UNCOMMITTED = '''\ +INIT_EXISTS_UNCOMMITTED = """\ the review data has already been initialized, but is not recorded! run "hg commit .hgreview -m'initialize code review'" to record it permanently -''' +""" -COMMENT_REQUIRES_MESSAGE = '''\ +COMMENT_REQUIRES_MESSAGE = """\ a message must be provided to add a comment! -''' +""" -COMMENT_FILE_DOES_NOT_EXIST = '''\ +COMMENT_FILE_DOES_NOT_EXIST = """\ file %s was not changed in revision %s! -''' +""" -COMMENT_LINES_REQUIRE_FILE = '''\ +COMMENT_LINES_REQUIRE_FILE = """\ you must give a filename to comment on specific lines! -''' +""" -SIGNOFF_REQUIRES_MESSAGE = '''\ +SIGNOFF_REQUIRES_MESSAGE = """\ a message must be provided to sign off! -''' +""" -SIGNOFF_OPINION_CONFLICT = '''\ +SIGNOFF_OPINION_CONFLICT = """\ cannot sign off as both --yes and --no! -''' +""" -SIGNOFF_EXISTS = '''\ +SIGNOFF_EXISTS = """\ you have already signed off on this changeset (use --force to overwrite)! -''' +""" -REVIEW_LOG_CSET = '''\ +REVIEW_LOG_CSET = """\ changeset: %d:%s -''' +""" -REVIEW_LOG_AUTHOR = '''\ +REVIEW_LOG_AUTHOR = """\ author: %s -''' +""" -REVIEW_LOG_SUMMARY = '''\ +REVIEW_LOG_SUMMARY = """\ summary: %s -''' +""" -REVIEW_LOG_SIGNOFFS = '''\ +REVIEW_LOG_SIGNOFFS = """\ signoffs: %d signoffs (%d yes, %d no, %d neutral) -''' +""" -REVIEW_LOG_COMMENTS = '''\ +REVIEW_LOG_COMMENTS = """\ comments: %d comments from %d authors -''' +""" -REVIEW_LOG_FILE_HEADER = '''changes in %s''' +REVIEW_LOG_FILE_HEADER = """changes in %s""" -REVIEW_LOG_COMMENT_AUTHOR = '''\ +REVIEW_LOG_COMMENT_AUTHOR = """\ # %s said: -''' +""" -REVIEW_LOG_COMMENT_LINE = '''\ +REVIEW_LOG_COMMENT_LINE = """\ # %s -''' +""" -COMMIT_COMMENT = '''Add a comment on changeset %s''' -COMMIT_SIGNOFF = '''Sign off on changeset %s''' -DELETE_SIGNOFF = '''Remove sign off on changeset %s''' \ No newline at end of file +COMMIT_COMMENT = """Add a comment on changeset %s""" +COMMIT_SIGNOFF = """Sign off on changeset %s""" +DELETE_SIGNOFF = """Remove sign off on changeset %s""" \ No newline at end of file diff -r 21e11e7dfca5 -r 9df20fad6514 review/templates.py --- a/review/templates.py Thu Oct 08 18:23:23 2009 -0400 +++ b/review/templates.py Thu Oct 08 23:03:26 2009 -0400 @@ -1,16 +1,18 @@ -COMMENT_FILE_TEMPLATE = '''\ +"""Templates for hg-review's data files.""" + +COMMENT_FILE_TEMPLATE = """\ author:%s datetime:%s node:%s filename:%s lines:%s -%s''' +%s""" -SIGNOFF_FILE_TEMPLATE = '''\ +SIGNOFF_FILE_TEMPLATE = """\ author:%s datetime:%s node:%s opinion:%s -%s''' \ No newline at end of file +%s""" \ No newline at end of file diff -r 21e11e7dfca5 -r 9df20fad6514 review/tests/__init__.py --- a/review/tests/__init__.py Thu Oct 08 18:23:23 2009 -0400 +++ b/review/tests/__init__.py Thu Oct 08 23:03:26 2009 -0400 @@ -0,0 +1,8 @@ +"""Unit tests for hg-review. + +The tests require nose: pip install nose && nosetests --with-doctest -v + +These tests will test the command line interface and therefor the API +behind it. + +""" \ No newline at end of file diff -r 21e11e7dfca5 -r 9df20fad6514 review/tests/util.py --- a/review/tests/util.py Thu Oct 08 18:23:23 2009 -0400 +++ b/review/tests/util.py Thu Oct 08 23:03:26 2009 -0400 @@ -1,3 +1,5 @@ +"""Utilities for writing unit tests for hg-review.""" + import os, shutil import sample_data from mercurial import commands, hg, ui