Mercurial > hg
view tests/test-push-checkheads-pruned-B5.t @ 40393:229d23cdb203
exchangev2: support fetching shallow files history
This commit teaches the exchangev2 client code to handle fetching shallow
files data.
Only shallow fetching of files data is supported: shallow fetching of
changeset and manifest data is explicitly not yet supported.
Previously, we would fetch file revisions for changesets that were received
by the current pull operation. In the new model, we calculate the set of
"relevant" changesets given the pull depth and only fetch files data for
those changesets.
We also teach the "filesdata" command invocation to vary parameters as needed.
The implementation here is far from complete or optimal. Subsequent pulls will
end up re-fetching a lot of files data. But the application of this data should
mostly be a no-op on the client, so it isn't a big deal.
Depending on the order file revisions are fetched in, revisions could get
inserted with the wrong revision number relationships. I think the best way
to deal with this is to remove revision numbers from storage and to either
dynamically derive them (by reconstructing a DAG from nodes/parents) or remove
revision numbers from the file storage interface completely.
A missing API that we'll likely want to write pretty soon is "ensure files
for revision(s) are present." We can kind of cajole exchangev2.pull() to do
this. But it isn't very efficient. For example, in simple cases like
widening the store to obtain data for a single revision, it is probably
more efficient to walk the manifest and find exactly which file revisions
are missing and to make explicit requests for just their data. In more
advanced cases, asking the server for all files data may be more efficient,
even though it requires sending data the client already has. There is tons
of room for future experimentation here. And TBH I'm not sure what the
final state will be.
Anyway, this commit gets us pretty close to being able to have shallow
and narrow checkouts with exchangev2/sqlite storage. Close enough that a
minimal extension should be able to provide fill in the gaps until the code
in core stabilizes and there is a user-facing way to trigger the
narrow/shallow bits from `hg clone` without also implying using of the
narrow extension...
Differential Revision: https://phab.mercurial-scm.org/D5169
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 19 Oct 2018 12:30:49 +0200 |
parents | 89630d0b3e23 |
children | 34a46d48d24e |
line wrap: on
line source
==================================== Testing head checking code: Case B-5 ==================================== Mercurial checks for the introduction of new heads on push. Evolution comes into play to detect if existing branches on the server are being replaced by some of the new one we push. This case is part of a series of tests checking this behavior. Category B: simple case involving pruned changesets TestCase 5: multi-changeset branch, mix of pruned and superceeded .. old-state: .. .. * 3 changeset branch .. .. new-state: .. .. * old head is pruned .. * old mid is superceeded .. * old root is pruned .. .. expected-result: .. .. * push allowed .. .. graph-summary: .. .. B ⊗ .. | .. A ø⇠◔ A' .. | | .. B ⊗ | .. |/ .. ● $ . $TESTDIR/testlib/push-checkheads-util.sh Test setup ---------- $ mkdir B5 $ cd B5 $ setuprepos creating basic server and client repo updating to branch default 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd server $ mkcommit B0 $ mkcommit C0 $ cd ../client $ hg pull pulling from $TESTTMP/B5/server searching for changes adding changesets adding manifests adding file changes added 2 changesets with 2 changes to 2 files new changesets d73caddc5533:821fb21d0dd2 (2 drafts) (run 'hg update' to get a working copy) $ hg up 0 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ mkcommit B1 created new head $ hg debugobsolete --record-parents `getid "desc(A0)"` obsoleted 1 changesets 2 new orphan changesets $ hg debugobsolete `getid "desc(B0)"` `getid "desc(B1)"` obsoleted 1 changesets $ hg debugobsolete --record-parents `getid "desc(C0)"` obsoleted 1 changesets $ hg log -G --hidden @ 25c56d33e4c4 (draft): B1 | | x 821fb21d0dd2 (draft): C0 | | | x d73caddc5533 (draft): B0 | | | x 8aaa48160adc (draft): A0 |/ o 1e4be0697311 (public): root Actual testing -------------- $ hg push pushing to $TESTTMP/B5/server searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) 3 new obsolescence markers obsoleted 3 changesets $ cd ../..