summaryrefslogtreecommitdiffstats
path: root/subcmds
diff options
context:
space:
mode:
authorKevin Degi <kdegi@codeaurora.org>2014-11-12 11:27:45 -0700
committerKevin Degi <kdegi@codeaurora.org>2015-07-29 14:44:46 -0600
commitabaa7f312f1b6c8d11d7c757fe909900ce5788b5 (patch)
tree2eba7244f267c9df33510a820b5353da1d7722cd /subcmds
parent7cccfb2cf0ed1ed14f6b8a5bdb36459ebcb4db5a (diff)
downloadgit-repo-abaa7f312f1b6c8d11d7c757fe909900ce5788b5.tar.gz
Add option to correct gitdir when syncingv1.12.25
In some cases, a user may wish to continue with a sync even though it would require overwriting an existing git directory. This behavior is not safe as a default because it could result in the loss of some user data, but as an optional flag it allows the user more flexibility. To support this, add a --force-sync flag to the sync command that will attempt to overwrite the existing git dir if it is specified and the existing git dir points to the wrong obj dir. Change-Id: Ieddda8ad54e264a1eb4a9d54881dd6ebc8a03833
Diffstat (limited to 'subcmds')
-rw-r--r--subcmds/sync.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py
index ec333ae7..a8074a40 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -119,6 +119,11 @@ credentials.
119The -f/--force-broken option can be used to proceed with syncing 119The -f/--force-broken option can be used to proceed with syncing
120other projects if a project sync fails. 120other projects if a project sync fails.
121 121
122The --force-sync option can be used to overwrite existing git
123directories if they have previously been linked to a different
124object direcotry. WARNING: This may cause data to be lost since
125refs may be removed when overwriting.
126
122The --no-clone-bundle option disables any attempt to use 127The --no-clone-bundle option disables any attempt to use
123$URL/clone.bundle to bootstrap a new Git repository from a 128$URL/clone.bundle to bootstrap a new Git repository from a
124resumeable bundle file on a content delivery network. This 129resumeable bundle file on a content delivery network. This
@@ -174,6 +179,11 @@ later is required to fix a server side protocol bug.
174 p.add_option('-f', '--force-broken', 179 p.add_option('-f', '--force-broken',
175 dest='force_broken', action='store_true', 180 dest='force_broken', action='store_true',
176 help="continue sync even if a project fails to sync") 181 help="continue sync even if a project fails to sync")
182 p.add_option('--force-sync',
183 dest='force_sync', action='store_true',
184 help="overwrite an existing git directory if it needs to "
185 "point to a different object directory. WARNING: this "
186 "may cause loss of data")
177 p.add_option('-l', '--local-only', 187 p.add_option('-l', '--local-only',
178 dest='local_only', action='store_true', 188 dest='local_only', action='store_true',
179 help="only update working tree, don't fetch") 189 help="only update working tree, don't fetch")
@@ -281,6 +291,7 @@ later is required to fix a server side protocol bug.
281 success = project.Sync_NetworkHalf( 291 success = project.Sync_NetworkHalf(
282 quiet=opt.quiet, 292 quiet=opt.quiet,
283 current_branch_only=opt.current_branch_only, 293 current_branch_only=opt.current_branch_only,
294 force_sync=opt.force_sync,
284 clone_bundle=not opt.no_clone_bundle, 295 clone_bundle=not opt.no_clone_bundle,
285 no_tags=opt.no_tags, archive=self.manifest.IsArchive, 296 no_tags=opt.no_tags, archive=self.manifest.IsArchive,
286 optimized_fetch=opt.optimized_fetch) 297 optimized_fetch=opt.optimized_fetch)
@@ -696,7 +707,7 @@ later is required to fix a server side protocol bug.
696 for project in all_projects: 707 for project in all_projects:
697 pm.update() 708 pm.update()
698 if project.worktree: 709 if project.worktree:
699 project.Sync_LocalHalf(syncbuf) 710 project.Sync_LocalHalf(syncbuf, force_sync=opt.force_sync)
700 pm.end() 711 pm.end()
701 print(file=sys.stderr) 712 print(file=sys.stderr)
702 if not syncbuf.Finish(): 713 if not syncbuf.Finish():