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