2

假设我在 Mercurial 中有大约 50 多个功能分支。如果我做:

hg tag some-tag

在其中一个功能分支中,它似乎传播到所有分支。无论我在哪个功能分支,hg tags都会显示所有标签。这一切都很好。但如果我这样做hg log,它会告诉我包含更改的变更集.hgtags发生在特定分支中:

changeset:   4:ea48c727fbcd
branch:      feat1
tag:         tip
user:        Daniel <xxxx@yyyy.com>
date:        Mon Dec 21 20:15:11 2015 +0100
files:       .hgtags
description:
Added tag feat-1.0 for changeset 3c81a17d4b31

Mercurial 如何.hgtags在所有分支机构之间保持同步?我读过Mercurial Tag Design,但没有提及任何细节。

我要问的原因是我们在工作中使用 Rhodecode for Mercurial,而当它在重负载下时,这种传播似乎明显滞后。

这种滞后真的很烦人,因为我可以在.hgtags文件中看到最新的标签,但hg tags没有列出最新的标签。做另一个标签有时可以解决问题(也许这是 Rhodecode 中的一个错误),但我想知道这是如何工作的,以便更好地理解底层机制。

4

1 回答 1

3

Quoting some documentation:

The tags that are in effect at any given time are the tags specified in each head. A difficult case arises, if the same tag specifies two different revisions in two different heads. There is no general "correct" solution to this problem.

If two definitions/changes of tags seem unrelated...the "tipmost" (e.g. the one with the higher numeric revision number) wins.
...
However if a tag was defined in a common ancestor of both heads, but changed in just one head, the changed one wins over the unchanged one.

Also:

If there is just one head only the last line where the tag appears is taken into account. If there are multiple heads, the previous definitions of the tag are used to determine which head holds the most recent tag.... If a tag points to 0000000000000000000000000000000000000000 it is considered to be deleted.

My guess is the lag is when you have multiple tags in multiple branches that need resolution, Mercurial has to look up each changeset to determine its revision to determine "tipmost". Only the changeset hash and tag name are in .hgtags.

于 2015-12-21T21:56:00.513 回答