summaryrefslogtreecommitdiffstats
path: root/subcmds/sync.py
diff options
context:
space:
mode:
authorRaman Tenneti <rtenneti@google.com>2021-04-12 20:57:25 -0700
committerRaman Tenneti <rtenneti@google.com>2021-04-13 15:47:10 +0000
commitf32f243ff8aaabe5287235015e1ce189da0123e3 (patch)
tree3fe288a6b23c20736b650ad37e3d1b00451b27fe /subcmds/sync.py
parent49de8ef584a074982f3fd86aac8a144f48209807 (diff)
downloadgit-repo-f32f243ff8aaabe5287235015e1ce189da0123e3.tar.gz
init: Added --partial-clone-exclude option.
partial-clone-exclude option excludes projects during partial clone. This is a comma-delimited project names (from manifest.xml). This option is persisted and it is used by the sync command. A project that has been unparital'ed will remain unpartial if that project's name is specified in the --partial-clone-exclude option. The project name should match exactly. Added $ ./run_tests -v Bug: [google internal] b/175712967 "I can't "unpartial" my androidx-main checkout" $ rm -rf androidx-main/ $ mkdir androidx-main/ $ cd androidx-main/ $ repo_dev init -u https://android.googlesource.com/platform/manifest -b androidx-main --partial-clone --clone-filter=blob:limit=10M -m default.xml $ repo_dev sync -c -j8 + Verify a project is partial $ cd frameworks/support/ $ git config -l | grep 'partial' + Unpartial a project. $ /google/bin/releases/android/git_repack/git_unpartial + Verify project is unpartial $ git config -l | grep 'partial' $ cd ../.. + Exclude the project from being unparial'ed after init and sync. $ repo_dev init -u https://android.googlesource.com/platform/manifest -b androidx-main --partial-clone --clone-filter=blob:limit=10M --partial-clone-exclude="platform/frameworks/support,platform/frameworks/support-golden" -m default.xml + Verify project is unpartial $ cd frameworks/support/ $ git config -l | grep 'partial' $ cd ../.. $ repo_dev sync -c -j8 $ cd frameworks/support/ $ git config -l | grep 'partial' $ cd ../.. + Remove the project from exclude list and verify that project is partially cloned. $ repo_dev init -u https://android.googlesource.com/platform/manifest -b androidx-main --partial-clone --clone-filter=blob:limit=10M --partial-clone-exclude= -m default.xml $ repo_dev sync -c -j8 $ cd frameworks/support/ $ git config -l | grep 'partial' Change-Id: Id5dba418eba1d3f54b54e826000406534c0ec196 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303162 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r--subcmds/sync.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 4bcd45d5..b8abb1a7 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -348,7 +348,8 @@ later is required to fix a server side protocol bug.
348 optimized_fetch=opt.optimized_fetch, 348 optimized_fetch=opt.optimized_fetch,
349 retry_fetches=opt.retry_fetches, 349 retry_fetches=opt.retry_fetches,
350 prune=opt.prune, 350 prune=opt.prune,
351 clone_filter=self.manifest.CloneFilter) 351 clone_filter=self.manifest.CloneFilter,
352 partial_clone_exclude=self.manifest.PartialCloneExclude)
352 353
353 output = buf.getvalue() 354 output = buf.getvalue()
354 if opt.verbose and output: 355 if opt.verbose and output:
@@ -517,7 +518,6 @@ later is required to fix a server side protocol bug.
517 if (not project.use_git_worktrees and 518 if (not project.use_git_worktrees and
518 len(project.manifest.GetProjectsWithName(project.name)) > 1): 519 len(project.manifest.GetProjectsWithName(project.name)) > 1):
519 if not opt.quiet: 520 if not opt.quiet:
520 #pm.update(inc=0, msg='Shared project found')
521 print('\r%s: Shared project %s found, disabling pruning.' % 521 print('\r%s: Shared project %s found, disabling pruning.' %
522 (project.relpath, project.name)) 522 (project.relpath, project.name))
523 if git_require((2, 7, 0)): 523 if git_require((2, 7, 0)):
@@ -726,7 +726,8 @@ later is required to fix a server side protocol bug.
726 optimized_fetch=opt.optimized_fetch, 726 optimized_fetch=opt.optimized_fetch,
727 retry_fetches=opt.retry_fetches, 727 retry_fetches=opt.retry_fetches,
728 submodules=self.manifest.HasSubmodules, 728 submodules=self.manifest.HasSubmodules,
729 clone_filter=self.manifest.CloneFilter) 729 clone_filter=self.manifest.CloneFilter,
730 partial_clone_exclude=self.manifest.PartialCloneExclude)
730 finish = time.time() 731 finish = time.time()
731 self.event_log.AddSync(mp, event_log.TASK_SYNC_NETWORK, 732 self.event_log.AddSync(mp, event_log.TASK_SYNC_NETWORK,
732 start, finish, success) 733 start, finish, success)