Mercurial Branch Merging

From MozillaWiki
Jump to: navigation, search

Mercurial Branch Repository Merging

Upstream Merge Workflow

Suppose you have a project branch repository or a user repository that you wish to merge "upstream" to mozilla-central or a project branch.

From your working repo:

hg pull mozilla-central
hg merge
# if there are conflicts, fix them, and then issue `hg resolve -ma`
hg commit -m "Merge mozilla-central and my-awesome-branch"
hg push project-repo
hg push mozilla-central

Downstream Sync Workflow

You have a project branch or user repo you want to resync with the upstream repo, say, mozilla-central or a project repo.

At it's most basic:

cd project-repo
hg pull http://hg.mozilla.org/mozilla-central/
hg merge
# if there are conflicts, fix them, and then issue `hg resolve -ma`
hg commit -m "Merge m-c onto project-repo"
hg push project-branch

via ehsan

Working within the branch

When a bug is fixed in a project repository, the fix is not available until it is merged upstream, so marking the bug as resolved is deceptive. The tracemonkey workflow for this is:

  1. Create your patch using a personal repo
  2. Get reviews (BEFORE landing on project repo; the rules don't change!)
  3. Push the fix to the project repo
  4. Add [fixed-in-tracemonkey] to the whiteboard
  5. Add a commit comment to the bug giving the commit's tracemonkey revision, eg http://hg.mozilla.org/tracemonkey/rev/87dc60c12d24
  6. Do not mark the bug as resolved

Then, when the fix is part of a merge to mozilla-central:

cdleary has a script to automate those last steps, because apparently it's not that much fun to grovel through bugzilla and cut & paste revision ids like crazy.