Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: skia/commit_hash.py

Issue 2187533002: skia_commit_hash.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-07-28 (Thursday) 16:16:56 EDT Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: skia/commit_hash.py
diff --git a/skia/commit_hash.py b/skia/commit_hash.py
new file mode 100755
index 0000000000000000000000000000000000000000..bfab82271ce43ecce7e627381737166e16a06191
--- /dev/null
+++ b/skia/commit_hash.py
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+
+# Copyright (c) 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+'''
+Usage: python commit_hash.py SKIA_DIR OUTPUT_FILE
+'''
+
+import os
+import subprocess
+import sys
+
+assert len(sys.argv) == 3
+
+template = '''#include "skia/ext/skia_commit_hash.h"
+namespace skia {
+const char* CommitHash() { return "%s"; }
+}
+'''
+
+try:
+ commit = subprocess.check_output(
+ ['git', 'rev-parse', '--short=12', 'HEAD'],
+ cwd=sys.argv[1]).strip()
+except (subprocess.CalledProcessError, OSError), e:
+ commit = 'UNKNOWN'
+
+with open(sys.argv[2], 'w') as o:
+ o.write(template % commit)
« skia/BUILD.gn ('K') | « skia/BUILD.gn ('k') | skia/ext/skia_commit_hash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698