D6678: continue: added support for histedit
taapas1128 (Taapas Agrawal)
phabricator at mercurial-scm.org
Thu Aug 8 16:12:19 UTC 2019
taapas1128 marked an inline comment as done.
taapas1128 updated this revision to Diff 16157.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D6678?vs=16019&id=16157
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D6678/new/
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
@@ -1781,8 +1781,7 @@
raise error.Abort(_('histedit cancelled\n'))
# rebuild state
if goal == goalcontinue:
- state.read()
- state = bootstrapcontinue(ui, state, opts)
+ return resumehistedit(ui, repo, state)
elif goal == goaleditplan:
_edithisteditplan(ui, repo, state, rules)
return
@@ -1839,6 +1838,21 @@
state.write()
+def resumehistedit(ui, repo, state=None):
+ if not state:
+ 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=resumehistedit)
+
To: taapas1128, durin42, #hg-reviewers
Cc: pulkit, mercurial-devel
More information about the Mercurial-devel
mailing list