[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Converting to git



Hi

On Do, 30 Aug 2012, Norbert Preining wrote:
> I want to move more and more of the svn repositories to git, and for
> that we need to settle an association from svn user names to
> name/emails.

BTW, I have started to move some of the repos where there are not
too many contributors or mostly me to git, that is by now
	tex-gyre:	git://anonscm.debian.org/debian-tex/tex-gyre.git
	texinfo:	git://anonscm.debian.org/debian-tex/texinfo.git
For these two I imported also the history of tags and branches
and did some manual cleaning in case some rubbish or useless branches
were created.

FOr that I wrote some notes in case someone else wants to do it with
*his* repository. Basic idea is from
http://john.albin.net/git/convert-subversion-to-git
paired with some infos from the web pages of debian.org for git/scm:

The following script cannot be run as is, but should be clear
to everyone what to do.

It worked well for the repositories I converted, but I had to remove
some dummy or old forgotten branches I still had hanging around
in svn that are of no use at all.

Let me know if you need an explanation.

----------------------------------------------------

#### LOCAL COMPUTER ######################
export package=tex-gyre
# the name of your account on git.debian.org
debiangituser=preining

# here the svn-git-authors-transform.txt is important
# that is the previous email I sent!!!
git svn clone  svn://svn.debian.org/svn/debian-tex --no-metadata -A ../svn-git-authors-transform.txt --trunk=${package}/trunk --tags=${package}/tags --branches=${package}/branches  ./temp

#
# if there are svn ignore stuff:
# cd temp
# git svn show-ignore > .gitignore
# git add .gitignore
# git commit -m 'Convert svn:ignore properties to .gitignore.'
# cd ..


###### ON git.debian.org !!!!!!!!!!!!!!!!!!#####################
# you can do that while the above clone is running!
cd /git/debian-tex/
umask 002
mkdir ${package}.git
cd ${package}.git
git --bare init --shared
git symbolic-ref HEAD refs/heads/trunk
echo "SOME USEFULL DESCRIPTION!!!!" > description
mv hooks/post-update.sample hooks/post-update
chmod a+x hooks/post-update


####### BACK ON LOCAL COMPUTER!!!! AFTER ABOVE clone HAS FINISHED!!
cd temp
git remote add bare git+ssh://${debiangituser}@git.debian.org/git/debian-tex/${package}.git
git config remote.bare.push 'refs/remotes/*:refs/heads/*'
git push bare
cd ..


# remove temp if not necessary, should not be ...
# rm -rf temp


###### AGAIN ON git.debian.org !!!! ####################
cd  /git/debian-tex/${package}.git
# rename trunk to master as normal for git
git branch -m trunk master

#
# convert tags
# decide on which names you want!
git for-each-ref --format='%(refname)' refs/heads/tags | \
  cut -d / -f 4 | \
  while read ref \
  do
    # if you want to change the actual tag name, change the first "$ref"
    # eg into "debian/$ref"
    git tag "$ref" "refs/heads/tags/$ref"
    git branch -D "tags/$ref"
  done

#
# NOW ALSO CHECK FOR 
# - useless tags and branches, and remove them!!

##### BACK ON LOCAL COMPUTER !!!!!!! ##################
# get your working checkout/clone
git clone git+ssh://${debiangituser}@git.debian.org/git/debian-tex/${package}.git
cd ${package}.git

# if you use a different user name or email for your debian git dev
# then set it now. I for example use @debian.org adress for the commits
git config user.email "${debiangituser}@debian.org"
git config user.name XXXXXX YYYYYYYYY ! PLEASE CHANGE !

#
# if you want tracking local branches for all remote branches:
#
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master`; do
  git branch --track ${branch##*/} $branch
done

----------------------------------------------------------------

Best wishes

Norbert
------------------------------------------------------------------------
Norbert Preining            preining@{jaist.ac.jp, logic.at, debian.org}
JAIST, Japan                                 TeX Live & Debian Developer
DSA: 0x09C5B094   fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
------------------------------------------------------------------------
BURLESTON
That peculiarly tuneless humming and whistling adopted by people who
are extremely angry.
			--- Douglas Adams, The Meaning of Liff


Reply to: