fix sync of remote bookmarks

Summary:
The simplest fix so far is to erase accessed bookmarks state before switching

New cloud join will

Reviewed By: markbt

Differential Revision: D22791409

fbshipit-source-id: 9675ec03c275e42e640d3a95dd5eda2ae084b92b
This commit is contained in:
Liubov Dmitrieva 2020-07-28 07:50:16 -07:00 committed by Facebook GitHub Bot
parent 54a2c6028c
commit 543c7b3a88
3 changed files with 9 additions and 6 deletions

View File

@ -11,6 +11,7 @@ import re
import time
from edenscm.mercurial import (
bookmarks as bookmarksmod,
cmdutil,
error,
extensions,
@ -208,6 +209,8 @@ def cloudjoin(ui, repo, **opts):
for key in sync._getremotebookmarks(repo).keys()
}
sync._updateremotebookmarks(repo, tr, bmremove)
# erase state of the remote accessed bookmarks as well
bookmarksmod.cleanselectivepullaccessedbookmarks(repo)
# erase state if the repo has been connected before to the destination workspace
syncstate.SyncState.erasestate(repo, workspacename)
# clear subscription

View File

@ -1328,6 +1328,12 @@ def _readremotenamesfrom(vfs, filename):
yield node, nametype, remote, rname
def cleanselectivepullaccessedbookmarks(repo):
vfs = repo.sharedvfs
with lockmod.lock(vfs, _selectivepullaccessedbookmarkslock):
vfs.tryunlink(_selectivepullaccessedbookmarks)
def selectivepullbookmarknames(repo, remote=None, includeaccessed=True):
"""Returns the bookmark names that should be pulled during a pull."""
initbooks = set(repo.ui.configlist("remotenames", "selectivepulldefault"))

View File

@ -390,16 +390,12 @@ Bookmark feature should disappear in w2 but master will stay as it is a protecte
@ 0 base: public
Bookmark feature reappear here due to a bug in selectivepullaccessedbookmarks
TODO: fix selectivepullaccessedbookmarks
$ hg pull -B stable -q
$ showgraph
o 7 S: public remote/stable
|
| o 6 M: public remote/master
|/
| o 5 F: public remote/feature
|/
| o 4 D (W2): draft book (W2)
| |
| o 3 C (W2): draft
@ -428,8 +424,6 @@ Switch one more time. Bookmark stable should return and feature disappear.
|
| o 6 M: public remote/master
|/
| o 5 F: public remote/feature
|/
| o 4 D (W2): draft book (W2)
| |
| o 3 C (W2): draft