annotate tests/test-grep.t @ 41722:37b33c34bf4f

templatekw: add a {negrev} keyword Revision numbers are getting much maligned for two reasons: they are too long in large repos and users get confused by their local-only nature. It just occurred to me that negative revision numbers avoid both of those problems. Since negative revision numbers change whenever the repo changes, it's much more obvious that they are a local-only convenience. Additionally, for the recent commits that we usually care about the most, negative revision numbers are always near zero. This commit adds a negrev templatekw to more easily expose negative revision numbers. It's not easy to reliably produce this output with existing keywords due to hidden commits while at the same time ensuring good performance.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Fri, 15 Feb 2019 14:43:31 -0500
parents 5d383d9636d0
children 8ab42ccb68fe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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**'
39044
83cee1af747f tests: allow more detailed error message from re.compile
Augie Fackler <augie@google.com>
parents: 38960
diff changeset
21 grep: invalid match pattern: nothing to repeat* (glob)
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
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
26 $ hg grep -r tip:0 '.*'
17923
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
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
30 $ hg grep -r tip:0 port port
11902
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
41513
718e9b444d97 grep: respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 39930
diff changeset
35 simple from subdirectory
718e9b444d97 grep: respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 39930
diff changeset
36
718e9b444d97 grep: respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 39930
diff changeset
37 $ mkdir dir
718e9b444d97 grep: respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 39930
diff changeset
38 $ cd dir
718e9b444d97 grep: respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 39930
diff changeset
39 $ hg grep -r tip:0 port
718e9b444d97 grep: respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 39930
diff changeset
40 port:4:export
718e9b444d97 grep: respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 39930
diff changeset
41 port:4:vaportight
718e9b444d97 grep: respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 39930
diff changeset
42 port:4:import/export
718e9b444d97 grep: respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 39930
diff changeset
43 $ hg grep -r tip:0 port --config ui.relative-paths=yes
718e9b444d97 grep: respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 39930
diff changeset
44 ../port:4:export
718e9b444d97 grep: respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 39930
diff changeset
45 ../port:4:vaportight
718e9b444d97 grep: respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 39930
diff changeset
46 ../port:4:import/export
718e9b444d97 grep: respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 39930
diff changeset
47 $ cd ..
718e9b444d97 grep: respect ui.relative-paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 39930
diff changeset
48
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
49 simple with color
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
50
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
51 $ hg --config extensions.color= grep --config color.mode=ansi \
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
52 > --color=always port port -r tip:0
17806
dc7010ed0101 grep: colorize all fields
Idan Kamara <idankk86@gmail.com>
parents: 17805
diff changeset
53 \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
54 \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
55 \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
56
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
57 simple templated
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
58
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
59 $ hg grep port -r tip:0 \
39369
34ba47117164 formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39044
diff changeset
60 > -T '{path}:{rev}:{node|short}:{texts % "{if(matched, text|upper, text)}"}\n'
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
61 port:4:914fa752cdea:exPORT
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
62 port:4:914fa752cdea:vaPORTight
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
63 port:4:914fa752cdea:imPORT/exPORT
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
64
39369
34ba47117164 formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39044
diff changeset
65 $ hg grep port -r tip:0 -T '{path}:{rev}:{texts}\n'
37500
8bb3899a0f47 formatter: make nested items somewhat readable in template output
Yuya Nishihara <yuya@tcha.org>
parents: 37449
diff changeset
66 port:4:export
8bb3899a0f47 formatter: make nested items somewhat readable in template output
Yuya Nishihara <yuya@tcha.org>
parents: 37449
diff changeset
67 port:4:vaportight
8bb3899a0f47 formatter: make nested items somewhat readable in template output
Yuya Nishihara <yuya@tcha.org>
parents: 37449
diff changeset
68 port:4:import/export
8bb3899a0f47 formatter: make nested items somewhat readable in template output
Yuya Nishihara <yuya@tcha.org>
parents: 37449
diff changeset
69
39369
34ba47117164 formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39044
diff changeset
70 $ hg grep port -r tip:0 -T '{path}:{tags}:{texts}\n'
38540
1e25782a7583 grep: add support for log-like template keywords and functions
Yuya Nishihara <yuya@tcha.org>
parents: 38421
diff changeset
71 port:tip:export
1e25782a7583 grep: add support for log-like template keywords and functions
Yuya Nishihara <yuya@tcha.org>
parents: 38421
diff changeset
72 port:tip:vaportight
1e25782a7583 grep: add support for log-like template keywords and functions
Yuya Nishihara <yuya@tcha.org>
parents: 38421
diff changeset
73 port:tip:import/export
1e25782a7583 grep: add support for log-like template keywords and functions
Yuya Nishihara <yuya@tcha.org>
parents: 38421
diff changeset
74
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
75 simple JSON (no "change" field)
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
76
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
77 $ hg grep -r tip:0 -Tjson port
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
78 [
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
79 {
37770
31750413f8d7 formatter: convert timestamp to int
Yuya Nishihara <yuya@tcha.org>
parents: 37500
diff changeset
80 "date": [4, 0],
39930
66df1059b7c0 grep: rename {line_number} to {lineno} as well (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39707
diff changeset
81 "lineno": 1,
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
82 "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
39369
34ba47117164 formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39044
diff changeset
83 "path": "port",
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
84 "rev": 4,
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
85 "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}],
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
86 "user": "spam"
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
87 },
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
88 {
37770
31750413f8d7 formatter: convert timestamp to int
Yuya Nishihara <yuya@tcha.org>
parents: 37500
diff changeset
89 "date": [4, 0],
39930
66df1059b7c0 grep: rename {line_number} to {lineno} as well (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39707
diff changeset
90 "lineno": 2,
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
91 "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
39369
34ba47117164 formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39044
diff changeset
92 "path": "port",
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
93 "rev": 4,
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
94 "texts": [{"matched": false, "text": "va"}, {"matched": true, "text": "port"}, {"matched": false, "text": "ight"}],
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
95 "user": "spam"
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
96 },
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
97 {
37770
31750413f8d7 formatter: convert timestamp to int
Yuya Nishihara <yuya@tcha.org>
parents: 37500
diff changeset
98 "date": [4, 0],
39930
66df1059b7c0 grep: rename {line_number} to {lineno} as well (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39707
diff changeset
99 "lineno": 3,
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
100 "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
39369
34ba47117164 formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39044
diff changeset
101 "path": "port",
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
102 "rev": 4,
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
103 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
104 "user": "spam"
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
105 }
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
106 ]
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
107
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
108 simple JSON without matching lines
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
109
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
110 $ hg grep -r tip:0 -Tjson -l port
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
111 [
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
112 {
37770
31750413f8d7 formatter: convert timestamp to int
Yuya Nishihara <yuya@tcha.org>
parents: 37500
diff changeset
113 "date": [4, 0],
39930
66df1059b7c0 grep: rename {line_number} to {lineno} as well (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39707
diff changeset
114 "lineno": 1,
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
115 "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
39369
34ba47117164 formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39044
diff changeset
116 "path": "port",
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
117 "rev": 4,
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
118 "user": "spam"
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
119 }
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
120 ]
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
121
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
122 all
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
123
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
124 $ hg grep --traceback --all -nu port port
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
125 port:4:4:-:spam:import/export
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
126 port:3:4:+:eggs:import/export
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
127 port:2:1:-:spam:import
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
128 port:2:2:-:spam:export
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
129 port:2:1:+:spam:export
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
130 port:2:2:+:spam:vaportight
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
131 port:2:3:+:spam:import/export
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
132 port:1:2:+:eggs:export
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
133 port:0:1:+:spam:import
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
134
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
135 all JSON
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
136
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
137 $ hg grep --all -Tjson port port
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
138 [
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
139 {
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
140 "change": "-",
37770
31750413f8d7 formatter: convert timestamp to int
Yuya Nishihara <yuya@tcha.org>
parents: 37500
diff changeset
141 "date": [4, 0],
39930
66df1059b7c0 grep: rename {line_number} to {lineno} as well (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39707
diff changeset
142 "lineno": 4,
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
143 "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
39369
34ba47117164 formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39044
diff changeset
144 "path": "port",
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
145 "rev": 4,
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
146 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
147 "user": "spam"
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
148 },
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
149 {
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
150 "change": "+",
37770
31750413f8d7 formatter: convert timestamp to int
Yuya Nishihara <yuya@tcha.org>
parents: 37500
diff changeset
151 "date": [3, 0],
39930
66df1059b7c0 grep: rename {line_number} to {lineno} as well (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39707
diff changeset
152 "lineno": 4,
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
153 "node": "95040cfd017d658c536071c6290230a613c4c2a6",
39369
34ba47117164 formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39044
diff changeset
154 "path": "port",
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
155 "rev": 3,
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
156 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
157 "user": "eggs"
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
158 },
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
159 {
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
160 "change": "-",
37770
31750413f8d7 formatter: convert timestamp to int
Yuya Nishihara <yuya@tcha.org>
parents: 37500
diff changeset
161 "date": [2, 0],
39930
66df1059b7c0 grep: rename {line_number} to {lineno} as well (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39707
diff changeset
162 "lineno": 1,
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
163 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
39369
34ba47117164 formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39044
diff changeset
164 "path": "port",
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
165 "rev": 2,
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
166 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}],
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
167 "user": "spam"
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
168 },
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
169 {
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
170 "change": "-",
37770
31750413f8d7 formatter: convert timestamp to int
Yuya Nishihara <yuya@tcha.org>
parents: 37500
diff changeset
171 "date": [2, 0],
39930
66df1059b7c0 grep: rename {line_number} to {lineno} as well (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39707
diff changeset
172 "lineno": 2,
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
173 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
39369
34ba47117164 formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39044
diff changeset
174 "path": "port",
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
175 "rev": 2,
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
176 "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}],
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
177 "user": "spam"
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
178 },
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
179 {
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
180 "change": "+",
37770
31750413f8d7 formatter: convert timestamp to int
Yuya Nishihara <yuya@tcha.org>
parents: 37500
diff changeset
181 "date": [2, 0],
39930
66df1059b7c0 grep: rename {line_number} to {lineno} as well (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39707
diff changeset
182 "lineno": 1,
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
183 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
39369
34ba47117164 formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39044
diff changeset
184 "path": "port",
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
185 "rev": 2,
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
186 "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}],
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
187 "user": "spam"
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
188 },
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
189 {
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
190 "change": "+",
37770
31750413f8d7 formatter: convert timestamp to int
Yuya Nishihara <yuya@tcha.org>
parents: 37500
diff changeset
191 "date": [2, 0],
39930
66df1059b7c0 grep: rename {line_number} to {lineno} as well (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39707
diff changeset
192 "lineno": 2,
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
193 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
39369
34ba47117164 formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39044
diff changeset
194 "path": "port",
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
195 "rev": 2,
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
196 "texts": [{"matched": false, "text": "va"}, {"matched": true, "text": "port"}, {"matched": false, "text": "ight"}],
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
197 "user": "spam"
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
198 },
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
199 {
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
200 "change": "+",
37770
31750413f8d7 formatter: convert timestamp to int
Yuya Nishihara <yuya@tcha.org>
parents: 37500
diff changeset
201 "date": [2, 0],
39930
66df1059b7c0 grep: rename {line_number} to {lineno} as well (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39707
diff changeset
202 "lineno": 3,
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
203 "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
39369
34ba47117164 formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39044
diff changeset
204 "path": "port",
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
205 "rev": 2,
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
206 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}],
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
207 "user": "spam"
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
208 },
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
209 {
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
210 "change": "+",
37770
31750413f8d7 formatter: convert timestamp to int
Yuya Nishihara <yuya@tcha.org>
parents: 37500
diff changeset
211 "date": [1, 0],
39930
66df1059b7c0 grep: rename {line_number} to {lineno} as well (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39707
diff changeset
212 "lineno": 2,
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
213 "node": "8b20f75c158513ff5ac80bd0e5219bfb6f0eb587",
39369
34ba47117164 formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39044
diff changeset
214 "path": "port",
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
215 "rev": 1,
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
216 "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}],
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
217 "user": "eggs"
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
218 },
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
219 {
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
220 "change": "+",
37770
31750413f8d7 formatter: convert timestamp to int
Yuya Nishihara <yuya@tcha.org>
parents: 37500
diff changeset
221 "date": [0, 0],
39930
66df1059b7c0 grep: rename {line_number} to {lineno} as well (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39707
diff changeset
222 "lineno": 1,
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
223 "node": "f31323c9217050ba245ee8b537c713ec2e8ab226",
39369
34ba47117164 formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39044
diff changeset
224 "path": "port",
29858
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
225 "rev": 0,
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
226 "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}],
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
227 "user": "spam"
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
228 }
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
229 ]
33461139c31c grep: add formatter support
Yuya Nishihara <yuya@tcha.org>
parents: 29854
diff changeset
230
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
231 other
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
232
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
233 $ hg grep -r tip:0 -l port port
17805
21c93988ca70 test-grep: add a test for -l
Idan Kamara <idankk86@gmail.com>
parents: 16912
diff changeset
234 port:4
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
235 $ hg grep -r tip:0 import port
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
236 port:4:import/export
2870
8eaaf1321bfe grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents: 2869
diff changeset
237
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
238 $ hg cp port port2
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
239 $ hg commit -m 4 -u spam -d '5 0'
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
240
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
241 follow
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
242
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
243 $ hg grep -r tip:0 --traceback -f 'import\n\Z' port2
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
244 port:0:import
15765
1ef46bcd76f8 grep: make multiline mode the default (BC)
Matt Mackall <mpm@selenic.com>
parents: 15293
diff changeset
245
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
246 $ echo deport >> port2
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
247 $ hg commit -m 5 -u eggs -d '6 0'
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
248 $ hg grep -f --all -nu port port2
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
249 port2:6:4:+:eggs:deport
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
250 port:4:4:-:spam:import/export
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
251 port:3:4:+:eggs:import/export
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
252 port:2:1:-:spam:import
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
253 port:2:2:-:spam:export
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
254 port:2:1:+:spam:export
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
255 port:2:2:+:spam:vaportight
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
256 port:2:3:+:spam:import/export
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
257 port:1:2:+:eggs:export
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
258 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
259
24064
c260887cdbcd log: fix --follow null parent not to include revision 0
Yuya Nishihara <yuya@tcha.org>
parents: 22947
diff changeset
260 $ hg up -q null
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
261 $ hg grep -r 'reverse(:.)' -f port
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
262 port:0:import
24064
c260887cdbcd log: fix --follow null parent not to include revision 0
Yuya Nishihara <yuya@tcha.org>
parents: 22947
diff changeset
263
37447
067e8d1178a2 workingctx: build _manifest on filenode() or flags() request
Yuya Nishihara <yuya@tcha.org>
parents: 37133
diff changeset
264 Test wdir
067e8d1178a2 workingctx: build _manifest on filenode() or flags() request
Yuya Nishihara <yuya@tcha.org>
parents: 37133
diff changeset
265 (at least, this shouldn't crash)
067e8d1178a2 workingctx: build _manifest on filenode() or flags() request
Yuya Nishihara <yuya@tcha.org>
parents: 37133
diff changeset
266
067e8d1178a2 workingctx: build _manifest on filenode() or flags() request
Yuya Nishihara <yuya@tcha.org>
parents: 37133
diff changeset
267 $ hg up -q
067e8d1178a2 workingctx: build _manifest on filenode() or flags() request
Yuya Nishihara <yuya@tcha.org>
parents: 37133
diff changeset
268 $ echo wport >> port2
067e8d1178a2 workingctx: build _manifest on filenode() or flags() request
Yuya Nishihara <yuya@tcha.org>
parents: 37133
diff changeset
269 $ hg stat
067e8d1178a2 workingctx: build _manifest on filenode() or flags() request
Yuya Nishihara <yuya@tcha.org>
parents: 37133
diff changeset
270 M port2
067e8d1178a2 workingctx: build _manifest on filenode() or flags() request
Yuya Nishihara <yuya@tcha.org>
parents: 37133
diff changeset
271 $ hg grep -r 'wdir()' port
38217
16f93a3b8b05 grep: enable passing wdir as a revision
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 37770
diff changeset
272 port2:2147483647:export
16f93a3b8b05 grep: enable passing wdir as a revision
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 37770
diff changeset
273 port2:2147483647:vaportight
16f93a3b8b05 grep: enable passing wdir as a revision
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 37770
diff changeset
274 port2:2147483647:import/export
16f93a3b8b05 grep: enable passing wdir as a revision
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 37770
diff changeset
275 port2:2147483647:deport
16f93a3b8b05 grep: enable passing wdir as a revision
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 37770
diff changeset
276 port2:2147483647:wport
37447
067e8d1178a2 workingctx: build _manifest on filenode() or flags() request
Yuya Nishihara <yuya@tcha.org>
parents: 37133
diff changeset
277
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
278 $ cd ..
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
279 $ hg init t2
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
280 $ cd t2
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
281 $ hg grep -r tip:0 foobar foo
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11902
diff changeset
282 [1]
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
283 $ hg grep -r tip:0 foobar
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11902
diff changeset
284 [1]
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
285 $ echo blue >> color
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
286 $ echo black >> color
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
287 $ hg add color
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
288 $ hg ci -m 0
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
289 $ echo orange >> color
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
290 $ hg ci -m 1
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
291 $ echo black > color
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
292 $ hg ci -m 2
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
293 $ echo orange >> color
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
294 $ echo blue >> color
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
295 $ hg ci -m 3
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
296 $ hg grep -r tip:0 orange
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
297 color:3:orange
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
298 $ hg grep --all orange
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
299 color:3:+:orange
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
300 color:2:-:orange
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
301 color:1:+:orange
5106
ee702e7f181f test-grep: test issue 685
Patrick Mezard <pmezard@gmail.com>
parents: 4877
diff changeset
302
38421
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
303 $ hg grep --diff orange
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
304 color:3:+:orange
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
305 color:2:-:orange
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
306 color:1:+:orange
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
307
29854
b842b1adfea2 grep: refactor loop that yields matched text with label
Yuya Nishihara <yuya@tcha.org>
parents: 24064
diff changeset
308 test substring match: '^' should only match at the beginning
b842b1adfea2 grep: refactor loop that yields matched text with label
Yuya Nishihara <yuya@tcha.org>
parents: 24064
diff changeset
309
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
310 $ hg grep -r tip:0 '^.' --config extensions.color= --color debug
29854
b842b1adfea2 grep: refactor loop that yields matched text with label
Yuya Nishihara <yuya@tcha.org>
parents: 24064
diff changeset
311 [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|b]lack
b842b1adfea2 grep: refactor loop that yields matched text with label
Yuya Nishihara <yuya@tcha.org>
parents: 24064
diff changeset
312 [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|o]range
b842b1adfea2 grep: refactor loop that yields matched text with label
Yuya Nishihara <yuya@tcha.org>
parents: 24064
diff changeset
313 [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|b]lue
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
314
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
315 match in last "line" without newline
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
316
39707
5abc47d4ca6b tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents: 39369
diff changeset
317 $ "$PYTHON" -c 'fp = open("noeol", "wb"); fp.write(b"no infinite loop"); fp.close();'
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
318 $ hg ci -Amnoeol
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
319 adding noeol
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
320 $ hg grep -r tip:0 loop
15293
0e34699d6988 grep: correct handling of matching lines without line ending (issue3050)
Mads Kiilerich <mads@kiilerich.com>
parents: 13956
diff changeset
321 noeol:4:no infinite loop
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
322
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
323 $ cd ..
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
324
21024
7731a2281cf0 spelling: fixes from spell checker
Mads Kiilerich <madski@unity3d.com>
parents: 21011
diff changeset
325 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
326
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
327 Got a traceback when using grep on a single
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
328 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
329
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
330 $ hg init issue685
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
331 $ cd issue685
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
332 $ echo octarine > color
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
333 $ hg ci -Amcolor
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
334 adding color
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
335 $ hg rename color colour
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
336 $ hg ci -Am rename
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
337 $ hg grep -r tip:0 octarine
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
338 colour:1:octarine
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
339 color:0:octarine
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
340
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
341 Used to crash here
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
342
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
343 $ hg grep -r 1 octarine
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
344 colour:1:octarine
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
345 $ cd ..
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
346
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
347
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
348 Issue337: test that grep follows parent-child relationships instead
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
349 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
350
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
351 $ hg init issue337
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
352 $ cd issue337
8849
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
353
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
354 $ echo white > color
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
355 $ hg commit -A -m "0 white"
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
356 adding color
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
357
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
358 $ echo red > color
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
359 $ 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
360
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
361 $ hg update 0
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
362 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
363 $ echo black > color
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
364 $ hg commit -A -m "2 black"
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
365 created new head
8849
80cc4b1a62d0 compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 8167
diff changeset
366
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
367 $ hg update --clean 1
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
368 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
369 $ echo blue > color
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
370 $ 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
371
11902
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
372 $ hg grep --all red
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
373 color:3:-:red
3c9a5ed9b1e2 tests: unify test-grep
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11141
diff changeset
374 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
375
38421
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
376 $ hg grep --diff red
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
377 color:3:-:red
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
378 color:1:+:red
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
379
37133
a2a6755a3def grep: fixes erroneous output of grep in forward order (issue3885)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 36495
diff changeset
380 Issue3885: test that changing revision order does not alter the
a2a6755a3def grep: fixes erroneous output of grep in forward order (issue3885)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 36495
diff changeset
381 revisions printed, just their order.
a2a6755a3def grep: fixes erroneous output of grep in forward order (issue3885)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 36495
diff changeset
382
a2a6755a3def grep: fixes erroneous output of grep in forward order (issue3885)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 36495
diff changeset
383 $ hg grep --all red -r "all()"
a2a6755a3def grep: fixes erroneous output of grep in forward order (issue3885)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 36495
diff changeset
384 color:1:+:red
a2a6755a3def grep: fixes erroneous output of grep in forward order (issue3885)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 36495
diff changeset
385 color:3:-:red
a2a6755a3def grep: fixes erroneous output of grep in forward order (issue3885)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 36495
diff changeset
386
a2a6755a3def grep: fixes erroneous output of grep in forward order (issue3885)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 36495
diff changeset
387 $ hg grep --all red -r "reverse(all())"
a2a6755a3def grep: fixes erroneous output of grep in forward order (issue3885)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 36495
diff changeset
388 color:3:-:red
a2a6755a3def grep: fixes erroneous output of grep in forward order (issue3885)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 36495
diff changeset
389 color:1:+:red
a2a6755a3def grep: fixes erroneous output of grep in forward order (issue3885)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 36495
diff changeset
390
38421
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
391 $ hg grep --diff red -r "all()"
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
392 color:1:+:red
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
393 color:3:-:red
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
394
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
395 $ hg grep --diff red -r "reverse(all())"
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
396 color:3:-:red
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
397 color:1:+:red
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
398
16912
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16350
diff changeset
399 $ cd ..
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16350
diff changeset
400
13920
332e400764e5 grep: don't print data from binary files for matches (issue2614)
Md. O. Shayan <mdoshayan@gmail.com>
parents: 12942
diff changeset
401 $ 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
402 $ cd a
16350
4f795f5fbb0b tests: make tests work if directory contains special characters
Thomas Arendsen Hein <thomas@intevation.de>
parents: 15765
diff changeset
403 $ 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
404 $ 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
405 $ 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
406 $ 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
407 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
408
38421
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
409 $ hg grep "MaCam" --diff
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
410 binfile.bin:0:+: Binary file matches
7fbb5d76c555 grep: add --diff flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38342
diff changeset
411
16912
6ef3107c661e tests: cleanup of tests that got lost in their own nested directories
Mads Kiilerich <mads@kiilerich.com>
parents: 16350
diff changeset
412 $ cd ..
38217
16f93a3b8b05 grep: enable passing wdir as a revision
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 37770
diff changeset
413
38342
b8f45fc27370 grep: adds allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38217
diff changeset
414 Test for showing working of allfiles flag
b8f45fc27370 grep: adds allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38217
diff changeset
415
b8f45fc27370 grep: adds allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38217
diff changeset
416 $ hg init sng
b8f45fc27370 grep: adds allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38217
diff changeset
417 $ cd sng
b8f45fc27370 grep: adds allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38217
diff changeset
418 $ echo "unmod" >> um
b8f45fc27370 grep: adds allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38217
diff changeset
419 $ hg ci -A -m "adds unmod to um"
b8f45fc27370 grep: adds allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38217
diff changeset
420 adding um
b8f45fc27370 grep: adds allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38217
diff changeset
421 $ echo "something else" >> new
b8f45fc27370 grep: adds allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38217
diff changeset
422 $ hg ci -A -m "second commit"
b8f45fc27370 grep: adds allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38217
diff changeset
423 adding new
b8f45fc27370 grep: adds allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38217
diff changeset
424 $ hg grep -r "." "unmod"
b8f45fc27370 grep: adds allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38217
diff changeset
425 [1]
38648
ffd08ec22955 grep: rename --allfiles to --all-files
Yuya Nishihara <yuya@tcha.org>
parents: 38631
diff changeset
426 $ hg grep -r "." "unmod" --all-files
38342
b8f45fc27370 grep: adds allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38217
diff changeset
427 um:1:unmod
b8f45fc27370 grep: adds allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38217
diff changeset
428
38650
eba69ddd4e52 grep: search working directory files by default if --all-files is specified
Yuya Nishihara <yuya@tcha.org>
parents: 38649
diff changeset
429 With --all-files, the working directory is searched by default
eba69ddd4e52 grep: search working directory files by default if --all-files is specified
Yuya Nishihara <yuya@tcha.org>
parents: 38649
diff changeset
430
eba69ddd4e52 grep: search working directory files by default if --all-files is specified
Yuya Nishihara <yuya@tcha.org>
parents: 38649
diff changeset
431 $ echo modified >> new
eba69ddd4e52 grep: search working directory files by default if --all-files is specified
Yuya Nishihara <yuya@tcha.org>
parents: 38649
diff changeset
432 $ hg grep --all-files mod
38653
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
433 new:modified
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
434 um:unmod
38650
eba69ddd4e52 grep: search working directory files by default if --all-files is specified
Yuya Nishihara <yuya@tcha.org>
parents: 38649
diff changeset
435
eba69ddd4e52 grep: search working directory files by default if --all-files is specified
Yuya Nishihara <yuya@tcha.org>
parents: 38649
diff changeset
436 which can be overridden by -rREV
eba69ddd4e52 grep: search working directory files by default if --all-files is specified
Yuya Nishihara <yuya@tcha.org>
parents: 38649
diff changeset
437
eba69ddd4e52 grep: search working directory files by default if --all-files is specified
Yuya Nishihara <yuya@tcha.org>
parents: 38649
diff changeset
438 $ hg grep --all-files -r. mod
eba69ddd4e52 grep: search working directory files by default if --all-files is specified
Yuya Nishihara <yuya@tcha.org>
parents: 38649
diff changeset
439 um:1:unmod
eba69ddd4e52 grep: search working directory files by default if --all-files is specified
Yuya Nishihara <yuya@tcha.org>
parents: 38649
diff changeset
440
38651
5e4027db52f4 grep: add config knob to enable/disable the default wdir search
Yuya Nishihara <yuya@tcha.org>
parents: 38650
diff changeset
441 commands.all-files can be negated by --no-all-files
5e4027db52f4 grep: add config knob to enable/disable the default wdir search
Yuya Nishihara <yuya@tcha.org>
parents: 38650
diff changeset
442
5e4027db52f4 grep: add config knob to enable/disable the default wdir search
Yuya Nishihara <yuya@tcha.org>
parents: 38650
diff changeset
443 $ hg grep --config commands.grep.all-files=True mod
38653
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
444 new:modified
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
445 um:unmod
38651
5e4027db52f4 grep: add config knob to enable/disable the default wdir search
Yuya Nishihara <yuya@tcha.org>
parents: 38650
diff changeset
446 $ hg grep --config commands.grep.all-files=True --no-all-files mod
5e4027db52f4 grep: add config knob to enable/disable the default wdir search
Yuya Nishihara <yuya@tcha.org>
parents: 38650
diff changeset
447 um:0:unmod
5e4027db52f4 grep: add config knob to enable/disable the default wdir search
Yuya Nishihara <yuya@tcha.org>
parents: 38650
diff changeset
448
38649
0d0f8bd692c4 grep: reject --diff --all-files
Yuya Nishihara <yuya@tcha.org>
parents: 38648
diff changeset
449 --diff --all-files makes no sense since --diff is the option to grep history
0d0f8bd692c4 grep: reject --diff --all-files
Yuya Nishihara <yuya@tcha.org>
parents: 38648
diff changeset
450
0d0f8bd692c4 grep: reject --diff --all-files
Yuya Nishihara <yuya@tcha.org>
parents: 38648
diff changeset
451 $ hg grep --diff --all-files um
0d0f8bd692c4 grep: reject --diff --all-files
Yuya Nishihara <yuya@tcha.org>
parents: 38648
diff changeset
452 abort: --diff and --all-files are mutually exclusive
0d0f8bd692c4 grep: reject --diff --all-files
Yuya Nishihara <yuya@tcha.org>
parents: 38648
diff changeset
453 [255]
0d0f8bd692c4 grep: reject --diff --all-files
Yuya Nishihara <yuya@tcha.org>
parents: 38648
diff changeset
454
38651
5e4027db52f4 grep: add config knob to enable/disable the default wdir search
Yuya Nishihara <yuya@tcha.org>
parents: 38650
diff changeset
455 but --diff should precede the commands.grep.all-files option
5e4027db52f4 grep: add config knob to enable/disable the default wdir search
Yuya Nishihara <yuya@tcha.org>
parents: 38650
diff changeset
456
5e4027db52f4 grep: add config knob to enable/disable the default wdir search
Yuya Nishihara <yuya@tcha.org>
parents: 38650
diff changeset
457 $ hg grep --config commands.grep.all-files=True --diff mod
5e4027db52f4 grep: add config knob to enable/disable the default wdir search
Yuya Nishihara <yuya@tcha.org>
parents: 38650
diff changeset
458 um:0:+:unmod
5e4027db52f4 grep: add config knob to enable/disable the default wdir search
Yuya Nishihara <yuya@tcha.org>
parents: 38650
diff changeset
459
38342
b8f45fc27370 grep: adds allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38217
diff changeset
460 $ cd ..
b8f45fc27370 grep: adds allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38217
diff changeset
461
38217
16f93a3b8b05 grep: enable passing wdir as a revision
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 37770
diff changeset
462 Fix_Wdir(): test that passing wdir() t -r flag does greps on the
16f93a3b8b05 grep: enable passing wdir as a revision
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 37770
diff changeset
463 files modified in the working directory
16f93a3b8b05 grep: enable passing wdir as a revision
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 37770
diff changeset
464
16f93a3b8b05 grep: enable passing wdir as a revision
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 37770
diff changeset
465 $ cd a
16f93a3b8b05 grep: enable passing wdir as a revision
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 37770
diff changeset
466 $ echo "abracadara" >> a
16f93a3b8b05 grep: enable passing wdir as a revision
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 37770
diff changeset
467 $ hg add a
16f93a3b8b05 grep: enable passing wdir as a revision
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 37770
diff changeset
468 $ hg grep -r "wdir()" "abra"
16f93a3b8b05 grep: enable passing wdir as a revision
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 37770
diff changeset
469 a:2147483647:abracadara
16f93a3b8b05 grep: enable passing wdir as a revision
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 37770
diff changeset
470
16f93a3b8b05 grep: enable passing wdir as a revision
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 37770
diff changeset
471 $ cd ..
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
472
38652
bfcd5c7cbf9a grep: restore pre-9ef10437bb88 behavior, enable wdir search by tweakdefaults
Yuya Nishihara <yuya@tcha.org>
parents: 38651
diff changeset
473 Change Default of grep by ui.tweakdefaults, that is, the files not in current
bfcd5c7cbf9a grep: restore pre-9ef10437bb88 behavior, enable wdir search by tweakdefaults
Yuya Nishihara <yuya@tcha.org>
parents: 38651
diff changeset
474 working directory should not be grepp-ed on
bfcd5c7cbf9a grep: restore pre-9ef10437bb88 behavior, enable wdir search by tweakdefaults
Yuya Nishihara <yuya@tcha.org>
parents: 38651
diff changeset
475
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
476 $ hg init ab
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
477 $ cd ab
38652
bfcd5c7cbf9a grep: restore pre-9ef10437bb88 behavior, enable wdir search by tweakdefaults
Yuya Nishihara <yuya@tcha.org>
parents: 38651
diff changeset
478 $ cat <<'EOF' >> .hg/hgrc
bfcd5c7cbf9a grep: restore pre-9ef10437bb88 behavior, enable wdir search by tweakdefaults
Yuya Nishihara <yuya@tcha.org>
parents: 38651
diff changeset
479 > [ui]
bfcd5c7cbf9a grep: restore pre-9ef10437bb88 behavior, enable wdir search by tweakdefaults
Yuya Nishihara <yuya@tcha.org>
parents: 38651
diff changeset
480 > tweakdefaults = True
bfcd5c7cbf9a grep: restore pre-9ef10437bb88 behavior, enable wdir search by tweakdefaults
Yuya Nishihara <yuya@tcha.org>
parents: 38651
diff changeset
481 > EOF
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
482 $ echo "some text">>file1
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
483 $ hg add file1
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
484 $ hg commit -m "adds file1"
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
485 $ hg mv file1 file2
38653
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
486
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
487 wdir revision is hidden by default:
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
488
38631
9ef10437bb88 grep: change default behaviour to search working directory files (BC)
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38540
diff changeset
489 $ hg grep "some"
38653
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
490 file2:some text
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
491
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
492 but it should be available in template dict:
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
493
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
494 $ hg grep "some" -Tjson
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
495 [
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
496 {
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
497 "date": [0, 0],
39930
66df1059b7c0 grep: rename {line_number} to {lineno} as well (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39707
diff changeset
498 "lineno": 1,
38653
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
499 "node": "ffffffffffffffffffffffffffffffffffffffff",
39369
34ba47117164 formatter: rename {abspath}/{file} to {path}, and drop relative {path} (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 39044
diff changeset
500 "path": "file2",
38653
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
501 "rev": 2147483647,
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
502 "texts": [{"matched": true, "text": "some"}, {"matched": false, "text": " text"}],
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
503 "user": "test"
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
504 }
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
505 ]
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
506
aabc01da9834 grep: hide cryptic revision number by default
Yuya Nishihara <yuya@tcha.org>
parents: 38652
diff changeset
507 $ cd ..
38946
f3f109971359 grep: add MULTIREV support to --allfiles flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38653
diff changeset
508
f3f109971359 grep: add MULTIREV support to --allfiles flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38653
diff changeset
509 test -rMULTIREV with --all-files
f3f109971359 grep: add MULTIREV support to --allfiles flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38653
diff changeset
510
f3f109971359 grep: add MULTIREV support to --allfiles flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38653
diff changeset
511 $ cd sng
f3f109971359 grep: add MULTIREV support to --allfiles flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38653
diff changeset
512 $ hg rm um
f3f109971359 grep: add MULTIREV support to --allfiles flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38653
diff changeset
513 $ hg commit -m "deletes um"
f3f109971359 grep: add MULTIREV support to --allfiles flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38653
diff changeset
514 $ hg grep -r "0:2" "unmod" --all-files
f3f109971359 grep: add MULTIREV support to --allfiles flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38653
diff changeset
515 um:0:unmod
f3f109971359 grep: add MULTIREV support to --allfiles flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38653
diff changeset
516 um:1:unmod
38960
d99468d2b09a grep: search all commits in allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38946
diff changeset
517 $ hg grep -r "0:2" "unmod" --all-files um
d99468d2b09a grep: search all commits in allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38946
diff changeset
518 um:0:unmod
d99468d2b09a grep: search all commits in allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38946
diff changeset
519 um:1:unmod
41683
5d383d9636d0 walkchangerevs: obey allfiles parameter when taking the slow path
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 41513
diff changeset
520 $ hg grep -r "0:2" "unmod" --all-files "glob:**/um" # Check that patterns also work
5d383d9636d0 walkchangerevs: obey allfiles parameter when taking the slow path
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 41513
diff changeset
521 um:0:unmod
5d383d9636d0 walkchangerevs: obey allfiles parameter when taking the slow path
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 41513
diff changeset
522 um:1:unmod
38946
f3f109971359 grep: add MULTIREV support to --allfiles flag
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38653
diff changeset
523 $ cd ..
38960
d99468d2b09a grep: search all commits in allfiles mode
Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
parents: 38946
diff changeset
524