在 Mercurial 中使用基本标签
我们刚刚开始使用 hg,并且我们正在为系统中的常用模块使用基本标签。我有几个关于标签如何工作的问题。
(#1) 当我使用以下命令添加标签时,它会自动为我签入 .hgtags 文件吗?
hg tag MY_TAG
当我第一次添加标签时,它会在 .hgtags 文件中添加一行。当我对 tag 命令执行 -f(强制)时,它会向文件添加另一个条目。然后,当我删除它时,它会向 .hgtags 文件添加 另外 2 行 行。最终我的文件看起来像这样:
af9e9bf4cf004a7fab4f911e95d1002579fd851a MY_TAG //来自初始标记 af9e9bf4cf004a7fab4f911e95d1002579fd851a MY_TAG //来自删除(1/2) 0000000000000000000000000000000000000000 MY_TAG //来自删除(2/2) 4611114976f02dd0d4f8ec9e84266dcea161cd3f MY_TAG //来自拉取后的标签 0426c9e6e0ccf01e6d18d85420466d1edd1bff1f MY_TAG //来自强制标记
(#2) 为什么它不断向 .hgtags 文件添加行?当我创建基本标签时,我只关心文件中的单个条目。我应该关心这个肿胀吗?我是否必须手动管理 .hgtags 文件才能以这种方式工作?
(#3) 另外,删除行是否必须在文件中保持连续?
(#4) 文件是从上到下读取的,还是 Mercurial 确实找到了最新的变更集并在我移动到标签时使用该变更集?
We just started using hg and we're using base tags for common modules in our system. I have a few questions about how tags work.
(#1) When I add a tag using the following command, does it automatically check in the .hgtags file for me?
hg tag MY_TAG
When I add a tag for the first time, it adds a line to the the .hgtags file. When I do a -f (force) on the tag command, it adds another entry to the file. Then, when I remove it, it adds 2 more lines to the .hgtags file. Ultimately my file ends up looking like this:
af9e9bf4cf004a7fab4f911e95d1002579fd851a MY_TAG //from initial tag af9e9bf4cf004a7fab4f911e95d1002579fd851a MY_TAG //from delete (1/2) 0000000000000000000000000000000000000000 MY_TAG //from delete (2/2) 4611114976f02dd0d4f8ec9e84266dcea161cd3f MY_TAG //from tag after pull 0426c9e6e0ccf01e6d18d85420466d1edd1bff1f MY_TAG //from forced tag
(#2) Why does it keep adding lines to the .hgtags file? When I'm doing a base tag, I only really care to have a single entry in the file. Should I care about this bloat? Do I have to manually manage the .hgtags file to work in this way?
(#3) Also, do the delete lines have to remain contiguous in the file?
(#4) Is the file read from top to bottom, or does Mercurial actually find the latest changeset and use that one when I move to a tag?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MY_TAG
匹配的最后一行将被用作标记。如果您需要清理某些内容,确实没有理由不编辑标签文件。一般来说,标签不应该移动,如果您想经常移动它们,您可能需要查看
MY_TAG
is used as the tag.There's really no reason not to edit the tags file if you need to clean something up. In general, tags shouldn't move, and if you're wanting to move them frequently, you may want to look into bookmarks instead.