Commit bf13f08b authored by thestig@chromium.org's avatar thestig@chromium.org

Fix roll_dep.py to print the right latest SVN revision number on error.

TEST="roll_dep.py breakpad/src 10000" should print ~1387, not 4.

Review URL: https://codereview.chromium.org/604463002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@292129 0039d316-1c4b-4281-b951-d872f2087c98
parent 4d2a66ee
...@@ -107,6 +107,7 @@ def convert_svn_revision(dep_path, revision): ...@@ -107,6 +107,7 @@ def convert_svn_revision(dep_path, revision):
"""Find the git revision corresponding to an svn revision.""" """Find the git revision corresponding to an svn revision."""
err_msg = 'Unknown error' err_msg = 'Unknown error'
revision = int(revision) revision = int(revision)
latest_svn_rev = None
with open(os.devnull, 'w') as devnull: with open(os.devnull, 'w') as devnull:
for ref in ('HEAD', 'origin/master'): for ref in ('HEAD', 'origin/master'):
try: try:
...@@ -126,6 +127,8 @@ def convert_svn_revision(dep_path, revision): ...@@ -126,6 +127,8 @@ def convert_svn_revision(dep_path, revision):
print >> sys.stderr, ( print >> sys.stderr, (
'WARNING: Could not parse svn revision out of "%s"' % line) 'WARNING: Could not parse svn revision out of "%s"' % line)
continue continue
if not latest_svn_rev or int(svn_rev) > int(latest_svn_rev):
latest_svn_rev = svn_rev
if svn_rev == revision: if svn_rev == revision:
return git_rev return git_rev
if svn_rev > revision: if svn_rev > revision:
...@@ -137,7 +140,8 @@ def convert_svn_revision(dep_path, revision): ...@@ -137,7 +140,8 @@ def convert_svn_revision(dep_path, revision):
else: else:
err_msg = ( err_msg = (
'latest available revision is %d; you may need to ' 'latest available revision is %d; you may need to '
'"git fetch origin" to get the latest commits.' % svn_rev) '"git fetch origin" to get the latest commits.' %
latest_svn_rev)
finally: finally:
log_p.terminate() log_p.terminate()
grep_p.terminate() grep_p.terminate()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment