Scott Purcell wrote:
> I had a file in repository that was at revision 9. I wanted to see how
> this works, so I issued a ‘svn delete thefile’, then svn commit thefile.
> The file was gone from my working dir and from the repository I guess.
> Anyway, now lets say I want to retrieve revision 7 of ‘thefile’.
> How can I do that? Is the only way to look at revisions, is to put in
> dates, or know the revision #? Isn’t there a way to show all revisions
> since it has been in the repository?
> That is one of cvs’s strengths in my opinion, and I would think
> subversion would have it.
I'm not sure what your complaint is, CVS is the same way. You need to
know a revision or date or other identifier to specify which past
version you want to refer to.
To figure that out, look in the history log of the repository to find
out when the file was deleted, or other changes that you wish to undo,
then check out the correct version. In the case of deleted files, you
will need to use a peg revision, so if you see that the file was deleted
in rev 7 and you want to bring it back, do "svn copy
/path/to/repo/thefile@7 ." which will pull the file that in rev 7 was
named thefile and drop it in your CWD. Once you commit it will then
reappear in the head revision of the repository.
You have to use peg revisions for referring to deleted files because
that name no longer exists in the head revision. This is one of the
ways svn differs from cvs: with cvs when you delete a file, it just
gets moved to the Attic/ and if you ever create a new file that happens
to have the same name, then the old file is pulled from the Attic/,
modified, and saved, so the completely new file inherits all the history
of the deleted file that it has nothing to do with. Subversion actually
versions the directories so deleting a file just removes the name from
the directory as of the HEAD revision. This allows you to retain
history when you rename or copy files, and abandon history from deleted
files if you want to create a new unrelated file with the same name.
To unsubscribe, e-mail: email@example.com
For additional commands, e-mail: firstname.lastname@example.org
Received on Tue Feb 21 16:10:48 2006