Changes

Jump to navigation Jump to search
no edit summary
Line 1: Line 1: −
==Initial script to take the latest version of a module and move it to Gitea.==
+
The script to use is smedev/git-cvs2git.sh
<syntaxhighlight lang="shell">
  −
#!/bin/bash
  −
# $1  = Module name e.g. smeserver-ddclient
  −
# $2 = "contrib" ...anything else -=> core module
  −
LocalUser="brianr"
  −
RemoteUser="brianr"
  −
if [ $2 == "contrib" ]; then
  −
  CVSFiles="/home/$LocalUser/smecontribs/rpms"
  −
else
  −
  CVSFiles="/home/$LocalUser/smeserver/rpms"
  −
fi
  −
GitFiles="/home/$LocalUser/GitFiles"
  −
RemoteRepoURL="https://src.koozali.org/$RemoteUser/$1"
  −
mkdir -p $GitFiles
  −
 
  −
#Make sure credentials taken from store
  −
git config --global credential.helper store #The first time you pull or push it will ask for credentials and then save them in a file.
  −
 
  −
# Clone the CVS repository
  −
cd $CVSFiles
  −
cvs -d:ext:shell.koozali.org:/cvs/smecontribs checkout $1
  −
 
  −
# Fully populate the directory (gets the tar file - which is not strictly in CVS)
  −
cd $1/contribs10
  −
make prep
  −
 
  −
# Create the local Git repository
  −
cd $GitFiles
  −
rm -rf $1
  −
git init $1
  −
cd $1
  −
echo `pwd`
  −
#pull in all the files we want
  −
if [ $2 == "contrib" ]; then
  −
    mkdir -p contribs10
  −
    for fpath in "*.patch" "*.spec" "*.gz" "*.tgz" "*.xz" "Makefile"
  −
    do
  −
    cp $CVSFiles/$1/contribs10/$fpath ./contribs10/
  −
    done
  −
else
  −
mkdir -p sme10
  −
    for fpath in "*.patch" "*.spec" "*.gz" "*.tgz" "*.xz" "Makefile"
  −
    do
  −
        cp $CVSFiles/$1/sme10/$fpath ./sme10/
  −
    done
  −
fi
     −
#Get Clone the common directory
+
# $1 = Module name e.g. smeserver-ddclient
git clone https://src.koozali.org/brianr/common.git
+
# $2 = Organisation (smeserver or smecontrib)e
# and delete the .git else it pushes back a link to the repo
+
# optional (can be in any order)
cd common
+
#   <local> will use parameters set for local repository else it will use remote
rm -fr ".git"
+
#  <debug> turn on debug regardless of ~/.smegit/config
cd ..
+
#  <noisy> print a line showing how it was called
   −
#stage and commit them
+
This will take a CVS package and create a equivalent git repo and copy across the data.
git add -A
  −
git commit -m "initial commit of file from CVS for $1"
     −
# Create the remote repo and push the converted git repository to the remote
+
See also:
git remote remove origin
+
https://wiki.koozali.org/Howto_create_a_gitea_repo_and_build_an_rpm#Creating_the_Repo_on_the_gitea_Server
git remote add origin $RemoteRepoURL
  −
# Need to have created the repo at this point....
  −
git pull --no-edit origin master
  −
git push -u origin master
  −
echo "Created $1 Repo in $RemoteRepoURL"
  −
exit 0
  −
</syntaxhighlight>
      +
DEPRECATED:
 
==Issues:==
 
==Issues:==
   Line 134: Line 80:  
It includes a "cvsconvert" script which runs cvs-fast-convert and writes to a git repo.
 
It includes a "cvsconvert" script which runs cvs-fast-convert and writes to a git repo.
   −
HOWEVER it needs access to the CVS files, not just the cvs client!
+
HOWEVER it needs access to the CVS files, not just the cvs client!<syntaxhighlight>
 +
[brianr@rockysmebuild cvs-fast-export]$ more cvsconvert
 +
#!/usr/bin/env python3
 +
"""
 +
cvsconvert - convert a CVS repo and check against the original
 +
 
 +
Convert, and check the tree content of a gitspace conversion against
 +
the CVS.  The tip state of every branch, and every tag, is checked.
 +
 
 +
Will produce spurious errors if any CVS branch name had to be sanitized.
 +
</syntaxhighlight>cvssync (part of the cvs package) is the way to go.
 +
 
 +
See here: https://stackoverflow.com/questions/28693868/migration-from-cvs-to-git
 +
 
 +
 
 +
This worked:
 +
 
 +
cvssync brianr@shell.koozali.org:/cvs/smecontribs/rpms smeserver-ddclient
 +
 
 +
it creates a directory "smeserver-ddclient" of the CVS files.
 +
 
 +
and "find . | cvs-fast-export | git fast-import" also did something, although I am not sure it was quite what I expected!!
 +
 
 +
TBC (WIP)

Navigation menu