cl-digraph: Update site.
author |
Steve Losh <steve@stevelosh.com> |
date |
Tue, 14 Mar 2017 13:30:36 +0000 |
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>Web Interface — 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="Command Line Interface" href="cli.html" />
<link rel="prev" title="Concepts" href="concepts.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="cli.html" title="Command Line Interface"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="concepts.html" title="Concepts"
accesskey="P">previous</a> |</li>
<li><a href="index.html">hg-review vpre-alpha documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="web-interface">
<h1>Web Interface<a class="headerlink" href="#web-interface" title="Permalink to this headline">¶</a></h1>
<p>The web interface of hg-review is probably what you’re going to use the most.</p>
<div class="section" id="running-locally">
<h2>Running Locally<a class="headerlink" href="#running-locally" title="Permalink to this headline">¶</a></h2>
<p>To start the web interface for a local repository that you want to review you
can run <tt class="docutils literal"><span class="pre">hg</span> <span class="pre">review</span> <span class="pre">--web</span></tt>. Visit <a class="reference external" href="http://localhost:8080/">http://localhost:8080/</a> to use it.</p>
<p>When you add comments or signoffs hg-review will use your normal Mercurial
username as the author.</p>
<p>This command can take a few extra options:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">--address</span> <span class="pre">ADDRESS</span></tt></dt>
<dd><p class="first">The address to bind to. Use <tt class="docutils literal"><span class="pre">0.0.0.0</span></tt> if you want other people to be able
to access it.</p>
<p><strong>Be careful!</strong> Because the web interface uses your Mercurial username by
default, binding to <tt class="docutils literal"><span class="pre">0.0.0.0</span></tt> will let anyone add comments and signoffs
in your name! You’ll probably want to use the <tt class="docutils literal"><span class="pre">--read-only</span></tt> option to
prevent this.</p>
<p class="last">Default: <tt class="docutils literal"><span class="pre">127.0.0.1</span></tt></p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--port</span> <span class="pre">PORT</span></tt></dt>
<dd><p class="first">The port to listen on.</p>
<p class="last">Default: <tt class="docutils literal"><span class="pre">8080</span></tt></p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--read-only</span></tt></dt>
<dd><p class="first">Run the server in read-only mode. This will not allow data to be pushed or
pulled, comments to be made or signoffs to be added.</p>
<p>This can be useful when combined with <tt class="docutils literal"><span class="pre">--address</span></tt> to let other people
view the UI without letting them add comments in your name.</p>
<p class="last">Default: <tt class="docutils literal"><span class="pre">false</span></tt></p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--allow-anon</span></tt></dt>
<dd><p class="first">Allow comments (not not signoffs) to be added even if <tt class="docutils literal"><span class="pre">--read-only</span></tt> is
used, and set the username to <tt class="docutils literal"><span class="pre">Anonymous</span> <span class="pre"><anonymous@example.com></span></tt> instead
of your Mercurial username.</p>
<p>This option is most useful when you’re deploying a permanent web interface
to a server and want to allow anonymous viewers to add comments. See the
<a class="reference internal" href="#deployment"><em>Deployment to a Server</em></a> section for more information.</p>
<p class="last">Default: <tt class="docutils literal"><span class="pre">false</span></tt></p>
</dd>
</dl>
</div>
<div class="section" id="deployment-to-a-server">
<span id="deployment"></span><h2>Deployment to a Server<a class="headerlink" href="#deployment-to-a-server" title="Permalink to this headline">¶</a></h2>
<p>Although hg-review is built for <em>distributed</em> code review it’s sometimes nice
to provide a public interface. This will let people can comment easily without
using the extension (or even cloning your project).</p>
<div class="section" id="initial-deployment">
<h3>Initial Deployment<a class="headerlink" href="#initial-deployment" title="Permalink to this headline">¶</a></h3>
<p>You can use any WSGI server you like to provide a public instance of hg-review.
Before you start you’ll need to have Mercurial installed on your web server.</p>
<p>Once you’ve got Mercurial running on the server you’ll need to clone copies of
hg-review, your project, and your project’s review data to the web server.
First create a directory where everything will live:</p>
<div class="highlight-python"><pre>mkdir /var/www/myproject-review-interface/
cd /var/www/myproject-review-interface/</pre>
</div>
<p>Then grab a copy of hg-review:</p>
<div class="highlight-python"><pre>hg clone http://bitbucket.org/sjl/hg-review/</pre>
</div>
<p>Grab a copy of your project and configure it to use the hg-review extension as
well as the built-in <a class="reference external" href="http://mercurial.selenic.com/wiki/FetchExtension">fetch</a> extension (to
automatically merge updates):</p>
<div class="highlight-python"><pre>hg clone -U http://bitbucket.org/you/yourproject/
cd yourproject
echo '[extensions]' >> .hg/hgrc
echo 'review = /var/www/myproject-review-interface/hg-review/review' >> .hg/hgrc
echo 'fetch = ' >> .hg/hgrc</pre>
</div>
<p>Use hg-review to pull down the review data:</p>
<div class="highlight-python"><pre>hg review --init</pre>
</div>
<p>Now that you’ve got all the necessary data you can set up the WSGI script.
Start by copying the included sample script:</p>
<div class="highlight-python"><pre>cd /var/www/myproject-review-interface/
cp hg-review/contrib/deploy/wsgi.py wsgi.py</pre>
</div>
<p>Edit the script to configure your project to your liking. For reference, the
relevant part of the script should look something like this:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c"># An example WSGI script for serving hg-review's web UI.</span>
<span class="c"># Edit as necessary.</span>
<span class="c"># If hg-review is not on your webserver's PYTHONPATH, uncomment the lines</span>
<span class="c"># below and point it at the hg-review directory.</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">insert</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="s">"/var/www/myproject-review-interface/hg-review"</span><span class="p">)</span>
<span class="n">REPO</span> <span class="o">=</span> <span class="s">'/var/www/myproject-review-interface/myproject'</span>
<span class="n">READ_ONLY</span> <span class="o">=</span> <span class="bp">True</span>
<span class="n">ALLOW_ANON_COMMENTS</span> <span class="o">=</span> <span class="bp">False</span>
<span class="n">ANON_USER</span> <span class="o">=</span> <span class="s">'Anonymous <anonymous@example.com>'</span>
<span class="n">SITE_ROOT</span> <span class="o">=</span> <span class="s">'http://yoursite.com/optional/path'</span>
<span class="n">TITLE</span> <span class="o">=</span> <span class="s">'Your Project'</span>
<span class="n">PROJECT_URL</span> <span class="o">=</span> <span class="s">'http://bitbucket.org/your/project/'</span> <span class="c"># or None</span>
</pre></div>
</div>
<p>All that’s left is to point your WSGI server at this script and fire it up. How
you do that depends on your WSGI server. A sample configuration file for
<a class="reference external" href="http://gunicorn.org/">Gunicorn</a> is provided in
<tt class="docutils literal"><span class="pre">contrib/deploy/gunicorn.conf.py</span></tt>.</p>
</div>
<div class="section" id="updating-the-data">
<h3>Updating the Data<a class="headerlink" href="#updating-the-data" title="Permalink to this headline">¶</a></h3>
<p>You’ll want to keep the review data for this interface current so users can see
all the latest comments and signoffs.</p>
<p>To do this you simply need to pull in the main repository (to receive new
changesets in your project) and fetch in the review data repository (to receive
new comments and signoffs):</p>
<div class="highlight-python"><pre>hg -R /var/www/myproject-review-interface/ pull
hg -R /var/www/myproject-review-interface/.hg/review fetch</pre>
</div>
<p>New comments and signoffs will be visible immediately – you don’t need to
restart your WSGI server.</p>
<p>You’ll probably want to set this up as a cron job or use a hook of some kind
to automate the updates.</p>
<p>If you allow anonymous comments and want people that are using the extension
locally (instead of this public instance) to see these comments, you’ll need to
<em>fetch and push</em> the review data repo as well:</p>
<div class="highlight-python"><pre>hg -R /var/www/myproject-review-interface/.hg/review/ fetch
hg -R /var/www/myproject-review-interface/.hg/review/ push</pre>
</div>
<p>hg-review is designed to never encounter merge conflicts with its data, but
there’s always the chance that someone has done something manually that could
cause a problem.</p>
<p>If your interface doesn’t seem to be receiving new comments/signoffs you’ll
want to take a look at the review data repository to see what’s wrong:</p>
<div class="highlight-python"><pre>cd /var/www/myproject-review-interface/.hg/review
hg heads</pre>
</div>
<p>There should only ever be one head in this repository. If there are more you’ll
need to merge them (and push back to your public review data repo so others
won’t encounter the same problem).</p>
</div>
</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="#">Web Interface</a><ul>
<li><a class="reference external" href="#running-locally">Running Locally</a></li>
<li><a class="reference external" href="#deployment-to-a-server">Deployment to a Server</a><ul>
<li><a class="reference external" href="#initial-deployment">Initial Deployment</a></li>
<li><a class="reference external" href="#updating-the-data">Updating the Data</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="concepts.html"
title="previous chapter">Concepts</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="cli.html"
title="next chapter">Command Line Interface</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/webui.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="cli.html" title="Command Line Interface"
>next</a> |</li>
<li class="right" >
<a href="concepts.html" title="Concepts"
>previous</a> |</li>
<li><a href="index.html">hg-review vpre-alpha documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2010, Steve Losh and contributors.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.7.
</div>
</body>
</html>