summaryrefslogtreecommitdiff
path: root/gbp/git.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-10-24 19:24:44 +0200
committerGuido Günther <agx@sigxcpu.org>2011-10-26 09:45:10 +0200
commit27c58973d980bd0fce9502b535c703d2209e25db (patch)
tree1a193e3964c9f2c0e8ab169066af6411d6441c2c /gbp/git.py
parent416268a64772d4f1c40e43ac0ceaa46aa20d2ce3 (diff)
GitRepository: make branch, path and base_dir read only properties
Diffstat (limited to 'gbp/git.py')
-rw-r--r--gbp/git.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/gbp/git.py b/gbp/git.py
index d7c3910..d84114b 100644
--- a/gbp/git.py
+++ b/gbp/git.py
@@ -89,7 +89,7 @@ class GitRepository(object):
"""
def __init__(self, path):
- self.path = os.path.abspath(path)
+ self._path = os.path.abspath(path)
try:
out, ret = self.__git_getoutput('rev-parse', ['--show-cdup'])
if ret or out != ['\n']:
@@ -175,12 +175,14 @@ class GitRepository(object):
"""
GitCommand(command, args, extra_env=extra_env, cwd=self.path)()
+ @property
+ def path(self):
+ return self._path
+
+ @property
def base_dir(self):
"""
Get the base of the repository.
-
- @return: The base of the git repository
- @rtype: string.
"""
return os.path.join(self.path, '.git')
@@ -298,6 +300,11 @@ class GitRepository(object):
args += [ commit ] if commit else []
self._git_command("tag", args)
+ @property
+ def branch(self):
+ """The currently checked out branch"""
+ return self.get_branch()
+
def get_branch(self):
"""on what branch is the current working copy"""
for line in self.__git_getoutput('branch', [ '--no-color' ])[0]: