-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetcommits.py
125 lines (117 loc) · 3.6 KB
/
getcommits.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import json
import pprint
import requests
pp = pprint.PrettyPrinter(indent=4)
repos = ["cloudedge/buffserv",
"cloudedge/build-dp-fpga",
"cloudedge/build-dpdk",
"cloudedge/common",
"cloudedge/fpga-sro",
"cloudedge/gtpserv",
"cloudedge/intel-sdk-fpga",
"cloudedge/pfcp",
"cloudedge/qmdpi",
"cloudedge/services",
"cloudedge/test",
"cloudedge/tools",
"cloudedge/uclb",
"cloudedge/upf",
"cloudedge/upf-dp-bf",
"cloudedge/upf-dp-fpga",
"cloudedge/upf-dp-fpga-hw",
"cloudedge/upf-dp-fpga-sw",
"cloudedge/upf-dp-x86",
"cloudedge/upf-pe",
"cloudedge/upfc",
"cloudedge/upfu",
"flowfabric/aa-agent",
"flowfabric/base-image",
"flowfabric/basics",
"flowfabric/bastioninstaller",
"flowfabric/bato",
"flowfabric/bnc",
"flowfabric/bns",
"flowfabric/build-bess",
"flowfabric/build-dp-bf",
"flowfabric/build-go",
"flowfabric/cert-agent",
"flowfabric/cli",
"flowfabric/cni-plugins",
"flowfabric/cni-plugins-rt",
"flowfabric/coredns",
"flowfabric/coredns-provisioning",
"flowfabric/cpp-config",
"flowfabric/dataplane-bf",
"flowfabric/dataplane-common",
"flowfabric/dataplane-common-hw",
"flowfabric/dataplane-fpga",
"flowfabric/dataplane-scripts",
"flowfabric/dhcp",
"flowfabric/dhcpd",
"flowfabric/dls",
"flowfabric/dnsmasq",
"flowfabric/dp-bf-protobuf",
"flowfabric/drivers",
"flowfabric/etcd",
"flowfabric/fcs",
"flowfabric/fps",
"flowfabric/frr",
"flowfabric/gui",
"flowfabric/haproxy",
"flowfabric/httpd",
"flowfabric/hwdata",
"flowfabric/interop",
"flowfabric/intproxy",
"flowfabric/k8s-netagent",
"flowfabric/k8s-nuodb",
"flowfabric/k8s-podagent",
"flowfabric/keepalived",
"flowfabric/kfm",
"flowfabric/ksdf",
"flowfabric/ksdf-admin",
"flowfabric/kvs",
"flowfabric/kvs-rt-dbg",
"flowfabric/ldap-server",
"flowfabric/lg",
"flowfabric/lnc",
"flowfabric/log-collector",
"flowfabric/log-forwarder",
"flowfabric/msgbus",
"flowfabric/ncs",
"flowfabric/ncsfm",
"flowfabric/ncsvf",
"flowfabric/netconfig-utils",
"flowfabric/network-operator",
"flowfabric/nuodb",
"flowfabric/nuodb-nuoadm",
"flowfabric/ocp-installer",
"flowfabric/racadm",
"flowfabric/registry",
"flowfabric/rts",
"flowfabric/rtsp",
"flowfabric/syscfg-operator",
"flowfabric/syslogd-sidecar",
"flowfabric/uts",
"flowfabric/vfx",
"flowfabric/vrouter",
"flowfabric/vrouter-dp"]
dict = {}
for repo in repos:
print(repo)
request = "https://gitlab.kaloom.io/api/v4/projects/" + repo.replace("/", "%2F") + "/repository/commits?since=2021-01-01?ref_name=master?all=true&per_page=10000"
response = requests.get(request, headers={'PRIVATE-TOKEN': 'Knbj2iNpu6sLG3jCsQ7B'})
data = json.loads(response.content)
#print(json.dumps(data, indent=4, sort_keys=True))
total = 0
num_commits = len(data)
for commit in data:
#print(json.dumps(commit, indent=4, sort_keys=True))
request = "https://gitlab.kaloom.io/api/v4/projects/" + repo.replace("/", "%2F") + "/repository/commits/" + commit['id'] + "?stats=yes"
response = requests.get(request, headers={'PRIVATE-TOKEN': 'Knbj2iNpu6sLG3jCsQ7B'})
data = json.loads(response.content)
#print(json.dumps(data, indent=4, sort_keys=True))
total = total + data['stats']['additions']
dict[repo] = {'num_commits': str(num_commits), 'total': str(total)}
#print(dict)
for key in dict:
print(key + "," + dict[key]['num_commits'] + "," + dict[key]['total'])