GitRepository.create_branch: add 'force' option
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Fri, 13 Sep 2013 06:53:16 +0000 (09:53 +0300)
committerGuido Günther <agx@sigxcpu.org>
Fri, 5 Dec 2014 14:35:53 +0000 (15:35 +0100)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/git/repository.py

index edb8e21f23fe577d590d13b06e26cdbe0d7410ba..96921b1a22053982bcdc7a5dd69a574fbde15205 100644 (file)
@@ -295,16 +295,18 @@ class GitRepository(object):
         args = GitArgs("-m", branch, newbranch)
         self._git_command("branch", args.args)
 
-    def create_branch(self, branch, rev=None):
+    def create_branch(self, branch, rev=None, force=False):
         """
         Create a new branch
 
         @param branch: the branch's name
         @param rev: where to start the branch from
+        @param force: reset branch HEAD to start point, if it already exists
 
         If rev is None the branch starts form the current HEAD.
         """
         args = GitArgs(branch)
+        args.add_true(force, '--force')
         args.add_true(rev, rev)
         self._git_command("branch", args.args)