Module: tools
Branch: master
Commit: 71ff9805246dfd0834023c858f4f07bd7073056b
URL: https://source.winehq.org/git/tools.git/?a=commit;h=71ff9805246dfd0834023c8…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Wed Jul 6 16:06:21 2022 +0200
testbot/cgi: Allow calling AddError() without an error.
This simplifies error handling for APIs that just return an error
message.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/lib/ObjectModel/CGI/Page.pm | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/testbot/lib/ObjectModel/CGI/Page.pm b/testbot/lib/ObjectModel/CGI/Page.pm
index 1df53929..a8268754 100644
--- a/testbot/lib/ObjectModel/CGI/Page.pm
+++ b/testbot/lib/ObjectModel/CGI/Page.pm
@@ -356,6 +356,7 @@ Sets the error message to be shown to the user.
=item ErrMessage
A message to be shown on the page that describes why the form data is invalid.
This should include the display name of the field(s) that need to be fixed.
+If this parameter is false the error message is not modified.
=item ErrField
If the error concerns a specific field, the name of that field. This can be
@@ -363,6 +364,9 @@ used by the page to highlight the field that needs to be corrected.
=back
+Returns the ErrMessage parameter. This allows checking whether an error
+was actually added.
+
=back
=cut
@@ -370,8 +374,12 @@ sub AddError($$;$)
{
my ($self, $ErrMessage, $ErrField) = @_;
- $self->{ErrMessage} = $ErrMessage;
- $self->{ErrField} = $ErrField;
+ if ($ErrMessage)
+ {
+ $self->{ErrMessage} = $ErrMessage;
+ $self->{ErrField} = $ErrField;
+ }
+ return $ErrMessage;
}
# FIXME: For legacy code, to be removed.
Module: tools
Branch: master
Commit: ce0a7b4413c8097fe07c82ca448fcfe6648474c3
URL: https://source.winehq.org/git/tools.git/?a=commit;h=ce0a7b4413c8097fe07c82c…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Wed Jul 6 16:05:39 2022 +0200
testbot/web: Use AddError() to set the item list action error.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/web/FailuresList.pl | 4 ++--
testbot/web/admin/UsersList.pl | 4 ++--
testbot/web/admin/VMsList.pl | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/testbot/web/FailuresList.pl b/testbot/web/FailuresList.pl
index 2cb40c48..d1f8de6d 100644
--- a/testbot/web/FailuresList.pl
+++ b/testbot/web/FailuresList.pl
@@ -138,8 +138,8 @@ sub OnItemAction($$$)
my ($_ErrProperty, $ErrMessage) = $Failure->Save();
if (defined $ErrMessage)
{
- # Setting ErrField is only useful on form pages
- $self->{EnclosingPage}->SetError(undef, $ErrMessage);
+ # Setting the error field is only useful on form pages
+ $self->{EnclosingPage}->AddError($ErrMessage);
return 0;
}
return 1;
diff --git a/testbot/web/admin/UsersList.pl b/testbot/web/admin/UsersList.pl
index 5f9f47b4..6fdb06d0 100644
--- a/testbot/web/admin/UsersList.pl
+++ b/testbot/web/admin/UsersList.pl
@@ -109,8 +109,8 @@ sub OnItemAction($$$)
my ($_ErrProperty, $ErrMessage) = $User->Save();
if (defined $ErrMessage)
{
- # Setting ErrField is only useful on form pages
- $self->{EnclosingPage}->SetError(undef, $ErrMessage);
+ # Setting the error field is only useful on form pages
+ $self->{EnclosingPage}->AddError($ErrMessage);
return 0;
}
diff --git a/testbot/web/admin/VMsList.pl b/testbot/web/admin/VMsList.pl
index 6c3ff203..3361c03f 100644
--- a/testbot/web/admin/VMsList.pl
+++ b/testbot/web/admin/VMsList.pl
@@ -52,8 +52,8 @@ sub OnItemAction($$$)
my ($_ErrProperty, $ErrMessage) = $VM->Save();
if (defined $ErrMessage)
{
- # Setting ErrField is only useful on form pages
- $self->{EnclosingPage}->SetError(undef, $ErrMessage);
+ # Setting the error field is only useful on form pages
+ $self->{EnclosingPage}->AddError($ErrMessage);
return 0;
}
return 1;
Module: tools
Branch: master
Commit: 1dd718b79d3511e7e9d614fc9c6d96be4ffcc655
URL: https://source.winehq.org/git/tools.git/?a=commit;h=1dd718b79d3511e7e9d614f…
Author: Torge Matthies <openglfreak(a)googlemail.com>
Date: Fri Jun 24 07:16:35 2022 +0200
gitlab: Make mbox splitting more robust.
This complements the fix in af62ee218ed25a1502490a1017cf53d23cf65307
by not splitting on every line that starts with From.
The mbox split algorithm now uses the same From-line detection as git
mailsplit.
---
gitlab/gitlab-to-mail/gitlabtomail.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/gitlab/gitlab-to-mail/gitlabtomail.py b/gitlab/gitlab-to-mail/gitlabtomail.py
index 8333588e..03824504 100755
--- a/gitlab/gitlab-to-mail/gitlabtomail.py
+++ b/gitlab/gitlab-to-mail/gitlabtomail.py
@@ -278,10 +278,12 @@ def decode_rfc2822(header):
def split_mbox_into_messages(mbox):
result = []
- for mail in re.split(r'^From ', mbox, flags=re.M):
+ # Ported from Git's mailsplit code to regex.
+ regex = r'^(?=.{20,})(?=From .*\d{2}:\d{2}:\d{2}\s*(?:9[1-9]|\d{3,})(?!\d)[^:\n]*$)'
+ for mail in re.split(regex, mbox, flags=re.M|re.A):
if not mail:
continue
- result.append(email.message_from_string('From ' + mail))
+ result.append(email.message_from_string(mail))
return result