User Tools

Site Tools


sourceforge:git

This is an old revision of the document!


Git

Git is a revision control system, just like rcs, cvs and subversion (SVN) are.
Though the Crossfire repository is maintained by svn, it is possible to access this svn repo with git.
The subversion package needs to be installed though, since it has bindings for PERL because git-svn is a perl script located in {prefix}/libexec/git-core .

Prerequisites

The bindings of SVN for Perl are available if SWIG is installed.
SVN needs to know where to find the swig binary at compilation time :

./configure --with-swig=/usr/rcs/bin/swig --with-ssl=/usr --with-apr=/usr/rcs --with-apr-util=/usr/rcs --with-neon=/usr/rcs --prefix=/usr/rcs/svn-1.6.23 --with-zlib=/lib --with-serf=/usr/rcs 

When SWIG is available, then after make it needs additionally make swig-pl to compile the SVN perl modules and libraries.
make && make swig-pl && make install && make install-swig-pl should then install the PERL bindings to something like
/usr/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi-ld/SVN directory.

export PERLLIB='/usr/lib/perl5' and export PERL5LIB='/usr/lib/perl5' might be required though, so the perl modules are found.

git svn clone -r 1

Inside a new created directory then run these commands :

git svn clone -r 1 svn://svn.code.sf.net/p/crossfire/code ;echo $?

Which should print to the terminal

Initialized empty Git repository in /mnt/sdb16/CROSSFIRE/svn/git_experiments/code/.git/
W: +empty_dir: trunk
r1 = a967a85ee09bcf27915ff5eb652a10a7dc0d4a89 (refs/remotes/git-svn)
Checked out HEAD:
svn://svn.code.sf.net/p/crossfire/code r1
creating empty directory: trunk
0

And create a directory “code” with a hidden .git/ folder and a trunk/ folder structure.

Inside the .git folder there is a file named config which should look like

[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[svn-remote "svn"]
	url = svn://svn.code.sf.net/p/crossfire/code
	fetch = :refs/remotes/git-svn

Now it needs to change into the new 'code' directory :

cd code

Then run git svn log and git log:

 git svn log                   
------------------------------------------------------------------------
r1 | (no author) | 1999-03-29 03:46:48 -0100 (Mon, 29 Mar 1999) | 2 lines
 
New repository initialized by cvs2svn.
 
------------------------------------------------------------------------
 
 git log
commit c03bc89287c20c60c8d52377771046f54166d4eb (HEAD -> master)
Author: (no author) <(no author)@282e977c-c81d-0410-88c4-b93c2d0d6712>
Date:   Mon Mar 29 04:46:48 1999 +0000
 
    New repository initialized by cvs2svn.
 
    git-svn-id: svn://svn.code.sf.net/p/crossfire/code@1 282e977c-c81d-0410-88c4
-b93c2d0d6712

git svn fetch -r 2 svn

Inside this code directory we start to “fetch” revision by revision :

 git svn fetch -r 2 svn;echo $?
	A	trunk/arch/spell/rod_light.111.xpm
	A	trunk/arch/spell/rod_light.arc
	A	trunk/arch/spell/rod_light.112.xpm
	A	trunk/arch/spell/rod_light.113.xpm
	A	trunk/arch/spell/rod_heavy.111
 
	A	trunk/arch/dev/README
	A	trunk/arch/dev/xpm.template
r2 = e8b6556cff76da629a33f2f20c5e3388df081fca (refs/remotes/git-svn)
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
0

When you get errors like

W: Ignoring error from SVN, path probably does not exist: (175002): RA layer request failed: REPORT request >on '/p/crossfire/code/!svn/rvr/2' failed
W: Do not be alarmed at the above message git-svn is just searching aggressively for old history.
This may take a while on large repositories
0hecked through r2

then maybe change the .git/config entry value for the key 'url' from https: to svn:
url = https://svn.code.sf.net/p/crossfire/codeurl = svn://svn.code.sf.net/p/crossfire/code .

When the fetch has finished, then run git svn log :

git svn log
------------------------------------------------------------------------
r2 | uid200 | 1999-03-29 03:46:48 -0100 (Mon, 29 Mar 1999) | 2 lines
 
Initial revision
 
------------------------------------------------------------------------
r1 | (no author) | 1999-03-29 03:46:48 -0100 (Mon, 29 Mar 1999) | 2 lines
 
New repository initialized by cvs2svn.
 
------------------------------------------------------------------------

git svn rebase -l

The downloaded files are still kept inside the data pack files;
to make them show up it needs to rebase locally :

  git svn rebase -l
 
First, rewinding head to replay your work on top of it...
Fast-forwarded master to refs/remotes/git-svn.

Now the trunk/arch folder has some files to view .

Note: Do not forget the -l option for rebase; without that option it would rebase against the HEAD of the svn tree,
downloading all the 20000+ revisions !

And git log tells us :

 git log
commit e8b6556cff76da629a33f2f20c5e3388df081fca (HEAD -> master, git-svn)
Author: uid200 <uid200@282e977c-c81d-0410-88c4-b93c2d0d6712>
Date:   Mon Mar 29 04:46:48 1999 +0000
 
    Initial revision
 
 
    git-svn-id: svn://svn.code.sf.net/p/crossfire/code@2 282e977c-c81d-0410-88c4-b
93c2d0d6712
 
commit c03bc89287c20c60c8d52377771046f54166d4eb
Author: (no author) <(no author)@282e977c-c81d-0410-88c4-b93c2d0d6712>
Date:   Mon Mar 29 04:46:48 1999 +0000
 
    New repository initialized by cvs2svn.
 
    git-svn-id: svn://svn.code.sf.net/p/crossfire/code@1 282e977c-c81d-0410-88c4-b93c2d0d6712
sourceforge/git.1524418691.txt.gz · Last modified: 2018/04/22 12:38 by karl