summaryrefslogtreecommitdiff
path: root/refs/symbolic.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-11-23 23:20:11 +0100
committerSebastian Thiel <byronimo@gmail.com>2010-11-23 23:20:11 +0100
commit7029773512eee5a0bb765b82cfdd90fd5ab34e15 (patch)
tree945d209ed7437820ee13e1bb1d617c9ffd922f2f /refs/symbolic.py
parent61f3db7bd07ac2f3c2ff54615c13bf9219289932 (diff)
downloadgitpython-7029773512eee5a0bb765b82cfdd90fd5ab34e15.tar.gz
Implemented revlog.append_entry as classmethod, to assure we will always actually write_append the new entry, instead of rewriting the whole file. Added file-locking and directory handling, so the implementation should be similar (enough) to the git reference implementation.
Next up is to implement a way to update the reflog when changing references, which is going to be a little more complicated
Diffstat (limited to 'refs/symbolic.py')
-rw-r--r--refs/symbolic.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/refs/symbolic.py b/refs/symbolic.py
index 94e8d726..0d8fdfd1 100644
--- a/refs/symbolic.py
+++ b/refs/symbolic.py
@@ -266,8 +266,19 @@ class SymbolicReference(object):
applied to this reference
.. note:: As the log is parsed every time, its recommended to cache it for use
- instead of calling this method repeatedly"""
+ instead of calling this method repeatedly. It should be considered read-only."""
return RefLog.from_file(RefLog.path(self))
+
+ 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
+ will be used
+ :return: added RefLogEntry instance"""
+ return RefLog.append_entry(RefLog.path(self), oldbinsha,
+ (newbinsha is None and self.commit.binsha) or newbinsha,
+ message)
@classmethod
def to_full_path(cls, path):