如何用版本号而不是GUID(在TeamCity中)标记我的版本? [英] How can I label my build with revision number and not the GUID (in TeamCity)?

查看:74
本文介绍了如何用版本号而不是GUID(在TeamCity中)标记我的版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试与TeamCity进行持续集成".我想以增量方式标记我的构建,而VCS提供的GUID并不像简单的递增数字那样有用.我希望该数字与Mercurial中的数字修订版本实际匹配.

I am trying to do "continuous integration" with TeamCity. I would like to label my builds in a incremental way and the GUID provided by the VCS is not as usefull as a simple increasing number. I would like the number to actually match the revision in number in Mercurial.

我的处境

商品信息:

我希望将版本标记为0.0.12,而不是GUID.

I would like the build to be labeled 0.0.12 rather than the GUID.

有人会这么仁慈,并为我省去数小时的时间来解决这个问题吗?

Would someone be so kind and save me hours of trying to figure this out ?

推荐答案

正如Lasse V. Karlsen提到的那样,这些数字修订版本号是本地克隆特定的,并且每个克隆都可以不同.它们确实不适合版本控制-您可以重新克隆相同的存储库并获得不同的修订号.

As Lasse V. Karlsen mentioned those numerical revision numbers are local-clone specific and can be different for each clone. They're really not suitable for versioning -- you could reclone the same repo and get different revision numbers.

至少包括节点ID也会创建类似0.0.12-6ec760554f2b的内容,这样您仍然可以获得可排序的发布工件,但仍可以坚定地确定您的发布.

At the very least include the node id also creating something like 0.0.12-6ec760554f2b then you still get sortable release artifacts but are still firmly identifying your release.

如果您使用数字标签来标记发行版,则有一个特别好的选择:

If you're using numeric tags to tag releases there's a particularly nice option:

% hg log -r tip --template '{latesttag}.{latesttagdistance}'

,如果该克隆上的最新标签称为1.0.1并且在84之前提交,则给出的值如下:

which, if the most recent tag on that clone was called 1.0.1 and was 84 commits ago gives a value like:

1.0.1.84

由于在不同的存储库中,标签的头部距离可以有84个提交,因此您应该仍然可以包含以下节点ID:

Since you can have different heads that are 84 commits away from a tag in different repos you should still probably include the node id like:

% hg log -r tip --template '{latesttag}.{latesttagdistance}-{node|short}'

给予:

1.0.1.84-ec760554f2b

产生 great 版本的字符串.

这篇关于如何用版本号而不是GUID(在TeamCity中)标记我的版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆