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:
- locate 'filename' in HEAD
- trace the history of that file back to revision
xxx
- 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...
精彩评论