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

Sean Farley sean at farley.io
Tue Jul 5 17:01:57 EDT 2016


Yuya Nishihara <yuya at tcha.org> writes:

> 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].

I think I see what you mean but I'm pretty strapped for time so if
someone could do that, that would be great :-) Otherwise, I'll put it in
my queue.


More information about the Mercurial-devel mailing list