blob: 9fb694df40db27dde2b8fe024bf4eac7e729e80c [file] [log] [blame]
Mike Frysingerf6013762019-06-13 02:30:51 -04001# -*- coding:utf-8 -*-
Shawn O. Pearce47c1a632009-03-02 18:24:23 -08002#
3# Copyright (C) 2009 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
Sarah Owenscecd1d82012-11-01 22:59:27 -070017from __future__ import print_function
Shawn O. Pearce47c1a632009-03-02 18:24:23 -080018import sys
Shawn O. Pearcec95583b2009-03-03 17:47:06 -080019from command import Command, MirrorSafeCommand
Shawn O. Pearce47c1a632009-03-02 18:24:23 -080020from git_command import git
David Pursehousee00aa6b2012-09-11 14:33:51 +090021from git_refs import HEAD
Shawn O. Pearce47c1a632009-03-02 18:24:23 -080022
Shawn O. Pearcec95583b2009-03-03 17:47:06 -080023class Version(Command, MirrorSafeCommand):
Shawn O. Pearceecff4f12011-11-29 15:01:33 -080024 wrapper_version = None
25 wrapper_path = None
26
Shawn O. Pearce47c1a632009-03-02 18:24:23 -080027 common = False
28 helpSummary = "Display the version of repo"
29 helpUsage = """
30%prog
31"""
32
33 def Execute(self, opt, args):
34 rp = self.manifest.repoProject
35 rem = rp.GetRemote(rp.remote.name)
36
Sarah Owenscecd1d82012-11-01 22:59:27 -070037 print('repo version %s' % rp.work_git.describe(HEAD))
38 print(' (from %s)' % rem.url)
Shawn O. Pearceecff4f12011-11-29 15:01:33 -080039
40 if Version.wrapper_path is not None:
Sarah Owenscecd1d82012-11-01 22:59:27 -070041 print('repo launcher version %s' % Version.wrapper_version)
42 print(' (from %s)' % Version.wrapper_path)
Shawn O. Pearceecff4f12011-11-29 15:01:33 -080043
Mike Frysingerca540ae2019-07-10 15:42:30 -040044 print('git %s' % git.version_tuple().full)
Sarah Owenscecd1d82012-11-01 22:59:27 -070045 print('Python %s' % sys.version)