From 4954036205385c3e819dc1b64fc0e7c28fe487e9 Mon Sep 17 00:00:00 2001 From: Nico von Geyso Date: Fri, 10 Aug 2012 12:49:45 +0200 Subject: added some doc strings --- fit.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fit.py b/fit.py index f34627f..fabd1b2 100644 --- a/fit.py +++ b/fit.py @@ -10,6 +10,7 @@ class Fit: self.repo = Repository(path) def _insert_node(self, node_oid, path, root_oid): + """ Inserts a new Node in a Git Tree graph """ if root_oid: root = self.repo.TreeBuilder(root_oid) current_node = self.repo[root_oid] @@ -36,7 +37,7 @@ class Fit: # directories to create new_path = dir_path[len(existing_builders)-1:] - # create blob + # inserts blob object if len(new_path) > 0: builder = self.repo.TreeBuilder() else: @@ -74,6 +75,7 @@ class Fit: def add_file(self, data, path): + """ Inserts the given file in the git tree and commits the changes """ try: commit = self._get_last_commit() parents = [commit.oid] @@ -100,7 +102,13 @@ class Fit: return b2a_hex(blob_oid).decode('ascii') + def get_file(self, oid): + """ Returns the actual data of a git object """ + return self.repo[oid].data + + def _list(self, path=None): + """ Lists all entries for a given path """ try: commit = self._get_last_commit() tree = commit.tree -- cgit v1.2.3-1-g7c22