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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3631465/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 07:34:54  来源:igfitidea点击:

How to use "svn export" command to get a single file from the repository?

windowssvn

提问by Delta

How can I use the svn exportcommand to get a single file from the repository?

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

I've tried this:

我试过这个:

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

But I get this error:

但我收到此错误:

svn: e:\repositories\process is not a working copy

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

回答by jason.rickman

Guessing from your directory name, you are trying to access the repository on the local filesystem. You still need to use URL syntax to access it:

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

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

回答by Robert Duchnik

You don't have to do this locally either. You can do it through a remote repository, for example:

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

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

回答by John Washburn

For the substition impaired here is a real example from GitHub.com to a local directory:

对于受损的替换,这里是一个从 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

See: Download a single folder or directory from a GitHub repofor more details.

请参阅:从 GitHub 存储库下载单个文件夹或目录以了解更多详细信息。

回答by Amos M. Carpenter

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...

我知道 OP 要求从命令行进行导出,但以防万一这对其他人有帮助...

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

您可以让Eclipse(加上此处讨论插件之一)为您完成工作。

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

显然,下载Eclipse只是为了做一个单一的导出是多余的,但是如果您已经将它用于开发,您也可以svn export在浏览 SVN 存储库时从您的 IDE 的上下文菜单中简单地做一个。

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
  • 对于那些不太熟悉在命令行级别使用 SVN 的人来说更容易(但您可以通过查看带有一系列命令的 SVN 控制台来了解在命令行级别发生的事情)
  • 您已经设置了 SVN 详细信息,不必担心身份验证等。
  • 您不必担心输入错误的 URL 或记住参数的顺序
  • 您可以在对话框中指定要导出到的目录
  • 您可以在对话框中指定是要从 TRUNK/HEAD 导出还是使用特定修订版

回答by Nitin Lawande

Use SVN repository URL to export file to Local path.

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

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