aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-11-07 17:54:36 +0100
committerGuido Günther <agx@sigxcpu.org>2011-11-07 18:05:41 +0100
commit7870360f216773451a84bd66e8c6f01fe7d8a9e1 (patch)
treefa7224ed1835c56577a42222412dff31e1ba1ac7 /tests
parent8038a46e77b557ed234a0cfcb3c6109190d1b2c2 (diff)
GitRepository: add checkout() to checkout a treeish
Diffstat (limited to 'tests')
-rw-r--r--tests/test_GitRepository.py31
1 files changed, 31 insertions, 0 deletions
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