datalad-unix 921 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Set folder where script will be executed
  2. loc=$(dirname $0)
  3. projectdir=$(git -C ${loc} rev-parse --show-toplevel)
  4. pushd ${loc} > /dev/null
  5. # initialise
  6. if test -f "00repo_needs_initialisation00.txt" ;
  7. then
  8. echo "running project repository initiation (first run)"
  9. datalad get . -n -r
  10. datalad update -r --how=merge
  11. rm "00repo_needs_initialisation00.txt"
  12. fi
  13. # Set commit message
  14. echo "Optionally enter a commit message, and hit return: "
  15. read commitmessage
  16. if [[ "$commitmessage" == "" ]]; then
  17. echo "using date as commit message"
  18. commitmessage="commit on $(date +%Y-%m-%d)"
  19. fi
  20. #sync
  21. datalad update -r --how=merge
  22. datalad save -r -m "$commitmessage"
  23. datalad push -r
  24. # Set dropping option
  25. echo "Do you want to drop all files that were uploaded, they will be on the server but not on this computer anymore ? [y/n]"
  26. read q_answer
  27. if "$q_answer" == "y";
  28. then
  29. datalad drop . -r
  30. fi
  31. pause