File indexing completed on 2024-04-21 05:41:53

0001 #!/bin/sh
0002 
0003 # This script splits out all the frameworks from kdelibs into separate repositories
0004 # and puts them into ../frameworks/.
0005 #
0006 # For each framework, first it creates an empty repository and it imports the
0007 # current code, into the original subdirectory. For example, kconfig will be a
0008 # repository containing a tier1/kconfig/ directory. Then, in a second commit,
0009 # the code is moved to the root directory of the repository.
0010 #
0011 # Doing the move in two steps like this lets git follow the history better.
0012 # When the old kdelibs history is grafted on the new repositories, the history
0013 # will contain a commit that deletes everything except that framework, and then
0014 # another commit moving the framework to the root.
0015 #
0016 origproject=kdelibs
0017 origbranch=frameworks
0018 origsha1=`git rev-parse HEAD`
0019 
0020 if [ ! -d tier1 ]; then
0021   echo "Run this script from the toplevel of the monolithic repository, there must be a tier1 subdirectory"
0022   exit 1
0023 fi
0024 
0025 dest=../frameworks
0026 mkdir -p $dest
0027 here=$PWD
0028 
0029 for dir in tier1/* tier2/* tier3/* tier4/*; do
0030     cd $here
0031     if [ -f $dir ]; then
0032       continue;
0033     fi
0034     frameworkname=`basename $dir`
0035     frameworkdest=$dest/$frameworkname
0036     rm -rf $frameworkdest
0037     # eg. create ../frameworks/kjs/tier1
0038     mkdir -p $(dirname $frameworkdest/$dir)
0039     # eg. copy tier1/kjs to ../frameworks/kjs/tier1/kjs
0040     cp -a $dir $frameworkdest/$dir/
0041     cd $frameworkdest
0042 
0043 git init
0044 git add .
0045 
0046 git commit -q -F - <<EOF
0047 
0048 Initial import from the monolithic $origproject.
0049 
0050 This is the beginning of revision history for this module. If you
0051 want to look at revision history older than this, please refer to the
0052 techbase wiki for how to use Git history grafting. At the time of
0053 writing, this wiki is located here:
0054 
0055 http://community.kde.org/Frameworks/GitOldHistory
0056 
0057 If you have already performed the grafting and you don't see any
0058 history beyond this commit, try running "git log" with the "--follow"
0059 argument.
0060 
0061 Branched from the monolithic repo, $origproject $origbranch branch, at commit
0062 $origsha1
0063 
0064 EOF
0065 
0066 # eg. moves tier1/kconfig/* to .
0067 git mv $dir/* .
0068 git commit -q -m "Move $frameworkname code to the root directory."
0069 
0070 echo "$frameworkdest done."
0071 
0072 done
0073