[PATCH RFC] show: implement underway view

Yuya Nishihara yuya at tcha.org
Mon Apr 10 09:58:11 EDT 2017


On Wed, 05 Apr 2017 23:03:34 -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1491458600 25200
> #      Wed Apr 05 23:03:20 2017 -0700
> # Node ID fd7258f2153bdd9c6871d6ca38c68047d3e15f4c
> # Parent  45761ef1bc935b1fab74adccf2541ef854b1c2eb
> show: implement underway view

There are some minor issues, but I think this is a good start.

> + at revsetpredicate('_underway([commitage[, headage]])')
> +def underwayrevset(repo, subset, x):
> +    """Changesets that are still mutable and other important changesets."""

Please add "(EXPERIMENTAL)" or comment out the doc. Otherwise this would be
included in the help.

> +    if args['commitage']:
> +        rs += ' and date(%s)'
> +        rsargs.append(args['commitage'][1])

revsetlang.getstring() should be used.

> +    if args['headage']:
> +        rs += ' and date(%s)'
> +        rsargs.append(args['headage'][1])

This too.

> +    wdirrev = repo['.'].rev()
> +    if wdirrev != nullrev:
> +        relevant += revset.baseset(set([wdirrev]))

Nit: this is actually a working-directory parent.

> + at showview('underway', fmtopic='underway')
> +def showunderway(ui, repo, fm):
> +    """changesets that are unfinished"""
> +    # TODO support date-based limiting when calling revset.
> +    revs = repo.revs('sort(_underway(), topo)')
> +
> +    revdag = graphmod.dagwalker(repo, revs)
> +    displayer = cmdutil.changeset_templater(ui, repo, None, None,
> +                                            tmpl=fm._t.load(fm._topic),
> +                                            mapfile=None, buffered=True)
> +
> +    ui.setconfig('experimental', 'graphshorten', True)
> +    cmdutil.displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges)

Ugh, well, it's okay for now. We'll need non-formatter interface like
showunderway(ui, repo, opts).


More information about the Mercurial-devel mailing list