Don't log spam `repo sync` by default

Most times a repo sync after some time (week+) results in a bunch of
messages, which are not very useful for average user:
- discarding 1 commits
- Deleting obsolete checkout.

Bug: N/A
Test: repo sync
Change-Id: I881eab61f9f261e98f3656c09e73ddd159ce288c
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/397038
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Tested-by: Tomasz Wasilczyk <twasilczyk@google.com>
diff --git a/project.py b/project.py
index 069cc71..d887a55 100644
--- a/project.py
+++ b/project.py
@@ -1467,7 +1467,12 @@
         self.revisionId = revisionId
 
     def Sync_LocalHalf(
-        self, syncbuf, force_sync=False, submodules=False, errors=None
+        self,
+        syncbuf,
+        force_sync=False,
+        submodules=False,
+        errors=None,
+        verbose=False,
     ):
         """Perform only the local IO portion of the sync process.
 
@@ -1548,7 +1553,7 @@
                     return
             else:
                 lost = self._revlist(not_rev(revid), HEAD)
-                if lost:
+                if lost and verbose:
                     syncbuf.info(self, "discarding %d commits", len(lost))
 
             try:
@@ -1738,7 +1743,7 @@
             self.bare_git.rev_parse("FETCH_HEAD"),
         )
 
-    def DeleteWorktree(self, quiet=False, force=False):
+    def DeleteWorktree(self, verbose=False, force=False):
         """Delete the source checkout and any other housekeeping tasks.
 
         This currently leaves behind the internal .repo/ cache state.  This
@@ -1747,7 +1752,7 @@
         at some point.
 
         Args:
-            quiet: Whether to hide normal messages.
+            verbose: Whether to show verbose messages.
             force: Always delete tree even if dirty.
 
         Returns:
@@ -1768,7 +1773,7 @@
                 logger.error(msg)
                 raise DeleteDirtyWorktreeError(msg, project=self)
 
-        if not quiet:
+        if verbose:
             print(f"{self.RelPath(local=False)}: Deleting obsolete checkout.")
 
         # Unlock and delink from the main worktree.  We don't use git's worktree
@@ -3900,13 +3905,13 @@
 class ManifestProject(MetaProject):
     """The MetaProject for manifests."""
 
-    def MetaBranchSwitch(self, submodules=False):
+    def MetaBranchSwitch(self, submodules=False, verbose=False):
         """Prepare for manifest branch switch."""
 
         # detach and delete manifest branch, allowing a new
         # branch to take over
         syncbuf = SyncBuffer(self.config, detach_head=True)
-        self.Sync_LocalHalf(syncbuf, submodules=submodules)
+        self.Sync_LocalHalf(syncbuf, submodules=submodules, verbose=verbose)
         syncbuf.Finish()
 
         return (
@@ -4437,10 +4442,10 @@
                 return False
 
             if manifest_branch:
-                self.MetaBranchSwitch(submodules=submodules)
+                self.MetaBranchSwitch(submodules=submodules, verbose=verbose)
 
             syncbuf = SyncBuffer(self.config)
-            self.Sync_LocalHalf(syncbuf, submodules=submodules)
+            self.Sync_LocalHalf(syncbuf, submodules=submodules, verbose=verbose)
             syncbuf.Finish()
 
             if is_new or self.CurrentBranch is None:
diff --git a/subcmds/sync.py b/subcmds/sync.py
index b723662..ac6a451 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -956,12 +956,13 @@
 
         return _FetchMainResult(all_projects)
 
-    def _CheckoutOne(self, detach_head, force_sync, project):
+    def _CheckoutOne(self, detach_head, force_sync, verbose, project):
         """Checkout work tree for one project
 
         Args:
             detach_head: Whether to leave a detached HEAD.
             force_sync: Force checking out of the repo.
+            verbose: Whether to show verbose messages.
             project: Project object for the project to checkout.
 
         Returns:
@@ -975,7 +976,7 @@
         errors = []
         try:
             project.Sync_LocalHalf(
-                syncbuf, force_sync=force_sync, errors=errors
+                syncbuf, force_sync=force_sync, errors=errors, verbose=verbose
             )
             success = syncbuf.Finish()
         except GitError as e:
@@ -1042,7 +1043,7 @@
         proc_res = self.ExecuteInParallel(
             opt.jobs_checkout,
             functools.partial(
-                self._CheckoutOne, opt.detach_head, opt.force_sync
+                self._CheckoutOne, opt.detach_head, opt.force_sync, opt.verbose
             ),
             all_projects,
             callback=_ProcessResults,
@@ -1288,7 +1289,7 @@
                             groups=None,
                         )
                         project.DeleteWorktree(
-                            quiet=opt.quiet, force=opt.force_remove_dirty
+                            verbose=opt.verbose, force=opt.force_remove_dirty
                         )
 
         new_project_paths.sort()
@@ -1533,7 +1534,10 @@
             syncbuf = SyncBuffer(mp.config)
             start = time.time()
             mp.Sync_LocalHalf(
-                syncbuf, submodules=mp.manifest.HasSubmodules, errors=errors
+                syncbuf,
+                submodules=mp.manifest.HasSubmodules,
+                errors=errors,
+                verbose=opt.verbose,
             )
             clean = syncbuf.Finish()
             self.event_log.AddSync(