Browse Source

git-annex in jcolomb@gaston

julien_PC 2 years ago
parent
commit
a2d41df894
4 changed files with 67 additions and 128 deletions
  1. 45 0
      .log/gin.log
  2. 9 12
      old_sync.bat
  3. 0 113
      sync
  4. 13 3
      sync.bat

+ 45 - 0
.log/gin.log

@@ -9,3 +9,48 @@
 2021-09-27T13:19:52: Sync script executed
 2021-09-27T13:20:53: Sync script executed
 2021-09-27T13:32:34: Sync script executed
+2021-09-27T13:57:16: Sync script executed
+Error occurred during 'gin commit'
+127
+: Sync script executed
+Error occurred during 'gin commit'
+127
+: Sync script executed
+Error occurred during 'gin commit'
+127
+: Sync script executed
+Error occurred during 'gin commit'
+127
+: Sync script executed
+Error occurred during 'gin commit'
+127
+2021-09-28T11:55:01: Sync script executed
+Error occurred during 'gin remove-content' in main repo
+127
+2021-09-28T12:12:56: Sync script executed
+Error occurred during 'gin remove-content' in main repo
+127
+: Sync script executed
+Error occurred during 'gin commit'
+127
+: Sync script executed
+Error occurred during 'gin commit'
+127
+: Sync script executed
+Error occurred during 'gin commit'
+127
+: Sync script executed
+Error occurred during 'gin commit'
+127
+: Sync script executed
+Error occurred during 'gin commit'
+127
+: Sync script executed
+Error occurred during 'gin commit'
+127
+2021-09-28T13:48:30: Sync script executed
+Error occurred during 'gin remove-content' in main repo
+127
+: Sync script executed
+Error occurred during 'gin commit'
+127

+ 9 - 12
old_sync.bat

@@ -1,13 +1,7 @@
 :: Upload changes from inside repository using GIN CLI
 :: Assumes no submodules
 
-: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
@@ -15,14 +9,17 @@ for /f %%i in ('git -C %curdir% rev-parse --show-toplevel') do set projectdir=%%
 
 
 cd %projectdir%
-gin sync
-CALL :checkerror %ERRORLEVEL% "Error occurred during 'gin sync'"
-gin commit .
-CALL :checkerror %ERRORLEVEL% "Error occurred during 'gin commit'"
-gin upload
-CALL :checkerror %ERRORLEVEL% "Error occurred during 'gin upload'"
+
+ gin sync
+:: CALL :checkerror %ERRORLEVEL% "Error occurred during 'gin sync'"
+:: gin commit .
+:: CALL :checkerror %ERRORLEVEL% "Error occurred during 'gin commit'"
+:: gin upload
+:: CALL :checkerror %ERRORLEVEL% "Error occurred during 'gin upload'"
 
 :: Uncomment below to download all large files
 :: gin get-content .
 :: CALL :checkerror %ERRORLEVEL% "Error occurred during 'gin get-content'"
+echo %projectdir%
+
 pause

+ 0 - 113
sync

@@ -1,113 +0,0 @@
-#!/usr/bin/env bash
-#
-# Upload changes from inside repository using GIN CLI
-# Works with submodules.
-# Assumes gin init was performed or the repository was downloaded via gin get
-
-usage() {
-    echo "$0 <sync-option>"
-    echo
-    echo "<sync-option>     The sync option defines what to do with the content of large files."
-    echo "                  It should be one of the following values:"
-    echo "                     download - Download all large file content from the server"
-    echo "                     keep     - Keep all large file content but do not download missing large files"
-    echo "                     remove   - Do not download large files and remove existing local large file content"
-    exit 1
-}
-
-# Set the variable for synchronisation option, see above 
-syncopt="remove"
-
-# 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
-
-
-
-# Checking synchronisation option and giving feedback
-checkargs() {
-    case "$1" in
-        download)
-            echo "Downloading and keep all large file content"
-            ;;
-        keep)
-            echo "Keeping existing local large file content, do not downlad extra files"
-            ;;
-        remove)
-            echo "Removing all local large file content"
-            ;;
-        *)
-            usage
-            ;;
-    esac
-}
-
-checkargs "${syncopt}"
-
-checkerror() {
-    err=$1
-    msg=$2
-    if [[ ${err} != 0 ]]; then
-        echo "${msg}" >> ./.log/gin.log
-	echo "${err}" >> ./.log/gin.log
-        echo "${msg}"
-        echo "Press [Enter] to close this window"
-        read -r
-        exit 1
-    fi
-}
-
-# Set folder where script will be executed 
-loc=$(dirname $0)
-projectdir=$(git -C ${loc} rev-parse --show-toplevel)
-
-pushd ${loc} > /dev/null
-# write log
-mkdir -p ./.log
-echo "$(date +'%Y-%m-%dT%H:%M:%S'): Sync script executed" >> ./.log/gin.log
-
-echo "intialise submodules"
-git submodule foreach gin init
-
-echo "Synchronising submodules"
-git submodule foreach gin commit . -m "$commitmessage"
-checkerror $? "Error occurred during 'gin commit'"
-git submodule foreach gin sync
-checkerror $? "Error occurred during 'gin sync'"
-
-git submodule foreach gin upload
-checkerror $? "Error occurred during 'gin upload'"
-
-## remove uploaded (annexed) content
-if [[ "$syncopt" == "remove" ]]; then
-        git submodule foreach gin remove-content 
-        checkerror $? "Error occurred during 'gin remove-content'"
-    fi
-# get annexed content 
-if [[ "${syncopt}" == "download" ]]; then
-        git submodule foreach gin get-content .
-        checkerror $? "Error occurred during 'gin get-content .'"
-    fi    
-
-
-echo "Synchronising main repository"
-
-gin commit . -m "$commitmessage"
-gin sync
-gin upload
-
-# remove uploaded (annexed) content
-if [[ "$syncopt" == "remove" ]]; then
-        gin remove-content 
-        checkerror $? "Error occurred during 'gin remove-content' in main repo"
-    fi
-# get annexed content 
-if [[ "${syncopt}" == "download" ]]; then
-        gin get-content .
-        checkerror $? "Error occurred during 'gin get-content . in main repo'"
-    fi   

+ 13 - 3
sync.bat

@@ -1,6 +1,16 @@
 :: this script should run the sync bash script on windows, onecs cygwin has been installed
 
-C:\cygwin64\bin\bash git config --global user.name= juliencolombPC
-C:\cygwin64\bin\bash git config --global user.email= julien.colomb@fu-berlin.de
+:checkerror
+    err=%1
+    msg=%2
+    if %err% NEQ 0 (
 
-C:\cygwin64\bin\bash sync
+    )
+EXIT /B
+
+set curdir=%~dp0
+for /f %%i in ('git -C %curdir% rev-parse --show-toplevel') do set projectdir=%%i
+
+C:\cygwin64\bin\bash -l %projectdir%sync.sh
+
+PAUSE