Mercurial > hg
comparison hgext/histedit.py @ 27085:d50ff8f4891f
histedit: add an experimental base action
This is a first (very simple) version of the histedit base action.
It works well in common usecases like rebasing the whole stack and
spliting the stack.
I don't see any obvious edge cases - but probably there is more than one.
That's why I want to keep it behind experimental.histeditng config knob
for now. I think on knob for all new histedit behaviors is better because
we will test all of them together and testers will need to turn it on only
once to get all new nice things.
author | Mateusz Kwapich <mitrandir@fb.com> |
---|---|
date | Tue, 17 Nov 2015 15:04:31 -0800 |
parents | 383f10b67fd6 |
children | 5f5c7d9f4a08 |
comparison
equal
deleted
inserted
replaced
27084:383f10b67fd6 | 27085:d50ff8f4891f |
---|---|
643 (newnode, (n,)), | 643 (newnode, (n,)), |
644 ] | 644 ] |
645 for ich in internalchanges: | 645 for ich in internalchanges: |
646 replacements.append((ich, (n,))) | 646 replacements.append((ich, (n,))) |
647 return repo[n], replacements | 647 return repo[n], replacements |
648 | |
649 class base(histeditaction): | |
650 def constraints(self): | |
651 return set(['forceother']) | |
652 | |
653 def run(self): | |
654 if self.repo['.'].node() != self.node: | |
655 mergemod.update(self.repo, self.node, False, True, False) | |
656 # branchmerge, force, partial) | |
657 return self.continueclean() | |
658 | |
659 def continuedirty(self): | |
660 abortdirty() | |
661 | |
662 def continueclean(self): | |
663 basectx = self.repo['.'] | |
664 return basectx, [] | |
648 | 665 |
649 class _multifold(fold): | 666 class _multifold(fold): |
650 """fold subclass used for when multiple folds happen in a row | 667 """fold subclass used for when multiple folds happen in a row |
651 | 668 |
652 We only want to fire the editor for the folded message once when | 669 We only want to fire the editor for the folded message once when |
1289 def extsetup(ui): | 1306 def extsetup(ui): |
1290 cmdutil.summaryhooks.add('histedit', summaryhook) | 1307 cmdutil.summaryhooks.add('histedit', summaryhook) |
1291 cmdutil.unfinishedstates.append( | 1308 cmdutil.unfinishedstates.append( |
1292 ['histedit-state', False, True, _('histedit in progress'), | 1309 ['histedit-state', False, True, _('histedit in progress'), |
1293 _("use 'hg histedit --continue' or 'hg histedit --abort'")]) | 1310 _("use 'hg histedit --continue' or 'hg histedit --abort'")]) |
1311 if ui.configbool("experimental", "histeditng"): | |
1312 actiontable.update({'b': base, 'base': base}) |