如何使用 SVN 关键字替换来获取最新标签的名称(在标签目录中)?

How do I use SVN keyword substitution to get the name of the most recent tag (in the tags dir)?

$id$命令只指定修订号。有没有办法获取提交的标签名称或最近的标签?

如果您能解释如何使用 TortoiseSVN 完成此操作,我将不胜感激。

当前 Subversion 1.9 版本中没有这样的关键字。

来自评论:

@WillyG so the keyword expansion has to happen only in e.g. /tags/release-1.2/myversion.txt, right?

@bahrep Yes, that would suffice.

既然你说这样的方法就足够了,我猜你可以手动或使用脚本写入标签的名称,而不是使用关键字。例如。在标记版本之前,创建或修改文件 myversion.txt 以包含标记的名称。

顺便说一句,正如@rup 已经建议的那样,您可以在 users@ SVN mailing list.

提出这个问题
  1. None现有的SVN关键字可以为您提供这样的数据
  2. 您无法在 Subversion 中创建全新的关键字(即使使用 1.8+ 自定义关键字)

但是

  • 因为此数据只能用于未版本控制的已部署应用程序
  • 您可以(必须)自定义部署工具和流程

可以考虑使用其中的SubWCrev魔法,即:

$WCISTAGGED$ $WCISTAGGED?TText:FText$ is replaced with TText if the repository URL contains the tags classification pattern, or FText if not.

关键字,模板文件中的 TText 手动替换为所需的标签名称(部署前)或一些额外的自动化脚本