Sheriffing/How To/Unified Repos: Difference between revisions

Jump to navigation Jump to search
→‎Backouts: backticks do not format code
(→‎Backouts: switch to hg oops)
(→‎Backouts: backticks do not format code)
Line 149: Line 149:
The standard backout command makes backing out revisions more difficult than it should, as it won't pre-fill the backout commit message with a bug number:
The standard backout command makes backing out revisions more difficult than it should, as it won't pre-fill the backout commit message with a bug number:
* Copy backout <revision> from treeherder, note the bug <number>, and remember the <reason>
* Copy backout <revision> from treeherder, note the bug <number>, and remember the <reason>
* `hg backout -r <revision>`
* hg backout -r <revision>
** This should open up your editor with a completely empty commit message. Type in the backout message like "Backout revision <revision> (bug <number>) for <reason>" (possibly with "CLOSED TREE" in there to get around a closure hook).
** This should open up your editor with a completely empty commit message. Type in the backout message like "Backout revision <revision> (bug <number>) for <reason>" (possibly with "CLOSED TREE" in there to get around a closure hook).
* `hg push -r . <tree>`
* hg push -r . <tree>


[https://hg.mozilla.org/hgcustom/version-control-tools/file/4e7ab9638cf0/hgext/qbackout qbackout] can still be used, though you will want to use `hg oops` in place of `hg qbackout` (eg if you use `hg share` to get multiple working directories, qbackout and other uses of mq do not play nice with shared repos):
[https://hg.mozilla.org/hgcustom/version-control-tools/file/4e7ab9638cf0/hgext/qbackout qbackout] can still be used, though you will want to use `hg oops` in place of `hg qbackout` (eg if you use `hg share` to get multiple working directories, qbackout and other uses of mq do not play nice with shared repos):
* Copy the backout <revision> from treeherder
* Copy the backout <revision> from treeherder
* `hg oops -e -r <revision>`
* hg oops -e -r <revision>
** This should open up your editor with a prepopulated commit message like "Backed out <revision> (bug <number>)". Add in the <reason> and possibly "CLOSED TREE" to get around a closure hook.
** This should open up your editor with a prepopulated commit message like "Backed out <revision> (bug <number>)". Add in the <reason> and possibly "CLOSED TREE" to get around a closure hook.
* `hg out -r . <tree>` to double-check what you will be pushing
* hg out -r . <tree> ''(to double-check what you will be pushing)''
* `hg push -r . <tree>`
* hg push -r . <tree>


qbackout can also back out a range of commits in a single backout commit:
qbackout can also back out a range of commits in a single backout commit:
* `hg oops -e -s -r <toprevision>:<bottomrevision>`
* hg oops -e -s -r <toprevision>:<bottomrevision>
** This will open your editor with a prepopulated commit message like "Backed out <toprevision>,<anymiddlerevisions>,<bottomrevision> (bug <number>,any other bug <numbers>)". Add in the <reason> and possibly "CLOSED TREE" to get around a closure hook.
** This will open your editor with a prepopulated commit message like "Backed out <toprevision>,<anymiddlerevisions>,<bottomrevision> (bug <number>,any other bug <numbers>)". Add in the <reason> and possibly "CLOSED TREE" to get around a closure hook.
* `hg push -r . <tree>`
* hg push -r . <tree>
(Omit oops's -s flag to back out each individual revision in the range as a separate commit.)
(Omit oops's -s flag to back out each individual revision in the range as a separate commit.)


==== Revert a backout ====
==== Revert a backout ====
* https://mozilla-version-control-tools.readthedocs.org/en/latest/hgmozilla/common.html#revive-a-commit-that-was-backed-out
* `hg graft`, see https://mozilla-version-control-tools.readthedocs.org/en/latest/hgmozilla/common.html#revive-a-commit-that-was-backed-out


=== Rebasing after losing a push race ===
=== Rebasing after losing a push race ===
Confirmed users
328

edits

Navigation menu