TortoiseSVN 关键字替换何时发生? [英] When does TortoiseSVN keyword substitution occur?

查看:25
本文介绍了TortoiseSVN 关键字替换何时发生?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关键词替换什么时候发生?如何设置

When does keyword substitution occur? How to set

我设置了 svn:keywords 属性

我将这些行放在 1.txt 中并提交.

I put these lines in 1.txt and committed it.

$Revision$
$Author$

推荐答案

当且仅当适当的 svn:keywords 值时,关键字才会在文件的 checkout/update/switch/export/cat 上展开设置.当提交包含关键字的文件时,客户端将关键字缩减为关键字字符串的空副本并将其发送到服务器.除非设置了 svn:keywords 属性,否则 Subversion 不会启用关键字的原因是 Subversion 永远不会更改您的文件内容,除非您告诉我们这样做,而该属性会这样做.

Keywords are expanded on checkout/update/switch/export/cat of a file if and only if the appropriate svn:keywords values are set. When committing a file containing a keyword the client reduces the keyword down to be an empty copy of the keyword string and sends that to the server. The reason Subversion does not enable keywords unless the svn:keywords property is set is Subversion will never change your file content unless you tell us to do so, which the property does.

考虑 Subversion 的 INSTALL 文档.它的 svn:keywords 属性设置为 LastChangedDate.如果您使用 HTTP(而不是 Subversion 客户端)从此 URL 检索文件:https://svn.apache.org/repos/asf/subversion/trunk/INSTALL

Consider the INSTALL document for Subversion. It has the svn:keywords property set to LastChangedDate. If you retrieve the file with HTTP (and not a Subversion client) from this URL: https://svn.apache.org/repos/asf/subversion/trunk/INSTALL

您会注意到该文件只有 $LastChangedDate$ 并且没有展开.这是存储在服务器中的文件的表示.从 1.8.0 开始,我们为服务器增加了一个选项,允许 HTTP 客户端请求扩展关键字.因此,如果您访问以下 URL,您将看到关键字已展开:https://svn.apache.org/repos/asf/subversion/trunk/INSTALL?kw=1

You will note that the file only has $LastChangedDate$ and is not expanded. This is the representation of the file as stored in the server. Since 1.8.0 we have an addition option for the server that allows HTTP clients to request the keywords be expanded. So if you visited the following URL you will see the keyword is expanded: https://svn.apache.org/repos/asf/subversion/trunk/INSTALL?kw=1

您还可以使用 Subversion 客户端的 cat 命令来检索文件并为您进行关键字替换(例如svn cat https://svn.apache.org/repos/asf/subversion/trunk/INSTALL).

You can also use the Subversion client's cat command to retrieve files and do the keyword substitution for you (e.g. svn cat https://svn.apache.org/repos/asf/subversion/trunk/INSTALL).

关键字在扩展时扩展到的值基于文件上次更改的修订的修订属性.修订属性通常在提交时设置(尽管修订属性可能会在以后更改).因此,您在输出中获得的值取决于扩展完成时的值.HeadURL 属性当然也是如何访问存储库的属性.Revision 可能永远不会改变.

The values that keywords are expanded to when they are expanded are based on the revision properties for the revision the file was last changed in. Revision properties are generally set at commit time (though the revision properties may be changed at a later date). So what the values you get in the output depend upon the values at the time the expansion is done. The HeadURL property is of course also a property of how the repository is accessed. Revision may never change.

我建议阅读关于关键字的部分如果您要使用它们,请在 SVN 手册中替换.

这篇关于TortoiseSVN 关键字替换何时发生?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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