Reputation: 2908
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?
Upvotes: 196
Views: 56026
Reputation: 1826
I had the problem today with filenames generated from email addresses (not a very good idea!).
Solution, using printf
options of find
, and shell expansion
svn add $(find . -name "*@*.png" -printf "%p@ ")
Upvotes: 0
Reputation: 156
The only solution that worked for me was the same suggested by @NPike
svn revert 'path/to/filename@ext@'
Upvotes: 0
Reputation: 2256
Simply add
@
at the of the file you need to use, no matter what SVN command it is, e.g.:
[email protected]
to
[email protected]@
Upvotes: 12
Reputation: 1524
To add multiple files, there is alternative solution:
svn status | grep \.png | awk '{print $2"@"}'| xargs svn add
Upvotes: 6
Reputation: 164
For svn commands with 2 arguments like "move", you must append "@" only at left (first) parameter. For example:
$ svn add README@txt@
A README@txt
$ svn move README@txt@ README2@txt
A README2@txt
D README@txt
$ svn status
A README2@txt
$ svn commit -m "blah"
Adding README2@txt
Transmitting file data .
Committed revision 168.
$ svn delete README2@txt@
D README2@txt
$ svn commit -m "blahblah"
*Deleting README2@txt
Committed revision 169.
This line is important: $ svn move README@txt@ README2@txt
As you can see, we don't need to append "@" at "README2@txt"
Upvotes: 1
Reputation: 825
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.
Upvotes: 14
Reputation: 41662
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.
Upvotes: 83
Reputation: 13254
In my case I needed to remove files from a SVN repo that contained an @ sign:
This wouldn't work:
svn remove 'src/assets/images/hi_res/[email protected]'
But this did:
svn remove 'src/assets/images/hi_res/[email protected]@'
Upvotes: 8
Reputation: 684
@David H
I just tried a similar command without escaping the @ symbols and it still works fine
svn ci splash.png [email protected]@
This is on GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0) and svn 1.6.16
Upvotes: 0
Reputation: 121
to add the following file : [email protected] do the following: svn add image\@2x.png@
Upvotes: 12
Reputation: 163357
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 asnews@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 usefilename@@
to talk about a file named filename@.
Upvotes: 290