GitRepository.create_branch: add 'force' option
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Fri, 13 Sep 2013 06:53:16 +0000 (09:53 +0300)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Fri, 14 Nov 2014 12:22:04 +0000 (14:22 +0200)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/git/repository.py

index 910c691..1b69640 100644 (file)
@@ -367,16 +367,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)