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

Public Member Functions

def delete (cls, repo, *heads, **kwargs)
 
def set_tracking_branch (self, remote_reference)
 
def tracking_branch (self)
 
def rename (self, new_path, force=False)
 
def checkout (self, force=False, **kwargs)
 
def config_reader (self)
 
def config_writer (self)
 
- Public Member Functions inherited from Reference
def __init__ (self, repo, path, check_path=True)
 
def __str__ (self)
 
def set_object (self, object, logmsg=None)
 
def name (self)
 
def iter_items (cls, repo, common_path=None)
 
def remote_name (self)
 
def remote_head (self)
 
- Public Member Functions inherited from SymbolicReference
def __init__ (self, repo, path)
 
def __repr__ (self)
 
def __eq__ (self, other)
 
def __ne__ (self, other)
 
def __hash__ (self)
 
def abspath (self)
 
def dereference_recursive (cls, repo, ref_path)
 
def set_commit (self, commit, logmsg=None)
 
def set_reference (self, ref, logmsg=None)
 
def is_valid (self)
 
def is_detached (self)
 
def log (self)
 
def log_append (self, oldbinsha, message, newbinsha=None)
 
def log_entry (self, index)
 
def to_full_path (cls, path)
 
def delete (cls, repo, path)
 
def create (cls, repo, path, reference='HEAD', force=False, logmsg=None)
 
def from_path (cls, repo, path)
 
def is_remote (self)
 
- Public Member Functions inherited from Iterable
def list_items (cls, repo, *args, **kwargs)
 
def iter_items (cls, repo, *args, **kwargs)
 

Data Fields

 path
 
- Data Fields inherited from SymbolicReference
 repo
 
 path
 

Static Public Attributes

 k_config_remote
 
 k_config_remote_ref
 
- Static Public Attributes inherited from SymbolicReference
 ref
 

Additional Inherited Members

- Properties inherited from SymbolicReference
 commit = property(_get_commit, set_commit, doc="Query or set commits directly")
 
 object = property(_get_object, set_object, doc="Return the object our ref currently refers to")
 
 reference = property(_get_reference, set_reference, doc="Returns the Reference we point to")
 

Detailed Description

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.hexsha
    '1c09f116cbc2cb4100fb6935bb162daa4723f455'

Member Function Documentation

◆ checkout()

def checkout (   self,
  force = False,
**  kwargs 
)
Checkout this head by setting the HEAD to this reference, by updating the index
to reflect the tree we point to and by updating the working tree to reflect
the latest index.

The command will fail if changed working tree files would be overwritten.

:param force:
    If True, changes to the index and the working tree will be discarded.
    If False, GitCommandError will be raised in that situation.

:param kwargs:
    Additional keyword arguments to be passed to git checkout, i.e.
    b='new_branch' to create a new branch at the given spot.

:return:
    The active branch after the checkout operation, usually self unless
    a new branch has been created.
    If there is no active branch, as the HEAD is now detached, the HEAD
    reference will be returned instead.

:note:
    By default it is only allowed to checkout heads - everything else
    will leave the HEAD detached which is allowed and possible, but remains
    a special state that some tools might not be able to handle.

◆ config_reader()

def config_reader (   self)
:return: A configuration parser instance constrained to only read
    this instance's values

◆ config_writer()

def config_writer (   self)
:return: A configuration writer instance with read-and write access
    to options of this head

◆ delete()

def delete (   cls,
  repo,
heads,
**  kwargs 
)
Delete the given heads

:param force:
    If True, the heads will be deleted even if they are not yet merged into
    the main development stream.
    Default False

Reimplemented in RemoteReference.

◆ rename()

def rename (   self,
  new_path,
  force = False 
)
Rename self to a new path

:param new_path:
    Either a simple name or a path, i.e. new_name or features/new_name.
    The prefix refs/heads is implied

:param force:
    If True, the rename will succeed even if a head with the target name
    already exists.

:return: self
:note: respects the ref log as git commands are used

Reimplemented from SymbolicReference.

◆ set_tracking_branch()

def set_tracking_branch (   self,
  remote_reference 
)
Configure this branch to track the given remote reference. This will alter
    this branch's configuration accordingly.

:param remote_reference: The remote reference to track or None to untrack
    any references
:return: self

◆ tracking_branch()

def tracking_branch (   self)
:return: The remote_reference we are tracking, or None if we are
    not a tracking branch

Field Documentation

◆ k_config_remote

k_config_remote
static

◆ k_config_remote_ref

k_config_remote_ref
static

◆ path

path

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