D6678: continue: added support for histedit
taapas1128 (Taapas Agrawal)
phabricator at mercurial-scm.org
Tue Jul 23 18:29:18 UTC 2019
taapas1128 created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
This patch adds the support for histedit in `hg continue` plan.
As seperate `hgcontinuehistedit()` function is created to handle
independent calls for resuming histedit. This function is
then registered as continuefunc for state detection API.
Results are shown as tests.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D6678
AFFECTED FILES
hgext/histedit.py
tests/test-histedit-arguments.t
CHANGE DETAILS
diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
--- a/tests/test-histedit-arguments.t
+++ b/tests/test-histedit-arguments.t
@@ -1,4 +1,4 @@
-#testcases abortcommand abortflag
+#testcases commandmode abortflag continueflag
#if abortflag
$ cat >> $HGRCPATH <<EOF
@@ -7,6 +7,13 @@
> EOF
#endif
+#if continueflag
+ $ cat >> $HGRCPATH <<EOF
+ > [alias]
+ > continue = histedit --continue
+ > EOF
+#endif
+
Test argument handling and various data parsing
==================================================
@@ -53,12 +60,13 @@
histedit --continue/--abort with no existing state
--------------------------------------------------
- $ hg histedit --continue
- abort: no histedit in progress
+ $ hg continue
+ abort: no histedit in progress (continueflag !)
+ abort: no operation in progress (no-continueflag !)
[255]
$ hg abort
abort: no histedit in progress (abortflag !)
- abort: no operation in progress (abortcommand !)
+ abort: no operation in progress (no-abortflag !)
[255]
Run a dummy edit to make sure we get tip^^ correctly via revsingle.
@@ -163,7 +171,7 @@
$ echo alpha >> alpha
$ mv .hg/histedit-state.back .hg/histedit-state
- $ hg histedit --continue
+ $ hg continue
saved backup bundle to $TESTTMP/foo/.hg/strip-backup/08d98a8350f3-02594089-histedit.hg
$ hg log -G -T '{rev} {shortest(node)} {desc}\n' -r 2::
@ 4 f5ed five
@@ -493,7 +501,7 @@
$ hg resolve -m --all
(no more unresolved files)
continue: hg histedit --continue
- $ hg histedit --cont
+ $ hg continue
merging foo
warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
Editing (6f2f0241f119), you may commit or record as needed now.
@@ -516,7 +524,7 @@
> evolution.allowunstable=True
> EOF
$ hg commit --amend -m 'allow this fold'
- $ hg histedit --continue
+ $ hg continue
$ cd ..
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1839,6 +1839,20 @@
state.write()
+def hgcontinuehistedit(ui, repo):
+ state = histeditstate(repo)
+ with repo.wlock() as wlock, repo.lock() as lock:
+ state.wlock = wlock
+ state.lock = lock
+ opts = {'keep':state.keep}
+ fm = ui.formatter('histedit', opts)
+ fm.startitem()
+ state.read()
+ state = bootstrapcontinue(ui, state, opts)
+ _continuehistedit(ui, repo, state)
+ _finishhistedit(ui, repo, state, fm)
+ fm.end()
+
def _finishhistedit(ui, repo, state, fm):
"""This action runs when histedit is finishing its session"""
hg.updaterepo(repo, state.parentctxnode, overwrite=False)
@@ -2322,5 +2336,6 @@
def extsetup(ui):
cmdutil.summaryhooks.add('histedit', summaryhook)
statemod.addunfinished('histedit', fname='histedit-state', allowcommit=True,
- continueflag=True, abortfunc=hgaborthistedit)
-
+ continueflag=True, abortfunc=hgaborthistedit,
+ continuefunc=hgcontinuehistedit)
+
To: taapas1128, durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list