如何在Subversion托管文件名中转义@字符? [英] How to escape @ characters in Subversion managed file names?

查看:60
本文介绍了如何在Subversion托管文件名中转义@字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于许多Subversion操作,在文件或URL参数的末尾附加 @符号可让您定位该文件的特定版本。例如, svn info test.txt@1234将提供有关test.txt的信息,因为它存在于修订版1234中。

For many Subversion operations, appending the '@' symbol to the end of a file or URL argument allows you to target a specific revision of that file. For example, "svn info test.txt@1234" will give information about test.txt as it existed in revision 1234.

但是,当文件名包含@,它会被Subversion错误地解释为版本说明符:

However, when the name of the file contains an @, it is incorrectly interpreted by Subversion as a revision specifier:


svn info'test @ .txt'
svn:语法错误解析修订版'.txt'

svn info 'test@.txt' svn: Syntax error parsing revision '.txt'

我已经尝试了双引号和单引号以及用'/','转义\和 @。如何告诉Subversion将@符号视为文件名的一部分?

I've tried double and single quotes as well as escaping with '/', '\', and '@'. How can I tell Subversion to treat the @ symbols as part of the file name?

推荐答案

来自 SVN书(强调):


敏锐的读者可能会想知道,peg修订语法是否会导致工作复制路径或实际上带有符号的URL出现问题。毕竟, svn 是如何知道 news @ 11 是我树中目录的名称还是仅仅是 news ?值得庆幸的是,尽管 svn 始终采用后者,但有一个简单的解决方法。 您只需在路径末尾附加一个at符号,例如 news @ 11 @ svn 只关心参数中的最后一个符号,在符号后省略文字钉修订说明符被认为是非法的。此解决方法甚至适用于以at符号结尾的路径-您可以使用 filename @@ 来谈论名为 filename @ 的文件。

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@.

这篇关于如何在Subversion托管文件名中转义@字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆