diff options
| author | Jeroen Dhollander <jeroendh@google.com> | 2024-08-20 10:28:41 +0200 |
|---|---|---|
| committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-08-30 09:08:29 +0000 |
| commit | c44ad093092f71320c6311cc1fc3de9171f6bd0c (patch) | |
| tree | 1446f0329da76eeb0c295582180552129a9cd39f /project.py | |
| parent | 4592a63de5e1a9312ce8a37953e233bd49a0ad80 (diff) | |
| download | git-repo-c44ad093092f71320c6311cc1fc3de9171f6bd0c.tar.gz | |
Add a `--rebase` option to sync command
Previously repo would abort a sync if there were published changes not
merged upstream. The --rebase option allows the modification of
published commits.
This is a copy of http://go/grev/369694 with the merge conflicts
resolved.
Bug: 40014610
Change-Id: Idac8199400346327b530abea33f1ed794e5bb4c2
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/435838
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Tested-by: Jeroen Dhollander <jeroendh@google.com>
Commit-Queue: Jeroen Dhollander <jeroendh@google.com>
Diffstat (limited to 'project.py')
| -rw-r--r-- | project.py | 6 |
1 files changed, 4 insertions, 2 deletions
| @@ -1535,6 +1535,7 @@ class Project: | |||
| 1535 | syncbuf, | 1535 | syncbuf, |
| 1536 | force_sync=False, | 1536 | force_sync=False, |
| 1537 | force_checkout=False, | 1537 | force_checkout=False, |
| 1538 | force_rebase=False, | ||
| 1538 | submodules=False, | 1539 | submodules=False, |
| 1539 | errors=None, | 1540 | errors=None, |
| 1540 | verbose=False, | 1541 | verbose=False, |
| @@ -1680,14 +1681,15 @@ class Project: | |||
| 1680 | if pub: | 1681 | if pub: |
| 1681 | not_merged = self._revlist(not_rev(revid), pub) | 1682 | not_merged = self._revlist(not_rev(revid), pub) |
| 1682 | if not_merged: | 1683 | if not_merged: |
| 1683 | if upstream_gain: | 1684 | if upstream_gain and not force_rebase: |
| 1684 | # The user has published this branch and some of those | 1685 | # The user has published this branch and some of those |
| 1685 | # commits are not yet merged upstream. We do not want | 1686 | # commits are not yet merged upstream. We do not want |
| 1686 | # to rewrite the published commits so we punt. | 1687 | # to rewrite the published commits so we punt. |
| 1687 | fail( | 1688 | fail( |
| 1688 | LocalSyncFail( | 1689 | LocalSyncFail( |
| 1689 | "branch %s is published (but not merged) and is " | 1690 | "branch %s is published (but not merged) and is " |
| 1690 | "now %d commits behind" | 1691 | "now %d commits behind. Fix this manually or rerun " |
| 1692 | "with the --rebase option to force a rebase." | ||
| 1691 | % (branch.name, len(upstream_gain)), | 1693 | % (branch.name, len(upstream_gain)), |
| 1692 | project=self.name, | 1694 | project=self.name, |
| 1693 | ) | 1695 | ) |
