updating specific file etc.

This commit is contained in:
Matthew Gaughan 2024-03-31 16:50:23 -05:00
parent 6d4f56abe6
commit d113e0991a

View File

@ -66,33 +66,7 @@ def get_file(vcs_link, commit_hash, is_readme):
shutil.rmtree(full_temp_path, ignore_errors=True)
shutil.rmtree(other_temp_path, ignore_errors=True)
return "NoFile"
#target_filename = r"/README/"
#issue with searching through the tree this way
# need to match the tree w blobs
#print(commit0.tree.blobs)
#file_id = commit0.tree[r'README.*'].hexsha
#targetfile = repo0.blob(file_id)
#targetfile = commit0.tree / target_filename
'''
try:
targetfile = commit0.tree / target_filename
except KeyError:
target_filename = "README.rst"
try:
targetfile = commit0.tree / target_filename
except KeyError:
target_filename = "README"
try:
targetfile = commit0.tree / target_filename
except KeyError:
target_filename = "README.txt"
try:
targetfile = commit0.tree / target_filename
except KeyError:
shutil.rmtree(full_temp_path, ignore_errors=True)
shutil.rmtree(other_temp_path, ignore_errors=True)
return "KeyError -- the file is not in the commit tree"
'''
targetfile = ""
for blob in commit0.tree.blobs:
#print(type(blob.path))
@ -140,9 +114,9 @@ def for_all_files():
return_value = get_file(row[0], row[2], readme_is)
if return_value != "NoError":
csv_writer.writerow([row[0], row[2], readme_is, return_value])
#get_file('https://github.com/tqdm/tqdm', 'fbe7952cce11e8073378b063bdae7ab277a96eb8', True)
# if it is noError, just write the row down in a different csv
# there's an issue of duplicates, but just keep it moving
# if no duplicates -- just run it through
if __name__ == "__main__":
for_all_files()
#print(get_file('https://github.com/the-tcpdump-group/tcpslice', 'ffac277bf41946a1d985afae7fe2535d7a28546f', True))
#get_file('https://github.com/krahets/hello-algo/tree/dev1', 'f615ad42ef3c58cfc6f080b8fb0cd0eb741706a9', True )
for_all_files()