Re: [edk2] [Patch 2/3] BaseTools: Update PatchCheck to handle the two [] as prefix
Thanks for the comment, when I push the patch I will do the update. Best Regards, Zhu Yonghong -Original Message- From: Justen, Jordan L Sent: Tuesday, October 18, 2016 12:49 AM To: Zhu, Yonghong; edk2-devel@lists.01.org Cc: Gao, Liming Subject: Re: [Patch 2/3] BaseTools: Update PatchCheck to handle the two [] as prefix A small (not too important) suggestion for the patch subject might be: BaseTools/PatchCheck.py: Update to handle the two [] as prefix On 2016-10-17 01:28:37, Yonghong Zhu wrote: > The bug is that only remove the first [] when it does the char count, > however sometimes we use [edk2][patch] as prefix, this patch fix this bug. > > Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=113 > Remove blank line after 'Fixes:'. > Cc: Liming Gao > Cc: Jordan Justen > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Yonghong Zhu > --- > BaseTools/Scripts/PatchCheck.py | 17 + > 1 file changed, 9 insertions(+), 8 deletions(-) > > diff --git a/BaseTools/Scripts/PatchCheck.py > b/BaseTools/Scripts/PatchCheck.py index 07fca68..05f8f6e 100755 > --- a/BaseTools/Scripts/PatchCheck.py > +++ b/BaseTools/Scripts/PatchCheck.py > @@ -434,10 +434,18 @@ class CheckOnePatch: > [\s\S\r\n]+ > ) > ''', > re.IGNORECASE | re.VERBOSE | re.MULTILINE) > > +subject_prefix_re = \ > +re.compile(r'''^ > + \s* (\[ > +[^\[\]]* # Allow all non-brackets > + \])* \s* > + ''', > + re.VERBOSE) > + > def find_patch_pieces(self): > if sys.version_info < (3, 0): > patch = self.patch.encode('ascii', 'ignore') > else: > patch = self.patch > @@ -470,18 +478,11 @@ class CheckOnePatch: > self.stat = mo.group('stat') > self.commit_msg = mo.group('commit_message') > > self.commit_subject = pmail['subject'].replace('\r\n', '') > self.commit_subject = self.commit_subject.replace('\n', '') > - > -pfx_start = self.commit_subject.find('[') > -if pfx_start >= 0: > -pfx_end = self.commit_subject.find(']') > -if pfx_end > pfx_start: > -self.commit_prefix = self.commit_subject[pfx_start + 1 : > pfx_end] Since we no longer set self.commit_prefix, and you remove the other references to it in the script? Reviewed-by: Jordan Justen > -self.commit_subject = self.commit_subject[pfx_end + 1 > :].lstrip() > - > +self.commit_subject = self.subject_prefix_re.sub('', > + self.commit_subject, 1) > > class CheckGitCommits: > """Reads patches from git based on the specified git revision range. > > The patches are read from git, and then checked. > -- > 2.6.1.windows.1 > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch 2/3] BaseTools: Update PatchCheck to handle the two [] as prefix
A small (not too important) suggestion for the patch subject might be: BaseTools/PatchCheck.py: Update to handle the two [] as prefix On 2016-10-17 01:28:37, Yonghong Zhu wrote: > The bug is that only remove the first [] when it does the char count, > however sometimes we use [edk2][patch] as prefix, this patch fix this bug. > > Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=113 > Remove blank line after 'Fixes:'. > Cc: Liming Gao> Cc: Jordan Justen > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Yonghong Zhu > --- > BaseTools/Scripts/PatchCheck.py | 17 + > 1 file changed, 9 insertions(+), 8 deletions(-) > > diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py > index 07fca68..05f8f6e 100755 > --- a/BaseTools/Scripts/PatchCheck.py > +++ b/BaseTools/Scripts/PatchCheck.py > @@ -434,10 +434,18 @@ class CheckOnePatch: > [\s\S\r\n]+ > ) > ''', > re.IGNORECASE | re.VERBOSE | re.MULTILINE) > > +subject_prefix_re = \ > +re.compile(r'''^ > + \s* (\[ > +[^\[\]]* # Allow all non-brackets > + \])* \s* > + ''', > + re.VERBOSE) > + > def find_patch_pieces(self): > if sys.version_info < (3, 0): > patch = self.patch.encode('ascii', 'ignore') > else: > patch = self.patch > @@ -470,18 +478,11 @@ class CheckOnePatch: > self.stat = mo.group('stat') > self.commit_msg = mo.group('commit_message') > > self.commit_subject = pmail['subject'].replace('\r\n', '') > self.commit_subject = self.commit_subject.replace('\n', '') > - > -pfx_start = self.commit_subject.find('[') > -if pfx_start >= 0: > -pfx_end = self.commit_subject.find(']') > -if pfx_end > pfx_start: > -self.commit_prefix = self.commit_subject[pfx_start + 1 : > pfx_end] Since we no longer set self.commit_prefix, and you remove the other references to it in the script? Reviewed-by: Jordan Justen > -self.commit_subject = self.commit_subject[pfx_end + 1 > :].lstrip() > - > +self.commit_subject = self.subject_prefix_re.sub('', > self.commit_subject, 1) > > class CheckGitCommits: > """Reads patches from git based on the specified git revision range. > > The patches are read from git, and then checked. > -- > 2.6.1.windows.1 > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 2/3] BaseTools: Update PatchCheck to handle the two [] as prefix
The bug is that only remove the first [] when it does the char count, however sometimes we use [edk2][patch] as prefix, this patch fix this bug. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=113 Cc: Liming GaoCc: Jordan Justen Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu --- BaseTools/Scripts/PatchCheck.py | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py index 07fca68..05f8f6e 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -434,10 +434,18 @@ class CheckOnePatch: [\s\S\r\n]+ ) ''', re.IGNORECASE | re.VERBOSE | re.MULTILINE) +subject_prefix_re = \ +re.compile(r'''^ + \s* (\[ +[^\[\]]* # Allow all non-brackets + \])* \s* + ''', + re.VERBOSE) + def find_patch_pieces(self): if sys.version_info < (3, 0): patch = self.patch.encode('ascii', 'ignore') else: patch = self.patch @@ -470,18 +478,11 @@ class CheckOnePatch: self.stat = mo.group('stat') self.commit_msg = mo.group('commit_message') self.commit_subject = pmail['subject'].replace('\r\n', '') self.commit_subject = self.commit_subject.replace('\n', '') - -pfx_start = self.commit_subject.find('[') -if pfx_start >= 0: -pfx_end = self.commit_subject.find(']') -if pfx_end > pfx_start: -self.commit_prefix = self.commit_subject[pfx_start + 1 : pfx_end] -self.commit_subject = self.commit_subject[pfx_end + 1 :].lstrip() - +self.commit_subject = self.subject_prefix_re.sub('', self.commit_subject, 1) class CheckGitCommits: """Reads patches from git based on the specified git revision range. The patches are read from git, and then checked. -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel