##// END OF EJS Templates
wireprotov2: define and implement "manifestdata" command...
wireprotov2: define and implement "manifestdata" command The added command can be used for obtaining manifest data. Given a manifest path and set of manifest nodes, data about manifests can be retrieved. Unlike changeset data, we wish to emit deltas to describe manifest revisions. So the command uses the relatively new API for building delta requests and emitting them. The code calls into deltaparent(), which I'm not very keen of. There's still work to be done in delta generation land so implementation details of storage (e.g. exactly one delta is stored/available) don't creep into higher levels. But we can worry about this later (there is already a TODO on imanifestorage tracking this). On the subject of parent deltas, the server assumes parent revisions exist on the receiving end. This is obviously wrong for shallow clone. I've added TODOs to add a mechanism to the command to allow clients to specify desired behavior. This shouldn't be too difficult to implement. Another big change is that the client must explicitly request manifest nodes to retrieve. This is a major departure from "getbundle," where the server derives relevant manifests as it iterates changesets and sends them automatically. As implemented, the client must transmit each requested node to the server. At 20 bytes per node, we're looking at 2 MB per 100,000 nodes. Plus wire encoding overhead. This isn't ideal for clients with limited upload bandwidth. I plan to address this in the future by allowing alternate mechanisms for defining the revisions to retrieve. One idea is to define a range of changeset revisions whose manifest revisions to retrieve (similar to how "changesetdata" works). We almost certainly want an API to look up an individual manifest by node. And that's where I've chosen to start with the implementation. Again, a theme of this early exchangev2 work is I want to start by building primitives for accessing raw repository data first and see how far we can get with those before we need more complexity. Differential Revision: https://phab.mercurial-scm.org/D4488

File last commit:

r37356:cbc4425e default
r39673:c7a7c7e8 default
Show More
test-relink.t
106 lines | 2.6 KiB | text/troff | Tads3Lexer
Matt Mackall
tests: replace exit 80 with #require
r22046 #require hardlink
Mads Kiilerich
tests: introduce hghave hardlinks...
r16971
Nicolas Dumazet
tests: unify test-relink
r12115 $ echo "[extensions]" >> $HGRCPATH
$ echo "relink=" >> $HGRCPATH
$ fix_path() {
> tr '\\' /
> }
$ cat > arelinked.py <<EOF
Augie Fackler
tests: update test-relink to pass our import checker
r33990 > from __future__ import absolute_import, print_function
> import os
> import sys
Nicolas Dumazet
tests: unify test-relink
r12115 > from mercurial import util
> path1, path2 = sys.argv[1:3]
> if util.samefile(path1, path2):
Augie Fackler
tests: update test-relink to pass our import checker
r33990 > print('%s == %s' % (path1, path2))
Nicolas Dumazet
tests: unify test-relink
r12115 > else:
Augie Fackler
tests: update test-relink to pass our import checker
r33990 > print('%s != %s' % (path1, path2))
Nicolas Dumazet
tests: unify test-relink
r12115 > EOF
create source repository
$ hg init repo
$ cd repo
$ echo a > a
$ echo b > b
$ hg ci -Am addfile
adding a
adding b
Thomas Arendsen Hein
tests: make tests work if directory contains special characters...
r16350 $ cat "$TESTDIR/binfile.bin" >> a
$ cat "$TESTDIR/binfile.bin" >> b
Nicolas Dumazet
tests: unify test-relink
r12115 $ hg ci -Am changefiles
Martin Geisler
relink: format reclaimed byte count nicely
r13656 make another commit to create files larger than 1 KB to test
formatting of final byte count
Thomas Arendsen Hein
tests: make tests work if directory contains special characters...
r16350 $ cat "$TESTDIR/binfile.bin" >> a
$ cat "$TESTDIR/binfile.bin" >> b
Martin Geisler
relink: format reclaimed byte count nicely
r13656 $ hg ci -m anotherchange
Martin Geisler
relink: avoid trying to lock the same repo twice
r13657 don't sit forever trying to double-lock the source repo
$ hg relink .
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 relinking $TESTTMP/repo/.hg/store to $TESTTMP/repo/.hg/store
Martin Geisler
relink: avoid trying to lock the same repo twice
r13657 there is nothing to relink
Martin Geisler
merge with stable
r13659
Nicolas Dumazet
tests: unify test-relink
r12115 Test files are read in binary mode
Pulkit Goyal
py3: replace file() with open() in test-relink.t...
r36036 $ $PYTHON -c "open('.hg/store/data/dummy.i', 'wb').write(b'a\r\nb\n')"
Nicolas Dumazet
tests: unify test-relink
r12115 $ cd ..
clone and pull to break links
$ hg clone --pull -r0 repo clone
adding changesets
adding manifests
adding file changes
added 1 changesets with 2 changes to 2 files
Denis Laxalde
transaction-summary: show the range of new revisions upon pull/unbundle (BC)...
r34662 new changesets 008c0c271c47
Nicolas Dumazet
tests: unify test-relink
r12115 updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd clone
$ hg pull -q
$ echo b >> b
$ hg ci -m changeb
created new head
Pulkit Goyal
py3: replace file() with open() in test-relink.t...
r36036 $ $PYTHON -c "open('.hg/store/data/dummy.i', 'wb').write(b'a\nb\r\n')"
Nicolas Dumazet
tests: unify test-relink
r12115
relink
Gregory Szorc
tests: conditionalize tests based on presence of revlogs for files...
r37356 #if no-reposimplestore
Pierre-Yves David
progress: get the extremely verbose output out of default debug...
r25125 $ hg relink --debug --config progress.debug=true | fix_path
Mads Kiilerich
tests: remove redundant globs...
r12640 relinking $TESTTMP/repo/.hg/store to $TESTTMP/clone/.hg/store
Nicolas Dumazet
tests: unify test-relink
r12115 tip has 2 files, estimated total number of files: 3
collecting: 00changelog.i 1/3 files (33.33%)
collecting: 00manifest.i 2/3 files (66.67%)
collecting: a.i 3/3 files (100.00%)
collecting: b.i 4/3 files (133.33%)
collecting: dummy.i 5/3 files (166.67%)
collected 5 candidate storage files
not linkable: 00changelog.i
not linkable: 00manifest.i
timeless
progress: dropping superfluous space from units
r12744 pruning: data/a.i 3/5 files (60.00%)
Nicolas Dumazet
tests: unify test-relink
r12115 not linkable: data/b.i
timeless
progress: dropping superfluous space from units
r12744 pruning: data/dummy.i 5/5 files (100.00%)
Nicolas Dumazet
tests: unify test-relink
r12115 pruned down to 2 probably relinkable files
timeless
progress: dropping superfluous space from units
r12744 relinking: data/a.i 1/2 files (50.00%)
Nicolas Dumazet
tests: unify test-relink
r12115 not linkable: data/dummy.i
Siddharth Agarwal
revlog: store fulltext when compressed delta is bigger than it...
r23285 relinked 1 files (1.36 KB reclaimed)
Nicolas Dumazet
tests: unify test-relink
r12115 $ cd ..
check hardlinks
Augie Fackler
cleanup: use $PYTHON to run python in many more tests...
r32940 $ $PYTHON arelinked.py repo/.hg/store/data/a.i clone/.hg/store/data/a.i
Nicolas Dumazet
tests: unify test-relink
r12115 repo/.hg/store/data/a.i == clone/.hg/store/data/a.i
Augie Fackler
cleanup: use $PYTHON to run python in many more tests...
r32940 $ $PYTHON arelinked.py repo/.hg/store/data/b.i clone/.hg/store/data/b.i
Nicolas Dumazet
tests: unify test-relink
r12115 repo/.hg/store/data/b.i != clone/.hg/store/data/b.i
Gregory Szorc
tests: conditionalize tests based on presence of revlogs for files...
r37356 #endif