Skip to content

Commit fe19e94

Browse files
committed
RF: DataLad 0.13 compat fixes - use .save instead of .add for datalad; do not use .repo.repo
There might be one more commit now in the DataLad history but I think it is tollerable
1 parent f4c2dd2 commit fe19e94

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

heudiconv/external/dlad.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ def add_to_datalad(topdir, studydir, msg, bids):
105105
# Previously we did not have it as a submodule, and since no
106106
# automagic migration is implemented, we just need to check first
107107
# if any path under .heudiconv is already under git control
108-
if any(x[0].startswith('.heudiconv/') for x in
109-
ds.repo.repo.index.entries.keys()):
108+
if any(x.startswith('.heudiconv/') for x in ds.repo.get_files()):
110109
lgr.warning("%s has .heudiconv not as a submodule from previous"
111110
" versions of heudiconv. No automagic migration is "
112111
"yet provided", ds)
@@ -119,11 +118,11 @@ def add_to_datalad(topdir, studydir, msg, bids):
119118
# we place all files under annex and then add
120119
if create_file_if_missing(op.join(dsh_path, '.gitattributes'),
121120
"""* annex.largefiles=anything"""):
122-
ds.add('.heudiconv/.gitattributes',
121+
ds.save('.heudiconv/.gitattributes',
123122
to_git=True,
124123
message="Added gitattributes to place all .heudiconv content"
125124
" under annex")
126-
ds.add('.', recursive=True, save=False,
125+
ds.save('.', recursive=True
127126
# not in effect! ?
128127
#annex_add_opts=['--include-dotfiles']
129128
)

heudiconv/external/tests/test_dlad.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_mark_sensitive(tmpdir):
1717
'g2': 'd1',
1818
}
1919
)
20-
ds.add('.')
20+
ds.save('.')
2121
mark_sensitive(ds, 'f*')
2222
all_meta = dict(ds.repo.get_metadata('.'))
2323
target_rec = {'distribution-restrictions': ['sensitive']}

heudiconv/tests/test_main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def test_prepare_for_datalad(tmpdir):
147147
dummy_path = os.path.join(dsh_path, 'dummy.nii.gz')
148148

149149
create_file_if_missing(dummy_path, '')
150-
ds.add(dummy_path, message="added a dummy file")
150+
ds.save(dummy_path, message="added a dummy file")
151151
# next call must not fail, should just issue a warning
152152
add_to_datalad(str(tmpdir), studydir_, None, False)
153153
ds.repo.is_under_annex(dummy_path)

0 commit comments

Comments
 (0)