summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2008-10-31 09:51:12 +0100
committerGuido Guenther <agx@sigxcpu.org>2008-10-31 09:51:12 +0100
commit1ef4e041ff117f7124c7116ea3f37ade5fbd645f (patch)
tree8651e55781c4e04f3fa321a7d32750e70c18d15e
parent8b15994277805a3e3d6b1058f07113aef3c2e1ab (diff)
add set_branch() to switch branches
-rw-r--r--gbp/git_utils.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/gbp/git_utils.py b/gbp/git_utils.py
index 204e2626..90926f00 100644
--- a/gbp/git_utils.py
+++ b/gbp/git_utils.py
@@ -5,7 +5,7 @@
import subprocess
import os.path
-from command_wrappers import (GitAdd, GitRm, copy_from)
+from command_wrappers import (GitAdd, GitRm, GitCheckoutBranch, copy_from)
import dateutil.parser
import calendar
@@ -66,6 +66,12 @@ class GitRepository(object):
if line.startswith('*'):
return line.split(' ', 1)[1].strip()
+ def set_branch(self, branch):
+ """switch to branch 'branch'"""
+ self.__check_path()
+ if self.get_branch() != branch:
+ GitCheckoutBranch(branch)()
+
def is_clean(self):
"""does the repository contain any uncommitted modifications"""
self.__check_path()