From 7870360f216773451a84bd66e8c6f01fe7d8a9e1 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Mon, 7 Nov 2011 17:54:36 +0100 Subject: GitRepository: add checkout() to checkout a treeish --- tests/test_GitRepository.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'tests') diff --git a/tests/test_GitRepository.py b/tests/test_GitRepository.py index f7e5e97a..235c758d 100644 --- a/tests/test_GitRepository.py +++ b/tests/test_GitRepository.py @@ -368,6 +368,37 @@ def test_create_bare(): (True, '') """ +def test_checkout(): + """ + Checkout treeishs + + Methods tested: + - L{gbp.git.GitRepository.checkout} + - L{gbp.git.GitRepository.get_branch} + - L{gbp.git.GitRepository.set_branch} + - L{gbp.git.GitRepository.rev_parse} + + Properties tested: + - L{gbp.git.GitRepository.branch} + - L{gbp.git.GitRepository.tags} + + >>> import gbp.git + >>> repo = gbp.git.GitRepository(repo_dir) + >>> repo.checkout('master') + >>> repo.branch + 'master' + >>> sha1 = repo.rev_parse('master') + >>> repo.checkout(sha1) + >>> repo.branch + >>> repo.get_branch() + Traceback (most recent call last): + ... + GitRepositoryError: Currently not on a branch + >>> tag = repo.tags[0] + >>> repo.checkout(tag) + >>> repo.branch + """ + def test_teardown(): """ Perform the teardown -- cgit v1.2.3