aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp/scripts/pull.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2013-05-02 21:46:47 +0200
committerGuido Günther <agx@sigxcpu.org>2013-05-02 21:46:47 +0200
commite854b1b7a7cb134e79869d424d5342fba38c01d0 (patch)
treedf1a255a6c60e80d4c057f462c42913002bcc235 /gbp/scripts/pull.py
parentd645733da513471492f358c31949f99319ae8878 (diff)
Add --ignore-branch to gbp-pull
This allows us to fetch upstream and pristine-tar even when in detached head state. This can be usefull when e.g. building in jenkins which uses a detached head by default.
Diffstat (limited to 'gbp/scripts/pull.py')
-rwxr-xr-xgbp/scripts/pull.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/gbp/scripts/pull.py b/gbp/scripts/pull.py
index 7dad83c2..dc002590 100755
--- a/gbp/scripts/pull.py
+++ b/gbp/scripts/pull.py
@@ -69,11 +69,13 @@ def fast_forward_branch(branch, repo, options):
def main(argv):
retval = 0
+ current = None
parser = GbpOptionParser(command=os.path.basename(argv[0]), prefix='',
usage='%prog [options] - safely update a repository from remote')
branch_group = GbpOptionGroup(parser, "branch options", "branch update and layout options")
parser.add_option_group(branch_group)
+ branch_group.add_boolean_config_file_option(option_name = "ignore-branch", dest="ignore_branch")
branch_group.add_option("--force", action="store_true", dest="force", default=False,
help="force a branch update even if can't be fast forwarded")
branch_group.add_option("--redo-pq", action="store_true", dest="redo_pq", default=False,
@@ -101,7 +103,15 @@ def main(argv):
try:
branches = []
- current = repo.get_branch()
+ try:
+ current = repo.get_branch()
+ except GitRepositoryError:
+ # Not being on any branch is o.k. with --git-ignore-branch
+ if options.ignore_branch:
+ current = repo.head
+ gbp.log.info("Found detached head at '%s'" % current)
+ else:
+ raise
for branch in [ options.debian_branch, options.upstream_branch ]:
if repo.has_branch(branch):