diff options
-rw-r--r-- | CHANGES | 13 | ||||
-rw-r--r-- | lib/git/repo.py | 14 | ||||
-rw-r--r-- | test/git/test_remote.py | 1 |
3 files changed, 28 insertions, 0 deletions
@@ -107,6 +107,19 @@ Refs * Will dynmically retrieve their object at the time of query to assure the information is actual. Recently objects would be cached, hence ref object not be safely kept persistent. + +Remote +------ +* Added Remote object allowing easy access to remotes +* Repo.remotes lists all remotes +* Repo.remote returns a remote of the specified name if it exists + +Config +------ +* The git configuration can now be read and manipulated directly from within python + using the GitConfigParser +* Repo.config_reader returns a read-only parser +* Repo.config_writer returns a read-write parser 0.1.6 ===== diff --git a/lib/git/repo.py b/lib/git/repo.py index d5cc9782..0a8592ab 100644 --- a/lib/git/repo.py +++ b/lib/git/repo.py @@ -115,6 +115,20 @@ class Repo(object): A list of Remote objects allowing to access and manipulate remotes """ return Remote.list_items(self) + + def remote(self, name='origin'): + """ + Return + Remote with the specified name + + Raise + ValueError if no remote with such a name exists + """ + for remote in Remote.iter_items(self): + if remote.name == name: + return remote + # END for each existing remote + raise ValueError( "Remote named %s does not exist" % name ) # alias heads branches = heads diff --git a/test/git/test_remote.py b/test/git/test_remote.py index 2446710f..8c0177fd 100644 --- a/test/git/test_remote.py +++ b/test/git/test_remote.py @@ -67,6 +67,7 @@ class TestRemote(TestCase): assert num_remotes assert num_remotes == len(remote_set) + origin = self.repo.remote('origin') def test_creation_and_removal(self): new_name = "test_new_one" |