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

Unified Diff: third_party/crashpad/update.py

Issue 2722063003: Exclude codereview.settings from Crashpad (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/crashpad/crashpad/codereview.settings ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/crashpad/update.py
diff --git a/third_party/crashpad/update.py b/third_party/crashpad/update.py
index aade8b0c76954a7bf318490b6224f17d8f000728..ee792fbe479eeef3fe7da1f1a1e90b2e49b263df 100755
--- a/third_party/crashpad/update.py
+++ b/third_party/crashpad/update.py
@@ -14,6 +14,8 @@ import tempfile
import textwrap
+EXCLUDED_FILES = ['codereview.settings']
+
IS_WINDOWS = sys.platform.startswith('win')
@@ -107,6 +109,36 @@ def main(args):
revision_old,
parsed.update_to)
+ cherry_pick_start_head = original_head
+
+ # Put excluded files back at the old revision, so that any changes to them
+ # can be made during the update. They’ll be deleted again before the update
+ # is committed.
+ git_root = subprocess.check_output(['git', 'rev-parse', '--show-toplevel'],
+ shell=IS_WINDOWS).rstrip()
+ excluded_full_paths = []
+ for excluded_file in EXCLUDED_FILES:
+ contents = subprocess.check_output(
+ ['git', 'cat-file', 'blob', revision_old + ':' + excluded_file],
scottmg 2017/03/01 18:38:15 I can imagine this mucking up newlines on Windows,
+ shell=IS_WINDOWS)
+ excluded_full_path = \
agable 2017/03/01 20:50:54 Don't use \ for line continuations, use parenthese
+ os.path.join(git_root, parsed.subtree, excluded_file)
+ excluded_full_paths.append(excluded_full_path)
+ with open(excluded_full_path, 'wbx') as file:
scottmg 2017/03/01 18:38:15 I've never used 'x' before, why is it useful here?
Mark Mentovai 2017/03/01 21:00:36 scottmg wrote:
+ file.write(contents)
+ if excluded_full_paths:
+ add_cmd = ['git', 'add']
+ add_cmd.extend(excluded_full_paths)
+ subprocess.check_call(add_cmd, shell=IS_WINDOWS)
+ commit_cmd = ['git', 'commit', '--message', 'Restore excluded files']
+ commit_cmd.extend(excluded_full_paths)
+ subprocess.check_call(commit_cmd, shell=IS_WINDOWS)
+
+ # Cherry-picking will begin from here.
+ cherry_pick_start_head = (
+ subprocess.check_output(['git', 'rev-parse', 'HEAD'],
+ shell=IS_WINDOWS).rstrip())
+
update_range = revision_old + '..' + parsed.update_to
# This cherry-picks each change in the window from the upstream project into
@@ -150,7 +182,8 @@ Press ^C to abort.
# If the user had to help, count the number of cherry-picked commits,
# expecting it to match.
cherry_picked_commits = int(subprocess.check_output(
- ['git', 'rev-list', '--count', original_head + '..HEAD']))
+ ['git', 'rev-list', '--count', cherry_pick_start + '..HEAD'],
+ shell=IS_WINDOWS))
if cherry_picked_commits != len(log_lines):
print >>sys.stderr, 'Something smells fishy, aborting anyway...'
subprocess.call(['git', 'cherry-pick', '--abort'], shell=IS_WINDOWS)
@@ -196,14 +229,34 @@ Press ^C to abort.
'HEAD:' + parsed.subtree]):
has_local_modifications = False
+ if not EXCLUDED_FILES:
+ modifications = 'None.'
+ elif len(EXCLUDED_FILES) == 1:
+ modifications = \
+ ' - %s has been excluded.' % EXCLUDED_FILES[0]
+ else:
+ modifications =\
+ ' - The following files have been excluded:'
+ for excluded_file in sorted(EXCLUDED_FILES):
+ modifications += '\n - ' + excluded_file
readme_content_new = re.sub(r'\nLocal Modifications:\n.*$',
- '\nLocal Modifications:\nNone.',
+ '\nLocal Modifications:\n' + modifications,
readme_content_new,
1)
- # This soft-reset causes all of the cherry-picks to show up as staged,
- # which will have the effect of squashing them along with the README update
- # when committed below.
+ # Remove excluded files as promised.
+ if excluded_full_paths:
+ rm_cmd = ['git', 'rm']
+ rm_cmd.extend(excluded_full_paths)
+ subprocess.check_call(rm_cmd, shell=IS_WINDOWS)
+ commit_cmd = ['git', 'commit', '--message', 'Remove excluded files']
+ commit_cmd.extend(excluded_full_paths)
+ subprocess.check_call(commit_cmd, shell=IS_WINDOWS)
+
+ # This soft-reset causes all of the cherry-picks and any additions and
+ # removals of excluded files to show up as staged, which will have the
+ # effect of squashing them along with the README update when committed
+ # below.
subprocess.check_call(['git', 'reset', '--soft', original_head],
shell=IS_WINDOWS)
« no previous file with comments | « third_party/crashpad/crashpad/codereview.settings ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698