diff options
Diffstat (limited to 'subcmds/version.py')
| -rw-r--r-- | subcmds/version.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/subcmds/version.py b/subcmds/version.py new file mode 100644 index 00000000..4f19a0ca --- /dev/null +++ b/subcmds/version.py | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | # | ||
| 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 | |||
| 16 | import sys | ||
| 17 | from command import Command | ||
| 18 | from git_command import git | ||
| 19 | from project import HEAD | ||
| 20 | |||
| 21 | class Version(Command): | ||
| 22 | common = False | ||
| 23 | helpSummary = "Display the version of repo" | ||
| 24 | helpUsage = """ | ||
| 25 | %prog | ||
| 26 | """ | ||
| 27 | |||
| 28 | def Execute(self, opt, args): | ||
| 29 | rp = self.manifest.repoProject | ||
| 30 | rem = rp.GetRemote(rp.remote.name) | ||
| 31 | |||
| 32 | print 'repo version %s' % rp.work_git.describe(HEAD) | ||
| 33 | print ' (from %s)' % rem.url | ||
| 34 | print git.version().strip() | ||
| 35 | print 'Python %s' % sys.version | ||
