提交后在文件中包含修订号吗?
我使用 TortoiseHg 作为我网站的版本控制系统。我想在网站上放置一个标签,报告服务器上的当前版本。我希望它是自动的,而不是手动更新。
如果我可以设置 TortoiseHg 在每次提交时将修订号写入文件,那么我可以将我的网站设置为在进行更改时加载版本号,并将该版本号呈现到页面。有可能让 TortoiseHg 做到这一点吗?
I'm using TortoiseHg as the version control system for my website. I want to put a label on the website which reports the current revision that is live on the server. Rather than updating this manually, I want it to be automatic.
If I can set TortoiseHg to write the revision number to a file whenever I do a commit, I can set my website to load the version number whenever changes are made, and render this number to the page. Is it possible to get TortoiseHg to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
首先,根据合同,我有义务提醒您,修订号在分布式系统中基本上没有意义。
其次,您可能想要的是一个钩子。有多种方法可以做到这一点。最简单的可能是您的网络服务器结帐时的类似内容:
First, I'm contractually obligated to remind you that revision numbers are largely meaningless in distributed systems.
Second, what you probably want is a hook. There are various ways to do this. The simplest is probably something like this on your webserver checkout:
由于您使用的是 .NET,因此每当编译您的解决方案时,还有一些构建工具会自动执行此操作:
Since you're using .NET, there are also build tools that do this automatically whenever your solution is compiled:
还有关键字扩展,它将扩展文件中的 CVS/SVN 样式关键字。它们可以包括版本、日期、作者等...
https://www.mercurial-scm .org/wiki/KeywordExtension
...但它也值得一读,因为您不使用它的原因。
https://www.mercurial-scm.org/wiki/KeywordPlan
There's also the keyword extension, which will expand CVS/SVN style keywords in files. They can include versions, dates, authors, etc...
https://www.mercurial-scm.org/wiki/KeywordExtension
...but it's also worth reading this, for reasons why you wouldn't use it.
https://www.mercurial-scm.org/wiki/KeywordPlan
hg Tip --template "{rev}:{node|short}-{latesttag}+{latesttagdistance}\n"
附近的 smth ,其中, fe 为 hgsubversion repo 今天我得到结果
830:d4b3b8370b3c-1.2.1+42
hg tip --template "{rev}:{node|short}-{latesttag}+{latesttagdistance}\n"
where for, f.e. for hgsubversion repo today I get as result
830:d4b3b8370b3c-1.2.1+42