如何使用“svn export”命令从存储库中获取单个文件?

时间:2010-09-02 21:32:27

标签: windows svn

如何使用svn export命令从存储库中获取单个文件?

我试过这个:

svn export e:\repositories\process\test.txt c:\

但是我收到了这个错误:

  

svn:e:\ repositories \ process不是工作副本

5 个答案:

答案 0 :(得分:55)

从您的目录名称猜测,您正在尝试访问本地文件系统上的存储库。您仍然需要使用URL语法来访问它:

svn export file:///e:/repositories/process/test.txt c:\test.txt

答案 1 :(得分:19)

您也不必在本地执行此操作。您可以通过远程存储库执行此操作,例如:

svn export http://<repo>/process/test.txt /path/to/code/

答案 2 :(得分:4)

对于受损的替代品,这里是从GitHub.com到本地目录的真实例子:

svn ls https://github.com/rdcarp/playing-cards/trunk/PumpkinSoup.PlayingCards.Interfaces
svn export https://github.com/rdcarp/playing-cards/trunk/PumpkinSoup.PlayingCards.Interfaces /temp/SvnExport/Washburn

有关详细信息,请参阅:Download a single folder or directory from a GitHub repo

答案 3 :(得分:1)

I know the OP was asking about doing the export from the command line, but just in case this is helpful to anyone else out there...

You could just let Eclipse (plus one of the plugins discussed here) do the work for you.

Obviously, downloading Eclipse just for doing a single export is overkill, but if you are already using it for development, you can also do an svn export simply from your IDE's context menu when browsing an SVN repository.

Advantages:

  • easier for those not so familiar with using SVN at the command-line level (but you can learn about what happens at the command-line level by looking at the SVN console with a range of commands)
  • you'd already have your SVN details set up and wouldn't have to worry about authenticating, etc.
  • you don't have to worry about mistyping the URL, or remembering the order of parameters
  • you can specify in a dialog which directory you'd like to export to
  • you can specify in a dialog whether you'd like to export from TRUNK/HEAD or use a specific revision

答案 4 :(得分:0)

使用SVN存储库URL将文件导出到本地路径。

     svn export [-r rev] [--ignore-externals] URL Export_PATH
     svn export http://<path>/test.txt C:\Temp-Folder