Changeset 45469 in webkit
- Timestamp:
- Jul 1, 2009 11:54:37 PM (15 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r45464 r45469 1 2009-07-01 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 bugzilla-tool fails for SVN users 6 https://bugs.webkit.org/show_bug.cgi?id=26914 7 8 To fix this I moved svn from -F - to using -m 9 In order for -m to work I had to move us off of shell=True 10 To move off of shell=True all call sites for run_command 11 which take args, need to pass their args as an list instead of a string. 12 13 In order for the final bug update to work correctly, I had to 14 abstract the way that we parse out revision numbers from the commit text. 15 16 * Scripts/bugzilla-tool: 17 * Scripts/modules/scm.py: 18 1 19 2009-07-01 Eric Seidel <eric@webkit.org> 2 20 -
trunk/WebKitTools/Scripts/bugzilla-tool
r45405 r45469 206 206 self.apply_patches(patches, tool.scm(), options.local_commit) 207 207 208 def bug_comment_from_commit_text(commit_text): 209 comment_lines = [] 210 commit_lines = commit_text.splitlines() 211 for line in commit_lines: 212 comment_lines.append(line) 213 match = re.match("^Committed r(\d+)$", line) 214 if match: 215 revision = match.group(1) 216 comment_lines.append("http://trac.webkit.org/changeset/" + revision) 217 break 218 return "\n".join(comment_lines) 219 208 def bug_comment_from_commit_text(scm, commit_text): 209 match = re.search(scm.commit_success_regexp(), commit_text, re.MULTILINE) 210 svn_revision = match.group('svn_revision') 211 commit_text += ("\nhttp://trac.webkit.org/changeset/%s" % svn_revision) 212 return commit_text 220 213 221 214 class LandAndUpdateBug(Command): … … 318 311 commit_message = commit_message_for_this_commit(scm) 319 312 commit_log = scm.commit_with_message(commit_message) 320 return bug_comment_from_commit_text( commit_log)313 return bug_comment_from_commit_text(scm, commit_log) 321 314 322 315 @classmethod -
trunk/WebKitTools/Scripts/modules/scm.py
r45368 r45469 60 60 61 61 @staticmethod 62 def run_command( command, cwd=None, input=None, raise_on_failure=True, return_exit_code=False):62 def run_command(args, cwd=None, input=None, raise_on_failure=True, return_exit_code=False): 63 63 stdin = subprocess.PIPE if input else None 64 process = subprocess.Popen( command, stdout=subprocess.PIPE, stdin=stdin, shell=True, cwd=cwd)64 process = subprocess.Popen(args, stdout=subprocess.PIPE, stdin=stdin, cwd=cwd) 65 65 output = process.communicate(input)[0].rstrip() 66 66 exit_code = process.wait() … … 121 121 raise NotImplementedError, "subclasses must implement" 122 122 123 @staticmethod 124 def commit_success_regexp(): 125 raise NotImplementedError, "subclasses must implement" 126 123 127 def working_directory_is_clean(self): 124 128 raise NotImplementedError, "subclasses must implement" … … 147 151 # Subclasses must indicate if they support local commits, 148 152 # but the SCM baseclass will only call local_commits methods when this is true. 149 def supports_local_commits(self): 153 @staticmethod 154 def supports_local_commits(): 150 155 raise NotImplementedError, "subclasses must implement" 151 156 … … 179 184 return None 180 185 186 @staticmethod 187 def commit_success_regexp(): 188 return "^Committed revision (?P<svn_revision>\d+)\.$" 189 181 190 def svn_version(self): 182 191 if not self.cached_version: 183 self.cached_version = self.run_command( "svn --version --quiet")192 self.cached_version = self.run_command(['svn', '--version', '--quiet']) 184 193 185 194 return self.cached_version 186 195 187 196 def working_directory_is_clean(self): 188 return self.run_command( "svn diff") == ""197 return self.run_command(['svn', 'diff']) == "" 189 198 190 199 def clean_working_directory(self): 191 self.run_command( "svn revert -R .")200 self.run_command(['svn', 'revert', '-R', '.']) 192 201 193 202 def update_webkit(self): … … 195 204 196 205 def status_command(self): 197 return 'svn status'206 return ['svn', 'status'] 198 207 199 208 def changed_files(self): … … 204 213 return self.run_status_and_extract_filenames(self.status_command(), status_regexp) 205 214 206 def supports_local_commits(self): 215 @staticmethod 216 def supports_local_commits(): 207 217 return False 208 218 … … 216 226 if self.dryrun: 217 227 return "Dry run, no remote commit." 218 return self.run_command( 'svn commit -F -', input=message)228 return self.run_command(['svn', 'commit', '-m', message]) 219 229 220 230 # All git-specific logic should go here. … … 225 235 @classmethod 226 236 def in_working_directory(cls, path): 227 return cls.run_command( "git rev-parse --is-inside-work-tree 2>&1", cwd=path) == "true"237 return cls.run_command(['git', 'rev-parse', '--is-inside-work-tree'], cwd=path) == "true" 228 238 229 239 @classmethod 230 240 def find_checkout_root(cls, path): 231 241 # "git rev-parse --show-cdup" would be another way to get to the root 232 (checkout_root, dot_git) = os.path.split(cls.run_command( "git rev-parse --git-dir", cwd=path))242 (checkout_root, dot_git) = os.path.split(cls.run_command(['git', 'rev-parse', '--git-dir'], cwd=path)) 233 243 # If we were using 2.6 # checkout_root = os.path.relpath(checkout_root, path) 234 244 if not os.path.isabs(checkout_root): # Sometimes git returns relative paths … … 236 246 return checkout_root 237 247 248 @staticmethod 249 def commit_success_regexp(): 250 return "^Committed r(?P<svn_revision>\d+)$" 251 238 252 def discard_local_commits(self): 239 self.run_command( "git reset --hard trunk")253 self.run_command(['git', 'reset', '--hard', 'trunk']) 240 254 241 255 def local_commits(self): 242 return self.run_command( "git log --pretty=oneline head...trunk").splitlines()243 256 return self.run_command('git', 'log', '--pretty=oneline', 'HEAD...trunk').splitlines() 257 244 258 def working_directory_is_clean(self): 245 return self.run_command( "git diff-index HEAD") == ""259 return self.run_command(['git', 'diff-index', 'HEAD']) == "" 246 260 247 261 def clean_working_directory(self): 248 262 # Could run git clean here too, but that wouldn't match working_directory_is_clean 249 self.run_command( "git reset --hard HEAD")263 self.run_command(['git', 'reset', '--hard', 'HEAD']) 250 264 251 265 def update_webkit(self): 252 266 # FIXME: Should probably call update-webkit, no? 253 267 log("Updating working directory") 254 self.run_command( "git svn rebase")268 self.run_command(['git', 'svn', 'rebase']) 255 269 256 270 def status_command(self): 257 return 'git status'271 return ['git', 'status'] 258 272 259 273 def changed_files(self): 260 status_command = 'git diff -r --name-status -C -M HEAD'274 status_command = ['git', 'diff', '-r', '--name-status', '-C', '-M', 'HEAD'] 261 275 status_regexp = '^(?P<status>[ADM])\t(?P<filename>.+)$' 262 276 return self.run_status_and_extract_filenames(status_command, status_regexp) 263 277 264 def supports_local_commits(self): 278 @staticmethod 279 def supports_local_commits(): 265 280 return True 266 281 … … 269 284 270 285 def create_patch(self): 271 return self.run_command( "git diff HEAD")286 return self.run_command(['git', 'diff', 'HEAD']) 272 287 273 288 def commit_with_message(self, message): … … 278 293 279 294 def commit_locally_with_message(self, message): 280 self.run_command( 'git commit -a -F -', input=message)295 self.run_command(['git', 'commit', '--all', '-F', '-'], input=message) 281 296 282 297 def push_local_commits_to_server(self): 283 298 if self.dryrun: 284 299 return "Dry run, no remote commit." 285 return self.run_command( 'git svn dcommit')300 return self.run_command(['git', 'svn', 'dcommit']) 286 301 287 302 def commit_ids_from_range_arguments(self, args, cherry_pick=False): 288 303 # First get the commit-ids for the passed in revisions. 289 rev_parse_args = ['git', 'rev-parse', '--revs-only'] + args 290 revisions = self.run_command(" ".join(rev_parse_args)).splitlines() 291 304 revisions = self.run_command(['git', 'rev-parse', '--revs-only'] + args).splitlines() 305 292 306 if cherry_pick: 293 307 return revisions 294 308 295 309 # If we're not cherry picking and were only passed one revision, assume "^revision head" aka "revision..head". 296 310 if len(revisions) < 2: 297 311 revisions[0] = "^" + revisions[0] 298 312 revisions.append("HEAD") 299 300 rev_list_args = ['git', 'rev-list'] + revisions 301 return self.run_command(" ".join(rev_list_args)).splitlines() 313 314 return self.run_command(['git', 'rev-list'] + revisions).splitlines() 302 315 303 316 def commit_message_for_commit(self, commit_id): 304 commit_lines = self.run_command( "git cat-file commit " + commit_id).splitlines()317 commit_lines = self.run_command(['git', 'cat-file', 'commit', commit_id]).splitlines() 305 318 306 319 # Skip the git headers. … … 312 325 return "\n".join(commit_lines[first_line_after_headers:]) 313 326 314 def show_diff_command_for_commit(self, commit_id):315 return "git diff-tree -p " + commit_id316 317 327 def files_changed_summary_for_commit(self, commit_id): 318 return self.run_command( "git diff-tree --shortstat --no-commit-id " + commit_id)328 return self.run_command(['git', 'diff-tree', '--shortstat', '--no-commit-id', commit_id])
Note: See TracChangeset
for help on using the changeset viewer.