Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the correct way to merge/transform a dev branch into a stable branch in Mercurial?

I work for a web development company that uses Mercurial as its DVCS of choice. We're currently in the process of creating a new version of a site that is already in production.

Both a stable and a development branch of the site exist in the same repository. The production site runs off the stable branch, and developers obviously code against the development (dev from now on) branch (apart from bugfixes).

This model is quite new to us. After the last major production push, we created the development branch from the just-released stable branch (using hg branch dev from the latest stable revision and committing to create a new tip).

A significant amount of new code exists in the dev branch now that we're nearing another release. Meanwhile, the stable branch has only seen bugfixes, all that have been ported over to the dev branch already.

When we're satisfied with the state of the dev branch and deem it production-ready, what we'd like is for the then-current state of the dev branch to become the new stable branch. In one swift stroke, the stable branch would assimilate the tons of changes that have been made to the dev branch. The dev branch would (we assume) essentially become inactive, until such a time that we start developing new stuff again.

What is the correct process for actually achieving this? A simple merge from the tip of dev while having the tip of the stable branch checked out, or something else? As I said, all changes to stable already exist in dev, so we're okay with dev just becoming stable as-is.

And once the mystical transmogrification of dev into stable has been done and the result has been tagged, what's the process of beginning further development on the dev branch again, since after a merge into stable it won't have an active tip to check out? Just check out the last dev revision prior to the merge and commit on top of that to create the new tip? That seems wrong; my gut instinct tells me that the "new dev" should be spun off of the merged & tagged tip of the stable branch, but I don't know how that's done. (As said, last time we did this by creating the named dev branch in the first place; this time we just want to create a new tip to the existing, though probably inactive-post-merge dev branch)

Simple questions to anyone who is more accustomed to distributed version control and Mercurial, but it's not too long since we left SVN-land and things are still a bit hazy. Any help is appreciated.

like image 307
JK Laiho Avatar asked Apr 26 '10 17:04

JK Laiho


People also ask

How do I merge branches in Mercurial?

To merge two branches, you pull their heads into the same repository, update to one of them and merge the other, and then commit the result once you're happy with the merge. The resulting changeset has two parents.

What is mercurial default branch?

Mercurial's main branch is called "default" and is analogous to "trunk" in SVN, "HEAD" in CVS, and "master" in Git. If you try to use some other name for your "main" branch, users will get a more or less random branch when they clone and commit things in the wrong place, which is generally undesirable.


1 Answers

If the development branch has all additions you've made to your stable branch, and the development branch is ready to be the new stable branch, you could just branch a new stable branch of the development branch. The old stable branch could be kept around as is in case users of the legacy code need a hotfix.

like image 135
Frank Schwieterman Avatar answered Nov 03 '22 11:11

Frank Schwieterman