diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -843,8 +843,9 @@ class queue(object): if qfinished and repo.ui.configbool('mq', 'secret', False): # only use this logic when the secret option is added oldqbase = repo[qfinished[0]] - if oldqbase.p1().phase() < phases.secret: - phases.advanceboundary(repo, phases.draft, qfinished) + tphase = repo.ui.config('phases', 'new-commit', phases.draft) + if oldqbase.phase() > tphase and oldqbase.p1().phase() <= tphase: + phases.advanceboundary(repo, tphase, qfinished) def delete(self, repo, patches, opts): if not patches and not opts.get('rev'): diff --git a/tests/test-mq.t b/tests/test-mq.t --- a/tests/test-mq.t +++ b/tests/test-mq.t @@ -1474,6 +1474,22 @@ Test that qfinish change phase when mq.s 1: secret 2: secret +Test that qfinish respect phases.new-commit setting + + $ echo '[phases]' >> $HGRCPATH + $ echo 'new-commit=secret' >> $HGRCPATH + $ hg qfinish qbase + patch add-file2 finalized without changeset message + $ hg phase 'all()' + 0: draft + 1: secret + 2: secret + +(restore env for next test) + + $ sed -i.bak -e 's/new-commit=secret//' $HGRCPATH + $ hg qimport -r 1 --name add-file2 + Test that qfinish preserve phase when mq.secret=false $ sed -i.bak -e 's/secret=true/secret=false/' $HGRCPATH