Show More
@@ -150,6 +150,10 b' class incrementalmissingancestors(object' | |||
|
150 | 150 | '''whether the common set has any non-trivial bases''' |
|
151 | 151 | return self.bases and self.bases != set([nullrev]) |
|
152 | 152 | |
|
153 | def addbases(self, newbases): | |
|
154 | '''grow the ancestor set by adding new bases''' | |
|
155 | self.bases.update(newbases) | |
|
156 | ||
|
153 | 157 | def missingancestors(self, revs): |
|
154 | 158 | '''return all the ancestors of revs that are not ancestors of self.bases |
|
155 | 159 |
@@ -45,6 +45,8 b' class naiveincrementalmissingancestors(o' | |||
|
45 | 45 | def __init__(self, ancs, bases): |
|
46 | 46 | self.ancs = ancs |
|
47 | 47 | self.bases = set(bases) |
|
48 | def addbases(self, newbases): | |
|
49 | self.bases.update(newbases) | |
|
48 | 50 | def missingancestors(self, revs): |
|
49 | 51 | res = set() |
|
50 | 52 | for rev in revs: |
@@ -97,6 +99,11 b' def test_missingancestors(seed, rng):' | |||
|
97 | 99 | naiveinc = naiveincrementalmissingancestors(ancs, bases) |
|
98 | 100 | seq = [] |
|
99 | 101 | for _ in xrange(inccount): |
|
102 | if rng.random() < 0.2: | |
|
103 | newbases = samplerevs(graphnodes) | |
|
104 | seq.append(('addbases', newbases)) | |
|
105 | inc.addbases(newbases) | |
|
106 | naiveinc.addbases(newbases) | |
|
100 | 107 | revs = samplerevs(graphnodes) |
|
101 | 108 | seq.append(('missingancestors', revs)) |
|
102 | 109 | h = inc.missingancestors(revs) |
General Comments 0
You need to be logged in to leave comments.
Login now