cl-netpbm: Update site.
author |
Steve Losh <steve@stevelosh.com> |
date |
Mon, 23 Dec 2019 15:28:27 -0500 |
parents |
1d1ba7d1338d |
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>API — 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="Hacking hg-review" href="hacking.html" />
<link rel="prev" title="Command Line Interface" href="cli.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="hacking.html" title="Hacking hg-review"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="cli.html" title="Command Line Interface"
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="api">
<h1>API<a class="headerlink" href="#api" title="Permalink to this headline">¶</a></h1>
<p>hg-review takes Mercurial’s approach to API stability:</p>
<ul class="simple">
<li>The command line interface is fairly stable and will not break often.</li>
<li>File formats will not change often.</li>
<li>The internal implementation may change frequently – there are no guarantees
of stability.</li>
</ul>
<p>Providing a stable CLI means that (possibly non-GPL) programs can interact with
hg-review easily without fear of constant breaking.</p>
<p>Stable file formats mean that older versions of hg-review will be able to work
with review data from newer versions (albeit with reduced functionality).</p>
<p><em>Not</em> providing a stable internal implementation allows hg-review’s code to be
kept clean and elegant. It means that Python programs will needs to use
subprocesses to avoid breaking, but this is a tradeoff that the author feels is
worth making.</p>
<div class="section" id="data-repository-layout">
<h2>Data Repository Layout<a class="headerlink" href="#data-repository-layout" title="Permalink to this headline">¶</a></h2>
<p>The structure of hg-review’s data repository looks like this:</p>
<div class="highlight-python"><pre>your-project/
|
+-- .hg/
| |
| +-- review
| | |
| | +-- {{ changeset hash }}
| | | |
| | | +-- .exists
| | | |
| | | +-- comments
| | | | |
| | | | +-- {{ comment hash }}
| | | | |
| | | | `-- other comments...
| | | |
| | | +-- signoffs
| | | |
| | | +-- {{ signoff hash }}
| | | |
| | | `-- other signoffs ...
| | |
| | `-- other changesets ...
| |
| `-- other files ...
|
`-- other files ...</pre>
</div>
<p>All review data for a changeset is stored in:</p>
<div class="highlight-python"><pre>.hg/review/{{ changeset hash }}/</pre>
</div>
<p>A <tt class="docutils literal"><span class="pre">.exists</span></tt> file is included in that directory when code review for
that changeset is initialized. This allows us to check if a given changeset has
been initialized for code review very quickly.</p>
<p>Comments for a changeset are stored in:</p>
<div class="highlight-python"><pre>.hg/review/{{ changeset hash }}/comments/{{ comment hash }}</pre>
</div>
<p>Signoffs for a changeset are stored in:</p>
<div class="highlight-python"><pre>.hg/review/{{ changeset hash }}/signoffs/{{ signoff hash }}</pre>
</div>
</div>
<div class="section" id="file-formats">
<h2>File Formats<a class="headerlink" href="#file-formats" title="Permalink to this headline">¶</a></h2>
<p>hg-review’s file format is (fairly) stable and is designed to be easily parsed
to enable export to other code review systems.</p>
<p>Comment and signoff files are stored as JSON. The files are indented four
spaces per level to make them more human-readable.</p>
<div class="section" id="exists-files">
<h3><tt class="docutils literal"><span class="pre">.exists</span></tt> Files<a class="headerlink" href="#exists-files" title="Permalink to this headline">¶</a></h3>
<p>The <tt class="docutils literal"><span class="pre">.exists</span></tt> file is always empty. It simply exists to make looking up
whether a given changeset has been initialized faster. It may go away in the
future – do not depend on it.</p>
</div>
<div class="section" id="comment-files">
<h3>Comment Files<a class="headerlink" href="#comment-files" title="Permalink to this headline">¶</a></h3>
<p>Here is a sample comment file:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span>
<span class="s">"author"</span><span class="p">:</span> <span class="s">"Steve Losh <steve@stevelosh.com>"</span><span class="p">,</span>
<span class="s">"file"</span><span class="p">:</span> <span class="p">[</span>
<span class="s">"reykjavi</span><span class="se">\u0301</span><span class="s">k.txt"</span><span class="p">,</span>
<span class="s">"cmV5YWphdmnMgWsudHh0"</span>
<span class="p">],</span>
<span class="s">"hgdate"</span><span class="p">:</span> <span class="s">"Mon Jul 12 23:55:51 2010 -0400"</span><span class="p">,</span>
<span class="s">"lines"</span><span class="p">:</span> <span class="p">[</span>
<span class="mi">0</span>
<span class="p">],</span>
<span class="s">"message"</span><span class="p">:</span> <span class="s">"Sample."</span><span class="p">,</span>
<span class="s">"node"</span><span class="p">:</span> <span class="s">"0e987f91e9b6628b26a30c5d00668a15fae8f22f"</span><span class="p">,</span>
<span class="s">"style"</span><span class="p">:</span> <span class="s">"markdown"</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Comment files have some or all of the following fields:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">author</span></tt></dt>
<dd>The Mercurial username of the person that added this comment.</dd>
<dt><tt class="docutils literal"><span class="pre">file</span></tt></dt>
<dd>A list of two strings. The first string is a (JSON-encoded) representation
of the UTF-8 filename. The second string is a base64 encoded version of the
actual bytes of the filename (which is what Mercurial gives and expects to
receive internally). If this is a review-level comment both strings will be
blank.</dd>
<dt><tt class="docutils literal"><span class="pre">hgdate</span></tt></dt>
<dd>The date and time the comment was added (or last edited).</dd>
<dt><tt class="docutils literal"><span class="pre">lines</span></tt></dt>
<dd>A list of integers representing the lines of the file that this comment
applies to. If this is a file-level or review-level comment the list will
be empty.</dd>
<dt><tt class="docutils literal"><span class="pre">message</span></tt></dt>
<dd>A string representing the raw comment message.</dd>
<dt><tt class="docutils literal"><span class="pre">node</span></tt></dt>
<dd>A string representing the hash of the changset this comment belongs to, for
easy lookup later.</dd>
<dt><tt class="docutils literal"><span class="pre">style</span></tt></dt>
<dd>A string representing the style of this comment – this will be
<tt class="docutils literal"><span class="pre">markdown</span></tt> for Markdown comments and blank for plain-text comments. More
styles may be added in the future.</dd>
</dl>
</div>
<div class="section" id="signoff-files">
<h3>Signoff Files<a class="headerlink" href="#signoff-files" title="Permalink to this headline">¶</a></h3>
<p>Here is a sample signoff file:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">{</span>
<span class="s">"author"</span><span class="p">:</span> <span class="s">"Steve Losh <steve@stevelosh.com>"</span><span class="p">,</span>
<span class="s">"hgdate"</span><span class="p">:</span> <span class="s">"Tue Jul 13 00:16:00 2010 -0400"</span><span class="p">,</span>
<span class="s">"message"</span><span class="p">:</span> <span class="s">"Sample."</span><span class="p">,</span>
<span class="s">"node"</span><span class="p">:</span> <span class="s">"0e987f91e9b6628b26a30c5d00668a15fae8f22f"</span><span class="p">,</span>
<span class="s">"opinion"</span><span class="p">:</span> <span class="s">"yes"</span><span class="p">,</span>
<span class="s">"style"</span><span class="p">:</span> <span class="s">"markdown"</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Signoff files have some or all of the following fields:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">author</span></tt></dt>
<dd>The Mercurial username of the person that added this comment.</dd>
<dt><tt class="docutils literal"><span class="pre">hgdate</span></tt></dt>
<dd>The date and time the comment was added (or last edited).</dd>
<dt><tt class="docutils literal"><span class="pre">message</span></tt></dt>
<dd>A string representing the raw comment message.</dd>
<dt><tt class="docutils literal"><span class="pre">node</span></tt></dt>
<dd>A string representing the hash of the changset this comment belongs to, for
easy lookup later.</dd>
<dt><tt class="docutils literal"><span class="pre">opinion</span></tt></dt>
<dd>A string representing the signoff opinion. This will be <tt class="docutils literal"><span class="pre">yes</span></tt>, <tt class="docutils literal"><span class="pre">no</span></tt>, or
a blank string (for a neutral signoff).</dd>
<dt><tt class="docutils literal"><span class="pre">style</span></tt></dt>
<dd>A string representing the style of this comment – this will be
<tt class="docutils literal"><span class="pre">markdown</span></tt> for Markdown comments and blank for plain-text comments. More
styles may be added in the future.</dd>
</dl>
</div>
</div>
<div class="section" id="command-line-interface">
<h2>Command Line Interface<a class="headerlink" href="#command-line-interface" title="Permalink to this headline">¶</a></h2>
<p>hg-review’s command line interface is (fairly) stable. If you want to interact
with review data for a repository this is the safest method to use.</p>
<p>See the <a class="reference external" href="cli.html"><em>command line interface documentation</em></a> for more details.</p>
</div>
<div class="section" id="internal-python-api">
<h2>Internal Python API<a class="headerlink" href="#internal-python-api" title="Permalink to this headline">¶</a></h2>
<p>hg-review’s internal Python implementation is <em>not</em> stable. It may change at
any time. Relying on it virtually guarantees your application will break at
some point.</p>
<p>For a more stable API you should use the command line interface.</p>
<p>The Python API will be documented later, but is not a high priority at the
moment because of its volatility.</p>
</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="#">API</a><ul>
<li><a class="reference external" href="#data-repository-layout">Data Repository Layout</a></li>
<li><a class="reference external" href="#file-formats">File Formats</a><ul>
<li><a class="reference external" href="#exists-files"><tt class="docutils literal"><span class="pre">.exists</span></tt> Files</a></li>
<li><a class="reference external" href="#comment-files">Comment Files</a></li>
<li><a class="reference external" href="#signoff-files">Signoff Files</a></li>
</ul>
</li>
<li><a class="reference external" href="#command-line-interface">Command Line Interface</a></li>
<li><a class="reference external" href="#internal-python-api">Internal Python API</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="cli.html"
title="previous chapter">Command Line Interface</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="hacking.html"
title="next chapter">Hacking hg-review</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/api.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="hacking.html" title="Hacking hg-review"
>next</a> |</li>
<li class="right" >
<a href="cli.html" title="Command Line Interface"
>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>