Mercurial > hg
annotate tests/test-extdata.t @ 34457: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 |
rev | line source |
---|---|
34457
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
1 $ hg init repo |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
2 $ cd repo |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
3 $ for n in 0 1 2 3; do |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
4 > echo $n > $n |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
5 > hg ci -qAm $n |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
6 > done |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
7 |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
8 test revset support |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
9 |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
10 $ cat <<'EOF' >> .hg/hgrc |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
11 > [extdata] |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
12 > filedata = file:extdata.txt |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
13 > shelldata = shell:cat extdata.txt | grep 2 |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
14 > EOF |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
15 $ cat <<'EOF' > extdata.txt |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
16 > 2 |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
17 > 3 |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
18 > EOF |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
19 |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
20 $ hg log -qr "extdata(filedata)" |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
21 2:f6ed99a58333 |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
22 3:9de260b1e88e |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
23 $ hg log -qr "extdata(shelldata)" |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
24 2:f6ed99a58333 |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
25 |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
26 test weight of extdata() revset |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
27 |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
28 $ hg debugrevspec -p optimized "extdata(filedata) & 3" |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
29 * optimized: |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
30 (andsmally |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
31 (func |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
32 (symbol 'extdata') |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
33 (symbol 'filedata')) |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
34 (symbol '3')) |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
35 3 |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
36 |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
37 test bad extdata() revset source |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
38 |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
39 $ hg log -qr "extdata()" |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
40 hg: parse error: extdata takes at least 1 string argument |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
41 [255] |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
42 $ hg log -qr "extdata(unknown)" |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
43 abort: unknown extdata source 'unknown' |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
44 [255] |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
45 |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
46 we don't fix up relative file URLs, but we do run shell commands in repo root |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
47 |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
48 $ mkdir sub |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
49 $ cd sub |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
50 $ hg log -qr "extdata(filedata)" |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
51 abort: error: No such file or directory |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
52 [255] |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
53 $ hg log -qr "extdata(shelldata)" |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
54 2:f6ed99a58333 |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
55 |
2c3b8fa3211b
revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
56 $ cd .. |