编辑: Mercurial 版本是 2.7

EDIT2: 我这里有不同的书签,但想删除其中一个而不是合并它们。

我读到我可以使用删除远程书签 foo

hg book -d foo
hg push -B foo

请告诉我我在这里做错了什么,同时尝试在本地删除书签 @default(有效)然后远程删除(无效,因此在下次拉取时再次恢复):
$ hg pull
pulling from /tmp/foo/base
searching for changes
no changes found
divergent bookmark @ stored as @default

$ hg book
* @                         8:d7a82de9f7c9
  @default                  9:c12daad73af2

$ hg book -d @default

$ hg book
* @                         8:d7a82de9f7c9

$ hg push -B @default
pushing to /tmp/foo/base
searching for changes
no changes found
bookmark @default does not exist on the local or remote repository!

$ hg in -B
comparing with /tmp/foo/base
searching for changed bookmarks
no changed bookmarks found

$ hg out -B
comparing with /tmp/foo/base
searching for changed bookmarks
no changed bookmarks found

$ hg pull
pulling from /tmp/foo/base
searching for changes
no changes found
divergent bookmark @ stored as @default

$ hg book
* @                         8:d7a82de9f7c9
  @default                  9:c12daad73af2

谢谢!

最佳答案

远程书签的名称是 @ ,而不是 @default 。您需要做的就是在本地删除 @default,然后将 @ 推送回远程存储库。这将更新远程存储库以与您的 @ 书签一致。
示例(Windows 批处理文件):

hg init a
cd a
echo >file1
hg ci -Am1
hg clone . ..\b
echo >file2
hg ci -Am2
hg book @
hg log
@REM *** At this point "a" has a bookmark on the changeset with comment "2"
cd ..\b
echo >file3
hg ci -Am3
hg book @
@REM *** At this point "b" has a bookmark on the changeset with comment "3"
hg pull ..\a
@REM *** Mercurial 2.7 named the divergent bookmark @1.
@REM *** I delete the local divergent bookmark and push back to "a" (including new changeset)
hg boo -d @1
hg push ..\a -f -B @

@REM *** Display "b" log
hg log

@REM *** Display "a" log...bookmark is moved to changeset with comment "3"
cd ..\a
hg log

关于mercurial - 为什么我不能在 Mercurial (hg) 中删除这个远程书签?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18662121/

10-09 06:54
查看更多