narrow: keep bookmarks temporarily stripped for as long as commits are
The narrow extension also has support for shallowness and for
inserting older commits on pull. It works by temporarily stripping
newer commits, adding the older commits, then re-applying the stripped
bundle. The regular Mercurial server uses that when you widen,
although it shouldn't be necessary there. Our Google-internal server
does it when the user requests an older commit.
Our Google-internal tests fail since
7caf632e30c3 (filecache:
unimplement __set__() and __delete__() (API), 2018-10-20). I haven't
quite understood the problem, but it's related to the way we
temporarily hide bookmarks while the commits they point to are
stripped. When a transaction is started, Mercurial tries to read
various things from the repo for the transaction summary. That leads
to computation of hidden commits, which leads to an attempt to find
commits pinned by bookmarks. This is the reason we temporarily hide
the bookmarks. I think the aforementioned commit makes the restored
bookmarks visible earlier than before (which seems like an
improvement), so we can no longer incorrectly rely on the
repo._bookmarks field being cached too long (IIUC).
This patch makes it so we restore the temporarily hidden bookmarks
only after the temporary bundle has been re-applied. It also adapts
the code to update the repo.__bookmarks field using the pattern
described in the aforementioned commit instead of writing directly to
the fiels.
I have spent many hours trying to understand what was going on here,
but I still don't know if this can also happen without our custom
server. So this patch unfortunately does not add any tests; I have
only been able to test the fix using our Google-internal tests.
Differential Revision: https://phab.mercurial-scm.org/D5398
narrow: drop obsolete support for old Mercurial
Not needed since narrow is shipped with core.
Differential Revision: https://phab.mercurial-scm.org/D5397
tests: test that narrow preserves bookmarks on widen
When widening inserts older commits in the changelog, we have to
preserve bookmarks so they are not removed by the call to
repair.strip() we temporarily do. We didn't have any tests for that
before.
Differential Revision: https://phab.mercurial-scm.org/D5396
rebase: clarify that commits that become empty are skipped
Our message just said that it created no changes, but we didn't
explicitly say that that meant that the the commit was not rebased. It
also wasn't clear why it created no changes, so this patch also
clarifies that that was because the changes were already in the
destination.
Differential Revision: https://phab.mercurial-scm.org/D5395
rebase: format commit in usual way when explaining that it became empty
We use the _ctxdesc() for other similar messages, so it seems we
should use it here too.
Differential Revision: https://phab.mercurial-scm.org/D5394
rust: propagate error of index_get_parents() properly
Before, rustla_contains() would return 0 on error, and the exception would
be cleared or noticed somewhere else. We need to propagate the error from
AncestorsIterator up to the FFI surface.
rust: look up HgRevlogIndex_GetParents() from symbol table
And removes the unused index_get_parents_checked() function.
I expect the Index struct will be turned into a pyobject type, though I
haven't written any PoC-level patches yet.