提交后如何在我的源代码中存储新的 SVN 修订号?(乌龟SVN)

问题描述:

是否有可能通过 TortoiseSVN 知道您将在提交之前获得的 SVN rev 编号,以便我可以将该 rev# 放入源代码注释部分?

Is it possible, via TortoiseSVN, to know the SVN rev number you are about to get prior to a commit so that I can put that rev# into the source code comment section?

也许我可以将一个特殊的键名/变量放入我的文件中,TortoiseSVN 会自动将其替换为即将提交的 rev#?

Perhaps there is a special keyname/variable that I can put into my file that TortoiseSVN will automatically replace with the rev# it's about to commit to?

这背后的动机是我可以通过查看源代码来获取最新版本并查看它包含哪些 SVN 版本.它还给管理层带来了温暖.

The motivation behind this is that I can take the latest build and see what SVN rev's it was comprised of by just looking at the source code. It also gives management warm fuzzies.

Subversion 确实支持关键字扩展,但您可能想要在选择实施之前阅读此处.

Subversion does support keyword expansion, but you may want to read here before choosing to implementing it.

避免使用 SVN 中已有的内容修改提交的文件通常是个好主意的原因有很多.上面的第二个链接提供了更多关于为什么这可能是一个坏主意的详细信息.但基本上,差异和补丁可能会成为问题.

There are a number of reasons why it's generally a good idea to avoid modifying your committed files with content that is already in SVN. The second link above provides more detail on why this can be a bad idea. But basically, diffs and patches can become problematic.

您也不需要复制 Subversion 捕获的信息,因为这可以通过 log 命令轻松获取.

You also don't need to duplicate the information that Subversion captures because this can be easily obtained via the log command.