def pull_list_changed_files(git_path):
"""Pull new updates from remote origin."""
git_repo = git.Repo(git_path)
logging.info(" HEAD: " + str(git_repo.head.commit))
logging.info(" is detached: " + str(git_repo.head.is_detached))
logging.info(" is dirty: " + str(git_repo.is_dirty()))
if git_repo.head.is_detached:
raise Exception("Detached head")
if git_repo.is_dirty():
raise Exception("Dirty repository")
files = []
cdnjs_origin = git_repo.remotes.origin
fetch_info = cdnjs_origin.pull()
for single_fetch_info in fetch_info:
for diff in single_fetch_info.commit.diff(
single_fetch_info.old_commit):
logging.debug("Found diff: " + str(diff))
if not diff.a_blob is None:
if not diff.a_blob.path in files:
files.append(diff.a_blob.path)
return files
评论列表
文章目录