Actors hold information about a person acting on the repository. They can be committers and authors or anything with a name and an email as mentioned in the git log entries.
Create an Actor from a string.
A Blob encapsulates a git blob object
The blame information for the given file at the given commit
The binary contents of this blob.
The mime type of this file (based on the filename)
The size of this blob in bytes
The Git class manages communication with the Git binary.
It provides a convenient interface to calling the Git binary, such as in:
g = Git( git_dir ) g.init() # calls 'git init' program rval = g.ls_files() # calls 'git ls-files' program
- Debugging
- Set the GIT_PYTHON_TRACE environment variable print each invocation of the command to stdout. Set its value to ‘full’ to see details about the returned values.
Handles executing the command on the shell and consumes and returns the returned information (stdout)
Returns:
str(output) # extended_output = False (Default)
tuple(int(status), str(stdout), str(stderr)) # extended_output = True
Wraps a git Commit object.
This class will act lazily on some of its attributes and will query the value on demand only if it involves calling the git binary.
Parse out the actor (author or committer) info
Count the number of commits reachable from this ref
Creates diffs between a tree and the index or between two trees:
git.Diff[]:
between tree and the index if only a is given
between two trees if a and b are given and are commits
Find all commits matching the given criteria. repo
is the Repo
Parse out commit information into a list of Commit objects
Create a git stat from changes between this commit and its first parent or from all changes done if this is the very first commit.
Module containing all exceptions thrown througout the git package,
A Head is a named reference to a Commit. Every Head instance contains a name and a Commit object.
Examples:
>>> repo = Repo("/path/to/repo")
>>> head = repo.heads[0]
>>> head.name
'master'
>>> head.commit
<git.Commit "1c09f116cbc2cb4100fb6935bb162daa4723f455">
>>> head.commit.id
'1c09f116cbc2cb4100fb6935bb162daa4723f455'
Find all Heads in the repository
git.Head[]
List is sorted by committerdate
Create a new Head instance from the given string.
Format:
name: [a-zA-Z_/]+
<null byte>
id: [0-9A-Fa-f]{40}
Parse out head information into a list of head objects
Represents a git repository and allows you to query references, gather commit information, generate diffs, create and clone repositories query the log.
The name of the currently active branch.
Archive the given treeish
Examples:
>>> repo.archive_tar
<String containing tar archive>
>>> repo.archive_tar('a87ff14')
<String containing tar archive for commit a87ff14>
>>> repo.archive_tar('master', 'myproject/')
<String containing tar bytes archive, whose files are prefixed with 'myproject/'>
Archive and gzip the given treeish
Examples:
>>> repo.archive_tar_gz
<String containing tar.gz archive>
>>> repo.archive_tar_gz('a87ff14')
<String containing tar.gz archive for commit a87ff14>
>>> repo.archive_tar_gz('master', 'myproject/')
<String containing tar.gz archive and prefixed with 'myproject/'>
The Blob object for the given id
A list of Head objects representing the branch heads in this repo
The Commit object for the specified id
The number of commits reachable by the given branch/commit
Returns a list of commits that is in other_repo but not in self
A list of Commit objects representing the history of a given ref/commit
is the branch/commit name (default ‘master’)
is the maximum number of commits to return (default 10)
The Commits objects that are reachable via to but not via frm Commits are returned in chronological order.
The Commits objects that are newer than the specified date. Commits are returned in chronological order.
Initialize a bare git repository at the given path
Examples:
git.Repo.init_bare('/var/git/myrepo.git')
The diff from commit a to commit b, optionally restricted to the given file(s)
Fork a bare git repository from this repo
A list of Head objects representing the branch heads in this repo
Initialize a bare git repository at the given path
Examples:
git.Repo.init_bare('/var/git/myrepo.git')
Return the status of the index.
The Commit for a treeish, and all commits leading to it.
A list of Tag objects that are available in this repo
The Tree object for the given treeish reference
Examples:
repo.tree('master')
Represents stat information as presented by git at the end of a merge. It is created from the output of a diff operation.
Example:
c = Commit( sha1 )
s = c.stats
s.total # full-stat-dict
s.files # dict( filepath : stat-dict )
stat-dict
A dictionary with the following keys and values:
deletions = number of deleted lines as int
insertions = number of inserted lines as int
lines = total number of lines changed as int, or deletions + insertions
full-stat-dict
In addition to the items in the stat-dict, it features additional information:
files = number of changed files as int
Create a Stat object from output retrieved by git-diff.
Find all Tags in the repository
git.Tag[]
List is sorted by committerdate
Create a new Tag instance from the given string.
Format:
name: [a-zA-Z_/]+
<null byte>
id: [0-9A-Fa-f]{40}
Parse out tag information into an array of Tag objects
Parse a content item and create the appropriate object
is the Repo