##// END OF EJS Templates
walkchangerevs: yield contexts
Matt Mackall -
r9654:96fe91be default
parent child Browse files
Show More
@@ -55,12 +55,11 b' def countrate(ui, repo, amap, *pats, **o'
55
55
56 get = util.cachefunc(lambda r: repo[r])
56 get = util.cachefunc(lambda r: repo[r])
57 m = cmdutil.match(repo, pats, opts)
57 m = cmdutil.match(repo, pats, opts)
58 for st, rev, fns in cmdutil.walkchangerevs(ui, repo, m, get, opts):
58 for st, ctx, fns in cmdutil.walkchangerevs(ui, repo, m, get, opts):
59
60 if not st == 'add':
59 if not st == 'add':
61 continue
60 continue
62
61
63 ctx = get(rev)
62 rev = ctx.rev()
64 if df and not df(ctx.date()[0]): # doesn't match date format
63 if df and not df(ctx.date()[0]): # doesn't match date format
65 continue
64 continue
66
65
@@ -1217,15 +1217,16 b' def walkchangerevs(ui, repo, match, chan'
1217 nrevs = [rev for rev in revs[i:i+window] if want(rev)]
1217 nrevs = [rev for rev in revs[i:i+window] if want(rev)]
1218 for rev in sorted(nrevs):
1218 for rev in sorted(nrevs):
1219 fns = fncache.get(rev)
1219 fns = fncache.get(rev)
1220 ctx = change(rev)
1220 if not fns:
1221 if not fns:
1221 def fns_generator():
1222 def fns_generator():
1222 for f in change(rev).files():
1223 for f in ctx.files():
1223 if match(f):
1224 if match(f):
1224 yield f
1225 yield f
1225 fns = fns_generator()
1226 fns = fns_generator()
1226 yield 'add', rev, fns
1227 yield 'add', ctx, fns
1227 for rev in nrevs:
1228 for rev in nrevs:
1228 yield 'iter', rev, None
1229 yield 'iter', change(rev), None
1229 return iterate()
1230 return iterate()
1230
1231
1231 def commit(ui, repo, commitfunc, pats, opts):
1232 def commit(ui, repo, commitfunc, pats, opts):
@@ -1292,9 +1292,9 b' def grep(ui, repo, pattern, *pats, **opt'
1292 matchfn = cmdutil.match(repo, pats, opts)
1292 matchfn = cmdutil.match(repo, pats, opts)
1293 found = False
1293 found = False
1294 follow = opts.get('follow')
1294 follow = opts.get('follow')
1295 for st, rev, fns in cmdutil.walkchangerevs(ui, repo, matchfn, get, opts):
1295 for st, ctx, fns in cmdutil.walkchangerevs(ui, repo, matchfn, get, opts):
1296 if st == 'add':
1296 if st == 'add':
1297 ctx = get(rev)
1297 rev = ctx.rev()
1298 pctx = ctx.parents()[0]
1298 pctx = ctx.parents()[0]
1299 parent = pctx.rev()
1299 parent = pctx.rev()
1300 matches.setdefault(rev, {})
1300 matches.setdefault(rev, {})
@@ -1328,6 +1328,7 b' def grep(ui, repo, pattern, *pats, **opt'
1328 except error.LookupError:
1328 except error.LookupError:
1329 pass
1329 pass
1330 elif st == 'iter':
1330 elif st == 'iter':
1331 rev = ctx.rev()
1331 parent = get(rev).parents()[0].rev()
1332 parent = get(rev).parents()[0].rev()
1332 for fn in sorted(revfiles.get(rev, [])):
1333 for fn in sorted(revfiles.get(rev, [])):
1333 states = matches[rev][fn]
1334 states = matches[rev][fn]
@@ -2026,8 +2027,9 b' def log(ui, repo, *pats, **opts):'
2026 only_branches = opts.get('only_branch')
2027 only_branches = opts.get('only_branch')
2027
2028
2028 displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn)
2029 displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn)
2029 for st, rev, fns in cmdutil.walkchangerevs(ui, repo, matchfn, get, opts):
2030 for st, ctx, fns in cmdutil.walkchangerevs(ui, repo, matchfn, get, opts):
2030 if st == 'add':
2031 if st == 'add':
2032 rev = ctx.rev()
2031 parents = [p for p in repo.changelog.parentrevs(rev)
2033 parents = [p for p in repo.changelog.parentrevs(rev)
2032 if p != nullrev]
2034 if p != nullrev]
2033 if opts.get('no_merges') and len(parents) == 2:
2035 if opts.get('no_merges') and len(parents) == 2:
@@ -2035,7 +2037,6 b' def log(ui, repo, *pats, **opts):'
2035 if opts.get('only_merges') and len(parents) != 2:
2037 if opts.get('only_merges') and len(parents) != 2:
2036 continue
2038 continue
2037
2039
2038 ctx = get(rev)
2039 if only_branches and ctx.branch() not in only_branches:
2040 if only_branches and ctx.branch() not in only_branches:
2040 continue
2041 continue
2041
2042
@@ -2068,7 +2069,7 b' def log(ui, repo, *pats, **opts):'
2068
2069
2069 elif st == 'iter':
2070 elif st == 'iter':
2070 if count == limit: break
2071 if count == limit: break
2071 if displayer.flush(rev):
2072 if displayer.flush(ctx.rev()):
2072 count += 1
2073 count += 1
2073
2074
2074 def manifest(ui, repo, node=None, rev=None):
2075 def manifest(ui, repo, node=None, rev=None):
General Comments 0
You need to be logged in to leave comments. Login now