Search code examples
svnrevert

SVN does not appear to be reverting changes


I pulled from a repo, made changes across several files, and now I want to undo them.

I tried svn revert -R ., and svn revert --depth infinity . but when I call svn status, I'm still seeing all the files marked as modified, and they seem to be the same as they were before I tried to revert.

I saw this discussion in the docs on reverting changes, but it seems to deal with going from one commit to another, rather than undoing all uncommitted changes.

(I do not have access to TortoiseSVN.)

I can't give you an exact dump of the status command, but it looks somewhat like this:

>>svn status
?    dir/
?    dir/
X    dir/
?    dir/

Performing status on external item at [dir]
M    file

Performing status on external item at [dir]
?    dir/
?    dir/
?    file
?    file
X    dir/

Solution

  • According to the svn:externals documentation there are some commands that will recurse into directories defined by externals. These commands are:

    • checkout
    • update
    • switch
    • export
    • status

    Most of these have an --ignore-externals flag letting you avoid updating those.

    However, using svn:externals works by creating independent working copies below the directory where they are defined. Aside from the small set of commands above, that's exactly how the external directories get treated. Specifically in your case, svn revert skips right over the external directories, because those are not actually part of this working copy.

    Sadly that appears to be one of the remaining rough spots in svn:externals. You'll probably need to change directory into the modified external and revert there as well.

    You can probably script this fairly readily.