Tortoise HG - 在提交时添加标签
目前,我只知道如何在提交后添加标签。这意味着获得仅包含该标签的第二次提交。是否可以在提交时添加标签?
At the moment, I only know how to add a tag after a commit. This means that a get a second commit that just contains the tag. Is it possible to add a tag on commit?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
否,因为标签是存储库根目录下的
.hgtags
文件中的一个条目,包含变更集 ID 和标签名称,并且该文件本身处于修订控制之下。在创建变更集之前,变更集 ID 是未知的,因此标记会创建另一个变更集来签入记录该变更集标签的.hgtags
文件。No, because a tag is an entry in the
.hgtags
file at the root of your repository containing the changeset id and the tag name, and this file itself is under revision control. The changeset id isn't known until the changeset is created, so tagging creates another changeset to check in the.hgtags
file recording the tag for that changeset.根据 Mercurial wiki 的说法,这是不可能的。正如马克所说。
https://www.mercurial-scm.org/wiki/Tag
但是,我只是想知道。为什么 Mercurial 不完全忽略 .hgtags 文件?就像它忽略 .hg/ 文件夹一样。
因此,mercurial 在每次生成变更集 ID 时不会包含 .hgtags。
如果 .hgtags、.hgignores 等位于 .hg/ 内,那就太好了
According to mercurial wiki, it is impossible. Just like Mark said.
https://www.mercurial-scm.org/wiki/Tag
But then, i just wondering. Why not mercurial ignoring the .hgtags file altogether ? just like it ignores .hg/ folder.
So mercurial won't include .hgtags everytime it's generating a changeset ID.
Would be great if .hgtags, .hgignores, etc is resides inside .hg/
在我看来,Hg 标记系统有点混乱,因为创建标记会更改历史记录,即使没有项目文件发生更改,也需要合并和提交。标记会很快给历史图带来负担。
我使用了 SVN 标记,它是在单独的分支上完成的,其优点是不更改工作分支历史记录。此外,可以从任何分支进行标记,因为 Hg 从所有分支头部的 .hgtags 文件中获取标记。
下面的小脚本创建一个分支“标记”并将标签放入其中。它将当前分支合并到“标记”分支中,因此很容易看到变更集标记是从哪里完成的(它特别避免了切换分支时的长时间刷新)。
它可能可以改进,但它适合我的需要。
我强烈建议在测试此脚本之前克隆您的项目,以防它的行为不符合您的预期!
用法示例:
For my point of view, Hg tagging system is a bit messy because creating a tag changes the history and needs merging and committing even if no project file has changed. Tagging can burden a history graph very quickly.
I was used of SVN tagging which was done on a separate branch, which has the advantage not to change working branch history. Moreover, tagging can be done from any branch, because Hg takes tags from the .hgtags files on the heads of all branches.
The little script below creates a branch "tagging" and puts tags in it. It merges the current branch in "tagging" branch, so it's easy to see the changeset tag was done from (it especially avoids long refreshes when switching branch).
It can probably be improved, but it suits my needs.
I strongly recommend making a clone of your project before testing this script, in case it does not behave as you expect!
Example Usage:
不确定这是否是您正在寻找的内容,但您可以将标记移动到不同的变更集。
Not sure if this is what you are looking for, but you can move the tag to a different changeset.