libv8 6.2.414.42.1 → 6.3.292.48.0beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/libv8/version.rb +1 -1
- data/vendor/depot_tools/PRESUBMIT.py +38 -0
- data/vendor/depot_tools/bootstrap/win/manifest.txt +3 -1
- data/vendor/depot_tools/bootstrap/win/manifest_bleeding_edge.txt +2 -0
- data/vendor/depot_tools/checkout.py +1 -1
- data/vendor/depot_tools/cipd_manifest.txt +1 -1
- data/vendor/depot_tools/gclient_scm.py +23 -14
- data/vendor/depot_tools/gerrit_util.py +15 -10
- data/vendor/depot_tools/git_cl.py +23 -11
- data/vendor/depot_tools/git_drover.py +2 -1
- data/vendor/depot_tools/git_upstream_diff.py +2 -1
- data/vendor/depot_tools/gsutil.py +1 -1
- data/vendor/depot_tools/infra/config/recipes.cfg +1 -1
- data/vendor/depot_tools/presubmit_canned_checks.py +8 -1
- data/vendor/depot_tools/presubmit_support.py +2 -1
- data/vendor/depot_tools/recipes/README.recipes.md +56 -43
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/__init__.py +1 -0
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/api.py +1 -4
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/basic_luci.json +105 -0
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.py +5 -0
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/__init__.py +6 -0
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/api.py +25 -0
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/examples/full.expected/basic.json +12 -0
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/examples/full.expected/basic_luci.json +75 -0
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/examples/full.expected/win.json +12 -0
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/examples/full.py +10 -1
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/api.py +13 -11
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch.json +2 -0
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch_luci.json +2 -0
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_rietveld_patch.json +2 -0
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_rietveld_patch_new.json +2 -0
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch.json +2 -0
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch_new.json +2 -0
- data/vendor/depot_tools/recipes/trigger_recipe_roller.txt +1 -0
- data/vendor/depot_tools/roll_dep.py +116 -78
- data/vendor/depot_tools/scm.py +6 -4
- data/vendor/depot_tools/split_cl.py +45 -18
- metadata +7 -5
- data/patches/0005-avoid-constructor-inheritance-due-to-compilation-iss.patch +0 -81
@@ -55,6 +55,18 @@
|
|
55
55
|
],
|
56
56
|
"name": "presubmit_support_py_path"
|
57
57
|
},
|
58
|
+
{
|
59
|
+
"cmd": [
|
60
|
+
"echo",
|
61
|
+
"$PATH"
|
62
|
+
],
|
63
|
+
"env_prefixes": {
|
64
|
+
"PATH": [
|
65
|
+
"RECIPE_PACKAGE_REPO[depot_tools]"
|
66
|
+
]
|
67
|
+
},
|
68
|
+
"name": "on_path"
|
69
|
+
},
|
58
70
|
{
|
59
71
|
"name": "$result",
|
60
72
|
"recipe_result": null,
|
@@ -4,9 +4,10 @@
|
|
4
4
|
|
5
5
|
DEPS = [
|
6
6
|
'depot_tools',
|
7
|
-
'recipe_engine/step',
|
8
7
|
'recipe_engine/path',
|
9
8
|
'recipe_engine/platform',
|
9
|
+
'recipe_engine/runtime',
|
10
|
+
'recipe_engine/step',
|
10
11
|
]
|
11
12
|
|
12
13
|
|
@@ -36,8 +37,16 @@ def RunSteps(api):
|
|
36
37
|
'presubmit_support_py_path',
|
37
38
|
['ls', api.depot_tools.presubmit_support_py_path])
|
38
39
|
|
40
|
+
with api.depot_tools.on_path():
|
41
|
+
api.step('on_path', ['echo', '$PATH'])
|
42
|
+
|
39
43
|
|
40
44
|
def GenTests(api):
|
41
45
|
yield api.test('basic')
|
42
46
|
|
47
|
+
yield (
|
48
|
+
api.test('basic_luci')
|
49
|
+
+ api.runtime(is_experimental=False, is_luci=True)
|
50
|
+
)
|
51
|
+
|
43
52
|
yield api.test('win') + api.platform('win', 32)
|
@@ -63,12 +63,13 @@ class TryserverApi(recipe_api.RecipeApi):
|
|
63
63
|
|
64
64
|
cwd = self.m.context.cwd or self.m.path['start_dir'].join(patch_root)
|
65
65
|
with self.m.context(cwd=cwd):
|
66
|
-
step_result = self.m.git(
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
66
|
+
step_result = self.m.git(
|
67
|
+
'-c', 'core.quotePath=false', 'diff', '--cached', '--name-only',
|
68
|
+
name='git diff to analyze patch',
|
69
|
+
stdout=self.m.raw_io.output(),
|
70
|
+
step_test_data=lambda:
|
71
|
+
self.m.raw_io.test_api.stream_output('foo.cc'),
|
72
|
+
**kwargs)
|
72
73
|
paths = [self.m.path.join(patch_root, p) for p in
|
73
74
|
step_result.stdout.split()]
|
74
75
|
if self.m.platform.is_win:
|
@@ -84,11 +85,12 @@ class TryserverApi(recipe_api.RecipeApi):
|
|
84
85
|
cwd = self.m.path['checkout'].join(issue_root) if issue_root else None
|
85
86
|
|
86
87
|
with self.m.context(cwd=cwd):
|
87
|
-
step_result = self.m.git(
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
88
|
+
step_result = self.m.git(
|
89
|
+
'-c', 'core.quotePath=false', 'diff', '--cached', '--name-only',
|
90
|
+
name='git diff to analyze patch',
|
91
|
+
stdout=self.m.raw_io.output(),
|
92
|
+
step_test_data=lambda:
|
93
|
+
self.m.raw_io.test_api.stream_output('foo.cc'))
|
92
94
|
paths = step_result.stdout.split()
|
93
95
|
if issue_root:
|
94
96
|
paths = [self.m.path.join(issue_root, path) for path in paths]
|
@@ -0,0 +1 @@
|
|
1
|
+
No-op file. Edit this to kick recipes.
|
@@ -68,58 +68,26 @@ def should_show_log(upstream_url):
|
|
68
68
|
return True
|
69
69
|
|
70
70
|
|
71
|
-
def
|
72
|
-
|
73
|
-
|
71
|
+
def get_deps(root):
|
72
|
+
"""Returns the path and the content of the DEPS file."""
|
73
|
+
deps_path = os.path.join(root, 'DEPS')
|
74
74
|
try:
|
75
|
-
with open(
|
75
|
+
with open(deps_path, 'rb') as f:
|
76
76
|
deps_content = f.read()
|
77
77
|
except (IOError, OSError):
|
78
78
|
raise Error('Ensure the script is run in the directory '
|
79
79
|
'containing DEPS file.')
|
80
|
+
return deps_path, deps_content
|
80
81
|
|
81
|
-
if not ignore_dirty_tree and not is_pristine(root):
|
82
|
-
raise Error('Ensure %s is clean first (no non-merged commits).' % root)
|
83
|
-
|
84
|
-
full_dir = os.path.normpath(os.path.join(os.path.dirname(root), deps_dir))
|
85
|
-
if not os.path.isdir(full_dir):
|
86
|
-
raise Error('Directory not found: %s (%s)' % (deps_dir, full_dir))
|
87
|
-
head = check_output(['git', 'rev-parse', 'HEAD'], cwd=full_dir).strip()
|
88
|
-
|
89
|
-
if not head in deps_content:
|
90
|
-
print('Warning: %s is not checked out at the expected revision in DEPS' %
|
91
|
-
deps_dir)
|
92
|
-
if key is None:
|
93
|
-
print("Warning: no key specified. Using '%s'." % deps_dir)
|
94
|
-
key = deps_dir
|
95
|
-
|
96
|
-
# It happens if the user checked out a branch in the dependency by himself.
|
97
|
-
# Fall back to reading the DEPS to figure out the original commit.
|
98
|
-
for i in deps_content.splitlines():
|
99
|
-
m = re.match(r'\s+"' + key + '":.*"([a-z0-9]{40})",', i)
|
100
|
-
if m:
|
101
|
-
head = m.group(1)
|
102
|
-
break
|
103
|
-
else:
|
104
|
-
raise Error('Expected to find commit %s for %s in DEPS' % (head, key))
|
105
|
-
|
106
|
-
print('Found old revision %s' % head)
|
107
|
-
|
108
|
-
check_call(['git', 'fetch', 'origin', '--quiet'], cwd=full_dir)
|
109
|
-
roll_to = check_output(['git', 'rev-parse', roll_to], cwd=full_dir).strip()
|
110
|
-
print('Found new revision %s' % roll_to)
|
111
|
-
|
112
|
-
if roll_to == head:
|
113
|
-
raise AlreadyRolledError('No revision to roll!')
|
114
82
|
|
83
|
+
def generate_commit_message(
|
84
|
+
full_dir, dependency, head, roll_to, no_log, log_limit):
|
85
|
+
"""Creates the commit message for this specific roll."""
|
115
86
|
commit_range = '%s..%s' % (head[:9], roll_to[:9])
|
116
|
-
|
117
87
|
upstream_url = check_output(
|
118
88
|
['git', 'config', 'remote.origin.url'], cwd=full_dir).strip()
|
119
89
|
log_url = get_log_url(upstream_url, head, roll_to)
|
120
|
-
cmd = [
|
121
|
-
'git', 'log', commit_range, '--date=short', '--no-merges',
|
122
|
-
]
|
90
|
+
cmd = ['git', 'log', commit_range, '--date=short', '--no-merges']
|
123
91
|
logs = check_output(
|
124
92
|
cmd + ['--format=%ad %ae %s'], # Args with '=' are automatically quoted.
|
125
93
|
cwd=full_dir).rstrip()
|
@@ -130,16 +98,15 @@ def roll(root, deps_dir, roll_to, key, reviewers, bug, no_log, log_limit,
|
|
130
98
|
if not l.endswith('recipe-roller Roll recipe dependencies (trivial).')
|
131
99
|
]
|
132
100
|
logs = '\n'.join(cleaned_lines) + '\n'
|
101
|
+
|
133
102
|
nb_commits = len(lines)
|
134
103
|
rolls = nb_commits - len(cleaned_lines)
|
135
|
-
|
136
104
|
header = 'Roll %s/ %s (%d commit%s%s)\n\n' % (
|
137
|
-
|
105
|
+
dependency,
|
138
106
|
commit_range,
|
139
107
|
nb_commits,
|
140
108
|
's' if nb_commits > 1 else '',
|
141
109
|
('; %s trivial rolls' % rolls) if rolls else '')
|
142
|
-
|
143
110
|
log_section = ''
|
144
111
|
if log_url:
|
145
112
|
log_section = log_url + '\n\n'
|
@@ -152,34 +119,64 @@ def roll(root, deps_dir, roll_to, key, reviewers, bug, no_log, log_limit,
|
|
152
119
|
# Keep the first N log entries.
|
153
120
|
logs = ''.join(logs.splitlines(True)[:log_limit]) + '(...)\n'
|
154
121
|
log_section += logs
|
155
|
-
|
156
|
-
|
157
|
-
log_section += ' ' + key
|
158
|
-
log_section += '\n'
|
122
|
+
return header + log_section
|
123
|
+
|
159
124
|
|
160
|
-
|
161
|
-
|
162
|
-
|
125
|
+
def calculate_roll(full_dir, dependency, deps_content, roll_to, key):
|
126
|
+
"""Calculates the roll for a dependency by processing deps_content, and
|
127
|
+
fetching the dependency via git.
|
128
|
+
"""
|
129
|
+
head = check_output(['git', 'rev-parse', 'HEAD'], cwd=full_dir).strip()
|
130
|
+
if not head in deps_content:
|
131
|
+
print('Warning: %s is not checked out at the expected revision in DEPS' %
|
132
|
+
dependency)
|
133
|
+
if not key:
|
134
|
+
key = dependency
|
163
135
|
|
136
|
+
# It happens if the user checked out a branch in the dependency by himself.
|
137
|
+
# Fall back to reading the DEPS to figure out the original commit.
|
138
|
+
for i in deps_content.splitlines():
|
139
|
+
m = re.match(r'\s+"' + key + '":.*"([a-z0-9]{40})",', i)
|
140
|
+
if m:
|
141
|
+
head = m.group(1)
|
142
|
+
break
|
143
|
+
else:
|
144
|
+
raise Error('Expected to find commit %s for %s in DEPS' % (head, key))
|
145
|
+
|
146
|
+
check_call(['git', 'fetch', 'origin', '--quiet'], cwd=full_dir)
|
147
|
+
roll_to = check_output(['git', 'rev-parse', roll_to], cwd=full_dir).strip()
|
148
|
+
return head, roll_to
|
149
|
+
|
150
|
+
|
151
|
+
def gen_commit_msg(logs, cmdline, rolls, reviewers, bug):
|
152
|
+
"""Returns the final commit message."""
|
153
|
+
commit_msg = ''
|
154
|
+
if len(logs) > 1:
|
155
|
+
commit_msg = 'Rolling %d dependencies\n\n' % len(logs)
|
156
|
+
commit_msg += '\n\n'.join(logs)
|
157
|
+
commit_msg += '\nCreated with:\n ' + cmdline
|
158
|
+
commit_msg += 'R=%s\n' % ','.join(reviewers) if reviewers else ''
|
159
|
+
commit_msg += 'BUG=%s\n' % bug if bug else ''
|
160
|
+
return commit_msg
|
161
|
+
|
162
|
+
|
163
|
+
def finalize(commit_msg, deps_path, deps_content, rolls):
|
164
|
+
"""Edits the DEPS file, commits it, then uploads a CL."""
|
164
165
|
print('Commit message:')
|
165
|
-
print('\n'.join(' ' + i for i in
|
166
|
-
|
167
|
-
with open(
|
166
|
+
print('\n'.join(' ' + i for i in commit_msg.splitlines()))
|
167
|
+
|
168
|
+
with open(deps_path, 'wb') as f:
|
168
169
|
f.write(deps_content)
|
170
|
+
root = os.path.dirname(deps_path)
|
169
171
|
check_call(['git', 'add', 'DEPS'], cwd=root)
|
170
|
-
check_call(['git', 'commit', '--quiet', '-m',
|
172
|
+
check_call(['git', 'commit', '--quiet', '-m', commit_msg], cwd=root)
|
171
173
|
|
172
174
|
# Pull the dependency to the right revision. This is surprising to users
|
173
175
|
# otherwise.
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
print('You forgot to pass -r, make sure to insert a R=foo@example.com line')
|
179
|
-
print('to the commit description before emailing.')
|
180
|
-
print('')
|
181
|
-
print('Run:')
|
182
|
-
print(' git cl upload --send-mail')
|
176
|
+
for dependency, (_head, roll_to) in sorted(rolls.iteritems()):
|
177
|
+
full_dir = os.path.normpath(
|
178
|
+
os.path.join(os.path.dirname(root), dependency))
|
179
|
+
check_call(['git', 'checkout', '--quiet', roll_to], cwd=full_dir)
|
183
180
|
|
184
181
|
|
185
182
|
def main():
|
@@ -203,11 +200,19 @@ def main():
|
|
203
200
|
parser.add_argument(
|
204
201
|
'--roll-to', default='origin/master',
|
205
202
|
help='Specify the new commit to roll to (default: %(default)s)')
|
206
|
-
parser.add_argument(
|
207
|
-
|
208
|
-
help='
|
203
|
+
parser.add_argument(
|
204
|
+
'--key', action='append', default=[],
|
205
|
+
help='Regex(es) for dependency in DEPS file')
|
206
|
+
parser.add_argument('dep_path', nargs='+', help='Path(s) to dependency')
|
209
207
|
args = parser.parse_args()
|
210
208
|
|
209
|
+
if len(args.dep_path) > 1:
|
210
|
+
if args.roll_to != 'origin/master':
|
211
|
+
parser.error(
|
212
|
+
'Can\'t use multiple paths to roll simultaneously and --roll-to')
|
213
|
+
if args.key:
|
214
|
+
parser.error(
|
215
|
+
'Can\'t use multiple paths to roll simultaneously and --key')
|
211
216
|
reviewers = None
|
212
217
|
if args.reviewer:
|
213
218
|
reviewers = args.reviewer.split(',')
|
@@ -215,22 +220,55 @@ def main():
|
|
215
220
|
if not '@' in r:
|
216
221
|
reviewers[i] = r + '@chromium.org'
|
217
222
|
|
223
|
+
root = os.getcwd()
|
224
|
+
dependencies = sorted(d.rstrip('/').rstrip('\\') for d in args.dep_path)
|
225
|
+
cmdline = 'roll-dep ' + ' '.join(dependencies) + ''.join(
|
226
|
+
' --key ' + k for k in args.key)
|
218
227
|
try:
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
228
|
+
if not args.ignore_dirty_tree and not is_pristine(root):
|
229
|
+
raise Error('Ensure %s is clean first (no non-merged commits).' % root)
|
230
|
+
# First gather all the information without modifying anything, except for a
|
231
|
+
# git fetch.
|
232
|
+
deps_path, deps_content = get_deps(root)
|
233
|
+
rolls = {}
|
234
|
+
for dependency in dependencies:
|
235
|
+
full_dir = os.path.normpath(
|
236
|
+
os.path.join(os.path.dirname(root), dependency))
|
237
|
+
if not os.path.isdir(full_dir):
|
238
|
+
raise Error('Directory not found: %s (%s)' % (dependency, full_dir))
|
239
|
+
head, roll_to = calculate_roll(
|
240
|
+
full_dir, dependency, deps_content, args.roll_to, args.key)
|
241
|
+
if roll_to == head:
|
242
|
+
if len(dependencies) == 1:
|
243
|
+
raise AlreadyRolledError('No revision to roll!')
|
244
|
+
print('%s: Already at latest commit %s' % (dependency, roll_to))
|
245
|
+
else:
|
246
|
+
print(
|
247
|
+
'%s: Rolling from %s to %s' % (dependency, head[:10], roll_to[:10]))
|
248
|
+
rolls[dependency] = (head, roll_to)
|
249
|
+
|
250
|
+
logs = []
|
251
|
+
for dependency, (head, roll_to) in sorted(rolls.iteritems()):
|
252
|
+
full_dir = os.path.normpath(
|
253
|
+
os.path.join(os.path.dirname(root), dependency))
|
254
|
+
log = generate_commit_message(
|
255
|
+
full_dir, dependency, head, roll_to, args.no_log, args.log_limit)
|
256
|
+
logs.append(log)
|
257
|
+
deps_content = deps_content.replace(head, roll_to)
|
258
|
+
|
259
|
+
commit_msg = gen_commit_msg(logs, cmdline, rolls, reviewers, args.bug)
|
260
|
+
finalize(commit_msg, deps_path, deps_content, rolls)
|
230
261
|
except Error as e:
|
231
262
|
sys.stderr.write('error: %s\n' % e)
|
232
263
|
return 2 if isinstance(e, AlreadyRolledError) else 1
|
233
264
|
|
265
|
+
print('')
|
266
|
+
if not reviewers:
|
267
|
+
print('You forgot to pass -r, make sure to insert a R=foo@example.com line')
|
268
|
+
print('to the commit description before emailing.')
|
269
|
+
print('')
|
270
|
+
print('Run:')
|
271
|
+
print(' git cl upload --send-mail')
|
234
272
|
return 0
|
235
273
|
|
236
274
|
|
data/vendor/depot_tools/scm.py
CHANGED
@@ -131,8 +131,8 @@ class GIT(object):
|
|
131
131
|
upstream_branch = GIT.GetUpstreamBranch(cwd)
|
132
132
|
if upstream_branch is None:
|
133
133
|
raise gclient_utils.Error('Cannot determine upstream branch')
|
134
|
-
command = ['
|
135
|
-
'-r', '%s...' % upstream_branch]
|
134
|
+
command = ['-c', 'core.quotePath=false', 'diff',
|
135
|
+
'--name-status', '--no-renames', '-r', '%s...' % upstream_branch]
|
136
136
|
if not files:
|
137
137
|
pass
|
138
138
|
elif isinstance(files, basestring):
|
@@ -277,7 +277,8 @@ class GIT(object):
|
|
277
277
|
files, usually in the prospect to apply the patch for a try job."""
|
278
278
|
if not branch:
|
279
279
|
branch = GIT.GetUpstreamBranch(cwd)
|
280
|
-
command = ['
|
280
|
+
command = ['-c', 'core.quotePath=false', 'diff',
|
281
|
+
'-p', '--no-color', '--no-prefix', '--no-ext-diff',
|
281
282
|
branch + "..." + branch_head]
|
282
283
|
if full_move:
|
283
284
|
command.append('--no-renames')
|
@@ -300,7 +301,8 @@ class GIT(object):
|
|
300
301
|
"""Returns the list of modified files between two branches."""
|
301
302
|
if not branch:
|
302
303
|
branch = GIT.GetUpstreamBranch(cwd)
|
303
|
-
command = ['
|
304
|
+
command = ['-c', 'core.quotePath=false', 'diff',
|
305
|
+
'--name-only', branch + "..." + branch_head]
|
304
306
|
return GIT.Capture(command, cwd=cwd).splitlines(False)
|
305
307
|
|
306
308
|
@staticmethod
|
@@ -67,8 +67,7 @@ def AddUploadedByGitClSplitToDescription(description):
|
|
67
67
|
|
68
68
|
|
69
69
|
def UploadCl(refactor_branch, refactor_branch_upstream, directory, files,
|
70
|
-
|
71
|
-
cmd_upload):
|
70
|
+
description, comment, reviewers, changelist, cmd_upload):
|
72
71
|
"""Uploads a CL with all changes to |files| in |refactor_branch|.
|
73
72
|
|
74
73
|
Args:
|
@@ -77,14 +76,12 @@ def UploadCl(refactor_branch, refactor_branch_upstream, directory, files,
|
|
77
76
|
directory: Path to the directory that contains the OWNERS file for which
|
78
77
|
to upload a CL.
|
79
78
|
files: List of AffectedFile instances to include in the uploaded CL.
|
80
|
-
author: Email address of the user running this script.
|
81
79
|
description: Description of the uploaded CL.
|
82
80
|
comment: Comment to post on the uploaded CL.
|
83
|
-
|
81
|
+
reviewers: A set of reviewers for the CL.
|
84
82
|
changelist: The Changelist class.
|
85
83
|
cmd_upload: The function associated with the git cl upload command.
|
86
84
|
"""
|
87
|
-
|
88
85
|
# Create a branch.
|
89
86
|
if not CreateBranchForDirectory(
|
90
87
|
refactor_branch, directory, refactor_branch_upstream):
|
@@ -110,8 +107,6 @@ def UploadCl(refactor_branch, refactor_branch_upstream, directory, files,
|
|
110
107
|
os.remove(tmp_file.name)
|
111
108
|
|
112
109
|
# Upload a CL.
|
113
|
-
reviewers = owners_database.reviewers_for(
|
114
|
-
[f.LocalPath() for f in files], author)
|
115
110
|
upload_args = ['-f', '--cq-dry-run', '-r', ','.join(reviewers)]
|
116
111
|
if not comment:
|
117
112
|
upload_args.append('--send-mail')
|
@@ -136,7 +131,32 @@ def GetFilesSplitByOwners(owners_database, files):
|
|
136
131
|
return files_split_by_owners
|
137
132
|
|
138
133
|
|
139
|
-
def
|
134
|
+
def PrintClInfo(cl_index, num_cls, directory, file_paths, description,
|
135
|
+
reviewers):
|
136
|
+
"""Prints info about a CL.
|
137
|
+
|
138
|
+
Args:
|
139
|
+
cl_index: The index of this CL in the list of CLs to upload.
|
140
|
+
num_cls: The total number of CLs that will be uploaded.
|
141
|
+
directory: Path to the directory that contains the OWNERS file for which
|
142
|
+
to upload a CL.
|
143
|
+
file_paths: A list of files in this CL.
|
144
|
+
description: The CL description.
|
145
|
+
reviewers: A set of reviewers for this CL.
|
146
|
+
"""
|
147
|
+
description_lines = FormatDescriptionOrComment(description,
|
148
|
+
directory).splitlines()
|
149
|
+
indented_description = '\n'.join([' ' + l for l in description_lines])
|
150
|
+
|
151
|
+
print 'CL {}/{}'.format(cl_index, num_cls)
|
152
|
+
print 'Path: {}'.format(directory)
|
153
|
+
print 'Reviewers: {}'.format(', '.join(reviewers))
|
154
|
+
print '\n' + indented_description + '\n'
|
155
|
+
print '\n'.join(file_paths)
|
156
|
+
print
|
157
|
+
|
158
|
+
|
159
|
+
def SplitCl(description_file, comment_file, changelist, cmd_upload, dry_run):
|
140
160
|
""""Splits a branch into smaller branches and uploads CLs.
|
141
161
|
|
142
162
|
Args:
|
@@ -144,6 +164,7 @@ def SplitCl(description_file, comment_file, changelist, cmd_upload):
|
|
144
164
|
comment_file: File containing the comment of uploaded CLs.
|
145
165
|
changelist: The Changelist class.
|
146
166
|
cmd_upload: The function associated with the git cl upload command.
|
167
|
+
dry_run: Whether this is a dry run (no branches or CLs created).
|
147
168
|
|
148
169
|
Returns:
|
149
170
|
0 in case of success. 1 in case of error.
|
@@ -152,7 +173,7 @@ def SplitCl(description_file, comment_file, changelist, cmd_upload):
|
|
152
173
|
comment = ReadFile(comment_file) if comment_file else None
|
153
174
|
|
154
175
|
try:
|
155
|
-
EnsureInGitRepository()
|
176
|
+
EnsureInGitRepository()
|
156
177
|
|
157
178
|
cl = changelist()
|
158
179
|
change = cl.GetChange(cl.GetCommonAncestorWithUpstream(), None)
|
@@ -172,20 +193,26 @@ def SplitCl(description_file, comment_file, changelist, cmd_upload):
|
|
172
193
|
owners_database = owners.Database(change.RepositoryRoot(), file, os.path)
|
173
194
|
owners_database.load_data_needed_for([f.LocalPath() for f in files])
|
174
195
|
|
175
|
-
files_split_by_owners = GetFilesSplitByOwners(
|
176
|
-
owners_database, files)
|
196
|
+
files_split_by_owners = GetFilesSplitByOwners(owners_database, files)
|
177
197
|
|
178
|
-
|
179
|
-
|
198
|
+
num_cls = len(files_split_by_owners)
|
199
|
+
print('Will split current branch (' + refactor_branch + ') into ' +
|
200
|
+
str(num_cls) + ' CLs.\n')
|
180
201
|
|
181
|
-
for directory, files in
|
202
|
+
for cl_index, (directory, files) in \
|
203
|
+
enumerate(files_split_by_owners.iteritems(), 1):
|
182
204
|
# Use '/' as a path separator in the branch name and the CL description
|
183
205
|
# and comment.
|
184
206
|
directory = directory.replace(os.path.sep, '/')
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
207
|
+
file_paths = [f.LocalPath() for f in files]
|
208
|
+
reviewers = owners_database.reviewers_for(file_paths, author)
|
209
|
+
|
210
|
+
if dry_run:
|
211
|
+
PrintClInfo(cl_index, num_cls, directory, file_paths, description,
|
212
|
+
reviewers)
|
213
|
+
else:
|
214
|
+
UploadCl(refactor_branch, refactor_branch_upstream, directory, files,
|
215
|
+
description, comment, reviewers, changelist, cmd_upload)
|
189
216
|
|
190
217
|
# Go back to the original branch.
|
191
218
|
git.run('checkout', refactor_branch)
|