diff options
author | Aravind Vasudevan <aravindvasudev@google.com> | 2023-09-14 08:17:20 +0000 |
---|---|---|
committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-09-14 17:14:40 +0000 |
commit | 7a1f1f70f0587795e2b6979adf7eac389037de57 (patch) | |
tree | 046fc680bbd97b329d0a667a391a208eb772e86b /project.py | |
parent | c993c5068e0f7e22124b1bfb17ad0425fe2b8c83 (diff) | |
download | git-repo-7a1f1f70f0587795e2b6979adf7eac389037de57.tar.gz |
project: Use repo logger
Bug: b/292704435
Change-Id: I510fc911530db2c84a7ee099fa2905ceac35d0b7
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/386295
Reviewed-by: Jason Chang <jasonnc@google.com>
Tested-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 172 |
1 files changed, 69 insertions, 103 deletions
@@ -56,9 +56,13 @@ import git_superproject | |||
56 | from git_trace2_event_log import EventLog | 56 | from git_trace2_event_log import EventLog |
57 | import platform_utils | 57 | import platform_utils |
58 | import progress | 58 | import progress |
59 | from repo_logging import RepoLogger | ||
59 | from repo_trace import Trace | 60 | from repo_trace import Trace |
60 | 61 | ||
61 | 62 | ||
63 | logger = RepoLogger(__file__) | ||
64 | |||
65 | |||
62 | class SyncNetworkHalfResult(NamedTuple): | 66 | class SyncNetworkHalfResult(NamedTuple): |
63 | """Sync_NetworkHalf return value.""" | 67 | """Sync_NetworkHalf return value.""" |
64 | 68 | ||
@@ -115,16 +119,6 @@ def _lwrite(path, content): | |||
115 | raise | 119 | raise |
116 | 120 | ||
117 | 121 | ||
118 | def _error(fmt, *args): | ||
119 | msg = fmt % args | ||
120 | print("error: %s" % msg, file=sys.stderr) | ||
121 | |||
122 | |||
123 | def _warn(fmt, *args): | ||
124 | msg = fmt % args | ||
125 | print("warn: %s" % msg, file=sys.stderr) | ||
126 | |||
127 | |||
128 | def not_rev(r): | 122 | def not_rev(r): |
129 | return "^" + r | 123 | return "^" + r |
130 | 124 | ||
@@ -436,7 +430,7 @@ class _CopyFile(object): | |||
436 | mode = mode & ~(stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH) | 430 | mode = mode & ~(stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH) |
437 | os.chmod(dest, mode) | 431 | os.chmod(dest, mode) |
438 | except IOError: | 432 | except IOError: |
439 | _error("Cannot copy file %s to %s", src, dest) | 433 | logger.error("error: Cannot copy file %s to %s", src, dest) |
440 | 434 | ||
441 | 435 | ||
442 | class _LinkFile(object): | 436 | class _LinkFile(object): |
@@ -471,7 +465,9 @@ class _LinkFile(object): | |||
471 | os.makedirs(dest_dir) | 465 | os.makedirs(dest_dir) |
472 | platform_utils.symlink(relSrc, absDest) | 466 | platform_utils.symlink(relSrc, absDest) |
473 | except IOError: | 467 | except IOError: |
474 | _error("Cannot link file %s to %s", relSrc, absDest) | 468 | logger.error( |
469 | "error: Cannot link file %s to %s", relSrc, absDest | ||
470 | ) | ||
475 | 471 | ||
476 | def _Link(self): | 472 | def _Link(self): |
477 | """Link the self.src & self.dest paths. | 473 | """Link the self.src & self.dest paths. |
@@ -499,7 +495,7 @@ class _LinkFile(object): | |||
499 | dest = _SafeExpandPath(self.topdir, self.dest) | 495 | dest = _SafeExpandPath(self.topdir, self.dest) |
500 | # Entity contains a wild card. | 496 | # Entity contains a wild card. |
501 | if os.path.exists(dest) and not platform_utils.isdir(dest): | 497 | if os.path.exists(dest) and not platform_utils.isdir(dest): |
502 | _error( | 498 | logger.error( |
503 | "Link error: src with wildcard, %s must be a directory", | 499 | "Link error: src with wildcard, %s must be a directory", |
504 | dest, | 500 | dest, |
505 | ) | 501 | ) |
@@ -1201,7 +1197,7 @@ class Project(object): | |||
1201 | tar.extractall(path=path) | 1197 | tar.extractall(path=path) |
1202 | return True | 1198 | return True |
1203 | except (IOError, tarfile.TarError) as e: | 1199 | except (IOError, tarfile.TarError) as e: |
1204 | _error("Cannot extract archive %s: %s", tarpath, str(e)) | 1200 | logger.error("error: Cannot extract archive %s: %s", tarpath, e) |
1205 | return False | 1201 | return False |
1206 | 1202 | ||
1207 | def Sync_NetworkHalf( | 1203 | def Sync_NetworkHalf( |
@@ -1234,10 +1230,7 @@ class Project(object): | |||
1234 | ) | 1230 | ) |
1235 | msg_args = self.name | 1231 | msg_args = self.name |
1236 | msg = msg_template % msg_args | 1232 | msg = msg_template % msg_args |
1237 | _error( | 1233 | logger.error(msg_template, msg_args) |
1238 | msg_template, | ||
1239 | msg_args, | ||
1240 | ) | ||
1241 | return SyncNetworkHalfResult( | 1234 | return SyncNetworkHalfResult( |
1242 | False, SyncNetworkHalfError(msg, project=self.name) | 1235 | False, SyncNetworkHalfError(msg, project=self.name) |
1243 | ) | 1236 | ) |
@@ -1250,7 +1243,7 @@ class Project(object): | |||
1250 | try: | 1243 | try: |
1251 | self._FetchArchive(tarpath, cwd=topdir) | 1244 | self._FetchArchive(tarpath, cwd=topdir) |
1252 | except GitError as e: | 1245 | except GitError as e: |
1253 | _error("%s", e) | 1246 | logger.error("error: %s", e) |
1254 | return SyncNetworkHalfResult(False, e) | 1247 | return SyncNetworkHalfResult(False, e) |
1255 | 1248 | ||
1256 | # From now on, we only need absolute tarpath. | 1249 | # From now on, we only need absolute tarpath. |
@@ -1267,7 +1260,7 @@ class Project(object): | |||
1267 | try: | 1260 | try: |
1268 | platform_utils.remove(tarpath) | 1261 | platform_utils.remove(tarpath) |
1269 | except OSError as e: | 1262 | except OSError as e: |
1270 | _warn("Cannot remove archive %s: %s", tarpath, str(e)) | 1263 | logger.warn("warn: Cannot remove archive %s: %s", tarpath, e) |
1271 | self._CopyAndLinkFiles() | 1264 | self._CopyAndLinkFiles() |
1272 | return SyncNetworkHalfResult(True) | 1265 | return SyncNetworkHalfResult(True) |
1273 | 1266 | ||
@@ -1762,17 +1755,17 @@ class Project(object): | |||
1762 | """ | 1755 | """ |
1763 | if self.IsDirty(): | 1756 | if self.IsDirty(): |
1764 | if force: | 1757 | if force: |
1765 | print( | 1758 | logger.warn( |
1766 | "warning: %s: Removing dirty project: uncommitted changes " | 1759 | "warning: %s: Removing dirty project: uncommitted changes " |
1767 | "lost." % (self.RelPath(local=False),), | 1760 | "lost.", |
1768 | file=sys.stderr, | 1761 | self.RelPath(local=False), |
1769 | ) | 1762 | ) |
1770 | else: | 1763 | else: |
1771 | msg = ( | 1764 | msg = ( |
1772 | "error: %s: Cannot remove project: uncommitted" | 1765 | "error: %s: Cannot remove project: uncommitted" |
1773 | "changes are present.\n" % self.RelPath(local=False) | 1766 | "changes are present.\n" % self.RelPath(local=False) |
1774 | ) | 1767 | ) |
1775 | print(msg, file=sys.stderr) | 1768 | logger.error(msg) |
1776 | raise DeleteDirtyWorktreeError(msg, project=self) | 1769 | raise DeleteDirtyWorktreeError(msg, project=self) |
1777 | 1770 | ||
1778 | if not quiet: | 1771 | if not quiet: |
@@ -1819,12 +1812,11 @@ class Project(object): | |||
1819 | platform_utils.rmtree(self.gitdir) | 1812 | platform_utils.rmtree(self.gitdir) |
1820 | except OSError as e: | 1813 | except OSError as e: |
1821 | if e.errno != errno.ENOENT: | 1814 | if e.errno != errno.ENOENT: |
1822 | print("error: %s: %s" % (self.gitdir, e), file=sys.stderr) | 1815 | logger.error("error: %s: %s", self.gitdir, e) |
1823 | print( | 1816 | logger.error( |
1824 | "error: %s: Failed to delete obsolete checkout; remove " | 1817 | "error: %s: Failed to delete obsolete checkout; remove " |
1825 | "manually, then run `repo sync -l`." | 1818 | "manually, then run `repo sync -l`.", |
1826 | % (self.RelPath(local=False),), | 1819 | self.RelPath(local=False), |
1827 | file=sys.stderr, | ||
1828 | ) | 1820 | ) |
1829 | raise DeleteWorktreeError(aggregate_errors=[e]) | 1821 | raise DeleteWorktreeError(aggregate_errors=[e]) |
1830 | 1822 | ||
@@ -1840,10 +1832,7 @@ class Project(object): | |||
1840 | platform_utils.remove(path) | 1832 | platform_utils.remove(path) |
1841 | except OSError as e: | 1833 | except OSError as e: |
1842 | if e.errno != errno.ENOENT: | 1834 | if e.errno != errno.ENOENT: |
1843 | print( | 1835 | logger.error("error: %s: Failed to remove: %s", path, e) |
1844 | "error: %s: Failed to remove: %s" % (path, e), | ||
1845 | file=sys.stderr, | ||
1846 | ) | ||
1847 | failed = True | 1836 | failed = True |
1848 | errors.append(e) | 1837 | errors.append(e) |
1849 | dirs[:] = [ | 1838 | dirs[:] = [ |
@@ -1862,10 +1851,7 @@ class Project(object): | |||
1862 | platform_utils.remove(d) | 1851 | platform_utils.remove(d) |
1863 | except OSError as e: | 1852 | except OSError as e: |
1864 | if e.errno != errno.ENOENT: | 1853 | if e.errno != errno.ENOENT: |
1865 | print( | 1854 | logger.error("error: %s: Failed to remove: %s", d, e) |
1866 | "error: %s: Failed to remove: %s" % (d, e), | ||
1867 | file=sys.stderr, | ||
1868 | ) | ||
1869 | failed = True | 1855 | failed = True |
1870 | errors.append(e) | 1856 | errors.append(e) |
1871 | elif not platform_utils.listdir(d): | 1857 | elif not platform_utils.listdir(d): |
@@ -1873,21 +1859,16 @@ class Project(object): | |||
1873 | platform_utils.rmdir(d) | 1859 | platform_utils.rmdir(d) |
1874 | except OSError as e: | 1860 | except OSError as e: |
1875 | if e.errno != errno.ENOENT: | 1861 | if e.errno != errno.ENOENT: |
1876 | print( | 1862 | logger.error("error: %s: Failed to remove: %s", d, e) |
1877 | "error: %s: Failed to remove: %s" % (d, e), | ||
1878 | file=sys.stderr, | ||
1879 | ) | ||
1880 | failed = True | 1863 | failed = True |
1881 | errors.append(e) | 1864 | errors.append(e) |
1882 | if failed: | 1865 | if failed: |
1883 | print( | 1866 | logger.error( |
1884 | "error: %s: Failed to delete obsolete checkout." | 1867 | "error: %s: Failed to delete obsolete checkout.", |
1885 | % (self.RelPath(local=False),), | 1868 | self.RelPath(local=False), |
1886 | file=sys.stderr, | ||
1887 | ) | 1869 | ) |
1888 | print( | 1870 | logger.error( |
1889 | " Remove manually, then run `repo sync -l`.", | 1871 | " Remove manually, then run `repo sync -l`.", |
1890 | file=sys.stderr, | ||
1891 | ) | 1872 | ) |
1892 | raise DeleteWorktreeError(aggregate_errors=errors) | 1873 | raise DeleteWorktreeError(aggregate_errors=errors) |
1893 | 1874 | ||
@@ -2781,7 +2762,7 @@ class Project(object): | |||
2781 | print("Curl output:\n%s" % output) | 2762 | print("Curl output:\n%s" % output) |
2782 | return False | 2763 | return False |
2783 | elif curlret and not verbose and output: | 2764 | elif curlret and not verbose and output: |
2784 | print("%s" % output, file=sys.stderr) | 2765 | logger.error("%s", output) |
2785 | 2766 | ||
2786 | if os.path.exists(tmpPath): | 2767 | if os.path.exists(tmpPath): |
2787 | if curlret == 0 and self._IsValidBundle(tmpPath, quiet): | 2768 | if curlret == 0 and self._IsValidBundle(tmpPath, quiet): |
@@ -2800,10 +2781,7 @@ class Project(object): | |||
2800 | return True | 2781 | return True |
2801 | else: | 2782 | else: |
2802 | if not quiet: | 2783 | if not quiet: |
2803 | print( | 2784 | logger.error("Invalid clone.bundle file; ignoring.") |
2804 | "Invalid clone.bundle file; ignoring.", | ||
2805 | file=sys.stderr, | ||
2806 | ) | ||
2807 | return False | 2785 | return False |
2808 | except OSError: | 2786 | except OSError: |
2809 | return False | 2787 | return False |
@@ -2923,9 +2901,8 @@ class Project(object): | |||
2923 | self._CheckDirReference(self.objdir, self.gitdir) | 2901 | self._CheckDirReference(self.objdir, self.gitdir) |
2924 | except GitError as e: | 2902 | except GitError as e: |
2925 | if force_sync: | 2903 | if force_sync: |
2926 | print( | 2904 | logger.error( |
2927 | "Retrying clone after deleting %s" % self.gitdir, | 2905 | "Retrying clone after deleting %s", self.gitdir |
2928 | file=sys.stderr, | ||
2929 | ) | 2906 | ) |
2930 | try: | 2907 | try: |
2931 | platform_utils.rmtree( | 2908 | platform_utils.rmtree( |
@@ -3046,8 +3023,8 @@ class Project(object): | |||
3046 | # hardlink below. | 3023 | # hardlink below. |
3047 | if not filecmp.cmp(stock_hook, dst, shallow=False): | 3024 | if not filecmp.cmp(stock_hook, dst, shallow=False): |
3048 | if not quiet: | 3025 | if not quiet: |
3049 | _warn( | 3026 | logger.warn( |
3050 | "%s: Not replacing locally modified %s hook", | 3027 | "warn: %s: Not replacing locally modified %s hook", |
3051 | self.RelPath(local=False), | 3028 | self.RelPath(local=False), |
3052 | name, | 3029 | name, |
3053 | ) | 3030 | ) |
@@ -3158,7 +3135,12 @@ class Project(object): | |||
3158 | src = platform_utils.realpath(src_path) | 3135 | src = platform_utils.realpath(src_path) |
3159 | # Fail if the links are pointing to the wrong place. | 3136 | # Fail if the links are pointing to the wrong place. |
3160 | if src != dst: | 3137 | if src != dst: |
3161 | _error("%s is different in %s vs %s", name, destdir, srcdir) | 3138 | logger.error( |
3139 | "error: %s is different in %s vs %s", | ||
3140 | name, | ||
3141 | destdir, | ||
3142 | srcdir, | ||
3143 | ) | ||
3162 | raise GitError( | 3144 | raise GitError( |
3163 | "--force-sync not enabled; cannot overwrite a local " | 3145 | "--force-sync not enabled; cannot overwrite a local " |
3164 | "work tree. If you're comfortable with the " | 3146 | "work tree. If you're comfortable with the " |
@@ -4206,7 +4188,7 @@ class ManifestProject(MetaProject): | |||
4206 | "manifest.standalone" | 4188 | "manifest.standalone" |
4207 | ) | 4189 | ) |
4208 | if was_standalone_manifest and not manifest_url: | 4190 | if was_standalone_manifest and not manifest_url: |
4209 | print( | 4191 | logger.error( |
4210 | "fatal: repo was initialized with a standlone manifest, " | 4192 | "fatal: repo was initialized with a standlone manifest, " |
4211 | "cannot be re-initialized without --manifest-url/-u" | 4193 | "cannot be re-initialized without --manifest-url/-u" |
4212 | ) | 4194 | ) |
@@ -4224,7 +4206,7 @@ class ManifestProject(MetaProject): | |||
4224 | is_new = not self.Exists | 4206 | is_new = not self.Exists |
4225 | if is_new: | 4207 | if is_new: |
4226 | if not manifest_url: | 4208 | if not manifest_url: |
4227 | print("fatal: manifest url is required.", file=sys.stderr) | 4209 | logger.error("fatal: manifest url is required.") |
4228 | return False | 4210 | return False |
4229 | 4211 | ||
4230 | if verbose: | 4212 | if verbose: |
@@ -4280,7 +4262,7 @@ class ManifestProject(MetaProject): | |||
4280 | if manifest_branch == "HEAD": | 4262 | if manifest_branch == "HEAD": |
4281 | manifest_branch = self.ResolveRemoteHead() | 4263 | manifest_branch = self.ResolveRemoteHead() |
4282 | if manifest_branch is None: | 4264 | if manifest_branch is None: |
4283 | print("fatal: unable to resolve HEAD", file=sys.stderr) | 4265 | logger.error("fatal: unable to resolve HEAD") |
4284 | return False | 4266 | return False |
4285 | self.revisionExpr = manifest_branch | 4267 | self.revisionExpr = manifest_branch |
4286 | else: | 4268 | else: |
@@ -4305,7 +4287,7 @@ class ManifestProject(MetaProject): | |||
4305 | elif platform in all_platforms: | 4287 | elif platform in all_platforms: |
4306 | groups.append(platformize(platform)) | 4288 | groups.append(platformize(platform)) |
4307 | elif platform != "none": | 4289 | elif platform != "none": |
4308 | print("fatal: invalid platform flag", file=sys.stderr) | 4290 | logger.error("fatal: invalid platform flag", file=sys.stderr) |
4309 | return False | 4291 | return False |
4310 | self.config.SetString("manifest.platform", platform) | 4292 | self.config.SetString("manifest.platform", platform) |
4311 | 4293 | ||
@@ -4326,35 +4308,29 @@ class ManifestProject(MetaProject): | |||
4326 | 4308 | ||
4327 | if worktree: | 4309 | if worktree: |
4328 | if mirror: | 4310 | if mirror: |
4329 | print( | 4311 | logger.error("fatal: --mirror and --worktree are incompatible") |
4330 | "fatal: --mirror and --worktree are incompatible", | ||
4331 | file=sys.stderr, | ||
4332 | ) | ||
4333 | return False | 4312 | return False |
4334 | if submodules: | 4313 | if submodules: |
4335 | print( | 4314 | logger.error( |
4336 | "fatal: --submodules and --worktree are incompatible", | 4315 | "fatal: --submodules and --worktree are incompatible" |
4337 | file=sys.stderr, | ||
4338 | ) | 4316 | ) |
4339 | return False | 4317 | return False |
4340 | self.config.SetBoolean("repo.worktree", worktree) | 4318 | self.config.SetBoolean("repo.worktree", worktree) |
4341 | if is_new: | 4319 | if is_new: |
4342 | self.use_git_worktrees = True | 4320 | self.use_git_worktrees = True |
4343 | print("warning: --worktree is experimental!", file=sys.stderr) | 4321 | logger.warn("warning: --worktree is experimental!") |
4344 | 4322 | ||
4345 | if archive: | 4323 | if archive: |
4346 | if is_new: | 4324 | if is_new: |
4347 | self.config.SetBoolean("repo.archive", archive) | 4325 | self.config.SetBoolean("repo.archive", archive) |
4348 | else: | 4326 | else: |
4349 | print( | 4327 | logger.error( |
4350 | "fatal: --archive is only supported when initializing a " | 4328 | "fatal: --archive is only supported when initializing a " |
4351 | "new workspace.", | 4329 | "new workspace." |
4352 | file=sys.stderr, | ||
4353 | ) | 4330 | ) |
4354 | print( | 4331 | logger.error( |
4355 | "Either delete the .repo folder in this workspace, or " | 4332 | "Either delete the .repo folder in this workspace, or " |
4356 | "initialize in another location.", | 4333 | "initialize in another location." |
4357 | file=sys.stderr, | ||
4358 | ) | 4334 | ) |
4359 | return False | 4335 | return False |
4360 | 4336 | ||
@@ -4362,24 +4338,21 @@ class ManifestProject(MetaProject): | |||
4362 | if is_new: | 4338 | if is_new: |
4363 | self.config.SetBoolean("repo.mirror", mirror) | 4339 | self.config.SetBoolean("repo.mirror", mirror) |
4364 | else: | 4340 | else: |
4365 | print( | 4341 | logger.error( |
4366 | "fatal: --mirror is only supported when initializing a new " | 4342 | "fatal: --mirror is only supported when initializing a new " |
4367 | "workspace.", | 4343 | "workspace." |
4368 | file=sys.stderr, | ||
4369 | ) | 4344 | ) |
4370 | print( | 4345 | logger.error( |
4371 | "Either delete the .repo folder in this workspace, or " | 4346 | "Either delete the .repo folder in this workspace, or " |
4372 | "initialize in another location.", | 4347 | "initialize in another location." |
4373 | file=sys.stderr, | ||
4374 | ) | 4348 | ) |
4375 | return False | 4349 | return False |
4376 | 4350 | ||
4377 | if partial_clone is not None: | 4351 | if partial_clone is not None: |
4378 | if mirror: | 4352 | if mirror: |
4379 | print( | 4353 | logger.error( |
4380 | "fatal: --mirror and --partial-clone are mutually " | 4354 | "fatal: --mirror and --partial-clone are mutually " |
4381 | "exclusive", | 4355 | "exclusive" |
4382 | file=sys.stderr, | ||
4383 | ) | 4356 | ) |
4384 | return False | 4357 | return False |
4385 | self.config.SetBoolean("repo.partialclone", partial_clone) | 4358 | self.config.SetBoolean("repo.partialclone", partial_clone) |
@@ -4409,11 +4382,10 @@ class ManifestProject(MetaProject): | |||
4409 | 4382 | ||
4410 | self.config.SetBoolean("repo.git-lfs", git_lfs) | 4383 | self.config.SetBoolean("repo.git-lfs", git_lfs) |
4411 | if not is_new: | 4384 | if not is_new: |
4412 | print( | 4385 | logger.warn( |
4413 | "warning: Changing --git-lfs settings will only affect new " | 4386 | "warning: Changing --git-lfs settings will only affect new " |
4414 | "project checkouts.\n" | 4387 | "project checkouts.\n" |
4415 | " Existing projects will require manual updates.\n", | 4388 | " Existing projects will require manual updates.\n" |
4416 | file=sys.stderr, | ||
4417 | ) | 4389 | ) |
4418 | 4390 | ||
4419 | if clone_filter_for_depth is not None: | 4391 | if clone_filter_for_depth is not None: |
@@ -4437,9 +4409,7 @@ class ManifestProject(MetaProject): | |||
4437 | ).success | 4409 | ).success |
4438 | if not success: | 4410 | if not success: |
4439 | r = self.GetRemote() | 4411 | r = self.GetRemote() |
4440 | print( | 4412 | logger.error("fatal: cannot obtain manifest %s", r.url) |
4441 | "fatal: cannot obtain manifest %s" % r.url, file=sys.stderr | ||
4442 | ) | ||
4443 | 4413 | ||
4444 | # Better delete the manifest git dir if we created it; otherwise | 4414 | # Better delete the manifest git dir if we created it; otherwise |
4445 | # next time (when user fixes problems) we won't go through the | 4415 | # next time (when user fixes problems) we won't go through the |
@@ -4460,14 +4430,13 @@ class ManifestProject(MetaProject): | |||
4460 | self.StartBranch("default") | 4430 | self.StartBranch("default") |
4461 | except GitError as e: | 4431 | except GitError as e: |
4462 | msg = str(e) | 4432 | msg = str(e) |
4463 | print( | 4433 | logger.error( |
4464 | f"fatal: cannot create default in manifest {msg}", | 4434 | "fatal: cannot create default in manifest %s", msg |
4465 | file=sys.stderr, | ||
4466 | ) | 4435 | ) |
4467 | return False | 4436 | return False |
4468 | 4437 | ||
4469 | if not manifest_name: | 4438 | if not manifest_name: |
4470 | print("fatal: manifest name (-m) is required.", file=sys.stderr) | 4439 | logger.error("fatal: manifest name (-m) is required.") |
4471 | return False | 4440 | return False |
4472 | 4441 | ||
4473 | elif is_new: | 4442 | elif is_new: |
@@ -4482,11 +4451,8 @@ class ManifestProject(MetaProject): | |||
4482 | try: | 4451 | try: |
4483 | self.manifest.Link(manifest_name) | 4452 | self.manifest.Link(manifest_name) |
4484 | except ManifestParseError as e: | 4453 | except ManifestParseError as e: |
4485 | print( | 4454 | logger.error("fatal: manifest '%s' not available", manifest_name) |
4486 | "fatal: manifest '%s' not available" % manifest_name, | 4455 | logger.error("fatal: %s", e) |
4487 | file=sys.stderr, | ||
4488 | ) | ||
4489 | print("fatal: %s" % str(e), file=sys.stderr) | ||
4490 | return False | 4456 | return False |
4491 | 4457 | ||
4492 | if not this_manifest_only: | 4458 | if not this_manifest_only: |
@@ -4528,13 +4494,13 @@ class ManifestProject(MetaProject): | |||
4528 | submanifest = "" | 4494 | submanifest = "" |
4529 | if self.manifest.path_prefix: | 4495 | if self.manifest.path_prefix: |
4530 | submanifest = f"for {self.manifest.path_prefix} " | 4496 | submanifest = f"for {self.manifest.path_prefix} " |
4531 | print( | 4497 | logger.warn( |
4532 | f"warning: git update of superproject {submanifest}failed, " | 4498 | "warning: git update of superproject %s failed, " |
4533 | "repo sync will not use superproject to fetch source; " | 4499 | "repo sync will not use superproject to fetch source; " |
4534 | "while this error is not fatal, and you can continue to " | 4500 | "while this error is not fatal, and you can continue to " |
4535 | "run repo sync, please run repo init with the " | 4501 | "run repo sync, please run repo init with the " |
4536 | "--no-use-superproject option to stop seeing this warning", | 4502 | "--no-use-superproject option to stop seeing this warning", |
4537 | file=sys.stderr, | 4503 | submanifest, |
4538 | ) | 4504 | ) |
4539 | if sync_result.fatal and use_superproject is not None: | 4505 | if sync_result.fatal and use_superproject is not None: |
4540 | return False | 4506 | return False |