INNER CODE UNIT · Python

has_file_changed

DmitryRyumin/ICCV-2023-25-Papers · code/markdown_to_json_parser.py:120

def has_file_changed(repo, file_path, new_content, branch_name):
    try:
        contents = repo.get_contents(file_path, ref=branch_name)
        existing_content = contents.decoded_content.decode("utf-8")
        return existing_content != new_content
    except Exception as e:
        print(f"Exception in has_file_changed: {e}")
        print(f"File Path: {file_path}")
        return True


def create_git_tree_elements(file_updates):
    return [
        InputGitTreeElement(
            path=update.path, mode="100644", type="blob", content=update.content
        )
        for update in file_updates
    ]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…