Skip to content

Commit

Permalink
Added subdir tracking suppor
Browse files Browse the repository at this point in the history
  • Loading branch information
AsherSeiling committed May 22, 2021
1 parent 2c53875 commit 587effe
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
11 changes: 6 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ def main():
print("Repo not initilized")

# Checks to run the code
try:
if runcode == True:
main()
except:
print("Error: Command not found")
#try:
#if runcode == True:
# main()
#except:
# print("Error: Command not found")
main()
2 changes: 1 addition & 1 deletion modules/initilizeNew.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ def initNew():
jsondata = json.dumps(jsonmasterconfig, indent=4)
jsonFile = open("branches/master/config.json", "w+")
jsonFile.write(jsondata)
jsonFile.close()
jsonFile.close()
24 changes: 16 additions & 8 deletions modules/sourceyTrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,25 @@ def find_differences():
for i in referencelastcommit:
if i not in refernceCurrentData:
change_log["deletion"].append(i)
# Add sub dirs in the changes changes_possible
for i in changes_possible:
if os.path.isdir(i) == True:
for files in os.listdir(i):
changes_possible.append(f"{i}/{files}")
# Find the changes_possible
for i in changes_possible:
if os.path.isdir(i) == False:
changes1 = open(i, "r").read()
changes2 = open(f".sourcey/branches/{mainJsondata['currentBranch']}/commits/{BranchJson['commitsnum']}/{i}").read()
changes_percent = 0
if changes1 != changes2:
lenchanges1 = len(changes1)
lenchanges2 = len(changes2)
changes_percent = 100 - (((lenchanges2 / lenchanges1) - math.floor(lenchanges2 / lenchanges1)) * 100)
change_log["changes"].append({"file" : f"{i}", "changePercent" : f"{changes_percent}"})
try:
changes1 = open(i, "r").read()
changes2 = open(f".sourcey/branches/{mainJsondata['currentBranch']}/commits/{BranchJson['commitsnum']}/{i}").read()
changes_percent = 0
if changes1 != changes2:
lenchanges1 = len(changes1)
lenchanges2 = len(changes2)
changes_percent = 100 - (((lenchanges2 / lenchanges1) - math.floor(lenchanges2 / lenchanges1)) * 100)
change_log["changes"].append({"file" : f"{i}", "changePercent" : f"{changes_percent}"})
except:
pass
return change_log

# Main Disp functions
Expand Down

0 comments on commit 587effe

Please sign in to comment.