diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-11-23 21:14:59 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-11-23 21:14:59 +0100 |
commit | a21a9f6f13861ddc65671b278e93cf0984adaa30 (patch) | |
tree | 67e30aa7a870bedc238ea6eed0e991dc1a80083a /test/test_reflog.py | |
parent | 5bd7d44ff7e51105e3e277aee109a45c42590572 (diff) | |
download | gitpython-a21a9f6f13861ddc65671b278e93cf0984adaa30.tar.gz |
Actor: Moved it from git.objects.util to git.util, adjusted all imports accordingly. Added methods to Actor to retrieve the global committer and author information
Reflog: implemented and tested append_entry method
Diffstat (limited to 'test/test_reflog.py')
-rw-r--r-- | test/test_reflog.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/test/test_reflog.py b/test/test_reflog.py index a017106e..67b1a9da 100644 --- a/test/test_reflog.py +++ b/test/test_reflog.py @@ -1,6 +1,7 @@ from git.test.lib import * -from git.objects import IndexObject, Actor +from git.objects import IndexObject from git.refs import * +from git.util import Actor import tempfile import shutil @@ -40,6 +41,7 @@ class TestRefLog(TestBase): # simple read reflog = RefLog.from_file(rlp_master_ro) + assert reflog._path is not None assert isinstance(reflog, RefLog) assert len(reflog) @@ -56,6 +58,8 @@ class TestRefLog(TestBase): # test serialize and deserialize - results must match exactly + binsha = chr(255)*20 + msg = "my reflog message" for rlp in (rlp_head, rlp_master): reflog = RefLog.from_file(rlp) tfile = os.path.join(tdir, os.path.basename(rlp)) @@ -67,6 +71,18 @@ class TestRefLog(TestBase): # ... as well as each bytes of the written stream assert open(tfile).read() == open(rlp).read() + + # append an entry - it gets written automatically + entry = treflog.append_entry(IndexObject.NULL_BIN_SHA, binsha, msg) + assert entry.oldhexsha == IndexObject.NULL_HEX_SHA + assert entry.newhexsha == 'f'*40 + assert entry.message == msg + assert treflog == RefLog.from_file(tfile) + + # but not this time + treflog.append_entry(binsha, binsha, msg, write=False) + assert treflog != RefLog.from_file(tfile) + # END for each reflog |