##// END OF EJS Templates
shelve: move mutableancestors to not be a closure...
Kostia Balytskyi -
r30380:84e8cbdb default
parent child Browse files
Show More
@@ -273,24 +273,24 b' def getshelvename(repo, parent, opts):'
273 raise error.Abort(_("shelved change names may not start with '.'"))
273 raise error.Abort(_("shelved change names may not start with '.'"))
274 return name
274 return name
275
275
276 def _docreatecmd(ui, repo, pats, opts):
276 def mutableancestors(ctx):
277 def mutableancestors(ctx):
277 """return all mutable ancestors for ctx (included)
278 """return all mutable ancestors for ctx (included)
279
278
280 Much faster than the revset ancestors(ctx) & draft()"""
279 Much faster than the revset ancestors(ctx) & draft()"""
281 seen = set([nodemod.nullrev])
280 seen = set([nodemod.nullrev])
282 visit = collections.deque()
281 visit = collections.deque()
283 visit.append(ctx)
282 visit.append(ctx)
284 while visit:
283 while visit:
285 ctx = visit.popleft()
284 ctx = visit.popleft()
286 yield ctx.node()
285 yield ctx.node()
287 for parent in ctx.parents():
286 for parent in ctx.parents():
288 rev = parent.rev()
287 rev = parent.rev()
289 if rev not in seen:
288 if rev not in seen:
290 seen.add(rev)
289 seen.add(rev)
291 if parent.mutable():
290 if parent.mutable():
292 visit.append(parent)
291 visit.append(parent)
293
292
293 def _docreatecmd(ui, repo, pats, opts):
294 wctx = repo[None]
294 wctx = repo[None]
295 parents = wctx.parents()
295 parents = wctx.parents()
296 if len(parents) > 1:
296 if len(parents) > 1:
General Comments 0
You need to be logged in to leave comments. Login now