Can a file be recovered after svn delete?
I am trying to figure out if we need to reduce the number of developers having svn admin rights.
1 - If a subversion user accidentally deletes and commits the delete of a file or folder, how can the file be recovered?
开发者_JAVA百科2 - If the subversion user has svn admin rights, does svn delete executed on the client behave differently (more permanent)?
Target: svn command line client under Red Hat Enterprise Linux (RHEL) 5.2
Yes, the deleted data can be recovered. Simply determine which revision removed the information, and "reverse-merge" the commit. Something like this:
svn merge -c -12345 working_copy_path
svn commit working_copy_path
The -12345 means "reverse-merge revision 12345".
Note that subversion itself doesn't have any concept of "administrative" users. Users either have or do not have read and/or write permissions to any given path in the repository. Also note that depending on how you access the repository, there may effectively be no authorization at all.
- 1 - Everything can be undone using SVN. Even a rm (or delete) command can be undone.
- 2 - #1 applies for every users
Just checkout a revision where the file still existed:
svn checkout -r <revision> <path to repository>
Now you can add the file again.
A thorough discussion on reverting deletion from the "Version Control with Subversion" book can be found here:
http://svnbook.red-bean.com/nightly/en/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.resurrect
精彩评论