mozilla
Your Search Results

    Landing a patch

    This article is in need of a technical review.

    Purpose

    This article will be particularly helpful for people who have recently got their L3 commit access. This describes how to land your patch.

     

    Actual Steps

    The first thing you should do when you're starting is go through the Mozilla-Inbound tree rules. After that:

    Obtain Mozilla-Inbound: The most convenient way to land patches is to manage a local mozilla-inbound repository, besides your mozilla-central. I keep my mozilla-central for hacking on my bugs and mozilla-inbound only for pushing patches. One way is to clone the entire repo from Mozilla-Inbound. A second, much easier and faster way is to clone it from your existing local mozilla-central. So just run this in the directory where you want to clone your m-i:

    hg clone /path/to/m-c mozilla-inbound

    and then run this command inside your newly cloned repository:

    hg strip --no-backup 'roots(outgoing())'

    Make Mozilla-Inbound push compatible: Edit your .hg/hgrc inside the local m-i to look like below. Some people prefer to name their push url’s to default-push since that enables them to push by simply issuing hg push compared to hg push inbound (which I have to issue to push) according the below configuration. I prefer the latter since typing inbound just makes sure that I am aware of where I am pushing (and just cautions me to be careful). See |hg help urls|.

    [paths]
    default = https://hg.mozilla.org/integration/mozilla-inbound
    inbound = ssh://hg.mozilla.org/integration/mozilla-inbound
    Pull the latest changes: Run 
    hg pull -u
    in your local m-i to pull the latest changes from the remote mozilla-inbound repository and update it.
     
    Import the patch: Import the patch or mercurial queue that you want to push. In most cases I simply do 
    hg qimport ../mozilla-central/.hg/patches/name_of_queue_to_import
    since my changes are in m-c. Now apply the patch by simply running
    hg qpush -move name_of_patch_to_push
    If needed, edit the commit message (remember to add r=patch-reviewer-username) by running
    hg qrefresh -e
    Move applied patches into repository history: Run
    hg qfinish -a
    which will take your patch from mercurial queues to out of its control and into the actual repo. See |hg qfinish —help| for more details.
     
    Push: Run
    hg push inbound
    if it spits out a url, then everything has gone according to plan. Simply just go and paste that url to the concerned bug for record keeping and so that others are aware of your push. However, if no urls were printed, you might just have to carry out a few more steps.
     
    Update bugzilla
    Paste the url from above into the associated bug from the patch description, so people following the bug know its commit status.
     
    Note: Do this only if the push wasn’t successful in the push step.
     
    The push failure just means that someone else has pushed between you pulling and pushing. Run
    hg qimport -r tip
    This just converts your change to the repo back to a mercurial queue. Then run
    hg qpop
    to pop off that mq. Repeat these steps until you succeed.
     

    If Something Goes Wrong

    • Join the #developers or #introduction on irc.mozilla.org and ask someone for help.
    • If you know what caused this problem, then simply back out your push. You can also use this nice backout extension by Steve Fink for mercurial by doing the following:
      • Download the __init__.py from the repository. Save it in a convenient location.
      • Go to your hgrc (in my case /etc/mercurial/hgrc), and add this to it under the section called [extensions]: qbackout = /path/to/qbackout . Save it and close it.
      • Run hg qbackout -r revnum from your local mozilla-inbound repository. This will create a mercurial queue out of that revision which you backed out. Now you need to push this onto inbound, similar to what you did previously.
      • Qbackout would have created an mq; pop that queue and run hg pull -u in your local mozilla-inbound.
      • hg qpush —move name_of_backout_mq
      • hg qfinish -a
      • hg push inbound
      • When successfully pushed, this will spit out a url; paste that url in the concerned bug in bugzilla so that others also know about it.
      • If the above fails, repeat the process again.

    Document Tags and Contributors

    Tags: 
    Last updated by: MonicaChew,