Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to escape @ characters in Subversion managed file names?

Tags:

escaping

svn

For many Subversion operations, appending the '@' symbol to the end of a file or URL argument allows you to target a specific revision of that file. For example, "svn info test.txt@1234" will give information about test.txt as it existed in revision 1234.

However, when the name of the file contains an @, it is incorrectly interpreted by Subversion as a revision specifier:

svn info '[email protected]' svn: Syntax error parsing revision '.txt'

I've tried double and single quotes as well as escaping with '/', '\', and '@'. How can I tell Subversion to treat the @ symbols as part of the file name?

like image 426
weston Avatar asked Apr 16 '09 18:04

weston


4 Answers

From the SVN book (emphasis added):

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@.

like image 134
Rob Kennedy Avatar answered Oct 21 '22 05:10

Rob Kennedy


The original answer is correct, but perhaps not explicit enough. The particular unix command line options are as follows:

svn info '[email protected]@'

or

svn info "[email protected]@"

or

svn info image\@2x.png\@

I just tested all three.

like image 44
David H Avatar answered Oct 21 '22 06:10

David H


Solution for adding multiple files in different sub-folders:

for file in $(find ./ -type f -name "*@*.png"); do svn add $file@; done

Just replace the "png" in "@.png" to the kind of files you want to add.

like image 39
Lcsky Avatar answered Oct 21 '22 05:10

Lcsky


to add the following file : [email protected] do the following: svn add image\@2x.png@

like image 27
Malek Belkahla Avatar answered Oct 21 '22 05:10

Malek Belkahla