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