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

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: 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
« no previous file with comments | « skia/BUILD.gn ('k') | skia/ext/skia_commit_hash.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/commit_hash.py
diff --git a/skia/commit_hash.py b/skia/commit_hash.py
new file mode 100755
index 0000000000000000000000000000000000000000..03866b6dbfd6bd99123c2fbac7464eae788c571b
--- /dev/null
+++ b/skia/commit_hash.py
@@ -0,0 +1,29 @@
+#!/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"
+const char* skia::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'
mtklein 2016/07/26 16:11:48 Is failure expected to happen somewhere? Wouldn't
+
+with open(sys.argv[2], 'w') as o:
+ o.write(template % commit)
« no previous file with comments | « 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