Mercurial > hg-stable
comparison tests/test-extdata.t @ 34458:2c3b8fa3211b
revset: add experimental support for extdata
This is minimal and non-controversial implementation of extdata() revset.
Originally extdata sources were exposed to the symbol namespace, but I've
changed it to a plain function for simplicity.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 01 Oct 2017 10:50:00 +0100 |
parents | |
children | a1b89c8ad32d |
comparison
equal
deleted
inserted
replaced
34457:7757cc48b766 | 34458:2c3b8fa3211b |
---|---|
1 $ hg init repo | |
2 $ cd repo | |
3 $ for n in 0 1 2 3; do | |
4 > echo $n > $n | |
5 > hg ci -qAm $n | |
6 > done | |
7 | |
8 test revset support | |
9 | |
10 $ cat <<'EOF' >> .hg/hgrc | |
11 > [extdata] | |
12 > filedata = file:extdata.txt | |
13 > shelldata = shell:cat extdata.txt | grep 2 | |
14 > EOF | |
15 $ cat <<'EOF' > extdata.txt | |
16 > 2 | |
17 > 3 | |
18 > EOF | |
19 | |
20 $ hg log -qr "extdata(filedata)" | |
21 2:f6ed99a58333 | |
22 3:9de260b1e88e | |
23 $ hg log -qr "extdata(shelldata)" | |
24 2:f6ed99a58333 | |
25 | |
26 test weight of extdata() revset | |
27 | |
28 $ hg debugrevspec -p optimized "extdata(filedata) & 3" | |
29 * optimized: | |
30 (andsmally | |
31 (func | |
32 (symbol 'extdata') | |
33 (symbol 'filedata')) | |
34 (symbol '3')) | |
35 3 | |
36 | |
37 test bad extdata() revset source | |
38 | |
39 $ hg log -qr "extdata()" | |
40 hg: parse error: extdata takes at least 1 string argument | |
41 [255] | |
42 $ hg log -qr "extdata(unknown)" | |
43 abort: unknown extdata source 'unknown' | |
44 [255] | |
45 | |
46 we don't fix up relative file URLs, but we do run shell commands in repo root | |
47 | |
48 $ mkdir sub | |
49 $ cd sub | |
50 $ hg log -qr "extdata(filedata)" | |
51 abort: error: No such file or directory | |
52 [255] | |
53 $ hg log -qr "extdata(shelldata)" | |
54 2:f6ed99a58333 | |
55 | |
56 $ cd .. |