2014-12-05 110 views
4

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 [email protected] 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 [email protected]@. 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 [email protected]@ to talk about a file named [email protected]


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

所以这个:

svn add "C:\SomeTests\[email protected]"

给我的错误:

svn: E200009: 'C:/SomeTests/[email protected]': a peg revision is not allowed here

这:

svn add "C:\SomeTests\[email protected]@"

为我工作。

也是这个工作对我来说:

svn info "C:\SomeTests\[email protected]@"

更多在这里:How to escape @ characters in Subversion managed file names?


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

有:

svn mv "C:\SomeTests\test.txt" "C:\SomeTests\[email protected]"

我得到这个文件名:

C:\SomeTests\[email protected]

有:

svn mv "C:\SomeTests\test.txt" "C:\SomeTests\[email protected]@"

我得到这个文件名:

[email protected]@

有:

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

我得到这个文件名:

[email protected]

有:

svn mv "C:\SomeTests\test.txt" "C:\SomeTests\@[email protected]"

我得到这个文件名:

@[email protected]

什么SH我应该这样做,它总是有效的? 不管@符号是在开始,在中间还是在结尾?

(编辑:以我现在的问题人物总是在开始或在第二位。)

回答

1

我试图处处得到一些支持。 但现在我已经通过反复试验发现了我的解决方案。

就这样运行命令:

svn mv "C:\@[email protected]\" "C:\@NewFile.txt/" 

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

它为我在每个选项:

@File to NoAtFile 
@File to [email protected] 
@File to @NewFile 
NoAtFile to [email protected] 
NoAtFile to @NewFile 
[email protected] to NoAtFile 
[email protected] to [email protected] 
[email protected] to @NewFile 

我希望它可以节省你的麻烦我了。 :)

0

伟大的问题;可疑的答案... 这似乎错误打字;也许不会从命令行复制。目前我不在Windows上,因此无法在那里测试您的解决方案。 另外,我正在使用svn和Linux上的名字符号重命名一个目录。

svn mv "[email protected]@[email protected]" "[email protected]@gmail.com" 

请注意,单个@在源的末尾转义名称中的任意数量。目的地是字面上的。

另请参阅:This SO post