Mercurial: what are the consequences of a phase change?

In Mercurial, the revision phase can be changed arbitrarily. What are the consequences of changing the phase for all possible transitions (public, project, secret) x (public, project, secret)? What phase changes are safe? What can cause problems and what problems? What are more or less no-ops?

+8
mercurial phase
source share
2 answers

The default phase for commit is draft , that they were processed when no phases existed. When you click the draft changeset, Mercury automatically changes its phase to public . You can use it to find out what changes you have already posted or not.

But the real problem is that when the changeset is in the public phase, mercurial will not let you change them with history editing extensions (e.g. mq , rebase , etc.). This is very important, because editing history only occurs in the local repository, they are not distributed using pull / push operations. Thus, after the publication of a set of changes, it gets out of control, it is dangerous to change it.

You can go from any phase to any other phase. A "normal stream" is a transition to a higher phase (secret-> draft-> public), but Mercurial allows you to switch to a lower phase with the --force option. Phase change alone is harmless. For example, the only thing that happens when switching from public to draft or secret is that protection for editing history is discarded, nothing else, pull and push will not work fine, Mercurial can never be confused because they have unique identifiers. A story editing action that occurs after a phase change like this can cause problems. And that's why Mercurial gives a warning when the phase changes and requires the --force option, as confirmation of what you really want.

In general, published commits do not change, which is what the phases are trying to provide. But perhaps you have control over all the repositories. Or maybe you pushed something, and you know that no one has pulled it yet. Whatever the reason, you have the option to force the phase of the change sets back into the draft and edit them. But this edition has to be done in every repository with changesets.

+9
source share
  • A public revision cannot be edited using history editing tools (i.e. mq , rebase ).
  • A secret revision cannot be transferred to another repository (it will be ignored when a push command is issued or when another repository is tried).
  • The project editor allows both, but will automatically change to public if it is redirected to another repository.

The purpose of the phase system is to prevent you from changing the revision after you move it to another repository, which is a bad idea if you cannot delete the old version of the revision from all the repositories that it was clicked on.

All phase changes are more or less unnecessary; it is just a marker to indicate what is or is not safe to do with the revision.

+5
source share

All Articles