Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] gbp-pull: similar force update strategy for all branches #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions gbp/scripts/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import gbp.log


def fast_forward_branch(rem_repo, branch, repo, options):
def update_branch(rem_repo, branch, repo, options):
"""
update branch to its remote branch, fail on non fast forward updates
unless --force is given
Expand Down Expand Up @@ -71,10 +71,17 @@ def fast_forward_branch(rem_repo, branch, repo, options):
repo.rev_parse(remote, short=12)))
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


Expand Down Expand Up @@ -212,7 +219,7 @@ def main(argv):
branches.add(branch)

for branch in branches:
if not fast_forward_branch(rem_repo, branch, repo, options):
if not update_branch(rem_repo, branch, repo, options):
retval = 2

if options.redo_pq:
Expand Down