From 4cef373d985e707f06b9454bcfbb621ef5dee80f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 5 Nov 2026 21:48:00 -0500 Subject: [PATCH] style: use `import manifest_xml` everywhere Align with Google style guides and `import manifest_xml` as a module rather than import symbols out of it. Change-Id: Ib600a5ccaf53b178e27e6e9d56847751d266bfe4 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/654812 Tested-by: Mike Frysinger Commit-Queue: Mike Frysinger Reviewed-by: Brian Gan --- main.py | 6 +++--- subcmds/diffmanifests.py | 6 +++--- subcmds/sync.py | 14 +++++++------- tests/test_main.py | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/main.py b/main.py index d85d6fbcb..1e705e26b 100755 --- a/main.py +++ b/main.py @@ -50,7 +50,7 @@ import event_log import git_command import git_config from git_trace2_event_log import EventLog -from manifest_xml import RepoClient +import manifest_xml import pager import repo_trace from subcmds import all_commands @@ -389,10 +389,10 @@ class _Repo: result = 0 color.SetDefaultColoring(gopts.color) - outer_client = RepoClient(self.repodir) + outer_client = manifest_xml.RepoClient(self.repodir) repo_client = outer_client if gopts.submanifest_path: - repo_client = RepoClient( + repo_client = manifest_xml.RepoClient( self.repodir, submanifest_path=gopts.submanifest_path, outer_client=outer_client, diff --git a/subcmds/diffmanifests.py b/subcmds/diffmanifests.py index 5f27d2db9..189c1697c 100644 --- a/subcmds/diffmanifests.py +++ b/subcmds/diffmanifests.py @@ -14,7 +14,7 @@ import color from command import PagedCommand -from manifest_xml import RepoClient +import manifest_xml class _Coloring(color.Coloring): @@ -238,12 +238,12 @@ synced and their revisions won't be found. self.printRevision ) = self.printText - manifest1 = RepoClient(self.repodir) + manifest1 = manifest_xml.RepoClient(self.repodir) manifest1.Override(args[0], load_local_manifests=False) if len(args) == 1: manifest2 = self.manifest else: - manifest2 = RepoClient(self.repodir) + manifest2 = manifest_xml.RepoClient(self.repodir) manifest2.Override(args[1], load_local_manifests=False) diff = manifest1.projectsDiff(manifest2) diff --git a/subcmds/sync.py b/subcmds/sync.py index acef8ea6c..e04351141 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py @@ -64,7 +64,7 @@ import git_config import git_refs import git_superproject from hooks import RepoHook -from manifest_xml import XmlManifest +import manifest_xml import platform_utils from progress import elapsed_str from progress import jobs_str @@ -887,7 +887,7 @@ later is required to fix a server side protocol bug. ) def _GetSuperprojectRevision( - self, opt: optparse.Values, manifest: XmlManifest + self, opt: optparse.Values, manifest: manifest_xml.XmlManifest ) -> Optional[str]: """Returns the --superproject-revision to apply to manifest. @@ -906,7 +906,7 @@ later is required to fix a server side protocol bug. return None def _ConfigureSuperproject( - self, opt: optparse.Values, manifest: XmlManifest + self, opt: optparse.Values, manifest: manifest_xml.XmlManifest ) -> bool: """Configure superproject with options. @@ -2156,7 +2156,7 @@ later is required to fix a server side protocol bug. self, opt: optparse.Values, smart_sync_manifest_path: str, - manifest: XmlManifest, + manifest: manifest_xml.XmlManifest, best_effort: bool = False, ) -> str: if not manifest.manifest_server: @@ -2474,7 +2474,7 @@ later is required to fix a server side protocol bug. def _SyncToSuperprojectRev( self, opt: optparse.Values, - manifest: XmlManifest, + manifest: manifest_xml.XmlManifest, mp: Project, manifest_name: Optional[str], errors: List[Exception], @@ -2520,7 +2520,7 @@ later is required to fix a server side protocol bug. ) def _ResolveSmartSyncOption( - self, opt: optparse.Values, manifest: XmlManifest + self, opt: optparse.Values, manifest: manifest_xml.XmlManifest ) -> bool: """Resolve opt.smart_sync from CLI flags, config, and manifest. @@ -2773,7 +2773,7 @@ later is required to fix a server side protocol bug. self, opt: optparse.Values, args: List[str], - manifest: XmlManifest, + manifest: manifest_xml.XmlManifest, all_projects: List[Project], ) -> None: """Fail when repo.reprojectcmd is used on a manifest nesting projects. diff --git a/tests/test_main.py b/tests/test_main.py index 6229f6bb7..c26ab9484 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -181,7 +181,7 @@ def test_event_log_disabled_skips_add_and_git_hash() -> None: project.GetCommitRevisionId.assert_not_called() -@mock.patch("main.RepoClient") +@mock.patch("manifest_xml.RepoClient") def test_run_long_gates_event_log_on_flag( mock_client_cls: mock.MagicMock, tmp_path: Path ) -> None: