public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v2 1/1] BaseTools/Scripts/PatchCheck.py: Check for Change-id
@ 2023-12-21  8:32 PierreGondois
  0 siblings, 0 replies; 3+ messages in thread
From: PierreGondois @ 2023-12-21  8:32 UTC (permalink / raw)
  To: devel
  Cc: Rebecca Cran, Liming Gao, Bob Feng, Yuwei Chen, Sami Mujawar,
	Pedro Falcato, Ray Ni

Code review tools like gerrit might use a 'Change-id' tag to track
the evolution of patches. This tag should be removed before
submitting a patch to the mailing-list.
It has been observed that contributors sometimes forget to remove
this tag. Add a check in PatchCheck.py to automate this.

Also add a '--ignore-change-id' command line parameter to ignore
the above check.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Acked-by: Pedro Falcato <pedro.falcato@gmail.com>
Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
---

Notes:
    v2:
    - Fix capitalization in helper: Change-id -> Change-Id

 BaseTools/Scripts/PatchCheck.py | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index 7f372d40b570..1675dcbd7321 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -3,7 +3,7 @@
 #
 #  Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>
 #  Copyright (C) 2020, Red Hat, Inc.<BR>
-#  Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
+#  Copyright (c) 2020 - 2023, Arm Limited. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -26,6 +26,9 @@ class Verbose:
     SILENT, ONELINE, NORMAL = range(3)
     level = NORMAL
 
+class PatchCheckConf:
+    ignore_change_id = False
+
 class EmailAddressCheck:
     """Checks an email address."""
 
@@ -111,6 +114,8 @@ class CommitMessageCheck:
             self.check_signed_off_by()
             self.check_misc_signatures()
             self.check_overall_format()
+            if not PatchCheckConf.ignore_change_id:
+                self.check_change_id_format()
         self.report_message_result()
 
     url = 'https://github.com/tianocore/tianocore.github.io/wiki/Commit-Message-Format'
@@ -307,6 +312,12 @@ class CommitMessageCheck:
                 break
             last_sig_line = line.strip()
 
+    def check_change_id_format(self):
+        cid='Change-Id:'
+        if self.msg.find(cid) != -1:
+            self.error('\"%s\" found in commit message:' % cid)
+            return
+
 (START, PRE_PATCH, PATCH) = range(3)
 
 class GitDiffCheck:
@@ -780,11 +791,16 @@ class PatchCheckApp:
         group.add_argument("--silent",
                            action="store_true",
                            help="Print nothing")
+        group.add_argument("--ignore-change-id",
+                           action="store_true",
+                           help="Ignore the presence of 'Change-Id:' tags in commit message")
         self.args = parser.parse_args()
         if self.args.oneline:
             Verbose.level = Verbose.ONELINE
         if self.args.silent:
             Verbose.level = Verbose.SILENT
+        if self.args.ignore_change_id:
+            PatchCheckConf.ignore_change_id = True
 
 if __name__ == "__main__":
     sys.exit(PatchCheckApp().retval)
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112805): https://edk2.groups.io/g/devel/message/112805
Mute This Topic: https://groups.io/mt/103297083/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH v2 1/1] BaseTools/Scripts/PatchCheck.py: Check for Change-id
       [not found] <17A2CBB8731D31AE.28867@groups.io>
@ 2024-01-31 15:07 ` PierreGondois
  2024-02-04 14:50   ` Rebecca Cran
  0 siblings, 1 reply; 3+ messages in thread
From: PierreGondois @ 2024-01-31 15:07 UTC (permalink / raw)
  To: devel
  Cc: Rebecca Cran, Liming Gao, Bob Feng, Yuwei Chen, Sami Mujawar,
	Pedro Falcato, Ray Ni

Hello Rebecca, Liming,

Just a ping in case this was forgotten,
Regards,
Pierre

On 12/21/23 09:32, PierreGondois via groups.io wrote:
> Code review tools like gerrit might use a 'Change-id' tag to track
> the evolution of patches. This tag should be removed before
> submitting a patch to the mailing-list.
> It has been observed that contributors sometimes forget to remove
> this tag. Add a check in PatchCheck.py to automate this.
> 
> Also add a '--ignore-change-id' command line parameter to ignore
> the above check.
> 
> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
> Acked-by: Pedro Falcato <pedro.falcato@gmail.com>
> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
> Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
> ---
> 
> Notes:
>      v2:
>      - Fix capitalization in helper: Change-id -> Change-Id
> 
>   BaseTools/Scripts/PatchCheck.py | 18 +++++++++++++++++-
>   1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
> index 7f372d40b570..1675dcbd7321 100755
> --- a/BaseTools/Scripts/PatchCheck.py
> +++ b/BaseTools/Scripts/PatchCheck.py
> @@ -3,7 +3,7 @@
>   #
>   #  Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>
>   #  Copyright (C) 2020, Red Hat, Inc.<BR>
> -#  Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
> +#  Copyright (c) 2020 - 2023, Arm Limited. All rights reserved.<BR>
>   #
>   #  SPDX-License-Identifier: BSD-2-Clause-Patent
>   #
> @@ -26,6 +26,9 @@ class Verbose:
>       SILENT, ONELINE, NORMAL = range(3)
>       level = NORMAL
>   
> +class PatchCheckConf:
> +    ignore_change_id = False
> +
>   class EmailAddressCheck:
>       """Checks an email address."""
>   
> @@ -111,6 +114,8 @@ class CommitMessageCheck:
>               self.check_signed_off_by()
>               self.check_misc_signatures()
>               self.check_overall_format()
> +            if not PatchCheckConf.ignore_change_id:
> +                self.check_change_id_format()
>           self.report_message_result()
>   
>       url = 'https://github.com/tianocore/tianocore.github.io/wiki/Commit-Message-Format'
> @@ -307,6 +312,12 @@ class CommitMessageCheck:
>                   break
>               last_sig_line = line.strip()
>   
> +    def check_change_id_format(self):
> +        cid='Change-Id:'
> +        if self.msg.find(cid) != -1:
> +            self.error('\"%s\" found in commit message:' % cid)
> +            return
> +
>   (START, PRE_PATCH, PATCH) = range(3)
>   
>   class GitDiffCheck:
> @@ -780,11 +791,16 @@ class PatchCheckApp:
>           group.add_argument("--silent",
>                              action="store_true",
>                              help="Print nothing")
> +        group.add_argument("--ignore-change-id",
> +                           action="store_true",
> +                           help="Ignore the presence of 'Change-Id:' tags in commit message")
>           self.args = parser.parse_args()
>           if self.args.oneline:
>               Verbose.level = Verbose.ONELINE
>           if self.args.silent:
>               Verbose.level = Verbose.SILENT
> +        if self.args.ignore_change_id:
> +            PatchCheckConf.ignore_change_id = True
>   
>   if __name__ == "__main__":
>       sys.exit(PatchCheckApp().retval)


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114904): https://edk2.groups.io/g/devel/message/114904
Mute This Topic: https://groups.io/mt/104076488/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH v2 1/1] BaseTools/Scripts/PatchCheck.py: Check for Change-id
  2024-01-31 15:07 ` [edk2-devel] [PATCH v2 1/1] BaseTools/Scripts/PatchCheck.py: Check for Change-id PierreGondois
@ 2024-02-04 14:50   ` Rebecca Cran
  0 siblings, 0 replies; 3+ messages in thread
From: Rebecca Cran @ 2024-02-04 14:50 UTC (permalink / raw)
  To: Pierre Gondois, devel
  Cc: Liming Gao, Bob Feng, Yuwei Chen, Sami Mujawar, Pedro Falcato,
	Ray Ni

Sorry, I had forgotten about it.

The change has been pushed as 056b4bf74bf5cfa2c0c9c5e44a7c5f3f461d17c0.


-- 
Rebecca Cran


On 1/31/24 08:07, Pierre Gondois wrote:
> Hello Rebecca, Liming,
>
> Just a ping in case this was forgotten,
> Regards,
> Pierre
>
> On 12/21/23 09:32, PierreGondois via groups.io wrote:
>> Code review tools like gerrit might use a 'Change-id' tag to track
>> the evolution of patches. This tag should be removed before
>> submitting a patch to the mailing-list.
>> It has been observed that contributors sometimes forget to remove
>> this tag. Add a check in PatchCheck.py to automate this.
>>
>> Also add a '--ignore-change-id' command line parameter to ignore
>> the above check.
>>
>> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
>> Acked-by: Pedro Falcato <pedro.falcato@gmail.com>
>> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
>> Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
>> ---
>>
>> Notes:
>>      v2:
>>      - Fix capitalization in helper: Change-id -> Change-Id
>>
>>   BaseTools/Scripts/PatchCheck.py | 18 +++++++++++++++++-
>>   1 file changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/BaseTools/Scripts/PatchCheck.py 
>> b/BaseTools/Scripts/PatchCheck.py
>> index 7f372d40b570..1675dcbd7321 100755
>> --- a/BaseTools/Scripts/PatchCheck.py
>> +++ b/BaseTools/Scripts/PatchCheck.py
>> @@ -3,7 +3,7 @@
>>   #
>>   #  Copyright (c) 2015 - 2021, Intel Corporation. All rights 
>> reserved.<BR>
>>   #  Copyright (C) 2020, Red Hat, Inc.<BR>
>> -#  Copyright (c) 2020, ARM Ltd. All rights reserved.<BR>
>> +#  Copyright (c) 2020 - 2023, Arm Limited. All rights reserved.<BR>
>>   #
>>   #  SPDX-License-Identifier: BSD-2-Clause-Patent
>>   #
>> @@ -26,6 +26,9 @@ class Verbose:
>>       SILENT, ONELINE, NORMAL = range(3)
>>       level = NORMAL
>>   +class PatchCheckConf:
>> +    ignore_change_id = False
>> +
>>   class EmailAddressCheck:
>>       """Checks an email address."""
>>   @@ -111,6 +114,8 @@ class CommitMessageCheck:
>>               self.check_signed_off_by()
>>               self.check_misc_signatures()
>>               self.check_overall_format()
>> +            if not PatchCheckConf.ignore_change_id:
>> +                self.check_change_id_format()
>>           self.report_message_result()
>>         url = 
>> 'https://github.com/tianocore/tianocore.github.io/wiki/Commit-Message-Format'
>> @@ -307,6 +312,12 @@ class CommitMessageCheck:
>>                   break
>>               last_sig_line = line.strip()
>>   +    def check_change_id_format(self):
>> +        cid='Change-Id:'
>> +        if self.msg.find(cid) != -1:
>> +            self.error('\"%s\" found in commit message:' % cid)
>> +            return
>> +
>>   (START, PRE_PATCH, PATCH) = range(3)
>>     class GitDiffCheck:
>> @@ -780,11 +791,16 @@ class PatchCheckApp:
>>           group.add_argument("--silent",
>>                              action="store_true",
>>                              help="Print nothing")
>> +        group.add_argument("--ignore-change-id",
>> +                           action="store_true",
>> +                           help="Ignore the presence of 'Change-Id:' 
>> tags in commit message")
>>           self.args = parser.parse_args()
>>           if self.args.oneline:
>>               Verbose.level = Verbose.ONELINE
>>           if self.args.silent:
>>               Verbose.level = Verbose.SILENT
>> +        if self.args.ignore_change_id:
>> +            PatchCheckConf.ignore_change_id = True
>>     if __name__ == "__main__":
>>       sys.exit(PatchCheckApp().retval)


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115086): https://edk2.groups.io/g/devel/message/115086
Mute This Topic: https://groups.io/mt/104076488/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-04 14:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <17A2CBB8731D31AE.28867@groups.io>
2024-01-31 15:07 ` [edk2-devel] [PATCH v2 1/1] BaseTools/Scripts/PatchCheck.py: Check for Change-id PierreGondois
2024-02-04 14:50   ` Rebecca Cran
2023-12-21  8:32 PierreGondois

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox