@@ -179,10 +179,17 @@ def create_patch(self, patch_name, message):
179
179
try :
180
180
self .hg ("qinit" )
181
181
except subprocess .CalledProcessError :
182
- # There is already a patch queue in this repo
183
- # Should only happen during development
184
182
pass
185
- self .hg ("qnew" , patch_name , "-X" , self .root , "-m" , message )
183
+
184
+ patch_names = [item .strip () for item in self .hg ("qseries" ).split ("\n " ) if item .strip ()]
185
+
186
+ suffix = 0
187
+ test_name = patch_name
188
+ while test_name in patch_names :
189
+ suffix += 1
190
+ test_name = "%s-%i" % (patch_name , suffix )
191
+
192
+ self .hg ("qnew" , test_name , "-X" , self .root , "-m" , message )
186
193
187
194
def update_patch (self , include = None ):
188
195
if include is not None :
@@ -227,9 +234,8 @@ def add_new(self, prefix=None):
227
234
self .git ("add" , * args )
228
235
229
236
def create_patch (self , patch_name , message ):
230
- # In git a patch is actually a branch
237
+ # In git a patch is actually a commit
231
238
self .message = message
232
- self .git ("checkout" , "-b" , patch_name )
233
239
234
240
def update_patch (self , include = None ):
235
241
assert self .message is not None
@@ -289,20 +295,27 @@ def sync_tests(paths, local_tree, wpt, bug):
289
295
return initial_manifest , new_manifest
290
296
291
297
292
- def update_metadata (paths , local_tree , wpt , initial_rev , bug , log_files , ignore_existing ):
298
+ def update_metadata (paths , local_tree , initial_rev , bug , log_files , ignore_existing ,
299
+ wpt_repo = None ):
293
300
try :
294
301
try :
295
- local_tree .create_patch ("web-platform-tests_update_%s_metadata" % wpt .rev ,
296
- "Update web-platform-tests expected data to revision %s" %
297
- wpt .rev )
302
+ if wpt_repo is not None :
303
+ name = "web-platform-tests_update_%s_metadata" % wpt_repo .rev
304
+ message = "Update web-platform-tests expected data to revision %s" % wpt_repo .rev
305
+ else :
306
+ name = "web-platform-tests_update_metadata"
307
+ message = "Update web-platform-tests expected data"
308
+
309
+ local_tree .create_patch (name , message )
298
310
except subprocess .CalledProcessError :
299
311
# Patch with that name already exists, probably
300
312
pass
301
- needs_human = metadata .update_expected (paths ["sync " ],
313
+ needs_human = metadata .update_expected (paths ["test " ],
302
314
paths ["metadata" ],
303
315
log_files ,
304
316
rev_old = initial_rev ,
305
- ignore_existing = ignore_existing )
317
+ ignore_existing = ignore_existing ,
318
+ sync_root = paths .get ("sync" , None ))
306
319
307
320
if needs_human :
308
321
#TODO: List all the files that should be checked carefully for changes.
@@ -321,10 +334,12 @@ def update_metadata(paths, local_tree, wpt, initial_rev, bug, log_files, ignore_
321
334
def run_update (** kwargs ):
322
335
config = kwargs ["config" ]
323
336
324
- paths = {"sync" : kwargs ["sync_path" ],
325
- "test" : kwargs ["tests_root" ],
337
+ paths = {"test" : kwargs ["tests_root" ],
326
338
"metadata" : kwargs ["metadata_root" ]}
327
339
340
+ if kwargs ["sync" ]:
341
+ paths ["sync" ] = kwargs ["sync_path" ]
342
+
328
343
for path in paths .itervalues ():
329
344
ensure_exists (path )
330
345
@@ -352,19 +367,26 @@ def run_update(**kwargs):
352
367
if rev is None :
353
368
rev = config ["web-platform-tests" ].get ("branch" , "master" )
354
369
355
- wpt = WebPlatformTests (config ["web-platform-tests" ]["remote_url" ],
356
- paths ["sync" ],
357
- rev = rev )
358
370
bug = None
359
371
360
372
initial_rev = None
373
+ wpt_repo = None
374
+
361
375
if kwargs ["sync" ]:
362
- initial_manifest , new_manifest = sync_tests (paths , local_tree , wpt , bug )
376
+ wpt_repo = WebPlatformTests (config ["web-platform-tests" ]["remote_url" ],
377
+ paths ["sync" ],
378
+ rev = rev )
379
+ initial_manifest , new_manifest = sync_tests (paths , local_tree , wpt_repo , bug )
363
380
initial_rev = initial_manifest .rev
364
381
365
382
if kwargs ["run_log" ]:
366
- update_metadata (paths , local_tree , wpt , initial_rev , bug ,
367
- kwargs ["run_log" ], kwargs ["ignore_existing" ])
383
+ update_metadata (paths ,
384
+ local_tree ,
385
+ initial_rev ,
386
+ bug ,
387
+ kwargs ["run_log" ],
388
+ kwargs ["ignore_existing" ],
389
+ wpt_repo = wpt_repo )
368
390
369
391
370
392
def main ():
0 commit comments