-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsanity_check.py
executable file
·75 lines (58 loc) · 1.99 KB
/
sanity_check.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
#!/usr/local/bin/python
#
# Quick & dirty sanity check script for hotfix releases.
#
# Simply displays all commits which does not exists in hotfix branch.
#
import sys
import argparse
import subprocess
import os
f = open('sanity.txt', 'w')
modules = ("api", "impl", "support", "gui-distribution", "app-developer")
for module in modules:
os.chdir(module)
f.write("\n\n========== " + module + ": List of commits only in develop branch =============\n")
try:
out_bytes = subprocess.check_output("git log --oneline hotfix/3.1.1..develop --format=format:'%an %ad %H %s'", shell=True)
except subprocess.CalledProcessError as e:
out_bytes = e.output
code = e.returncode
result = {}
# result_text = out_bytes.decode("utf-8")
lines = str(out_bytes).split("\n")
for line in lines:
entry = line.split(" ")
if len(entry) is 4:
name = entry[0]
entries = []
if name in result:
entries = result[name]
entries.append(entry[1:4])
result[name] = entries
subprocess.call(['git', 'checkout', 'develop'])
try:
out4 = subprocess.check_output("git log --oneline develop..hotfix/3.1.1 --format=format:'%s'", shell=True)
except subprocess.CalledProcessError as e:
out4 = e.output
code = e.returncode
lines = str(out4).split("\n")
in_dev = []
for line in lines:
in_dev.append(line)
count = 0
for name in result:
entries = result[name]
f.write("\n# Committer: " + name + "\n")
for entry in entries:
if entry[2] in in_dev:
print("Dupricate: " + str(entry))
else:
f.write(entry[0] + "\t" + entry[1] + "\t" + entry[2] + "\n")
try:
out3 = subprocess.check_output("git checkout hotfix/3.1.1", shell=True)
except subprocess.CalledProcessError as e:
out3 = e.output
code = e.returncode
os.chdir("..")
f.close()