RE: How to retrieve the content of a "deleted" file

Emmanuel Blot wrote:
> Hi,
>
> I'm not able to access the content of a file at a specific revision
> with the "svn cat" command, as this file has been deleted since (in a
> revision greater than the revision I will to access)
>
> I was using subversion 1.1 (both client and server, based on Apache
> 2.0.54), and I migrated from 1.1 to 1.2.3 (client and server). To
> migrate, I've performed a dump + load into a brand new repository,
> but I still can't get the content of a "deleted" file, so I guess I
> missing an important point. Current revision (HEAD) of the repository
> is 67.
>
> I'd like to get the content of a file which has been added in release
> 59 and deleted in release 62 (to be exact, the file has been moved to
> the same directory, with another name):
>
> svn log -q -v -r 59
> http://10.129.123.78/svn/project/trunk/src/dyntest/scripts>
------------------------------------------------------------------------
> r59 | blote | 2005-09-08 20:28:40 +0200 (Thu, 08 Sep 2005) Changed
> paths: A /trunk/src/dyntest/scripts/errors.dtf
>
------------------------------------------------------------------------
>
> svn log -q -v -r 62
> http://10.129.123.78/svn/project/trunk/src/dyntest/scripts>
------------------------------------------------------------------------
> r62 | blote | 2005-09-09 18:33:17 +0200 (Fri, 09 Sep 2005) Changed
> paths: D /trunk/src/dyntest/scripts/errors.dtf
> A /trunk/src/dyntest/scripts/rc.dtf (from
> /trunk/src/dyntest/scripts/errors.dtf:59)
>
------------------------------------------------------------------------
>
> svn list -r 61
> http://10.129.123.78/svn/project/trunk/src/dyntest/scripts> dzoom0976.dtf
> errors.dtf
> info.dtf
>
> svn list -r 62
> http://10.129.123.78/svn/project/trunk/src/dyntest/scripts> dzoom0976.dtf
> info.dtf
>
> I though I could get the content of this file using the following
> command:
>
> svn cat -r 59
> http://10.129.123.78/svn/project/trunk/src/dyntest/scripts/errors.dtf>
> However, I get the following error (that I don't understand):
>
> svn: REPORT request failed on
> '/svn/project/!svn/bc/67/trunk/src/dyntest/scripts/errors.dtf'
> svn: '/svn/project/!svn/bc/67/trunk/src/dyntest/scripts/errors.dtf'
> path not found
>
> Whatever the "rev" value set to the -r option (svn cat -r 59, -r 60,
> -r61 .. whatever), I always get the same error message, with always
> the HEAD revision (67) in the path.
>
> What should I miss, how can I obtain the content of this file ?
>
> I should say that I'm using Trac, and that the Trac browser is able
> to access the content of the file at revision 59 with no issue.
>
> I'm also able to check out the repository for this revision, and
> obtain the file without any issue:
>
> svn co -r 59
> http://10.129.123.78/svn/project/trunk/src/dyntest/scripts> A scripts/info.dtf
> A scripts/errors.dtf
> A scripts/dzoom0976.dtf
>
> May be I mis-use the svn tool ?
>
> TIA,
> Cheers

As I'm sure many people are tired of saying, you need to use peg
revisions for this.

Because subversion tracks files across name changes, it's not guaranteed
that the file currently in the HEAD revision is the same as the file
with the same name at some prior point. So, if you created an
errors.dtf file and added it to the repository, and then tried your
above command, subversion would complain that the errors.dtf file didn't
exist in revision 59--because it didn't, another file with the same name
did. To access a prior version of a file whose name has changed, or
which has been deleted, by the name it had at some point in the past,
you have to "peg" the command to a revision at which it existed and had
that name.

This tells subversion to give you the file that was named errors.dtf in
revision 61, as it existed at revision 59. It's a very powerful system,
though slightly confusing at first glance, especially because CVS (which
is where most of us came from) doesn't have this capability (since it
doesn't handle file renaming at all).