我不在我的 Mercurial 系统前面进行验证,但我认为问题是 Mercurial 只考虑来自拓扑头的 .hgtags,而不是分支头。例子:
[1]---[2]---[5]---[6] Default
\ /
[3]---[4] Vendor
[6] 是拓扑头,[4] 和 [6] 是分支头。解决方案是在合并时保留对 .hgtags 的所有更改。
编辑
这是我的测试。合并后,我立即接受了本地 .hgtags 并且hg tags
只在 .hgtags 上显示标签default
。我无法更新到供应商标签,这与您所看到的不同。我正在使用 Mercurial 2.3.1。在 vendor 上创建另一个变更集并制作第二个拓扑头后,丢失的标签重新出现。
hg init test
cd test
echo >a
hg ci -Am 1
hg branch vendor
echo >b
hg ci -Am 2
hg tag v1
hg update default
hg tag d1
hg merge vendor --tool internal:local
hg ci -m Merge
@REM This only shows 'tip' and 'd1'
hg tags
hg update vendor
hg tags
hg update d1
@REM This fails to update.
hg update v1
@ Add another topological head by committing to vendor
hg update vendor
echo >c
hg ci -Am 3
@ Now all tags are visible and work.
hg tags
hg update v1
hg update d1
和输出:
C:\>hg init test
C:\>cd test
C:\test>echo 1>a
C:\test>hg ci -Am 1
adding a
C:\test>hg branch vendor
marked working directory as branch vendor
(branches are permanent and global, did you want a bookmark?)
C:\test>echo 1>b
C:\test>hg ci -Am 2
adding b
C:\test>hg tag v1
C:\test>hg update default
0 files updated, 0 files merged, 2 files removed, 0 files unresolved
C:\test>hg tag d1
C:\test>hg merge vendor --tool internal:local
1 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
C:\test>hg ci -m Merge
C:\test>hg tags
tip 4:80759c41b3cc
d1 0:17b05ed457d1
C:\test>hg update vendor
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
C:\test>hg tags
tip 4:80759c41b3cc
d1 0:17b05ed457d1
C:\test>hg update d1
0 files updated, 0 files merged, 2 files removed, 0 files unresolved
C:\test>hg update v1
abort: unknown revision 'v1'!
C:\test>hg update vendor
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
C:\test>echo 1>c
C:\test>hg ci -Am 3
adding c
C:\test>hg tags
tip 5:a2c0fe73a9f1
v1 1:3168d0f4e5e5
d1 0:17b05ed457d1
C:\test>hg update v1
0 files updated, 0 files merged, 2 files removed, 0 files unresolved
C:\test>hg update d1
0 files updated, 0 files merged, 1 files removed, 0 files unresolved