Skip to content

Commit 46f5ace

Browse files
authored
1 parent 6ade684 commit 46f5ace

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import json
2+
3+
from .ReportRepository import *
4+
5+
class ReportGitSizer(ReportRepository):
6+
def name(self):
7+
return "git-sizer"
8+
9+
def convertBytesToKiB(self, bytes):
10+
return round(bytes / 1024, 1)
11+
12+
def convertBytesToMiB(self, bytes):
13+
return round(bytes / 1024 ** 2, 3)
14+
15+
def updateData(self):
16+
stdout = self.executeScript(["ghe-repo", self.repository, "-c", self.configuration["gitSizerPath"] + " --json --json-version=2"])
17+
18+
sizerData = json.loads(stdout.decode("utf-8"))
19+
20+
getSizerDataValue = lambda key: sizerData[key]["value"]
21+
22+
self.header = \
23+
[
24+
"date",
25+
26+
# Overall repository size
27+
"commits",
28+
"commits [MiB]",
29+
"trees",
30+
"trees [MiB]",
31+
"tree entries",
32+
"blobs",
33+
"blobs [MiB]",
34+
"annotated tags",
35+
"refs",
36+
37+
# Biggest objects
38+
"biggest commit [KiB]",
39+
"most parents",
40+
"most tree entries",
41+
"biggest blob [MiB]",
42+
43+
# History structure
44+
"largest history depth",
45+
"largest tag depth",
46+
47+
# Biggest checkouts
48+
"directories",
49+
"path depth",
50+
"path length",
51+
"files",
52+
"size of files [MiB]",
53+
"symlinks",
54+
"submodules"
55+
]
56+
57+
self.data.append(
58+
[
59+
str(self.yesterday()),
60+
61+
# Overall repository size
62+
getSizerDataValue("uniqueCommitCount"),
63+
self.convertBytesToMiB(getSizerDataValue("uniqueCommitSize")),
64+
getSizerDataValue("uniqueTreeCount"),
65+
self.convertBytesToMiB(getSizerDataValue("uniqueTreeSize")),
66+
getSizerDataValue("uniqueTreeEntries"),
67+
getSizerDataValue("uniqueBlobCount"),
68+
self.convertBytesToMiB(getSizerDataValue("uniqueBlobSize")),
69+
getSizerDataValue("uniqueTagCount"),
70+
getSizerDataValue("referenceCount"),
71+
72+
# Biggest objects
73+
self.convertBytesToKiB(getSizerDataValue("maxCommitSize")),
74+
getSizerDataValue("maxCommitParentCount"),
75+
getSizerDataValue("maxTreeEntries"),
76+
self.convertBytesToMiB(getSizerDataValue("maxBlobSize")),
77+
78+
# History structure
79+
getSizerDataValue("maxHistoryDepth"),
80+
getSizerDataValue("maxTagDepth"),
81+
82+
# Biggest checkouts
83+
getSizerDataValue("maxCheckoutTreeCount"),
84+
getSizerDataValue("maxCheckoutPathDepth"),
85+
getSizerDataValue("maxCheckoutPathLength"),
86+
getSizerDataValue("maxCheckoutBlobCount"),
87+
self.convertBytesToMiB(getSizerDataValue("maxCheckoutBlobSize")),
88+
getSizerDataValue("maxCheckoutLinkCount"),
89+
getSizerDataValue("maxCheckoutSubmoduleCount")
90+
])

0 commit comments

Comments
 (0)