简体   繁体   English

维护并自动更新包含当前修订的文件

[英]Maintain and automatically update a file containing current revision

I'm currently writing a script to report which revision of the base framework each of our projects are using. 我当前正在编写一个脚本来报告我们每个项目正在使用的基本框架的修订版。 I'm trying to do this by creating a version.txt file in our framework trunk which gets automatically updated with the current revision after each commit. 我正在尝试通过在我们的框架主干中创建一个version.txt文件来做到这一点,该文件在每次提交后会自动以当前修订版本进行更新。 This is so each project that has a copy of this base framework know it's revision that it is using. 这样,每个拥有此基本框架副本的项目都可以知道它正在使用的修订版本。

The problem i'm having is getting the version.txt to get updated with the revision after every commit. 我遇到的问题是每次提交后都会获取version.txt以使用修订版进行更新。

I've tried using $Revision$ keyword substitution, but this will only update if version.txt is modified itself (which defeats the purpose). 我试过使用$ Revision $关键字替换,但这只会在version.txt本身被修改时更新(这违背了目的)。

I've thought about using a pre-commit hook to make a change to version.txt so it gets added to the list of files to commit but not sure how to add a file to the commit list during a pre-commit. 我已经考虑过使用预提交钩子对version.txt进行更改,以便将其添加到要提交的文件列表中,但不确定如何在预提交期间将文件添加到提交列表中。

Any better ways to go about this? 还有更好的方法吗?

Thanks 谢谢

  1. You must not and can not change content of transaction in pre-commit hook 您一定也不能更改预提交挂钩中的事务内容
  2. You still can use keyword in version.txt and modify+commit in additional commit from post-commit hook (hook will get rather exotic logic, but it will work) for the cost of "poisoning" repository by 2x amount of commits (1 data + 1 control) 您仍然可以在version.txt中使用关键字,并在提交后的钩子中进行其他提交中的Modify + commit(钩子将获得异乎寻常的逻辑,但它将起作用),以2倍的提交量(1数据)“中毒”存储库的成本+1个控件)
  3. You still can use keyword in version.txt and use single commit, if you before every commit join needed for commit files and version.txt in changelist 如果在更改列表中提交文件和version.txt所需的每次提交联接之前 ,仍可以在version.txt中使用关键字并使用单个提交。

    • If you Projects are also versioned as Framework (and framework linked with externals) at the development stage you can always check svn:external property or svn info in nested WC of framework inside WC of your projects 如果在开发阶段将项目也版本化为框架(以及与外部链接的框架),则始终可以在项目的WC内的框架的嵌套WC中检查svn:external属性或svn info
    • If you want to know version of framework in deployed project, you can inside deploy-process create version.txt with needed content inside deployable tree, read about SubWCRev (part of TortoiseSVN) or it's Linux-equivalent SVNRev 如果您想了解已部署项目中框架的版本,则可以在deploy-process内部创建带有可部署树中所需内容的version.txt,了解SubWCRev(TortoiseSVN的一部分)或与Linux等效的SVNRev

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 自动创建subversion修订文件 - Automatically create subversion revision file 合并将始终更新文件的修订号吗? - Will a merge always update the revision number of a file? 如何获取修订版本中的更新特定文件? - How to get update specific file in revision length? 我已经设置了 SVN 来自动更新 txt 文件中的修订号,但仅限于对文件的更改。 我希望它在每次提交时更新 Rev - I've setup SVN to automatically update the revision number in a txt file but only on changes to file. I'd like it to update Rev on every commit Word / Openoffice文档的当前SVN修订的自动字段更新 - Automatic field update of current SVN revision for Word/Openoffice document 通过当前的svn修订号更新appengine-web.xml中的版本 - Update version in appengine-web.xml by current svn revision number 如何自动将SVN提交消息和修订编号添加到Java文件? - How to automatically add SVN commit messages and revision numbering to java file? TortoiseSVN,更新后(或提交前)更新文件中的修订版 - TortoiseSVN, update revision in file after update (or before commit) 导出后如何将当前的修订号获取到文件中? - How to get the current revision number into a file after export? 当前的Subversion修订版命令 - Current Subversion revision command
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM