Development/Workflow/FollowingMainline

How to follow mainline development

Usually when we are developing a feature, we branch off the development mainline branch and start working. When a new commit lands in mainline, pulling it to our branch will cause the creation of a new head. If we haven't shared our branch, then we might want to move the branching point up, as if we branched from the current tip, instead of merging. Here's how we do it with hg rebase.

Example

[mits@localhost f-locsty]$ hg glog -l 5
o  changeset:   334:4c04bbf27474
|  tag:         tip
|  user:        Dimitris Glezos <dimitris@glezos.com>
|  date:        Sun Jul 20 02:00:46 2008 +0300
|  summary:     Fixed CSS icon locality issues, reworked submission page and information pages.
|
o  changeset:   333:77df51768a69
|  user:        Dimitris Glezos <dimitris@glezos.com>
|  date:        Sun Jul 20 01:57:31 2008 +0300
|  summary:     Merge CSS files together
|
o  changeset:   332:c0b80fce8ad4
|  user:        Dimitris Glezos <dimitris@glezos.com>
|  date:        Mon Jul 14 20:52:37 2008 +0300
|  summary:     Lets make stylesheets local. Might need some more tweaking.
|
o  changeset:   331:28cd3d30e66a
|  user:        Dimitris Glezos <dimitris@glezos.com>
|  date:        Sun Jul 20 21:51:30 2008 +0300
|  summary:     Added tag 0.3 for changeset e24c92763271
|
o  changeset:   330:e24c92763271
|  tag:         0.3
|  user:        Dimitris Glezos <dimitris@glezos.com>
|  date:        Sun Jul 20 21:51:00 2008 +0300
|  summary:     Released version 0.3
|

Changesets 332-334 are branched off mainline at 331. You can see this when we pull the new changesets from mainline, which creates a new head from that parent:

[mits@localhost f-locsty]$ hg pull ../b-devel 
pulling from ../b-devel
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
(run 'hg heads' to see heads, 'hg merge' to merge)

[mits@localhost f-locsty]$ hg heads
changeset:   335:48aff4208fff
tag:         tip
parent:      331:28cd3d30e66a
user:        Dimitris Glezos <dimitris@glezos.com>
date:        Thu Jul 24 17:19:48 2008 +0300
summary:     Added Serbian translation by Miloš Komarčević (FH #54)

changeset:   334:4c04bbf27474
user:        Dimitris Glezos <dimitris@glezos.com>
date:        Sun Jul 20 02:00:46 2008 +0300
summary:     Fixed CSS icon locality issues, reworked submission page and information pages.

[mits@localhost f-locsty]$ hg glog -l 5
o  changeset:   335:48aff4208fff
|  tag:         tip
|  parent:      331:28cd3d30e66a
|  user:        Dimitris Glezos <dimitris@glezos.com>
|  date:        Thu Jul 24 17:19:48 2008 +0300
|  summary:     Added Serbian translation by Miloš Komarčević (FH #54)
|
| o  changeset:   334:4c04bbf27474
| |  user:        Dimitris Glezos <dimitris@glezos.com>
| |  date:        Sun Jul 20 02:00:46 2008 +0300
| |  summary:     Fixed CSS icon locality issues, reworked submission page and information pages.
| |
| o  changeset:   333:77df51768a69
| |  user:        Dimitris Glezos <dimitris@glezos.com>
| |  date:        Sun Jul 20 01:57:31 2008 +0300
| |  summary:     Merge CSS files together
| |
| o  changeset:   332:c0b80fce8ad4
|/   user:        Dimitris Glezos <dimitris@glezos.com>
|    date:        Mon Jul 14 20:52:37 2008 +0300
|    summary:     Lets make stylesheets local. Might need some more tweaking.
|
o  changeset:   331:28cd3d30e66a
|  user:        Dimitris Glezos <dimitris@glezos.com>
|  date:        Sun Jul 20 21:51:30 2008 +0300
|  summary:     Added tag 0.3 for changeset e24c92763271
|

Let's rebase those changesets on top of the tip:

[mits@localhost f-locsty]$ hg rebase -b 334
...

(Note: We could also have used something more "safe" like: hg transplant --all --branch 334 && hg strip 332.)

[mits@localhost f-locsty]$ hg glog -l 7
o  changeset:   335:71f57ebce983
|  tag:         tip
|  user:        Dimitris Glezos <dimitris@glezos.com>
|  date:        Sun Jul 20 02:00:46 2008 +0300
|  summary:     Fixed CSS icon locality issues, reworked submission page and information pages.
|
o  changeset:   334:7c562af51bc9
|  user:        Dimitris Glezos <dimitris@glezos.com>
|  date:        Sun Jul 20 01:57:31 2008 +0300
|  summary:     Merge CSS files together
|
o  changeset:   333:bfe9e702689b
|  user:        Dimitris Glezos <dimitris@glezos.com>
|  date:        Mon Jul 14 20:52:37 2008 +0300
|  summary:     Lets make stylesheets local. Might need some more tweaking.
|
o  changeset:   332:48aff4208fff
|  user:        Dimitris Glezos <dimitris@glezos.com>
|  date:        Thu Jul 24 17:19:48 2008 +0300
|  summary:     Added Serbian translation by Miloš Komarčević (FH #54)
|
@  changeset:   331:28cd3d30e66a
|  user:        Dimitris Glezos <dimitris@glezos.com>
|  date:        Sun Jul 20 21:51:30 2008 +0300
|  summary:     Added tag 0.3 for changeset e24c92763271
|
o  changeset:   330:e24c92763271
|  tag:         0.3
|  user:        Dimitris Glezos <dimitris@glezos.com>
|  date:        Sun Jul 20 21:51:00 2008 +0300
|  summary:     Released version 0.3
|
o  changeset:   329:3b1222686b97
|  user:        Dimitris Glezos <dimitris@glezos.com>
|  date:        Sun Jul 20 21:34:25 2008 +0300
|  summary:     trivial: Housekeeping of some files
|

That's it! Now we can continue working on tip:

[mits@localhost f-locsty]$ hg up tip
115 files updated, 0 files merged, 2 files removed, 0 files unresolved

[mits@localhost f-locsty]$ hg heads
changeset:   335:71f57ebce983
tag:         tip
user:        Dimitris Glezos <dimitris@glezos.com>
date:        Sun Jul 20 02:00:46 2008 +0300
summary:     Fixed CSS icon locality issues, reworked submission page and information pages.