diff options
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 43 |
1 files changed, 21 insertions, 22 deletions
@@ -1427,6 +1427,7 @@ class Project(object): | |||
1427 | 1427 | ||
1428 | def Sync_NetworkHalf(self, | 1428 | def Sync_NetworkHalf(self, |
1429 | quiet=False, | 1429 | quiet=False, |
1430 | verbose=False, | ||
1430 | is_new=None, | 1431 | is_new=None, |
1431 | current_branch_only=False, | 1432 | current_branch_only=False, |
1432 | force_sync=False, | 1433 | force_sync=False, |
@@ -1509,16 +1510,17 @@ class Project(object): | |||
1509 | else: | 1510 | else: |
1510 | depth = self.manifest.manifestProject.config.GetString('repo.depth') | 1511 | depth = self.manifest.manifestProject.config.GetString('repo.depth') |
1511 | 1512 | ||
1512 | need_to_fetch = not (optimized_fetch and | 1513 | # See if we can skip the network fetch entirely. |
1513 | (ID_RE.match(self.revisionExpr) and | 1514 | if not (optimized_fetch and |
1514 | self._CheckForImmutableRevision())) | 1515 | (ID_RE.match(self.revisionExpr) and |
1515 | if (need_to_fetch and | 1516 | self._CheckForImmutableRevision())): |
1516 | not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir, | 1517 | if not self._RemoteFetch( |
1517 | current_branch_only=current_branch_only, | 1518 | initial=is_new, quiet=quiet, verbose=verbose, alt_dir=alt_dir, |
1518 | no_tags=no_tags, prune=prune, depth=depth, | 1519 | current_branch_only=current_branch_only, |
1519 | submodules=submodules, force_sync=force_sync, | 1520 | no_tags=no_tags, prune=prune, depth=depth, |
1520 | clone_filter=clone_filter)): | 1521 | submodules=submodules, force_sync=force_sync, |
1521 | return False | 1522 | clone_filter=clone_filter): |
1523 | return False | ||
1522 | 1524 | ||
1523 | mp = self.manifest.manifestProject | 1525 | mp = self.manifest.manifestProject |
1524 | dissociate = mp.config.GetBoolean('repo.dissociate') | 1526 | dissociate = mp.config.GetBoolean('repo.dissociate') |
@@ -2193,6 +2195,7 @@ class Project(object): | |||
2193 | current_branch_only=False, | 2195 | current_branch_only=False, |
2194 | initial=False, | 2196 | initial=False, |
2195 | quiet=False, | 2197 | quiet=False, |
2198 | verbose=False, | ||
2196 | alt_dir=None, | 2199 | alt_dir=None, |
2197 | no_tags=False, | 2200 | no_tags=False, |
2198 | prune=False, | 2201 | prune=False, |
@@ -2223,7 +2226,7 @@ class Project(object): | |||
2223 | 2226 | ||
2224 | if is_sha1 or tag_name is not None: | 2227 | if is_sha1 or tag_name is not None: |
2225 | if self._CheckForImmutableRevision(): | 2228 | if self._CheckForImmutableRevision(): |
2226 | if not quiet: | 2229 | if verbose: |
2227 | print('Skipped fetching project %s (already have persistent ref)' | 2230 | print('Skipped fetching project %s (already have persistent ref)' |
2228 | % self.name) | 2231 | % self.name) |
2229 | return True | 2232 | return True |
@@ -2400,17 +2403,13 @@ class Project(object): | |||
2400 | # got what we wanted, else trigger a second run of all | 2403 | # got what we wanted, else trigger a second run of all |
2401 | # refs. | 2404 | # refs. |
2402 | if not self._CheckForImmutableRevision(): | 2405 | if not self._CheckForImmutableRevision(): |
2403 | if current_branch_only and depth: | 2406 | # Sync the current branch only with depth set to None. |
2404 | # Sync the current branch only with depth set to None | 2407 | # We always pass depth=None down to avoid infinite recursion. |
2405 | return self._RemoteFetch(name=name, | 2408 | return self._RemoteFetch( |
2406 | current_branch_only=current_branch_only, | 2409 | name=name, quiet=quiet, verbose=verbose, |
2407 | initial=False, quiet=quiet, alt_dir=alt_dir, | 2410 | current_branch_only=current_branch_only and depth, |
2408 | depth=None, clone_filter=clone_filter) | 2411 | initial=False, alt_dir=alt_dir, |
2409 | else: | 2412 | depth=None, clone_filter=clone_filter) |
2410 | # Avoid infinite recursion: sync all branches with depth set to None | ||
2411 | return self._RemoteFetch(name=name, current_branch_only=False, | ||
2412 | initial=False, quiet=quiet, alt_dir=alt_dir, | ||
2413 | depth=None, clone_filter=clone_filter) | ||
2414 | 2413 | ||
2415 | return ok | 2414 | return ok |
2416 | 2415 | ||