summaryrefslogtreecommitdiffstats
path: root/subcmds/sync.py
diff options
context:
space:
mode:
authorJeroen Dhollander <jeroendh@google.com>2024-08-20 10:28:41 +0200
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-08-30 09:08:29 +0000
commitc44ad093092f71320c6311cc1fc3de9171f6bd0c (patch)
tree1446f0329da76eeb0c295582180552129a9cd39f /subcmds/sync.py
parent4592a63de5e1a9312ce8a37953e233bd49a0ad80 (diff)
downloadgit-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 'subcmds/sync.py')
-rw-r--r--subcmds/sync.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 113e7a67..019ce3e0 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -401,6 +401,13 @@ later is required to fix a server side protocol bug.
401 "WARNING: this may cause loss of data", 401 "WARNING: this may cause loss of data",
402 ) 402 )
403 p.add_option( 403 p.add_option(
404 "--rebase",
405 dest="rebase",
406 action="store_true",
407 help="rebase local commits regardless of whether they are "
408 "published",
409 )
410 p.add_option(
404 "-l", 411 "-l",
405 "--local-only", 412 "--local-only",
406 dest="local_only", 413 dest="local_only",
@@ -1009,7 +1016,13 @@ later is required to fix a server side protocol bug.
1009 return _FetchMainResult(all_projects) 1016 return _FetchMainResult(all_projects)
1010 1017
1011 def _CheckoutOne( 1018 def _CheckoutOne(
1012 self, detach_head, force_sync, force_checkout, verbose, project 1019 self,
1020 detach_head,
1021 force_sync,
1022 force_checkout,
1023 force_rebase,
1024 verbose,
1025 project,
1013 ): 1026 ):
1014 """Checkout work tree for one project 1027 """Checkout work tree for one project
1015 1028
@@ -1019,6 +1032,7 @@ later is required to fix a server side protocol bug.
1019 existing git directory that was previously linked to a different 1032 existing git directory that was previously linked to a different
1020 object directory). 1033 object directory).
1021 force_checkout: Force checking out of the repo content. 1034 force_checkout: Force checking out of the repo content.
1035 force_rebase: Force rebase.
1022 verbose: Whether to show verbose messages. 1036 verbose: Whether to show verbose messages.
1023 project: Project object for the project to checkout. 1037 project: Project object for the project to checkout.
1024 1038
@@ -1036,6 +1050,7 @@ later is required to fix a server side protocol bug.
1036 syncbuf, 1050 syncbuf,
1037 force_sync=force_sync, 1051 force_sync=force_sync,
1038 force_checkout=force_checkout, 1052 force_checkout=force_checkout,
1053 force_rebase=force_rebase,
1039 errors=errors, 1054 errors=errors,
1040 verbose=verbose, 1055 verbose=verbose,
1041 ) 1056 )
@@ -1109,6 +1124,7 @@ later is required to fix a server side protocol bug.
1109 opt.detach_head, 1124 opt.detach_head,
1110 opt.force_sync, 1125 opt.force_sync,
1111 opt.force_checkout, 1126 opt.force_checkout,
1127 opt.rebase,
1112 opt.verbose, 1128 opt.verbose,
1113 ), 1129 ),
1114 projects, 1130 projects,