hg-review/cli.html @ afcd0648bf7f

d: Update site.
author Steve Losh <steve@stevelosh.com>
date Tue, 31 Jan 2012 13:42:59 -0500
parents 4ab3f1cb454a
children (none)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Command Line Interface &mdash; hg-review vpre-alpha documentation</title>
    <link rel="stylesheet" href="_static/review.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     'pre-alpha',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="hg-review vpre-alpha documentation" href="index.html" />
    <link rel="next" title="API" href="api.html" />
    <link rel="prev" title="Web Interface" href="webui.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="api.html" title="API"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="webui.html" title="Web Interface"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">hg-review vpre-alpha documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="command-line-interface">
<h1>Command Line Interface<a class="headerlink" href="#command-line-interface" title="Permalink to this headline">¶</a></h1>
<p>hg-review provides a command line interface. Except for initializing the review
data, starting the web ui, and possibly some scripting, you&#8217;ll probably want to
use the <a class="reference external" href="webui.html"><em>web interface</em></a> for most tasks.</p>
<p>When you enable the hg-review extension Mercurial will gain a new command:
<tt class="docutils literal"><span class="pre">review</span></tt>. This command on its own will display review data for a changeset,
but it also has several subcommands detailed below.</p>
<p>You can always get help on a given topic right from the command line with
<tt class="docutils literal"><span class="pre">hg</span> <span class="pre">help</span> <span class="pre">review</span></tt> or <tt class="docutils literal"><span class="pre">hg</span> <span class="pre">help</span> <span class="pre">review-topic</span></tt>.</p>
<div class="section" id="review">
<span id="c-review"></span><h2><tt class="docutils literal"><span class="pre">review</span></tt><a class="headerlink" href="#review" title="Permalink to this headline">¶</a></h2>
<p>View code review data for a changeset. Usage:</p>
<div class="highlight-python"><pre>hg review [-r REV] [-U CONTEXT] [--quiet] [FILE]</pre>
</div>
<p>Diffs of all changed files will be shown with comments inline.</p>
<p>The line numbers printed are the ones that should be used to add line-level
comments.</p>
<p>Options:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">--unified</span> <span class="pre">VALUE</span></tt></dt>
<dd>The number of lines of context to show for diffs in this changeset
(default: <tt class="docutils literal"><span class="pre">5</span></tt>).</dd>
<dt><tt class="docutils literal"><span class="pre">--rev</span> <span class="pre">VALUE</span></tt></dt>
<dd>The revision to show (default: <tt class="docutils literal"><span class="pre">.</span></tt>).</dd>
<dt><tt class="docutils literal"><span class="pre">--quiet</span></tt></dt>
<dd>Do not show diffs &#8211; only show review-level comments and signoffs (default:
<tt class="docutils literal"><span class="pre">false</span></tt>).</dd>
<dt><tt class="docutils literal"><span class="pre">--verbose</span></tt></dt>
<dd>Show the short identifier of each comment and signoff, mainly for use with
the <a class="reference internal" href="#c-edit"><em>edit</em></a> subcommand (default: <tt class="docutils literal"><span class="pre">false</span></tt>).</dd>
<dt><tt class="docutils literal"><span class="pre">--debug</span></tt></dt>
<dd>Show the full identifier of each comment and signoff, mainly for use with
the <a class="reference internal" href="#c-edit"><em>edit</em></a> subcommand (default: <tt class="docutils literal"><span class="pre">false</span></tt>).</dd>
</dl>
</div>
<div class="section" id="init">
<span id="c-init"></span><h2><tt class="docutils literal"><span class="pre">--init</span></tt><a class="headerlink" href="#init" title="Permalink to this headline">¶</a></h2>
<p>Initialize code review for a repository. Usage:</p>
<div class="highlight-python"><pre>hg review --init --remote-path PATH</pre>
</div>
<p>When run for the first time in a project, it will do two things:</p>
<ul class="simple">
<li>Create a new repository to hold the review data at <tt class="docutils literal"><span class="pre">.hg/review/</span></tt>.</li>
<li>Create and <tt class="docutils literal"><span class="pre">hg</span> <span class="pre">add</span></tt> a <tt class="docutils literal"><span class="pre">.hgreview</span></tt> file in the current repository. You
will need to commit this file yourself with: <tt class="docutils literal"><span class="pre">hg</span> <span class="pre">commmit</span> <span class="pre">.hgreview</span> <span class="pre">-m</span>
<span class="pre">'initialize</span> <span class="pre">code</span> <span class="pre">review</span> <span class="pre">data'</span></tt></li>
</ul>
<p>The <tt class="docutils literal"><span class="pre">--remote-path</span></tt> option is required and specifies the path where the
canonical code review data for this project will live.  This is the path that
will be cloned when someone else runs <tt class="docutils literal"><span class="pre">hg</span> <span class="pre">review</span> <span class="pre">--init</span></tt> on the project.</p>
<p>Options:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">--remote-path</span> <span class="pre">VALUE</span></tt></dt>
<dd>The URL to the public code review data repository.</dd>
</dl>
</div>
<div class="section" id="comment">
<span id="c-comment"></span><h2><tt class="docutils literal"><span class="pre">--comment</span></tt><a class="headerlink" href="#comment" title="Permalink to this headline">¶</a></h2>
<p>Add a code review comment for a changeset. Usage:</p>
<div class="highlight-python"><pre>hg review --comment [-m MESSAGE] [--mdown] [-r REV] [-l LINES] [FILE]</pre>
</div>
<p>If no files are given the comment will be attached to the changeset as a whole.</p>
<p>If one or more files are given but no lines are given, the comment will be
attached to each file as a whole.</p>
<p>If a file is given and lines are given the comment will be attached to those
specific lines. Lines should be specified as a comma-separated list of line
numbers (as numbered in the output of &#8220;hg review&#8221;), such as <tt class="docutils literal"><span class="pre">3</span></tt> or <tt class="docutils literal"><span class="pre">2,3</span></tt>.</p>
<p>Options:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">--rev</span> <span class="pre">VALUE</span></tt></dt>
<dd>The revision to add a comment to (default: <tt class="docutils literal"><span class="pre">.</span></tt>).</dd>
<dt><tt class="docutils literal"><span class="pre">--lines</span> <span class="pre">VALUE</span></tt></dt>
<dd>Comment on the given lines (specified as a comma-separated list of line
numbers) of the file (default: <tt class="xref docutils literal"><span class="pre">None</span></tt>).</dd>
<dt><tt class="docutils literal"><span class="pre">--message</span> <span class="pre">VALUE</span></tt></dt>
<dd>Use <tt class="docutils literal"><span class="pre">VALUE</span></tt> as the comment instead of opening an editor (default:
<tt class="xref docutils literal"><span class="pre">None</span></tt> (i.e. &#8220;open an editor&#8221;)).</dd>
<dt><tt class="docutils literal"><span class="pre">--mdown</span></tt></dt>
<dd>Use Markdown to format the comment (default: <tt class="xref docutils literal"><span class="pre">False</span></tt>).</dd>
</dl>
</div>
<div class="section" id="signoff">
<span id="c-signoff"></span><h2><tt class="docutils literal"><span class="pre">--signoff</span></tt><a class="headerlink" href="#signoff" title="Permalink to this headline">¶</a></h2>
<p>Add a code review signoff for a changeset. Usage:</p>
<div class="highlight-python"><pre>hg review --signoff [-m MESSAGE] [--mdown] [--yes | --no] [-r REV]</pre>
</div>
<p>The <tt class="docutils literal"><span class="pre">--yes</span></tt> and <tt class="docutils literal"><span class="pre">--no</span></tt> options can be used to indicate whether you think the
changeset is &#8220;good&#8221; or &#8220;bad&#8221;.</p>
<p>It&#8217;s up to the collaborators of each individual project to decide exactly what
that means.  If neither option is given the signoff will be marked as
&#8220;neutral&#8221;.</p>
<p>Options:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">--rev</span> <span class="pre">VALUE</span></tt></dt>
<dd>The revision to sign off on (default: <tt class="docutils literal"><span class="pre">.</span></tt>).</dd>
<dt><tt class="docutils literal"><span class="pre">--yes</span></tt></dt>
<dd>Sign off as &#8220;yes&#8221; for the changeset (default: <tt class="xref docutils literal"><span class="pre">False</span></tt> (i.e. &#8220;neutral&#8221;)).</dd>
<dt><tt class="docutils literal"><span class="pre">--no</span></tt></dt>
<dd>Sign off as &#8220;no&#8221; for the changeset (default: <tt class="xref docutils literal"><span class="pre">False</span></tt> (i.e. &#8220;neutral&#8221;)).</dd>
<dt><tt class="docutils literal"><span class="pre">--message</span> <span class="pre">VALUE</span></tt></dt>
<dd>Use <tt class="docutils literal"><span class="pre">VALUE</span></tt> as the signoff message instead of opening an editor (default:
<tt class="xref docutils literal"><span class="pre">None</span></tt> (i.e. &#8220;open an editor&#8221;)).</dd>
<dt><tt class="docutils literal"><span class="pre">--mdown</span></tt></dt>
<dd>Use Markdown to format the signoff message (default: <tt class="xref docutils literal"><span class="pre">False</span></tt>).</dd>
</dl>
</div>
<div class="section" id="edit">
<span id="c-edit"></span><h2><tt class="docutils literal"><span class="pre">--edit</span></tt><a class="headerlink" href="#edit" title="Permalink to this headline">¶</a></h2>
<p>Edit a comment or signoff. Usage:</p>
<div class="highlight-python"><pre>hg review --edit IDENTIFIER [--yes | --no] [-m MESSAGE] [-l LINES] [--mdown] [FILE]</pre>
</div>
<p>Edit the comment or changeset with the given identifier.</p>
<p>You can find the identifier of the item you would like to edit by running <tt class="docutils literal"><span class="pre">hg</span>
<span class="pre">review</span> <span class="pre">--verbose</span></tt> to display identifiers.</p>
<p>Any other options given (such as <tt class="docutils literal"><span class="pre">--message</span></tt>, <tt class="docutils literal"><span class="pre">--yes</span></tt> or filenames) will
replace the content of the item you edit.</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">--message</span> <span class="pre">VALUE</span></tt></dt>
<dd>Replace the comment or signoff message with VALUE (default: <tt class="xref docutils literal"><span class="pre">None</span></tt> (i.e.
&#8220;open an editor&#8221;)).</dd>
<dt><tt class="docutils literal"><span class="pre">--mdown</span></tt></dt>
<dd>Use Markdown to format the comment or signoff message (default: <tt class="xref docutils literal"><span class="pre">False</span></tt>
(i.e. &#8220;Use the same formatting the item already has)).</dd>
<dt><tt class="docutils literal"><span class="pre">--lines</span></tt></dt>
<dd>The line(s) of the file to comment on (default: <tt class="xref docutils literal"><span class="pre">None</span></tt> (i.e. &#8220;use the
same line the comment already has)). Returns an error if you&#8217;re editing
a signoff or a review-level comment.</dd>
<dt><tt class="docutils literal"><span class="pre">--yes</span></tt></dt>
<dd>Change the signoff to state the the changeset is &#8220;good&#8221; (default:
<tt class="xref docutils literal"><span class="pre">False</span></tt>). Returns an error if you are not editing a signoff.</dd>
<dt><tt class="docutils literal"><span class="pre">--no</span></tt></dt>
<dd>Change the signoff to state the the changeset is &#8220;bad&#8221; (default:
<tt class="xref docutils literal"><span class="pre">False</span></tt>). Returns an error if you are not editing a signoff.</dd>
</dl>
</div>
<div class="section" id="check">
<span id="c-check"></span><h2><tt class="docutils literal"><span class="pre">--check</span></tt><a class="headerlink" href="#check" title="Permalink to this headline">¶</a></h2>
<p>Check the review status of a changeset. Usage:</p>
<div class="highlight-python"><pre>hg review --check [-r REV] [--no-nos] [--yeses NUM] [--seen]</pre>
</div>
<p>Check that the given changeset &#8220;passes&#8221; the given tests of review status. If no
tests are given an error is returned.</p>
<p>Tests are checked in the following order:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">--no-nos</span></tt></li>
<li><tt class="docutils literal"><span class="pre">--yeses</span></tt></li>
<li><tt class="docutils literal"><span class="pre">--seen</span></tt></li>
</ul>
<p>If any tests fail the command returns a status of 1 with a message describing
the failure on stderr, otherwise it returns 0 and prints nothing.</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">--rev</span> <span class="pre">VALUE</span></tt></dt>
<dd>The revision to check (default: <tt class="docutils literal"><span class="pre">.</span></tt>).</dd>
<dt><tt class="docutils literal"><span class="pre">--no-nos</span></tt></dt>
<dd>Ensure this revision does <em>not</em> have any signoffs of &#8220;no&#8221; (default:
<tt class="xref docutils literal"><span class="pre">False</span></tt> (i.e. &#8220;Don&#8217;t perform this check&#8221;)).</dd>
<dt><tt class="docutils literal"><span class="pre">--yeses</span> <span class="pre">VALUE</span></tt></dt>
<dd>Ensure this revision has at least <tt class="docutils literal"><span class="pre">VALUE</span></tt> signoffs of &#8220;yes&#8221; (default:
<tt class="xref docutils literal"><span class="pre">None</span></tt> (i.e. &#8220;Don&#8217;t perform this check&#8221;).</dd>
<dt><tt class="docutils literal"><span class="pre">--seen</span></tt></dt>
<dd>Ensure this revision has at least one comment or signoff (default:
<tt class="xref docutils literal"><span class="pre">False</span></tt> (i.e. &#8220;Don&#8217;t perform this check&#8221;)).</dd>
</dl>
</div>
<div class="section" id="web">
<span id="c-web"></span><h2><tt class="docutils literal"><span class="pre">--web</span></tt><a class="headerlink" href="#web" title="Permalink to this headline">¶</a></h2>
<p>Start the web interface. Usage:</p>
<div class="highlight-python"><pre>hg review --web [--read-only] [--allow-anon] [--address ADDRESS] [--port PORT]</pre>
</div>
<p>Visit <a class="reference external" href="http://localhost:8080/">http://localhost:8080/</a> (replace the port number if you specified
a different port) in a modern browser of your choice to use the web interface.</p>
<p>Use <tt class="docutils literal"><span class="pre">Ctrl+C</span></tt> to stop the interface.</p>
<p>Options:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">--read-only</span></tt></dt>
<dd>Make the web interface read-only; disallowing comments, signoffs, pushes
and pulls (default: <tt class="xref docutils literal"><span class="pre">False</span></tt>).</dd>
<dt><tt class="docutils literal"><span class="pre">--allow-anon</span></tt></dt>
<dd>Allow anonymous comments on the web interface and set the username for
comments to an anonymous username (default: <tt class="xref docutils literal"><span class="pre">False</span></tt> (i.e. allow comments
and use your Mercurial username)).</dd>
<dt><tt class="docutils literal"><span class="pre">--address</span> <span class="pre">VALUE</span></tt></dt>
<dd>Run the web interface on the specified address (default: <tt class="docutils literal"><span class="pre">127.0.0.1</span></tt>).</dd>
<dt><tt class="docutils literal"><span class="pre">--port</span> <span class="pre">VALUE</span></tt></dt>
<dd>Run the web interface on the specified port (default: <tt class="docutils literal"><span class="pre">8080</span></tt>).</dd>
</dl>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="index.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="#">Command Line Interface</a><ul>
<li><a class="reference external" href="#review"><tt class="docutils literal"><span class="pre">review</span></tt></a></li>
<li><a class="reference external" href="#init"><tt class="docutils literal"><span class="pre">--init</span></tt></a></li>
<li><a class="reference external" href="#comment"><tt class="docutils literal"><span class="pre">--comment</span></tt></a></li>
<li><a class="reference external" href="#signoff"><tt class="docutils literal"><span class="pre">--signoff</span></tt></a></li>
<li><a class="reference external" href="#edit"><tt class="docutils literal"><span class="pre">--edit</span></tt></a></li>
<li><a class="reference external" href="#check"><tt class="docutils literal"><span class="pre">--check</span></tt></a></li>
<li><a class="reference external" href="#web"><tt class="docutils literal"><span class="pre">--web</span></tt></a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="webui.html"
                                  title="previous chapter">Web Interface</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="api.html"
                                  title="next chapter">API</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="_sources/cli.txt"
                     rel="nofollow">Show Source</a></li>
            </ul>
          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
              <p class="searchtip" style="font-size: 90%">
              Enter search terms or a module, class or function name.
              </p>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="api.html" title="API"
             >next</a> |</li>
        <li class="right" >
          <a href="webui.html" title="Web Interface"
             >previous</a> |</li>
        <li><a href="index.html">hg-review vpre-alpha documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; Copyright 2010, Steve Losh and contributors.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.7.
    </div>
  </body>
</html>