问题
I'm trying to checkout a project that was deleted from my SVN in revision 401. The project is now defunct and had been completely replaced with a rewrite of the code, but I'd like to do a checkout so that I can refer back to small pieces of the old code while working on the rewrite.
As far as I can tell, this should be as simple as checking out the old path and the last good revision (400). But when I try this I get an error, because it's trying to use the latest revision:
C:\Users\couling\workspace>svn checkout --revision=400 https://svn.domain.com/repos/trunk/OldProject
Error validating server certificate for 'https://svn.domain.com:443':
- The certificate is not issued by a trusted authority. Use the
fingerprint to validate the certificate manually!
Certificate information:
- Hostname: svn.domain.com
- Valid: from Tue, 11 Dec 2012 15:03:33 GMT until Wed, 11 Dec 2013 15:03:33 GMT
- Issuer: Personal Certificate, Foomy Whatsit, Blah, Blah, GB
- Fingerprint: 01:02:03:04:05:06:07:08:09:10:11:12:13:14:15:16:17:18:19:20
(R)eject, accept (t)emporarily or accept (p)ermanently? t
svn: '/repos/!svn/bc/1418/trunk/OldProject' path not found
C:\Users\couling\workspace>
I can easily browse to the folder at revision 400 through a web browser so in the worst case I can still view the code, but I'd prefer to have a copy of all the source files to hand for my IDE.
For reference I'm using this version of the client:
C:\Users\couling\workspace>svn --version
svn, version 1.6.16 (r1073529)
compiled Mar 8 2011, 11:47:41
Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.apache.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).
How do I check out a folder that has now been deleted?
Edit
For the removal of doubt.... The checkout command above uses the syntax --revision=400
as this happened to be the last way I wrote the command before posting. This is valid syntax given that the svn command uses a library compatible with the GNU getopt_long. The version I use does and the following are all synonymous -r 400
-r400
--revision 400
--revision=400
. The different variants are all reduced to a single result by the getopt library.
As it happens the reason that was the last command I used before posting was that I went through all variants to confirm it was not related to this issue. They all had the same result.
回答1:
svn co --depth=infinity https://svn.domain.com/repos/trunk/OldProject@400
See "SVNBook | Peg and Operative Revisions".
回答2:
- When you use Operative Revision, you have to write it with space:
-r 400
- You can use PEG-revision un URL instead of OR:
https://svn.domain.com/repos/trunk/OldProject@400
- In order to perform operation without user-intervention (for cert) you can add to command
... --non-interactive --trust-server-cert
Samples
because OP insists insists on being right instead of RTFM and try
Precondition: http://mayorat.ursinecorner.ru:8088/svn/Hello/branches/Greetings doesn't exist in current HEAD, but was in r16
svn co -r 16 http://mayorat.ursinecorner.ru:8088/svn/Hello/branches/Greetings
svn: E160013: '/svn/Hello/!svn/rvr/37/branches/Greetings' path not found
svn co http://mayorat.ursinecorner.ru:8088/svn/Hello/branches/Greetings@16
A Greetings\Hello.txt
U Greetings
Checked out revision 16.
svn co -r=16 http://mayorat.ursinecorner.ru:8088/svn/Hello/branches/
svn: E205000: Syntax error in revision argument '=16'
- According to last comment I had to get HEAD of /branches, but
>dir /b
Greetings
来源:https://stackoverflow.com/questions/15875856/how-to-check-out-a-deleted-project-from-an-svn-on-the-command-line