[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [githax/master] Add a script to generate good-looking gitlab checklists



commit 1452873415e94a04bf43127a3d3c1b37e41095d7
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Thu Jun 18 17:41:04 2020 -0400

    Add a script to generate good-looking gitlab checklists
---
 gitlab/gitlab-checklist | 68 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/gitlab/gitlab-checklist b/gitlab/gitlab-checklist
new file mode 100755
index 0000000..3af269c
--- /dev/null
+++ b/gitlab/gitlab-checklist
@@ -0,0 +1,68 @@
+#!/usr/bin/python3
+import gitlab
+import sys
+
+#
+# To use this program, copy a list of tickets from gitlab.  It's indended
+# that you'll take the list from the tracbot list of parent and child
+# tickets, getting a string like:
+#   " legacy/trac#33679 (moved), legacy/trac#33073 (moved), ..."
+#
+# This program will talk to gitlab and find what the tickets names are
+# and what projects they belong to.  It is set up to look in tor, then
+# chutney, then legacy/trac, and it is set up to write tickets
+# relative to "tor".
+#
+# The result will be a gitlab checklist.
+
+if sys.stdin.isatty():
+    print("(reading from stdin...)", file=stderr)
+
+# Parse the input.
+input = sys.stdin.read()
+input = input.replace("legacy/trac#", " ")
+input = input.replace("(moved)", " ")
+input = input.replace(",", " ")
+issues = input.split()
+
+gl = gitlab.Gitlab('https://gitlab.torproject.org')
+
+MAIN_PROJECT = "tor"
+
+if 0:
+    all_projects = {}
+    for p in gl.projects.list(all=True):
+        all_projects[p.name.lower()] = p
+
+    projects = [ all_projects[x] for x in [
+            "tor", "chutney", "legacy/trac" ]]
+
+else:
+    projects = [ gl.projects.get(i) for i in
+                 [ 426, # tor
+                   427, # chutney
+                   414, # legacy/trac
+                 ] ]
+
+def get_issue(iid):
+    for p in projects:
+        try:
+            return p.issues.get(iid)
+        except gitlab.exceptions.GitlabError:
+            pass
+    return None
+
+for iid in issues:
+    issue = get_issue(iid)
+    if issue is None:
+        print(" * [ ] #{} ????".format(iid))
+    else:
+        if issue.state == 'closed':
+            x = "x"
+        else:
+            x = " "
+        name = gl.projects.get(issue.project_id).name.lower()
+        if name == MAIN_PROJECT:
+            name = ""
+        print(" * [{}] {}#{} {} ".format(x, name, iid, issue.title))
+

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits