commitcloud: remove omitted bookmarks that are available locally

Summary:
When syncing, if a locally-available bookmark is synced to a new commit that
has been omitted, remove the local bookmark to ensure that the next cloud sync
doesn't move the bookmark back to where it used to be.

Reviewed By: mitrandir77

Differential Revision: D15414172

fbshipit-source-id: 71aaa2d89f734e4c575c24da2c0ef6b59ca4deaa
This commit is contained in:
Mark Thomas 2019-05-21 14:29:10 -07:00 committed by Facebook Github Bot
parent 93b9b82be1
commit 30e5b3eb26
3 changed files with 9 additions and 17 deletions

View File

@ -465,6 +465,8 @@ def _mergebookmarks(repo, tr, cloudbookmarks, lastsyncstate):
% (cloudnode, name)
)
omittedbookmarks.add(name)
if name in localbookmarks:
changes.append((name, None))
else:
# The bookmarks has been deleted in the cloud.
if localnode is not None and localnode != lastcloudnode:

View File

@ -126,23 +126,16 @@ Rebasing the bookmark will make the draft commit disappear.
|
@ 0: df4f53cec30a public 'base'
Sync in client2. This will fail because we don't have the landed commit, so
we will need to pull.
Sync in client2. This will omit the bookmark because we don't have the landed commit.
$ cd ../client2
$ hg cloud sync -q
67d363c9001e1d7227625f0fa5004aca4572d214 not found, omitting foo bookmark
abort: commitcloud: failed to synchronize commits: 'oscillating commit cloud workspace detected.
check for commits that are visible in one repo but hidden in another,
and hide or unhide those commits in all places.'
(please retry 'hg cloud sync')
(please contact the Source Control Team if this error persists)
[255]
$ tglogp
x 1: 00422fad0026 draft 'draft-commit
| Differential Revision: https://phabricator.fb.com/D1234' foo
@ 0: df4f53cec30a public 'base'
Pull so that we have the public commit and sync again.
$ hg pull
pulling from ssh://user@dummy/server
searching for changes

View File

@ -518,7 +518,7 @@ Do a sync in the new client - the bookmark is left where it was
|
o 6: d16408588b2d draft 'oldstack-feb4'
|
o 5: 1f9ebd6d1390 draft 'oldstack-feb1' oldbook
o 5: 1f9ebd6d1390 draft 'oldstack-feb1'
|
| o 4: 46f8775ee5d4 draft 'newstack-feb28'
| |
@ -829,7 +829,7 @@ Sync in client 2. It doesn't have the new destination of midbook, so should omi
$ tglogp
o 10: 2ace67ee4791 draft 'oldstack-mar4 amended'
|
| x 9: 2b8dce7bd745 draft 'oldstack-mar4' midbook
| x 9: 2b8dce7bd745 draft 'oldstack-mar4'
|/
o 8: d16408588b2d draft 'oldstack-feb4'
|
@ -837,16 +837,14 @@ Sync in client 2. It doesn't have the new destination of midbook, so should omi
|
@ 0: df4f53cec30a public 'base'
BUG! It didn't omit it, but rather left it where it was.
$ cd ../client1
$ hg cloud sync -q
$ tglogp
o 11: f770b7f72fa5 public 'public1'
o 11: f770b7f72fa5 public 'public1' midbook
|
| @ 10: 2ace67ee4791 draft 'oldstack-mar4 amended'
| |
| | x 9: 2b8dce7bd745 draft 'oldstack-mar4' midbook
| | x 9: 2b8dce7bd745 draft 'oldstack-mar4'
| |/
| o 2: d16408588b2d draft 'oldstack-feb4'
| |
@ -854,4 +852,3 @@ BUG! It didn't omit it, but rather left it where it was.
|/
o 0: df4f53cec30a public 'base'
BUG! The bookmark moved back.