# HG changeset patch # User Pierre-Yves David # Date 1327933028 -3600 # Node ID ee1c8385e5b0b4d080cfa28460bf36c57f3e6e92 # Parent 922c0e9b40be7877224359aef6e67e2bb9659c72 qfinish: do not set secret changeset to draft if mq.secret=false If mq.secret=false, mq should not touch phase diff -r 922c0e9b40be -r ee1c8385e5b0 hgext/mq.py --- a/hgext/mq.py Mon Jan 30 17:39:05 2012 +0100 +++ b/hgext/mq.py Mon Jan 30 15:17:08 2012 +0100 @@ -826,9 +826,13 @@ return patches def finish(self, repo, revs): + # Manually trigger phase computation to ensure phasedefaults is + # executed before we remove the patches. + repo._phaserev patches = self._revpatches(repo, sorted(revs)) qfinished = self._cleanup(patches, len(patches)) - if qfinished: + 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) diff -r 922c0e9b40be -r ee1c8385e5b0 tests/test-mq.t --- a/tests/test-mq.t Mon Jan 30 17:39:05 2012 +0100 +++ b/tests/test-mq.t Mon Jan 30 15:17:08 2012 +0100 @@ -1464,3 +1464,22 @@ 0: secret 1: secret 2: secret + +Test that qfinish change phase when mq.secret=true + + $ hg qfinish qbase + patch add-file1 finalized without changeset message + $ hg phase 'all()' + 0: draft + 1: secret + 2: secret + +Test that qfinish preserve phase when mq.secret=false + + $ sed -i'' $HGRCPATH -e 's/secret=true/secret=false/' + $ hg qfinish qbase + patch add-file2 finalized without changeset message + $ hg phase 'all()' + 0: draft + 1: secret + 2: secret