You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2019/03/20 15:00:11 UTC

[sling-tooling-scm] 02/35: SLING-3987 - move from Subversion to Git

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit 37c20bb272014dc5f0e46c501d854500c962977e
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Sep 12 19:49:59 2017 +0000

    SLING-3987 - move from Subversion to Git
    
    Add an incomplete script to run the migration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1808146 13f79535-47bb-0310-9956-ffa450edef68
---
 scripts/migrate-to-git.sh | 68 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/scripts/migrate-to-git.sh b/scripts/migrate-to-git.sh
new file mode 100755
index 0000000..ad36e98
--- /dev/null
+++ b/scripts/migrate-to-git.sh
@@ -0,0 +1,68 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This script is used to migrate modules from SVN to Git
+#!/bin/sh
+
+if [ ! -f check_staged_release.sh ]; then
+    echo "Please run this script from the root of the Sling SVN repository"
+    exit 1
+fi
+
+# prefixes to strip from module paths. trailing slash is mandatory
+prefixes='bundles/extensions/ bundles/ contrib/bundles contrib/extensions/ contrib/ karaf/ tooling/maven/'
+git_repo_location='../sling-modules'
+
+for module in $(./tooling/scm/scripts/gen-repo-candidates.sh); do
+
+    module_orig=$module
+
+    for prefix in $prefixes; do
+        module=${module#${prefix}}
+    done
+
+    repo_name=${module//\//-} # slashes to dashes
+    repo_name="sling-${repo_name}" # add TLP prefix
+    
+    echo "---- Preparing to migrate $module_orig to $repo_name ---"
+
+    status=$(curl -s -o /dev/null -I  -w "%{http_code}" https://git-wip-us.apache.org/repos/asf?p=${repo_name})
+
+    if [ $status = "404" ]; then
+        echo "Repository not found, will create";
+    elif [ $status = "200" ] ;then
+        echo "Repository exists, skipping";
+    else
+        echo "Unhandled HTTP status code ${status}, aborting"
+        exit 1
+    fi
+    
+    if [ ! -d ${git_repo_location}/${repo_name}/.git ]; then
+        echo "Converting from SVN to Git..."
+        # TODO - migrate the repository from SVN to git
+        exit 2 # unimplemented
+    else
+        echo "Already converted"
+    fi
+
+    
+    # TODO - create the repository using the ASF self-service tool
+    echo "Creating GIT repository ..."
+    exit 2 # unimplemented
+
+    cd ${git_repo_location}/${repo_name}
+    git remote add origin https://git-wip-us.apache.org/repos/asf/${repo_name}.git
+    git push -u origin master
+done