summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--command.py7
-rwxr-xr-xmain.py9
-rw-r--r--subcmds/gitc_init.py4
-rw-r--r--subcmds/help.py8
4 files changed, 21 insertions, 7 deletions
diff --git a/command.py b/command.py
index 997acec0..cd5e3c3e 100644
--- a/command.py
+++ b/command.py
@@ -231,7 +231,12 @@ class MirrorSafeCommand(object):
231 and does not require a working directory. 231 and does not require a working directory.
232 """ 232 """
233 233
234class RequiresGitcCommand(object): 234class GitcAvailableCommand(object):
235 """Command that requires GITC to be available, but does 235 """Command that requires GITC to be available, but does
236 not require the local client to be a GITC client. 236 not require the local client to be a GITC client.
237 """ 237 """
238
239class GitcClientCommand(object):
240 """Command that requires the local client to be a GITC
241 client.
242 """
diff --git a/main.py b/main.py
index a5979a87..4f4eb9fc 100755
--- a/main.py
+++ b/main.py
@@ -42,7 +42,7 @@ from git_command import git, GitCommand
42from git_config import init_ssh, close_ssh 42from git_config import init_ssh, close_ssh
43from command import InteractiveCommand 43from command import InteractiveCommand
44from command import MirrorSafeCommand 44from command import MirrorSafeCommand
45from command import RequiresGitcCommand 45from command import GitcAvailableCommand, GitcClientCommand
46from subcmds.version import Version 46from subcmds.version import Version
47from editor import Editor 47from editor import Editor
48from error import DownloadError 48from error import DownloadError
@@ -144,11 +144,16 @@ class _Repo(object):
144 file=sys.stderr) 144 file=sys.stderr)
145 return 1 145 return 1
146 146
147 if isinstance(cmd, RequiresGitcCommand) and not gitc_utils.get_gitc_manifest_dir(): 147 if isinstance(cmd, GitcAvailableCommand) and not gitc_utils.get_gitc_manifest_dir():
148 print("fatal: '%s' requires GITC to be available" % name, 148 print("fatal: '%s' requires GITC to be available" % name,
149 file=sys.stderr) 149 file=sys.stderr)
150 return 1 150 return 1
151 151
152 if isinstance(cmd, GitcClientCommand) and not gitc_client_name:
153 print("fatal: '%s' requires a GITC client" % name,
154 file=sys.stderr)
155 return 1
156
152 try: 157 try:
153 copts, cargs = cmd.OptionParser.parse_args(argv) 158 copts, cargs = cmd.OptionParser.parse_args(argv)
154 copts = cmd.ReadEnvironmentOptions(copts) 159 copts = cmd.ReadEnvironmentOptions(copts)
diff --git a/subcmds/gitc_init.py b/subcmds/gitc_init.py
index c243bb3b..4f9d7344 100644
--- a/subcmds/gitc_init.py
+++ b/subcmds/gitc_init.py
@@ -18,12 +18,12 @@ import os
18import sys 18import sys
19 19
20import gitc_utils 20import gitc_utils
21from command import RequiresGitcCommand 21from command import GitcAvailableCommand
22from manifest_xml import GitcManifest 22from manifest_xml import GitcManifest
23from subcmds import init 23from subcmds import init
24 24
25 25
26class GitcInit(init.Init, RequiresGitcCommand): 26class GitcInit(init.Init, GitcAvailableCommand):
27 common = True 27 common = True
28 helpSummary = "Initialize a GITC Client." 28 helpSummary = "Initialize a GITC Client."
29 helpUsage = """ 29 helpUsage = """
diff --git a/subcmds/help.py b/subcmds/help.py
index ae5b8f08..9bb4c8c7 100644
--- a/subcmds/help.py
+++ b/subcmds/help.py
@@ -19,7 +19,7 @@ import sys
19from formatter import AbstractFormatter, DumbWriter 19from formatter import AbstractFormatter, DumbWriter
20 20
21from color import Coloring 21from color import Coloring
22from command import PagedCommand, MirrorSafeCommand, RequiresGitcCommand 22from command import PagedCommand, MirrorSafeCommand, GitcAvailableCommand, GitcClientCommand
23import gitc_utils 23import gitc_utils
24 24
25class Help(PagedCommand, MirrorSafeCommand): 25class Help(PagedCommand, MirrorSafeCommand):
@@ -57,8 +57,12 @@ Displays detailed usage information about a command.
57 print('The most commonly used repo commands are:') 57 print('The most commonly used repo commands are:')
58 58
59 def gitc_supported(cmd): 59 def gitc_supported(cmd):
60 if not isinstance(cmd, RequiresGitcCommand): 60 if not isinstance(cmd, GitcAvailableCommand) and not isinstance(cmd, GitcClientCommand):
61 return True 61 return True
62 if self.manifest.isGitcClient:
63 return True
64 if isinstance(cmd, GitcClientCommand):
65 return False
62 if gitc_utils.get_gitc_manifest_dir(): 66 if gitc_utils.get_gitc_manifest_dir():
63 return True 67 return True
64 return False 68 return False