diff options
-rw-r--r-- | git_superproject.py | 2 | ||||
-rw-r--r-- | manifest_xml.py | 27 | ||||
-rw-r--r-- | project.py | 108 | ||||
-rw-r--r-- | subcmds/init.py | 2 | ||||
-rw-r--r-- | subcmds/sync.py | 2 |
5 files changed, 107 insertions, 34 deletions
diff --git a/git_superproject.py b/git_superproject.py index 299d2537..f4dbb27b 100644 --- a/git_superproject.py +++ b/git_superproject.py | |||
@@ -406,7 +406,7 @@ def UseSuperproject(opt, manifest): | |||
406 | if opt.use_superproject is not None: | 406 | if opt.use_superproject is not None: |
407 | return opt.use_superproject | 407 | return opt.use_superproject |
408 | else: | 408 | else: |
409 | client_value = manifest.manifestProject.config.GetBoolean('repo.superproject') | 409 | client_value = manifest.manifestProject.use_superproject |
410 | if client_value is not None: | 410 | if client_value is not None: |
411 | return client_value | 411 | return client_value |
412 | else: | 412 | else: |
diff --git a/manifest_xml.py b/manifest_xml.py index d3e952a5..022cad20 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -372,7 +372,7 @@ class XmlManifest(object): | |||
372 | # normal repo settings live in the manifestProject which we just setup | 372 | # normal repo settings live in the manifestProject which we just setup |
373 | # above, so we couldn't easily query before that. We assume Project() | 373 | # above, so we couldn't easily query before that. We assume Project() |
374 | # init doesn't care if this changes afterwards. | 374 | # init doesn't care if this changes afterwards. |
375 | if os.path.exists(mp.gitdir) and mp.config.GetBoolean('repo.worktree'): | 375 | if os.path.exists(mp.gitdir) and mp.use_worktree: |
376 | mp.use_git_worktrees = True | 376 | mp.use_git_worktrees = True |
377 | 377 | ||
378 | self._Unload() | 378 | self._Unload() |
@@ -487,7 +487,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
487 | mp = self.manifestProject | 487 | mp = self.manifestProject |
488 | 488 | ||
489 | if groups is None: | 489 | if groups is None: |
490 | groups = mp.config.GetString('manifest.groups') | 490 | groups = mp.manifest_groups |
491 | if groups: | 491 | if groups: |
492 | groups = self._ParseList(groups) | 492 | groups = self._ParseList(groups) |
493 | 493 | ||
@@ -861,22 +861,21 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
861 | 861 | ||
862 | @property | 862 | @property |
863 | def CloneBundle(self): | 863 | def CloneBundle(self): |
864 | clone_bundle = self.manifestProject.config.GetBoolean('repo.clonebundle') | 864 | clone_bundle = self.manifestProject.clone_bundle |
865 | if clone_bundle is None: | 865 | if clone_bundle is None: |
866 | return False if self.manifestProject.config.GetBoolean('repo.partialclone') else True | 866 | return False if self.manifestProject.partial_clone else True |
867 | else: | 867 | else: |
868 | return clone_bundle | 868 | return clone_bundle |
869 | 869 | ||
870 | @property | 870 | @property |
871 | def CloneFilter(self): | 871 | def CloneFilter(self): |
872 | if self.manifestProject.config.GetBoolean('repo.partialclone'): | 872 | if self.manifestProject.partial_clone: |
873 | return self.manifestProject.config.GetString('repo.clonefilter') | 873 | return self.manifestProject.clone_filter |
874 | return None | 874 | return None |
875 | 875 | ||
876 | @property | 876 | @property |
877 | def PartialCloneExclude(self): | 877 | def PartialCloneExclude(self): |
878 | exclude = self.manifest.manifestProject.config.GetString( | 878 | exclude = self.manifest.manifestProject.partial_clone_exclude or '' |
879 | 'repo.partialcloneexclude') or '' | ||
880 | return set(x.strip() for x in exclude.split(',')) | 879 | return set(x.strip() for x in exclude.split(',')) |
881 | 880 | ||
882 | @property | 881 | @property |
@@ -897,23 +896,23 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
897 | 896 | ||
898 | @property | 897 | @property |
899 | def IsMirror(self): | 898 | def IsMirror(self): |
900 | return self.manifestProject.config.GetBoolean('repo.mirror') | 899 | return self.manifestProject.mirror |
901 | 900 | ||
902 | @property | 901 | @property |
903 | def UseGitWorktrees(self): | 902 | def UseGitWorktrees(self): |
904 | return self.manifestProject.config.GetBoolean('repo.worktree') | 903 | return self.manifestProject.use_worktree |
905 | 904 | ||
906 | @property | 905 | @property |
907 | def IsArchive(self): | 906 | def IsArchive(self): |
908 | return self.manifestProject.config.GetBoolean('repo.archive') | 907 | return self.manifestProject.archive |
909 | 908 | ||
910 | @property | 909 | @property |
911 | def HasSubmodules(self): | 910 | def HasSubmodules(self): |
912 | return self.manifestProject.config.GetBoolean('repo.submodules') | 911 | return self.manifestProject.submodules |
913 | 912 | ||
914 | @property | 913 | @property |
915 | def EnableGitLfs(self): | 914 | def EnableGitLfs(self): |
916 | return self.manifestProject.config.GetBoolean('repo.git-lfs') | 915 | return self.manifestProject.git_lfs |
917 | 916 | ||
918 | def FindManifestByPath(self, path): | 917 | def FindManifestByPath(self, path): |
919 | """Returns the manifest containing path.""" | 918 | """Returns the manifest containing path.""" |
@@ -965,7 +964,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
965 | 964 | ||
966 | def GetGroupsStr(self): | 965 | def GetGroupsStr(self): |
967 | """Returns the manifest group string that should be synced.""" | 966 | """Returns the manifest group string that should be synced.""" |
968 | groups = self.manifestProject.config.GetString('manifest.groups') | 967 | groups = self.manifestProject.manifest_groups |
969 | if not groups: | 968 | if not groups: |
970 | groups = self.GetDefaultGroupsStr() | 969 | groups = self.GetDefaultGroupsStr() |
971 | return groups | 970 | return groups |
@@ -16,6 +16,7 @@ import errno | |||
16 | import filecmp | 16 | import filecmp |
17 | import glob | 17 | import glob |
18 | import os | 18 | import os |
19 | import platform | ||
19 | import random | 20 | import random |
20 | import re | 21 | import re |
21 | import shutil | 22 | import shutil |
@@ -1162,7 +1163,7 @@ class Project(object): | |||
1162 | if self.clone_depth: | 1163 | if self.clone_depth: |
1163 | depth = self.clone_depth | 1164 | depth = self.clone_depth |
1164 | else: | 1165 | else: |
1165 | depth = self.manifest.manifestProject.config.GetString('repo.depth') | 1166 | depth = self.manifest.manifestProject.depth |
1166 | 1167 | ||
1167 | # See if we can skip the network fetch entirely. | 1168 | # See if we can skip the network fetch entirely. |
1168 | if not (optimized_fetch and | 1169 | if not (optimized_fetch and |
@@ -1179,7 +1180,7 @@ class Project(object): | |||
1179 | return False | 1180 | return False |
1180 | 1181 | ||
1181 | mp = self.manifest.manifestProject | 1182 | mp = self.manifest.manifestProject |
1182 | dissociate = mp.config.GetBoolean('repo.dissociate') | 1183 | dissociate = mp.dissociate |
1183 | if dissociate: | 1184 | if dissociate: |
1184 | alternates_file = os.path.join(self.objdir, 'objects/info/alternates') | 1185 | alternates_file = os.path.join(self.objdir, 'objects/info/alternates') |
1185 | if os.path.exists(alternates_file): | 1186 | if os.path.exists(alternates_file): |
@@ -2282,9 +2283,7 @@ class Project(object): | |||
2282 | return ok | 2283 | return ok |
2283 | 2284 | ||
2284 | def _ApplyCloneBundle(self, initial=False, quiet=False, verbose=False): | 2285 | def _ApplyCloneBundle(self, initial=False, quiet=False, verbose=False): |
2285 | if initial and \ | 2286 | if initial and (self.manifest.manifestProject.depth or self.clone_depth): |
2286 | (self.manifest.manifestProject.config.GetString('repo.depth') or | ||
2287 | self.clone_depth): | ||
2288 | return False | 2287 | return False |
2289 | 2288 | ||
2290 | remote = self.GetRemote(self.remote.name) | 2289 | remote = self.GetRemote(self.remote.name) |
@@ -2513,7 +2512,7 @@ class Project(object): | |||
2513 | 2512 | ||
2514 | if init_git_dir: | 2513 | if init_git_dir: |
2515 | mp = self.manifest.manifestProject | 2514 | mp = self.manifest.manifestProject |
2516 | ref_dir = mp.config.GetString('repo.reference') or '' | 2515 | ref_dir = mp.reference or '' |
2517 | 2516 | ||
2518 | def _expanded_ref_dirs(): | 2517 | def _expanded_ref_dirs(): |
2519 | """Iterate through the possible git reference directory paths.""" | 2518 | """Iterate through the possible git reference directory paths.""" |
@@ -3359,17 +3358,92 @@ class ManifestProject(MetaProject): | |||
3359 | capture_stderr=True).Wait() == 0 | 3358 | capture_stderr=True).Wait() == 0 |
3360 | 3359 | ||
3361 | @property | 3360 | @property |
3361 | def standalone_manifest_url(self): | ||
3362 | """The URL of the standalone manifest, or None.""" | ||
3363 | return self.config.getString('manifest.standalone') | ||
3364 | |||
3365 | @property | ||
3366 | def manifest_groups(self): | ||
3367 | """The manifest groups string.""" | ||
3368 | return self.config.GetString('manifest.groups') | ||
3369 | |||
3370 | @property | ||
3371 | def reference(self): | ||
3372 | """The --reference for this manifest.""" | ||
3373 | self.config.GetString('repo.reference') | ||
3374 | |||
3375 | @property | ||
3376 | def dissociate(self): | ||
3377 | """Whether to dissociate.""" | ||
3378 | self.config.GetBoolean('repo.dissociate') | ||
3379 | |||
3380 | @property | ||
3381 | def archive(self): | ||
3382 | """Whether we use archive.""" | ||
3383 | self.config.GetBoolean('repo.archive') | ||
3384 | |||
3385 | @property | ||
3386 | def mirror(self): | ||
3387 | """Whether we use mirror.""" | ||
3388 | self.config.GetBoolean('repo.mirror') | ||
3389 | |||
3390 | @property | ||
3391 | def use_worktree(self): | ||
3392 | """Whether we use worktree.""" | ||
3393 | self.config.GetBoolean('repo.worktree') | ||
3394 | |||
3395 | @property | ||
3396 | def clone_bundle(self): | ||
3397 | """Whether we use clone_bundle.""" | ||
3398 | self.config.GetBoolean('repo.clonebundle') | ||
3399 | |||
3400 | @property | ||
3401 | def submodules(self): | ||
3402 | """Whether we use submodules.""" | ||
3403 | self.config.GetBoolean('repo.submodules') | ||
3404 | |||
3405 | @property | ||
3406 | def git_lfs(self): | ||
3407 | """Whether we use git_lfs.""" | ||
3408 | self.config.GetBoolean('repo.git-lfs') | ||
3409 | |||
3410 | @property | ||
3411 | def use_superproject(self): | ||
3412 | """Whether we use superproject.""" | ||
3413 | self.config.GetBoolean('repo.superproject') | ||
3414 | |||
3415 | @property | ||
3416 | def partial_clone(self): | ||
3417 | """Whether this is a partial clone.""" | ||
3418 | self.config.GetBoolean('repo.partialclone') | ||
3419 | |||
3420 | @property | ||
3421 | def depth(self): | ||
3422 | """Partial clone depth.""" | ||
3423 | self.config.GetString('repo.depth') | ||
3424 | |||
3425 | @property | ||
3426 | def clone_filter(self): | ||
3427 | """The clone filter.""" | ||
3428 | self.config.GetString('repo.clonefilter') | ||
3429 | |||
3430 | @property | ||
3431 | def partial_clone_exclude(self): | ||
3432 | """Partial clone exclude string""" | ||
3433 | self.config.GetBoolean('repo.partialcloneexclude') | ||
3434 | |||
3435 | @property | ||
3362 | def _platform_name(self): | 3436 | def _platform_name(self): |
3363 | """Return the name of the platform.""" | 3437 | """Return the name of the platform.""" |
3364 | return platform.system().lower() | 3438 | return platform.system().lower() |
3365 | 3439 | ||
3366 | def Sync(self, _kwargs_only=(), manifest_url='', manifest_branch=None, | 3440 | def Sync(self, _kwargs_only=(), manifest_url='', manifest_branch=None, |
3367 | standalone_manifest=False, groups='', platform='', mirror=False, | 3441 | standalone_manifest=False, groups='', mirror=False, reference='', |
3368 | dissociate=False, reference='', worktree=False, submodules=False, | 3442 | dissociate=False, worktree=False, submodules=False, archive=False, |
3369 | archive=False, partial_clone=None, clone_filter='blob:none', | 3443 | partial_clone=None, depth=None, clone_filter='blob:none', |
3370 | partial_clone_exclude=None, clone_bundle=None, git_lfs=None, | 3444 | partial_clone_exclude=None, clone_bundle=None, git_lfs=None, |
3371 | use_superproject=None, verbose=False, current_branch_only=False, | 3445 | use_superproject=None, verbose=False, current_branch_only=False, |
3372 | tags='', depth=None): | 3446 | platform='', tags=''): |
3373 | """Sync the manifest and all submanifests. | 3447 | """Sync the manifest and all submanifests. |
3374 | 3448 | ||
3375 | Args: | 3449 | Args: |
@@ -3379,8 +3453,6 @@ class ManifestProject(MetaProject): | |||
3379 | file. | 3453 | file. |
3380 | groups: a string, restricts the checkout to projects with the specified | 3454 | groups: a string, restricts the checkout to projects with the specified |
3381 | groups. | 3455 | groups. |
3382 | platform: a string, restrict the checkout to projects with the specified | ||
3383 | platform group. | ||
3384 | mirror: a boolean, whether to create a mirror of the remote repository. | 3456 | mirror: a boolean, whether to create a mirror of the remote repository. |
3385 | reference: a string, location of a repo instance to use as a reference. | 3457 | reference: a string, location of a repo instance to use as a reference. |
3386 | dissociate: a boolean, whether to dissociate from reference mirrors after | 3458 | dissociate: a boolean, whether to dissociate from reference mirrors after |
@@ -3391,6 +3463,7 @@ class ManifestProject(MetaProject): | |||
3391 | archive: a boolean, whether to checkout each project as an archive. See | 3463 | archive: a boolean, whether to checkout each project as an archive. See |
3392 | git-archive. | 3464 | git-archive. |
3393 | partial_clone: a boolean, whether to perform a partial clone. | 3465 | partial_clone: a boolean, whether to perform a partial clone. |
3466 | depth: an int, how deep of a shallow clone to create. | ||
3394 | clone_filter: a string, filter to use with partial_clone. | 3467 | clone_filter: a string, filter to use with partial_clone. |
3395 | partial_clone_exclude : a string, comma-delimeted list of project namess | 3468 | partial_clone_exclude : a string, comma-delimeted list of project namess |
3396 | to exclude from partial clone. | 3469 | to exclude from partial clone. |
@@ -3401,8 +3474,9 @@ class ManifestProject(MetaProject): | |||
3401 | verbose: a boolean, whether to show all output, rather than only errors. | 3474 | verbose: a boolean, whether to show all output, rather than only errors. |
3402 | current_branch_only: a boolean, whether to only fetch the current manifest | 3475 | current_branch_only: a boolean, whether to only fetch the current manifest |
3403 | branch from the server. | 3476 | branch from the server. |
3477 | platform: a string, restrict the checkout to projects with the specified | ||
3478 | platform group. | ||
3404 | tags: a boolean, whether to fetch tags., | 3479 | tags: a boolean, whether to fetch tags., |
3405 | depth: an int, how deep of a shallow clone to create. | ||
3406 | 3480 | ||
3407 | Returns: | 3481 | Returns: |
3408 | a boolean, whether the sync was successful. | 3482 | a boolean, whether the sync was successful. |
@@ -3493,11 +3567,11 @@ class ManifestProject(MetaProject): | |||
3493 | else: | 3567 | else: |
3494 | self.PreSync() | 3568 | self.PreSync() |
3495 | 3569 | ||
3496 | groups = re.split(r'[,\s]+', groups) | 3570 | groups = re.split(r'[,\s]+', groups or '') |
3497 | all_platforms = ['linux', 'darwin', 'windows'] | 3571 | all_platforms = ['linux', 'darwin', 'windows'] |
3498 | platformize = lambda x: 'platform-' + x | 3572 | platformize = lambda x: 'platform-' + x |
3499 | if platform == 'auto': | 3573 | if platform == 'auto': |
3500 | if (not mirror and not self.config.GetString('repo.mirror') == 'true'): | 3574 | if not mirror and not self.mirror: |
3501 | groups.append(platformize(self._platform_name)) | 3575 | groups.append(platformize(self._platform_name)) |
3502 | elif platform == 'all': | 3576 | elif platform == 'all': |
3503 | groups.extend(map(platformize, all_platforms)) | 3577 | groups.extend(map(platformize, all_platforms)) |
@@ -3561,8 +3635,8 @@ class ManifestProject(MetaProject): | |||
3561 | self.config.SetBoolean('repo.partialclone', partial_clone) | 3635 | self.config.SetBoolean('repo.partialclone', partial_clone) |
3562 | if clone_filter: | 3636 | if clone_filter: |
3563 | self.config.SetString('repo.clonefilter', clone_filter) | 3637 | self.config.SetString('repo.clonefilter', clone_filter) |
3564 | elif self.config.GetBoolean('repo.partialclone'): | 3638 | elif self.partialclone: |
3565 | clone_filter = self.config.GetString('repo.clonefilter') | 3639 | clone_filter = self.clone_filter |
3566 | else: | 3640 | else: |
3567 | clone_filter = None | 3641 | clone_filter = None |
3568 | 3642 | ||
diff --git a/subcmds/init.py b/subcmds/init.py index b6c891ac..13085fae 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
@@ -345,7 +345,7 @@ to update the working directory files. | |||
345 | self._SyncManifest(opt) | 345 | self._SyncManifest(opt) |
346 | self._LinkManifest(opt.manifest_name) | 346 | self._LinkManifest(opt.manifest_name) |
347 | 347 | ||
348 | if self.manifest.manifestProject.config.GetBoolean('repo.superproject'): | 348 | if self.manifest.manifestProject.use_superproject: |
349 | self._CloneSuperproject(opt) | 349 | self._CloneSuperproject(opt) |
350 | 350 | ||
351 | if os.isatty(0) and os.isatty(1) and not self.manifest.IsMirror: | 351 | if os.isatty(0) and os.isatty(1) and not self.manifest.IsMirror: |
diff --git a/subcmds/sync.py b/subcmds/sync.py index f5584dc8..c1655159 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -976,7 +976,7 @@ later is required to fix a server side protocol bug. | |||
976 | file=sys.stderr) | 976 | file=sys.stderr) |
977 | 977 | ||
978 | mp = self.manifest.manifestProject | 978 | mp = self.manifest.manifestProject |
979 | is_standalone_manifest = mp.config.GetString('manifest.standalone') | 979 | is_standalone_manifest = bool(mp.standalone_manifest_url) |
980 | if not is_standalone_manifest: | 980 | if not is_standalone_manifest: |
981 | mp.PreSync() | 981 | mp.PreSync() |
982 | 982 | ||