Jeremy White : Add the ability to process select MRs and events.
Alexandre Julliard
julliard at winehq.org
Thu Apr 28 10:56:35 CDT 2022
Module: tools
Branch: master
Commit: 4089204f69f4d08da70951986f793de58e8f27d3
URL: https://source.winehq.org/git/tools.git/?a=commit;h=4089204f69f4d08da70951986f793de58e8f27d3
Author: Jeremy White <jwhite at codeweavers.com>
Date: Thu Apr 28 07:37:04 2022 -0500
Add the ability to process select MRs and events.
This debug facility lets me test running just one
MR or event to make development simpler.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
gitlab/gitlab-to-mail/gitlabtomail.py | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/gitlab/gitlab-to-mail/gitlabtomail.py b/gitlab/gitlab-to-mail/gitlabtomail.py
index 74ea95e..d4d6972 100755
--- a/gitlab/gitlab-to-mail/gitlabtomail.py
+++ b/gitlab/gitlab-to-mail/gitlabtomail.py
@@ -607,8 +607,30 @@ def process_mr(mr, update_db):
db.set_last_mr_updated_at(updated_at)
+def handle_debug_requests():
+ for arg in sys.argv[2:]:
+ if arg.find("mr=") == 0:
+ print(f"Processing MR iid {arg[3:]}")
+ mr = fetch_specific_mr(int(arg[3:]))
+ process_mr(mr, False)
+ elif arg.find("event=") == 0:
+ print(f"Processing event id {arg[6:]}")
+ # I did not immediately see a way to get a specific event.
+ # This is debug code, so I'm at peace with doing this inefficiently
+ date = (datetime.datetime.now() - datetime.timedelta(days=365)).date()
+ for event in fetch_events(date):
+ if event['id'] == int(arg[6:]):
+ process_event(event)
+ else:
+ print(f"Error: unknown argument {arg}", file=sys.stderr)
+
+
def main():
+ if len(sys.argv) > 2:
+ handle_debug_requests()
+ return
+
# Process any new merge requests
last_mr_updated_at = db.get_last_mr_updated_at()
if not last_mr_updated_at:
More information about the wine-cvs
mailing list