Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: tools/autoroller/roll_chromium_revision.py

Issue 1381963003: autoroller: Always roll and improve description (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Made CL description clearer when no deps or Clang changes. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/autoroller/roll_chromium_revision.py
diff --git a/tools/autoroller/roll_chromium_revision.py b/tools/autoroller/roll_chromium_revision.py
index 4f2de2f7e9c30c5624139536125f845073a24326..acb1d56b96b289b7af386b20ce7d467ac5560d6f 100755
--- a/tools/autoroller/roll_chromium_revision.py
+++ b/tools/autoroller/roll_chromium_revision.py
@@ -23,6 +23,7 @@ import urllib
CHROMIUM_LKGR_URL = 'https://chromium-status.appspot.com/lkgr'
CHROMIUM_SRC_URL = 'https://chromium.googlesource.com/chromium/src'
CHROMIUM_COMMIT_TEMPLATE = CHROMIUM_SRC_URL + '/+/%s'
+CHROMIUM_LOG_TEMPLATE = CHROMIUM_SRC_URL + '/+log/%s'
CHROMIUM_FILE_TEMPLATE = CHROMIUM_SRC_URL + '/+/%s/%s'
COMMIT_POSITION_RE = re.compile('^Cr-Commit-Position: .*#([0-9]+).*$')
@@ -45,7 +46,8 @@ CLANG_UPDATE_SCRIPT_LOCAL_PATH = os.path.join('tools', 'clang', 'scripts',
'update.sh')
DepsEntry = collections.namedtuple('DepsEntry', 'path url revision')
-ChangedDep = collections.namedtuple('ChangedDep', 'path current_rev new_rev')
+ChangedDep = collections.namedtuple('ChangedDep',
+ 'path url current_rev new_rev')
def ParseDepsDict(deps_content):
@@ -220,9 +222,9 @@ def CalculateChangedDeps(current_deps, new_deps):
'Should never find more than one entry matching %s in %s, found %d' %
(entry.path, new_entries, len(new_matching_entries)))
if not new_matching_entries:
- result.append(ChangedDep(entry.path, entry.revision, 'None'))
+ result.append(ChangedDep(entry.path, entry.url, entry.revision, 'None'))
elif entry != new_matching_entries[0]:
- result.append(ChangedDep(entry.path, entry.revision,
+ result.append(ChangedDep(entry.path, entry.url, entry.revision,
new_matching_entries[0].revision))
return result
@@ -244,40 +246,41 @@ def CalculateChangedClang(new_cr_rev):
new_clang_update_sh = ReadRemoteCrFile(CLANG_UPDATE_SCRIPT_URL_PATH,
new_cr_rev).splitlines()
new_rev = GetClangRev(new_clang_update_sh)
- return ChangedDep(CLANG_UPDATE_SCRIPT_LOCAL_PATH, current_rev, new_rev)
+ return ChangedDep(CLANG_UPDATE_SCRIPT_LOCAL_PATH, None, current_rev, new_rev)
-def GenerateCommitMessage(current_cr_rev, new_cr_rev, changed_deps_list,
- clang_change):
+def GenerateCommitMessage(current_cr_rev, new_cr_rev, current_git_number,
+ new_git_number, changed_deps_list, clang_change):
current_cr_rev = current_cr_rev[0:7]
new_cr_rev = new_cr_rev[0:7]
rev_interval = '%s..%s' % (current_cr_rev, new_cr_rev)
-
- current_git_number = ParseCommitPosition(ReadRemoteCrCommit(current_cr_rev))
- new_git_number = ParseCommitPosition(ReadRemoteCrCommit(new_cr_rev))
git_number_interval = '%s:%s' % (current_git_number, new_git_number)
- commit_msg = ['Roll chromium_revision %s (%s)' % (rev_interval,
+ commit_msg = ['Roll chromium_revision %s (%s)\n' % (rev_interval,
git_number_interval)]
-
+ commit_msg.append('Change log: %s' % (CHROMIUM_LOG_TEMPLATE % rev_interval))
+ commit_msg.append('Full diff: %s\n' % (CHROMIUM_COMMIT_TEMPLATE %
+ rev_interval))
if changed_deps_list:
- commit_msg.append('\nRelevant changes:')
+ commit_msg.append('Changed dependencies:')
for c in changed_deps_list:
- commit_msg.append('* %s: %s..%s' % (c.path, c.current_rev[0:7],
- c.new_rev[0:7]))
-
+ commit_msg.append('* %s: %s/+log/%s..%s' % (c.path, c.url,
+ c.current_rev[0:7],
+ c.new_rev[0:7]))
change_url = CHROMIUM_FILE_TEMPLATE % (rev_interval, 'DEPS')
- commit_msg.append('Details: %s' % change_url)
+ commit_msg.append('DEPS diff: %s\n' % change_url)
+ else:
+ commit_msg.append('No dependencies changed.')
if clang_change.current_rev != clang_change.new_rev:
- commit_msg.append('\nClang version changed %s:%s' %
+ commit_msg.append('Clang version changed %s:%s' %
(clang_change.current_rev, clang_change.new_rev))
change_url = CHROMIUM_FILE_TEMPLATE % (rev_interval,
CLANG_UPDATE_SCRIPT_URL_PATH)
commit_msg.append('Details: %s' % change_url)
else:
- commit_msg.append('\nClang version was not updated in this roll.')
+ commit_msg.append('No update to Clang.')
return '\n'.join(commit_msg)
@@ -358,6 +361,9 @@ def main():
help=('Calculate changes and modify DEPS, but don\'t create '
'any local branch, commit, upload CL or send any '
'tryjobs.'))
+ p.add_argument('--allow-reverse', action='store_true', default=False,
+ help=('Allow rolling back in time (disabled by default but '
+ 'may be useful to be able do to manually).'))
p.add_argument('-s', '--skip-try', action='store_true', default=False,
help='Do everything except sending tryjobs.')
p.add_argument('-v', '--verbose', action='store_true', default=False,
@@ -378,31 +384,39 @@ def main():
_EnsureUpdatedMasterBranch(opts.dry_run)
- if not opts.revision:
+ new_cr_rev = opts.revision
+ if not new_cr_rev:
lkgr_contents = ReadUrlContent(CHROMIUM_LKGR_URL)
logging.info('No revision specified. Using LKGR: %s', lkgr_contents[0])
- opts.revision = lkgr_contents[0]
+ new_cr_rev = lkgr_contents[0]
deps_filename = os.path.join(CHECKOUT_ROOT_DIR, 'DEPS')
local_deps = ParseLocalDepsFile(deps_filename)
current_cr_rev = local_deps['vars']['chromium_revision']
+ current_git_number = ParseCommitPosition(ReadRemoteCrCommit(current_cr_rev))
phoglund 2015/10/02 06:53:42 Nit: current_git_pos or current_commit_pos? That i
kjellander_webrtc 2015/10/02 07:10:36 Good idea, I incorporated it in PS#3.
+ new_git_number = ParseCommitPosition(ReadRemoteCrCommit(new_cr_rev))
phoglund 2015/10/02 06:53:42 Ditto
kjellander_webrtc 2015/10/02 07:10:36 Done.
+
current_cr_deps = ParseRemoteCrDepsFile(current_cr_rev)
- new_cr_deps = ParseRemoteCrDepsFile(opts.revision)
+ new_cr_deps = ParseRemoteCrDepsFile(new_cr_rev)
- changed_deps = sorted(CalculateChangedDeps(current_cr_deps, new_cr_deps))
- clang_change = CalculateChangedClang(opts.revision)
- if changed_deps or clang_change:
- commit_msg = GenerateCommitMessage(current_cr_rev, opts.revision,
+ if new_git_number > current_git_number or opts.allow_reverse:
+ changed_deps = sorted(CalculateChangedDeps(current_cr_deps, new_cr_deps))
+ clang_change = CalculateChangedClang(new_cr_rev)
+ commit_msg = GenerateCommitMessage(current_cr_rev, new_cr_rev,
+ current_git_number, new_git_number,
changed_deps, clang_change)
logging.debug('Commit message:\n%s', commit_msg)
else:
- logging.info('No deps changes detected when rolling from %s to %s. '
- 'Aborting without action.', current_cr_rev, opts.revision)
+ logging.info('Currently pinned chromium_revision: %s (#%s) is newer than '
+ '%s (#%s). To roll to older revisions, you must pass the '
+ '--allow-reverse flag.\n'
+ 'Aborting without action.', current_cr_rev, current_git_number,
+ new_cr_rev, new_git_number)
return 0
_CreateRollBranch(opts.dry_run)
- UpdateDeps(deps_filename, current_cr_rev, opts.revision)
+ UpdateDeps(deps_filename, current_cr_rev, new_cr_rev)
_LocalCommit(commit_msg, opts.dry_run)
_UploadCL(opts.dry_run)
_LaunchTrybots(opts.dry_run, opts.skip_try)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698