ReleaseEngineering/PuppetAgain/HowTo/Merge Changes Between Repos

From MozillaWiki
Jump to: navigation, search

Several orgs have their own repositories, and we're working on the "everyone merge every which way" model. So here's how those merges work

The idea is to merge the 'default' branch of some other org's repo into the 'default' branch of this org's repo, without affecting production.

Example

In this case, we're merging from moco's repo to QA's. I've done this using two local "pure" repos, plus a merging repo. You could, most likely, do this with the real upstream repos and your working repo, but this is a little safer.

clone build

 hg clone https://hg.mozilla.org/build/puppet build-puppet

clone qa

 hg clone https://hg.mozilla.org/qa/puppet qa-puppet

now treat qa-puppet and build-puppet as the upstream repos, and clone a local repo

 hg clone qa-puppet qa-local
 cd qa-local

verify we're on default

 hg branch

pull from the 'default' branch of the upstream build-puppet repo

 hg pull -b default ../build-puppet
 pulling from ../build-puppet
 searching for changes
 adding changesets
 adding manifests
 adding file changes
 added 68 changesets with 69 changes to 40 files (+1 heads)
 updating bookmark moco
 adding remote bookmark moco-prod
 (run 'hg heads' to see heads, 'hg merge' to merge)

This says it adds a new head, which is true. That's the head to merge. Ignore the bookmarks - I need to fix that..

Look for the head to merge, and merge it

 hg heads

If this lists two heads for production, you'll need to get rid of one of them. Otherwise, skip down to 'hg merge' below

See which heads we're dealing with

 hg heads production

Pick the one that is *not* from the QA repo, 1eac58877d1d in this case, and switch to it

 hg up -r 1eac58877d1d

close the branch here

 hg commit -m "Close unwanted production branch" --close-branch

and switch back

 hg up -r %changeset% (last changeset of your default branch)
 hg heads

hg heads should now show two default heads and one production head.

Back on track! Merge in the head of the build repo

 hg merge -r 3eda5b62e769

look at the diff

 hg diff

commit it

 hg commit -m "merge build/default to qa/default"

look at the graph (requires [extensions] hgext.graphlog= in ~/.hgrc)

 hg glog

push it

 hg push ../qa-puppet

If you had to kill a production branch earlier, then this will require a -f.

Go over to the qa-puppet repo and make sure *it* looks OK

 cd ../qa-puppet
 hg glog

If so, push it (again, with -f if necessary)

 hg push ssh://hg.mozilla.org/qa/puppet

Note that this only updated the default branch. Perform the usual default-to-production merge to get that into production.