diff options
author | Gavin Mak <gavinmak@google.com> | 2023-03-11 06:46:20 +0000 |
---|---|---|
committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-03-22 17:46:28 +0000 |
commit | ea2e330e43c182dc16b0111ebc69ee5a71ee4ce1 (patch) | |
tree | dc33ba0e56825b3e007d0589891756724725a465 /subcmds/gitc_init.py | |
parent | 1604cf255f8c1786a23388db6d5277ac7949a24a (diff) | |
download | git-repo-ea2e330e43c182dc16b0111ebc69ee5a71ee4ce1.tar.gz |
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 <vapier@google.com>
Tested-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Diffstat (limited to 'subcmds/gitc_init.py')
-rw-r--r-- | subcmds/gitc_init.py | 69 |
1 files changed, 40 insertions, 29 deletions
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 | |||
23 | 23 | ||
24 | 24 | ||
25 | class GitcInit(init.Init, GitcAvailableCommand): | 25 | class GitcInit(init.Init, GitcAvailableCommand): |
26 | COMMON = True | 26 | COMMON = True |
27 | MULTI_MANIFEST_SUPPORT = False | 27 | MULTI_MANIFEST_SUPPORT = False |
28 | helpSummary = "Initialize a GITC Client." | 28 | helpSummary = "Initialize a GITC Client." |
29 | helpUsage = """ | 29 | helpUsage = """ |
30 | %prog [options] [client name] | 30 | %prog [options] [client name] |
31 | """ | 31 | """ |
32 | helpDescription = """ | 32 | helpDescription = """ |
33 | The '%prog' command is ran to initialize a new GITC client for use | 33 | The '%prog' command is ran to initialize a new GITC client for use |
34 | with the GITC file system. | 34 | with the GITC file system. |
35 | 35 | ||
@@ -47,30 +47,41 @@ The optional -f argument can be used to specify the manifest file to | |||
47 | use for this GITC client. | 47 | use for this GITC client. |
48 | """ | 48 | """ |
49 | 49 | ||
50 | def _Options(self, p): | 50 | def _Options(self, p): |
51 | super()._Options(p, gitc_init=True) | 51 | super()._Options(p, gitc_init=True) |
52 | 52 | ||
53 | def Execute(self, opt, args): | 53 | def Execute(self, opt, args): |
54 | gitc_client = gitc_utils.parse_clientdir(os.getcwd()) | 54 | gitc_client = gitc_utils.parse_clientdir(os.getcwd()) |
55 | if not gitc_client or (opt.gitc_client and gitc_client != opt.gitc_client): | 55 | if not gitc_client or ( |
56 | print('fatal: Please update your repo command. See go/gitc for instructions.', | 56 | opt.gitc_client and gitc_client != opt.gitc_client |
57 | file=sys.stderr) | 57 | ): |
58 | sys.exit(1) | 58 | print( |
59 | self.client_dir = os.path.join(gitc_utils.get_gitc_manifest_dir(), | 59 | "fatal: Please update your repo command. See go/gitc for " |
60 | gitc_client) | 60 | "instructions.", |
61 | super().Execute(opt, args) | 61 | file=sys.stderr, |
62 | ) | ||
63 | sys.exit(1) | ||
64 | self.client_dir = os.path.join( | ||
65 | gitc_utils.get_gitc_manifest_dir(), gitc_client | ||
66 | ) | ||
67 | super().Execute(opt, args) | ||
62 | 68 | ||
63 | manifest_file = self.manifest.manifestFile | 69 | manifest_file = self.manifest.manifestFile |
64 | if opt.manifest_file: | 70 | if opt.manifest_file: |
65 | if not os.path.exists(opt.manifest_file): | 71 | if not os.path.exists(opt.manifest_file): |
66 | print('fatal: Specified manifest file %s does not exist.' % | 72 | print( |
67 | opt.manifest_file) | 73 | "fatal: Specified manifest file %s does not exist." |
68 | sys.exit(1) | 74 | % opt.manifest_file |
69 | manifest_file = opt.manifest_file | 75 | ) |
76 | sys.exit(1) | ||
77 | manifest_file = opt.manifest_file | ||
70 | 78 | ||
71 | manifest = GitcManifest(self.repodir, os.path.join(self.client_dir, | 79 | manifest = GitcManifest( |
72 | '.manifest')) | 80 | self.repodir, os.path.join(self.client_dir, ".manifest") |
73 | manifest.Override(manifest_file) | 81 | ) |
74 | gitc_utils.generate_gitc_manifest(None, manifest) | 82 | manifest.Override(manifest_file) |
75 | print('Please run `cd %s` to view your GITC client.' % | 83 | gitc_utils.generate_gitc_manifest(None, manifest) |
76 | os.path.join(wrapper.Wrapper().GITC_FS_ROOT_DIR, gitc_client)) | 84 | print( |
85 | "Please run `cd %s` to view your GITC client." | ||
86 | % os.path.join(wrapper.Wrapper().GITC_FS_ROOT_DIR, gitc_client) | ||
87 | ) | ||