自动将生成的文件包含在 hg 存档中
我有一个巨大的 Mercurial 存储库,其中有一个名为“.version”的分级文件。每次提交或更新完成时,都会使用挂钩自动生成此文件。
然而,这个文件是生成的并且没有版本控制(这总是导致与其他项目开发人员发生冲突),我希望当我执行有关 hg archive 的帮助页面时始终将其打包,
hg archive
告诉我们有一个选项
hg archive -I .version
,但是否有可能有一种方法自动执行此包含?
我在 hgrc 文件的联机帮助页中没有找到与此相关的选项。
有什么建议吗?
I have a huge Mercurial Repository with a gerated file called ".version". This file is automatically generated with a hook each time a commit is made or an update is done.
However this file is generated and NOT versioned (this always resulted in conflicts with other project developers), I want it always to be packaged when I do a
hg archive
the help page about hg archive tells that there is an option
hg archive -I .version
but is there maybe a way to perform this inclusion automatically?
I found no option relating to this in the manpage about the hgrc-file.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
archive 命令并不意味着是打包软件的最终解决方案。它只是为您提供一个没有历史记录的 zip 文件或 tar 球,仅此而已。
因此,请编写一个脚本来执行此操作。该脚本可以首先使用 archive 来获取一组干净的文件:
然后运行钩子来生成版本文件,将必要的文件复制到目录中,构建文档等。最后,您自己打包目录即可。
士气是获取文件快照是打包软件的最小部分。
The archive command is not meant to be the end-all-solution to packaging your software. It just gives you a zip file or tar ball without the history, that's all.
So make a script to do this instead. The script can start by using archive to get a clean set of files:
and then run the hook to generate the version file, copy the necessary file into the directory, build documentation, etc. Finally, just pack the directory yourself.
The morale is that getting a snapshot of the files is the smallest part of packaging software.
要自动运行 -I,您可以在 hgrc 中设置一个别名,
但我不认为 -I 会执行您认为它会执行的操作。我对此的理解是,它将存档的内容限制为仅存储库中与模式“.version”匹配的内容,因为存储库中没有它,所以什么都没有。
如果 .version 中您想要的只是正在存档的修订版的版本信息,也许您当前的挂钩应该更改为
post-archive
挂钩?To run -I automatically you can set up an alias in your hgrc
however I don't think -I does what you think it does. My understanding of it is it limits the contents of the archive to only things in the repo that match the pattern ".version" which as you don't have it in the repo is nothing.
If all you want in .version is version information for the revison that is being archived perhaps your current hook should be changed to a
post-archive
hook?