summaryrefslogtreecommitdiffstats
path: root/main.py
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-03-02 18:24:23 -0800
committerShawn O. Pearce <sop@google.com>2009-03-02 18:24:23 -0800
commit47c1a63a07ebd67efac00ca9e0d877633aea5881 (patch)
tree1d52cf3c114a4389a0ec79102604aa8ca6afdde7 /main.py
parent559b846b17a5b720c1247d07e292150466f27f96 (diff)
downloadgit-repo-47c1a63a07ebd67efac00ca9e0d877633aea5881.tar.gz
Add 'repo version' to describe what code we are running
I meant to have this in here, so clients can more easily report what version of repo they are running. Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'main.py')
-rwxr-xr-xmain.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/main.py b/main.py
index f8fcfe2d..db4fa0fb 100755
--- a/main.py
+++ b/main.py
@@ -46,6 +46,9 @@ global_options.add_option('-p', '--paginate',
46global_options.add_option('--no-pager', 46global_options.add_option('--no-pager',
47 dest='no_pager', action='store_true', 47 dest='no_pager', action='store_true',
48 help='disable the pager') 48 help='disable the pager')
49global_options.add_option('--version',
50 dest='show_version', action='store_true',
51 help='display this version of repo')
49 52
50class _Repo(object): 53class _Repo(object):
51 def __init__(self, repodir): 54 def __init__(self, repodir):
@@ -69,6 +72,13 @@ class _Repo(object):
69 argv = [] 72 argv = []
70 gopts, gargs = global_options.parse_args(glob) 73 gopts, gargs = global_options.parse_args(glob)
71 74
75 if gopts.show_version:
76 if name == 'help':
77 name = 'version'
78 else:
79 print >>sys.stderr, 'fatal: invalid usage of --version'
80 sys.exit(1)
81
72 try: 82 try:
73 cmd = self.commands[name] 83 cmd = self.commands[name]
74 except KeyError: 84 except KeyError: