Skip to content

Instantly share code, notes, and snippets.

@tobiasvl
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobiasvl/e3b939030fc3432422f8 to your computer and use it in GitHub Desktop.
Save tobiasvl/e3b939030fc3432422f8 to your computer and use it in GitHub Desktop.
Konvertering av cerebrum_sites fra CVS til Git

Konverter CVS-repo til Git

Her er kommandoene jeg kjørte for å konvertere cerebrum_sites fra CVS til Git.

Basert på http://www.embecosm.com/appnotes/ean11/ean11-howto-cvs-git-1.0.html.

cvsclone

Installer cvsclone og avhengigheten flex:

sudo yum install flex
git clone git@github.com:akavel/cvsclone.git
cd cvsclone
make all

Sett stier

Følgende absolutte stier må settes:

${DESTDIR} : destination directory for module specific CVS repo
${GITDIR} : destination directory for module specific Git repo
${REPOURL} : URL to push the module specific Git repository to
${SRCDIR} : source directory for storing initial local copy of CVS repo

Funksjon for sync

Følgende funksjon synkroniserer ut moduler fra det klonede CVS-repoet, og må sources:

# Function for syncing file out of repository
synccvs() {
  # Make sure parent directory works, otherwise rsync fails
  mkdir -p `dirname ${DESTDIR}/${1}`
  # Firstly if directory, rsync dir
  if test -d ${SRCDIR}/${1}; then
    rsync -avz ${SRCDIR}/${1}/ ${DESTDIR}/${1}
    return
  fi
  # Next, if file not in attic, rsync that
  if test -e ${SRCDIR}/${1},v; then
    rsync -avz ${SRCDIR}/${1},v ${DESTDIR}/${1},v
    return
  fi
  # Finally, check if file in attic, then rsync that
  if test -e `dirname ${SRCDIR}/${1}`/Attic/`basename ${SRCDIR}/${1}`,v; then
    mkdir -p `dirname ${DESTDIR}/${1}`/Attic
    rsync -avz `dirname ${SRCDIR}/${1}`/Attic/`basename ${SRCDIR}/${1}`,v \
      `dirname ${DESTDIR}/${1}`/Attic/`basename ${DESTDIR}/${1}`,v
    return
  fi
  echo "Path doesn't exist! ${1}"
  exit 1
}

Klon CVS-repoet

CVS-repoet må klones fullstendig, ikke bare sjekkes ut. Deretter må riktig modul synces ut ved hjelp av funksjonen over.

cd ${SRCDIR}
cvsclone -d :pserver:tvl@vcs-usit.uio.no:/usit/cvs/cvsroot cerebrum_sites
synccvs
cvs -d ${DESTDIR} init

Importer til Git

Så importerer vi CVS-modulen vi akkurat syncet ut inn i Git:

CVSPSFILE=`echo ${DESTDIR} | sed 's/\//\#/g'`
rm -Rf ~/.cvsps/${CVSPSFILE}*
git cvsimport -d ${DESTDIR} -C ${GITDIR} -p -z,120 -o master -k cerebrum_sites

Last opp til Stash

Til slutt dytter vi repoet til Stash:

cd ${GITDIR}
git remote add origin ssh://git@utv.uio.no:7999/crb/cerebrum_config.git
git push

Opprydning

Tegnsett

Warning: commit message did not conform to UTF-8.
You may want to amend it after fixing the message, or set the config
variable i18n.commitencoding to the encoding your project uses.

Siste steg

Det viktigste steget:

yum remove cvs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment