Browse Source

add script and hardware info

julien colomb 2 years ago
parent
commit
2308cde67b
3 changed files with 80 additions and 0 deletions
  1. 0 0
      02_material_and_methods/03_hardware/.gitkeep
  2. 41 0
      datalad-unix
  3. 39 0
      datalad.bat

+ 0 - 0
02_material_and_methods/03_hardware/.gitkeep


+ 41 - 0
datalad-unix

@@ -0,0 +1,41 @@
+# Set folder where script will be executed 
+loc=$(dirname $0)
+projectdir=$(git -C ${loc} rev-parse --show-toplevel)
+
+pushd ${loc} > /dev/null
+
+# initialise
+if test -f "00repo_needs_initialisation00.txt" ;
+  then
+  echo "running project repository initiation (first run)"
+  datalad get . -n -r
+  datalad update -r --how=merge
+  rm "00repo_needs_initialisation00.txt"
+fi
+
+
+# Set commit message
+echo "Optionally enter a commit message, and hit return: "  
+read commitmessage 
+
+if [[ "$commitmessage" == "" ]]; then
+        echo "using date as commit message"
+	commitmessage="commit on $(date +%Y-%m-%d)"    
+fi
+
+#sync
+
+datalad update -r --how=merge
+datalad save -r -m  "$commitmessage"
+datalad push -r
+
+# Set dropping option
+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]"  
+read q_answer 
+
+if "$q_answer" == "y"; 
+then
+datalad drop . -r
+fi
+
+pause

+ 39 - 0
datalad.bat

@@ -0,0 +1,39 @@
+:: Upload changes from inside repository using GIN CLI
+
+:checkerror
+    err=%1
+    msg=%2
+    if %err% NEQ 0 (
+
+    )
+EXIT /B
+
+set curdir=%~dp0
+for /f %%i in ('git -C %curdir% rev-parse --show-toplevel') do set projectdir=%%i
+
+
+
+cd %projectdir%
+
+datalad get . -n -r
+datalad update -r --how=merge
+
+echo "Enter a commit message:"
+set /p input=
+
+
+:: sync
+
+datalad update -r --how=merge
+datalad save -r -m  %input%
+datalad push -r
+
+
+
+set /p qanswer="Do you want to drop all files that were uploaded, they will be on the server but not on this computer anymore ? [y/n] "
+
+if /i "%input%" == "yes" (
+    datalad drop . -r
+)
+
+pause