Show More
@@ -1151,7 +1151,7 b' def grep(ui, repo, pattern, *pats, **opt' | |||
|
1151 | 1151 | def display(fn, rev, states, prevstates): |
|
1152 | 1152 | counts = {'-': 0, '+': 0} |
|
1153 | 1153 | filerevmatches = {} |
|
1154 |
if |
|
|
1154 | if not opts['all']: | |
|
1155 | 1155 | a, b, r = prevstates, states, rev |
|
1156 | 1156 | else: |
|
1157 | 1157 | a, b, r = states, prevstates, prev.get(fn, -1) |
@@ -1179,11 +1179,9 b' def grep(ui, repo, pattern, *pats, **opt' | |||
|
1179 | 1179 | get = util.cachefunc(lambda r: repo.changectx(r).changeset()) |
|
1180 | 1180 | changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts) |
|
1181 | 1181 | count = 0 |
|
1182 | incrementing = False | |
|
1183 | 1182 | follow = opts.get('follow') |
|
1184 | 1183 | for st, rev, fns in changeiter: |
|
1185 | 1184 | if st == 'window': |
|
1186 | incrementing = rev | |
|
1187 | 1185 | matches.clear() |
|
1188 | 1186 | elif st == 'add': |
|
1189 | 1187 | mf = repo.changectx(rev).manifest() |
@@ -1209,7 +1207,7 b' def grep(ui, repo, pattern, *pats, **opt' | |||
|
1209 | 1207 | if copy: |
|
1210 | 1208 | skip[copy] = True |
|
1211 | 1209 | continue |
|
1212 |
if |
|
|
1210 | if not opts['all'] or fstate[fn]: | |
|
1213 | 1211 | pos, neg = display(fn, rev, m, fstate[fn]) |
|
1214 | 1212 | count += pos + neg |
|
1215 | 1213 | if pos and not opts['all']: |
@@ -1221,14 +1219,13 b' def grep(ui, repo, pattern, *pats, **opt' | |||
|
1221 | 1219 | fstate[copy] = m |
|
1222 | 1220 | prev[fn] = rev |
|
1223 | 1221 | |
|
1224 | if not incrementing: | |
|
1225 | fstate = fstate.items() | |
|
1226 | fstate.sort() | |
|
1227 |
f |
|
|
1228 |
|
|
|
1229 | continue | |
|
1230 | if fn not in copies.get(prev[fn], {}): | |
|
1231 | display(fn, rev, {}, state) | |
|
1222 | fstate = fstate.items() | |
|
1223 | fstate.sort() | |
|
1224 | for fn, state in fstate: | |
|
1225 | if fn in skip: | |
|
1226 | continue | |
|
1227 | if fn not in copies.get(prev[fn], {}): | |
|
1228 | display(fn, rev, {}, state) | |
|
1232 | 1229 | return (count == 0 and 1) or 0 |
|
1233 | 1230 | |
|
1234 | 1231 | def heads(ui, repo, **opts): |
@@ -17,8 +17,11 b" hg commit -m 3 -u eggs -d '3 0'" | |||
|
17 | 17 | head -n 3 port > port1 |
|
18 | 18 | mv port1 port |
|
19 | 19 | hg commit -m 4 -u spam -d '4 0' |
|
20 | echo % simple | |
|
20 | 21 | hg grep port port |
|
22 | echo % all | |
|
21 | 23 | hg grep --all -nu port port |
|
24 | echo % other | |
|
22 | 25 | hg grep import port |
|
23 | 26 | |
|
24 | 27 | hg cp port port2 |
@@ -1,6 +1,8 b'' | |||
|
1 | % simple | |
|
1 | 2 | port:4:export |
|
2 | 3 | port:4:vaportight |
|
3 | 4 | port:4:import/export |
|
5 | % all | |
|
4 | 6 | port:4:4:-:spam:import/export |
|
5 | 7 | port:3:4:+:eggs:import/export |
|
6 | 8 | port:2:1:-:spam:import |
@@ -10,6 +12,7 b' port:2:2:+:spam:vaportight' | |||
|
10 | 12 | port:2:3:+:spam:import/export |
|
11 | 13 | port:1:2:+:eggs:export |
|
12 | 14 | port:0:1:+:spam:import |
|
15 | % other | |
|
13 | 16 | port:4:import/export |
|
14 | 17 | % follow |
|
15 | 18 | port:0:import |
General Comments 0
You need to be logged in to leave comments.
Login now