diff options
Diffstat (limited to 'subcmds/gitc_init.py')
-rw-r--r-- | subcmds/gitc_init.py | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/subcmds/gitc_init.py b/subcmds/gitc_init.py deleted file mode 100644 index 54791d58..00000000 --- a/subcmds/gitc_init.py +++ /dev/null | |||
@@ -1,87 +0,0 @@ | |||
1 | # Copyright (C) 2015 The Android Open Source Project | ||
2 | # | ||
3 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | # you may not use this file except in compliance with the License. | ||
5 | # You may obtain a copy of the License at | ||
6 | # | ||
7 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | # | ||
9 | # Unless required by applicable law or agreed to in writing, software | ||
10 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | # See the License for the specific language governing permissions and | ||
13 | # limitations under the License. | ||
14 | |||
15 | import os | ||
16 | import sys | ||
17 | |||
18 | import gitc_utils | ||
19 | from command import GitcAvailableCommand | ||
20 | from manifest_xml import GitcManifest | ||
21 | from subcmds import init | ||
22 | import wrapper | ||
23 | |||
24 | |||
25 | class GitcInit(init.Init, GitcAvailableCommand): | ||
26 | COMMON = True | ||
27 | MULTI_MANIFEST_SUPPORT = False | ||
28 | helpSummary = "Initialize a GITC Client." | ||
29 | helpUsage = """ | ||
30 | %prog [options] [client name] | ||
31 | """ | ||
32 | helpDescription = """ | ||
33 | The '%prog' command is ran to initialize a new GITC client for use | ||
34 | with the GITC file system. | ||
35 | |||
36 | This command will setup the client directory, initialize repo, just | ||
37 | like repo init does, and then downloads the manifest collection | ||
38 | and installs it in the .repo/directory of the GITC client. | ||
39 | |||
40 | Once this is done, a GITC manifest is generated by pulling the HEAD | ||
41 | SHA for each project and generates the properly formatted XML file | ||
42 | and installs it as .manifest in the GITC client directory. | ||
43 | |||
44 | The -c argument is required to specify the GITC client name. | ||
45 | |||
46 | The optional -f argument can be used to specify the manifest file to | ||
47 | use for this GITC client. | ||
48 | """ | ||
49 | |||
50 | def _Options(self, p): | ||
51 | super()._Options(p, gitc_init=True) | ||
52 | |||
53 | def Execute(self, opt, args): | ||
54 | gitc_client = gitc_utils.parse_clientdir(os.getcwd()) | ||
55 | if not gitc_client or ( | ||
56 | opt.gitc_client and gitc_client != opt.gitc_client | ||
57 | ): | ||
58 | print( | ||
59 | "fatal: Please update your repo command. See go/gitc for " | ||
60 | "instructions.", | ||
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) | ||
68 | |||
69 | manifest_file = self.manifest.manifestFile | ||
70 | if opt.manifest_file: | ||
71 | if not os.path.exists(opt.manifest_file): | ||
72 | print( | ||
73 | "fatal: Specified manifest file %s does not exist." | ||
74 | % opt.manifest_file | ||
75 | ) | ||
76 | sys.exit(1) | ||
77 | manifest_file = opt.manifest_file | ||
78 | |||
79 | manifest = GitcManifest( | ||
80 | self.repodir, os.path.join(self.client_dir, ".manifest") | ||
81 | ) | ||
82 | manifest.Override(manifest_file) | ||
83 | gitc_utils.generate_gitc_manifest(None, manifest) | ||
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 | ) | ||