Module: tools
Branch: master
Commit: 0c6de95d716da310ffceea197a8fbda78e2eeace
URL: https://source.winehq.org/git/tools.git/?a=commit;h=0c6de95d716da310ffceea1…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Mon May 2 19:22:42 2022 +0200
testbot/SetWinLocale: Copy the locales again after a revert.
Most of the time the system and default user account locales are not
impacted when the current account's --locale and --country locales are
reverted after a reboot. But for some locales they are reverted too so
that SetWinLocale needs to set them again.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
testbot/bin/SetWinLocale | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testbot/bin/SetWinLocale b/testbot/bin/SetWinLocale
index e41af20..0752df5 100755
--- a/testbot/bin/SetWinLocale
+++ b/testbot/bin/SetWinLocale
@@ -946,7 +946,7 @@ if ($OptReboot)
if ($Reverted)
{
Warning("$Expected got reverted to $Reverted. Setting them again but this will not stick across reboots\n");
- SetWinLocales(undef, undef, $OptLocale, $CountryId, undef, undef, undef, undef);
+ SetWinLocales($OptSysCopy, $OptDefCopy, $OptLocale, $CountryId, undef, undef, undef, undef);
last;
}
sleep(2);
Module: tools
Branch: master
Commit: 8feb70cfc29b465c9644174b0c77cc0ed49951dc
URL: https://source.winehq.org/git/tools.git/?a=commit;h=8feb70cfc29b465c9644174…
Author: Jeremy White <jwhite(a)codeweavers.com>
Date: Thu Apr 28 19:27:34 2022 -0500
Add context for threads of any kind.
Seems to give better context for discussions with diffnotes.
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
gitlab/gitlab-to-mail/gitlabtomail.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/gitlab/gitlab-to-mail/gitlabtomail.py b/gitlab/gitlab-to-mail/gitlabtomail.py
index 6beedf3..747ac66 100755
--- a/gitlab/gitlab-to-mail/gitlabtomail.py
+++ b/gitlab/gitlab-to-mail/gitlabtomail.py
@@ -336,10 +336,11 @@ def process_commented_on(event):
diffnote = fetch_diffnotes(event['note']['noteable_iid'], author, event['note']['id'], event['note']['position'])
body += diffnote
- if event['note']['type'] == 'DiscussionNote':
- original = find_original_comment(event['note']['noteable_iid'], event['note']['id'])
- if original:
- body += quote_original_comment(original)
+ # If we are part of a thread, naively quote the last comment
+ # this seems slightly improve reported context.
+ original = find_original_comment(event['note']['noteable_iid'], event['note']['id'])
+ if original:
+ body += quote_original_comment(original)
body += event['note']['body']
Module: tools
Branch: master
Commit: bbe90c2b8f64e3851db37b472986ad5fd4f90085
URL: https://source.winehq.org/git/tools.git/?a=commit;h=bbe90c2b8f64e3851db37b4…
Author: Jeremy White <jwhite(a)codeweavers.com>
Date: Thu Apr 28 19:18:52 2022 -0500
Use position to try to match DiffNotes.
This seems to produce a better result.
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
gitlab/gitlab-to-mail/gitlabtomail.py | 39 ++++++++++++-----------------------
1 file changed, 13 insertions(+), 26 deletions(-)
diff --git a/gitlab/gitlab-to-mail/gitlabtomail.py b/gitlab/gitlab-to-mail/gitlabtomail.py
index a2f7079..6beedf3 100755
--- a/gitlab/gitlab-to-mail/gitlabtomail.py
+++ b/gitlab/gitlab-to-mail/gitlabtomail.py
@@ -152,33 +152,26 @@ def quote_original_comment(note):
return prefix + '> ' + '> '.join(ret)
-def find_line_code_in_notes(notes, line_code):
- for note in notes:
- if 'diff_file' in note and 'truncated_diff_lines' in note:
- for diff in note['truncated_diff_lines']:
- if diff['line_code'] == line_code:
- return "{}@{}/{}\n".format(note['diff_file']['new_path'], diff['new_line'],
- str(diff['old_line']) + "> " + diff['text'] + "\n")
- return None
-
-
-def fetch_diffnotes(mr_iid, author, line_codes):
+def fetch_diffnotes(mr_iid, author, note_id, position):
# This is a KLUDGE. The discussions.json entry point is not documented.
# It provides back an array of all discussions on a given Merge request.
- # We can use it to pick out a particular DiffNote, using the ending line_code.
+ # We can use it to pick out a particular DiffNote, using the position.
# Human readable text seems to come up in 'truncated_diff_lines'.
# I've made an ask for a better way to do this, but it seems to work for now.
url = urljoin(settings.GITLAB_URL, f"/{settings.GITLAB_PROJECT_NAME}/-/merge_requests/{mr_iid}/discussions.json")
r = requests.get(url, headers={"PRIVATE-TOKEN": settings.GITLAB_TOKEN})
r.raise_for_status()
- notes = r.json()
+ discussions = r.json()
diffnotes = ""
- for note in notes:
- if 'line_code' in note and note['line_code'] in line_codes:
- diffnotes += "{} commented about {}:\n".format(author, note['diff_file']['new_path'])
- if 'truncated_diff_lines' in note:
- for diff in note['truncated_diff_lines']:
- diffnotes += "> " + diff['text'] + "\n"
+ for d in discussions:
+ if d['notes'][0]['id'] == str(note_id):
+ if 'truncated_diff_lines' in d and 'position' in d:
+ if d['position'] == position:
+ diffnotes += "{} commented about {}:\n".format(author, d['diff_file']['new_path'])
+ if 'truncated_diff_lines' in d:
+ for diff in d['truncated_diff_lines']:
+ diffnotes += "> " + diff['text'] + "\n"
+ break
return diffnotes
@@ -340,13 +333,7 @@ def process_commented_on(event):
# TODO - this is fairly fragile. hoping to get guidance here:
# https://forum.gitlab.com/t/end-point-to-retrieve-a-diffnote/66926
if event['note']['type'] == 'DiffNote':
- line_codes = []
- if 'position' in event['note'] and 'line_range' in event['note']['position']:
- if 'start' in event['note']['position']['line_range']:
- line_codes.append(event['note']['position']['line_range']['start']['line_code'])
- if 'end' in event['note']['position']['line_range']:
- line_codes.append(event['note']['position']['line_range']['end']['line_code'])
- diffnote = fetch_diffnotes(event['note']['noteable_iid'], author, line_codes)
+ diffnote = fetch_diffnotes(event['note']['noteable_iid'], author, event['note']['id'], event['note']['position'])
body += diffnote
if event['note']['type'] == 'DiscussionNote':