From 1ef4e041ff117f7124c7116ea3f37ade5fbd645f Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Fri, 31 Oct 2008 09:51:12 +0100 Subject: add set_branch() to switch branches --- gbp/git_utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'gbp') 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() -- cgit v1.2.3