Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

copy file from a previous version in the svn repository

Tags:

svn

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 do svn copy -r xxx svn+ssh://repository name/filename ./filename

But it complains that svn: File not found

like image 213
Tanz Avatar asked Feb 24 '11 02:02

Tanz


1 Answers

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

like image 97
SimonJ Avatar answered Sep 22 '22 01:09

SimonJ