From ea2e330e43c182dc16b0111ebc69ee5a71ee4ce1 Mon Sep 17 00:00:00 2001 From: Gavin Mak Date: Sat, 11 Mar 2023 06:46:20 +0000 Subject: Format codebase with black and check formatting in CQ Apply rules set by https://gerrit-review.googlesource.com/c/git-repo/+/362954/ across the codebase and fix any lingering errors caught by flake8. Also check black formatting in run_tests (and CQ). Bug: b/267675342 Change-Id: I972d77649dac351150dcfeb1cd1ad0ea2efc1956 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/363474 Reviewed-by: Mike Frysinger Tested-by: Gavin Mak Commit-Queue: Gavin Mak --- subcmds/gitc_init.py | 69 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 29 deletions(-) (limited to 'subcmds/gitc_init.py') diff --git a/subcmds/gitc_init.py b/subcmds/gitc_init.py index e3a5813d..54791d58 100644 --- a/subcmds/gitc_init.py +++ b/subcmds/gitc_init.py @@ -23,13 +23,13 @@ import wrapper class GitcInit(init.Init, GitcAvailableCommand): - COMMON = True - MULTI_MANIFEST_SUPPORT = False - helpSummary = "Initialize a GITC Client." - helpUsage = """ + COMMON = True + MULTI_MANIFEST_SUPPORT = False + helpSummary = "Initialize a GITC Client." + helpUsage = """ %prog [options] [client name] """ - helpDescription = """ + helpDescription = """ The '%prog' command is ran to initialize a new GITC client for use with the GITC file system. @@ -47,30 +47,41 @@ The optional -f argument can be used to specify the manifest file to use for this GITC client. """ - def _Options(self, p): - super()._Options(p, gitc_init=True) + def _Options(self, p): + super()._Options(p, gitc_init=True) - def Execute(self, opt, args): - gitc_client = gitc_utils.parse_clientdir(os.getcwd()) - if not gitc_client or (opt.gitc_client and gitc_client != opt.gitc_client): - print('fatal: Please update your repo command. See go/gitc for instructions.', - file=sys.stderr) - sys.exit(1) - self.client_dir = os.path.join(gitc_utils.get_gitc_manifest_dir(), - gitc_client) - super().Execute(opt, args) + def Execute(self, opt, args): + gitc_client = gitc_utils.parse_clientdir(os.getcwd()) + if not gitc_client or ( + opt.gitc_client and gitc_client != opt.gitc_client + ): + print( + "fatal: Please update your repo command. See go/gitc for " + "instructions.", + file=sys.stderr, + ) + sys.exit(1) + self.client_dir = os.path.join( + gitc_utils.get_gitc_manifest_dir(), gitc_client + ) + super().Execute(opt, args) - manifest_file = self.manifest.manifestFile - if opt.manifest_file: - if not os.path.exists(opt.manifest_file): - print('fatal: Specified manifest file %s does not exist.' % - opt.manifest_file) - sys.exit(1) - manifest_file = opt.manifest_file + manifest_file = self.manifest.manifestFile + if opt.manifest_file: + if not os.path.exists(opt.manifest_file): + print( + "fatal: Specified manifest file %s does not exist." + % opt.manifest_file + ) + sys.exit(1) + manifest_file = opt.manifest_file - manifest = GitcManifest(self.repodir, os.path.join(self.client_dir, - '.manifest')) - manifest.Override(manifest_file) - gitc_utils.generate_gitc_manifest(None, manifest) - print('Please run `cd %s` to view your GITC client.' % - os.path.join(wrapper.Wrapper().GITC_FS_ROOT_DIR, gitc_client)) + manifest = GitcManifest( + self.repodir, os.path.join(self.client_dir, ".manifest") + ) + manifest.Override(manifest_file) + gitc_utils.generate_gitc_manifest(None, manifest) + print( + "Please run `cd %s` to view your GITC client." + % os.path.join(wrapper.Wrapper().GITC_FS_ROOT_DIR, gitc_client) + ) -- cgit v1.2.3-54-g00ecf