Fix git-p4 rebase to detect the correct upstream branch instead of unconditionally always rebasing on top of remotes/p4/master
Fix git-p4 rebase to detect the correct upstream branch instead of unconditionally always rebasing on top of remotes/p4/master Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Simon Hausmann committed
Jun 12, 2007 at 14:34 UTC
d7e3868cdfdc73c3de15296ecf32138a8308c07e
1 file changed
+10
-2
contrib/fast-import/git-p4
+10
-2
@@ -1361,9 +1361,17 @@ class P4Rebase(Command):
1361
def run(self, args):
1362
sync = P4Sync()
1363
sync.run([])
1364
- print "Rebasing the current branch"
1364
+
1365
+ [upstream, settings] = findUpstreamBranchPoint()
1366
+ if len(upstream) == 0:
1367
+ die("Cannot find upstream branchpoint for rebase")
1368
+
1369
+ # the branchpoint may be p4/foo~3, so strip off the parent
1370
+ upstream = re.sub("~[0-9]+$", "", upstream)
1371
+
1372
+ print "Rebasing the current branch onto %s" % upstream
1373
oldHead = read_pipe("git rev-parse HEAD").strip()
1366
- system("git rebase p4")
1374
+ system("git rebase %s" % upstream)
1375
system("git diff-tree --stat --summary -M %s HEAD" % oldHead)
1376
return True
1377