Show More
@@ -30,39 +30,27 def dagwalker(repo, revs): | |||||
30 | returned. |
|
30 | returned. | |
31 | """ |
|
31 | """ | |
32 | if not revs: |
|
32 | if not revs: | |
33 |
return |
|
33 | return | |
34 |
|
||||
35 | ns = [repo[r].node() for r in revs] |
|
|||
36 | revdag = list(nodes(repo, ns)) |
|
|||
37 |
|
34 | |||
38 | cl = repo.changelog |
|
35 | cl = repo.changelog | |
39 | lowestrev = min(revs) |
|
36 | lowestrev = min(revs) | |
40 | gpcache = {} |
|
37 | gpcache = {} | |
41 | leafs = {} |
|
|||
42 |
|
38 | |||
43 | for i, (id, c, ctx, parents) in enumerate(revdag): |
|
39 | for rev in revs: | |
|
40 | ctx = repo[rev] | |||
|
41 | parents = sorted(set([p.rev() for p in ctx.parents() if p.rev() in revs])) | |||
44 | mpars = [p.rev() for p in ctx.parents() if |
|
42 | mpars = [p.rev() for p in ctx.parents() if | |
45 | p.rev() != nullrev and p.rev() not in parents] |
|
43 | p.rev() != nullrev and p.rev() not in parents] | |
46 | grandparents = [] |
|
|||
47 |
|
44 | |||
48 | for mpar in mpars: |
|
45 | for mpar in mpars: | |
49 | gp = gpcache.get(mpar) or grandparent(cl, lowestrev, revs, mpar) |
|
46 | gp = gpcache.get(mpar) or grandparent(cl, lowestrev, revs, mpar) | |
50 | gpcache[mpar] = gp |
|
47 | gpcache[mpar] = gp | |
51 | if gp is None: |
|
48 | if gp is None: | |
52 | leafs.setdefault(mpar, []).append((i, ctx)) |
|
49 | parents.append(mpar) | |
53 |
el |
|
50 | elif gp not in parents: | |
54 |
|
|
51 | parents.append(gp) | |
55 |
|
52 | |||
56 | if grandparents: |
|
53 | yield (ctx.rev(), CHANGESET, ctx, parents) | |
57 | for gp in grandparents: |
|
|||
58 | if gp not in revdag[i][3]: |
|
|||
59 | revdag[i][3].append(gp) |
|
|||
60 |
|
||||
61 | for parent, leafs in leafs.iteritems(): |
|
|||
62 | for i, ctx in leafs: |
|
|||
63 | revdag[i][3].append(parent) |
|
|||
64 |
|
||||
65 | return revdag |
|
|||
66 |
|
54 | |||
67 | def nodes(repo, nodes): |
|
55 | def nodes(repo, nodes): | |
68 | """cset DAG generator yielding (id, CHANGESET, ctx, [parentids]) tuples |
|
56 | """cset DAG generator yielding (id, CHANGESET, ctx, [parentids]) tuples |
General Comments 0
You need to be logged in to leave comments.
Login now