tags:

views:

581

answers:

4

I have a URL for a Subversion repository and on the command line on Ubuntu I want to just download a copy of the repository as you would do in Mercurial by typing:

hg clone http://svn.somerepository.com/somerepository/trunk/docs/
  1. How do you "clone" a repository in SVN?

  2. Also, I just want to get everything below the docs folder - I don't want to start in the trunk - how would you do something like this:

    svn clone http://svn.somerepository.com/somerepository/trunk/docs/

+1  A: 
svn co svn://www.example.com/path/to/repository/...

In which "co" is short for "checkout".

amphetamachine
Checkout is not clone.
calmh
@calmh I think the question was coming from more of a workflow standpoint than a "how do I get a copy of the entire repository history."
Nick Meyer
@Nick Given the accepted answer, probably. I was fooled by the "copy of the repository" talk.
calmh
+4  A: 
  1. You can't clone the repository without having admin access to it (i.e. the ability to do svnadmin commands).
  2. You can certainly check out the subtree with svn co http://....../docs
Michael Hackner
You *can* clone a repository without admin access using svnsync, but this almost certainly isn't what the OP wants since such a clone is useless for making commits back to the real repository. This is the fundamental difference between distributed (git, hg, ...) and centralized (svn, cvs, ...).
bendin
@bendin Thanks...I was unfamiliar with `svnsync` and this usage of `clone`.
Michael Hackner
+4  A: 

You want to perform what in SVN-land is called a "check out."

svn co http://svn.somerepository.com/somerepository/trunk/docs/

Note the main difference between SVN and distributed systems like Mercurial or Git is that SVN's "check out" command downloads only a copy of the most recent version of each file, whereas with hg clone you will actually end up with a local copy of the repository's entire history as well. This has some implications for the way in which you work. For example, you need to have a network connection to the server in order to retrieve logs, perform diffs, etc.

Nick Meyer
+3  A: 

If you just need to grab the current version, svn checkout is all you need.

If you want a complete copy of the repository, including all previous versions, you can use svnsync. It can copy a complete repository and incrementally download new commits. I don't think it can be restricted to subdirectories though.

Wim