svn - 如何在 Subversion 中 move/重命名包含 @ 字符的文件

标签 svn character rename move at-sign

来自SVN 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@.

<小时/>

根据这个描述,你只需要在路径中添加一个@符号即可。

所以这个:

svn add "C:\SomeTests\my@file.txt"

给了我这个错误:

svn: E200009: 'C:/SomeTests/my@file.txt': a peg revision is not allowed here

还有这个:

svn add "C:\SomeTests\my@file.txt@"

对我有用。

这也对我有用:

svn info "C:\SomeTests\my@file.txt@"

更多信息请参见:How to escape @ characters in Subversion managed file names?

<小时/>

好的,好的。 但是当我想用@字符重命名或 move 文件时。它提供了奇怪的结果:

与:

svn mv "C:\SomeTests\test.txt" "C:\SomeTests\my@file.txt"

我得到这个文件名:

C:\SomeTests\my@file.txt

与:

svn mv "C:\SomeTests\test.txt" "C:\SomeTests\my@file.txt@"

我得到这个文件名:

my@file.txt@

与:

svn mv "C:\SomeTests\test.txt" "C:\SomeTests\@myfile.txt"

我得到这个文件名:

somefolder@myfile.txt

与:

svn mv "C:\SomeTests\test.txt" "C:\SomeTests\@myfile.txt@"

我得到这个文件名:

@myfile.txt@

我应该怎么做才能让它始终有效? @符号是在开头、中间还是结尾?

(编辑:在我当前的问题中,字符始终位于开头或第二位。)

最佳答案

我已尝试到处寻求支持。 但现在我通过反复试验找到了解决方案。

只需运行这样的命令:

svn mv "C:\@File.txt@\" "C:\@NewFile.txt/"

将 @ (At) 和\(反斜杠) 添加到源路径。 并将/(正斜杠) 添加到目标路径。

它在每个选项中都适合我:

@File to NoAtFile
@File to New@File
@File to @NewFile
NoAtFile to New@File
NoAtFile to @NewFile
_@File to NoAtFile
_@File to New@File
_@File to @NewFile
<小时/>

希望它能帮您解决我遇到的麻烦。 :)

关于svn - 如何在 Subversion 中 move/重命名包含 @ 字符的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27312188/

相关文章:

svn 创建主干和分支

visual-studio - Visual Studio : Load a Project from a Remote Location

php - 如何在 PhpDoc 文档 block 中使用 NetBeans 和 SVN @version 标记?

php - 删除非英文字符 PHP

python - 如何使用Python根据ascii顺序移动字符

c - 多字符字符常量 [-Wmultichar] C 中的错误

svn - Git 是如何解决 merge 问题的?

c++ - 重命名(): Access Denied despite full control

google-drive-api - 通过 API 重命名 Google Drive 中的文件夹

unix - 从shell中的文件递归删除文件名后缀