diff options
author | Raman Tenneti <rtenneti@google.com> | 2021-04-12 20:57:25 -0700 |
---|---|---|
committer | Raman Tenneti <rtenneti@google.com> | 2021-04-13 15:47:10 +0000 |
commit | f32f243ff8aaabe5287235015e1ce189da0123e3 (patch) | |
tree | 3fe288a6b23c20736b650ad37e3d1b00451b27fe /project.py | |
parent | 49de8ef584a074982f3fd86aac8a144f48209807 (diff) | |
download | git-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 'project.py')
-rw-r--r-- | project.py | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1050,7 +1050,8 @@ class Project(object): | |||
1050 | retry_fetches=0, | 1050 | retry_fetches=0, |
1051 | prune=False, | 1051 | prune=False, |
1052 | submodules=False, | 1052 | submodules=False, |
1053 | clone_filter=None): | 1053 | clone_filter=None, |
1054 | partial_clone_exclude=None): | ||
1054 | """Perform only the network IO portion of the sync process. | 1055 | """Perform only the network IO portion of the sync process. |
1055 | Local working directory/branch state is not affected. | 1056 | Local working directory/branch state is not affected. |
1056 | """ | 1057 | """ |
@@ -1087,6 +1088,10 @@ class Project(object): | |||
1087 | if clone_bundle and os.path.exists(self.objdir): | 1088 | if clone_bundle and os.path.exists(self.objdir): |
1088 | clone_bundle = False | 1089 | clone_bundle = False |
1089 | 1090 | ||
1091 | if self.name in partial_clone_exclude: | ||
1092 | clone_bundle = True | ||
1093 | clone_filter = None | ||
1094 | |||
1090 | if is_new is None: | 1095 | if is_new is None: |
1091 | is_new = not self.Exists | 1096 | is_new = not self.Exists |
1092 | if is_new: | 1097 | if is_new: |