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

Unified Diff: runtime/tools/make_version.py

Issue 11236034: Fix version script for git repos that are not git-svn. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/tools/make_version.py
diff --git a/runtime/tools/make_version.py b/runtime/tools/make_version.py
index c63f6a5b4c047fc66555fef50f8da8b376064f55..e3d8a70f779e5d21005c933914b68fc6cf6671fb 100644
--- a/runtime/tools/make_version.py
+++ b/runtime/tools/make_version.py
@@ -35,19 +35,23 @@ def getRevision():
debugLog("Using svn to get revision")
cmd = ['svn', 'info']
else:
- debugLog("Using git svn to get revision")
- cmd = ['git', 'svn', 'info']
- try:
- debugLog("Running command to get revision: %s" % cmd)
- proc = subprocess.Popen(cmd,
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- revision = proc.communicate()[0].split('\n')[4].split(' ')[1]
- debugLog("Got revision: %s" % revision)
- return revision
- except Exception:
- # If we can't get any revision info (due to lack of tooling) return ''.
- return ''
-
+ git_proc = subprocess.Popen(
Ivan Posva 2012/10/26 02:57:06 I know this was already an issue previously: What
Mads Ager (google) 2012/10/26 06:26:47 Yeah, I actually did remove a try: block from here
+ ['git', 'branch', '-r'],
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ if 'git-svn' in git_proc.communicate()[0]:
+ debugLog("Using git svn to get revision")
+ cmd = ['git', 'svn', 'info']
+ else:
+ # Cannot get revision because we are not in svn or
+ # git svn checkout.
+ debugLog("Could not get revision: not an svn or git-svn checkout?")
+ return ''
+ debugLog("Running command to get revision: %s" % cmd)
+ proc = subprocess.Popen(cmd,
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ revision = proc.communicate()[0].split('\n')[4].split(' ')[1]
+ debugLog("Got revision: %s" % revision)
+ return revision
def makeVersionString(version_file):
id = platform.system()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698