summaryrefslogtreecommitdiff
path: root/gbp/scripts
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-01-12 15:25:57 +0200
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-05-08 11:39:40 +0300
commit3897796b9ed3b78f63b0348d8a07d76e85207bfc (patch)
tree807e88f16a20799073faea2ad74bafcc9358ef17 /gbp/scripts
parent289ff4db25a852ca76fee9f87c87da84a6c40a26 (diff)
downloadgit-buildpackage-3897796b9ed3b78f63b0348d8a07d76e85207bfc.tar.gz
git-buildpackage-3897796b9ed3b78f63b0348d8a07d76e85207bfc.tar.bz2
git-buildpackage-3897796b9ed3b78f63b0348d8a07d76e85207bfc.zip
gbp-pull: similar update strategy for all branches
Treat non-checked-out branches similarly to the current branch when forcing update. That is, do git merge, instead of just setting the ref. Also, renames fast_forward_branch() to update_branch() to better match the functionality.
Diffstat (limited to 'gbp/scripts')
-rwxr-xr-xgbp/scripts/pull.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/gbp/scripts/pull.py b/gbp/scripts/pull.py
index d50ffc23..260f1074 100755
--- a/gbp/scripts/pull.py
+++ b/gbp/scripts/pull.py
@@ -28,7 +28,7 @@ from gbp.git import GitRepositoryError
from gbp.deb.git import DebianGitRepository
import gbp.log
-def fast_forward_branch(branch, repo, options):
+def update_branch(branch, repo, options):
"""
update branch to its remote branch, fail on non fast forward updates
unless --force is given
@@ -61,10 +61,17 @@ def fast_forward_branch(branch, repo, options):
gbp.log.info("Updating '%s'" % branch)
if repo.branch == branch:
repo.merge(remote)
- else:
+ elif can_fast_forward:
sha1 = repo.rev_parse(remote)
repo.update_ref("refs/heads/%s" % branch, sha1,
msg="gbp: forward %s to %s" % (branch, remote))
+ else:
+ # Merge other branch, if it cannot be fast-forwarded
+ current_branch=repo.branch
+ repo.set_branch(branch)
+ repo.merge(remote)
+ repo.set_branch(current_branch)
+
return update
def main(argv):
@@ -116,7 +123,7 @@ def main(argv):
repo.fetch(options.depth)
for branch in branches:
- if not fast_forward_branch(branch, repo, options):
+ if not update_branch(branch, repo, options):
retval = 2
if options.redo_pq: