Mercurial > hg
view tests/test-extdata.t @ 40923:3ed77780f4a6
wireprotov2: send linknodes to emitfilerevisions()
Previously, linknodes were calculated within emitfilerevisions() by
using filectx.introrev(), which would always use the linkrev/linknode
as recorded by storage. This is wrong for cases where the receiver
doesn't have the changeset the linknode refers to.
This commit changes the logic for linknode emission so the mapping
of filenode to linknode is computed by the caller and passed into
emitfilerevisions().
As part of the change, linknodes for "filesdata" in the
haveparents=False case are now correct: the existing code performed a
manifest walk and it was trivial to plug in the correct linknode.
However, behavior for the haveparents=True case is still wrong
because it relies on filtering linkrevs against the outgoing set in
order to determine what to send. This will be fixed in a subsequent
commit.
The change test test-wireproto-exchangev2-shallow.t is a bit wonky.
The test repo has 6 revisions. The changed test is performing a shallow
clone with depth=1. So, only file data for revision 5 is present
locally. So, the new behavior of associating the linknode with
revision 5 for every file revision seems correct. Of course, when
backfilling old revisions, we'll want to update the linknode. But
this problem requires wire protocol support and we'll cross that
bridge later.
Differential Revision: https://phab.mercurial-scm.org/D5405
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 10 Dec 2018 18:04:12 +0000 |
parents | faa41fd282d1 |
children | eec65b706caf |
line wrap: on
line source
$ hg init repo $ cd repo $ for n in 0 1 2 3 4 5 6 7 8 9 10 11; do > echo $n > $n > hg ci -qAm $n > done test revset support $ cat <<'EOF' >> .hg/hgrc > [extdata] > filedata = file:extdata.txt > notes = notes.txt > shelldata = shell:cat extdata.txt | grep 2 > emptygrep = shell:cat extdata.txt | grep empty > EOF $ cat <<'EOF' > extdata.txt > 2 another comment on 2 > 3 > EOF $ cat <<'EOF' > notes.txt > f6ed this change is great! > e834 this is buggy :( > 0625 first post > bogusnode gives no error > a ambiguous node gives no error > EOF $ hg log -qr "extdata(filedata)" 2:f6ed99a58333 3:9de260b1e88e $ hg log -qr "extdata(shelldata)" 2:f6ed99a58333 test weight of extdata() revset $ hg debugrevspec -p optimized "extdata(filedata) & 3" * optimized: (andsmally (func (symbol 'extdata') (symbol 'filedata')) (symbol '3')) 3 test non-zero exit of shell command $ hg log -qr "extdata(emptygrep)" abort: extdata command 'cat extdata.txt | grep empty' failed: exited with status 1 [255] test bad extdata() revset source $ hg log -qr "extdata()" hg: parse error: extdata takes at least 1 string argument [255] $ hg log -qr "extdata(unknown)" abort: unknown extdata source 'unknown' [255] test template support: $ hg log -r:3 -T "{node|short}{if(extdata('notes'), ' # {extdata('notes')}')}\n" 06254b906311 # first post e8342c9a2ed1 # this is buggy :( f6ed99a58333 # this change is great! 9de260b1e88e test template cache: $ hg log -r:3 -T '{rev} "{extdata("notes")}" "{extdata("shelldata")}"\n' 0 "first post" "" 1 "this is buggy :(" "" 2 "this change is great!" "another comment on 2" 3 "" "" test bad extdata() template source $ hg log -T "{extdata()}\n" hg: parse error: extdata expects one argument [255] $ hg log -T "{extdata('unknown')}\n" abort: unknown extdata source 'unknown' [255] $ hg log -T "{extdata(unknown)}\n" hg: parse error: empty data source specified (did you mean extdata('unknown')?) [255] $ hg log -T "{extdata('{unknown}')}\n" hg: parse error: empty data source specified [255] we don't fix up relative file URLs, but we do run shell commands in repo root $ mkdir sub $ cd sub $ hg log -qr "extdata(filedata)" abort: error: $ENOENT$ [255] $ hg log -qr "extdata(shelldata)" 2:f6ed99a58333 $ cd ..