I need to help for you.
I made images for retina display like "****@2x.png". but it can not add to svn 开发者_开发知识库like this.
******-no-iMac-2:baz shunter$ svn add retina_images/foo@2x.png
svn: warning: 'retina_images/foo' not found
I know how to add resource each like this.
******-no-iMac-2:baz shunter$ svn add retina_images/foo@2x.png@
A (bin) retina_images/foo@2x.png
but I made many images, so I feel so bad to do this way.
I really want to know how to add like this.
******-no-iMac-2:baz shunter$ svn add retina_images/bar/*.png
Please help!!
http://developers.enormego.com/view/add_2x_ios4_resources_svn
This is due to internal path recognizers in SVN. It expects the last at symbol to specify a revision. This is easily corrected by adding an at symbol to the end of your file:
$ svn add Default@2x.png@
A (bin) Default@2x.png
By Shuan (not me:)
The svn
command interprets the @
as an attempt to specify an SVN revision number (@REV format), so...
To add a single file:
svn add filename@2x.png@
Now svn
sees the final @
as the @REV specifier instead of the first one.
To add multiple files: (each with the @ symbol added to the end of the file-name)
ls *2x.png | xargs -I x svn add x@
This lists *2x.png
which will list all your retina images (in the current directory) and the output goes through xargs
, which executes the svn add
command for each file. The -I x
tells xargs
to replace 'x' with the file-name, so svn add x@
becomes the correct file-name with the '@' symbol added to the end.
I had this exact problem a few days ago and solved it this way:
berry$ for i in retina_images/bar/*.png
do
svn add $i@
done
A (bin) retina_images/bar/foo1@2x.png
A (bin) retina_images/bar/foo2@2x.png
A (bin) retina_images/bar/foo3@2x.png
A (bin) retina_images/bar/foo4@2x.png
berry$ svn commit
It's not, perhaps, an ideal solution to the problem, but it worked and I could move on.
I did it like this (in terminal)
svn add Images/icon@2x.png@
Or
The best way is go to Xcode
, right click on the image>source control add
. It adds the images without showing any error.
This question is a bit old now but I notice nobody had yet posted a truly easy one-liner for adding, via terminal, ALL new image files, regardless of extension or "@2x" status - or for removing them. I have these lines in my bash_profile:
alias svn_addall="svn st | grep '^?' | sed -e 's/@2x.*/&@/' | awk '{print \$2}' | xargs svn add"
alias svn_delall="svn st | grep '^\!' | sed -e 's/@2x.*/&@/' | awk '{print \$2}' | xargs svn rm"
Then if you run svn_addall
from any subfolder in your project, it will add ALL files, recursively, whether or not they have @2x in the name.
e.g. all of the below would be added in one go:
? header_bar.png
? bg@2x.jpg
? bg.jpg
? header_bar@2x.png
svn_delall
, in the same way, removes all those pesky !
-marked files that you've deleted via Finder but not yet from svn ;)
Note, these are modified a bit from other people's scripts I've found online, but the others were always either png specific (what about @2x.jpg
?), or they only add retina files without also adding other missing "normal" image files.
Do it like this much easier...
Example:
svn add default@2x.png@2x
The best way I have found is through Subversion integration within XCode. Once you have SVN integration setup (XCode>SCM>Configure SCM), Command+click on the item in the Groups & Files window and choose "Add to Repository". To delete an item, hit delete and choose select YES when prompted if you want to remove from source control.
精彩评论