comparison hgext/histedit.py @ 42584:db5560c07a28

abort: added support for histedit This patch adds the support for `histedit` in `hg abort` plan. As seperate `hgaborthistedit()` function is created to handle independent calls for abortion of `histedit`. This function is then registered as `abortfunc` for state detection API. hg abort in case of `histedit` also supports ` history-editing-backup` config option. Results are shown as tests. Differential Revision: https://phab.mercurial-scm.org/D6582
author Taapas Agrawal <taapas2897@gmail.com>
date Fri, 28 Jun 2019 00:35:52 +0530
parents 0231032729c4
children 701341f57ceb
comparison
equal deleted inserted replaced
42583:b9bc47211cf5 42584:db5560c07a28
1917 'cleaned up\n')) 1917 'cleaned up\n'))
1918 raise 1918 raise
1919 finally: 1919 finally:
1920 state.clear() 1920 state.clear()
1921 1921
1922 def hgaborthistedit(ui, repo):
1923 state = histeditstate(repo)
1924 nobackup = not ui.configbool('rewrite', 'backup-bundle')
1925 with repo.wlock() as wlock, repo.lock() as lock:
1926 state.wlock = wlock
1927 state.lock = lock
1928 _aborthistedit(ui, repo, state, nobackup=nobackup)
1929
1922 def _edithisteditplan(ui, repo, state, rules): 1930 def _edithisteditplan(ui, repo, state, rules):
1923 state.read() 1931 state.read()
1924 if not rules: 1932 if not rules:
1925 comment = geteditcomment(ui, 1933 comment = geteditcomment(ui,
1926 node.short(state.parentctxnode), 1934 node.short(state.parentctxnode),
2312 len(state.actions))) 2320 len(state.actions)))
2313 2321
2314 def extsetup(ui): 2322 def extsetup(ui):
2315 cmdutil.summaryhooks.add('histedit', summaryhook) 2323 cmdutil.summaryhooks.add('histedit', summaryhook)
2316 statemod.addunfinished('histedit', fname='histedit-state', allowcommit=True, 2324 statemod.addunfinished('histedit', fname='histedit-state', allowcommit=True,
2317 continueflag=True) 2325 continueflag=True, abortfunc=hgaborthistedit)
2318 2326