# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1515492587 -19800 # Node ID be41e4740a258053e7c14fb9d9a8574505b58cde # Parent b3be4797d3c6fd4d432e2362ba62d3457bf089c0 evolve: use phases.new-commit config to retain phase information (issue5720) Since the previous patches replaced the use of graftstate with evolvestate and we don't graft anymore on evolve --continue, we have now the capability to fix underlying bugs. This patch makes sure we use the phases.new-commit config to make a new commit of the same phase as that of the predecessor. Tests added in the previous patch shows the bug being fixed. diff -r b3be4797d3c6 -r be41e4740a25 CHANGELOG --- a/CHANGELOG Tue Jan 09 15:33:57 2018 +0530 +++ b/CHANGELOG Tue Jan 09 15:39:47 2018 +0530 @@ -15,6 +15,8 @@ dropped, please update both clients and servers. The new approach is still hidden behind and experimental flag for now. + * preserve phase information during interrupted `hg evolve` (issue5720) + topic (0.7.1) 7.1.1 - in progress diff -r b3be4797d3c6 -r be41e4740a25 hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Tue Jan 09 15:33:57 2018 +0530 +++ b/hgext3rd/evolve/__init__.py Tue Jan 09 15:39:47 2018 +0530 @@ -1598,8 +1598,13 @@ message = ctx.description() ui.status(_('evolving %d:%s "%s"\n') % (ctx.rev(), ctx, message.split('\n', 1)[0])) - node = repo.commit(text=message, user=user, - date=date, extra=extra) + targetphase = max(ctx.phase(), phases.draft) + overrides = {('phases', 'new-commit'): targetphase} + + with repo.ui.configoverride(overrides, 'evolve-continue'): + node = repo.commit(text=message, user=user, + date=date, extra=extra) + obsolete.createmarkers(repo, [(ctx, (repo[node],))]) _evolvestatedelete(repo) return diff -r b3be4797d3c6 -r be41e4740a25 tests/test-evolve-phase.t --- a/tests/test-evolve-phase.t Tue Jan 09 15:33:57 2018 +0530 +++ b/tests/test-evolve-phase.t Tue Jan 09 15:39:47 2018 +0530 @@ -107,9 +107,8 @@ $ hg evolve -c evolving 2:13833940840c "c" -XXX: Here 4 should be having secret phase just as same as 2 $ hg glog - @ 4 - 3d2080c198e5 c (draft) + @ 4 - 3d2080c198e5 c (secret) | o 3 - 87495ea7c9ec b (draft) | diff -r b3be4797d3c6 -r be41e4740a25 tests/test-issue-5720.t --- a/tests/test-issue-5720.t Tue Jan 09 15:33:57 2018 +0530 +++ b/tests/test-issue-5720.t Tue Jan 09 15:39:47 2018 +0530 @@ -77,11 +77,11 @@ Tip should stay in secret phase $ hg log -G -T "{rev}: {phase}" - @ 4: draft + @ 4: secret | o 3: draft | o 0: draft $ hg log -r . -T '{phase}\n' - draft + secret