Running a backout branch with Mercurial

21 November, 2013 § 3 Comments

As mentioned in an earlier post, we are running a special branch of Firefox that is made of the Nightly (mozilla-central) trunk minus the Australis changes. This branch will be the source of our Aurora (mozilla-aurora) builds in a few weeks.

As we were planning this work, we found that there weren’t many resources on the internet that described how to do what we wanted.

Basically, we have our trunk that will have a large and invasive feature being built on it. However, we also want to have a branch that doesn’t include this work.

To get started, we created a separate repository (holly) that was cloned from mozilla-central prior to the feature branch being merged in to mozilla-central. When the feature branch was merged in to mozilla-central, we merged over mozilla-central to holly again. At this point we ran a reverse diff of this merge (which only consisted of the feature branch changes). This reverse diff was then applied and committed to essentially back out all of the feature branch on this new holly repository.

Getting started was the easy part. Of course, software is never finished and we needed to figure out how to handle future changes to the feature.

We kicked around many ideas as we were trying to figure out how we wanted to run the backout branch, and I feel that we have settled on a pretty simple route that so far has worked smoothly.

Each time that we want to merge from mozilla-central to holly we do the following:

  1. cd /mozilla-central
  2. hg pull -u
  3. cd /holly
  4. hg pull -u
  5. hg pull /mozilla-central -r mozillaCentralChangeset
  6. if the set of changes between holly tip and mozillaCentralChangeset include changes that need to be backed out:
    1. hg up -r mozillaCentralChangeset
      • to switch heads to the mozilla-central-based head
    2. hg qbackout -r rev1+rev2+rev3
      • from oldest to newest, where rev* are the revisions that need to be backed out)
    3. hg qfin -a
    4. hg up -r hollyTipChangeset
      • to switch heads back to the holly-based head
  7. hg merge
  8. hg commit -m "merge mozilla-central to holly"
  9. hg push

qbackout is a Mercurial extension written by some Mozillians to make backing changesets out much easier. It uses Mercurial Queues and generates reverse diffs instead of creating a full backout branch like hg backout does. I highly recommend it.

I hope this post will help others who want to do something similar.

Notes on Firefox development

27 June, 2011 § 2 Comments

Today marks the start of my third week at Mozilla. I’d like to mark this occasion with some things that I have learned that are pertinent to developing for Firefox.

  1. review?

    When I submitted my first patch to Mozilla, I added a reviewer by appending r=reviewer to my patch. While this may say what you mean, it doesn’t do what you mean.

    To properly request a review, set review to ? in Bugzilla when you are adding an attachment. This will properly email the reviewer so they can become aware of the request.

  2. make -s -C objdir

    Running a clean build of Firefox can take about 25-30 minutes, while an incremental build can still take about 2 minutes. This is clearly not conducive to an iterative-style of coding.

    To make builds faster, you only need to rebuild the parts that have changed. To do this, simply run make -s -C objdir, where objdir is the parent directory within the object directory of the code that you have changed. It may be necessary to also re-link if native code has changed.

  3. -moz-appearance: none

    This was the first XUL gotcha that I ran into. I bumped in to this as I was working on bug 598169 and trying to make a XUL:textbox styleable.

    Many XUL elements use OS-dependent styling, and if you want to apply styles to them then you will have to turn off the default styling. -moz-apperance: none does just that.

  4. hg qpush –move patch

    Many of the developers at Mozilla use the mq extension for Mercurial. mq is a tool that allows you to keep all of your changesets in separate queues. This makes it easier to work on different patches in parallel.

    Most work can be done with three of the mq commands: hg qnew, hg qpush, and hg qpop.

    A normal hg qpush patch will push the current patch as well as all preceding patches on the tip, whereas hg qpush --move patch allows a user to push just the single patch on the tip.

  5. pymake

    If you’re working on Windows, Firefox can take a while to build when using the standard make -f client.mk. Fortunately, there exists a tool that makes your builds run a lot faster by taking advantage of the multiple cores on your system.

    Running python -O "..\build\pymake\make.py" -s -j12 will build Firefox with 12 concurrent compilations. I chose 12 because it is 1.5x the number of threads on my system. :dolske ran some benchmarks to find the optimal -j setting and advised me on the 1.5x multiplier.

    You can learn more about pymake on the Mozilla development website.

View source code for YouTube Playlist Downloader online

5 July, 2009 § 1 Comment

I’ve just uploaded the source code for the YouTube Playlist Downloader online to Google Code. You can view the source by browsing the trunk on the YTPD Google Code site.

The download link will stay the same since ClickOnce isn’t supported on Google Code. I may find myself adding in the setup executable to the download area within the Google Code project, but that executable will simply point at my metrolansing.com domain due to the aforementioned issue.

I’m using Mercurial for the version control system, and it is my first time working with a distributed version control system (DVCS). I’m looking forward to being able to work in branches and move complete features in to the trunk. From my first steps that I have taken, these DVCS systems seem to be the inverse of systems like Subversion. In Subversion, most work is done in the trunk, and then releases are either moved to a branch or tagged, whereas in Mercurial work is done in branches and then merged in to the trunk when considered complete.

Feel free to peruse the code and lend me any suggestions you may have. I am actively looking for contributors, so if you would like to get involved in some WPF and C# then you may have just found the project you were looking for.

Where Am I?

You are currently browsing entries tagged with mercurial at JAWS.