从 teamcity 标记 Mercurial 修订版失败,并显示“push在分支‘默认’上创建新的远程头”
我在 Teamcity 中设置了一个构建,用于构建和测试 Mercurial 分支,然后应该标记该分支。
该构建工作正常,但在标记时失败,并出现错误“push 在分支‘默认’上创建新的远程头”。我觉得这有点奇怪,因为正在使用的分支不被称为默认分支。
I have a build set up in Teamcity that builds and tests a mercurial branch, and should then tag that branch.
The building works correctly but when it comes to labelling it fails with the error "push creates new remote heads on branch 'default'". I find this slightly odd because the branch that is being used is not called default.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
在 Mercurial 中,
hg tag
创建一个更新.hgtags
的变更集。听起来您的工作父级不是分支头,因此hg tag
将创建一个分支,并且默认情况下无法推送新分支头。只是猜测...发布一个示例脚本来说明问题。In Mercurial,
hg tag
creates a changeset that updates.hgtags
. It sounds like your working parent is not a branch head, sohg tag
will create a branch, and new branch heads can't be pushed by default. Just a guess...post an example script that illustrates the problem.当 TeamCity 尝试将标签更改签入到 Mercurial 时,我们就发生了这种情况,但由于用于签出/签入的帐户发生更改而失败。 TeamCity 不知道如何合并变更集,因此它只是不断下载新的变更集、构建,然后尝试检查未合并的变更集,其中会出现您看到的错误。
从构建服务器中删除缓存是最简单的恢复方法。
This happened to us when TeamCity attempted to check in the tag change to mercurial but failed due to a change in the account it used for checkout/check-ins. TeamCity does not know how to merge changesets so it simply keeps downloading the new changesets, building, then trying to check the un-merged changeset in which gives the error you saw.
Deleting the cache off the buildserver is the easiest way to recover.
您可以拉取远程存储库并使用
hg head
查看其中有哪些 head、谁创建了它们以及是否要合并它们。You can pull the remote repository and look with
hg heads
which heads are there, who created them, and if you want to merge them.虽然我不确定 teamcity 如何最终出现多个头,但也许在 teamcity 执行构建时进行了签入,但它确实最终出现了多个头。因为每次尝试推送都失败时,它都会重复使用相同的 Mercurial 目录。解决方案是删除 Mercurial 缓存目录中的所有目录,如版本控制设置页面上设置的那样。然后重启teamcity。这提供了一个干净的目录,一切都按计划进行。
Although I can't be sure how teamcity ended up with multiple heads, perhaps there was a checkin while teamcity was performing the build, It did end up with multiple heads. Because it reuses the same mercurial directory each time every time it tried to push ended up failing. The solution was to delete all directories in the mercurial cache directory, as set up on the Version control settings page. Then restart teamcity. This gave a clean diretcory and everything worked as planned.
我相信发生这种情况是因为您的“默认”分支已关闭或合并到另一个分支。 TeamCity 不会强制推送,并且当推送在分支中创建新头时会失败。
在版本 8.0 之前,TeamCity 用于推送到“默认”分支,忽略 VCS 根设置,在 8.0 中,它使用来自标记提交的分支。
I believe that happened because your 'default' branch was closed or merged into another branch. TeamCity doesn't force push and fails when push creates a new head in the branch.
Prior to version 8.0 TeamCity used to push into branch 'default' ignoring VCS root settings, in 8.0 it uses a branch from tagged commit.