[PATCH 6 of 6 V2] histedit: move autoverb rule to the commit it matches

Yuya Nishihara yuya at tcha.org
Sun Jul 3 03:02:44 EDT 2016


On Thu, 30 Jun 2016 14:58:55 -0700, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean at farley.io>
> # Date 1466546329 25200
> #      Tue Jun 21 14:58:49 2016 -0700
> # Node ID edadb62f9204708f34abd85b33a6efe99945e789
> # Parent  bf3cabc7104d684d550a6c692f526b35ab8bfbc0
> # EXP-Topic autoverb
> histedit: move autoverb rule to the commit it matches

The change looks fine and the functionality has been reviewed. Queued the
series, thanks.

> +        newact = util.sortdict()
>          for act in actions:
>              ctx = repo[act.node]
>              summary = _getsummary(ctx)
>              fword = summary.split(' ', 1)[0].lower()
> +            added = False
> +
>              # if it doesn't end with the special character '!' just skip this
>              if fword.endswith('!'):
>                  fword = fword[:-1]
>                  if fword in primaryactions | secondaryactions | tertiaryactions:
>                      act.verb = fword
> +                    # get the target summary
> +                    tsum = summary[len(fword) + 1:].lstrip()
> +                    # safe but slow: reverse iterate over the actions so we
> +                    # don't clash on two commits having the same summary
> +                    for na, l in reversed(list(newact.iteritems())):
> +                        actx = repo[na.node]
> +                        asum = _getsummary(actx)
> +                        if asum == tsum:
> +                            added = True
> +                            l.append(act)
> +                            break

newact isn't accessed as a dict. Perhaps we want a dict of last-tsum => index
and a list of [na, ..l].


More information about the Mercurial-devel mailing list