为什么 Subversion 会跳过包含 @ 符号的文件?
当我尝试执行这样的命令时(从命令行或 Perl 脚本 - 没关系):
svn revert "build\[email protected]"
SVN 跳过此文件并输出:
Skipped 'build\myfile'
我尝试这样做:
svn revert "build\*.meta"
但它给出了相同的结果。
我可以从 GUI 恢复这些文件。我可以通过执行以下操作来恢复这些文件(但它恢复的程度比我想要的要多):
svn revert --recursive "build"
有解决方法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Subversion 中文件名中的 @ 符号实际上具有特殊含义 - 固定修订号。引用Subversion 书籍:
因此,您应该在脚本中的文件名后附加一个 @ 符号,如下所示:
The @ sign in filenames in Subversion actually has a special meaning - a pegged revision number. To quote the Subversion book:
So, you should append an @ sign to filenames in scripts, like this:
只是为了添加上面的正确答案,如果您有很多名称中带有“@”符号的文件,您想要批量处理(即使用 * 通配符),您可以在 OS X 终端中执行类似的操作(或者任何 Linux 机器):
上面的命令将使用 find 实用程序列出文件名中带有 @ 的每个文件,然后使用 XARGS 将文件路径通过管道传输到 SVN。 XARGS 将用路径替换每个出现的 %,并在文件名末尾附加特殊的“@”,以便 SVN 接受它。
希望这会有所帮助 - 我不得不绞尽脑汁来添加我的应用程序升级到 iOS4.0 所需的 gazzilion @2x.png 文件
Just to add to the above correct answer, if you have lots of files with the "@" symbol in their name that you want to process in a batch (i.e. use * wildcard), you can do something like this in OS X Terminal (or any Linux box really):
The above command will use the find utility to list out each file with @ in its filename and then pipe the path to the file to SVN using XARGS. XARGS will replace each occurrence of % with the path and append the special "@" at the end of the filename so that SVN will accept it.
Hope this helps - I had to whack my head for a bit to add the gazzilion @2x.png files that were needed for my app to be upgraded for iOS4.0
刚刚使用 cmd.exe shell 在 Windows 上正确测试了它 - 将名称用双引号引起来是有效的:
Just tested it properly on windows using the cmd.exe shell - enclosing the name in double quotes works:
什么操作系统?如果是 *nix 系统,请尝试使用“single@quotes”引用您的文件。
What operating system? If it is a *nix system, try quoting your file with 'single@quotes'.