11
11
from bzrlib.tuned_gzip import GzipFile
16
for version_id in vf.versions():
17
for parent_id in vf.get_parents(version_id):
18
descendants.setdefault(parent_id, []).append(version_id)
19
cur = [v for v in vf.versions() if len(vf.get_parents(v)) == 0]
22
for version_id in cur:
23
if version_id in seen:
25
parents = vf.get_parents(version_id)
26
if not seen.issuperset(parents):
28
next.extend(descendants.get(version_id, []))
13
34
class MultiParent(object):
15
36
def __init__(self, hunks=None):
313
334
snapshots = set()
314
for version_id in vf.versions():
315
for parent_id in vf.get_parents(version_id):
316
descendants.setdefault(parent_id, []).append(version_id)
317
cur = [v for v in vf.versions() if len(vf.get_parents(v)) == 0]
320
for version_id in cur:
321
if version_id in distances:
323
parents = vf.get_parents(version_id)
324
p_distances = [distances.get(p) for p in parents]
325
if None in p_distances:
327
next.extend(descendants.get(version_id, []))
328
if len(p_distances) == 0:
335
for version_id in topo_iter(vf):
336
p_distances = [distances[p] for p in vf.get_parents(version_id)]
337
if len(p_distances) == 0:
338
snapshots.add(version_id)
339
distances[version_id] = 0
341
max_distance = max(p_distances)
342
if max_distance + 1 > self.snapshot_interval:
343
snapshots.add(version_id)
344
distances[version_id] = 0
345
elif len(descendants) > 1 and max_distance > \
346
self.snapshot_interval -4 and False:
329
347
snapshots.add(version_id)
330
348
distances[version_id] = 0
332
max_distance = max(p_distances)
333
if max_distance + 1 > self.snapshot_interval:
334
snapshots.add(version_id)
335
distances[version_id] = 0
336
elif len(descendants) > 1 and max_distance > \
337
self.snapshot_interval -4 and False:
338
snapshots.add(version_id)
339
distances[version_id] = 0
341
distances[version_id] = max_distance + 1
350
distances[version_id] = max_distance + 1