2014-12-05 38 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