Skip to content

Commit c3e2278

Browse files
authored
Merge pull request #464 from dbic/bf-datalad
BF: be compatible with datalad 0.13
2 parents f4c2dd2 + 96dd325 commit c3e2278

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

heudiconv/external/dlad.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
lgr = logging.getLogger(__name__)
1212

13-
MIN_VERSION = '0.12.4'
13+
from ..info import MIN_DATALAD_VERSION as MIN_VERSION
1414

1515

1616
def prepare_datalad(studydir, outdir, sid, session, seqinfo, dicoms, bids):
@@ -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/info.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@
3737
'inotify',
3838
]
3939

40+
MIN_DATALAD_VERSION = '0.12.4'
4041
EXTRA_REQUIRES = {
4142
'tests': TESTS_REQUIRES,
4243
'extras': [], # Requires patched version ATM ['dcmstack'],
43-
'datalad': ['datalad >=0.12.3']
44+
'datalad': ['datalad >=%s' % MIN_DATALAD_VERSION]
4445
}
4546

4647
# Flatten the lists

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)

utils/test-compare-two-versions.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ function run() {
2626
shift
2727
source $heudiconvdir/venvs/dev3/bin/activate
2828
whichheudiconv=$(which heudiconv)
29+
# to get "reproducible" dataset UUIDs (might be detremental if we had multiple datalad calls
30+
# but since we use python API for datalad, should be Ok)
31+
export DATALAD_SEED=1
32+
2933

3034
if [ ! -e "$out" ]; then
3135
# just do full conversion

0 commit comments

Comments
 (0)