blob: 243e3676039b46b3526b28eaa33049a963307b22 [file] [log] [blame]
Shawn O. Pearce47c1a632009-03-02 18:24:23 -08001#
2# Copyright (C) 2009 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16import sys
Shawn O. Pearcec95583b2009-03-03 17:47:06 -080017from command import Command, MirrorSafeCommand
Shawn O. Pearce47c1a632009-03-02 18:24:23 -080018from git_command import git
David Pursehousee00aa6b2012-09-11 14:33:51 +090019from git_refs import HEAD
Shawn O. Pearce47c1a632009-03-02 18:24:23 -080020
Shawn O. Pearcec95583b2009-03-03 17:47:06 -080021class Version(Command, MirrorSafeCommand):
Shawn O. Pearceecff4f12011-11-29 15:01:33 -080022 wrapper_version = None
23 wrapper_path = None
24
Shawn O. Pearce47c1a632009-03-02 18:24:23 -080025 common = False
26 helpSummary = "Display the version of repo"
27 helpUsage = """
28%prog
29"""
30
31 def Execute(self, opt, args):
32 rp = self.manifest.repoProject
33 rem = rp.GetRemote(rp.remote.name)
34
35 print 'repo version %s' % rp.work_git.describe(HEAD)
36 print ' (from %s)' % rem.url
Shawn O. Pearceecff4f12011-11-29 15:01:33 -080037
38 if Version.wrapper_path is not None:
39 print 'repo launcher version %s' % Version.wrapper_version
40 print ' (from %s)' % Version.wrapper_path
41
Shawn O. Pearce47c1a632009-03-02 18:24:23 -080042 print git.version().strip()
43 print 'Python %s' % sys.version