1
votes

When looking for SVN revert command explanation, I saw the following explanation:

this subcommand does not require network access, and resolves any conflicted states. However, it does not restore removed directories.

I want to know, why it does not need network access, and why it does not restore removed directories.

2
When you say "I saw the following explanation", it's often helpful to provide a link to it so that others can read what you're referring to and make sure that it's a trustworthy source and you haven't misinterpreted anything. - alroc

2 Answers

1
votes

svn revert doesn't require network access because every working copy stores a "pristine" copy of each file as it was downloaded from the repository on the last update. So revert copies that file into your working copy.

As for the removed directories, that may not be true anymore. In versions previous to 1.7, each directory could be treated as an independent working copy, so it's possible that it couldn't restore those as it didn't have the pristine copies.

1
votes

svn saves informations about the working copy in the .svn folders and uses it to perform some management tasks on the working copy without having to access the repository i.e. go over the network. If you browse those directories you'll find there a local database file and bunch sub-directories with a bunch of .svn-base files. Those reflect the state of your working copy at the last time you have performed an svn update or svn checkout. So if you change a file in your working copy svn can tell the difference based on the corresponding locally saved .svn-base file and thus can revert the changes.

Informations about directory structure is not saved. If you want to revert changes on a directory the simplest way is to perform an svn update - which obviously needs the repository and thus network connection - from the parent of that directory.

It seems that you are reading the help of an older version of the svn client as posted in the answer to this question.

With the version 1.7 (at least, I cannot confirm with which version exactly this change came) and above svn help revert states:

Note: this sub-command does not require network access, and resolves any conflicted states.

And after some testing on one of my local copies:

Deleting using filesystem

Cmd-$> rd /Q /S <working copy>

or deleting using svn command

Cmd-$> svn remove <working copy>
D         <working copy>
D         <working copy>\<file1>
D         <working copy>\<file2>

Using the command

Cmd-$> svn revert -R .

I was able to revert in both cases.