From a07cdbae1d485fd715a5b6eca767f211770fea4d Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 19 Oct 2009 18:06:19 +0200 Subject: Added remote module and test cases - about to implement remote option handling --- lib/git/refs.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'lib/git/refs.py') 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// + 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:]) -- cgit v1.2.1