skilleter-thingy 0.2.15__py3-none-any.whl → 0.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of skilleter-thingy might be problematic. Click here for more details.
- skilleter_thingy/gitcmp_helper.py +2 -0
- skilleter_thingy/multigit.py +6 -4
- skilleter_thingy/py_audit.py +5 -4
- skilleter_thingy/thingy/git.py +1 -1
- {skilleter_thingy-0.2.15.dist-info → skilleter_thingy-0.3.1.dist-info}/METADATA +75 -72
- {skilleter_thingy-0.2.15.dist-info → skilleter_thingy-0.3.1.dist-info}/RECORD +10 -16
- {skilleter_thingy-0.2.15.dist-info → skilleter_thingy-0.3.1.dist-info}/entry_points.txt +0 -8
- skilleter_thingy/docker_purge.py +0 -111
- skilleter_thingy/git_mr.py +0 -103
- skilleter_thingy/gl.py +0 -174
- skilleter_thingy/rmdupe.py +0 -553
- skilleter_thingy/thingy/docker.py +0 -97
- skilleter_thingy/x.py +0 -3
- {skilleter_thingy-0.2.15.dist-info → skilleter_thingy-0.3.1.dist-info}/WHEEL +0 -0
- {skilleter_thingy-0.2.15.dist-info → skilleter_thingy-0.3.1.dist-info}/licenses/LICENSE +0 -0
- {skilleter_thingy-0.2.15.dist-info → skilleter_thingy-0.3.1.dist-info}/top_level.txt +0 -0
skilleter_thingy/gl.py
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
#! /usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
""" Nearly MVP of a command to do things to GitLab
|
|
4
|
-
Currently just implements the 'mr-list' command which outputs a list
|
|
5
|
-
of merge requests from all projects in CSV format.
|
|
6
|
-
|
|
7
|
-
TODO: Lots and lots of things! """
|
|
8
|
-
|
|
9
|
-
################################################################################
|
|
10
|
-
|
|
11
|
-
import argparse
|
|
12
|
-
import os
|
|
13
|
-
import sys
|
|
14
|
-
from collections import defaultdict
|
|
15
|
-
|
|
16
|
-
import thingy.colour as colour
|
|
17
|
-
import thingy.gitlab as gitlab
|
|
18
|
-
|
|
19
|
-
################################################################################
|
|
20
|
-
|
|
21
|
-
def mr_list(args):
|
|
22
|
-
""" List merge requests """
|
|
23
|
-
|
|
24
|
-
gl = gitlab.GitLab(args.server)
|
|
25
|
-
|
|
26
|
-
# TODO: Could incorporate some/all filtering in the request rather than getting all MRs and filtering them
|
|
27
|
-
|
|
28
|
-
mrs = gl.merge_requests(scope='all')
|
|
29
|
-
|
|
30
|
-
# TODO: Output format other than CSV
|
|
31
|
-
# TODO: More filtering
|
|
32
|
-
|
|
33
|
-
if args.summary:
|
|
34
|
-
authors = defaultdict(int)
|
|
35
|
-
reviewers = defaultdict(int)
|
|
36
|
-
combos = defaultdict(int)
|
|
37
|
-
|
|
38
|
-
count = 0
|
|
39
|
-
for mr in mrs:
|
|
40
|
-
author = mr['author']['username']
|
|
41
|
-
authors[author] += 1
|
|
42
|
-
|
|
43
|
-
if mr['state'] == 'merged':
|
|
44
|
-
try:
|
|
45
|
-
reviewer = mr['merged_by']['username']
|
|
46
|
-
except TypeError:
|
|
47
|
-
reviewer = 'UNKNOWN'
|
|
48
|
-
|
|
49
|
-
reviewers[reviewer] += 1
|
|
50
|
-
combos[f"{author}|{reviewer}"] += 1
|
|
51
|
-
|
|
52
|
-
count += 1
|
|
53
|
-
if args.limit and count > args.limit:
|
|
54
|
-
break
|
|
55
|
-
|
|
56
|
-
print('Number of merge requests by author')
|
|
57
|
-
|
|
58
|
-
for value in sorted(set(authors.values()), reverse=True):
|
|
59
|
-
for person in authors:
|
|
60
|
-
if authors[person] == value:
|
|
61
|
-
print(f' {person:32}: {authors[person]}')
|
|
62
|
-
|
|
63
|
-
print()
|
|
64
|
-
print('Number of merge requests by reviewer')
|
|
65
|
-
|
|
66
|
-
for value in sorted(set(reviewers.values()), reverse=True):
|
|
67
|
-
for person in reviewers:
|
|
68
|
-
if reviewers[person] == value:
|
|
69
|
-
print(f' {person:32}: {reviewers[person]}')
|
|
70
|
-
|
|
71
|
-
print()
|
|
72
|
-
print('Author/Reviewer combinations for merged changes')
|
|
73
|
-
|
|
74
|
-
for value in sorted(set(combos.values()), reverse=True):
|
|
75
|
-
for combo in combos:
|
|
76
|
-
if combos[combo] == value:
|
|
77
|
-
author, reviewer = combo.split('|')
|
|
78
|
-
|
|
79
|
-
print(f' Written by {author}, reviewed by {reviewer}: {combos[combo]}')
|
|
80
|
-
|
|
81
|
-
else:
|
|
82
|
-
print('state,merge id,project id,author,approver,title,merge date')
|
|
83
|
-
|
|
84
|
-
for mr in mrs:
|
|
85
|
-
if args.author and mr['author']['username'] != args.author:
|
|
86
|
-
continue
|
|
87
|
-
|
|
88
|
-
if mr['state'] == 'merged':
|
|
89
|
-
try:
|
|
90
|
-
merged_by = mr['merged_by']['username']
|
|
91
|
-
except TypeError:
|
|
92
|
-
merged_by = 'NONE'
|
|
93
|
-
|
|
94
|
-
if args.approver and merged_by != args.approver:
|
|
95
|
-
continue
|
|
96
|
-
|
|
97
|
-
if not args.summary:
|
|
98
|
-
print('%s,%s,%s,%s,%s,%s,"%s"' % (mr['state'], mr['id'], mr['project_id'],
|
|
99
|
-
mr['author']['username'], merged_by, mr['title'], mr['merged_at']))
|
|
100
|
-
elif args.all and not args.summary:
|
|
101
|
-
print('%s,%s,%s,%s,,"%s",' % (mr['state'], mr['id'], mr['project_id'], mr['author']['username'], mr['title']))
|
|
102
|
-
|
|
103
|
-
count += 1
|
|
104
|
-
if args.limit and count > args.limit:
|
|
105
|
-
break
|
|
106
|
-
|
|
107
|
-
################################################################################
|
|
108
|
-
|
|
109
|
-
def main():
|
|
110
|
-
""" Entry point """
|
|
111
|
-
|
|
112
|
-
parser = argparse.ArgumentParser(description='Gitlab commands')
|
|
113
|
-
|
|
114
|
-
parser.add_argument('--dryrun', '--dry-run', '-D', action='store_true', help='Dry-run comands')
|
|
115
|
-
parser.add_argument('--debug', '-d', action='store_true', help='Debug')
|
|
116
|
-
parser.add_argument('--verbose', '-v', action='store_true', help='Verbosity to the maximum')
|
|
117
|
-
parser.add_argument('--server', '-s', default=None, help='The GitLab server')
|
|
118
|
-
parser.add_argument('--token', '-t', default=None, help='The GitLab access token')
|
|
119
|
-
|
|
120
|
-
subparsers = parser.add_subparsers(dest='command')
|
|
121
|
-
|
|
122
|
-
parser_mr_list = subparsers.add_parser('mr-list', help='List merge requests')
|
|
123
|
-
parser_mr_list.add_argument('--all', action='store_true', help='List un-merged merge requests')
|
|
124
|
-
parser_mr_list.add_argument('--author', action='store', help='List merge requests created by a specific user')
|
|
125
|
-
parser_mr_list.add_argument('--approver', action='store', help='List merge requests approved by a specific user')
|
|
126
|
-
parser_mr_list.add_argument('--summary', action='store_true', help='Produce a summary report')
|
|
127
|
-
parser_mr_list.add_argument('--limit', action='store', type=int, help='Output the first N merge requests')
|
|
128
|
-
|
|
129
|
-
# TODO: Other subcommands
|
|
130
|
-
|
|
131
|
-
# Parse the command line
|
|
132
|
-
|
|
133
|
-
args = parser.parse_args()
|
|
134
|
-
|
|
135
|
-
# Check the server/token configuration
|
|
136
|
-
|
|
137
|
-
if not args.server:
|
|
138
|
-
args.server = os.environ.get('GITLAB_SERVER', None)
|
|
139
|
-
|
|
140
|
-
if not args.server:
|
|
141
|
-
colour.error('The GitLab server must be specified on the command line or via the [BLUE:GITLAB_SERVER] environment variable')
|
|
142
|
-
|
|
143
|
-
if not args.token:
|
|
144
|
-
args.token = os.environ.get('GITLAB_TOKEN', None)
|
|
145
|
-
|
|
146
|
-
if not args.token:
|
|
147
|
-
colour.error('GitLab access token must be specified on the command line or via the [BLUE:GITLAB_TOKEN] environment variable')
|
|
148
|
-
|
|
149
|
-
# Invoke the subcommand
|
|
150
|
-
|
|
151
|
-
if args.command == 'mr-list':
|
|
152
|
-
mr_list(args)
|
|
153
|
-
|
|
154
|
-
elif not args.command:
|
|
155
|
-
colour.error('No command specified')
|
|
156
|
-
else:
|
|
157
|
-
colour.error(f'Invalid command: "{args.command}"')
|
|
158
|
-
|
|
159
|
-
################################################################################
|
|
160
|
-
|
|
161
|
-
def gl():
|
|
162
|
-
"""Entry point"""
|
|
163
|
-
|
|
164
|
-
try:
|
|
165
|
-
main()
|
|
166
|
-
except KeyboardInterrupt:
|
|
167
|
-
sys.exit(1)
|
|
168
|
-
except BrokenPipeError:
|
|
169
|
-
sys.exit(2)
|
|
170
|
-
|
|
171
|
-
################################################################################
|
|
172
|
-
|
|
173
|
-
if __name__ == '__main__':
|
|
174
|
-
gl()
|