summaryrefslogtreecommitdiffstats
path: root/subcmds/gitc_init.py
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds/gitc_init.py')
-rw-r--r--subcmds/gitc_init.py19
1 files changed, 5 insertions, 14 deletions
diff --git a/subcmds/gitc_init.py b/subcmds/gitc_init.py
index 378f9236..e705b613 100644
--- a/subcmds/gitc_init.py
+++ b/subcmds/gitc_init.py
@@ -1,5 +1,3 @@
1# -*- coding:utf-8 -*-
2#
3# Copyright (C) 2015 The Android Open Source Project 1# Copyright (C) 2015 The Android Open Source Project
4# 2#
5# Licensed under the Apache License, Version 2.0 (the "License"); 3# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,7 +12,6 @@
14# See the License for the specific language governing permissions and 12# See the License for the specific language governing permissions and
15# limitations under the License. 13# limitations under the License.
16 14
17from __future__ import print_function
18import os 15import os
19import sys 16import sys
20 17
@@ -26,7 +23,7 @@ import wrapper
26 23
27 24
28class GitcInit(init.Init, GitcAvailableCommand): 25class GitcInit(init.Init, GitcAvailableCommand):
29 common = True 26 COMMON = True
30 helpSummary = "Initialize a GITC Client." 27 helpSummary = "Initialize a GITC Client."
31 helpUsage = """ 28 helpUsage = """
32%prog [options] [client name] 29%prog [options] [client name]
@@ -50,23 +47,17 @@ use for this GITC client.
50""" 47"""
51 48
52 def _Options(self, p): 49 def _Options(self, p):
53 super(GitcInit, self)._Options(p, gitc_init=True) 50 super()._Options(p, gitc_init=True)
54 g = p.add_option_group('GITC options')
55 g.add_option('-f', '--manifest-file',
56 dest='manifest_file',
57 help='Optional manifest file to use for this GITC client.')
58 g.add_option('-c', '--gitc-client',
59 dest='gitc_client',
60 help='The name of the gitc_client instance to create or modify.')
61 51
62 def Execute(self, opt, args): 52 def Execute(self, opt, args):
63 gitc_client = gitc_utils.parse_clientdir(os.getcwd()) 53 gitc_client = gitc_utils.parse_clientdir(os.getcwd())
64 if not gitc_client or (opt.gitc_client and gitc_client != opt.gitc_client): 54 if not gitc_client or (opt.gitc_client and gitc_client != opt.gitc_client):
65 print('fatal: Please update your repo command. See go/gitc for instructions.', file=sys.stderr) 55 print('fatal: Please update your repo command. See go/gitc for instructions.',
56 file=sys.stderr)
66 sys.exit(1) 57 sys.exit(1)
67 self.client_dir = os.path.join(gitc_utils.get_gitc_manifest_dir(), 58 self.client_dir = os.path.join(gitc_utils.get_gitc_manifest_dir(),
68 gitc_client) 59 gitc_client)
69 super(GitcInit, self).Execute(opt, args) 60 super().Execute(opt, args)
70 61
71 manifest_file = self.manifest.manifestFile 62 manifest_file = self.manifest.manifestFile
72 if opt.manifest_file: 63 if opt.manifest_file: