25
25
from __future__ import print_function
26
26
27
27
import contextlib
28
+ import datetime
28
29
import fnmatch
29
30
import getpass
30
31
import glob
@@ -349,8 +350,7 @@ def compare_unittests(args):
349
350
350
351
def run_cpython_test (raw_args ):
351
352
test_args = ['-v' ]
352
- import argparse
353
- parser = argparse .ArgumentParser ()
353
+ parser = ArgumentParser ()
354
354
parser .add_argument ('--all' , action = 'store_true' )
355
355
parser .add_argument ('--gvm' , dest = 'vm' , action = 'store_const' , const = 'gvm' )
356
356
parser .add_argument ('--svm' , dest = 'vm' , action = 'store_const' , const = 'svm' )
@@ -1562,14 +1562,22 @@ def update_import(name, suite_py, rev="origin/master"):
1562
1562
1563
1563
def update_import_cmd (args ):
1564
1564
"""Update our imports"""
1565
+
1566
+ parser = ArgumentParser ()
1567
+ parser .add_argument ('--graal-rev' , default = '' )
1568
+ parser .add_argument ('--graal-enterprise-rev' , default = '' )
1569
+ parser .add_argument ('--no-pull' , action = 'store_true' )
1570
+ args = parser .parse_args (args )
1571
+
1565
1572
join = os .path .join
1566
1573
vc = SUITE .vc
1567
1574
1568
1575
current_branch = vc .active_branch (SUITE .dir )
1569
- if current_branch == "master" :
1570
- mx .abort ("updating imports should be done on a branch" )
1571
1576
if vc .isDirty (SUITE .dir ):
1572
1577
mx .abort ("updating imports should be done on a clean branch" )
1578
+ if current_branch == "master" :
1579
+ vc .git_command (SUITE .dir , ["checkout" , "-b" , f"update/GR-21590/{ datetime .datetime .now ().strftime ('%d%m%y' )} " ])
1580
+ current_branch = vc .active_branch (SUITE .dir )
1573
1581
1574
1582
suite_py_files = []
1575
1583
local_names = []
@@ -1613,7 +1621,7 @@ def update_import_cmd(args):
1613
1621
mx .abort ("overlays repo must be clean" )
1614
1622
overlaybranch = vc .active_branch (overlaydir )
1615
1623
if overlaybranch == "master" :
1616
- if "--no-pull" not in args :
1624
+ if not args . no_pull :
1617
1625
vc .pull (overlaydir )
1618
1626
vc .set_branch (overlaydir , current_branch , with_remote = False )
1619
1627
vc .git_command (overlaydir , ["checkout" , current_branch ], abortOnError = True )
@@ -1637,7 +1645,16 @@ def update_import_cmd(args):
1637
1645
# now update all imports
1638
1646
for name in imports_to_update :
1639
1647
for idx , suite_py in enumerate (suite_py_files ):
1640
- revisions [name ] = update_import (name , suite_py , rev = ("HEAD" if (idx or "--no-pull" in args ) else "origin/master" ))
1648
+ repo_name = os .path .basename (mx .VC .get_vc_root (os .path .dirname (suite_py ))[1 ])
1649
+ if idx or not args .no_pull :
1650
+ rev = "HEAD"
1651
+ elif repo_name == "graal" and args .graal_rev :
1652
+ rev = args .graal_rev
1653
+ elif repo_name == "graal-enterprise" and args .graal_enterprise_rev :
1654
+ rev = args .graal_enterprise_rev
1655
+ else :
1656
+ rev = "origin/master"
1657
+ revisions [name ] = update_import (name , suite_py , rev = rev )
1641
1658
1642
1659
# copy files we inline from our imports
1643
1660
shutil .copy (
@@ -1680,7 +1697,7 @@ def update_import_cmd(args):
1680
1697
repos_updated .append (repo )
1681
1698
1682
1699
# push all repos
1683
- if "--no-push" not in args :
1700
+ if not args . no_push :
1684
1701
for repo in repos_updated :
1685
1702
try :
1686
1703
mx ._opts .very_verbose = True
0 commit comments