Add revinfo --actual to fetch the actual revisions,

gclient revinfo alone will now not return the actual checked out revisions but simply what's in the .gclient&DEPS.

BUG=none
TEST=add a --snapshot test to make sure it is not broken

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@55760 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
maruel@chromium.org 15 years ago
parent 888b8355ca
commit b1e315f9e8

@ -793,11 +793,16 @@ solutions = [
# Print the snapshot configuration file
print(self.DEFAULT_SNAPSHOT_FILE_TEXT % {'solution_list': new_gclient})
else:
entries = sorted(self.tree(False), key=lambda i: i.name)
for d in entries:
entry_url = GetURLAndRev(d)
line = '%s: %s' % (d.name, entry_url)
if not d is entries[-1]:
entries = {}
for d in self.tree(False):
if self._options.actual:
entries[d.name] = GetURLAndRev(d)
else:
entries[d.name] = d.parsed_url
keys = sorted(entries.keys())
for x in keys:
line = '%s: %s' % (x, entries[x])
if x is not keys[-1]:
line += ';'
print line
logging.info(str(self))
@ -1110,9 +1115,13 @@ def CMDrevinfo(parser, args):
help='override deps for the specified (comma-separated) '
'platform(s); \'all\' will process all deps_os '
'references')
parser.add_option('-a', '--actual', action='store_true',
help='gets the actual checked out revisions instead of the '
'ones specified in the DEPS and .gclient files')
parser.add_option('-s', '--snapshot', action='store_true',
help='creates a snapshot .gclient file of the current '
'version of all repositories to reproduce the tree')
'version of all repositories to reproduce the tree, '
'implies -a')
(options, args) = parser.parse_args(args)
client = GClient.LoadCurrentConfig(options)
if not client:

@ -429,12 +429,37 @@ class GClientSmokeSVN(GClientSmokeBase):
self.gclient(['config', self.svn_base + 'trunk/src/'])
self.gclient(['sync', '--deps', 'mac'])
results = self.gclient(['revinfo', '--deps', 'mac'])
out = ('src: %(base)s/src;\n'
'src/file/other: File("%(base)s/other/DEPS");\n'
'src/other: %(base)s/other;\n'
'src/third_party/foo: %(base)s/third_party/foo@1\n' %
{ 'base': self.svn_base + 'trunk' })
self.check((out, '', 0), results)
results = self.gclient(['revinfo', '--deps', 'mac', '--actual'])
out = ('src: %(base)s/src@2;\n'
'src/file/other: %(base)s/other/DEPS@2;\n'
'src/other: %(base)s/other@2;\n'
'src/third_party/foo: %(base)s/third_party/foo@1\n' %
{ 'base': self.svn_base + 'trunk' })
self.check((out, '', 0), results)
results = self.gclient(['revinfo', '--deps', 'mac', '--snapshot'])
out = ('# Snapshot generated with gclient revinfo --snapshot\n'
'solutions = [\n'
' { "name" : "src",\n'
' "url" : "%(base)s/src",\n'
' "custom_deps" : {\n'
' "foo/bar": None,\n'
' "invalid": None,\n'
' "src/file/other": \'%(base)s/other/DEPS@2\',\n'
' "src/other": \'%(base)s/other@2\',\n'
' "src/third_party/foo": '
'\'%(base)s/third_party/foo@1\',\n'
' },\n'
' "safesync_url": "",\n'
' },\n'
']\n\n' %
{ 'base': self.svn_base + 'trunk' })
self.check((out, '', 0), results)
class GClientSmokeGIT(GClientSmokeBase):
@ -608,6 +633,17 @@ class GClientSmokeGIT(GClientSmokeBase):
self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
self.gclient(['sync', '--deps', 'mac'])
results = self.gclient(['revinfo', '--deps', 'mac'])
out = ('src: %(base)srepo_1;\n'
'src/repo2: %(base)srepo_2@%(hash2)s;\n'
'src/repo2/repo_renamed: %(base)srepo_3\n' %
{
'base': self.git_base,
'hash1': self.githash('repo_1', 2)[:7],
'hash2': self.githash('repo_2', 1)[:7],
'hash3': self.githash('repo_3', 2)[:7],
})
self.check((out, '', 0), results)
results = self.gclient(['revinfo', '--deps', 'mac', '--actual'])
out = ('src: %(base)srepo_1@%(hash1)s;\n'
'src/repo2: %(base)srepo_2@%(hash2)s;\n'
'src/repo2/repo_renamed: %(base)srepo_3@%(hash3)s\n' %
@ -700,6 +736,21 @@ class GClientSmokeBoth(GClientSmokeBase):
'"url": "' + self.git_base + 'repo_1"}]'])
self.gclient(['sync', '--deps', 'mac'])
results = self.gclient(['revinfo', '--deps', 'mac'])
out = ('src: %(svn_base)s/src/;\n'
'src-git: %(git_base)srepo_1;\n'
'src/file/other: File("%(svn_base)s/other/DEPS");\n'
'src/other: %(svn_base)s/other;\n'
'src/repo2: %(git_base)srepo_2@%(hash2)s;\n'
'src/repo2/repo_renamed: %(git_base)srepo_3;\n'
'src/third_party/foo: %(svn_base)s/third_party/foo@1\n') % {
'svn_base': self.svn_base + 'trunk',
'git_base': self.git_base,
'hash1': self.githash('repo_1', 2)[:7],
'hash2': self.githash('repo_2', 1)[:7],
'hash3': self.githash('repo_3', 2)[:7],
}
self.check((out, '', 0), results)
results = self.gclient(['revinfo', '--deps', 'mac', '--actual'])
out = ('src: %(svn_base)s/src/@2;\n'
'src-git: %(git_base)srepo_1@%(hash1)s;\n'
'src/file/other: %(svn_base)s/other/DEPS@2;\n'

Loading…
Cancel
Save