summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fit.py10
1 files changed, 9 insertions, 1 deletions
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