mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 16:57:49 +03:00
a98f532abd
Summary: This is the test to cover tricky case in the discovery logic. Previously Mononoke's known() wireproto method returned `true` for both public and draft commits. The problem was in that it affects pushrebase. There are a few problems with the current setup. A push command like `hg push -r HASH --to BOOK` may actually do two things - it can either move a bookmark on the server or do a pushrebase. What it does depends on how discovery phase of the push finishes. Each `hg push` starts with a discovery algorithm that tries to figure out what commits to send to the server. If client decides that server already has all the commits then it'll just move the bookmark, otherwise it'll run the pushrebase. During discovery client sends wireproto `known()` method to the server with a list of commit hashes, and server returns a list of booleans telling if a server knows the commit or not. Before this diff Mononoke returned true for both draft commits and public commits, while Mercurial returned true it only for public commits. So if Mononoke already has a draft commit (it might have it because the commit was created via `hg pushbackup` or was created in the previous unsuccessful push attempt), then hg client discovery will decide to move a bookmark instead of pushrebasing, which in the case of master bookmark might have disastrous consequences. To fix it let's return false for draft commits, and also implement `knownnodes` which return true for draft commits (a better name for these methods would be `knownpublic` and `known`). Note though that in order to trigger the problem the position of the bookmark on the server should be different from the position of the bookmark on the client. This is because of short-circuting in the hg client discovery logic (see https://fburl.com/s5r76yle). The potential downside of the change is that we'll fetch bookmarks more often, but we'll add bookmark cache later if necessary. Reviewed By: ikostia Differential Revision: D14560355 fbshipit-source-id: b943714199576e14a32e87f325ae8059d95cb8ed |
||
---|---|---|
.. | ||
fixtures | ||
integration | ||
performance | ||
utils |