diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2009-10-19 18:06:19 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2009-10-19 18:06:19 +0200 |
commit | a07cdbae1d485fd715a5b6eca767f211770fea4d (patch) | |
tree | f0ed80c46d74a2904cde87a290f3e9a6be9c3efe /lib/git/refs.py | |
parent | a8f8582274cd6a368a79e569e2995cee7d6ea9f9 (diff) | |
download | gitpython-a07cdbae1d485fd715a5b6eca767f211770fea4d.tar.gz |
Added remote module and test cases - about to implement remote option handling
Diffstat (limited to 'lib/git/refs.py')
-rw-r--r-- | lib/git/refs.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/git/refs.py b/lib/git/refs.py index 1a58bb05..618babc2 100644 --- a/lib/git/refs.py +++ b/lib/git/refs.py @@ -226,3 +226,26 @@ class RemoteRef(Head): Represents a reference pointing to a remote head. """ _common_path_default = "refs/remotes" + + @property + def remote_name(self): + """ + Returns + Name of the remote we are a reference of, such as 'origin' for a reference + named 'origin/master' + """ + tokens = self.path.split('/') + # /refs/remotes/<remote name>/<branch_name> + return tokens[2] + + @property + def remote_branch(self): + """ + Returns + Name of the remote branch itself, i.e. master. + + NOTE: The returned name is usually not qualified enough to uniquely identify + a branch + """ + tokens = self.path.split('/') + return '/'.join(tokens[3:]) |