user4964330
user4964330

Reputation:

How to get a local copy of the SVN repository?

I'm triyng to migrate my SVN repository to a Git one. In order to do that, I have to have my svn repository locally in my machine. So far I tried svn checkout, git svn clone, svndump, and none worked. I found rsync, but that also gives an error which I can't get rid of.

I execute the following command in the directory where I want it to copy the repository:

rsync -a . [email protected]:http://someAddress/svn/repoName

and get the following error.

ssh: Could not resolve domain.host: Name or service not known rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(605) [sender=3.0.9]

Can anyone give an example of a simple use case of this scenario?

Thanks in advance.

Update: Tried the following:

svnadmin dump http://someAddress/svn/Reponame > Reponame-svn.out

and got the error of:

svnadmin: 'http://someAddress/svn/Reponame' is an URL when it should be a path

So, this also does not work..

Upvotes: 3

Views: 8377

Answers (3)

VonC
VonC

Reputation: 1324737

Note, once you have copied over the result of a svndump/svnadmin dump (as recommended in the accepted answer), svn2git or subgit can be used to import it to a Git repository.

Once upon a time (2009-2012), there was a vcs-svn experiment to convert an SVN "dumpfile" to a Git fast-import stream, but... this is definitively dropped with Git 2.29 (Q4 2020).

See commit fc47391, commit a006f87, commit d7a5649, commit b5dd96b, commit a04f653 (13 Aug 2020) by Jeff King (peff).
(Merged by Junio C Hamano -- gitster -- in commit afd49c3, 03 Sep 2020)

svn:drop vcs-svn experiment

Signed-off-by: Jeff King

The code in vcs-svn was started in 2010 as an attempt to build a remote-helper for interacting with svn repositories (as opposed to git-svn).
However, we never got as far as shipping a mature remote helper, and the last substantive commit was [e99d012a6bc](https://github.com/git/git/commit/e99d012a6bc8b8647a0389d486b5489557364ea6, Git v1.8.1-rc0) in Oct. 2012.

We do have a git-remote-testsvn, and it is even installed as part of "make install". But given the name, it seems unlikely to be used by anybody (you'd have to explicitly "git clone testsvn::$url(man), and there have been zero mentions of that on the mailing list since 2013, and even that includes the phrase "you might need to hack a bit to get it working properly").

We also ship contrib/svn-fe, which builds on the vcs-svn work.
However, it does not seem to build out of the box for me, as the link step misses some required libraries for using libgit.a.
Curiously, the original build breakage bisects for me to eff80a9fd9 (Allow custom "comment char", 2013-01-16, Git v1.8.2-rc0), which seems unrelated.
There was an attempt to fix it in da011cb0e7 ("contrib/svn-fe: fix Makefile", 2014-08-28, Git v2.2.0-rc0 -- merge), but on my system that only switches the error message.

So it seems like the result is not really usable by anybody in practice.
It would be wonderful if somebody wanted to pick up the topic again, and potentially it's worth carrying around for that reason. But the flip side is that people doing tree-wide operations have to deal with this code.
And you can see the list with (replace "HEAD" with this commit as appropriate):

{
  echo "--"
  git diff-tree --diff-filter=D -r --name-only HEAD^ HEAD
} |
git log --no-merges --oneline e99d012a6bc.. --stdin  

which shows 58 times somebody had to deal with the code, generally due to a compile or test failure, or a tree-wide style fix or API change.

Let's drop it and let anybody who wants to pick it up do so by resurrecting it from the Git history.

As a bonus, this also reduces the size of a stripped installation of Git from 21MB to 19MB.

Upvotes: 1

alroc
alroc

Reputation: 28174

If you do not have direct access to the Subversion server and you're using a recent client (which you should be), you can use svnrdump to create a dumpfile which you can then load into a local repository, making a copy of the full repository at that point in time which you can then convert to git.

If you do have direct access to the server, use svnadmin dump on the server to create the same dumpfile, then transfer to wherever you're working, load into a new repository, and run your conversion.

Upvotes: 4

tgharold
tgharold

Reputation: 731

rsync only works across a SSH connection, not HTTPS. It also requires that you have console access to the server (i.e. your repository is hosted on a Linux/Unix server). So unless you have a SSH key for the server that houses your SVN repository, which puts you at a $ or # prompt, you will not be able to get the repository files using rsync (or scp).

If it's a Windows server, then you'll need RDP access (or some way to run commands and then put the files somewhere that you can download them).

For making a backup copy of the SVN repository directory, either svndump or svnadmin hotcopy will work. Both have to be executed at a command-line on the server. You would then need to transfer the dump file (svndump) or the repository directory created by svnadmin hotcopy to your local machine.

Upvotes: 0

Related Questions