Commit 26ffa944 authored by Edward Lemur's avatar Edward Lemur Committed by Commit Bot

bot_update: Assume everything after the first @ is part of the revision.

So that bot_update can apply patched on top of experimental branches,
which include the user's email (and so an extra @).

Change-Id: I33acb49e8b48c6ed6db7e752fca7eb0f1ede0690
Reviewed-on: https://chromium-review.googlesource.com/c/1450895
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: 's avatarAndrii Shyshkalov <tandrii@chromium.org>
parent 73f97e7d
......@@ -886,11 +886,11 @@ def parse_revisions(revisions, root):
# TODO(hinoka): Delete this when webkit switches to recipes.
expanded_revisions.extend(revision.split(','))
for revision in expanded_revisions:
split_revision = revision.split('@')
split_revision = revision.split('@', 1)
if len(split_revision) == 1:
# This is just a plain revision, set it as the revision for root.
results[root] = split_revision[0]
elif len(split_revision) == 2:
else:
# This is an alt_root@revision argument.
current_root, current_rev = split_revision
......@@ -908,9 +908,7 @@ def parse_revisions(revisions, root):
normalized_root = current_root.strip('/')
results[normalized_root] = current_rev
else:
print ('WARNING: %r is not recognized as a valid revision specification,'
'skipping' % revision)
return results
......
......@@ -295,6 +295,22 @@ class BotUpdateUnittests(unittest.TestCase):
'https://chromium.googlesource.com/breakpad')
self.assertNotIn('src/overridden', out['directories'])
def testParsesRevisions(self):
revisions = [
'f671d3baeb64d9dba628ad582e867cf1aebc0207',
'src@deadbeef',
'https://foo.googlesource.com/bar@12345',
'bar@refs/experimental/test@example.com/test',
]
expected_results = {
'root': 'f671d3baeb64d9dba628ad582e867cf1aebc0207',
'src': 'deadbeef',
'https://foo.googlesource.com/bar.git': '12345',
'bar': 'refs/experimental/test@example.com/test',
}
actual_results = bot_update.parse_revisions(revisions, 'root')
self.assertEqual(expected_results, actual_results)
if __name__ == '__main__':
unittest.main()
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