Skip to content

Commit

Permalink
Merge pull request #6701 from adswa/enh-gitlab
Browse files Browse the repository at this point in the history
ENH: Better feedback when create-sibling-gitlab is called with non-existing path
  • Loading branch information
adswa committed May 30, 2022
2 parents 310fd9f + 682c910 commit 1072fb3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
28 changes: 21 additions & 7 deletions datalad/distributed/create_sibling_gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def __call__(
# to avoid undesired level-1 recursion into subdatasets
if any(p != ds.pathobj for p in (path or [])) or recursive:
# also include any matching subdatasets
for subds in ds.subdatasets(
subds = ds.subdatasets(
path=path,
# we can only operate on present datasets
state='present',
Expand All @@ -270,12 +270,26 @@ def __call__(
bottomup=False,
result_xfm='datasets',
result_renderer='disabled',
return_type='generator'):
for r in _proc_dataset(
ds, subds,
site, project, name, layout, existing, access,
dry_run, siteobjs, publish_depends, description):
yield r
return_type='list')
if not subds:
# we didn't find anything to operate on, let the user know
for p in path:
yield dict(
action='create_sibling_gitlab',
status='impossible',
refds=ds.path,
path=p,
message=('No dataset found under %s' % p),
type='dataset',
logger=lgr,
)
else:
for sub in subds:
for r in _proc_dataset(
ds, sub,
site, project, name, layout, existing, access,
dry_run, siteobjs, publish_depends, description):
yield r

return

Expand Down
9 changes: 9 additions & 0 deletions datalad/distributed/tests/test_create_sibling_gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ def test_dryrun(path=None):
ctlg = _get_nested_collections(path)
# no site config -> error
assert_raises(ValueError, ctlg['root'].create_sibling_gitlab)
# wrong path specification -> impossible result
res = ctlg['root'].create_sibling_gitlab(
dry_run=True, on_failure='ignore',
site='dummy', path='imaghost'
)
assert_result_count(res, 1)
assert_result_count(
res, 1, path=ctlg['root'].pathobj / 'imaghost', type='dataset',
status='impossible')
# single project vs multi-dataset call
assert_raises(
ValueError,
Expand Down

0 comments on commit 1072fb3

Please sign in to comment.