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 <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-03-03 17:47:06 -08:00
parent 6a5644d392
commit c95583bf4f
6 changed files with 22 additions and 9 deletions

View File

@@ -19,11 +19,11 @@ import subprocess
import sys
from git_command import GIT
from command import Command
from command import Command, MirrorSafeCommand
from error import RepoChangedException, GitError
from project import R_HEADS
class Sync(Command):
class Sync(Command, MirrorSafeCommand):
common = True
helpSummary = "Update working tree to the latest revision"
helpUsage = """