src/platform/dev: cros format everything
Run cros format on all files. This allows us to enable the check in
pre-upload (done in the follow-on CL).
BUG=none
TEST=none
Change-Id: I7af3847104cc67378851376ce65a61b06faaa715
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/4237542
Tested-by: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Jesse McGuire <jessemcguire@google.com>
Auto-Submit: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Alex Klein <saklein@chromium.org>
diff --git a/contrib/upstream_diff.py b/contrib/upstream_diff.py
index 94a7c45..e0c10c5 100755
--- a/contrib/upstream_diff.py
+++ b/contrib/upstream_diff.py
@@ -2,6 +2,7 @@
# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+
"""Compare local cherry-picks with upstream SHA1s.
This script compares local and UPSTREAM change by pulling
@@ -20,51 +21,65 @@
"""
import re
-import sys
from subprocess import call
+import sys
+
+
commit_start = 0
patchid = 1
-l_sha = ''
+l_sha = ""
-f = open(sys.argv[1], 'r')
+f = open(sys.argv[1], "r")
for line in f.readlines():
- if l_sha != '':
+ if l_sha != "":
# first line with leading white space is description
- if l_descr != '':
- if re.match('^ .*$', line):
+ if l_descr != "":
+ if re.match("^ .*$", line):
l_descr = line.strip()
- if l_descr[0:8] != 'UPSTREAM:':
- print('----------------------')
- print('Skipping !UPSTREAM ' + l_sha[0:9] + ' ' + l_descr)
- l_sha = ''
- l_descr = ''
+ if l_descr[0:8] != "UPSTREAM:":
+ print("----------------------")
+ print("Skipping !UPSTREAM " + l_sha[0:9] + " " + l_descr)
+ l_sha = ""
+ l_descr = ""
continue
- if re.match(r'^ \(cherry picked from commit ([0-9a-f]+)', line, remote_sha):
+ if re.match(
+ r"^ \(cherry picked from commit ([0-9a-f]+)", line, remote_sha
+ ):
remote_words = line.split()
- remote_sha = remote_words[4].split(')')
+ remote_sha = remote_words[4].split(")")
r_sha = remote_sha[0]
- r_sha_file = '%3d' % patchid + '_' + r_sha + '.patch'
- l_sha_file = '%3d' % patchid + '_' + l_sha + '.patch'
+ r_sha_file = "%3d" % patchid + "_" + r_sha + ".patch"
+ l_sha_file = "%3d" % patchid + "_" + l_sha + ".patch"
patchid += 1
- print('----------------------')
- print('Comparing ' + l_sha[0:9] + ' ' + l_descr + ' AND ' \
- + r_sha[0:9])
- print('meld', r_sha_file, l_sha_file)
- call('git format-patch -1 ' + l_sha + ' --stdout > ' + l_sha_file,
- shell=True)
- call('git format-patch -1 ' + r_sha + ' --stdout > ' + r_sha_file,
- shell=True)
- call('meld ' + l_sha_file + ' ' + r_sha_file, shell=True)
- l_sha = ''
- l_descr = ''
+ print("----------------------")
+ print(
+ "Comparing "
+ + l_sha[0:9]
+ + " "
+ + l_descr
+ + " AND "
+ + r_sha[0:9]
+ )
+ print("meld", r_sha_file, l_sha_file)
+ call(
+ "git format-patch -1 " + l_sha + " --stdout > " + l_sha_file,
+ shell=True,
+ )
+ call(
+ "git format-patch -1 " + r_sha + " --stdout > " + r_sha_file,
+ shell=True,
+ )
+ call("meld " + l_sha_file + " " + r_sha_file, shell=True)
+ l_sha = ""
+ l_descr = ""
- if re.match('^commit *', line):
- if l_sha != '':
- print('No cherry picked SHA1 in ' + l_sha[0:9] + ' ' + l_descr)
+ if re.match("^commit *", line):
+ if l_sha != "":
+ print("No cherry picked SHA1 in " + l_sha[0:9] + " " + l_descr)
words = line.split()
l_sha = words[1]
- l_descr = ''
+ l_descr = ""