Add --version flag

This commit is contained in:
Cameron Paul 2016-05-19 00:01:32 -05:00
parent 3ab5c07559
commit d76ffa8fd8
3 changed files with 30 additions and 0 deletions

View file

@ -413,6 +413,22 @@ class CommandBase(object):
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -W unused-extern-crates"
git_info = []
if os.path.isdir('.git'):
git_sha = subprocess.check_output([
'git', 'rev-parse', '--short', 'HEAD'
]).strip()
git_is_dirty = bool(subprocess.check_output([
'git', 'status', '--porcelain'
]).strip())
git_info.append('')
git_info.append(git_sha)
if git_is_dirty:
git_info.append('dirty')
env['GIT_INFO'] = '-'.join(git_info)
return env
def servo_crate(self):