]> git.parisson.com Git - docker-django-scripts.git/commitdiff
[Git] : update switch url for forge-2
authorEmilie Zawadzki <emilie.zawadzki@ircam.fr>
Tue, 26 Mar 2019 09:41:40 +0000 (10:41 +0100)
committerEmilie Zawadzki <emilie.zawadzki@ircam.fr>
Tue, 26 Mar 2019 09:41:40 +0000 (10:41 +0100)
git/switch_urls.sh [new file with mode: 0755]
misc/git_switch_urls.sh [deleted file]
prod/push.sh

diff --git a/git/switch_urls.sh b/git/switch_urls.sh
new file mode 100755 (executable)
index 0000000..3789676
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+# The script detect the right main project branch, then update the submodule function of branch-[mainProjectBranch]
+# For example, if you define these variables in .gitmodules :
+# - branch-dev
+# - branch-master
+# If you are on dev branch in main project, the script will update submodule functions of branch-dev you've defined
+# In main project, if you are in another branch than master or dev, it will take by default dev branch
+# If you don't define any branches for you submodule, the script will update from master
+
+cd "$(dirname "$0")"/../../
+
+function usage() {
+    echo "switch all git URLs from SSH to HTTPS and vice versa"
+    echo ""
+    echo "./switch_urls.sh"
+    echo "  -h --help"
+    echo "  -s --ssh : switch all repositories to SSH"
+    echo "  -t --https : switch all repositories to HTTPS"
+    echo ""
+}
+
+
+function update_git_urls() {
+    find ./ -path ./var/lib -prune -o -type f \( -name ".gitmodules" -o -name "config" \)  -exec sed -i $REGEX {} +
+}
+
+
+while [ "$1" != "" ]; do
+    PARAM=`echo $1 | awk -F= '{print $1}'`
+    VALUE=`echo $1 | awk -F= '{print $2}'`
+    case $PARAM in
+        -h | --help)
+            usage
+            exit
+            ;;
+        -s | --ssh)
+            REGEX='s/https:\/\/github.com\//git@github.com:/g'
+            update_git_urls
+            REGEX='s/https:\/\/forge-2.ircam.fr\//git@forge-2.ircam.fr:/g'
+            update_git_urls
+            ;;
+        -t | --https)
+            REGEX='s/git@github.com:/https:\/\/github.com\//g'
+            update_git_urls
+            REGEX='s/git@forge-2.ircam.fr:/https:\/\/forge-2.ircam.fr\//g'
+            update_git_urls
+            ;;
+        *)
+            echo "ERROR: unknown parameter \"$PARAM\""
+            usage
+            exit 1
+            ;;
+    esac
+    shift
+done
diff --git a/misc/git_switch_urls.sh b/misc/git_switch_urls.sh
deleted file mode 100755 (executable)
index 9d4daa1..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/bash
-
-# The script detect the right main project branch, then update the submodule function of branch-[mainProjectBranch]
-# For example, if you define these variables in .gitmodules :
-# - branch-dev
-# - branch-master
-# If you are on dev branch in main project, the script will update submodule functions of branch-dev you've defined
-# In main project, if you are in another branch than master or dev, it will take by default dev branch
-# If you don't define any branches for you submodule, the script will update from master
-
-cd "$(dirname "$0")"/../../
-
-function usage() {
-    echo "switch all git URLs from SSH to HTTPS and vice versa"
-    echo ""
-    echo "./git_switch_urls.sh"
-    echo "  -h --help"
-    echo "  -s --ssh : switch all repositories to SSH"
-    echo "  -t --https : switch all repositories to HTTPS"
-    echo ""
-}
-
-
-function update_git_urls() {
-    find ./ -path ./var/lib -prune -o -type f \( -name ".gitmodules" -o -name "config" \)  -exec sed -i $REGEX {} +
-}
-
-
-while [ "$1" != "" ]; do
-    PARAM=`echo $1 | awk -F= '{print $1}'`
-    VALUE=`echo $1 | awk -F= '{print $2}'`
-    case $PARAM in
-        -h | --help)
-            usage
-            exit
-            ;;
-        -s | --ssh)
-            REGEX='s/https:\/\/github.com\//git@github.com:/g'
-            update_git_urls
-            ;;
-        -t | --https)
-            REGEX='s/git@github.com:/https:\/\/github.com\//g'
-            update_git_urls
-            ;;
-        *)
-            echo "ERROR: unknown parameter \"$PARAM\""
-            usage
-            exit 1
-            ;;
-    esac
-    shift
-done
index 454fe4ab6a767d2f7d26f8756de5e8cf2b81d6e0..e235cfe9bd1543dd8e4fe73819db3a20a227b763 100755 (executable)
@@ -10,7 +10,7 @@
 
 cd "$(dirname "$0")"/../../
 
-bin/misc/git_switch_urls.sh --ssh
+bin/git/switch_urls.sh --ssh
 git push
 git submodule foreach --recursive 'git push'
-bin/misc/git_switch_urls.sh --https
+bin/git/switch_urls.sh --https