sapling/tests/test-treemanifest-autoconvert.t
Durham Goode df97f609bf treemanifest: move history sorting responsibility into MutableHistoryPack
Summary:
Previously, the logic that added data to a mutable history pack was required to
add it in the correct order (all entries for a certain file at once, and in
newest-first order). This required the callers to jump through weird hoops if
the data came in out of order or at different times in the transaction.

This patch moves the ordering logic to be inside MutableHistoryPack, so callers
can add the data in any order they wish, and it will get sorted before being
serialized.

This does add memory pressure to things that read a lot of history, like repack.
If this becomes a problem we may want to add a 'historypack.flush()' api that
let's us tell the history pack it's ok to flush it's current contents to disk.

Test Plan: Ran the tests

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: quark, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4956096

Signature: t1:4956096:1493264693:a2275a49e35565d4b11244e3e5dd82c25de7e16e
2017-04-27 10:44:34 -07:00

68 lines
1.5 KiB
Raku

$ . "$TESTDIR/library.sh"
$ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
$ export PYTHONPATH
$ hginit master
$ cd master
$ cat >> .hg/hgrc <<EOF
> [extensions]
> treemanifest=
> [treemanifest]
> server=True
> [remotefilelog]
> server=True
> EOF
$ echo x > x
$ hg commit -qAm 'add x'
$ cd ..
$ hgcloneshallow ssh://user@dummy/master client -q
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob)
$ cd client
$ cat >> .hg/hgrc <<EOF
> [extensions]
> fastmanifest=
> treemanifest=
>
> [remotefilelog]
> usefastdatapack=True
>
> [treemanifest]
> autocreatetrees=True
> demanddownload=False
>
> [fastmanifest]
> usetree=True
> usecache=False
> EOF
Test auto creating trees for merge commit
$ cd ../master
$ hg up -q null
$ echo z >> z
$ hg commit -qAm 'add z'
$ hg up -q 0
$ hg merge -q -r 1
$ hg commit -qAm 'merge'
$ cd ../client
$ hg pull
pulling from ssh://user@dummy/master
searching for changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 0 changes to 0 files
(run 'hg update' to get a working copy)
$ hg manifest -r tip
x
z
$ hg debughistorypack $TESTTMP/hgcache/master/packs/manifests/*.histidx
Node P1 Node P2 Node Link Node Copy From
ddb35f099a64 000000000000 000000000000 d32fd17cb041
13532a598745 bc0c2c938b92 000000000000 92f4ca0e667c
bc0c2c938b92 000000000000 000000000000 085784c01c08