[Libreoffice-commits] .: Branch 'feature/submodules' - 2 commits - g helpcontent2

Norbert Thiebaud nthiebaud at kemper.freedesktop.org
Thu May 10 12:08:19 PDT 2012


 g            |   76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 helpcontent2 |    2 -
 2 files changed, 76 insertions(+), 2 deletions(-)

New commits:
commit 8679710bd72dfb9e3ef55fa40885fc2475763684
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Thu May 10 14:06:29 2012 -0500

    tweak g to deal with submodules
    
    Change-Id: I61c606b23f24233617b75f2f5da9ca4844ca1b22

diff --git a/g b/g
index 545a058..a283d2c 100755
--- a/g
+++ b/g
@@ -2,8 +2,11 @@
 #
 # Wrapper for git to handle more subdirs at the same time
 #
-    echo "Do not use ./g anymore, we have submodules now"
+deprecated()
+{
+    echo "Do not use ./g fetch/pull/clone, we have submodules now, use ./g update to update the needed module, otherwise work on the core repo with git directly"
     exit 1
+}
 
 # no params, no action
 if [ "$#" -eq "0" ] ; then
@@ -96,6 +99,72 @@ refresh_all_hooks()
     done
 }
 
+update_submodule()
+{
+    local module="$1"
+    local active="$2"
+    local old_module="$1"
+
+    if [ "$active" = "yes" ] ; then
+	if [ "$module" == "helpcontent2" ] ; then
+	    old_module="help"
+	fi
+	if [ -d "$module" -a ! -L "$module" ] ; then
+	    if [ -d "$module/.git/." ] ; then
+		if [ -z $(git config --get "submodule.$module.url") ] ; then
+		    git submodule init $module
+		else
+		    echo "$module is already initialized"
+		fi
+	    else
+		if [ -d clone/$old_module/.git/. ] ; then
+		    echo "re-use clone/$old_module as a base for $module and fetch"
+		    cp -rp clone/$old_module/.git $module/.
+		fi
+		echo "init submodule $module"
+		git submodule init $module
+	    fi
+	    echo "update submodule $module"
+	    git submodule update $module
+	else
+	    echo "Error: $module is not a directory, so pre-submodule time?" 1>&2
+	    exit 1
+	fi
+    else
+	for key in $(git config --get-regex "submodule.$module" | cut -d' '  -f 1) ; do
+	    if [ -n "$key" ] ; then
+		echo "remove $key from .git/config"
+		git config --unset $key
+	    fi
+	done
+    fi
+}
+
+update_submodules()
+{
+    local m
+    local active
+    local module
+
+    if [ -f ./bin/repo-list ] ; then
+	for module in binfilter helpcontent2 dictionaries translations ; do
+	    active="no"
+	    for m in $(cat ./bin/repo-list) ; do
+		if [ "$m" = "help" ] ; then
+		    m="helpcontent2"
+		fi
+		if [ "$m" = "$module" ] ; then
+		    active="yes"
+		fi
+	    done
+	    update_submodule $module $active
+	done
+    else
+	echo "you need to autogen before trying ot update the submodules" 1>&2
+	exit 1
+    fi
+}
+
 postprocess()
 {
     rc=$1
@@ -154,10 +223,12 @@ done
 
 case "$COMMAND" in
     apply)
+	deprecated
         EXTRA="-p0 --stat --apply --index --ignore-space-change --whitespace=error"
         RELATIVIZE=0
         ;;
     clone|fetch|pull)
+	deprecated
         DO_HOOK_REFRESH=true
         ;;
     diff)
@@ -175,6 +246,9 @@ case "$COMMAND" in
             PUSH_ALL=1
         fi
         ;;
+    update)
+	update_submodules
+	exit 0;
 esac
 
 # absolutize the parameters first
commit 92892765bdbe3c95fd029067f13e719cfce95468
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Thu May 10 14:06:00 2012 -0500

    helpcontent2 tweak
    
    Change-Id: Id0fa59062e5943944bb7ad541be235a532ac5744

diff --git a/helpcontent2 b/helpcontent2
index d0b8fb8..6c1b76c 160000
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit d0b8fb86d851c9e3f1257c972494021320dda6d0
+Subproject commit 6c1b76c38f0fc469a2cbf41ffacde4d76df11ead


More information about the Libreoffice-commits mailing list