diff options
author | Guido Günther <agx@sigxcpu.org> | 2010-08-04 15:26:13 -0400 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2010-08-04 15:26:13 -0400 |
commit | af2a435443ff050c6a47fa2c58d79fa7f954cc38 (patch) | |
tree | 8d91e0ae52d4e85f5f12ae9bc25e2462545fdb13 /gbp-pull | |
parent | 34d6d84518d6f0593400af7e041d931b347ecf8a (diff) |
Don't update already up to date branches
Diffstat (limited to 'gbp-pull')
-rwxr-xr-x | gbp-pull | 28 |
1 files changed, 22 insertions, 6 deletions
@@ -29,22 +29,38 @@ from gbp.errors import GbpError from gbp.git import (GitRepositoryError, GitRepository) def fast_forward_branch(branch, repo, options): + """ + update branch to its remote branch, fail on non fast forward updates + unless --force is given + @return: branch updated or already up to date + @rtype: boolean + """ + update = False + remote = repo.get_merge_branch(branch) if not remote: print >>sys.stderr, "Warning: no branch tracking '%s' found - skipping." % branch - return - fast_forward = repo.is_fast_forward(branch, remote) - if not fast_forward: + return False + + can_fast_forward, up_to_date = repo.is_fast_forward(branch, remote) + + if up_to_date: # Great, we're done + print "Branch '%s' is already up to date." % branch + return True + + if can_fast_forward: + update = True + else: if options.force: print "Non-fast forwarding '%s' due to --force" % branch - fast_forward = True + update = True else: print >>sys.stderr, "Warning: Skipping non-fast forward of '%s' - use --force" % branch - if fast_forward: + if update: repo.set_branch(branch) GitMerge(remote)() - return fast_forward + return update def main(argv): changelog = 'debian/changelog' |