diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-11-16 11:05:31 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-11-16 11:06:12 +0100 |
commit | 9f73e8ba55f33394161b403bf7b8c2e0e05f47b0 (patch) | |
tree | f537d42a36e2424a240bcf4f1a4440e3e3acf4a4 /test/git/test_refs.py | |
parent | af5abca21b56fcf641ff916bd567680888c364aa (diff) | |
download | gitpython-9f73e8ba55f33394161b403bf7b8c2e0e05f47b0.tar.gz |
remote: added methods to set and query the tracking branch status of normal heads, including test.
Config: SectionConstraint was updated with additional callable methods, the complete ConfigParser interface should be covered now
Remote: refs methods is much more efficient now as it will set the search path to the directory containing the remote refs - previously it used the remotes/ base directory and pruned the search result
Diffstat (limited to 'test/git/test_refs.py')
-rw-r--r-- | test/git/test_refs.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/test/git/test_refs.py b/test/git/test_refs.py index 5f13d0b7..4cfd952e 100644 --- a/test/git/test_refs.py +++ b/test/git/test_refs.py @@ -63,8 +63,9 @@ class TestRefs(TestBase): assert len(s) == ref_count assert len(s|s) == ref_count - def test_heads(self): - for head in self.rorepo.heads: + @with_rw_repo('HEAD', bare=False) + def test_heads(self, rwrepo): + for head in rwrepo.heads: assert head.name assert head.path assert "refs/heads" in head.path @@ -72,6 +73,23 @@ class TestRefs(TestBase): cur_object = head.object assert prev_object == cur_object # represent the same git object assert prev_object is not cur_object # but are different instances + + writer = head.config_writer() + tv = "testopt" + writer.set_value(tv, 1) + assert writer.get_value(tv) == 1 + del(writer) + assert head.config_reader().get_value(tv) == 1 + head.config_writer().remove_option(tv) + + # after the clone, we might still have a tracking branch setup + head.set_tracking_branch(None) + assert head.tracking_branch() is None + remote_ref = rwrepo.remotes[0].refs[0] + assert head.set_tracking_branch(remote_ref) is head + assert head.tracking_branch() == remote_ref + head.set_tracking_branch(None) + assert head.tracking_branch() is None # END for each head def test_refs(self): @@ -208,6 +226,8 @@ class TestRefs(TestBase): refs = remote.refs RemoteReference.delete(rw_repo, *refs) remote_refs_so_far += len(refs) + for ref in refs: + assert ref.remote_name == remote.name # END for each ref to delete assert remote_refs_so_far |