2013-08-26 37 views
0

我想在源文件中展开/替换我定义的属性。这将是很好,如果,在文件中,我可以用通常的CVS关键字展开:svn用户定义的属性关键字扩展/替换

svn propset svn:keywords "Date Revision" "S:\Source\myfile.js"

svn propset Originator "[email protected]" "S:\Source\myfile.js"

上的文件:

// This is myfile.js 
// $Date$ 
// $Revision$ 
// $Originator$ 

产量:

// This is myfile.js 
// $Date: 2013-08-25 11:22:33 -0600 (Sun, 25 Aug 2013) $ 
// $Revision: 78 $ 
// $Originator: [email protected] $ 

我在猜测某种提交或提交后触发/操作可以处理这个(svn gnubie)。并发症可能是我正在使用Google项目。 注意:我知道$ Author $。 $ Originator $只是我想要做的一个例子。

TIA

回答

0

如果你想使用Subversion的自定义关键字,您必须使用SVN 1.8 * - 这个版本添加的可能性除旧,“经典” SVN来定义新的关键字:关键字。但是,无论如何,这些关键字仍然不能完全自由形式。您的关键字的定义必须由有限的基元集来构造。

svn help propset

Custom keywords can be defined with a format string separated from 
    the keyword name with '='. Valid format substitutions are: 
    %a - The author of the revision given by %r. 
    %b - The basename of the URL of the file. 
    %d - Short format of the date of the revision given by %r. 
    %D - Long format of the date of the revision given by %r. 
    %P - The file's path, relative to the repository root. 
    %r - The number of the revision which last changed the file. 
    %R - The URL to the root of the repository. 
    %u - The URL of the file. 
    %_ - A space (keyword definitions cannot contain a literal space). 
    %% - A literal '%'. 
    %H - Equivalent to %P%_%r%_%d%_%a. 
    %I - Equivalent to %b%_%r%_%d%_%a. 

也就是说,你,或许,与构建Originator(中提到的形式)的麻烦 - 的用户从来没有直接存储或引用的电子邮件,但有些其他关键词可以被定义和使用

+0

谢谢。我也应该提到,我已经阅读了有限的一组预定义宏构建的关键字。 – mnemotronic

+0

....抱歉由StackOvfl评论编辑超时。如何扩大我的OP的线。我以使用Originator $/$ Author $为例的错误。重新开始:假设属性“xyzzy”的值为“您的所有基地都属于我们”,我想将“$ xyzzy $”扩展为“$ xyzzy:您的所有基地都属于我们$”。很明显,svn不会使用默认功能来完成它。这可以使用提交自动化完成吗?我可以在Google项目上做到吗? – mnemotronic

+0

@mnemotronic - 简短答案是“否”和“否”。第一个答案可以是“部分是的,如果你可以同意额外的提交?-commit钩子和SVN服务器允许启用和使用自定义钩子(GC *没有*钩子)” –

0

尝试简单地:

svn propset svn:keywords "Date Revision [email protected]" "S:\Source\myfile.js" 

设置此属性后,请不要忘记提交文件! (使用龟SVN 1.8.11测试)