Sheriffing/How To/Landing patches: Difference between revisions
(→Bugzilla queries for patches requiring check-in: labeled m-c only query) |
No edit summary |
||
Line 1: | Line 1: | ||
{{Sheriffing How To|Landing check-needed patches}} | {{Sheriffing How To|Landing check-needed patches}} | ||
Sheriffs have the responsibility for landing checkin-needed patches on behalf of others who do not have the needed commit access to do so themselves or those who do not have the ability to watch their pushes afterwards. | Sheriffs have the responsibility for landing checkin-needed patches on behalf of others who do not have the needed commit access to do so themselves or those who do not have the ability to watch their pushes afterwards.<br /> | ||
Usually, patches should be landed after the merges and after the nightly builds started running. Of course, it can also be done when requested. | |||
= Bugzilla queries for patches requiring check-in = | = Bugzilla queries for patches requiring check-in = | ||
Line 20: | Line 21: | ||
*** Format should be something like "Bug 123456 - Add a null check to XYZ to avoid a crash. r=somebody" | *** Format should be something like "Bug 123456 - Add a null check to XYZ to avoid a crash. r=somebody" | ||
* If a patch is missing commit information, remind the patch author to include it for future patches with a link to the [https://developer.mozilla.org/en-US/docs/Mercurial_FAQ#How_can_I_generate_a_patch_for_somebody_else_to_check-in_for_me.3F Mercurial FAQ page] that describes how to set it. | * If a patch is missing commit information, remind the patch author to include it for future patches with a link to the [https://developer.mozilla.org/en-US/docs/Mercurial_FAQ#How_can_I_generate_a_patch_for_somebody_else_to_check-in_for_me.3F Mercurial FAQ page] that describes how to set it. | ||
The patches can be landed in 2 ways: | |||
'''Automatically''', from <span style="color:#14866d">'''mozreview'''</span> – and the patches will land on '''AUTOLAND''' | |||
'''Manually''', from the <span style="color:#14866d">'''console'''</span> – and the patches will land on '''INBOUND''' | |||
== Landing patches via mozreview (reviewboard) - Autoland == | |||
*These patches will have an additional section on the bug, right above '''“Attachments”''', called <span style="color:#14866d">'''“MozReview Requests”'''</span> | |||
[[File:Mozreview.png|frame|center]] | |||
*'''Click the link''' under '''“MozReview Requests”''' and you will be redirected to another page, from where the commit can be landed: | |||
[[File:Land1.jpg|frame|center]] | |||
*Click on the '''dropdown menu''' from <span style="color:#14866d">'''Automation'''</span>, and then click on <span style="color:#14866d">'''Land Commits'''</span>. | |||
<span style="color:#b32425">'''Note: If you cannot land the patch from GUI:'''</span> | |||
# '''Comment''' this message on the bug: ''“The patch doesn't meet the review requirements in MozReview needed for Autoland to push it - see http://mozilla-version-control-tools.readthedocs.io/en/latest/mozreview/autoland.html#landing-commits“'' | |||
# '''Needinfo''' the developer | |||
# '''Remove''' the checkin-needed tag | |||
== Landing patches from the console - Inbound == | |||
We will have to identify the person that added the patch, and the one that reviewed the patch. For this, you can use: https://wiki.mozilla.org/Modules/All or https://phonebook.mozilla.org/ or https://mozillians.org/en-US/ | |||
These are the steps that you should follow: | |||
# '''cd mozilla-unified''' | |||
# '''hg pull inbound''' | |||
# '''hg update inbound''' | |||
# '''hg qimport bz://<bugnumber>''' <span style="color:#14866d">''//to import the patches from the chosen bug''</span> | |||
# '''hg qseries''' <span style="color:#14866d">''//check the patches in the queue''</span> | |||
# '''hg qpush''' <span style="color:#14866d">''//apply patch. Use hg qpush -a if there are multiple patches''</span> | |||
# '''hg log''' <span style="color:#14866d">''//check the commit message''</span> | |||
# If in hg log, the name or e-mail of the reviewer are '''not correct''', use '''hg qref –u “Name <email>”''' | |||
# '''hg qref -e''' <span style="color:#14866d">//to add the reviewer and/ or edit the commit message</span> | |||
# '''hg qfinish -a''' <span style="color:#14866d">//turn all into permanent changesets</span> | |||
# '''hg push -r . inbound''' | |||
<span style="color:#b32425">'''Note: If you get the following error when pushing to inbound: "abort: push creates new remote head ..." run:'''</span> | |||
# '''hg pull --rebase inbound''' | |||
# '''hg push -r . inbound''' | |||
=== Deleting a patch from the tip === | |||
If you encounter any errors when applying a patch, you will have to: | |||
* '''delete''' the patch from the queue | |||
* '''needinfo''' the dev | |||
* '''delete''' the checkin-needed tag | |||
* '''leave a comment''' on the bug with the issue that stopped you from landing the bug. | |||
And furthermore to : | |||
* '''hg qpop''' | |||
* '''hg qdelete <span style="color:#14866d"><patch_name></span>''' | |||
* '''hg purge''' <span style="color:#14866d">''(--only if there are .rej files)''</span> | |||
* '''hg update -C''' | |||
== Relanding a revision == | |||
If requested, one or more revisions can be relanded after, for example, being backed out. | |||
# '''hg graft -er/-esr <span style="color:#14866d"><revision number> OR <revision>::<revision></span>''' | |||
# '''hg import <span style="color:#14866d"><revision link></span>''' | |||
# '''hg commit --amend''' <span style="color:#14866d">//to update the commit message</span>' | |||
# '''hg push -r . <span style="color:#14866d"><tree></span>''' | |||
== Landing bugs with multiple patches, out of which one is a zip file == | |||
If there are other patches, except the zip file, do the following: | |||
# '''hg qimport''' all the patches <span style="color:#b32425">UP TO</span> the zip file | |||
# '''hg push -a''' <span style="color:#14866d">// if there are multiple patches</span> | |||
# '''hg qfinish -a''' | |||
# '''hg histedit''' <span style="color:#14866d">// if you need to edit the reviewers</span> | |||
# '''hg finish -a''' | |||
Then: | |||
# Go to the bug in your VM, '''download''' the zip file, then '''unzip''' it <span style="color:#14866d">''(in your home directory to be easier)''</span> | |||
# Go to your console and run h'''g qimport ~/bug.'''<span style="color:#14866d">'''patch'''</span> <span style="color:#14866d">''// bug.patch is the file from the zip; ~/ = home = path where you extracted the file''</span> | |||
# '''hg qpush''' | |||
# '''hg qref -e''' <span style="color:#14866d">// to edit reviewer when it's just one patch</span> | |||
# '''hg finish -a''' | |||
# '''hg qimport bz:<span style="color:#14866d">//bug</span>''' <span style="color:#14866d">// import the rest of the missing patches, the ones that are not zip or other formats</span> | |||
# '''hg qpush -a''' | |||
# '''hg qfinish -a''' | |||
# '''hg histedit''' <span style="color:#14866d">// edit reviewers if necessary</span> | |||
# '''hg push -r . inbound''' | |||
== What to do in case you forget to update to inbound before importing patches == | |||
Landing Patches (rebasing your revision to the right tree in case you forgot to update to inbound before importing patches) | |||
Example: Let's say you are on the top of Autoland and you want to land some patches on Inbound, but you forgot to update to inbound, so you already imported a few patches and you realize you are on Autoland instead of inbound. | |||
What to do in order to rebase to the right tree: | |||
# '''hg log -fr.''' <span style="color:#14866d">// to force show the log and check how many revisions you have created - how many patches you have imported. Also you will need this later for the revision.</span> | |||
[[File:Landing paches1.png|frame|center]] | |||
# '''hg pull inbound''' | |||
# '''hg rebase -s <span style="color:#14866d"><revision/changeset number of the bottom most patch></span> -d inbound''' | |||
<span style="color:#b32425">Note: | |||
revision number of the bottom most patch = in the case above is 19212c6d7051, we only need the second string of characters from the changeset. | |||
-s = source; -d = destination </span> Good to know: When running this command, hg will '''move(cut)''' all the patches from Autoland to Inbound, starting from the source (e.g:19212c6d7051) to the last patch. (top most patch). | |||
[[File:Landing paches2.png|frame|center]] | |||
# '''hg log''' <span style="color:#14866d">''// to check if the commands had the desired effect'' </span> | |||
# '''hg update tip''' <span style="color:#14866d">''// this command will activate the rebase, will make sure that the changesets that were imported from the other tree are going to be in your tip for this specific tree. In this case inbound.'' </span> | |||
[[File:Tip.png|frame|center]] | |||
# '''hg out -r . inbound''' <span style="color:#14866d">''// check to see that the two patches rebased to inbound and are active in the tip'' <span> | |||
# Once the patches are where they should, you can go ahead and push. | |||
# '''hg push -r . inbound''' |
Revision as of 03:27, 26 August 2018
Sheriffs have the responsibility for landing checkin-needed patches on behalf of others who do not have the needed commit access to do so themselves or those who do not have the ability to watch their pushes afterwards.
Usually, patches should be landed after the merges and after the nightly builds started running. Of course, it can also be done when requested.
Bugzilla queries for patches requiring check-in
- Only patches for mozilla-central: Bugs with checkin-needed or checkin? requests set excluding non-core components in comm-central and NSS and NSPR
- This is now available as a shared saved search for anyone with editbugs permissions on bugzilla. Go here and search for "checkin-needed-core" to find it in the list, and you can add it to Bugzilla's footer.
- Also including patches for other trees, e.g. comm-central: Bugs with checkin-needed or checkin? requests set in all components
How to land check-in needed patches
- Verify that the patch has proper review before doing anything else
- Saving the attachment from the bug.
- Apply the patch to the appropriate repository using
hg import
(preferred) orpatch
.- For almost all patches, the appropriate repository is mozilla-inbound.
- If the patch does not apply cleanly, you can try to rebase. If that doesn't solve the issue, your best course of action is to remove the checkin-needed request and ask the developer to post an updated patch for check-in. If you understand the code very well or the conflicts are extremely trivial, you can try to resolve the conflicts yourself, but note that YOU are now on the hook for this patch too.
- Once the patch applies cleanly, verify that the commit information is correct:
- Author (use the information from their Bugzilla account if needed)
- Bug number
- Commit message (keeping in mind that the commit message should be a brief description of what the patch is doing)
- Format should be something like "Bug 123456 - Add a null check to XYZ to avoid a crash. r=somebody"
- If a patch is missing commit information, remind the patch author to include it for future patches with a link to the Mercurial FAQ page that describes how to set it.
The patches can be landed in 2 ways: Automatically, from mozreview – and the patches will land on AUTOLAND Manually, from the console – and the patches will land on INBOUND
Landing patches via mozreview (reviewboard) - Autoland
- These patches will have an additional section on the bug, right above “Attachments”, called “MozReview Requests”
- Click the link under “MozReview Requests” and you will be redirected to another page, from where the commit can be landed:
- Click on the dropdown menu from Automation, and then click on Land Commits.
Note: If you cannot land the patch from GUI:
- Comment this message on the bug: “The patch doesn't meet the review requirements in MozReview needed for Autoland to push it - see http://mozilla-version-control-tools.readthedocs.io/en/latest/mozreview/autoland.html#landing-commits“
- Needinfo the developer
- Remove the checkin-needed tag
Landing patches from the console - Inbound
We will have to identify the person that added the patch, and the one that reviewed the patch. For this, you can use: https://wiki.mozilla.org/Modules/All or https://phonebook.mozilla.org/ or https://mozillians.org/en-US/
These are the steps that you should follow:
- cd mozilla-unified
- hg pull inbound
- hg update inbound
- hg qimport bz://<bugnumber> //to import the patches from the chosen bug
- hg qseries //check the patches in the queue
- hg qpush //apply patch. Use hg qpush -a if there are multiple patches
- hg log //check the commit message
- If in hg log, the name or e-mail of the reviewer are not correct, use hg qref –u “Name <email>”
- hg qref -e //to add the reviewer and/ or edit the commit message
- hg qfinish -a //turn all into permanent changesets
- hg push -r . inbound
Note: If you get the following error when pushing to inbound: "abort: push creates new remote head ..." run:
- hg pull --rebase inbound
- hg push -r . inbound
Deleting a patch from the tip
If you encounter any errors when applying a patch, you will have to:
- delete the patch from the queue
- needinfo the dev
- delete the checkin-needed tag
- leave a comment on the bug with the issue that stopped you from landing the bug.
And furthermore to :
- hg qpop
- hg qdelete <patch_name>
- hg purge (--only if there are .rej files)
- hg update -C
Relanding a revision
If requested, one or more revisions can be relanded after, for example, being backed out.
- hg graft -er/-esr <revision number> OR <revision>::<revision>
- hg import <revision link>
- hg commit --amend //to update the commit message'
- hg push -r . <tree>
Landing bugs with multiple patches, out of which one is a zip file
If there are other patches, except the zip file, do the following:
- hg qimport all the patches UP TO the zip file
- hg push -a // if there are multiple patches
- hg qfinish -a
- hg histedit // if you need to edit the reviewers
- hg finish -a
Then:
- Go to the bug in your VM, download the zip file, then unzip it (in your home directory to be easier)
- Go to your console and run hg qimport ~/bug.patch // bug.patch is the file from the zip; ~/ = home = path where you extracted the file
- hg qpush
- hg qref -e // to edit reviewer when it's just one patch
- hg finish -a
- hg qimport bz://bug // import the rest of the missing patches, the ones that are not zip or other formats
- hg qpush -a
- hg qfinish -a
- hg histedit // edit reviewers if necessary
- hg push -r . inbound
What to do in case you forget to update to inbound before importing patches
Landing Patches (rebasing your revision to the right tree in case you forgot to update to inbound before importing patches) Example: Let's say you are on the top of Autoland and you want to land some patches on Inbound, but you forgot to update to inbound, so you already imported a few patches and you realize you are on Autoland instead of inbound. What to do in order to rebase to the right tree:
- hg log -fr. // to force show the log and check how many revisions you have created - how many patches you have imported. Also you will need this later for the revision.
- hg pull inbound
- hg rebase -s <revision/changeset number of the bottom most patch> -d inbound
Note: revision number of the bottom most patch = in the case above is 19212c6d7051, we only need the second string of characters from the changeset. -s = source; -d = destination Good to know: When running this command, hg will move(cut) all the patches from Autoland to Inbound, starting from the source (e.g:19212c6d7051) to the last patch. (top most patch).
- hg log // to check if the commands had the desired effect
- hg update tip // this command will activate the rebase, will make sure that the changesets that were imported from the other tree are going to be in your tip for this specific tree. In this case inbound.
- hg out -r . inbound // check to see that the two patches rebased to inbound and are active in the tip
- Once the patches are where they should, you can go ahead and push.
- hg push -r . inbound