Show More
@@ -1316,15 +1316,38 b' def ruleeditor(repo, ui, actions, editco' | |||
|
1316 | 1316 | rules are in the format [ [act, ctx], ...] like in state.rules |
|
1317 | 1317 | """ |
|
1318 | 1318 | if repo.ui.configbool("experimental", "histedit.autoverb"): |
|
1319 | newact = util.sortdict() | |
|
1319 | 1320 | for act in actions: |
|
1320 | 1321 | ctx = repo[act.node] |
|
1321 | 1322 | summary = _getsummary(ctx) |
|
1322 | 1323 | fword = summary.split(' ', 1)[0].lower() |
|
1324 | added = False | |
|
1325 | ||
|
1323 | 1326 | # if it doesn't end with the special character '!' just skip this |
|
1324 | 1327 | if fword.endswith('!'): |
|
1325 | 1328 | fword = fword[:-1] |
|
1326 | 1329 | if fword in primaryactions | secondaryactions | tertiaryactions: |
|
1327 | 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 | 1352 | rules = '\n'.join([act.torule() for act in actions]) |
|
1330 | 1353 | rules += '\n\n' |
@@ -507,17 +507,15 b' Test autoverb feature' | |||
|
507 | 507 | $ hg init autoverb |
|
508 | 508 | $ cd autoverb |
|
509 | 509 | $ echo alpha >> alpha |
|
510 | $ hg addr | |
|
511 | adding alpha | |
|
512 | $ hg ci -m one | |
|
510 | $ hg ci -qAm one | |
|
513 | 511 | $ echo alpha >> alpha |
|
514 | $ hg ci -m two | |
|
515 |
$ echo |
|
|
516 |
$ hg ci -m "roll! |
|
|
512 | $ hg ci -qm two | |
|
513 | $ echo beta >> beta | |
|
514 | $ hg ci -qAm "roll! one" | |
|
517 | 515 | |
|
518 | 516 | $ hg log --style compact --graph |
|
519 |
@ 2[tip] |
|
|
520 |
| roll! |
|
|
517 | @ 2[tip] 4f34d0f8b5fa 1970-01-01 00:00 +0000 test | |
|
518 | | roll! one | |
|
521 | 519 | | |
|
522 | 520 | o 1 579e40513370 1970-01-01 00:00 +0000 test |
|
523 | 521 | | two |
@@ -528,11 +526,12 b' Test autoverb feature' | |||
|
528 | 526 | |
|
529 | 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 | 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 | 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