julien colomb пре 2 година
родитељ
комит
25f01105c1
2 измењених фајлова са 33 додато и 2 уклоњено
  1. 33 0
      .scripts/datalad_sync.py
  2. 0 2
      .scripts/template_init.command

+ 33 - 0
.scripts/datalad_sync.py

@@ -0,0 +1,33 @@
+from heapq import merge
+import os
+import sys
+
+import datalad.api as dl
+
+# Set folder where script will be executed
+loc = os.path.dirname(os.path.abspath(__file__))
+print(loc)
+os.chdir(loc)
+#projectdir = dl.Repo(loc, create=False).get_toppath()
+
+# initialise
+if not os.path.isfile("06_dissemination/README_DISSEMINATION.md"):
+    print("running project repository initiation (first run)")
+    dl.get(".", recursive=True, get_data=False)
+    dl.update(merge=True, recursive=True)
+
+# Set commit message
+commitmessage = input("Optionally enter a commit message, and hit return: ")
+if not commitmessage:
+    print("using date as commit message")
+    commitmessage = "commit on" + {datetime.now().strftime('%Y-%m-%d')}
+
+# sync
+dl.update(merge=True, recursive=True)
+dl.save(".", message=commitmessage, recursive=True)
+dl.push(".", to="origin", recursive=True)
+
+# Set dropping option
+q_answer = input("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 q_answer == "y":
+    dl.drop(".", recursive=True)

+ 0 - 2
.scripts/template_init.command

@@ -34,7 +34,6 @@ gin git branch -D master
 
 # initialise submodules
 gin git submodule update --init --recursive
-git submodule update --recursive --remote
 
 # if the template was not initialise before, let's do it
 # new tonic version do that, so this should be obsolete.
@@ -80,7 +79,6 @@ else
 fi
 
 if test -f "00repo_needs_initialisation00.txt" ;
-then
 
     # delete file telling the initialisation need to be done
     rm "00repo_needs_initialisation00.txt"