Show More
@@ -292,19 +292,7 b' def validdest(repo, old, new):' | |||||
292 | # (new != nullrev has been excluded by the previous check) |
|
292 | # (new != nullrev has been excluded by the previous check) | |
293 | return True |
|
293 | return True | |
294 | elif repo.obsstore: |
|
294 | elif repo.obsstore: | |
295 | # We only need this complicated logic if there is obsolescence |
|
295 | return new.node() in obsolete.foreground(repo, [old.node()]) | |
296 | # XXX will probably deserve an optimised revset. |
|
|||
297 | nm = repo.changelog.nodemap |
|
|||
298 | validdests = set([old]) |
|
|||
299 | plen = -1 |
|
|||
300 | # compute the whole set of successors or descendants |
|
|||
301 | while len(validdests) != plen: |
|
|||
302 | plen = len(validdests) |
|
|||
303 | succs = set(c.node() for c in validdests) |
|
|||
304 | mutable = [c.node() for c in validdests if c.mutable()] |
|
|||
305 | succs.update(obsolete.allsuccessors(repo.obsstore, mutable)) |
|
|||
306 | known = (n for n in succs if n in nm) |
|
|||
307 | validdests = set(repo.set('%ln::', known)) |
|
|||
308 | return new in validdests |
|
|||
309 | else: |
|
296 | else: | |
|
297 | # still an independant clause as it is lazyer (and therefore faster) | |||
310 | return old.descendant(new) |
|
298 | return old.descendant(new) |
@@ -405,6 +405,33 b' def allsuccessors(obsstore, nodes, ignor' | |||||
405 | seen.add(suc) |
|
405 | seen.add(suc) | |
406 | remaining.add(suc) |
|
406 | remaining.add(suc) | |
407 |
|
407 | |||
|
408 | def foreground(repo, nodes): | |||
|
409 | """return all nodes in the "foreground" of other node | |||
|
410 | ||||
|
411 | The foreground of a revision is anything reachable using parent -> children | |||
|
412 | or precursor -> sucessor relation. It is very similars to "descendant" but | |||
|
413 | augmented with obsolescence information. | |||
|
414 | ||||
|
415 | Beware that possible obsolescence cycle may result if complexe situation. | |||
|
416 | """ | |||
|
417 | repo = repo.unfiltered() | |||
|
418 | foreground = set(repo.set('%ln::', nodes)) | |||
|
419 | if repo.obsstore: | |||
|
420 | # We only need this complicated logic if there is obsolescence | |||
|
421 | # XXX will probably deserve an optimised revset. | |||
|
422 | nm = repo.changelog.nodemap | |||
|
423 | plen = -1 | |||
|
424 | # compute the whole set of successors or descendants | |||
|
425 | while len(foreground) != plen: | |||
|
426 | plen = len(foreground) | |||
|
427 | succs = set(c.node() for c in foreground) | |||
|
428 | mutable = [c.node() for c in foreground if c.mutable()] | |||
|
429 | succs.update(allsuccessors(repo.obsstore, mutable)) | |||
|
430 | known = (n for n in succs if n in nm) | |||
|
431 | foreground = set(repo.set('%ln::', known)) | |||
|
432 | return set(c.node() for c in foreground) | |||
|
433 | ||||
|
434 | ||||
408 | def successorssets(repo, initialnode, cache=None): |
|
435 | def successorssets(repo, initialnode, cache=None): | |
409 | """Return all set of successors of initial nodes |
|
436 | """Return all set of successors of initial nodes | |
410 |
|
437 |
General Comments 0
You need to be logged in to leave comments.
Login now