diff options
author | Shawn O. Pearce <sop@google.com> | 2009-03-03 17:47:06 -0800 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2009-03-03 17:47:06 -0800 |
commit | c95583bf4f17b8467f815b6391ffc6c7add08804 (patch) | |
tree | c69bf8a061279b79326fb00f2197efcd8726864c /subcmds/init.py | |
parent | 6a5644d392069b67f17c8ce6cb10f07cce71cc1c (diff) | |
download | git-repo-c95583bf4f17b8467f815b6391ffc6c7add08804.tar.gz |
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>
Diffstat (limited to 'subcmds/init.py')
-rw-r--r-- | subcmds/init.py | 4 |
1 files changed, 2 insertions, 2 deletions
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 | |||
17 | import sys | 17 | import sys |
18 | 18 | ||
19 | from color import Coloring | 19 | from color import Coloring |
20 | from command import InteractiveCommand | 20 | from command import InteractiveCommand, MirrorSafeCommand |
21 | from error import ManifestParseError | 21 | from error import ManifestParseError |
22 | from remote import Remote | 22 | from remote import Remote |
23 | from git_command import git, MIN_GIT_VERSION | 23 | from git_command import git, MIN_GIT_VERSION |
24 | 24 | ||
25 | class Init(InteractiveCommand): | 25 | class Init(InteractiveCommand, MirrorSafeCommand): |
26 | common = True | 26 | common = True |
27 | helpSummary = "Initialize repo in the current directory" | 27 | helpSummary = "Initialize repo in the current directory" |
28 | helpUsage = """ | 28 | helpUsage = """ |