Why can't I delete this deleted bookmark in Mercurial (hg)?

EDIT: Mercury Version - 2.7

EDIT2: I have different bookmarks here, but you want to delete one of them, not merge them.

I read that I delete the remote bookmark foo with

 hg book -d foo hg push -B foo 

Please tell me what I'm doing wrong here, trying to delete the @default bookmark locally (which works) and then remotely (which does not work, so it restores again the next time it is clicked):

 $ 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 

Thanks!

+4
source share
2 answers

The remote bookmark name is @ , not @default . All you have to do is delete @default locally, then push @ back to the remote repository. This will update the remote repository to agree with your @ bookmark.

Example (Windows batch file):

 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 
+2
source

It seems you have a case of Divergent Bookmarks !

I believe that although I have not yet tried to recreate this on a remote repo to verify) that the remote repo believes that it has an update to the bookmark, which also updated the local repo. The name does not appear, although this is strange; is it called with spaces that the CLI cannot display, or maybe the "@" character itself? Perhaps you have a damaged entry in the bookmark file of the remote repo.

When you pull out a bookmark and the local and remote modules have updated the same bookmark, this creates a diverging bookmark. The remote version is added using "@ [path]", where the path is pulled from the [paths] section of the hgrc file based on the source of the remote repo. (For more information, see hg paths .) The version "@ [path]" exists only locally until you merge and delete the diverging bookmark.

I think that if you merged and clicked on a remote repo, you would solve the bookmark problem and everything would be all right.


In your comment, you said that you intentionally use a bookmark with the name β€œ@” referring to bookmark help: β€œIf you set a bookmark with the nameβ€œ @ ”, new repository clones will have this revision (and the bookmark is active) by default.

In this case, to prevent @default from being created, you need the two conventions to be consistent with what set of changes @ should have; basically you need to correct the discrepancy. Given that you do not want to merge and return to the remote repo, this means updating the @ bookmark to match the remote repo.

Using the console example in your question, I believe that removing the diverging bookmark and resetting the @ bookmark according to the remote repo will not allow the discrepancy to continue:

 hg book -d @default hg book @ -r 9 -f 
+2
source

Source: https://habr.com/ru/post/1500967/


All Articles