D6689: continue: added support for transplant
Closed by commit rHG0a4303c77637: continue: added support for transplant (authored by taapas1128). This revision was automatically updated to reflect the committed changes. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6689?vs=16161&id=16169 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6689/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6689 AFFECTED FILES hgext/transplant.py tests/test-transplant.t CHANGE DETAILS diff --git a/tests/test-transplant.t b/tests/test-transplant.t --- a/tests/test-transplant.t +++ b/tests/test-transplant.t @@ -1,8 +1,16 @@ +#testcases commandmode continueflag $ cat <> $HGRCPATH > [extensions] > transplant= > EOF +#if continueflag + $ cat >> $HGRCPATH < [alias] + > continue = transplant --continue + > EOF +#endif + $ hg init t $ cd t $ hg transplant @@ -424,8 +432,9 @@ updated to "e8643552fde5: foobar" 1 other heads for branch "default" $ rm added - $ hg transplant --continue - abort: no transplant to continue + $ hg continue + abort: no transplant to continue (continueflag !) + abort: no operation in progress (no-continueflag !) [255] $ hg transplant 1 applying 46ae92138f3c @@ -492,7 +501,7 @@ # To abort: hg update $ echo fixed > baz - $ hg transplant --continue + $ hg continue 9d6d6b5a8275 transplanted as d80c49962290 applying 1dab759070cf 1dab759070cf transplanted to aa0ffe6bd5ae @@ -881,7 +890,7 @@ [255] $ hg status ? b.rej - $ hg transplant --continue + $ hg continue 645035761929 skipped due to empty diff $ cd .. diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -734,6 +734,13 @@ if cleanupfn: cleanupfn() +def continuecmd(ui, repo): +"""logic to resume an interrupted transplant using +'hg continue'""" +with repo.wlock(): +tp = transplanter(ui, repo, {}) +return tp.resume(repo, repo, {}) + revsetpredicate = registrar.revsetpredicate() @revsetpredicate('transplanted([set])') @@ -760,6 +767,7 @@ def extsetup(ui): statemod.addunfinished ( 'transplant', fname='transplant/journal', clearable=True, +continuefunc=continuecmd, statushint=_('To continue:hg transplant --continue\n' 'To abort: hg update'), cmdhint=_("use 'hg transplant --continue' or 'hg update' to abort") To: taapas1128, #hg-reviewers, pulkit Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6689: continue: added support for transplant
taapas1128 marked an inline comment as done. taapas1128 updated this revision to Diff 16161. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6689?vs=16158&id=16161 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6689/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6689 AFFECTED FILES hgext/transplant.py tests/test-transplant.t CHANGE DETAILS diff --git a/tests/test-transplant.t b/tests/test-transplant.t --- a/tests/test-transplant.t +++ b/tests/test-transplant.t @@ -1,8 +1,16 @@ +#testcases commandmode continueflag $ cat <> $HGRCPATH > [extensions] > transplant= > EOF +#if continueflag + $ cat >> $HGRCPATH < [alias] + > continue = transplant --continue + > EOF +#endif + $ hg init t $ cd t $ hg transplant @@ -424,8 +432,9 @@ updated to "e8643552fde5: foobar" 1 other heads for branch "default" $ rm added - $ hg transplant --continue - abort: no transplant to continue + $ hg continue + abort: no transplant to continue (continueflag !) + abort: no operation in progress (no-continueflag !) [255] $ hg transplant 1 applying 46ae92138f3c @@ -492,7 +501,7 @@ # To abort: hg update $ echo fixed > baz - $ hg transplant --continue + $ hg continue 9d6d6b5a8275 transplanted as d80c49962290 applying 1dab759070cf 1dab759070cf transplanted to aa0ffe6bd5ae @@ -881,7 +890,7 @@ [255] $ hg status ? b.rej - $ hg transplant --continue + $ hg continue 645035761929 skipped due to empty diff $ cd .. diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -734,6 +734,13 @@ if cleanupfn: cleanupfn() +def continuecmd(ui, repo): +"""logic to resume an interrupted transplant using +'hg continue'""" +with repo.wlock(): +tp = transplanter(ui, repo, {}) +return tp.resume(repo, repo, {}) + revsetpredicate = registrar.revsetpredicate() @revsetpredicate('transplanted([set])') @@ -760,6 +767,7 @@ def extsetup(ui): statemod.addunfinished ( 'transplant', fname='transplant/journal', clearable=True, +continuefunc=continuecmd, statushint=_('To continue:hg transplant --continue\n' 'To abort: hg update'), cmdhint=_("use 'hg transplant --continue' or 'hg update' to abort") To: taapas1128, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6689: continue: added support for transplant
pulkit added inline comments. INLINE COMMENTS > transplant.py:737 > > +def continuetransplant(ui, repo): > +"""logic to resume an interrupted transplant using let's name this function `continue` only as it's in transplant.py and a continue implies that we are continuing transplant. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6689/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6689 To: taapas1128, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6689: continue: added support for transplant
taapas1128 updated this revision to Diff 16158. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6689?vs=16043&id=16158 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6689/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6689 AFFECTED FILES hgext/transplant.py tests/test-transplant.t CHANGE DETAILS diff --git a/tests/test-transplant.t b/tests/test-transplant.t --- a/tests/test-transplant.t +++ b/tests/test-transplant.t @@ -1,8 +1,16 @@ +#testcases commandmode continueflag $ cat <> $HGRCPATH > [extensions] > transplant= > EOF +#if continueflag + $ cat >> $HGRCPATH < [alias] + > continue = transplant --continue + > EOF +#endif + $ hg init t $ cd t $ hg transplant @@ -424,8 +432,9 @@ updated to "e8643552fde5: foobar" 1 other heads for branch "default" $ rm added - $ hg transplant --continue - abort: no transplant to continue + $ hg continue + abort: no transplant to continue (continueflag !) + abort: no operation in progress (no-continueflag !) [255] $ hg transplant 1 applying 46ae92138f3c @@ -492,7 +501,7 @@ # To abort: hg update $ echo fixed > baz - $ hg transplant --continue + $ hg continue 9d6d6b5a8275 transplanted as d80c49962290 applying 1dab759070cf 1dab759070cf transplanted to aa0ffe6bd5ae @@ -881,7 +890,7 @@ [255] $ hg status ? b.rej - $ hg transplant --continue + $ hg continue 645035761929 skipped due to empty diff $ cd .. diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -734,6 +734,13 @@ if cleanupfn: cleanupfn() +def continuetransplant(ui, repo): +"""logic to resume an interrupted transplant using +'hg continue'""" +with repo.wlock(): +tp = transplanter(ui, repo, {}) +return tp.resume(repo, repo, {}) + revsetpredicate = registrar.revsetpredicate() @revsetpredicate('transplanted([set])') @@ -760,6 +767,7 @@ def extsetup(ui): statemod.addunfinished ( 'transplant', fname='transplant/journal', clearable=True, +continuefunc=continuetransplant, statushint=_('To continue:hg transplant --continue\n' 'To abort: hg update'), cmdhint=_("use 'hg transplant --continue' or 'hg update' to abort") To: taapas1128, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6689: continue: added support for transplant
pulkit added inline comments. INLINE COMMENTS > transplant.py:743 > +tp = transplanter(ui, repo, opts) > +tp.resume(repo, repo, opts) > +return I don't see `transplanter` modifying opts. So we can directly pass empty dict in both of the above function. > transplant.py:744 > +tp.resume(repo, repo, opts) > +return > + `return tp.resume(..)` will be better here REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6689/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6689 To: taapas1128, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6689: continue: added support for transplant
taapas1128 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This creates a seperate function `continuetransplant()` containing logic for resuming transplant from interrupted state. `continuetransplant()` is then registered as `continuefunc` for state detection API. Results are shown in tests. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6689 AFFECTED FILES hgext/transplant.py tests/test-transplant.t CHANGE DETAILS diff --git a/tests/test-transplant.t b/tests/test-transplant.t --- a/tests/test-transplant.t +++ b/tests/test-transplant.t @@ -1,8 +1,16 @@ +#testcases commandmode continueflag $ cat <> $HGRCPATH > [extensions] > transplant= > EOF +#if continueflag + $ cat >> $HGRCPATH < [alias] + > continue = transplant --continue + > EOF +#endif + $ hg init t $ cd t $ hg transplant @@ -424,8 +432,9 @@ updated to "e8643552fde5: foobar" 1 other heads for branch "default" $ rm added - $ hg transplant --continue - abort: no transplant to continue + $ hg continue + abort: no transplant to continue (continueflag !) + abort: no operation in progress (no-continueflag !) [255] $ hg transplant 1 applying 46ae92138f3c @@ -492,7 +501,7 @@ # To abort: hg update $ echo fixed > baz - $ hg transplant --continue + $ hg continue 9d6d6b5a8275 transplanted as d80c49962290 applying 1dab759070cf 1dab759070cf transplanted to aa0ffe6bd5ae @@ -881,7 +890,7 @@ [255] $ hg status ? b.rej - $ hg transplant --continue + $ hg continue 645035761929 skipped due to empty diff $ cd .. diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -734,6 +734,15 @@ if cleanupfn: cleanupfn() +def continuetransplant(ui, repo): +"""logic to resume an interrupted transplant using +'hg continue'""" +with repo.wlock(): +opts = {} +tp = transplanter(ui, repo, opts) +tp.resume(repo, repo, opts) +return + revsetpredicate = registrar.revsetpredicate() @revsetpredicate('transplanted([set])') @@ -760,6 +769,7 @@ def extsetup(ui): statemod.addunfinished ( 'transplant', fname='transplant/journal', clearable=True, +continuefunc=continuetransplant, statushint=_('To continue:hg transplant --continue\n' 'To abort: hg update'), cmdhint=_("use 'hg transplant --continue' or 'hg update' to abort") To: taapas1128, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel