summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpamg@google.com <pamg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-18 19:10:06 +0000
committerpamg@google.com <pamg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-18 19:10:06 +0000
commit5752b6ba9850f6479f5d1e1f6b78d92116591434 (patch)
treecb47a277baa1f43116eec1fe56a6f5ebeb406888
parent5c184a6845df0c3a75f8e2f28e71ab25e5f6f535 (diff)
downloadchromium_src-5752b6ba9850f6479f5d1e1f6b78d92116591434.zip
chromium_src-5752b6ba9850f6479f5d1e1f6b78d92116591434.tar.gz
chromium_src-5752b6ba9850f6479f5d1e1f6b78d92116591434.tar.bz2
Add a .bat script wrapper for the Python diff3 wrapper so it can be called
successfully from svn in Cygwin. (Some people were able to use the .py wrapper directly, but I can't. I suspect it has to do with file mappings in Windows.) Change merge.py to use the .bat script, add an --svn option to specify the path to the right svn executable, and strip trailing whitespace. Review URL: http://codereview.chromium.org/14830 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7241 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/tools/merge/diff3-wrapper.bat10
-rwxr-xr-xwebkit/tools/merge/merge.py54
2 files changed, 40 insertions, 24 deletions
diff --git a/webkit/tools/merge/diff3-wrapper.bat b/webkit/tools/merge/diff3-wrapper.bat
new file mode 100644
index 0000000..3881884
--- /dev/null
+++ b/webkit/tools/merge/diff3-wrapper.bat
@@ -0,0 +1,10 @@
+@ECHO off
+
+:: Copyright (c) 2006-2008 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 around diff3-wrapper.py so it can be called from svn.
+
+python %~dp0diff3-wrapper.py %*
+exit /B %ERRORLEVEL%
diff --git a/webkit/tools/merge/merge.py b/webkit/tools/merge/merge.py
index 2dbd187..613a324 100755
--- a/webkit/tools/merge/merge.py
+++ b/webkit/tools/merge/merge.py
@@ -3,7 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""Does a webkit merge to tip of tree WebKit or a revision
+"""Does a webkit merge to tip of tree WebKit or a revision
specified on the command line. Looks at trunk/src/WEBKIT_MERGE_REVISION
to find the repository and revision to merge from.
@@ -30,12 +30,12 @@ DEPS_PATHS_TO_UPDATE = [
class Merger(object):
""" Does svn merges. """
-
- DIFF3_WRAPPER_PATH = os.path.join('..', '..', 'webkit', 'tools', 'merge',
- 'diff3-wrapper.py')
-
- def __init__(self, repository, webkit_root, old_revision,
- new_revision, is_dry_run, diff3_tool=None):
+
+ DIFF3_WRAPPER_PATH = os.path.join('..', '..', 'webkit', 'tools', 'merge',
+ 'diff3-wrapper.bat')
+
+ def __init__(self, repository, webkit_root, old_revision,
+ new_revision, is_dry_run, svn_path='svn', diff3_tool=None):
"""
Args:
repository: the repository that we are merging to/from.
@@ -45,6 +45,7 @@ class Merger(object):
new_revision: the revision we are merging to.
is_dry_run: whether to actually make changes or just print intended
changes.
+ svn_path: the path to the svn executable (or find it in the user's path)
diff3_tool: the tool for doing 3-way diffs.
"""
self._repository = repository
@@ -53,13 +54,14 @@ class Merger(object):
self._new_revision = new_revision
self._is_dry_run = is_dry_run
self._diff3_tool = diff3_tool
+ self._svn = svn_path
def MergeDirectory(self, directory):
""" Merges the given directory in the repository into the same directory
in the working copy.
"""
- command = ["svn", "merge", "--accept", "edit", "-r",
- "%s:%s" % (self._old_revision, self._new_revision),
+ command = [self._svn, "merge", "--accept", "edit", "-r",
+ "%s:%s" % (self._old_revision, self._new_revision),
"%s/%s" % (self._repository, directory), directory]
if self._diff3_tool is not None:
command.append("--diff3-cmd")
@@ -74,7 +76,7 @@ class Merger(object):
def GetCurrentRepositoryAndRevision(webkit_merge_revision_path):
""" Gets the repository and revision we're currently merged to according to
the WEBKIT_MERGE_REVISION file checked in.
-
+
Args:
webkit_merge_revision_path: path to WEBKIT_MERGE_REVISION file.
"""
@@ -82,19 +84,20 @@ def GetCurrentRepositoryAndRevision(webkit_merge_revision_path):
split_contents = contents.split("@")
return {'repository': split_contents[0], 'old_revision': split_contents[1]}
-def GetTipOfTreeRevision(repository):
- """ Gets the tip-of-tree revision for the repository.
+def GetTipOfTreeRevision(svn, repository):
+ """ Gets the tip-of-tree revision for the repository.
"""
- info = subprocess.Popen(["svn", "info", "--xml", repository], shell=True,
+ info = subprocess.Popen([svn, "info", "--xml", repository],
+ shell=True,
stdout=subprocess.PIPE).communicate()[0]
dom = xml.dom.minidom.parseString(info)
return dom.getElementsByTagName('entry')[0].getAttribute('revision')
-def UpdateWebKitMergeRevision(webkit_merge_revision_path, repository,
+def UpdateWebKitMergeRevision(webkit_merge_revision_path, repository,
new_revision, is_dry_run):
""" Updates the checked in WEBKIT_MERGE_REVISION file with the repository
and revision we just merged to.
-
+
Args:
webkit_merge_revision_path: path to WEBKIT_MERGE_REVISION file.
repository: repository we've merged to.
@@ -120,7 +123,7 @@ def UpdateDeps(deps_path, new_revision, is_dry_run):
else:
print "Updating %s" % deps_path
open(deps_path, "w").write(contents)
-
+
def Sync(is_dry_run):
sync_command = ["gclient", "sync"]
if is_dry_run:
@@ -131,13 +134,13 @@ def Sync(is_dry_run):
def main(options, args):
""" Does the merge and updates WEBKIT_MERGE_REVISION.
-
+
Args:
options: a dictionary of commandline arguments.
args: currently unused.
"""
Sync(options.dry_run)
-
+
webkit_merge_revision_path = google.path_utils.FindUpward(
google.path_utils.ScriptDir(), 'WEBKIT_MERGE_REVISION')
@@ -145,20 +148,20 @@ def main(options, args):
webkit_merge_revision_path)
repository = repository_and_revision['repository']
old_revision = repository_and_revision['old_revision']
-
+
if options.new_revision:
new_revision = options.new_revision
else:
- new_revision = GetTipOfTreeRevision(repository)
+ new_revision = GetTipOfTreeRevision(options.svn, repository)
webkit_root = google.path_utils.FindUpward(google.path_utils.ScriptDir(),
'third_party', 'WebKit')
- merger = Merger(repository, webkit_root, old_revision, new_revision,
- options.dry_run, options.diff3_tool)
+ merger = Merger(repository, webkit_root, old_revision, new_revision,
+ options.dry_run, options.svn, options.diff3_tool)
merger.MergeDirectory("JavaScriptCore")
merger.MergeDirectory("WebCore")
-
+
UpdateWebKitMergeRevision(webkit_merge_revision_path, repository,
new_revision, options.dry_run)
deps_path = google.path_utils.FindUpward(
@@ -174,7 +177,10 @@ if '__main__' == __name__:
help="Optional. Revision to merge to. Tip of tree "
"revision will be used if omitted.")
option_parser.add_option("", "--dry-run", action="store_true", default=False,
- help="Print out actions the merge would take, but"
+ help="Print out actions the merge would take, but "
"don't actually do them.")
+ option_parser.add_option("", "--svn", default="svn",
+ help="Path to svn executable, if it's not in your "
+ "PATH.")
options, args = option_parser.parse_args()
main(options, args)