If you're using branches, you can set their visibility to secret
. This will prevent them to be pushed.
hg phase --secret --force my-branch
When you want to share, you change their phase to draft
and then they will be automatically collected during a push operation.
See hg help phases
for more information.