Commit 0e30595a authored by tony@chromium.org's avatar tony@chromium.org

Add a git command for running ToT WebKit patches against the trybots.

This is basically a wrapper script for running a WebKit change against
the try bots.  It can be run from within third_party/WebKit and will try to apply the patch against ToT WebKit.

This tells the try server we want to use ToT WebKit by passing third_party/WebKit@HEAD as the first line of the patch file.

BUG=None
Review URL: https://codereview.chromium.org/12226013

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@181972 0039d316-1c4b-4281-b951-d872f2087c98
parent 6683ab4c
#!/bin/sh
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Test if this script is running under a MSys install. If it is, we will
# hardcode the path to Python where possible.
OUTPUT="$(uname | grep 'MINGW')"
MINGW=$?
if [ $MINGW = 0 ]; then
base_dir="${0%\\*}"
else
base_dir=$(dirname "$0")
fi
if [ -d "$base_dir/python_bin" -a $MINGW = 0 ]; then
PYTHONDONTWRITEBYTECODE=1 exec "$base_dir/python_bin/python.exe" "$base_dir"/git_wktry.py "$@"
else
PYTHONDONTWRITEBYTECODE=1 exec "$base_dir/git_wktry.py" "$@"
fi
#!/usr/bin/python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Wrapper for trychange.py for WebKit changes."""
import errno
import logging
import os
import sys
import tempfile
import git_cl
from scm import GIT
import trychange
class ScopedTemporaryFile(object):
def __init__(self, **kwargs):
file_handle, self._path = tempfile.mkstemp(**kwargs)
os.close(file_handle)
def __enter__(self):
return self._path
def __exit__(self, type, value, traceback):
try:
os.remove(self._path)
except OSError, e:
if e.errno != errno.ENOENT:
raise e
def generateDiff(path_to_write, chromium_src_root):
"""Create the diff file to send to the try server. We prepend the WebKit
revision to the beginning of the diff so we can patch against ToT or other
versions of WebKit."""
diff_lines = ['third_party/WebKit@HEAD\n']
raw_diff = GIT.GenerateDiff(os.path.join(chromium_src_root,
'third_party/WebKit'), full_move=True).splitlines(True)
diff_lines.extend(trychange.GetMungedDiff('third_party/WebKit',
raw_diff)[0])
open(path_to_write, 'wb').write(''.join(diff_lines))
def addLayoutBotsIfNeeded(argv):
for flag in argv:
if flag == '--bot' or flag.startswith('--bot=') or flag.startswith('-b'):
return argv
argv.extend(('--bot', 'linux_layout_rel,mac_layout_rel,win_layout_rel'))
def chromiumSrcRoot():
root = GIT.GetCheckoutRoot('.')
parent_path, leaf_path = os.path.split(root)
if leaf_path == 'WebKit':
root = GIT.GetCheckoutRoot(parent_path)
return root
def main(argv):
chromium_src_root = chromiumSrcRoot()
os.chdir(chromium_src_root)
argv = argv[1:]
addLayoutBotsIfNeeded(argv)
with ScopedTemporaryFile() as diff_file:
generateDiff(diff_file, chromium_src_root)
args = [
'--sub_rep', 'third_party/WebKit',
'--root', 'src',
'--rietveld_url', 'https://codereview.chromium.org',
'--diff', diff_file,
]
args.extend(argv)
cl = git_cl.Changelist()
change = cl.GetChange(cl.GetUpstreamBranch(), None)
logging.getLogger().handlers = []
return trychange.TryChange(args, change,
swallow_exception=False, prog='git wktry')
if __name__ == '__main__':
sys.exit(main(sys.argv))
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