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

Unified Diff: chrome/test/chromedriver/run_buildbot_steps.py

Issue 337923007: [Chromedriver] Convert Git hash to svn revision if required. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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: chrome/test/chromedriver/run_buildbot_steps.py
diff --git a/chrome/test/chromedriver/run_buildbot_steps.py b/chrome/test/chromedriver/run_buildbot_steps.py
index c471dbcf28d486ece975dc4750cf9a53b149aadf..13dc8cacfd77ca447fcffab6a640a46917b7201e 100755
--- a/chrome/test/chromedriver/run_buildbot_steps.py
+++ b/chrome/test/chromedriver/run_buildbot_steps.py
@@ -31,6 +31,10 @@ GS_SERVER_LOGS_URL = GS_CHROMEDRIVER_DATA_BUCKET + '/server_logs'
SERVER_LOGS_LINK = (
'http://chromedriver-data.storage.googleapis.com/server_logs')
TEST_LOG_FORMAT = '%s_log.json'
+GS_GITHASH_TO_SVN_URL =\
+ 'https://chromium.googlesource.com/chromium/src/+/%s?format=json'
+GS_SEARCH_PATTERN =\
+ r'.*git-svn-id: svn://svn.chromium.org/chrome/trunk/src@(\d+) '
SCRIPT_DIR = os.path.join(_THIS_DIR, os.pardir, os.pardir, os.pardir, os.pardir,
os.pardir, os.pardir, os.pardir, 'scripts')
@@ -379,15 +383,36 @@ def _CleanTmpDir():
print 'deleting file', file_path
os.remove(file_path)
+def _GetSVNRevisionFromGitHash(snapshot_revision):
+ json_url = GS_GITHASH_TO_SVN_URL % snapshot_revision
+ try:
+ response = urllib2.urlopen(json_url)
+ except urllib2.HTTPError, error:
+ util.PrintAndFlush('HTTP Error %d' % error.getcode())
+ return None
+ data = json.loads(response.read()[4:])
+ if 'message' in data:
+ message = data['message'].split('\n')
+ message = [line for line in message if line.strip()]
+ search_pattern = re.compile(GS_SEARCH_PATTERN)
+ result = search_pattern.search(message[len(message)-1])
+ if result:
+ return result.group(1)
+ return None
def _WaitForLatestSnapshot(revision):
util.MarkBuildStepStart('wait_for_snapshot')
while True:
snapshot_revision = archive.GetLatestSnapshotVersion()
- if int(snapshot_revision) >= int(revision):
- break
- util.PrintAndFlush('Waiting for snapshot >= %s, found %s' %
- (revision, snapshot_revision))
+ if not revision.isdigit():
+ revision = _GetSVNRevisionFromGitHash(revision)
+ if not snapshot_revision.isdigit():
+ snapshot_revision = _GetSVNRevisionFromGitHash(snapshot_revision)
+ if revision is not None and snapshot_revision is not None:
+ if int(snapshot_revision) >= int(revision):
+ break
+ util.PrintAndFlush('Waiting for snapshot >= %s, found %s' %
+ (revision, snapshot_revision))
time.sleep(60)
util.PrintAndFlush('Got snapshot revision %s' % snapshot_revision)
« 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