D6678: continue: added support for histedit
taapas1128 added a comment. @pulkit This one is ready too. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6678/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6678 To: taapas1128, durin42, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6678: continue: added support for histedit
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=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 #endif +#if continueflag + $ cat >> $HGRCPATH < [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 ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6678: continue: added support for histedit
pulkit added inline comments. INLINE COMMENTS > histedit.py:1842 > > +def hgcontinuehistedit(ui, repo): > +state = histeditstate(repo) I see that we can have a unified function, `resumehistedit(..)` which can be called from `_histedit()` too. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6678/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6678 To: taapas1128, durin42, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6678: continue: added support for histedit
taapas1128 updated this revision to Diff 16019. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6678?vs=16018=16019 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 #endif +#if continueflag + $ cat >> $HGRCPATH < [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 ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6678: continue: added support for histedit
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 #endif +#if continueflag + $ cat >> $HGRCPATH < [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 ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel