Project Management with Mercurial Branches
On Tuesday, Jonathan, Eddie and I had a little discussion about the project management of our code—especially after we have our golden version. I played with some of the ideas with these Mercurial extensions: branches, tags, graphic log view and transplant. The following summarized some of my tries.
Introduction to Our new Mercurial tools
- hg branch: create a branch under the same repository and check with branch you are working with. Users can specify which branch he/she wants to pull the code from
- hg tag: attach a tag to a revision. will create a new revision. Seems cannot attach a tag to individual files.
- hg glog or hg view: view the whole developing tree/revision structure
- hg transplant: cherry-picking the code
Schemes of Project Management
According to Karl Fogel's book which can be found at http://producingoss.com/. Especially Chapter 7 - Packaging, Release and Daily Development; The Release Branches Section, I think two branches work better than one and taking a snapshot of the tree is not a good way to get a stable version. Two branches can balance well on checking in the developer's effort as soon as possible and lowering the risk of checking in controversial/unstable code.
- Default branch/trunk: for development mainline, every developer can check in his/her code as long as it passes our NEW strong testing suite.
- A Release Candidate Branch: only check in clean and ready code (including bug fixing) which means
- Pass our NEW strong testing suite
- No controversial opinions from other developers
- All developers agree on checking to that release.
- Developers should update his/code developing branch frequently to the trunk — several times a day according to Karl Fogel.
We can have more branches like branches for release 1.0 and release 2.0. And with Mercurial-transplant, bug-fixing for 1.0 only can be cherry picked from the trunk to 1.0 branch only (Examples shown below).
My originally thinking was to create a branch under the same repository for each developer. The with hg glog or hg view, the developing tree of our whole group can be easily seen. But one thing, this tree could be very complicated. And people could easily get confused which branch he/she is working on (See the example for Scheme I).
The second thing I tried was to make two branches under the same repo. This was basically Jonathan's idea. Though the check-in procedures of the two branches were based on what I mentioned above, which was different from Jonathan's way. This scheme worked OK. The tree could be messed up a bit when I made mistake cherry-picking code. (revision 15 in the example for Scheme II)
The third scheme I tried was to have two branches in two repos: one for developing, one for release — could have more if we have more release candidates. This one we had much clear, separate and different though, tree structures for the two branches. cherry-picking was easier. I did make a mistake cherry-picking the code when I tried, but it didn't show in the developing tree (See the example for Scheme III).
Both the latter two are used in open source software project management according to Karl Fogel. And all three schemes can be realized with Mercurial.
Schemes | Pros | Cons | |
---|---|---|---|
I | 1. Branches under the same repository 2. Default branch/trunk for Development mainline 3. Individual Branches for each developer 4. Release branch for stable version | With single hg command, development structure/stage of our whole group can easily be seen. So it's easy to check the each developer's development revision so his/her branch won't lag behind too far | 1.Too many branches to handle under the repository so very easy to update the wrong branch 2. Developers could easily pull the whole repo instead of his own branch. |
II | 1. Branches under the same repository 2. Default branch/trunk for Development mainline 3. Release branch for stable version | 1. Fairly simple revision structures. 2. Clear view of the developing line and stable version | Wrong Cherry picking to the release branch could mess up a bit the whole repo revision structure |
III | Release Branch and Default branch are under different repo | Very clean revision structure for the trunk and especially for the release branch | No view of the whole revision structure |
- Scheme 1
o changeset: 14:7e05196f1647 |\ tag: tip | | parent: 12:d07c7f335631 | | parent: 13:567d336f6d7a | | user: bliu <bliu@pas.rochester.edu> | | date: Thu Jul 26 13:23:44 2012 -0400 | | summary: Shule merge his branch to trunk | | | o changeset: 13:567d336f6d7a | | branch: shule | | parent: 11:5935bfa52647 | | user: bliu <bliu@pas.rochester.edu> | | date: Thu Jul 26 13:22:27 2012 -0400 | | summary: shule added feature 2 | | o | changeset: 12:d07c7f335631 |\| parent: 7:75d40ef53d13 | | parent: 11:5935bfa52647 | | user: bliu <bliu@pas.rochester.edu> | | date: Thu Jul 26 13:19:05 2012 -0400 | | summary: Shule merged his branch with trunk/developing branch | | | o changeset: 11:5935bfa52647 | | branch: shule | | parent: 8:ec480f53ab7f | | user: bliu <bliu@pas.rochester.edu> | | date: Thu Jul 26 13:16:57 2012 -0400 | | summary: created module 2 by shule | | | | o changeset: 10:c160040af250 | | | branch: 1.0.x | | | user: bliu <bliu@pas.rochester.edu> | | | date: Thu Jul 26 13:14:18 2012 -0400 | | | summary: Added tag RELEASE_1_0_X for changeset f37e3dfa00ff | | | +---o changeset: 9:f37e3dfa00ff | | branch: 1.0.x | | tag: RELEASE_1_0_X | | parent: 7:75d40ef53d13 | | user: bliu <bliu@pas.rochester.edu> | | date: Thu Jul 26 12:06:15 2012 -0400 | | summary: Created branch for release 1.0 | | | o changeset: 8:ec480f53ab7f |/| branch: shule | | parent: 3:ffed79d15d20 | | parent: 7:75d40ef53d13 | | user: bliu <bliu@pas.rochester.edu> | | date: Thu Jul 26 12:00:14 2012 -0400 | | summary: Shule merged with the developing/default branch | | o | changeset: 7:75d40ef53d13 |\ \ parent: 4:ecfeaa2d72e6 | | | parent: 6:61b0ac6b5c20 | | | user: bliu <bliu@pas.rochester.edu> | | | date: Thu Jul 26 11:56:58 2012 -0400 | | | summary: Eddie merged feature 1 to the developing/default branch | | | | @ | changeset: 6:61b0ac6b5c20 | | | branch: eddie | | | user: bliu <bliu@pas.rochester.edu> | | | date: Thu Jul 26 11:55:17 2012 -0400 | | | summary: Eddie added feature1 | | | | o | changeset: 5:55e842fae920 |/| | branch: eddie | | | parent: 2:0fb3775dcc73 | | | parent: 4:ecfeaa2d72e6 | | | user: bliu <bliu@pas.rochester.edu> | | | date: Thu Jul 26 11:41:25 2012 -0400 | | | summary: Eddie merged with the developing/default branch | | | o---+ changeset: 4:ecfeaa2d72e6 | | | parent: 0:c70162535253 | | | parent: 3:ffed79d15d20 | | | user: bliu <bliu@pas.rochester.edu> | | | date: Thu Jul 26 11:35:16 2012 -0400 | | | summary: Merged with Shule's branch | | | | | o changeset: 3:ffed79d15d20 | | | branch: shule | | | parent: 1:d145928ca80e | | | user: bliu <bliu@pas.rochester.edu> | | | date: Thu Jul 26 11:31:06 2012 -0400 | | | summary: Shule's 1st modification to Module 1 | | | | o | changeset: 2:0fb3775dcc73 |/ / branch: eddie | | parent: 0:c70162535253 | | user: bliu <bliu@pas.rochester.edu> | | date: Thu Jul 26 11:26:57 2012 -0400 | | summary: Created Branch for Eddie | | | o changeset: 1:d145928ca80e |/ branch: shule | user: bliu <bliu@pas.rochester.edu> | date: Thu Jul 26 11:26:28 2012 -0400 | summary: Created Branch for Shule | o changeset: 0:c70162535253 user: bliu <bliu@pas.rochester.edu> date: Thu Jul 26 11:25:49 2012 -0400 summary: Initial commit of TAstroBEAR
- Scheme II
@ changeset: 19:c687cd2b699d |\ branch: 1.0.X | | tag: tip | | parent: 16:3d2c4134f5e6 | | parent: 17:b8e25dc8c496 | | user: bliu <bliu@pas.rochester.edu> | | date: Thu Jul 26 16:32:18 2012 -0400 | | summary: Eddie fixed a bug in module 1 | | | | o changeset: 18:d95fe8c2bae7 | |/| parent: 17:b8e25dc8c496 | | | parent: 13:250de7722735 | | | user: bliu <bliu@pas.rochester.edu> | | | date: Thu Jul 26 17:36:04 2012 -0400 | | | summary: Eddie merged his branch with bugfixing in module 1 with trunk | | | | o | changeset: 17:b8e25dc8c496 | | | parent: 11:257c587657ca | | | user: bliu <bliu@pas.rochester.edu> | | | date: Thu Jul 26 16:32:18 2012 -0400 | | | summary: Eddie fixed a bug in module 1 | | | o---+ changeset: 16:3d2c4134f5e6 | | | branch: 1.0.X | | | parent: 15:750c823af31f | | | parent: 13:250de7722735 | | | user: bliu <bliu@pas.rochester.edu> | | | date: Thu Jul 26 16:37:23 2012 -0400 | | | summary: Shule fixed a bug in feature 1 | | | o | | changeset: 15:750c823af31f | | | branch: 1.0.X | | | user: bliu <bliu@pas.rochester.edu> | | | date: Thu Jul 26 17:22:19 2012 -0400 | | | summary: backout the mis cherrypicking from the default branch | | | o | | changeset: 14:c8d8de75b020 | | | branch: 1.0.X | | | parent: 12:0b29e0bacf7d | | | user: bliu <bliu@pas.rochester.edu> | | | date: Thu Jul 26 15:33:31 2012 -0400 | | | summary: Eddie modified the feature1.f90 | | | | | o changeset: 13:250de7722735 | |/ parent: 11:257c587657ca | | user: bliu <bliu@pas.rochester.edu> | | date: Thu Jul 26 16:37:23 2012 -0400 | | summary: Shule fixed a bug in feature 1 | | o | changeset: 12:0b29e0bacf7d | | branch: 1.0.X | | parent: 6:cd151c2100ad | | user: bliu <bliu@pas.rochester.edu> | | date: Thu Jul 26 16:30:23 2012 -0400 | | summary: Eddie modified feature 1 | | | o changeset: 11:257c587657ca | |\ parent: 10:a22779a560a7 | | | parent: 9:ae21e6d2d4ba | | | user: bliu <bliu@pas.rochester.edu> | | | date: Thu Jul 26 15:43:15 2012 -0400 | | | summary: Eddie merge his branch with the main branch | | | | | o changeset: 10:a22779a560a7 | | | parent: 7:cf843a15dbf1 | | | user: bliu <bliu@pas.rochester.edu> | | | date: Thu Jul 26 15:33:31 2012 -0400 | | | summary: Eddie modified the feature1.f90 | | | | o | changeset: 9:ae21e6d2d4ba | |\| parent: 8:94bdb895f471 | | | parent: 7:cf843a15dbf1 | | | user: bliu <bliu@pas.rochester.edu> | | | date: Thu Jul 26 15:39:53 2012 -0400 | | | summary: merged after putting the tag RELEASE_2_0_X | | | | o | changeset: 8:94bdb895f471 | | | parent: 4:46982b65c965 | | | user: bliu <bliu@pas.rochester.edu> | | | date: Thu Jul 26 15:30:45 2012 -0400 | | | summary: Added tag module2.f90, RELEASE_2_0_X for changeset 46982b65c965 | | | | | o changeset: 7:cf843a15dbf1 | |/ parent: 4:46982b65c965 | | user: bliu <bliu@pas.rochester.edu> | | date: Thu Jul 26 15:08:58 2012 -0400 | | summary: Shule created module 2 | | o | changeset: 6:cd151c2100ad | | branch: 1.0.X | | user: bliu <bliu@pas.rochester.edu> | | date: Thu Jul 26 15:04:21 2012 -0400 | | summary: Added tag RELEASE_1_0_X for changeset 115372a64138 | | o | changeset: 5:115372a64138 |/ branch: 1.0.X | tag: RELEASE_1_0_X | user: bliu <bliu@pas.rochester.edu> | date: Thu Jul 26 15:03:31 2012 -0400 | summary: created a branch for 1.0.X | o changeset: 4:46982b65c965 |\ tag: RELEASE_2_0_X | | tag: module2.f90 | | parent: 3:bc41a66a492a | | parent: 2:3d05829cc1c1 | | user: bliu <bliu@pas.rochester.edu> | | date: Thu Jul 26 15:01:45 2012 -0400 | | summary: Shule merged his branch with the trunk | | | o changeset: 3:bc41a66a492a | | parent: 1:cab73a420c5b | | user: bliu <bliu@pas.rochester.edu> | | date: Thu Jul 26 15:01:03 2012 -0400 | | summary: Shule's 2nd modification to Module 1 | | o | changeset: 2:3d05829cc1c1 |/ user: bliu <bliu@pas.rochester.edu> | date: Thu Jul 26 14:54:08 2012 -0400 | summary: Eddie added feature 1 | o changeset: 1:cab73a420c5b | user: bliu <bliu@pas.rochester.edu> | date: Thu Jul 26 14:00:31 2012 -0400 | summary: Shule's 1st modification to module1.f90 | o changeset: 0:096f4d37e0fd user: bliu <bliu@pas.rochester.edu> date: Thu Jul 26 13:59:23 2012 -0400 summary: Initial commit of TAstroBEAR
- Scheme III
- trunk
@ changeset: 11:320adc42a728 | tag: tip | user: bliu <bliu@pas.rochester.edu> | date: Fri Jul 27 10:08:26 2012 -0400 | summary: Eddie fixed 1st bug in module 2 | o changeset: 10:ba38a00a54d2 | user: bliu <bliu@pas.rochester.edu> | date: Fri Jul 27 10:07:38 2012 -0400 | summary: Eddie fixed 1st bug in module 1 | o changeset: 9:b0a88811e50d | user: bliu <bliu@pas.rochester.edu> | date: Fri Jul 27 10:04:24 2012 -0400 | summary: Added tag RELEASE_2_0_X for changeset 0a89508c8ca2 | o changeset: 8:0a89508c8ca2 | tag: RELEASE_2_0_X | user: bliu <bliu@pas.rochester.edu> | date: Fri Jul 27 10:03:30 2012 -0400 | summary: Shule created module 2 | o changeset: 7:1b91941fb44b |\ parent: 6:4aac04e39e42 | | parent: 5:957430289152 | | user: bliu <bliu@pas.rochester.edu> | | date: Fri Jul 27 10:01:33 2012 -0400 | | summary: Shule merged his branch with the trunk | | | o changeset: 6:4aac04e39e42 | | parent: 2:d2bb8f24ef20 | | user: bliu <bliu@pas.rochester.edu> | | date: Fri Jul 27 09:51:18 2012 -0400 | | summary: Shule made 2nd modification to module 1 | | o | changeset: 5:957430289152 | | user: bliu <bliu@pas.rochester.edu> | | date: Fri Jul 27 09:52:24 2012 -0400 | | summary: Eddie fixed the 1st bug in feature 1 | | o | changeset: 4:2bf0d822ec6f | | user: bliu <bliu@pas.rochester.edu> | | date: Fri Jul 27 09:49:03 2012 -0400 | | summary: Eddie created feature 2 | | o | changeset: 3:307471c2a37e |/ user: bliu <bliu@pas.rochester.edu> | date: Fri Jul 27 09:44:54 2012 -0400 | summary: Added tag RELEASE_1_0_X for changeset d2bb8f24ef20 | o changeset: 2:d2bb8f24ef20 | tag: RELEASE_1_0_X | user: bliu <bliu@pas.rochester.edu> | date: Fri Jul 27 09:43:34 2012 -0400 | summary: Shule created feature 1 | o changeset: 1:abd9168ebcbc | user: bliu <bliu@pas.rochester.edu> | date: Fri Jul 27 09:40:19 2012 -0400 | summary: Eddie made the 1st modification to module 1 | o changeset: 0:98888bad8a2a user: bliu <bliu@pas.rochester.edu> date: Fri Jul 27 09:38:33 2012 -0400 summary: Initial committment of shceme3
- trunk
- Release Branch 1.0.x
@ changeset: 6:ecb6fe41824f | tag: tip | user: bliu <bliu@pas.rochester.edu> | date: Fri Jul 27 10:07:38 2012 -0400 | summary: Eddie fixed 1st bug in module 1 | o changeset: 5:898bd6d22ad9 | user: bliu <bliu@pas.rochester.edu> | date: Fri Jul 27 09:51:18 2012 -0400 | summary: Shule made 2nd modification to module 1 | o changeset: 4:c4c15931c578 | user: bliu <bliu@pas.rochester.edu> | date: Fri Jul 27 09:52:24 2012 -0400 | summary: Eddie fixed the 1st bug in feature 1 | o changeset: 3:307471c2a37e | user: bliu <bliu@pas.rochester.edu> | date: Fri Jul 27 09:44:54 2012 -0400 | summary: Added tag RELEASE_1_0_X for changeset d2bb8f24ef20 | o changeset: 2:d2bb8f24ef20 | tag: RELEASE_1_0_X | user: bliu <bliu@pas.rochester.edu> | date: Fri Jul 27 09:43:34 2012 -0400 | summary: Shule created feature 1 | o changeset: 1:abd9168ebcbc | user: bliu <bliu@pas.rochester.edu> | date: Fri Jul 27 09:40:19 2012 -0400 | summary: Eddie made the 1st modification to module 1 | o changeset: 0:98888bad8a2a user: bliu <bliu@pas.rochester.edu> date: Fri Jul 27 09:38:33 2012 -0400 summary: Initial committment of shceme3
Comments
No comments.