##// END OF EJS Templates
histedit: add addhisteditaction decorator...
Mateusz Kwapich -
r27201:dcb536d2 default
parent child Browse files
Show More
@@ -544,6 +544,20 b' def abortdirty():'
544 544 '--continue, or abort with histedit --abort'))
545 545
546 546
547 actiontable = {}
548 actionlist = []
549
550 def addhisteditaction(verbs):
551 def wrap(cls):
552 cls.verb = verbs[0]
553 for verb in verbs:
554 actiontable[verb] = cls
555 actionlist.append(cls)
556 return cls
557 return wrap
558
559
560 @addhisteditaction(['pick', 'p'])
547 561 class pick(histeditaction):
548 562 def run(self):
549 563 rulectx = self.repo[self.node]
@@ -553,6 +567,7 b' class pick(histeditaction):'
553 567
554 568 return super(pick, self).run()
555 569
570 @addhisteditaction(['edit', 'e'])
556 571 class edit(histeditaction):
557 572 def run(self):
558 573 repo = self.repo
@@ -567,6 +582,7 b' class edit(histeditaction):'
567 582 def commiteditor(self):
568 583 return cmdutil.getcommiteditor(edit=True, editform='histedit.edit')
569 584
585 @addhisteditaction(['fold', 'f'])
570 586 class fold(histeditaction):
571 587 def continuedirty(self):
572 588 repo = self.repo
@@ -677,6 +693,7 b' class base(histeditaction):'
677 693 basectx = self.repo['.']
678 694 return basectx, []
679 695
696 @addhisteditaction(['_multifold'])
680 697 class _multifold(fold):
681 698 """fold subclass used for when multiple folds happen in a row
682 699
@@ -689,6 +706,7 b' class _multifold(fold):'
689 706 def skipprompt(self):
690 707 return True
691 708
709 @addhisteditaction(["roll", "r"])
692 710 class rollup(fold):
693 711 def mergedescs(self):
694 712 return False
@@ -696,11 +714,13 b' class rollup(fold):'
696 714 def skipprompt(self):
697 715 return True
698 716
717 @addhisteditaction(["drop", "d"])
699 718 class drop(histeditaction):
700 719 def run(self):
701 720 parentctx = self.repo[self.state.parentctxnode]
702 721 return parentctx, [(self.node, tuple())]
703 722
723 @addhisteditaction(["mess", "m"])
704 724 class message(histeditaction):
705 725 def commiteditor(self):
706 726 return cmdutil.getcommiteditor(edit=True, editform='histedit.mess')
@@ -731,20 +751,6 b' def findoutgoing(ui, repo, remote=None, '
731 751 raise error.Abort(msg, hint=hint)
732 752 return repo.lookup(roots[0])
733 753
734 actiontable = {'p': pick,
735 'pick': pick,
736 'e': edit,
737 'edit': edit,
738 'f': fold,
739 'fold': fold,
740 '_multifold': _multifold,
741 'r': rollup,
742 'roll': rollup,
743 'd': drop,
744 'drop': drop,
745 'm': message,
746 'mess': message,
747 }
748 754
749 755 @command('histedit',
750 756 [('', 'commands', '',
@@ -1379,4 +1385,4 b' def extsetup(ui):'
1379 1385 ['histedit-state', False, True, _('histedit in progress'),
1380 1386 _("use 'hg histedit --continue' or 'hg histedit --abort'")])
1381 1387 if ui.configbool("experimental", "histeditng"):
1382 actiontable.update({'b': base, 'base': base})
1388 globals()['base'] = addhisteditaction(['base', 'b'])(base)
General Comments 0
You need to be logged in to leave comments. Login now