@@ -1530,7 +1530,7 @@ def delete_self_if_testdownstream(args):
1530
1530
shutil .rmtree (SUITE .dir , ignore_errors = True )
1531
1531
1532
1532
1533
- def update_import (name , suite_py , rev = "origin/master" ):
1533
+ def update_import (name , suite_py , args ):
1534
1534
parent = os .path .join (SUITE .dir , ".." )
1535
1535
dep_dir = None
1536
1536
for dirpath , dirnames , _ in os .walk (parent ):
@@ -1543,9 +1543,16 @@ def update_import(name, suite_py, rev="origin/master"):
1543
1543
mx .warn ("could not find suite %s to update" % name )
1544
1544
return
1545
1545
vc = mx .VC .get_vc (dep_dir )
1546
- if rev != "HEAD" :
1547
- vc .pull (dep_dir , update = False )
1548
- vc .update (dep_dir , rev = rev )
1546
+ repo_name = os .path .basename (dep_dir )
1547
+ if repo_name == "graal" and args .graal_rev :
1548
+ rev = args .graal_rev
1549
+ elif repo_name == "graal-enterprise" and args .graal_enterprise_rev :
1550
+ rev = args .graal_enterprise_rev
1551
+ elif idx or not args .no_pull :
1552
+ rev = "HEAD"
1553
+ else :
1554
+ rev = "origin/master"
1555
+ vc .update (dep_dir , rev = rev , mayPull = True )
1549
1556
tip = str (vc .tip (dep_dir )).strip ()
1550
1557
contents = None
1551
1558
with open (suite_py , 'r' ) as f :
@@ -1567,13 +1574,14 @@ def update_import_cmd(args):
1567
1574
parser .add_argument ('--graal-rev' , default = '' )
1568
1575
parser .add_argument ('--graal-enterprise-rev' , default = '' )
1569
1576
parser .add_argument ('--no-pull' , action = 'store_true' )
1577
+ parser .add_argument ('--allow-dirty' , action = 'store_true' )
1570
1578
args = parser .parse_args (args )
1571
1579
1572
1580
join = os .path .join
1573
1581
vc = SUITE .vc
1574
1582
1575
1583
current_branch = vc .active_branch (SUITE .dir )
1576
- if vc .isDirty (SUITE .dir ):
1584
+ if vc .isDirty (SUITE .dir ) and not args . allow_dirty :
1577
1585
mx .abort ("updating imports should be done on a clean branch" )
1578
1586
if current_branch == "master" :
1579
1587
vc .git_command (SUITE .dir , ["checkout" , "-b" , f"update/GR-21590/{ datetime .datetime .now ().strftime ('%d%m%y' )} " ])
@@ -1601,7 +1609,7 @@ def update_import_cmd(args):
1601
1609
1602
1610
# make sure all other repos are clean and on the same branch
1603
1611
for d in repos :
1604
- if vc .isDirty (d ):
1612
+ if vc .isDirty (d ) and not args . allow_dirty :
1605
1613
mx .abort ("repo %s is not clean" % d )
1606
1614
d_branch = vc .active_branch (d )
1607
1615
if d_branch == current_branch :
@@ -1617,7 +1625,7 @@ def update_import_cmd(args):
1617
1625
if not os .path .exists (overlaydir ):
1618
1626
mx .abort ("Overlays repo must be next to graalpython repo" )
1619
1627
vc = mx .VC .get_vc (overlaydir )
1620
- if vc .isDirty (overlaydir ):
1628
+ if vc .isDirty (overlaydir ) and not args . allow_dirty :
1621
1629
mx .abort ("overlays repo must be clean" )
1622
1630
overlaybranch = vc .active_branch (overlaydir )
1623
1631
if overlaybranch == "master" :
@@ -1645,16 +1653,7 @@ def update_import_cmd(args):
1645
1653
# now update all imports
1646
1654
for name in imports_to_update :
1647
1655
for idx , suite_py in enumerate (suite_py_files ):
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 )
1656
+ revisions [name ] = update_import (name , suite_py , args )
1658
1657
1659
1658
# copy files we inline from our imports
1660
1659
shutil .copy (
0 commit comments