Base Git Provider¶
This is an incomplete provider. Currently, it acts as a base for
GitHubRepo, and does not support cloning arbitrary Git URLs.
- class modify_repos.repo.git.GitRepo(script, remote_id)¶
Bases:
RepoSubclass this to define how to manipulate Git repositories.
- add_untracked: bool = False¶
Whether to consider untracked files when checking if there are changes and adding files in the auto
commit(). By default this is false to avoid accidentally adding generated files, but this means you need to remember to callgit_add()for any completely new files.
- git_cmd(*args)¶
Call and pass args to the
gitcommand.
- reset_target()¶
Reset the base branch that will be branched off of and merged into. This should ensure the repository is clean and up to date, discarding any changes from previous unsuccessful runs. Called by
run().- Return type:
None
- reset_branch()¶
Create or reset the work branch. This should ensure the branch is freshly created from the target branch. Called by
run().- Return type:
None
- needs_commit()¶
Check if there are uncommitted changes. Called by
auto_commit_if_needed().- Return type:
- auto_commit()¶
Create a commit unconditionally. This is called by
auto_commit_if_needed()to create the automatic commit when there are uncommitted changes, and should add those changes to the commit. It should not be called to create other intermediate commits. It should useScript.messageas the commit message.- Return type:
None
- needs_submit()¶
Check if there are commits that have not been pushed upstream. Called by
submit_if_needed().- Return type:
- submit()¶
Submit the changes upstream. What this means depends on the implementation; whether it merges, creates a PR, or something else.
- Return type:
None
- commit(message, add=False)¶
Create a commit with the given message.
- add_files(*items, update=False, all=False)¶
Call
git add.