Skip to content

Commit 4ba144b

Browse files
committed
Update imports
1 parent 00d52dd commit 4ba144b

File tree

3 files changed

+21
-22
lines changed

3 files changed

+21
-22
lines changed

ci.jsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "overlay": "989cb319230450613f74359bd3264b0138a812c7" }
1+
{ "overlay": "87c17bab229edc2d8df5224121bf7e0081b14b09" }

mx.graalpython/mx_graalpython.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,7 +1530,7 @@ def delete_self_if_testdownstream(args):
15301530
shutil.rmtree(SUITE.dir, ignore_errors=True)
15311531

15321532

1533-
def update_import(name, suite_py, rev="origin/master"):
1533+
def update_import(name, suite_py, args):
15341534
parent = os.path.join(SUITE.dir, "..")
15351535
dep_dir = None
15361536
for dirpath, dirnames, _ in os.walk(parent):
@@ -1543,9 +1543,16 @@ def update_import(name, suite_py, rev="origin/master"):
15431543
mx.warn("could not find suite %s to update" % name)
15441544
return
15451545
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)
15491556
tip = str(vc.tip(dep_dir)).strip()
15501557
contents = None
15511558
with open(suite_py, 'r') as f:
@@ -1567,13 +1574,14 @@ def update_import_cmd(args):
15671574
parser.add_argument('--graal-rev', default='')
15681575
parser.add_argument('--graal-enterprise-rev', default='')
15691576
parser.add_argument('--no-pull', action='store_true')
1577+
parser.add_argument('--allow-dirty', action='store_true')
15701578
args = parser.parse_args(args)
15711579

15721580
join = os.path.join
15731581
vc = SUITE.vc
15741582

15751583
current_branch = vc.active_branch(SUITE.dir)
1576-
if vc.isDirty(SUITE.dir):
1584+
if vc.isDirty(SUITE.dir) and not args.allow_dirty:
15771585
mx.abort("updating imports should be done on a clean branch")
15781586
if current_branch == "master":
15791587
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):
16011609

16021610
# make sure all other repos are clean and on the same branch
16031611
for d in repos:
1604-
if vc.isDirty(d):
1612+
if vc.isDirty(d) and not args.allow_dirty:
16051613
mx.abort("repo %s is not clean" % d)
16061614
d_branch = vc.active_branch(d)
16071615
if d_branch == current_branch:
@@ -1617,7 +1625,7 @@ def update_import_cmd(args):
16171625
if not os.path.exists(overlaydir):
16181626
mx.abort("Overlays repo must be next to graalpython repo")
16191627
vc = mx.VC.get_vc(overlaydir)
1620-
if vc.isDirty(overlaydir):
1628+
if vc.isDirty(overlaydir) and not args.allow_dirty:
16211629
mx.abort("overlays repo must be clean")
16221630
overlaybranch = vc.active_branch(overlaydir)
16231631
if overlaybranch == "master":
@@ -1645,16 +1653,7 @@ def update_import_cmd(args):
16451653
# now update all imports
16461654
for name in imports_to_update:
16471655
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)
16581657

16591658
# copy files we inline from our imports
16601659
shutil.copy(

mx.graalpython/suite.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,31 +44,31 @@
4444
},
4545
{
4646
"name": "sdk",
47-
"version": "0f5a0938132440a8eac56b56320f09552cba4076",
47+
"version": "15807fb796282bbc975bf82cb80b95d6c5f178ef",
4848
"subdir": True,
4949
"urls": [
5050
{"url": "https://github.com/oracle/graal", "kind": "git"},
5151
]
5252
},
5353
{
5454
"name": "tools",
55-
"version": "0f5a0938132440a8eac56b56320f09552cba4076",
55+
"version": "15807fb796282bbc975bf82cb80b95d6c5f178ef",
5656
"subdir": True,
5757
"urls": [
5858
{"url": "https://github.com/oracle/graal", "kind": "git"},
5959
],
6060
},
6161
{
6262
"name": "sulong",
63-
"version": "0f5a0938132440a8eac56b56320f09552cba4076",
63+
"version": "15807fb796282bbc975bf82cb80b95d6c5f178ef",
6464
"subdir": True,
6565
"urls": [
6666
{"url": "https://github.com/oracle/graal", "kind": "git"},
6767
]
6868
},
6969
{
7070
"name": "regex",
71-
"version": "0f5a0938132440a8eac56b56320f09552cba4076",
71+
"version": "15807fb796282bbc975bf82cb80b95d6c5f178ef",
7272
"subdir": True,
7373
"urls": [
7474
{"url": "https://github.com/oracle/graal", "kind": "git"},

0 commit comments

Comments
 (0)