OpenQuizz
Une application de gestion des contenus pédagogiques
Commit Class Reference
Inheritance diagram for Commit:
Collaboration diagram for Commit:

Public Member Functions

def __init__ (self, repo, binsha, tree=None, author=None, authored_date=None, author_tz_offset=None, committer=None, committed_date=None, committer_tz_offset=None, message=None, parents=None, encoding=None, gpgsig=None)
 
def replace (self, **kwargs)
 
def authored_datetime (self)
 
def committed_datetime (self)
 
def summary (self)
 
def count (self, paths='', **kwargs)
 
def name_rev (self)
 
def iter_items (cls, repo, rev, paths='', **kwargs)
 
def iter_parents (self, paths='', **kwargs)
 
def stats (self)
 
def create_from_tree (cls, repo, tree, message, parent_commits=None, head=False, author=None, committer=None, author_date=None, commit_date=None)
 
- Public Member Functions inherited from Object
def __init__ (self, repo, binsha)
 
def new (cls, repo, id)
 
def new_from_sha (cls, repo, sha1)
 
def __eq__ (self, other)
 
def __ne__ (self, other)
 
def __hash__ (self)
 
def __str__ (self)
 
def __repr__ (self)
 
def hexsha (self)
 
def data_stream (self)
 
def stream_data (self, ostream)
 
- Public Member Functions inherited from Iterable
def list_items (cls, repo, *args, **kwargs)
 
def iter_items (cls, repo, *args, **kwargs)
 
- Public Member Functions inherited from Diffable
def diff (self, other=Index, paths=None, create_patch=False, **kwargs)
 
- Public Member Functions inherited from Traversable
def list_traverse (self, *args, **kwargs)
 
def traverse (self, predicate=lambda i, True d, prune=lambda i, False d, depth=-1, branch_first=True, visit_once=True, ignore_self=1, as_edge=False)
 

Data Fields

 tree
 
 author
 
 authored_date
 
 author_tz_offset
 
 committer
 
 committed_date
 
 committer_tz_offset
 
 message
 
 parents
 
 encoding
 
 gpgsig
 
- Data Fields inherited from Object
 repo
 
 binsha
 
 size
 

Static Public Attributes

 env_author_date
 
 env_committer_date
 
 conf_encoding
 
 default_encoding
 
 type
 
- Static Public Attributes inherited from Object
 NULL_HEX_SHA
 
 NULL_BIN_SHA
 
 TYPES
 
 type
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  repo,
  binsha,
  tree = None,
  author = None,
  authored_date = None,
  author_tz_offset = None,
  committer = None,
  committed_date = None,
  committer_tz_offset = None,
  message = None,
  parents = None,
  encoding = None,
  gpgsig = None 
)
Instantiate a new Commit. All keyword arguments taking None as default will
be implicitly set on first query.

:param binsha: 20 byte sha1
:param parents: tuple( Commit, ... )
    is a tuple of commit ids or actual Commits
:param tree: Tree
    Tree object
:param author: Actor
    is the author Actor object
:param authored_date: int_seconds_since_epoch
    is the authored DateTime - use time.gmtime() to convert it into a
    different format
:param author_tz_offset: int_seconds_west_of_utc
    is the timezone that the authored_date is in
:param committer: Actor
    is the committer string
:param committed_date: int_seconds_since_epoch
    is the committed DateTime - use time.gmtime() to convert it into a
    different format
:param committer_tz_offset: int_seconds_west_of_utc
    is the timezone that the committed_date is in
:param message: string
    is the commit message
:param encoding: string
    encoding of the message, defaults to UTF-8
:param parents:
    List or tuple of Commit objects which are our parent(s) in the commit
    dependency graph
:return: git.Commit

:note:
    Timezone information is in the same format and in the same sign
    as what time.altzone returns. The sign is inverted compared to git's
    UTC timezone.

Member Function Documentation

◆ authored_datetime()

def authored_datetime (   self)

◆ committed_datetime()

def committed_datetime (   self)

◆ count()

def count (   self,
  paths = '',
**  kwargs 
)
Count the number of commits reachable from this commit

:param paths:
    is an optional path or a list of paths restricting the return value
    to commits actually containing the paths

:param kwargs:
    Additional options to be passed to git-rev-list. They must not alter
    the output style of the command, or parsing will yield incorrect results
:return: int defining the number of reachable commits

◆ create_from_tree()

def create_from_tree (   cls,
  repo,
  tree,
  message,
  parent_commits = None,
  head = False,
  author = None,
  committer = None,
  author_date = None,
  commit_date = None 
)
Commit the given tree, creating a commit object.

:param repo: Repo object the commit should be part of
:param tree: Tree object or hex or bin sha
    the tree of the new commit
:param message: Commit message. It may be an empty string if no message is provided.
    It will be converted to a string in any case.
:param parent_commits:
    Optional Commit objects to use as parents for the new commit.
    If empty list, the commit will have no parents at all and become
    a root commit.
    If None , the current head commit will be the parent of the
    new commit object
:param head:
    If True, the HEAD will be advanced to the new commit automatically.
    Else the HEAD will remain pointing on the previous commit. This could
    lead to undesired results when diffing files.
:param author: The name of the author, optional. If unset, the repository
    configuration is used to obtain this value.
:param committer: The name of the committer, optional. If unset, the
    repository configuration is used to obtain this value.
:param author_date: The timestamp for the author field
:param commit_date: The timestamp for the committer field

:return: Commit object representing the new commit

:note:
    Additional information about the committer and Author are taken from the
    environment or from the git configuration, see git-commit-tree for
    more information

◆ iter_items()

def iter_items (   cls,
  repo,
  rev,
  paths = '',
**  kwargs 
)
Find all commits matching the given criteria.

:param repo: is the Repo
:param rev: revision specifier, see git-rev-parse for viable options
:param paths:
    is an optional path or list of paths, if set only Commits that include the path
    or paths will be considered
:param kwargs:
    optional keyword arguments to git rev-list where
    ``max_count`` is the maximum number of commits to fetch
    ``skip`` is the number of commits to skip
    ``since`` all commits since i.e. '1970-01-01'
:return: iterator yielding Commit items

◆ iter_parents()

def iter_parents (   self,
  paths = '',
**  kwargs 
)
Iterate _all_ parents of this commit.

:param paths:
    Optional path or list of paths limiting the Commits to those that
    contain at least one of the paths
:param kwargs: All arguments allowed by git-rev-list
:return: Iterator yielding Commit objects which are parents of self 

◆ name_rev()

def name_rev (   self)
:return:
    String describing the commits hex sha based on the closest Reference.
    Mostly useful for UI purposes

◆ replace()

def replace (   self,
**  kwargs 
)
Create new commit object from existing commit object.

Any values provided as keyword arguments will replace the
corresponding attribute in the new object.

◆ stats()

def stats (   self)
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.

:return: git.Stats

◆ summary()

def summary (   self)
:return: First line of the commit message

Field Documentation

◆ author

author

◆ author_tz_offset

author_tz_offset

◆ authored_date

authored_date

◆ committed_date

committed_date

◆ committer

committer

◆ committer_tz_offset

committer_tz_offset

◆ conf_encoding

conf_encoding
static

◆ default_encoding

default_encoding
static

◆ encoding

encoding

◆ env_author_date

env_author_date
static

◆ env_committer_date

env_committer_date
static

◆ gpgsig

gpgsig

◆ message

message

◆ parents

parents

◆ tree

tree

◆ type

type
static

The documentation for this class was generated from the following file: