[PATCH 1 of 8 V2] revset: add a predicate for finding converted changesets
Matt Mackall
mpm at selenic.com
Wed Jun 20 12:55:52 CDT 2012
On Fri, 2012-06-08 at 00:58 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1336885946 14400
> # Node ID e01c0a7fc5fdd197150500b4845e53634d196db4
> # Parent 2255950e1f7663a9faa6b57040cc5c0debe7d4dd
> revset: add a predicate for finding converted changesets
Queued for default, thanks.
> + l = getargs(x, 0, 1, _('converted takes one or no arguments'))
> + rev = l and getstring(l[0], _('converted requires a revision')) or None
a) don't use spaces for alignment
b) don't use "x and y or z"
When you use the "x and y or z" hack, it's never clear to subsequent
readers whether the consequences of the y clause returning a
False-equivalent have been thought through. Here, an arg of "" results
in rev = None. Correct? I have no idea. Not worth the cognitive load,
just use if.
This became:
+ rev = None
l = getargs(x, 0, 1, _('converted takes one or no arguments'))
- rev = l and getstring(l[0], _('converted requires a revision')) or None
+ if l:
+ rev = getstring(l[0], _('converted requires a revision'))
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list