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
experimental/szager/collated-output
msb@chromium.org 16 years ago
parent e2ce0c75c3
commit 770ff9ee21

@ -805,7 +805,7 @@ class GClient(object):
def GetURLAndRev(name, original_url): def GetURLAndRev(name, original_url):
if original_url.find("@") < 0: if original_url.find("@") < 0:
if revision_overrides.has_key(name): if revision_overrides.has_key(name):
return (original_url, int(revision_overrides[name])) return (original_url, revision_overrides[name])
else: else:
# TODO(aharper): SVN/SCMWrapper cleanup (non-local commandset) # TODO(aharper): SVN/SCMWrapper cleanup (non-local commandset)
return (original_url, return (original_url,
@ -813,9 +813,9 @@ class GClient(object):
else: else:
url_components = original_url.split("@") url_components = original_url.split("@")
if revision_overrides.has_key(name): if revision_overrides.has_key(name):
return (url_components[0], int(revision_overrides[name])) return (url_components[0], revision_overrides[name])
else: else:
return (url_components[0], int(url_components[1])) return (url_components[0], url_components[1])
# Run on the base solutions first. # Run on the base solutions first.
for solution in solutions: for solution in solutions:
@ -823,11 +823,11 @@ class GClient(object):
if name in entries: if name in entries:
raise Error("solution %s specified more than once" % name) raise Error("solution %s specified more than once" % name)
(url, rev) = GetURLAndRev(name, solution["url"]) (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) # TODO(aharper): SVN/SCMWrapper cleanup (non-local commandset)
entries_deps_content[name] = gclient_scm.CaptureSVN( entries_deps_content[name] = gclient_scm.CaptureSVN(
["cat", ["cat",
"%s/%s@%d" % (url, "%s/%s@%s" % (url,
self._options.deps_file, self._options.deps_file,
rev)], rev)],
os.getcwd()) os.getcwd())
@ -842,7 +842,7 @@ class GClient(object):
for d in deps_to_process: for d in deps_to_process:
if type(deps[d]) == str: if type(deps[d]) == str:
(url, rev) = GetURLAndRev(d, deps[d]) (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) # Second pass for inherited deps (via the From keyword)
for d in deps_to_process: for d in deps_to_process:
@ -865,7 +865,7 @@ class GClient(object):
self._options.deps_file)), self._options.deps_file)),
{}) {})
(url, rev) = GetURLAndRev(d, sub_deps[d]) (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]) print(";\n\n".join(["%s: %s" % (x, entries[x])
for x in sorted(entries.keys())])) for x in sorted(entries.keys())]))

@ -133,15 +133,15 @@ class SVNWrapper(SCMWrapper):
if options.revision: if options.revision:
# Override the revision number. # Override the revision number.
url = '%s@%s' % (components[0], str(options.revision)) url = '%s@%s' % (components[0], str(options.revision))
revision = int(options.revision) revision = options.revision
forced_revision = True forced_revision = True
elif len(components) == 2: elif len(components) == 2:
revision = int(components[1]) revision = components[1]
forced_revision = True forced_revision = True
rev_str = "" rev_str = ""
if revision: if revision:
rev_str = ' at %d' % revision rev_str = ' at %s' % revision
if not os.path.exists(checkout_path): if not os.path.exists(checkout_path):
# We need to checkout. # We need to checkout.
@ -163,8 +163,8 @@ class SVNWrapper(SCMWrapper):
# Retrieve the current HEAD version because svn is slow at null updates. # Retrieve the current HEAD version because svn is slow at null updates.
if not revision: if not revision:
from_info_live = CaptureSVNInfo(from_info['URL'], '.') from_info_live = CaptureSVNInfo(from_info['URL'], '.')
revision = int(from_info_live['Revision']) revision = from_info_live['Revision']
rev_str = ' at %d' % revision rev_str = ' at %s' % revision
if from_info['URL'] != components[0]: if from_info['URL'] != components[0]:
to_info = CaptureSVNInfo(url, '.') to_info = CaptureSVNInfo(url, '.')
@ -517,7 +517,7 @@ def CaptureSVNHeadRevision(url):
""" """
info = CaptureSVN(["info", "--xml", url], os.getcwd()) info = CaptureSVN(["info", "--xml", url], os.getcwd())
dom = xml.dom.minidom.parseString(info) dom = xml.dom.minidom.parseString(info)
return int(dom.getElementsByTagName('entry')[0].getAttribute('revision')) return dom.getElementsByTagName('entry')[0].getAttribute('revision')
def CaptureSVNStatus(files): def CaptureSVNStatus(files):

Loading…
Cancel
Save