-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathlog.py
More file actions
53 lines (48 loc) · 2.46 KB
/
log.py
File metadata and controls
53 lines (48 loc) · 2.46 KB
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
import variables as var
import stack_commands as sc
def pre_log(project_name):
if input().split()[0] == "log":
log(" ".join(input().split()[1:]))
def log(project_name, argument):
global_stack = sc.load_g(project_name)
if argument == "simple":
for commit in global_stack:
print("#####################################################################")
print(commit["date-time"])
print("</"+commit["user"]+"/>")
for element in commit["changes"].keys():
print("["+commit["changes"][element][0]+"]",element,":",sep = " --- ")
if commit["changes"][element][0]=="...":
for lines in commit["changes"][element][1].keys():
if commit["changes"][element][1][lines][0]=="...":
print("\t"+str(lines)+") "+"["+commit["changes"][element][1][lines][0]+"]"+": "+commit["changes"][element][1][lines][1][:-1]+" -> "+commit["changes"][element][1][lines][2][:-1])
else:
print("\t"+str(lines)+") "+"["+commit["changes"][element][1][lines][0]+"]"+": "+commit["changes"][element][1][lines][1][:-1])
print("#####################################################################")
if argument == "--name-only":
for commit in global_stack:
print("#####################################################################")
print(commit["date-time"])
for element in commit["changes"].keys():
print("["+commit["changes"][element][0]+"]",element,sep = " --- ")
print("#####################################################################")
elif argument == "--reverse":
for commit in reversed(global_stack):
print("#####################################################################")
print(commit["date-time"])
print("</"+commit["user"]+"/>")
for element in commit["changes"].keys():
print("["+commit["changes"][element][0]+"]",element,":",sep = " --- ")
if commit["changes"][element][0]=="...":
for lines in commit["changes"][element][1].keys():
if commit["changes"][element][1][lines][0]=="...":
print("\t"+str(lines)+") "+"["+commit["changes"][element][1][lines][0]+"]"+": "+commit["changes"][element][1][lines][1][:-1]+" -> "+commit["changes"][element][1][lines][2][:-1])
else:
print("\t"+str(lines)+") "+"["+commit["changes"][element][1][lines][0]+"]"+": "+commit["changes"][element][1][lines][1][:-1])
print("#####################################################################")
elif argument.split()[0] == "--after":
pass
def main():
log("n","--name-only")
if "__name__" == "__main__":
main()