git
LibGit2Sharp wrapper module for pyRevit.
Documentation
https://github.com/libgit2/libgit2sharp/wiki
Attributes
mlogger = get_logger(__name__)
module-attribute
GIT_LIB = 'LibGit2Sharp'
module-attribute
LIBGIT_DLL = framework.get_dll_file(GIT_LIB)
module-attribute
Classes
PyRevitGitAuthenticationError
RepoInfo(repo)
Bases: object
Repo wrapper for passing around repository information.
Attributes:
Name | Type | Description |
---|---|---|
directory |
str
|
repo directory |
name |
str
|
repo name |
head_name |
str
|
head branch name |
last_commit_hash |
str
|
hash of head commit |
repo |
str
|
|
branch |
str
|
current branch name |
username |
str
|
credentials - username |
password |
str
|
credentials - password |
Source code in pyrevitlib/pyrevit/coreutils/git.py
Attributes
directory = repo.Info.WorkingDirectory
instance-attribute
name = op.basename(op.normpath(self.directory))
instance-attribute
head_name = repo.Head.FriendlyName
instance-attribute
last_commit_hash = repo.Head.Tip.Id.Sha
instance-attribute
repo = repo
instance-attribute
branch = repo.Head.FriendlyName
instance-attribute
username = None
instance-attribute
password = None
instance-attribute
Functions
get_repo(repo_dir)
Return repo object for given git repo directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_dir |
str
|
full path of git repo directory |
required |
Returns:
Type | Description |
---|---|
RepoInfo
|
repo object |
Source code in pyrevitlib/pyrevit/coreutils/git.py
git_pull(repo_info)
Pull the current head of given repo.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_info |
RepoInfo
|
target repo object |
required |
Returns:
Type | Description |
---|---|
RepoInfo
|
repo object with updated head |
Source code in pyrevitlib/pyrevit/coreutils/git.py
git_fetch(repo_info)
Fetch current branch of given repo.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_info |
RepoInfo
|
target repo object |
required |
Returns:
Type | Description |
---|---|
RepoInfo
|
repo object with updated head |
Source code in pyrevitlib/pyrevit/coreutils/git.py
git_clone(repo_url, clone_dir, username=None, password=None)
Clone git repository to given location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_url |
str
|
repo .git url |
required |
clone_dir |
str
|
destination path |
required |
username |
str
|
credentials - username |
None
|
password |
str
|
credentials - password |
None
|
Source code in pyrevitlib/pyrevit/coreutils/git.py
compare_branch_heads(repo_info)
Compare local and remote branch heads and return ???
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_info |
RepoInfo
|
target repo object |
required |
Source code in pyrevitlib/pyrevit/coreutils/git.py
get_all_new_commits(repo_info)
Fetch and return new commits ahead of current head.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_info |
RepoInfo
|
target repo object |
required |
Returns:
Type | Description |
---|---|
OrderedDict[str, str]
|
ordered dict of commit hash:message |