diff options
| -rw-r--r-- | docs/internal-fs-layout.md | 33 | ||||
| -rw-r--r-- | manifest_xml.py | 6 | ||||
| -rw-r--r-- | project.py | 7 | ||||
| -rwxr-xr-x | repo | 4 | ||||
| -rw-r--r-- | subcmds/init.py | 6 | ||||
| -rw-r--r-- | subcmds/sync.py | 7 |
6 files changed, 42 insertions, 21 deletions
diff --git a/docs/internal-fs-layout.md b/docs/internal-fs-layout.md index 9cbdefb7..0c59f988 100644 --- a/docs/internal-fs-layout.md +++ b/docs/internal-fs-layout.md | |||
| @@ -147,22 +147,23 @@ repo client checkout. | |||
| 147 | Most settings use the `[repo]` section to avoid conflicts with git. | 147 | Most settings use the `[repo]` section to avoid conflicts with git. |
| 148 | User controlled settings are initialized when running `repo init`. | 148 | User controlled settings are initialized when running `repo init`. |
| 149 | 149 | ||
| 150 | | Setting | `repo init` Option | Use/Meaning | | 150 | | Setting | `repo init` Option | Use/Meaning | |
| 151 | |-------------------|---------------------------|-------------| | 151 | |------------------- |---------------------------|-------------| |
| 152 | | manifest.groups | `--groups` & `--platform` | The manifest groups to sync | | 152 | | manifest.groups | `--groups` & `--platform` | The manifest groups to sync | |
| 153 | | repo.archive | `--archive` | Use `git archive` for checkouts | | 153 | | repo.archive | `--archive` | Use `git archive` for checkouts | |
| 154 | | repo.clonebundle | `--clone-bundle` | Whether the initial sync used clone.bundle explicitly | | 154 | | repo.clonebundle | `--clone-bundle` | Whether the initial sync used clone.bundle explicitly | |
| 155 | | repo.clonefilter | `--clone-filter` | Filter setting when using [partial git clones] | | 155 | | repo.clonefilter | `--clone-filter` | Filter setting when using [partial git clones] | |
| 156 | | repo.depth | `--depth` | Create shallow checkouts when cloning | | 156 | | repo.depth | `--depth` | Create shallow checkouts when cloning | |
| 157 | | repo.dissociate | `--dissociate` | Dissociate from any reference/mirrors after initial clone | | 157 | | repo.dissociate | `--dissociate` | Dissociate from any reference/mirrors after initial clone | |
| 158 | | repo.mirror | `--mirror` | Checkout is a repo mirror | | 158 | | repo.mirror | `--mirror` | Checkout is a repo mirror | |
| 159 | | repo.partialclone | `--partial-clone` | Create [partial git clones] | | 159 | | repo.partialclone | `--partial-clone` | Create [partial git clones] | |
| 160 | | repo.reference | `--reference` | Reference repo client checkout | | 160 | | repo.partialcloneexclude | `--partial-clone-exclude` | Comma-delimited list of project names (not paths) to exclude while using [partial git clones] | |
| 161 | | repo.submodules | `--submodules` | Sync git submodules | | 161 | | repo.reference | `--reference` | Reference repo client checkout | |
| 162 | | repo.superproject | `--use-superproject` | Sync [superproject] | | 162 | | repo.submodules | `--submodules` | Sync git submodules | |
| 163 | | repo.worktree | `--worktree` | Use [git worktree] for checkouts | | 163 | | repo.superproject | `--use-superproject` | Sync [superproject] | |
| 164 | | user.email | `--config-name` | User's e-mail address; Copied into `.git/config` when checking out a new project | | 164 | | repo.worktree | `--worktree` | Use [git worktree] for checkouts | |
| 165 | | user.name | `--config-name` | User's name; Copied into `.git/config` when checking out a new project | | 165 | | user.email | `--config-name` | User's e-mail address; Copied into `.git/config` when checking out a new project | |
| 166 | | user.name | `--config-name` | User's name; Copied into `.git/config` when checking out a new project | | ||
| 166 | 167 | ||
| 167 | [partial git clones]: https://git-scm.com/docs/gitrepository-layout#_code_partialclone_code | 168 | [partial git clones]: https://git-scm.com/docs/gitrepository-layout#_code_partialclone_code |
| 168 | [superproject]: https://en.wikibooks.org/wiki/Git/Submodules_and_Superprojects | 169 | [superproject]: https://en.wikibooks.org/wiki/Git/Submodules_and_Superprojects |
diff --git a/manifest_xml.py b/manifest_xml.py index d67ba72d..0c2b45e5 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
| @@ -590,6 +590,12 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 590 | return None | 590 | return None |
| 591 | 591 | ||
| 592 | @property | 592 | @property |
| 593 | def PartialCloneExclude(self): | ||
| 594 | exclude = self.manifest.manifestProject.config.GetString( | ||
| 595 | 'repo.partialcloneexclude') or '' | ||
| 596 | return set(x.strip() for x in exclude.split(',')) | ||
| 597 | |||
| 598 | @property | ||
| 593 | def IsMirror(self): | 599 | def IsMirror(self): |
| 594 | return self.manifestProject.config.GetBoolean('repo.mirror') | 600 | return self.manifestProject.config.GetBoolean('repo.mirror') |
| 595 | 601 | ||
| @@ -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: |
| @@ -350,6 +350,10 @@ def InitParser(parser, gitc_init=False): | |||
| 350 | group.add_option('--no-partial-clone', action='store_false', | 350 | group.add_option('--no-partial-clone', action='store_false', |
| 351 | help='disable use of partial clone (https://git-scm.com/' | 351 | help='disable use of partial clone (https://git-scm.com/' |
| 352 | 'docs/gitrepository-layout#_code_partialclone_code)') | 352 | 'docs/gitrepository-layout#_code_partialclone_code)') |
| 353 | group.add_option('--partial-clone-exclude', action='store', | ||
| 354 | help='exclude the specified projects (a comma-delimited ' | ||
| 355 | 'project names) from partial clone (https://git-scm.com' | ||
| 356 | '/docs/gitrepository-layout#_code_partialclone_code)') | ||
| 353 | group.add_option('--clone-filter', action='store', default='blob:none', | 357 | group.add_option('--clone-filter', action='store', default='blob:none', |
| 354 | help='filter for use with --partial-clone ' | 358 | help='filter for use with --partial-clone ' |
| 355 | '[default: %default]') | 359 | '[default: %default]') |
diff --git a/subcmds/init.py b/subcmds/init.py index 3566b8b6..a23e529d 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
| @@ -227,6 +227,9 @@ to update the working directory files. | |||
| 227 | else: | 227 | else: |
| 228 | opt.clone_filter = None | 228 | opt.clone_filter = None |
| 229 | 229 | ||
| 230 | if opt.partial_clone_exclude is not None: | ||
| 231 | m.config.SetString('repo.partialcloneexclude', opt.partial_clone_exclude) | ||
| 232 | |||
| 230 | if opt.clone_bundle is None: | 233 | if opt.clone_bundle is None: |
| 231 | opt.clone_bundle = False if opt.partial_clone else True | 234 | opt.clone_bundle = False if opt.partial_clone else True |
| 232 | else: | 235 | else: |
| @@ -242,7 +245,8 @@ to update the working directory files. | |||
| 242 | clone_bundle=opt.clone_bundle, | 245 | clone_bundle=opt.clone_bundle, |
| 243 | current_branch_only=opt.current_branch_only, | 246 | current_branch_only=opt.current_branch_only, |
| 244 | tags=opt.tags, submodules=opt.submodules, | 247 | tags=opt.tags, submodules=opt.submodules, |
| 245 | clone_filter=opt.clone_filter): | 248 | clone_filter=opt.clone_filter, |
| 249 | partial_clone_exclude=self.manifest.PartialCloneExclude): | ||
| 246 | r = m.GetRemote(m.remote.name) | 250 | r = m.GetRemote(m.remote.name) |
| 247 | print('fatal: cannot obtain manifest %s' % r.url, file=sys.stderr) | 251 | print('fatal: cannot obtain manifest %s' % r.url, file=sys.stderr) |
| 248 | 252 | ||
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) |
