veritas.repo

Package Contents

Classes

Repository

This class is a wrapper around the gitpython library. It provides a simple interface to interact with a git repository.

class veritas.repo.Repository(path: str, repo: str, ssh_cmd=None)

This class is a wrapper around the gitpython library. It provides a simple interface to interact with a git repository.

Parameters:
  • path (str) – path to the repository

  • repo (str) – name of the repository

  • ssh_cmd (str) – ssh command to use for remote operations

__getattr__(item)

getattr is called when an attribute is not found in the usual places

Parameters:

item (str) – name of the attribute

Returns:

the attribute

Return type:

item

_open_repository() None

open the repository

get_repo() git.Repo

return the repository

get_index() git.Repo.index

return the index

get_config()

return git configuration

get_info() dict

return git information

get_last_commits(max_count: int, filename: str) list

return last commits for a file

get_last_commits_of(path: str) list

get last commits of a path

get_revision(path)
get_commits() list

get commits

get_commits_details(diff: bool = False, diff_parsed: bool = False, source: bool = False, source_before: bool = False) list
set_config(key: str, sub_key: str, value: str) None

set git configuration

create_remote(remote_name: str, url: str) None

create a remote

has_changes() bool

check if there are changes

get_untracked_files() list

return untracked files

get_diff_summary(name_only: bool = True)
get_diff()

return diff

add(files: list)

add files to git

add_all()

add all files to git

commit(comment: str = '')

commit changes

push()

push changes

pull()

pull changes

commits(number_of_commits: int = 5) list

return list of commits

branch() str

return active branch

get_branch()

return branch

branches()

return branches

get(filename)

get file content

write(filename: str, content) bool

write content to file