diff options
author | Guido Günther <agx@sigxcpu.org> | 2011-02-09 22:50:59 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2011-02-09 22:53:10 +0100 |
commit | b92b88f95aacdbc1afcb0f2ad91a835fd3ad2612 (patch) | |
tree | 42676cd9f5b4d47e4ec9ead7c959b12328279776 /gbp | |
parent | d21506e3aa06dfd7f4acf953b2e58807b71677e0 (diff) |
git-import-dsc: auto create upstream branch
if it's missing. This allows to mass import old history of packages that
were native and switched to non-native later.
Closes: #610379
Diffstat (limited to 'gbp')
-rw-r--r-- | gbp/config.py | 5 | ||||
-rw-r--r-- | gbp/git.py | 14 |
2 files changed, 16 insertions, 3 deletions
diff --git a/gbp/config.py b/gbp/config.py index d1211334..00b8dbc3 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -1,6 +1,6 @@ # vim: set fileencoding=utf-8 : # -# (C) 2006,2007,2010 Guido Guenther <agx@sigxcpu.org> +# (C) 2006,2007,2010,2011 Guido Guenther <agx@sigxcpu.org> """handles command line and config file option parsing for the gbp commands""" from optparse import OptionParser, OptionGroup, Option, OptionValueError @@ -99,6 +99,7 @@ class GbpOptionParser(OptionParser): 'track' : 'True', 'author-is-committer': 'False', 'author-date-is-committer-date': 'False', + 'create-missing-branches': 'False', } help = { 'debian-branch': @@ -163,6 +164,8 @@ class GbpOptionParser(OptionParser): "Use the authors's name also as the comitter's name, default is '%(author-is-committer)s'", 'author-date-is-committer-date': "Use the authors's date as the comitter's date, default is '%(author-date-is-committer-date)s'", + 'create-missing-branches': + "Create missing branches automatically, default is '%(create-missing-branches)s'", } config_files = [ '/etc/git-buildpackage/gbp.conf', os.path.expanduser('~/.gbp.conf'), @@ -1,12 +1,13 @@ # vim: set fileencoding=utf-8 : # -# (C) 2006,2007,2008 Guido Guenther <agx@sigxcpu.org> +# (C) 2006,2007,2008,2011 Guido Guenther <agx@sigxcpu.org> """provides git repository related helpers""" import re import subprocess import os.path -from command_wrappers import (GitAdd, GitRm, GitCheckoutBranch, GitInit, GitCommand, copy_from) +from command_wrappers import (GitAdd, GitBranch, GitRm, GitCheckoutBranch, + GitInit, GitCommand, copy_from) from errors import GbpError import log import dateutil.parser @@ -198,6 +199,15 @@ class GitRepository(object): if self.get_branch() != branch: GitCheckoutBranch(branch)() + def create_branch(self, branch, rev=None): + """create a new branch + @param rev: where to start the branch from + + if param is None the branch starts form the current HEAD + """ + self.__check_path() + GitBranch()(branch, rev) + def delete_branch(self, branch): self.__check_path() if self.get_branch() != branch: |