47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
from perceval.backends.core.git import Git
|
|
import os
|
|
import datetime as dt
|
|
import shutil
|
|
|
|
key = os.environ.get('KKEXKEY')
|
|
|
|
early_cutoff = dt.datetime(2008,2, 8)
|
|
temp_dir = "/data/users/mgaughan/tmp"
|
|
|
|
def file_get_pr(upstream_vcs_link):
|
|
#print(upstream_vcs_link.split('/')[4])
|
|
full_temp_path = temp_dir + upstream_vcs_link.split('/')[4] + ".git"
|
|
repo = Git(uri=upstream_vcs_link, gitpath=full_temp_path)
|
|
try:
|
|
commits = repo.fetch()
|
|
except:
|
|
print("perceval issue")
|
|
return
|
|
has_readme = False
|
|
has_contributing = False
|
|
merge_pre_rm, merge_post_rm, merge_pre_cont, merge_post_cont = 0, 0, 0, 0
|
|
for commit in commits:
|
|
if "Merge" in commit['data'].keys():
|
|
if has_contributing:
|
|
merge_post_cont += 1
|
|
else:
|
|
merge_pre_cont += 1
|
|
print('merge')
|
|
else:
|
|
print('not')
|
|
files = commit['data']['files']
|
|
#print(commit['data']['CommitDate'])
|
|
for file in files:
|
|
if "CONTRIBUTING.md" == file['file']:
|
|
has_contributing = True
|
|
if "README.md" == file['file']:
|
|
has_readme = True
|
|
shutil.rmtree(full_temp_path, ignore_errors=True)
|
|
print("merge pre cont: " + str(merge_pre_cont))
|
|
print('merge post cont: ' + str(merge_post_cont))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
file_get_pr("https://github.com/tqdm/tqdm")
|
|
|