Why Subversion skips files which contain the @ symbol?

Paulius Liekis picture Paulius Liekis · Dec 31, 2009 · Viewed 11.1k times · Source

when I try to execute command like this (from a command-line or Perl script - it doesn't matter):

svn revert "build\[email protected]"

SVN skips this file and outputs:

Skipped 'build\myfile'

I tried doing:

svn revert "build\*.meta"

But it gives the same result.

I can revert these files from the GUI. And I can revert these files by doing (but it reverts more than I want):

svn revert --recursive "build"

Is there a workaround for this?

Answer

Avi picture Avi · Dec 31, 2009

The @ sign in filenames in Subversion actually has a special meaning - a pegged revision number. To quote the Subversion book:

The perceptive reader is probably wondering at this point whether the peg revision syntax causes problems for working copy paths or URLs that actually have at signs in them. After all, how does svn know whether news@11 is the name of a directory in my tree or just a syntax for “revision 11 of news”? Thankfully, while svn will always assume the latter, there is a trivial workaround. You need only append an at sign to the end of the path, such as news@11@. svn cares only about the last at sign in the argument, and it is not considered illegal to omit a literal peg revision specifier after that at sign. This workaround even applies to paths that end in an at sign—you would use filename@@ to talk about a file named filename@.

So, you should append an @ sign to filenames in scripts, like this:

svn revert "build\[email protected]@"