Sheriffing/How To/Backouts: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
m (update qbackout links)
(Overhaul the entire page)
Line 1: Line 1:
Backouts
When a patch is landed that causes build or test failures, it must be backed out to restore the tree to a passing state again. This page documents the procedure for performing backouts both for Gecko changes and Gaia.


Sheriffs also have to do Backouts of checkins from the various Mozilla Trees to fix bustages, test failures etc. This document should help doing these backouts
= Gecko Backouts =
 
== Prerequisites ==
= Requirements: =
* Install the qbackout extension from https://hg.mozilla.org/hgcustom/version-control-tools/file/default/hgext/qbackout
* Install the qbackout extension from https://hg.mozilla.org/hgcustom/version-control-tools/file/default/hgext/qbackout
* Instructions: https://hg.mozilla.org/hgcustom/version-control-tools/file/default/hgext/qbackout/README
* Instructions: https://hg.mozilla.org/hgcustom/version-control-tools/file/default/hgext/qbackout/README


= Example backout: =
== Usage ==
=== Backout of a single changeset===
backout of changeset abc1234
  hg qbackout -e -r 123456789abc
Where -r is the specific revision to be backed out. The -e option opens an editor to edit the commit message prior to committing. This is useful for adding DONTBUILD, CLOSED TREE, etc before pushing.
  hg qbackout -r abc1234 -e


with -r you define the revision/checkin you want to backout with -e you can change the commit message, useful for closed trees etc
=== Backout of multiple consecutive changesets ===
   
hg qbackout -e -s -r 123456789abc:cba987654321
Where the -r is now specifying a range of commits (from 123456789abc to cba987654321). The -s option commits the backouts as a single commit. Otherwise, each changeset in the range will be backed out as separate commits.
 
=== Backout of multiple non-consecutive changesets ===
  hg qbackout -e -s -r 123456789abc+cba987654321
Useful when there are commits in between the ones that need backing out.
 
=== Backout of a combination of consecutive and non-consecutive changesets ===
hg qbackout -e -s -r 123456789abc:cba987654321+xyz456789123
Useful when a follow-up patch needs backing out in addition to the main one (i.e. someone had a follow-up bustage fix push) or an additional commit conflicts with the backout and needs backing out as well.
 
== Pushing ==
  hg qfinish -a
  hg qfinish -a
Finalizes the patch for pushing to the remote repo.


finishes this transaction and you can proceed with hg push etc
=== What Ifs ===
 
* If the remote repo has additional changesets (i.e. a push race), hg pull --rebase will pull the new changesets and rebase the local changes on top of them.
= when the commit message was wrong like forgot closed tree etc =
** This requires the [http://mercurial.selenic.com/wiki/RebaseExtension rebase] extension to be enabled in .hgrc
* If the commit message needs to be modifying after qfinish (i.e. forgotten CLOSED TREE), hg commit --amend will open the backout in an editor for modification.
hg qimport -r tip && hg qrefresh -e && hg qfinish -a && hg push


qimport can also be useful if someone has pushed to the tree between you hg qfinish -a'ing and you pushing:
= Gaia Backouts =
If the changeset is not part of a merge (i.e. pushed directly instead instead of a merged Pull Request):
git revert 12345ab


  hg qimport -r tip && hg qpop && hg pull -u && hg qpush [nnnnnn].diff && hg qfinish -a && hg push
If the changeset is a merged Pull Request:
  git revert -m 1 12345ab


This pulls the tip commit back into your mercurial queue, pops it off the queue, pulls in the other person's changes, pushes your commit back onto the queue on top of the new changes, finishes the queue and pushes to the tree.
For reverting multiple git commits at the same time, see [http://stackoverflow.com/questions/1463340/revert-multiple-git-commits this StackOverflow] post.

Revision as of 22:43, 30 January 2015

When a patch is landed that causes build or test failures, it must be backed out to restore the tree to a passing state again. This page documents the procedure for performing backouts both for Gecko changes and Gaia.

Gecko Backouts

Prerequisites

Usage

Backout of a single changeset

hg qbackout -e -r 123456789abc

Where -r is the specific revision to be backed out. The -e option opens an editor to edit the commit message prior to committing. This is useful for adding DONTBUILD, CLOSED TREE, etc before pushing.

Backout of multiple consecutive changesets

hg qbackout -e -s -r 123456789abc:cba987654321

Where the -r is now specifying a range of commits (from 123456789abc to cba987654321). The -s option commits the backouts as a single commit. Otherwise, each changeset in the range will be backed out as separate commits.

Backout of multiple non-consecutive changesets

hg qbackout -e -s -r 123456789abc+cba987654321

Useful when there are commits in between the ones that need backing out.

Backout of a combination of consecutive and non-consecutive changesets

hg qbackout -e -s -r 123456789abc:cba987654321+xyz456789123

Useful when a follow-up patch needs backing out in addition to the main one (i.e. someone had a follow-up bustage fix push) or an additional commit conflicts with the backout and needs backing out as well.

Pushing

hg qfinish -a

Finalizes the patch for pushing to the remote repo.

What Ifs

  • If the remote repo has additional changesets (i.e. a push race), hg pull --rebase will pull the new changesets and rebase the local changes on top of them.
    • This requires the rebase extension to be enabled in .hgrc
  • If the commit message needs to be modifying after qfinish (i.e. forgotten CLOSED TREE), hg commit --amend will open the backout in an editor for modification.

Gaia Backouts

If the changeset is not part of a merge (i.e. pushed directly instead instead of a merged Pull Request):

git revert 12345ab

If the changeset is a merged Pull Request:

git revert -m 1 12345ab

For reverting multiple git commits at the same time, see this StackOverflow post.