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

Side by Side Diff: webkit/tools/merge/diff3-wrapper.py

Issue 17387: Ensure that merged files use LF rather than CRLF. This will hopefully keep th... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/env python 1 #!/bin/env python
2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Wrapper around BeyondCompare so it can be used as svn's diff3-cmd tool. 6 """Wrapper around BeyondCompare or kdiff3 so it can be used as svn's diff3-cmd
7 tool.
7 8
8 The basic idea here is based heavily off of diffwrap.py at: 9 The basic idea here is based heavily off of diffwrap.py at:
9 http://svnbook.red-bean.com/en/1.5/svn.advanced.externaldifftools.html#svn.advan ced.externaldifftools.diff3.ex-1 10 http://svnbook.red-bean.com/en/1.5/svn.advanced.externaldifftools.html#svn.advan ced.externaldifftools.diff3.ex-1
10 """ 11 """
11 12
12 import optparse 13 import optparse
13 import os 14 import os
14 import subprocess 15 import subprocess
15 import sys 16 import sys
16 17
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 # TODO(ojan): Maybe fall back to diff3? 88 # TODO(ojan): Maybe fall back to diff3?
88 raise Exception, "Must specify a diff tool to use." 89 raise Exception, "Must specify a diff tool to use."
89 90
90 value = subprocess.call(cmd, stdout=subprocess.PIPE) 91 value = subprocess.call(cmd, stdout=subprocess.PIPE)
91 92
92 # After performing the merge, this script needs to print the contents 93 # After performing the merge, this script needs to print the contents
93 # of the merged file to stdout. 94 # of the merged file to stdout.
94 # Return an errorcode of 0 on successful merge, 1 if unresolved conflicts 95 # Return an errorcode of 0 on successful merge, 1 if unresolved conflicts
95 # remain in the result. Any other errorcode will be treated as fatal. 96 # remain in the result. Any other errorcode will be treated as fatal.
96 merged_file_contents = open(mine).read() 97 merged_file_contents = open(mine).read()
98
99 # Ensure that the file doesn't use CRLF, in case the diff program converted
100 # line endings.
101 merged_file_contents.replace('\r\n', '\n')
102
97 # For reasons I don't understand, an extra line break gets added at the end 103 # For reasons I don't understand, an extra line break gets added at the end
98 # of the file. Strip it. 104 # of the file. Strip it.
99 merged_file_contents = merged_file_contents[:len(merged_file_contents)-1] 105 merged_file_contents = merged_file_contents[:-1]
100 print merged_file_contents 106 print merged_file_contents
101 sys.exit(value) 107 sys.exit(value)
102 108
103 if '__main__' == __name__: 109 if '__main__' == __name__:
104 main(sys.argv) 110 main(sys.argv)
OLDNEW
« 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