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

Public Member Functions

def __new__ (cls, filepath=None)
 
def __init__ (self, filepath=None)
 
def from_file (cls, filepath)
 
def path (cls, ref)
 
def iter_entries (cls, stream)
 
def entry_at (cls, filepath, index)
 
def to_file (self, filepath)
 
def append_entry (cls, config_reader, filepath, oldbinsha, newbinsha, message)
 
def write (self)
 

Detailed Description

A reflog contains reflog entries, each of which defines a certain state
of the head in question. Custom query methods allow to retrieve log entries
by date or by other criteria.

Reflog entries are ordered, the first added entry is first in the list, the last
entry, i.e. the last change of the head or reference, is last in the list.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  filepath = None 
)
Initialize this instance with an optional filepath, from which we will
initialize our data. The path is also used to write changes back using
the write() method

Member Function Documentation

◆ __new__()

def __new__ (   cls,
  filepath = None 
)

◆ append_entry()

def append_entry (   cls,
  config_reader,
  filepath,
  oldbinsha,
  newbinsha,
  message 
)
Append a new log entry to the revlog at filepath.

:param config_reader: configuration reader of the repository - used to obtain
    user information. May also be an Actor instance identifying the committer directly.
    May also be None
:param filepath: full path to the log file
:param oldbinsha: binary sha of the previous commit
:param newbinsha: binary sha of the current commit
:param message: message describing the change to the reference
:param write: If True, the changes will be written right away. Otherwise
    the change will not be written
:return: RefLogEntry objects which was appended to the log
:note: As we are append-only, concurrent access is not a problem as we
    do not interfere with readers.

◆ entry_at()

def entry_at (   cls,
  filepath,
  index 
)
:return: RefLogEntry at the given index
:param filepath: full path to the index file from which to read the entry
:param index: python list compatible index, i.e. it may be negative to
    specify an entry counted from the end of the list

:raise IndexError: If the entry didn't exist

.. note:: This method is faster as it only parses the entry at index, skipping
    all other lines. Nonetheless, the whole file has to be read if
    the index is negative

◆ from_file()

def from_file (   cls,
  filepath 
)
:return: a new RefLog instance containing all entries from the reflog
    at the given filepath
:param filepath: path to reflog
:raise ValueError: If the file could not be read or was corrupted in some way

◆ iter_entries()

def iter_entries (   cls,
  stream 
)
:return: Iterator yielding RefLogEntry instances, one for each line read
    sfrom the given stream.
:param stream: file-like object containing the revlog in its native format
    or basestring instance pointing to a file to read

◆ path()

def path (   cls,
  ref 
)
:return: string to absolute path at which the reflog of the given ref
    instance would be found. The path is not guaranteed to point to a valid
    file though.
:param ref: SymbolicReference instance

◆ to_file()

def to_file (   self,
  filepath 
)
Write the contents of the reflog instance to a file at the given filepath.
:param filepath: path to file, parent directories are assumed to exist

◆ write()

def write (   self)
Write this instance's data to the file we are originating from
:return: self

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