Updates to firefoxtree Mercurial extension
July 16, 2014 at 07:55 PM | categories: Mercurial, MozillaMy Please Stop Using MQ post, has been generating a lot of interest for bookmark-based workflows at Mozilla. To make adoption easier, I quickly authored an extension to add remote refs of Firefox repositories to Mercurial.
There was still a bit of confusion and gripes about workflows that I thought it would be best to update the extension to make things more pleasant.
Automatic tree names
People wanted an ability to easy pull/aggregate the various Firefox trees without additional configuration to an hgrc file.
With firefoxtree, you can now hg pull central or hg pull inbound or hg pull aurora and it just works.
Pushing with aliases doesn't yet work. It is slightly harder to do in the Mercurial API. I have a solution, but I'm validating some code paths to ensure it is safe. This feature will likely appear soon.
fxheads commands
Once people adopted unified repositories with heads from multiple repositories, they asked how they could quickly identify the heads of the pulled Firefox repositories.
firefoxtree now provides a hg fxheads command that prints a concise output of the commits constituting the heads of the Firefox repos. e.g.
$ hg fxheads 224969:0ec0b9ac39f0 aurora (sort of) bug 898554 - raise expected hazard count for b2g to 4 until they are fixed, a=bustage+hazbuild-only 224290:6befadcaa685 beta Tagging /src/mdauto/build/mozilla-beta 1772e55568e4 with FIREFOX_RELEASE_31_BASE a=release CLOSED TREE 224848:8e8f3ba64655 central Merge inbound to m-c a=merge 225035:ec7f2245280c fx-team fx-team/default Merge m-c to fx-team 224877:63c52b7ddc28 inbound Bug 1039197 - Always build js engine with zlib. r=luke 225044:1560f67f4f93 release release/default tip Automated checkin: version bump for firefox 31.0 release. DONTBUILD CLOSED TREE a=release
Please note that the output is based upon local-only knowledge: you'll need to pull to ensure data is current.
Reject pushing multiple heads
People were complaining that bookmark-based workflows resulted in Mercurial trying to push multiple heads to a remote. This complaint stems from the fact that Mercurial's default push behavior is to find all commits missing from the remote and push them. This behavior is extremely frustrating for Firefox development because the Firefox repos only have a single head and pushing multiple heads will only result in a server hook rejecting the push (after wasting a lot of time transferring that commit data).
firefoxtree now will refuse to push multiple heads to a known Firefox repo before any commit data is sent. In other words, we fail fast so your time is saved.
firefoxtree also changes the default behavior of hg push when pushing to a Firefox repo. If no -r argument is specified, hg push to a Firefox repo will automatically remap to hg push -r .. In other words, we attempt to push the working copy's commit by default. This change establishes sensible default and likely working behavior when typing just hg push.
I am a bit on the fence about changing the default behavior of hg
push. On one hand, it makes total sense. On the other, silently
changing the default behavior of a built-in command is a little
dangerous. I can easily see this backfiring when people interact with
non-Firefox repos. I encourage people to get in the habit of typing
hg push -r
Installing firefoxtree
Within the next 48 hours, mach mercurial-setup should prompt to install firefoxtree. Until then, clone https://hg.mozilla.org/hgcustom/version-control-tools and ensure your ~/.hgrc file has the following:
[extensions]
firefoxtree = /path/to/version-control-tools/hgext/firefoxtree
You likely already have a copy of version-control-tools in ~/.mozbuild/version-control-tools.
It is completely safe to install firefoxtree globally: the extension will only modify behavior of repositories that are clones of Firefox repositories.