For a little software development, I would like the changes to fit a specific process, as a result of which the integration branch would contain only “complete” changes. The idea stems from a blog post about getting useful history magazines from Mercurial. However, this is not only about creating magazines, but also about a structured way of working.
In general, the idea is that there will be an “integration” branch in the repository that will not directly develop, instead, any work will be performed on another branch, and when the full one is merged into the integration branch - below is an example with comments in braces:
O {Implemented new feature X} |\ | O {...} | | | O {...} |/ O {Fixed bug 002} |\ | O {...} |/ O {added tag "Release 1.0"} | O {Fixed bug 001} |\ | O {...} |/ O -- integration branch / O -- default branch
An “integration” branch could only come together and tag.
This is similar to how we work on development (on a server system other than DVCS), where you make changes to your work branch, and when you complete (and check, check, ...), you merge these changes into a branch integration, for formal testing and release.
In any case, my question is: how should I apply the policy of making changes only to the work branch, and on the integration branch we only allow merging or tagging?
My initial thought was to add a hook to pre-commit ( not precommit or pretxncommit , since I believe that they fire when you, for example, create a tag). The hook will verify that if you were on an integration branch, there are two parents, that is, it is the result of a merge, and it fails if it is not.
However, as I understand it, hooks are not copied when cloning a repository. Since this will be a project-specific parameter, it should not be set at the user level. So, how can I prevent a user from cloning a repository (thus losing hooks) by making changes directly to the integration branch and then clicking?
hg clone main_repo hg update integration_branch (make changes without starting a new branch) hg commit -m "I made some changes" hg push
Also, how can I apply this when using a system like Bitbucket?
Alternatively, is this not the right approach to workflow when using DVCS?