Show More
@@ -1316,15 +1316,38 b' def ruleeditor(repo, ui, actions, editco' | |||||
1316 | rules are in the format [ [act, ctx], ...] like in state.rules |
|
1316 | rules are in the format [ [act, ctx], ...] like in state.rules | |
1317 | """ |
|
1317 | """ | |
1318 | if repo.ui.configbool("experimental", "histedit.autoverb"): |
|
1318 | if repo.ui.configbool("experimental", "histedit.autoverb"): | |
|
1319 | newact = util.sortdict() | |||
1319 | for act in actions: |
|
1320 | for act in actions: | |
1320 | ctx = repo[act.node] |
|
1321 | ctx = repo[act.node] | |
1321 | summary = _getsummary(ctx) |
|
1322 | summary = _getsummary(ctx) | |
1322 | fword = summary.split(' ', 1)[0].lower() |
|
1323 | fword = summary.split(' ', 1)[0].lower() | |
|
1324 | added = False | |||
|
1325 | ||||
1323 | # if it doesn't end with the special character '!' just skip this |
|
1326 | # if it doesn't end with the special character '!' just skip this | |
1324 | if fword.endswith('!'): |
|
1327 | if fword.endswith('!'): | |
1325 | fword = fword[:-1] |
|
1328 | fword = fword[:-1] | |
1326 | if fword in primaryactions | secondaryactions | tertiaryactions: |
|
1329 | if fword in primaryactions | secondaryactions | tertiaryactions: | |
1327 | act.verb = fword |
|
1330 | act.verb = fword | |
|
1331 | # get the target summary | |||
|
1332 | tsum = summary[len(fword) + 1:].lstrip() | |||
|
1333 | # safe but slow: reverse iterate over the actions so we | |||
|
1334 | # don't clash on two commits having the same summary | |||
|
1335 | for na, l in reversed(list(newact.iteritems())): | |||
|
1336 | actx = repo[na.node] | |||
|
1337 | asum = _getsummary(actx) | |||
|
1338 | if asum == tsum: | |||
|
1339 | added = True | |||
|
1340 | l.append(act) | |||
|
1341 | break | |||
|
1342 | ||||
|
1343 | if not added: | |||
|
1344 | newact[act] = [] | |||
|
1345 | ||||
|
1346 | # copy over and flatten the new list | |||
|
1347 | actions = [] | |||
|
1348 | for na, l in newact.iteritems(): | |||
|
1349 | actions.append(na) | |||
|
1350 | actions += l | |||
1328 |
|
1351 | |||
1329 | rules = '\n'.join([act.torule() for act in actions]) |
|
1352 | rules = '\n'.join([act.torule() for act in actions]) | |
1330 | rules += '\n\n' |
|
1353 | rules += '\n\n' |
@@ -507,17 +507,15 b' Test autoverb feature' | |||||
507 | $ hg init autoverb |
|
507 | $ hg init autoverb | |
508 | $ cd autoverb |
|
508 | $ cd autoverb | |
509 | $ echo alpha >> alpha |
|
509 | $ echo alpha >> alpha | |
510 | $ hg addr |
|
510 | $ hg ci -qAm one | |
511 | adding alpha |
|
|||
512 | $ hg ci -m one |
|
|||
513 | $ echo alpha >> alpha |
|
511 | $ echo alpha >> alpha | |
514 | $ hg ci -m two |
|
512 | $ hg ci -qm two | |
515 |
$ echo |
|
513 | $ echo beta >> beta | |
516 |
$ hg ci -m "roll! |
|
514 | $ hg ci -qAm "roll! one" | |
517 |
|
515 | |||
518 | $ hg log --style compact --graph |
|
516 | $ hg log --style compact --graph | |
519 |
@ 2[tip] |
|
517 | @ 2[tip] 4f34d0f8b5fa 1970-01-01 00:00 +0000 test | |
520 |
| roll! |
|
518 | | roll! one | |
521 | | |
|
519 | | | |
522 | o 1 579e40513370 1970-01-01 00:00 +0000 test |
|
520 | o 1 579e40513370 1970-01-01 00:00 +0000 test | |
523 | | two |
|
521 | | two | |
@@ -528,11 +526,12 b' Test autoverb feature' | |||||
528 |
|
526 | |||
529 | Check that 'roll' is selected by default |
|
527 | Check that 'roll' is selected by default | |
530 |
|
528 | |||
531 |
$ HGEDITOR=cat hg histedit |
|
529 | $ HGEDITOR=cat hg histedit 0 --config experimental.histedit.autoverb=True | |
|
530 | pick 6058cbb6cfd7 0 one | |||
|
531 | roll 4f34d0f8b5fa 2 roll! one | |||
532 | pick 579e40513370 1 two |
|
532 | pick 579e40513370 1 two | |
533 | roll 1b0b0b04c8fe 2 roll! three |
|
|||
534 |
|
533 | |||
535 |
# Edit history between |
|
534 | # Edit history between 6058cbb6cfd7 and 4f34d0f8b5fa | |
536 | # |
|
535 | # | |
537 | # Commits are listed from least to most recent |
|
536 | # Commits are listed from least to most recent | |
538 | # |
|
537 | # |
General Comments 0
You need to be logged in to leave comments.
Login now