blob: 01b7fd8c7207705d9b98a18108c72cc7586a01d5 [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
Sarah Owenscecd1d82012-11-01 22:59:27 -070016from __future__ import print_function
Shawn O. Pearce47c1a632009-03-02 18:24:23 -080017import sys
Shawn O. Pearcec95583b2009-03-03 17:47:06 -080018from command import Command, MirrorSafeCommand
Shawn O. Pearce47c1a632009-03-02 18:24:23 -080019from git_command import git
David Pursehousee00aa6b2012-09-11 14:33:51 +090020from git_refs import HEAD
Shawn O. Pearce47c1a632009-03-02 18:24:23 -080021
Shawn O. Pearcec95583b2009-03-03 17:47:06 -080022class Version(Command, MirrorSafeCommand):
Shawn O. Pearceecff4f12011-11-29 15:01:33 -080023 wrapper_version = None
24 wrapper_path = None
25
Shawn O. Pearce47c1a632009-03-02 18:24:23 -080026 common = False
27 helpSummary = "Display the version of repo"
28 helpUsage = """
29%prog
30"""
31
32 def Execute(self, opt, args):
33 rp = self.manifest.repoProject
34 rem = rp.GetRemote(rp.remote.name)
35
Sarah Owenscecd1d82012-11-01 22:59:27 -070036 print('repo version %s' % rp.work_git.describe(HEAD))
37 print(' (from %s)' % rem.url)
Shawn O. Pearceecff4f12011-11-29 15:01:33 -080038
39 if Version.wrapper_path is not None:
Sarah Owenscecd1d82012-11-01 22:59:27 -070040 print('repo launcher version %s' % Version.wrapper_version)
41 print(' (from %s)' % Version.wrapper_path)
Shawn O. Pearceecff4f12011-11-29 15:01:33 -080042
Sarah Owenscecd1d82012-11-01 22:59:27 -070043 print(git.version().strip())
44 print('Python %s' % sys.version)