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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/steps/confirmdiff.py

Issue 1837103002: Make "webkit-patch pretty-diff" work under Cygwin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove comment Created 4 years, 8 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
« 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 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 Options.confirm, 45 Options.confirm,
46 ] 46 ]
47 47
48 def _show_pretty_diff(self): 48 def _show_pretty_diff(self):
49 if not self._tool.user.can_open_url(): 49 if not self._tool.user.can_open_url():
50 return None 50 return None
51 51
52 try: 52 try:
53 pretty_patch = PrettyPatch(self._tool.executive) 53 pretty_patch = PrettyPatch(self._tool.executive)
54 pretty_diff_file = pretty_patch.pretty_diff_file(self.diff()) 54 pretty_diff_file = pretty_patch.pretty_diff_file(self.diff())
55 url = "file://%s" % urllib.quote(pretty_diff_file.name) 55 self._open_pretty_diff(pretty_diff_file.name)
56 self._tool.user.open_url(url) 56
57 # We return the pretty_diff_file here because we need to keep the 57 # We return the pretty_diff_file here because we need to keep the
58 # file alive until the user has had a chance to confirm the diff. 58 # file alive until the user has had a chance to confirm the diff.
59 return pretty_diff_file 59 return pretty_diff_file
60 except ScriptError, e: 60 except ScriptError, e:
61 _log.warning("PrettyPatch failed. :(") 61 _log.warning("PrettyPatch failed. :(")
62 except OSError, e: 62 except OSError, e:
63 _log.warning("PrettyPatch unavailable.") 63 _log.warning("PrettyPatch unavailable.")
64 64
65 def _open_pretty_diff(self, file_path):
66 if self._tool.platform.is_cygwin():
67 assert file_path.endswith('.html')
68 self._tool.executive.run_command(['cygstart', file_path])
69 return
70 url = "file://%s" % urllib.quote(file_path)
71 self._tool.user.open_url(url)
72
65 def diff(self): 73 def diff(self):
66 changed_files = self._tool.scm().changed_files(self._options.git_commit) 74 changed_files = self._tool.scm().changed_files(self._options.git_commit)
67 return self._tool.scm().create_patch(self._options.git_commit, 75 return self._tool.scm().create_patch(self._options.git_commit,
68 changed_files=changed_files) 76 changed_files=changed_files)
69 77
70 def run(self, state): 78 def run(self, state):
71 if not self._options.confirm: 79 if not self._options.confirm:
72 return 80 return
73 pretty_diff_file = self._show_pretty_diff() 81 pretty_diff_file = self._show_pretty_diff()
74 if pretty_diff_file: 82 if pretty_diff_file:
75 diff_correct = self._tool.user.confirm("Was that diff correct?") 83 diff_correct = self._tool.user.confirm("Was that diff correct?")
76 pretty_diff_file.close() 84 pretty_diff_file.close()
77 if not diff_correct: 85 if not diff_correct:
78 self._exit(1) 86 self._exit(1)
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