|
OpenQuizz
Une application de gestion des contenus pédagogiques
|


Public Member Functions | |
| def | __init__ (self, repo, path) |
| def | __str__ (self) |
| def | __repr__ (self) |
| def | __eq__ (self, other) |
| def | __ne__ (self, other) |
| def | __hash__ (self) |
| def | name (self) |
| def | abspath (self) |
| def | dereference_recursive (cls, repo, ref_path) |
| def | set_commit (self, commit, logmsg=None) |
| def | set_object (self, object, 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 | rename (self, new_path, force=False) |
| def | iter_items (cls, repo, common_path=None) |
| def | from_path (cls, repo, path) |
| def | is_remote (self) |
Data Fields | |
| repo | |
| path | |
Static Public Attributes | |
| ref | |
Properties | |
| 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") | |
Represents a special case of a reference such that this reference is symbolic. It does not point to a specific commit, but to another Head, which itself specifies a commit. A typical example for a symbolic reference is HEAD.
| def __init__ | ( | self, | |
| repo, | |||
| path | |||
| ) |
Reimplemented in HEAD.
| def __eq__ | ( | self, | |
| other | |||
| ) |
| def __hash__ | ( | self | ) |
| def __ne__ | ( | self, | |
| other | |||
| ) |
| def __repr__ | ( | self | ) |
| def __str__ | ( | self | ) |
Reimplemented in Reference.
| def abspath | ( | self | ) |
| def create | ( | cls, | |
| repo, | |||
| path, | |||
reference = 'HEAD', |
|||
force = False, |
|||
logmsg = None |
|||
| ) |
Create a new symbolic reference, hence a reference pointing to another reference.
:param repo:
Repository to create the reference in
:param path:
full path at which the new symbolic reference is supposed to be
created at, i.e. "NEW_HEAD" or "symrefs/my_new_symref"
:param reference:
The reference to which the new symbolic reference should point to.
If it is a commit'ish, the symbolic ref will be detached.
:param force:
if True, force creation even if a symbolic reference with that name already exists.
Raise OSError otherwise
:param logmsg:
If not None, the message to append to the reflog. Otherwise no reflog
entry is written.
:return: Newly created symbolic Reference
:raise OSError:
If a (Symbolic)Reference with the same name but different contents
already exists.
:note: This does not alter the current HEAD, index or Working Tree
| def delete | ( | cls, | |
| repo, | |||
| path | |||
| ) |
Delete the reference at the given path
:param repo:
Repository to delete the reference from
:param path:
Short or full path pointing to the reference, i.e. refs/myreference
or just "myreference", hence 'refs/' is implied.
Alternatively the symbolic reference to be deleted
| def dereference_recursive | ( | cls, | |
| repo, | |||
| ref_path | |||
| ) |
:return: hexsha stored in the reference at the given ref_path, recursively dereferencing all
intermediate references as required
:param repo: the repository containing the reference at ref_path
| def from_path | ( | cls, | |
| repo, | |||
| path | |||
| ) |
:param path: full .git-directory-relative path name to the Reference to instantiate
:note: use to_full_path() if you only have a partial path of a known Reference Type
:return:
Instance of type Reference, Head, or Tag
depending on the given path
| def is_detached | ( | self | ) |
:return:
True if we are a detached reference, hence we point to a specific commit
instead to another reference
| def is_remote | ( | self | ) |
:return: True if this symbolic reference points to a remote branch
| def is_valid | ( | self | ) |
:return:
True if the reference is valid, hence it can be read and points to
a valid object or reference.
| def iter_items | ( | cls, | |
| repo, | |||
common_path = None |
|||
| ) |
Find all refs in the repository
:param repo: is the Repo
:param common_path:
Optional keyword argument to the path which is to be shared by all
returned Ref objects.
Defaults to class specific portion if None assuring that only
refs suitable for the actual class are returned.
:return:
git.SymbolicReference[], each of them is guaranteed to be a symbolic
ref which is not detached and pointing to a valid ref
List is lexicographically sorted
The returned objects represent actual subclasses, such as Head or TagReference
Reimplemented in Reference.
| def log | ( | self | ) |
:return: RefLog for this reference. Its last entry reflects the latest change
applied to this reference
.. note:: As the log is parsed every time, its recommended to cache it for use
instead of calling this method repeatedly. It should be considered read-only.
| def log_append | ( | self, | |
| oldbinsha, | |||
| message, | |||
newbinsha = None |
|||
| ) |
Append a logentry to the logfile of this ref
:param oldbinsha: binary sha this ref used to point to
:param message: A message describing the change
:param newbinsha: The sha the ref points to now. If None, our current commit sha
will be used
:return: added RefLogEntry instance
| def log_entry | ( | self, | |
| index | |||
| ) |
:return: RefLogEntry at the given index
:param index: python list compatible positive or negative index
.. note:: This method must read part of the reflog during execution, hence
it should be used sparringly, or only if you need just one index.
In that case, it will be faster than the ``log()`` method
| def name | ( | self | ) |
:return:
In case of symbolic references, the shortest assumable name
is the path itself.
Reimplemented in Reference.
| def rename | ( | self, | |
| new_path, | |||
force = False |
|||
| ) |
Rename self to a new path
:param new_path:
Either a simple name or a full path, i.e. new_name or features/new_name.
The prefix refs/ is implied for references and will be set as needed.
In case this is a symbolic ref, there is no implied prefix
:param force:
If True, the rename will succeed even if a head with the target name
already exists. It will be overwritten in that case
:return: self
:raise OSError: In case a file at path but a different contents already exists
Reimplemented in Head.
| def set_commit | ( | self, | |
| commit, | |||
logmsg = None |
|||
| ) |
As set_object, but restricts the type of object to be a Commit
:raise ValueError: If commit is not a Commit object or doesn't point to
a commit
:return: self
| def set_object | ( | self, | |
| object, | |||
logmsg = None |
|||
| ) |
Set the object we point to, possibly dereference our symbolic reference first.
If the reference does not exist, it will be created
:param object: a refspec, a SymbolicReference or an Object instance. SymbolicReferences
will be dereferenced beforehand to obtain the object they point to
:param logmsg: If not None, the message will be used in the reflog entry to be
written. Otherwise the reflog is not altered
:note: plain SymbolicReferences may not actually point to objects by convention
:return: self
Reimplemented in Reference.
| def set_reference | ( | self, | |
| ref, | |||
logmsg = None |
|||
| ) |
Set ourselves to the given ref. It will stay a symbol if the ref is a Reference.
Otherwise an Object, given as Object instance or refspec, is assumed and if valid,
will be set which effectively detaches the refererence if it was a purely
symbolic one.
:param ref: SymbolicReference instance, Object instance or refspec string
Only if the ref is a SymbolicRef instance, we will point to it. Everything
else is dereferenced to obtain the actual object.
:param logmsg: If set to a string, the message will be used in the reflog.
Otherwise, a reflog entry is not written for the changed reference.
The previous commit of the entry will be the commit we point to now.
See also: log_append()
:return: self
:note: This symbolic reference will not be dereferenced. For that, see
``set_object(...)``
| def to_full_path | ( | cls, | |
| path | |||
| ) |
:return: string with a full repository-relative path which can be used to initialize
a Reference instance, for instance by using ``Reference.from_path``
| path |
|
static |
| repo |
|
static |
|
static |
|
static |