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

Side by Side Diff: webkit/tools/merge/merge.py

Issue 20289: On Windows, find all modified files after a WebKit merge and force them... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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 | « webkit/tools/merge/diff3-wrapper.py ('k') | 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 """Does a webkit merge to tip of tree WebKit or a revision 6 """Does a webkit merge to tip of tree WebKit or a revision
7 specified on the command line. Looks at trunk/src/WEBKIT_MERGE_REVISION 7 specified on the command line. Looks at trunk/src/WEBKIT_MERGE_REVISION
8 to find the repository and revision to merge from. 8 to find the repository and revision to merge from.
9 9
10 Example usage: 10 Example usage:
11 merge.py 11 merge.py
12 merge.py --new_revision 12345 12 merge.py --new_revision 12345
13 merge.py --diff3-tool kdiff3 13 merge.py --diff3-tool kdiff3
14 14
15 """ 15 """
16 16
17 import optparse 17 import optparse
18 import os 18 import os
19 import re 19 import re
20 import subprocess 20 import subprocess
21 import sys
21 import xml.dom.minidom 22 import xml.dom.minidom
22 23
23 import google.path_utils 24 import google.path_utils
24 25
25 class Merger(object): 26 class Merger(object):
26 """ Does svn merges. """ 27 """ Does svn merges. """
27 28
28 DIFF3_WRAPPER_PATH = os.path.join('..', '..', 'webkit', 'tools', 'merge', 29 DIFF3_WRAPPER_PATH = os.path.join('..', '..', 'webkit', 'tools', 'merge',
29 'diff3-wrapper.bat') 30 'diff3-wrapper.bat')
30 31
(...skipping 30 matching lines...) Expand all
61 command.append("--diff3-cmd") 62 command.append("--diff3-cmd")
62 command.append(self.DIFF3_WRAPPER_PATH) 63 command.append(self.DIFF3_WRAPPER_PATH)
63 command.append("-x") 64 command.append("-x")
64 command.append("--use-%s" % self._diff3_tool) 65 command.append("--use-%s" % self._diff3_tool)
65 print ' '.join(command) 66 print ' '.join(command)
66 if not self._is_dry_run: 67 if not self._is_dry_run:
67 returncode = subprocess.call(command, cwd=self._webkit_root, shell=True) 68 returncode = subprocess.call(command, cwd=self._webkit_root, shell=True)
68 if returncode != 0: 69 if returncode != 0:
69 raise "Are you sure you're running SVN 1.5? svn --version to check" 70 raise "Are you sure you're running SVN 1.5? svn --version to check"
70 71
72 # On Windows, find modified files and force them to LF. We trust dos2unix
73 # not to change binary files.
74 if sys.platform == 'win32':
75 command = [self._svn, "status", "--xml", directory]
76 print ' '.join(command)
77 info = subprocess.Popen(command, cwd=self._webkit_root, shell=True,
78 stdout=subprocess.PIPE).communicate()[0]
79 dom = xml.dom.minidom.parseString(info)
80 for entry in dom.getElementsByTagName("entry"):
81 file_path = entry.getAttribute("path")
82 type = os.path.splitext(file_path)[-1]
83 status = (entry.getElementsByTagName('wc-status')[0]
84 .getAttribute('item'))
85 # TODO(pamg): Is this the same in non-English svn?
86 if status == "modified":
87 command = ["dos2unix.exe", file_path]
88 if self._is_dry_run:
89 print ' '.join(command)
90 else:
91 subprocess.call('dos2unix.exe %s' % file_path,
ojan 2009/02/12 02:21:00 shouldn't this be using command?
92 cwd=self._webkit_root, shell=True)
93
94
71 def GetCurrentRepositoryAndRevision(webkit_merge_revision_path): 95 def GetCurrentRepositoryAndRevision(webkit_merge_revision_path):
72 """ Gets the repository and revision we're currently merged to according to 96 """ Gets the repository and revision we're currently merged to according to
73 the WEBKIT_MERGE_REVISION file checked in. 97 the WEBKIT_MERGE_REVISION file checked in.
74 98
75 Args: 99 Args:
76 webkit_merge_revision_path: path to WEBKIT_MERGE_REVISION file. 100 webkit_merge_revision_path: path to WEBKIT_MERGE_REVISION file.
77 """ 101 """
78 contents = open(webkit_merge_revision_path).read().strip() 102 contents = open(webkit_merge_revision_path).read().strip()
79 split_contents = contents.split("@") 103 split_contents = contents.split("@")
80 return {'repository': split_contents[0], 'old_revision': split_contents[1]} 104 return {'repository': split_contents[0], 'old_revision': split_contents[1]}
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 help="Optional. Revision to merge to. Tip of tree " 197 help="Optional. Revision to merge to. Tip of tree "
174 "revision will be used if omitted.") 198 "revision will be used if omitted.")
175 option_parser.add_option("", "--dry-run", action="store_true", default=False, 199 option_parser.add_option("", "--dry-run", action="store_true", default=False,
176 help="Print out actions the merge would take, but " 200 help="Print out actions the merge would take, but "
177 "don't actually do them.") 201 "don't actually do them.")
178 option_parser.add_option("", "--svn", default="svn", 202 option_parser.add_option("", "--svn", default="svn",
179 help="Path to svn executable, if it's not in your " 203 help="Path to svn executable, if it's not in your "
180 "PATH.") 204 "PATH.")
181 options, args = option_parser.parse_args() 205 options, args = option_parser.parse_args()
182 main(options, args) 206 main(options, args)
OLDNEW
« no previous file with comments | « webkit/tools/merge/diff3-wrapper.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698