diff options
author | Ed Bartosh <eduard.bartosh@intel.com> | 2012-08-03 16:20:28 +0300 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2012-08-22 10:33:32 +0200 |
commit | 7524bbb37c3a1312f382db24d04e0234b7ff07b3 (patch) | |
tree | 5a8aa1585ba94c326393282b292d7fd1704db9cd /tests | |
parent | e8d175aec0ed7fe2d79758de147565518aacaec3 (diff) |
GitRepository: Implement set_upstream_branch and get_upstream_branch methods
set_upstream_branch sets upstream branch for the local branch using
git branch --set-upstream
get_upstream_branch returns info about upstream branches
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_GitRepository.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test_GitRepository.py b/tests/test_GitRepository.py index 10b448b..aa20e75 100644 --- a/tests/test_GitRepository.py +++ b/tests/test_GitRepository.py @@ -177,6 +177,43 @@ def test_rename_branch(): """ +def test_set_upstream_branch(): + """ + Set upstream branch master -> origin/master + + >>> import os, shutil + >>> import gbp.git + >>> repo = gbp.git.GitRepository(repo_dir) + >>> os.makedirs(os.path.join(repo.git_dir, 'refs/remotes/origin')) + >>> shutil.copy(os.path.join(repo.git_dir, 'refs/heads/master'), \ + os.path.join(repo.git_dir, 'refs/remotes/origin/')) + >>> repo.set_upstream_branch('master', 'origin/master') + >>> repo.get_upstream_branch('master') + 'origin/master' + >>> repo.set_upstream_branch('bla', 'origin/master') + Traceback (most recent call last): + GitRepositoryError: Branch bla doesn't exist! + >>> repo.set_upstream_branch('foo', 'origin/bla') + Traceback (most recent call last): + GitRepositoryError: Branch origin/bla doesn't exist! + + """ + +def test_get_upstream_branch(): + """ + Get info about upstream branches set in test_set_upstream_branch + + >>> import gbp.git + >>> repo = gbp.git.GitRepository(repo_dir) + >>> repo.get_upstream_branch('master') + 'origin/master' + >>> repo.get_upstream_branch('foo') + '' + >>> repo.get_upstream_branch('bla') + Traceback (most recent call last): + GitRepositoryError: Branch bla doesn't exist! + """ + def test_tag(): """ Create a tag named I{tag} and check it's existance |