diff options
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 | ) | ||