简体   繁体   中英

Does SVN have an equivalent for “hg clone” in Mercurial or “git clone” in Git?

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/

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.

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.

  1. You can't clone the repository without having admin access to it (ie the ability to do svnadmin commands).
  2. You can certainly check out the subtree with svn co http://....../docs
svn co svn://www.example.com/path/to/repository/...

其中“co”是“结账”的缩写。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM