OpenQuizz
Une application de gestion des contenus pédagogiques
git.objects.fun Namespace Reference

Functions

def tree_to_stream (entries, write)
 
def tree_entries_from_data (data)
 
def traverse_trees_recursive (odb, tree_shas, path_prefix)
 
def traverse_tree_recursive (odb, tree_sha, path_prefix)
 

Detailed Description

Module with functions which are supposed to be as fast as possible

Function Documentation

◆ traverse_tree_recursive()

def git.objects.fun.traverse_tree_recursive (   odb,
  tree_sha,
  path_prefix 
)
:return: list of entries of the tree pointed to by the binary tree_sha. An entry
    has the following format:
    * [0] 20 byte sha
    * [1] mode as int
    * [2] path relative to the repository
:param path_prefix: prefix to prepend to the front of all returned paths

◆ traverse_trees_recursive()

def git.objects.fun.traverse_trees_recursive (   odb,
  tree_shas,
  path_prefix 
)
:return: list with entries according to the given binary tree-shas.
    The result is encoded in a list
    of n tuple|None per blob/commit, (n == len(tree_shas)), where
    * [0] == 20 byte sha
    * [1] == mode as int
    * [2] == path relative to working tree root
    The entry tuple is None if the respective blob/commit did not
    exist in the given tree.
:param tree_shas: iterable of shas pointing to trees. All trees must
    be on the same level. A tree-sha may be None in which case None
:param path_prefix: a prefix to be added to the returned paths on this level,
    set it '' for the first iteration
:note: The ordering of the returned items will be partially lost

◆ tree_entries_from_data()

def git.objects.fun.tree_entries_from_data (   data)
Reads the binary representation of a tree and returns tuples of Tree items
:param data: data block with tree data (as bytes)
:return: list(tuple(binsha, mode, tree_relative_path), ...)

◆ tree_to_stream()

def git.objects.fun.tree_to_stream (   entries,
  write 
)
Write the give list of entries into a stream using its write method
:param entries: **sorted** list of tuples with (binsha, mode, name)
:param write: write method which takes a data string