Bug 9309

Summary: patchtest: detect the target branch from mbox before patching
Product: [Yocto Project Subprojects] Patchwork/Patchtest Reporter: Leonardo Sandoval Gonzalez <leonardo.sandoval.gonzalez>
Component: PatchtestAssignee: Leonardo Sandoval Gonzalez <leonardo.sandoval.gonzalez>
Status: RESOLVED FIXED QA Contact: David Rodriguez <david.israelx.rodriguez.castellanos>
Severity: enhancement    
Priority: Medium+ CC: bluelightning, jose.perez.carranza
Version: 2.2   
Target Milestone: 2.2 M1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Leonardo Sandoval Gonzalez 2016-03-18 17:12:28 UTC
Currently, patchtest patches series in either the current branch or the one specified in the command line. In an automated process, this is fine if series are intended for just one branch (master), but this is not always the case. patchtest should parse the mbox (email containing the patch) and detect the target patch dynamically.
Comment 1 Leonardo Sandoval Gonzalez 2016-04-07 20:36:02 UTC
Moving it to the correct product/component
Comment 2 Leonardo Sandoval Gonzalez 2016-04-25 14:23:42 UTC
Doing some parsing on subject's prefix, I found these diversity of formats:

* fraction only, i.e. [0/10]
* version only, i.e. [v2]
* fraction + branch, i.e. [0/10, fido]
* branch + fraction, i.e. [fido, 0/10]
* fraction + branch + version, i.e. [0/10, fido, v2]
* patch string, i.e. [PATCH]
* patch string + version, i.e. [PATCHv2]
* etc..

[000/116]
[00/10]
[001/100]
[00/14]
[00/15]
[00/16,Fido]
[00/20]
[00/22,Jethro]
[00/24,Jethro,V2]
[00/63]
[0/1]
[01/11]
[01/13]
[01/15]
[01/16]
[01/21]
[03/53]
[0/4]
[0/4,fido]
[0/5]
[05/10]
[05/26]
[0/6]
[0/7]
[07/73]
[0/7,jethro]
[0/8]
[0/9]
[09/20]
[10/14]
[1/1]
[1/2]
[1/2,jethro]
[1/2,v2]
[1/3]
[1/4]
[14/40]
[1/4,jethro]
[1/5]
[1/6]
[16/17]
[1/7]
[1/8]
[1/9]
[21/21]
[2/2]
[2/3]
[2/4]
[2/6, V2]
[2/8]
[3/4]
[4/4]
[4/7]
[5/7]
[5/8]
[6/6]
[6/7]
[7/7]
[dizzy]
[dizzy,1/4]
[fido]
[fido,00/11]
[fido,0/7]
[fido,dizzy]
[jethro]
[Jethro,0/5]
[jethro,1/1]
[Jethro,1/2]
[jethro,fido]
[jethro,master]
[jethro-next,1/1]
[jethro-next,1/8]
[jethro, RFC, 2/2]
[master]
[[master,1/2]
[master,Drown]
[master/jethro]
[master,jethro,fido] 2/2]
[master,jetrho] ]
[meta-oe]
[meta-oe,v3,1/1]
[OE-core] [PATCHv2 2/2]
[oe,v2,2/2]
[PATCH]
[PATCH 10/10]
[PATCH 1/1]
[PATCH 1/2]
[PATCH 1/3]
[PATCH 24/35]
[PATCH 2/5] [glplugin]
[PATCHv2]
[PATCHv2,01/16]
[PATCHv2,08/16]
[PATCHv2,1/2]
[[PATCHv2] 2/2]
[PATCHv2, 3/4]
[PATCHv3]
[PATCHv5]
[RESEND]
[RESEND,1/2]
[RESEND,2/7]
[RESEND,3/7]
[RESEND,v3,1/2]
[RFC]
[RFC,1/9]
[RFC,2/3]
[RFC,3/3]
[RFT]
[v1]
[V1,2/3]
[v2]
[V2]
[v2, 01/28]
[v2,1/1]
[V2,1/1]
[v2,1/2]
[V2,1/2]
[v2, 1/3]
[v2,1/3]
[v2, 1/3, jethro]
[v2, 1/4]
[v2,1/4]
[V2,1/4]
[v2,1/5]
[v2,1/7]
[V2,1/7]
[v2, 2/2]
[v2,2/2]
[v2,3/3]
[V2,Jethro,fido,01/10]
[V2,Jethro,fido,1/3]
[v3]
[v3, 01/22]
[v3,1/1]
[v3, 1/4]
[v3,1/4]
[v3, 2/2]
[v3,2/2]
[V3,2/3]
[v4,1/2]
[v4,1/3]
[v5,1/2]
[v5,1/3]
[v6,1/4]
[v7,1/5]
[wic]
[wic,01/15]
[wic,0/9]
[wic,5/6]
[wic,v2,01/14]
[wic,v3,00/14]
Comment 3 Leonardo Sandoval Gonzalez 2016-04-25 15:16:40 UTC
Feature has been implemented. This the pseudocode considered:

- if the subject has a prefix, meaning a string between brackets, then
    - remove non-branches strings (patch, v2, 1/10, etc)
    - check if branch is actually present on repo
    - if present, then 
        - use the subject's branch on patchtest testing
    - else
        - use current repo branch on patchtest testing
- else
    - use current repo branch on patchtest testing