Show More
@@ -122,22 +122,21 b' def createcmd(ui, repo, pats, opts):' | |||||
122 | """subcommand that creates a new shelve""" |
|
122 | """subcommand that creates a new shelve""" | |
123 |
|
123 | |||
124 | def publicancestors(ctx): |
|
124 | def publicancestors(ctx): | |
125 |
"""Compute the |
|
125 | """Compute the public ancestors of a commit. | |
126 |
|
126 | |||
127 |
Much faster than the revset |
|
127 | Much faster than the revset ancestors(ctx) & draft()""" | |
128 | seen = set([nullrev]) |
|
128 | seen = set([nullrev]) | |
129 | visit = util.deque() |
|
129 | visit = util.deque() | |
130 | visit.append(ctx) |
|
130 | visit.append(ctx) | |
131 | while visit: |
|
131 | while visit: | |
132 | ctx = visit.popleft() |
|
132 | ctx = visit.popleft() | |
|
133 | yield ctx.node() | |||
133 | for parent in ctx.parents(): |
|
134 | for parent in ctx.parents(): | |
134 | rev = parent.rev() |
|
135 | rev = parent.rev() | |
135 | if rev not in seen: |
|
136 | if rev not in seen: | |
136 | seen.add(rev) |
|
137 | seen.add(rev) | |
137 | if parent.mutable(): |
|
138 | if parent.mutable(): | |
138 | visit.append(parent) |
|
139 | visit.append(parent) | |
139 | else: |
|
|||
140 | yield parent.node() |
|
|||
141 |
|
140 | |||
142 | wctx = repo[None] |
|
141 | wctx = repo[None] | |
143 | parents = wctx.parents() |
|
142 | parents = wctx.parents() |
General Comments 0
You need to be logged in to leave comments.
Login now