From c95583bf4f17b8467f815b6391ffc6c7add08804 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 3 Mar 2009 17:47:06 -0800 Subject: Don't permit users to run repo status in a mirror client If a client was created with "repo init --mirror" then there are no working directories present, and no files checked out. Using a command like "repo status" in this context makes no sense, and actually throws back a Pytyon traceback at the console when the underlying commands fail out. We now tag commands with the MirrorSafeCommand type if they are able to be executed within a mirror directory safely. Using a command in a mirror which lacks this base class results in a useful error letting you know the command isn't supported. Bug: REPO-14 Signed-off-by: Shawn O. Pearce --- subcmds/init.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'subcmds/init.py') diff --git a/subcmds/init.py b/subcmds/init.py index ad28a611..d1fb4316 100644 --- a/subcmds/init.py +++ b/subcmds/init.py @@ -17,12 +17,12 @@ import os import sys from color import Coloring -from command import InteractiveCommand +from command import InteractiveCommand, MirrorSafeCommand from error import ManifestParseError from remote import Remote from git_command import git, MIN_GIT_VERSION -class Init(InteractiveCommand): +class Init(InteractiveCommand, MirrorSafeCommand): common = True helpSummary = "Initialize repo in the current directory" helpUsage = """ -- cgit v1.2.3-54-g00ecf