/blog/2014/04/01/using-mercurial-for-status-reports/index.html
HTML | 205 lines | 162 code | 32 blank | 11 comment | 0 complexity | 2444b9c134b6e0b26ddf6d07ca6417dd MD5 | raw file
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <!--
- Design by Free CSS Templates
- http://www.freecsstemplates.org
- Released for free under a Creative Commons Attribution 2.5 License
- Name : Pollinating
- Description: A two-column, fixed-width design with dark color scheme.
- Version : 1.0
- Released : 20101114
- -->
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
-
- <title>Gregory Szorc's Digital Home
- | Using Mercurial for Status Reports
- </title>
- <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="/blog/feed" />
- <link rel="alternate" type="application/atom+xml" title="Atom 1.0"
- href="/blog/feed/atom" />
- <link rel="stylesheet" href="/style/style.css" type="text/css" />
- <link rel="stylesheet" href="/css/pygments_murphy.css" type="text/css" />
- </head>
- <body>
- <div id="wrapper">
-
- <div id="menu">
- <ul>
- <li><a href="/">Home</a></li>
- <li><a href="/blog/">Blog</a></li>
- <li><a href="/notes">Notes</a></li>
- <li><a href="/work.html">Work</a></li>
- <li><a href="/skills.html">Skills</a></li>
- <li><a href="/thoughts.html">Thoughts</a></li>
- <li><a href="/resume.pdf">Resume</a></li>
- </ul>
- </div>
- <div id="page">
- <div id="page-bgtop">
- <div id="page-bgbtm">
- <div id="content">
-
- <div class="blog_post">
- <a name="using-mercurial-for-status-reports"></a>
- <h2 class="blog_post_title"><a href="/blog/2014/04/01/using-mercurial-for-status-reports" rel="bookmark" title="Permanent Link to Using Mercurial for Status Reports">Using Mercurial for Status Reports</a></h2>
- <small>April 01, 2014 at 12:30 PM | categories:
- <a href='/blog/category/mercurial'>Mercurial</a>, <a href='/blog/category/mozilla'>Mozilla</a>
- </small><p/>
- <div class="post_prose">
-
- <p>Mercurial has a pair of amazing features called
- <a href="http://www.selenic.com/hg/help/revsets">Revisions Sets</a>
- and <a href="http://www.selenic.com/hg/help/templates">Templates</a>. Combined,
- they allow you to query Mercurial like a database and to generate custom
- reports from obtained data.</p>
- <p>As I've <a href="/blog/2013/11/08/using-mercurial-to-query-mozilla-metadata/">demonstrated</a>,
- you can write Mercurial extensions to provide custom revision set
- queries and template functions and keywords. My
- <a href="https://hg.mozilla.org/hgcustom/version-control-tools/file/default/hgext/mozext">mozext</a>
- extension aggregates Mozilla's <em>pushlog</em> data into a local SQLite
- database and makes this data available to revision sets and templates.</p>
- <p>My hack of the day is to use revision sets and templates to create a
- weekly status report:</p>
- <div class="pygments_murphy"><pre><span></span>hg log -r 'public() and me() and firstpushdate("-7")' \
- --template '* {ifeq(reviewer, "gps", "Review: ", "Landing: ")}{firstline(desc)}\n'
- </pre></div>
- <p>When I run this, I get the output:</p>
- <div class="pygments_murphy"><pre><span></span>* Review: Bug 957241 - Don't package the full sdk when we don't need it. r=gps
- * Review: Bug 987146 - Represent SQL queries more efficiently. r=gps.
- * Review: Bug 987984 - VirtualenvManager.call_setup() should use self.python_path instead of sys.executable, r=gps
- * Landing: Bug 987398 - Part 1: Run mochitests from manifests with mach; r=ahal
- * Landing: Bug 987398 - Part 2: Handle install-to-subdir in TestResolver; r=ahal
- * Landing: Bug 987414 - Pass multiple test arguments to mach testing commands; r=ahal
- * Review: Bug 988141 - Clean up config/recurse.mk after bug 969164. r=gps
- * Landing: Bug 973992 - Support experiments add-ons; r=Unfocused
- * Review: Bug 927672 - Force pymake to fall back to mozmake when run on build slaves. r=gps
- * Review: Bug 989147 - Use new sccache for Linux and Android builds. r=gps
- * Review: Bug 989147 - Add missing part of the patch from rebase conflict. r=gps
- * Landing: Bug 975000 - Disable updating and compatibility checking for Experiments; r=Unfocused
- * Landing: Bug 985084 - Experiment add-ons should be disabled by default; r=Unfocused
- * Landing: Backed out changeset 4834a3833639 and c580afddd1cb (bug 985084 and bug 97500)
- * Landing: Bug 975000 - Disable updating and compatibility checking for Experiments; r=Unfocused
- * Landing: Bug 985084 - Experiment add-ons should be disabled by default; r=Unfocused
- * Landing: Bug 989137 - Part 1: Uninstall unknown experiments; r=Unfocused
- * Landing: Bug 989137 - Part 2: Don't use a global logger; r=gfritzsche
- * Landing: Bug 989137 - Part 3: Log.jsm API to get a Logger that prefixes messages; r=bsmedberg
- * Landing: Bug 989137 - Part 4: Use a prefixing logger for Experiments logging; r=gfritzsche
- * Landing: Bug 989137 - Part 5: Prefix each log message with the instance of the object; r=gfritzsche
- * Review: Bug 988849 - Add mach target for jit tests; r=gps
- * Landing: Bug 989137 - Part 6: Create experiment XPIs during the build; r=bsmedberg
- * Landing: Bug 989137 - Part 7: Remove unncessary content from test experiments; r=Unfocused
- * Landing: Bug 985084 - Part 2: Properly report userDisabled in the API; r=Unfocused
- </pre></div>
- <p>Which I can then copy and paste directly into the
- <a href="http://benjamin.smedbergs.us/weekly-updates.fcgi/">status tool</a> to
- capture all my weekly code contributions! That takes a few seconds to
- run and saves me a few minutes of typing.</p>
- <p>For the curious, let's break that Mercurial command down.</p>
- <ul>
- <li>public() selects all <em>public</em> changesets. These are changesets in the
- repository that have been pushed to a publishing repository. In other
- words, patches that landed in Firefox.</li>
- <li>me() is a custom revset from my <em>mozext</em> extension that parses the
- commit message and selects changesets that I authored or reviewed.</li>
- <li>firstpushdate("-7") is a custom revset from my <em>mozext</em> extension. It
- selects changesets that were first pushed in the last 7 days (using
- pushlog data stored in a local SQLite database).</li>
- </ul>
- <p>The template piece should be easy to read. I have a simple branch
- testing whether the changeset is a review or not, then output a label
- followed by the first line of the commit message.</p>
- <p>I have this command saved under the <em>[alias]</em> section of my <em>~/.hgrc</em>
- file so I can just type <em>hg statusreport</em>.</p>
- <p>While there is room to improve the tool (stripping <em>r=</em> lines from
- commit messages for example), I think it's a pretty cool hack and shows
- how Mercurial can grow to solve problems you don't think your version
- control system knows how to solve.</p>
- </div>
- </div>
- </div>
-
- <div id="sidebar">
- <ul>
- <li>
- <h2>Categories</h2>
- <ul>
- <li><a href="/blog/category/apple">Apple</a></li>
- <li><a href="/blog/category/bugzilla">Bugzilla</a></li>
- <li><a href="/blog/category/ci">CI</a></li>
- <li><a href="/blog/category/clang">Clang</a></li>
- <li><a href="/blog/category/docker">Docker</a></li>
- <li><a href="/blog/category/firefox">Firefox</a></li>
- <li><a href="/blog/category/git">Git</a></li>
- <li><a href="/blog/category/javascript">JavaScript</a></li>
- <li><a href="/blog/category/mercurial">Mercurial</a></li>
- <li><a href="/blog/category/mozreview">MozReview</a></li>
- <li><a href="/blog/category/mozilla">Mozilla</a></li>
- <li><a href="/blog/category/personal">Personal</a></li>
- <li><a href="/blog/category/programming">Programming</a></li>
- <li><a href="/blog/category/puppet">Puppet</a></li>
- <li><a href="/blog/category/pyoxidizer">PyOxidizer</a></li>
- <li><a href="/blog/category/python">Python</a></li>
- <li><a href="/blog/category/review-board">Review Board</a></li>
- <li><a href="/blog/category/rust">Rust</a></li>
- <li><a href="/blog/category/sync">Sync</a></li>
- <li><a href="/blog/category/browsers">browsers</a></li>
- <li><a href="/blog/category/build-system">build system</a></li>
- <li><a href="/blog/category/code-review">code review</a></li>
- <li><a href="/blog/category/compilers">compilers</a></li>
- <li><a href="/blog/category/internet">internet</a></li>
- <li><a href="/blog/category/logging">logging</a></li>
- <li><a href="/blog/category/mach">mach</a></li>
- <li><a href="/blog/category/make">make</a></li>
- <li><a href="/blog/category/misc">misc</a></li>
- <li><a href="/blog/category/movies">movies</a></li>
- <li><a href="/blog/category/packaging">packaging</a></li>
- <li><a href="/blog/category/pymake">pymake</a></li>
- <li><a href="/blog/category/security">security</a></li>
- <li><a href="/blog/category/sysadmin">sysadmin</a></li>
- <li><a href="/blog/category/testing">testing</a></li>
- </ul>
- </li>
- </ul>
- </div>
- <div style="clear: both;"> </div>
- </div>
- </div>
- </div>
- <div id="footer">
-
- <hr/>
- <p>Copyright (c) 2012- Gregory Szorc. All rights reserved. Design by <a href="http://www.freecsstemplates.org/"> CSS Templates</a>.</p>
- </div>
- </div>
- </body>
- </html>