Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 # TODO(ojan): Get rid of this one crrev.com supports this directly. | |
| 6 | |
| 7 import json | |
| 8 import urllib2 | |
| 9 import webapp2 | |
| 10 | |
| 11 # This is just to make testing easier. | |
| 12 def load_url(url): | |
| 13 return urllib2.urlopen(url).read() | |
| 14 | |
|
ghost stip (do not use)
2014/09/04 22:53:25
nit: 2 spaces
ojan
2014/09/05 21:40:33
2 line breaks? If so, done. Why doesn't the linter
| |
| 15 def commit_position_to_hash(commit_position): | |
| 16 url = 'https://cr-rev.appspot.com/_ah/api/crrev/v1/redirect/%s' % ( | |
| 17 commit_position) | |
| 18 return str(json.loads(load_url(url))['git_sha']) | |
| 19 | |
| 20 def url_from_commit_positions(start_commit_position, end_commit_position): | |
| 21 start = commit_position_to_hash(start_commit_position) | |
| 22 end = commit_position_to_hash(end_commit_position) | |
| 23 return ('https://chromium.googlesource.com/chromium/src/+log' | |
| 24 '/%s..%s?pretty=full' % (start, end)) | |
|
ghost stip (do not use)
2014/09/04 22:53:25
note: you may want pretty=fuller here, depending o
ojan
2014/09/05 21:40:33
Done.
| |
| 25 | |
| 26 def get_googlesource_url(handler, *args, **kwargs): | |
| 27 return url_from_commit_positions(handler.request.get('start'), | |
| 28 handler.request.get('end')) | |
| OLD | NEW |