Services/Sync/workingbetweenGitandHg
Why would you do this to yourself?
Whilst Mecurial (henceforth referred to as 'hg') is the official version control system for mozilla-central work (including services-central and mozilla-inbound), many developers choose to do development in git, and some work exclusively in hg. If you or your projectmates want to use git (and GitHub), you will have to interact with hg to get code out the door.
It is assumed that you have both git & hg set up on your machine already.
Getting an hg patch from bugzilla into your git repo
Scenario: You want to get a patch from bugzilla (or somewhere else on the internet). The vast majority of patches on bugs are currently in hg format, which conveniently is git's format, and is understood by patch.
High Level Explanation: You are telling git to pull in a patch file from a URL, apply it, start tracking those files (you should save them too)
Steps
In your git repo:
# If you have uncommitted changes, either commit them or stash them here. curl "https://your-bug-number.bugzilla.mozilla.org/attachment.cgi?id=your-desired-patch" > /tmp/new.patch git apply --index /tmp/new.patch # See `man git-apply` for options. See also `git am`. git commit -m "Bug 123456 - Part 1: frobnicate the whowhat (WIP)"
Getting an hg mq patch on your local machine into a local git repo
Scenario: You did some work in an hg patch queue that you want to move into git.
High Level Explanation: You are telling git to pull in a patch file from a url, convert it, start tracking those files , and save them.
Steps:
%patch -p1 < /fully-qualified-path-to-hg-repo/.hg/patches/your-patch %git add -p %git commit -m "My changes."
Getting your git patch into an hg patch format
Scenario: You're ready to ship to one of the major repositories, but they're all in hg, or your reviewer insists that you upload an hg not git patch.
High Level Explanation: ?
Steps:
dont know the answer to this one yet. :p