sudo apt install subversion git
sudo snap install docker
sudo groupadd docker
sudo usermod -aG docker $USER
restart for changes to be effectiv.
Start the svn-server with
docker run -d -p 80:80 --name svn-server krisdavison/svn-server:v3.0
The default access preconfigure is user - password
.
Check that it is by looking at (http://localhost/svn/)[http://localhost/svn/].
Add two (or more)n users by runnning
docker exec -it svn-server htpasswd -b -c /etc/subversion/passwd user1 password1
docker exec -it svn-server htpasswd -b -c /etc/subversion/passwd user2 password2
afterward restart the apache inside the docker for the changes to be effective
docker exec -it svn-server /etc/init.d/apache2 reload
svn checkout http://localhost/svn/SampleProject/ --username user
Checked out revision 0.
Create file and fill it with content and commit it
echo "This is the content of file1 on the first commit." >> file1.txt
svn add file1.txt
svn commit -m "Initial commit" --username user
echo "This is the content of file2 on the second commit." >> file2.txt
svn add file2.txt
svn commit -m "Second commit" --username user1
echo "This is the content of file3 on the third commit." >> file3.txt
svn add file3.txt
svn commit -m "Third commit" --username user2
svn update
svn log
which should show the 3 commits
git svn clone --username user http://localhost/svn/SampleProject ../git-repo
Check that the repo contains the commits
cd ../git-repo
git log
which should show something like
Author: user <user@d9e2b561-1f1f-4448-a533-1550bdb452c2>
Date: Mon Nov 11 11:56:38 2019 +0000
Initial commit
git-svn-id: http://localhost/svn/SampleProject@1 d9e2b561-1f1f-4448-a533-1550bdb452c2
as you can see the number behind the [@] indicates the revision number.
Edit or create your ~/.gitconfig to contain the lines
[alias]
find-svn-revision = "!git log --name-status --grep \"git-svn-id.*@$1\" #"
now
git find-svn-revision 2
will show the commit which originated from the svn revision 2