Skip to content

Commit

Permalink
Fix git-p4 rebase to detect the correct upstream branch instead of un…
Browse files Browse the repository at this point in the history
…conditionally

always rebasing on top of remotes/p4/master

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
  • Loading branch information
Simon Hausmann committed Jun 12, 2007
1 parent 27d2d81 commit d7e3868
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions contrib/fast-import/git-p4
Original file line number Diff line number Diff line change
Expand Up @@ -1361,9 +1361,17 @@ class P4Rebase(Command):
def run(self, args):
sync = P4Sync()
sync.run([])
print "Rebasing the current branch"

[upstream, settings] = findUpstreamBranchPoint()
if len(upstream) == 0:
die("Cannot find upstream branchpoint for rebase")

# the branchpoint may be p4/foo~3, so strip off the parent
upstream = re.sub("~[0-9]+$", "", upstream)

print "Rebasing the current branch onto %s" % upstream
oldHead = read_pipe("git rev-parse HEAD").strip()
system("git rebase p4")
system("git rebase %s" % upstream)
system("git diff-tree --stat --summary -M %s HEAD" % oldHead)
return True

Expand Down

0 comments on commit d7e3868

Please sign in to comment.