diff 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
line wrap: on
line diff
--- a/hgext/histedit.py	Sun Jun 23 23:11:35 2019 +0530
+++ b/hgext/histedit.py	Fri Jun 28 00:35:52 2019 +0530
@@ -1919,6 +1919,14 @@
     finally:
             state.clear()
 
+def hgaborthistedit(ui, repo):
+    state = histeditstate(repo)
+    nobackup = not ui.configbool('rewrite', 'backup-bundle')
+    with repo.wlock() as wlock, repo.lock() as lock:
+        state.wlock = wlock
+        state.lock = lock
+        _aborthistedit(ui, repo, state, nobackup=nobackup)
+
 def _edithisteditplan(ui, repo, state, rules):
     state.read()
     if not rules:
@@ -2314,5 +2322,5 @@
 def extsetup(ui):
     cmdutil.summaryhooks.add('histedit', summaryhook)
     statemod.addunfinished('histedit', fname='histedit-state', allowcommit=True,
-                            continueflag=True)
+                            continueflag=True, abortfunc=hgaborthistedit)