summaryrefslogtreecommitdiffstats
path: root/webkit/tools/merge
diff options
context:
space:
mode:
authoreseidel@chromium.org <eseidel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-27 18:02:30 +0000
committereseidel@chromium.org <eseidel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-27 18:02:30 +0000
commitccfeb68b76b69525f757dc54f01787cf26fe6e2a (patch)
treed4a2877620db426e4ee7f8556b9fd3cf0dedbe2a /webkit/tools/merge
parentdba77366bce1b53842a4e7c4c50a4693aa7cb5c9 (diff)
downloadchromium_src-ccfeb68b76b69525f757dc54f01787cf26fe6e2a.zip
chromium_src-ccfeb68b76b69525f757dc54f01787cf26fe6e2a.tar.gz
chromium_src-ccfeb68b76b69525f757dc54f01787cf26fe6e2a.tar.bz2
Fix the merge diff3 wrapper to work around a python subprocess bug on windows
TBR(ojan) Ojan wrote this with me and we tested it together Review URL: http://codereview.chromium.org/19023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8728 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/merge')
-rwxr-xr-xwebkit/tools/merge/diff3-wrapper.py26
1 files changed, 21 insertions, 5 deletions
diff --git a/webkit/tools/merge/diff3-wrapper.py b/webkit/tools/merge/diff3-wrapper.py
index c35b7a9..c179358 100755
--- a/webkit/tools/merge/diff3-wrapper.py
+++ b/webkit/tools/merge/diff3-wrapper.py
@@ -14,6 +14,7 @@ import optparse
import os
import subprocess
import sys
+import traceback
CYGDRIVE = '/cygdrive/'
CYGLEN = len(CYGDRIVE)
@@ -87,15 +88,24 @@ def main(args):
else:
# TODO(ojan): Maybe fall back to diff3?
raise Exception, "Must specify a diff tool to use."
-
- value = subprocess.call(cmd, stdout=subprocess.PIPE)
+
+ try:
+ # Work around http://bugs.python.org/issue3905
+ # by passing stderr and stdin as well since beyondcompare is a GUI app
+ return_code = subprocess.call(cmd,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ stdin=subprocess.PIPE,
+ shell=True)
+ except Exception,e:
+ print "Error running " + (" ".join(cmd))
+ traceback.print_exc(file=sys.stdout)
# After performing the merge, this script needs to print the contents
# of the merged file to stdout.
# Return an errorcode of 0 on successful merge, 1 if unresolved conflicts
# remain in the result. Any other errorcode will be treated as fatal.
merged_file_contents = open(mine).read()
-
# Ensure that the file doesn't use CRLF, in case the diff program converted
# line endings.
merged_file_contents.replace('\r\n', '\n')
@@ -104,7 +114,13 @@ def main(args):
# of the file. Strip it.
merged_file_contents = merged_file_contents[:-1]
print merged_file_contents
- sys.exit(value)
+ return return_code
if '__main__' == __name__:
- main(sys.argv) \ No newline at end of file
+ try:
+ return_code = main(sys.argv)
+ except Exception,e:
+ traceback.print_exc(file=sys.stdout)
+ # diff3 uses '1' to mean "conflict" and 2 to mean "I barfed".
+ sys.exit(2) # return "I barfed"
+ sys.exit(return_code)