diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-11-24 19:48:59 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-11-24 19:48:59 +0100 |
commit | 3175b5b21194bcc8f4448abe0a03a98d3a4a1360 (patch) | |
tree | f1a098c4b38ae3b7cf52600e9fc9c357cdd7c353 /test/test_repo.py | |
parent | fca367548e365f93c58c47dea45507025269f59a (diff) | |
parent | 3203cd7629345d32806f470a308975076b2b4686 (diff) | |
download | gitpython-3175b5b21194bcc8f4448abe0a03a98d3a4a1360.tar.gz |
Merge branch 'reflog'
Diffstat (limited to 'test/test_repo.py')
-rw-r--r-- | test/test_repo.py | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/test/test_repo.py b/test/test_repo.py index 59a1f6bf..95b0750a 100644 --- a/test/test_repo.py +++ b/test/test_repo.py @@ -467,11 +467,12 @@ class TestRepo(TestBase): def test_rev_parse(self): rev_parse = self.rorepo.rev_parse - # try special case: This one failed beforehand + # try special case: This one failed at some point, make sure its fixed assert rev_parse("33ebe").hexsha == "33ebe7acec14b25c5f84f35a664803fcab2f7781" # start from reference num_resolved = 0 + for ref in Reference.iter_items(self.rorepo): path_tokens = ref.path.split("/") for pt in range(len(path_tokens)): @@ -546,9 +547,32 @@ class TestRepo(TestBase): # missing starting brace self.failUnlessRaises(ValueError, rev_parse, '0.1.4^tree}') + # REVLOG + ####### + head = self.rorepo.head + + # need to specify a ref when using the @ syntax + self.failUnlessRaises(BadObject, rev_parse, "%s@{0}" % head.commit.hexsha) + + # uses HEAD.ref by default + assert rev_parse('@{0}') == head.commit + if not head.is_detached: + refspec = '%s@{0}' % head.ref.name + assert rev_parse(refspec) == head.ref.commit + # all additional specs work as well + assert rev_parse(refspec+"^{tree}") == head.commit.tree + assert rev_parse(refspec+":CHANGES").type == 'blob' + #END operate on non-detached head + + # the last position + assert rev_parse('@{1}') != head.commit + + # position doesn't exist + self.failUnlessRaises(BadObject, rev_parse, '@{10000}') + + # currently, nothing more is supported + self.failUnlessRaises(NotImplementedError, rev_parse, "@{1 week ago}") - # cannot handle rev-log for now - self.failUnlessRaises(ValueError, rev_parse, "hi@there") def test_repo_odbtype(self): target_type = GitDB |