开发者

copy file from a previous version in the svn repository

I am trying to copy a deleted file from a previous version from the svn repository to my working directory.

I know that the file is present in revision rxxx , because I do svn log -v and can see the old revision number associated with the file.

I also do svn info to find the repository name which in my case is of the form svn+ssh://repository

I then 开发者_如何学Pythondo svn copy -r xxx svn+ssh://repository name/filename ./filename

But it complains that svn: File not found


By default when you specify the URL of a file in a repository, SVN assumes you're referring to an object in HEAD. So your command actually means:

  1. locate 'filename' in HEAD
  2. trace the history of that file back to revision xxx
  3. copy the file as it looked then, into the current directory

Of course, this fails at the first step since the file no longer exists in HEAD. You need to explicitly reference the object that used to be called filename back in revision xxx, using what's known as a "peg revision":

svn copy -r xxx svn+ssh://repository/filename@xxx ./filename

The SVN book has a more in-depth explanation of peg revisions, if you're feeling brave...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜