diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2009-10-22 17:40:04 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2009-10-22 17:40:04 +0200 |
commit | 20c34a929a8b2871edd4fd44a38688e8977a4be6 (patch) | |
tree | d4dc6dd2207ddc6b9ad3253468f843849f5dc14a /test/git/test_base.py | |
parent | 3c658c16f3437ed7e78f6072b6996cb423a8f504 (diff) | |
download | gitpython-20c34a929a8b2871edd4fd44a38688e8977a4be6.tar.gz |
Added reset method to Head - its a class method due to the very general nature of the command. Yet I don't really like the way you have to call it as repo has to be ṕassed as first arg
Diffstat (limited to 'test/git/test_base.py')
-rw-r--r-- | test/git/test_base.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/git/test_base.py b/test/git/test_base.py index a7ef9374..3472608e 100644 --- a/test/git/test_base.py +++ b/test/git/test_base.py @@ -94,6 +94,22 @@ class TestBase(TestBase): assert prev_object is not cur_object # but are different instances # END for each head + @with_rw_repo('0.1.6') + def test_head_reset(self, rw_repo): + cur_head = rw_repo.head + new_head_commit = cur_head.commit.parents[0] + reset_head = Head.reset(rw_repo, new_head_commit, index=True) # index only + assert reset_head.commit == new_head_commit + + self.failUnlessRaises(ValueError, Head.reset, rw_repo, new_head_commit, index=False, working_tree=True) + new_head_commit = new_head_commit.parents[0] + reset_head = Head.reset(rw_repo, new_head_commit, index=True, working_tree=True) # index + wt + assert reset_head.commit == new_head_commit + + # paths + Head.reset(rw_repo, new_head_commit, paths = "lib") + + def test_get_object_type_by_name(self): for tname in base.Object.TYPES: assert base.Object in get_object_type_by_name(tname).mro() |