Mercurial > hg
comparison mercurial/graphmod.py @ 12954:85777aab7e08
merge with crew
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 08 Nov 2010 17:16:29 -0600 |
parents | 101366ad816c |
children | 9966c95b8c4f |
comparison
equal
deleted
inserted
replaced
12946:24a1d7ad12a4 | 12954:85777aab7e08 |
---|---|
30 integers which identify a node in the context of the graph returned. | 30 integers which identify a node in the context of the graph returned. |
31 """ | 31 """ |
32 cur = start | 32 cur = start |
33 while cur >= stop: | 33 while cur >= stop: |
34 ctx = repo[cur] | 34 ctx = repo[cur] |
35 parents = [p.rev() for p in ctx.parents() if p.rev() != nullrev] | 35 parents = set([p.rev() for p in ctx.parents() if p.rev() != nullrev]) |
36 yield (cur, CHANGESET, ctx, sorted(parents)) | 36 yield (cur, CHANGESET, ctx, sorted(parents)) |
37 cur -= 1 | 37 cur -= 1 |
38 | 38 |
39 def filerevs(repo, path, start, stop, limit=None): | 39 def filerevs(repo, path, start, stop, limit=None): |
40 """file cset DAG generator yielding (id, CHANGESET, ctx, [parentids]) tuples | 40 """file cset DAG generator yielding (id, CHANGESET, ctx, [parentids]) tuples |
45 filerev = len(repo.file(path)) - 1 | 45 filerev = len(repo.file(path)) - 1 |
46 rev = stop + 1 | 46 rev = stop + 1 |
47 count = 0 | 47 count = 0 |
48 while filerev >= 0 and rev > stop: | 48 while filerev >= 0 and rev > stop: |
49 fctx = repo.filectx(path, fileid=filerev) | 49 fctx = repo.filectx(path, fileid=filerev) |
50 parents = [f.linkrev() for f in fctx.parents() if f.path() == path] | 50 parents = set([f.linkrev() for f in fctx.parents() if f.path() == path]) |
51 rev = fctx.rev() | 51 rev = fctx.rev() |
52 if rev <= start: | 52 if rev <= start: |
53 yield (rev, CHANGESET, fctx.changectx(), sorted(parents)) | 53 yield (rev, CHANGESET, fctx.changectx(), sorted(parents)) |
54 count += 1 | 54 count += 1 |
55 if count == limit: | 55 if count == limit: |
63 that are in nodes, too. | 63 that are in nodes, too. |
64 """ | 64 """ |
65 include = set(nodes) | 65 include = set(nodes) |
66 for node in nodes: | 66 for node in nodes: |
67 ctx = repo[node] | 67 ctx = repo[node] |
68 parents = [p.rev() for p in ctx.parents() if p.node() in include] | 68 parents = set([p.rev() for p in ctx.parents() if p.node() in include]) |
69 yield (ctx.rev(), CHANGESET, ctx, sorted(parents)) | 69 yield (ctx.rev(), CHANGESET, ctx, sorted(parents)) |
70 | 70 |
71 def colored(dag): | 71 def colored(dag): |
72 """annotates a DAG with colored edge information | 72 """annotates a DAG with colored edge information |
73 | 73 |