Commit 770ff9ee authored by msb@chromium.org's avatar msb@chromium.org

gclient: store revision as a string and not int

Currently, revision numbers are stored as int. This won't work
for git's SHA1s. So storing revisions as strings.

Review URL: http://codereview.chromium.org/208060

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@26940 0039d316-1c4b-4281-b951-d872f2087c98
parent e2ce0c75
......@@ -805,7 +805,7 @@ class GClient(object):
def GetURLAndRev(name, original_url):
if original_url.find("@") < 0:
if revision_overrides.has_key(name):
return (original_url, int(revision_overrides[name]))
return (original_url, revision_overrides[name])
else:
# TODO(aharper): SVN/SCMWrapper cleanup (non-local commandset)
return (original_url,
......@@ -813,9 +813,9 @@ class GClient(object):
else:
url_components = original_url.split("@")
if revision_overrides.has_key(name):
return (url_components[0], int(revision_overrides[name]))
return (url_components[0], revision_overrides[name])
else:
return (url_components[0], int(url_components[1]))
return (url_components[0], url_components[1])
# Run on the base solutions first.
for solution in solutions:
......@@ -823,11 +823,11 @@ class GClient(object):
if name in entries:
raise Error("solution %s specified more than once" % name)
(url, rev) = GetURLAndRev(name, solution["url"])
entries[name] = "%s@%d" % (url, rev)
entries[name] = "%s@%s" % (url, rev)
# TODO(aharper): SVN/SCMWrapper cleanup (non-local commandset)
entries_deps_content[name] = gclient_scm.CaptureSVN(
["cat",
"%s/%s@%d" % (url,
"%s/%s@%s" % (url,
self._options.deps_file,
rev)],
os.getcwd())
......@@ -842,7 +842,7 @@ class GClient(object):
for d in deps_to_process:
if type(deps[d]) == str:
(url, rev) = GetURLAndRev(d, deps[d])
entries[d] = "%s@%d" % (url, rev)
entries[d] = "%s@%s" % (url, rev)
# Second pass for inherited deps (via the From keyword)
for d in deps_to_process:
......@@ -865,7 +865,7 @@ class GClient(object):
self._options.deps_file)),
{})
(url, rev) = GetURLAndRev(d, sub_deps[d])
entries[d] = "%s@%d" % (url, rev)
entries[d] = "%s@%s" % (url, rev)
print(";\n\n".join(["%s: %s" % (x, entries[x])
for x in sorted(entries.keys())]))
......
......@@ -133,15 +133,15 @@ class SVNWrapper(SCMWrapper):
if options.revision:
# Override the revision number.
url = '%s@%s' % (components[0], str(options.revision))
revision = int(options.revision)
revision = options.revision
forced_revision = True
elif len(components) == 2:
revision = int(components[1])
revision = components[1]
forced_revision = True
rev_str = ""
if revision:
rev_str = ' at %d' % revision
rev_str = ' at %s' % revision
if not os.path.exists(checkout_path):
# We need to checkout.
......@@ -163,8 +163,8 @@ class SVNWrapper(SCMWrapper):
# Retrieve the current HEAD version because svn is slow at null updates.
if not revision:
from_info_live = CaptureSVNInfo(from_info['URL'], '.')
revision = int(from_info_live['Revision'])
rev_str = ' at %d' % revision
revision = from_info_live['Revision']
rev_str = ' at %s' % revision
if from_info['URL'] != components[0]:
to_info = CaptureSVNInfo(url, '.')
......@@ -517,7 +517,7 @@ def CaptureSVNHeadRevision(url):
"""
info = CaptureSVN(["info", "--xml", url], os.getcwd())
dom = xml.dom.minidom.parseString(info)
return int(dom.getElementsByTagName('entry')[0].getAttribute('revision'))
return dom.getElementsByTagName('entry')[0].getAttribute('revision')
def CaptureSVNStatus(files):
......
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