Mercurial > hg
annotate tests/test-grep.t @ 24545:9e0c67e84896
json: implement {tags} template
Tags is pretty easy to implement. Let's start there.
The output is slightly different from `hg tags -Tjson`. For reference,
the CLI has the following output:
[
{
"node": "e2049974f9a23176c2addb61d8f5b86e0d620490",
"rev": 29880,
"tag": "tip",
"type": ""
},
...
]
Our output has the format:
{
"node": "0aeb19ea57a6d223bacddda3871cb78f24b06510",
"tags": [
{
"node": "e2049974f9a23176c2addb61d8f5b86e0d620490",
"tag": "tag1",
"date": [1427775457.0, 25200]
},
...
]
}
"rev" is omitted because it isn't a reliable identifier. We shouldn't
be exposing them in web APIs and giving the impression it remotely
resembles a stable identifier. Perhaps we could one day hide this behind
a config option (it might be useful to expose when running servers
locally).
The "type" of the tag isn't defined because this information isn't yet
exposed to the hgweb templater (it could be in a follow-up) and because
it is questionable whether different types should be exposed at all.
(Should the web interface really be exposing "local" tags?)
We use an object for the outer type instead of Array for a few reasons.
First, it is extensible. If we ever need to throw more global properties
into the output, we can do that without breaking backwards compatibility
(property additions should be backwards compatible). Second, uniformity
in web APIs is nice. Having everything return objects seems much saner than
a mix of array and object. Third, there are security issues with arrays
in older browsers. The JSON web services world almost never uses arrays
as the main type for this reason.
Another possibly controversial part about this patch is how dates are
defined. While JSON has a Date type, it is based on the JavaScript Date
type, which is widely considered a pile of garbage. It is a non-starter
for this reason.
Many of Mercurial's built-in date filters drop seconds resolution. So
that's a non-starter as well, since we want the API to be lossless where
possible. rfc3339date, rfc822date, isodatesec, and date are all lossless.
However, they each require the client to perform string parsing on top of
JSON decoding. While date parsing libraries are pretty ubiquitous, some
languages don't have them out of the box. However, pretty much every
programming language can deal with UNIX timestamps (which are just
integers or floats). So, we choose to use Mercurial's internal date
representation, which in JSON is modeled as float seconds since UNIX
epoch and an integer timezone offset from UTC (keep in mind
JavaScript/JSON models all "Numbers" as double prevision floating point
numbers, so there isn't a difference between ints and floats in JSON).
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 31 Mar 2015 14:52:21 -0700 |
parents | c260887cdbcd |
children | b842b1adfea2 |
rev | line source |
---|---|
13956
ffb5c09ba822
tests: remove redundant mkdir
Martin Geisler <mg@lazybytes.net>
parents:
13920
diff
changeset
|
1 $ hg init t |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
2 $ cd t |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
3 $ echo import > port |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
4 $ hg add port |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
5 $ hg commit -m 0 -u spam -d '0 0' |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
6 $ echo export >> port |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
7 $ hg commit -m 1 -u eggs -d '1 0' |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
8 $ echo export > port |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
9 $ echo vaportight >> port |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
10 $ echo 'import/export' >> port |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
11 $ hg commit -m 2 -u spam -d '2 0' |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
12 $ echo 'import/export' >> port |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
13 $ hg commit -m 3 -u eggs -d '3 0' |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
14 $ head -n 3 port > port1 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
15 $ mv port1 port |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
16 $ hg commit -m 4 -u spam -d '4 0' |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
17 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
18 pattern error |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
19 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
20 $ hg grep '**test**' |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
21 grep: invalid match pattern: nothing to repeat |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11902
diff
changeset
|
22 [1] |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
23 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
24 simple |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
25 |
17923
1e6b5faf9d4e
grep: don't search past the end of the searched string
Idan Kamara <idankk86@gmail.com>
parents:
17806
diff
changeset
|
26 $ hg grep '.*' |
1e6b5faf9d4e
grep: don't search past the end of the searched string
Idan Kamara <idankk86@gmail.com>
parents:
17806
diff
changeset
|
27 port:4:export |
1e6b5faf9d4e
grep: don't search past the end of the searched string
Idan Kamara <idankk86@gmail.com>
parents:
17806
diff
changeset
|
28 port:4:vaportight |
1e6b5faf9d4e
grep: don't search past the end of the searched string
Idan Kamara <idankk86@gmail.com>
parents:
17806
diff
changeset
|
29 port:4:import/export |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
30 $ hg grep port port |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
31 port:4:export |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
32 port:4:vaportight |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
33 port:4:import/export |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
34 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
35 simple with color |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
36 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
37 $ hg --config extensions.color= grep --config color.mode=ansi \ |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
38 > --color=always port port |
17806
dc7010ed0101
grep: colorize all fields
Idan Kamara <idankk86@gmail.com>
parents:
17805
diff
changeset
|
39 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m4\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc) |
dc7010ed0101
grep: colorize all fields
Idan Kamara <idankk86@gmail.com>
parents:
17805
diff
changeset
|
40 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m4\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might (esc) |
21011
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
17923
diff
changeset
|
41 \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m4\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc) |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
diff
changeset
|
42 |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
43 all |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
44 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
45 $ hg grep --traceback --all -nu port port |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
46 port:4:4:-:spam:import/export |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
47 port:3:4:+:eggs:import/export |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
48 port:2:1:-:spam:import |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
49 port:2:2:-:spam:export |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
50 port:2:1:+:spam:export |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
51 port:2:2:+:spam:vaportight |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
52 port:2:3:+:spam:import/export |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
53 port:1:2:+:eggs:export |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
54 port:0:1:+:spam:import |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
55 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
56 other |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
57 |
17805
21c93988ca70
test-grep: add a test for -l
Idan Kamara <idankk86@gmail.com>
parents:
16912
diff
changeset
|
58 $ hg grep -l port port |
21c93988ca70
test-grep: add a test for -l
Idan Kamara <idankk86@gmail.com>
parents:
16912
diff
changeset
|
59 port:4 |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
60 $ hg grep import port |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
61 port:4:import/export |
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
62 |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
63 $ hg cp port port2 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
64 $ hg commit -m 4 -u spam -d '5 0' |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
65 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
66 follow |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
67 |
15765
1ef46bcd76f8
grep: make multiline mode the default (BC)
Matt Mackall <mpm@selenic.com>
parents:
15293
diff
changeset
|
68 $ hg grep --traceback -f 'import\n\Z' port2 |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
69 port:0:import |
15765
1ef46bcd76f8
grep: make multiline mode the default (BC)
Matt Mackall <mpm@selenic.com>
parents:
15293
diff
changeset
|
70 |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
71 $ echo deport >> port2 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
72 $ hg commit -m 5 -u eggs -d '6 0' |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
73 $ hg grep -f --all -nu port port2 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
74 port2:6:4:+:eggs:deport |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
75 port:4:4:-:spam:import/export |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
76 port:3:4:+:eggs:import/export |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
77 port:2:1:-:spam:import |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
78 port:2:2:-:spam:export |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
79 port:2:1:+:spam:export |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
80 port:2:2:+:spam:vaportight |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
81 port:2:3:+:spam:import/export |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
82 port:1:2:+:eggs:export |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
83 port:0:1:+:spam:import |
3951
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
84 |
24064
c260887cdbcd
log: fix --follow null parent not to include revision 0
Yuya Nishihara <yuya@tcha.org>
parents:
22947
diff
changeset
|
85 $ hg up -q null |
c260887cdbcd
log: fix --follow null parent not to include revision 0
Yuya Nishihara <yuya@tcha.org>
parents:
22947
diff
changeset
|
86 $ hg grep -f port |
c260887cdbcd
log: fix --follow null parent not to include revision 0
Yuya Nishihara <yuya@tcha.org>
parents:
22947
diff
changeset
|
87 [1] |
c260887cdbcd
log: fix --follow null parent not to include revision 0
Yuya Nishihara <yuya@tcha.org>
parents:
22947
diff
changeset
|
88 |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
89 $ cd .. |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
90 $ hg init t2 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
91 $ cd t2 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
92 $ hg grep foobar foo |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11902
diff
changeset
|
93 [1] |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
94 $ hg grep foobar |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
11902
diff
changeset
|
95 [1] |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
96 $ echo blue >> color |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
97 $ echo black >> color |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
98 $ hg add color |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
99 $ hg ci -m 0 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
100 $ echo orange >> color |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
101 $ hg ci -m 1 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
102 $ echo black > color |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
103 $ hg ci -m 2 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
104 $ echo orange >> color |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
105 $ echo blue >> color |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
106 $ hg ci -m 3 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
107 $ hg grep orange |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
108 color:3:orange |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
109 $ hg grep --all orange |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
110 color:3:+:orange |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
111 color:2:-:orange |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
112 color:1:+:orange |
5106
ee702e7f181f
test-grep: test issue 685
Patrick Mezard <pmezard@gmail.com>
parents:
4877
diff
changeset
|
113 |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
114 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
115 match in last "line" without newline |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
116 |
22947
c63a09b6b337
tests: use $PYTHON instead of hardcoding python
Augie Fackler <raf@durin42.com>
parents:
21024
diff
changeset
|
117 $ $PYTHON -c 'fp = open("noeol", "wb"); fp.write("no infinite loop"); fp.close();' |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
118 $ hg ci -Amnoeol |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
119 adding noeol |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
120 $ hg grep loop |
15293
0e34699d6988
grep: correct handling of matching lines without line ending (issue3050)
Mads Kiilerich <mads@kiilerich.com>
parents:
13956
diff
changeset
|
121 noeol:4:no infinite loop |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
122 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
123 $ cd .. |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
124 |
21024
7731a2281cf0
spelling: fixes from spell checker
Mads Kiilerich <madski@unity3d.com>
parents:
21011
diff
changeset
|
125 Issue685: traceback in grep -r after rename |
12399
4fee1fd3de9a
tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents:
12316
diff
changeset
|
126 |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
127 Got a traceback when using grep on a single |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
128 revision with renamed files. |
7240
dac14cc9711e
test 261a9f47b44b: grep w/ match in last line w/o newline
Christian Ebert <blacktrash@gmx.net>
parents:
5107
diff
changeset
|
129 |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
130 $ hg init issue685 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
131 $ cd issue685 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
132 $ echo octarine > color |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
133 $ hg ci -Amcolor |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
134 adding color |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
135 $ hg rename color colour |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
136 $ hg ci -Am rename |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
137 $ hg grep octarine |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
138 colour:1:octarine |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
139 color:0:octarine |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
140 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
141 Used to crash here |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
142 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
143 $ hg grep -r 1 octarine |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
144 colour:1:octarine |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
145 $ cd .. |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
146 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
147 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
148 Issue337: test that grep follows parent-child relationships instead |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
149 of just using revision numbers. |
7240
dac14cc9711e
test 261a9f47b44b: grep w/ match in last line w/o newline
Christian Ebert <blacktrash@gmx.net>
parents:
5107
diff
changeset
|
150 |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
151 $ hg init issue337 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
152 $ cd issue337 |
8849
80cc4b1a62d0
compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
8167
diff
changeset
|
153 |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
154 $ echo white > color |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
155 $ hg commit -A -m "0 white" |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
156 adding color |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
157 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
158 $ echo red > color |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
159 $ hg commit -A -m "1 red" |
8849
80cc4b1a62d0
compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
8167
diff
changeset
|
160 |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
161 $ hg update 0 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
162 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
163 $ echo black > color |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
164 $ hg commit -A -m "2 black" |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
165 created new head |
8849
80cc4b1a62d0
compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
8167
diff
changeset
|
166 |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
167 $ hg update --clean 1 |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
168 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
169 $ echo blue > color |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
170 $ hg commit -A -m "3 blue" |
8849
80cc4b1a62d0
compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
8167
diff
changeset
|
171 |
11902
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
172 $ hg grep --all red |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
173 color:3:-:red |
3c9a5ed9b1e2
tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11141
diff
changeset
|
174 color:1:+:red |
13920
332e400764e5
grep: don't print data from binary files for matches (issue2614)
Md. O. Shayan <mdoshayan@gmail.com>
parents:
12942
diff
changeset
|
175 |
16912
6ef3107c661e
tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
176 $ cd .. |
6ef3107c661e
tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
177 |
13920
332e400764e5
grep: don't print data from binary files for matches (issue2614)
Md. O. Shayan <mdoshayan@gmail.com>
parents:
12942
diff
changeset
|
178 $ hg init a |
332e400764e5
grep: don't print data from binary files for matches (issue2614)
Md. O. Shayan <mdoshayan@gmail.com>
parents:
12942
diff
changeset
|
179 $ cd a |
16350
4f795f5fbb0b
tests: make tests work if directory contains special characters
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15765
diff
changeset
|
180 $ cp "$TESTDIR/binfile.bin" . |
13920
332e400764e5
grep: don't print data from binary files for matches (issue2614)
Md. O. Shayan <mdoshayan@gmail.com>
parents:
12942
diff
changeset
|
181 $ hg add binfile.bin |
332e400764e5
grep: don't print data from binary files for matches (issue2614)
Md. O. Shayan <mdoshayan@gmail.com>
parents:
12942
diff
changeset
|
182 $ hg ci -m 'add binfile.bin' |
332e400764e5
grep: don't print data from binary files for matches (issue2614)
Md. O. Shayan <mdoshayan@gmail.com>
parents:
12942
diff
changeset
|
183 $ hg grep "MaCam" --all |
332e400764e5
grep: don't print data from binary files for matches (issue2614)
Md. O. Shayan <mdoshayan@gmail.com>
parents:
12942
diff
changeset
|
184 binfile.bin:0:+: Binary file matches |
16912
6ef3107c661e
tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
185 |
6ef3107c661e
tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents:
16350
diff
changeset
|
186 $ cd .. |