| 4284 | return self.rebase() |
| 4285 | |
| 4286 | def rebase(self): |
| 4287 | if os.system("git update-index --refresh") != 0: |
| 4288 | die("Some files in your working directory are modified and different than what is in your index. You can use git update-index <filename> to bring the index up to date or stash away all your changes with git stash.") |
| 4289 | if len(read_pipe(["git", "diff-index", "HEAD", "--"])) > 0: |
| 4290 | die("You have uncommitted changes. Please commit them before rebasing or stash them away with git stash.") |
| 4291 | |
| 4292 | upstream, settings = findUpstreamBranchPoint() |
| 4293 | if len(upstream) == 0: |
| 4294 | die("Cannot find upstream branchpoint for rebase") |
| 4295 | |
| 4296 | # the branchpoint may be p4/foo~3, so strip off the parent |
| 4297 | upstream = re.sub(r"~[0-9]+$", "", upstream) |
| 4298 | |
| 4299 | print("Rebasing the current branch onto %s" % upstream) |
| 4300 | oldHead = read_pipe(["git", "rev-parse", "HEAD"]).strip() |
| 4301 | system(["git", "rebase", upstream]) |
| 4302 | system(["git", "diff-tree", "--stat", "--summary", "-M", oldHead, |
| 4303 | "HEAD", "--"]) |
| 4304 | return True |
| 4305 | |
| 4306 | |
| 4307 | class P4Clone(P4Sync): |