From: Markus Lehtonen Date: Thu, 12 Jan 2012 13:25:57 +0000 (+0200) Subject: gbp-pull: similar update strategy for all branches X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d9336c83b12e788e91455761a08b41f0e6ebb50b;p=tools%2Fgit-buildpackage.git 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. Signed-off-by: Markus Lehtonen --- diff --git a/gbp/scripts/pull.py b/gbp/scripts/pull.py index 41ff56cd..0ebd2e3b 100755 --- a/gbp/scripts/pull.py +++ b/gbp/scripts/pull.py @@ -29,7 +29,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 @@ -63,10 +63,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 @@ -167,7 +174,7 @@ def main(argv): repo.fetch(depth=options.depth) repo.fetch(depth=options.depth, tags=True) 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: