Sheriffing/How To/Unified Repos: Difference between revisions
(new hg pull commands) |
(hg in equivalent) |
||
Line 110: | Line 110: | ||
* hg out -r . inbound | * hg out -r . inbound | ||
** This will only display the things you're about to push to the inbound branch | ** This will only display the things you're about to push to the inbound branch | ||
=== View incoming changes === | |||
Since your unified repo will likely have all changesets from the various branches pulled locally, `hg in <somebranch> -r <somerev>` will likely not help you see what would be pulled into your current branch from <somebranch> up to that <somerev>. | |||
Instead, you can use the following to print out the equivalent. Say you want to see what would be merged onto mozilla-central from b2g-inbound's revision ca142ec8ba0f: | |||
Make sure m-c is fully up to date: | |||
* hg pull central | |||
* hg up central | |||
Get all of b2g-inbound's changesets: | |||
* hg pull b2ginbound | |||
Do a preview of the merge without actually performing the merge: | |||
* hg merge -r ca142ec8ba0f -P | |||
This will print out everything on b2g-inbound (up to and including revision ca142ec8ba0f) that is not already on mozilla-central. |
Revision as of 04:01, 8 January 2015
Unified Repos
- http://mozilla-version-control-tools.readthedocs.org/en/latest/hgmozilla/unifiedrepo.html
- https://mozilla-version-control-tools.readthedocs.org/en/latest/hgmozilla/firefoxtree.html
Setting up the repo
Set up your ssh key yourself Install Mercurial 3.2 or higher Make a copy of your .hgrc file for safekeeping and delete the original
- hg clone https://hg.mozilla.org/mozilla-central
- hg clone https://hg.mozilla.org/hgcustom/version-control-tools
- cd mozilla-central
- ./mach mercurial-setup
Configure mercurial as desired (do not enable the mq extension)
Edit your global .hgrc file to add the following to the [extensions] section:
- firefoxtree = /path/to/version-control-tools/hgext/firefoxtree
The following will pull all (or at least most) of the branches sheriffs need to have on hand:
- hg pull inbound && hg pull b2ginbound && hg pull fx-team && hg pull aurora && hg pull beta && hg pull esr31 && hg pull b2g34 && hg pull b2g32 && hg pull b2g30
If you need other branches, you can find their names in the firefoxtree extension source.
You should now have everything set up for proper use!
Maybe rename the folder from "mozilla-central" to "unifiedrepo" or something to make it clear it's more than just mozilla-central?
The `hg fxheads` command should list references to each of the relevant branch names, and the current revision and commit message for each.
With bug 1116861 landed in version-control-tools, you can now use the following commands to pull from groups of repositories with a single command:
- hg pull fxtrees # this will pull from all branches listed with the fxheads command
- hg pull integration # this will pull from the mozilla-inbound, b2g-inbound, and fx-team branches
- hg pull releases # this will pull from pretty much every release branch (FYI: including old, unused branches)
Merges
This assumes you have your unified repo all set up so that `hg fxheads` lists each of central, b2ginbound, fx-team, and inbound.
To merge a specific non-tip <revision> from mozilla-inbound to mozilla-central:
- hg pull central
- hg pull inbound
- hg up central
- hg merge -r <revision>
- hg commit -m "Merge mozilla-inbound to mozilla-central a=merge"
- hg push -r . central
To merge mozilla-central into mozilla-inbound:
- hg pull central
- hg pull inbound
- hg up inbound
- hg merge central
- hg commit -m "Merge mozilla-central to mozilla-inbound a=merge"
- hg push -r . inbound
- If the `hg merge central` command results in "abort: nothing to merge", you should instead use `hg update -r <mozilla-central's tip revision>` to do a non-merging update, then you can do `hg push -r . inbound` to push it as usual.
Checkin-neededs
This assumes we're checking things in to fx-team. Replace fx-team with another branch name as needed.
Update fx-team and prepare for the patches:
- hg pull fx-team
- hg up fx-team
- hg bookmark fx-team-checkins
Import the patches:
- hg import https://link.to/correct/checkin-needed.patch
- Repeat ^ as needed for all fx-team checkin-needed patches
Verify your outgoing changes:
- hg out -r . fx-team
If you haven't lost a push race:
- hg push -r . fx-team
If you lost a push race:
- hg pull fx-team
- hg rebase -d fx-team
- hg push -r . fx-team
Delete your no longer needed bookmark:
- hg bookmark -d fx-team-checkins
Uplifts
If branch-specific patches are posted, follow the checkin-needed instructions above, importing the patches onto the release branch.
If you're uplifting directly from an m-c checkin to aurora:
Pull and update to prepare for the uplifts:
- hg pull central
- hg pull aurora
- hg up aurora
Graft the mc commit and bring up the editor to edit the commit message, adding "a=foo" as needed:
- hg graft --edit -r <revision>
Repeat the previous step as needed for all uplifts as needed. Verify the outgoing changes and push:
- hg out -r . aurora
- hg push -r . aurora
You can graft a range of commits at once if that's easier:
- hg graft -r <toprevision><bottomrevision>
Read the documentation for graft for further help.
Backouts
TBD
Rebasing after losing a push race
This assumes you have commits you're attempting to push to mozilla-inbound when you lose a push race with someone. Change `inbound` to the correct branch name as needed.
- hg pull inbound
- hg rebase -d inbound
- hg push -r . inbound
Recovering from mistakes
WARNING: This will strip out any commits that haven't been pushed to the remote repositories, regardless of what branch/label/tag those commits are on. (So if you have local changes on inbound and run this command to strip something bad on fx-team, both inbound and fx-team will be stripped.) Only do this if you don't care about any of those commits!
- hg strip 'not public()'
See what you're about to push
`hg out` without any flags added will show you a LOT of unrelated commits. To see just what you'll be pushing to a given branch, use `hg out -r . <branch>`
- hg out -r . inbound
- This will only display the things you're about to push to the inbound branch
View incoming changes
Since your unified repo will likely have all changesets from the various branches pulled locally, `hg in <somebranch> -r <somerev>` will likely not help you see what would be pulled into your current branch from <somebranch> up to that <somerev>. Instead, you can use the following to print out the equivalent. Say you want to see what would be merged onto mozilla-central from b2g-inbound's revision ca142ec8ba0f:
Make sure m-c is fully up to date:
- hg pull central
- hg up central
Get all of b2g-inbound's changesets:
- hg pull b2ginbound
Do a preview of the merge without actually performing the merge:
- hg merge -r ca142ec8ba0f -P
This will print out everything on b2g-inbound (up to and including revision ca142ec8ba0f) that is not already on mozilla-central.