tags:

views:

62

answers:

4

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?

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

Thanks in advance,

A: 
  • 1 - Everything can be undone using SVN. Even a rm (or delete) command can be undone.
  • 2 - #1 applies for every users
Vivien Barousse
+6  A: 

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.

Mark
Mark,Thank you for your clear concise answer and provided examples.I had been misinformed about the concept of "administrative" svn users and their dangers. It sounds like the main danger is from administrators of the svn server, not svn users. I understand anything that can be done from an svn client (the server admin rights are not connected to their svn user rights) can be un-done by pointing back to an earlier revision. Thanks again,
Ed
@Ed: You're certainly welcome.
Mark
A: 

Just checkout a revision where the file still existed:

svn checkout -r <revision> <path to repository>

Now you can add the file again.

sebp
See my comment on timdev's answer. Reverse-merging the change preserves the history of the file(s) in question.
Mark
A: 

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

mrabbitt