aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/command_base.py
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-06-29 09:05:35 -0500
committerGitHub <noreply@github.com>2016-06-29 09:05:35 -0500
commit5478e605aef93cc384b709688cc68e3ed854a68b (patch)
treecae570fd14014cb9fbde7e383125a7b09a7ffc4c /python/servo/command_base.py
parent19cb3e99680427a7ae30dbbc11f550e35ecc4576 (diff)
parentd76ffa8fd8b9311ef13eb477c55fc0b7dce753f5 (diff)
downloadservo-5478e605aef93cc384b709688cc68e3ed854a68b.tar.gz
servo-5478e605aef93cc384b709688cc68e3ed854a68b.zip
Auto merge of #11262 - campaul:add_version_flag, r=Manishearth
Add `--version` flag - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy --faster` does not report any errors - [X] These changes fix #11241 (github issue number if applicable). Either: - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ Not 100% sure of a good way to test this, so I'm submitting as is for feedback. Manually testing it appears to work fine. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11262) <!-- Reviewable:end -->
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r--python/servo/command_base.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index e90245f43ec..990bc9a586c 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -374,6 +374,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):