aboutsummaryrefslogtreecommitdiff
path: root/refs
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-11-24 19:48:44 +0100
committerSebastian Thiel <byronimo@gmail.com>2010-11-24 19:48:44 +0100
commit3203cd7629345d32806f470a308975076b2b4686 (patch)
treef1a098c4b38ae3b7cf52600e9fc9c357cdd7c353 /refs
parent98a313305f0d554a179b93695d333199feb5266c (diff)
downloadGitPython-3203cd7629345d32806f470a308975076b2b4686.tar.gz
GitPython-3203cd7629345d32806f470a308975076b2b4686.zip
Fixed doc strings, improved error checking on RefLog.write method
Diffstat (limited to 'refs')
-rw-r--r--refs/log.py11
-rw-r--r--refs/symbolic.py2
2 files changed, 11 insertions, 2 deletions
diff --git a/refs/log.py b/refs/log.py
index 6c734ad4..f49c07fd 100644
--- a/refs/log.py
+++ b/refs/log.py
@@ -182,6 +182,7 @@ class RefLog(list, Serializable):
specifiy 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
@@ -224,6 +225,7 @@ class RefLog(list, Serializable):
@classmethod
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 be None
:param filepath: full path to the log file
@@ -255,8 +257,13 @@ class RefLog(list, Serializable):
return entry
def write(self):
- """Write this instance's data to the file we are originating from"""
- return self.to_file(self._path)
+ """Write this instance's data to the file we are originating from
+ :return: self"""
+ if self._path is None:
+ raise ValueError("Instance was not initialized with a path, use to_file(...) instead")
+ #END assert path
+ self.to_file(self._path)
+ return self
#} END interface
diff --git a/refs/symbolic.py b/refs/symbolic.py
index 6ba8083f..9937cf0c 100644
--- a/refs/symbolic.py
+++ b/refs/symbolic.py
@@ -174,6 +174,7 @@ class SymbolicReference(object):
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"""
@@ -345,6 +346,7 @@ class SymbolicReference(object):
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