Skip to content

Commit

Permalink
Merge pull request #387 from dandi/b2d-36
Browse files Browse the repository at this point in the history
Add script for backfilling `reregisterurl` invocations
  • Loading branch information
yarikoptic authored Jul 26, 2024
2 parents cb4d8c5 + a80df79 commit f9c626a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tools/backfill-reregister.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# <https://github.com/dandi/backups2datalad/pull/36#issuecomment-2153627640>
set -eux -o pipefail

dandiset_root=/mnt/backup/dandi/dandisets

cd "$dandiset_root"
for ds in 0*
do
cd "$ds"
embargo_status="$(git config --file .datalad/config --default OPEN --get dandi.dandiset.embargo-status)"
if [ "$embargo_status" = OPEN ] \
&& git remote | grep -Fqx datalad \
&& git log -S EMBARGOED -n1 -- .datalad/config | grep -q .
then
git annex find --include='*' --format='${key}\n' \
| git annex reregisterurl --batch --move-from datalad
git remote remove datalad
fi
cd -
done

0 comments on commit f9c626a

Please sign in to comment.