##// END OF EJS Templates
ancestor: add a way to add to bases of a missing ancestor object...
Siddharth Agarwal -
r23341:bcc3012f default
parent child Browse files
Show More
@@ -150,6 +150,10 b' class incrementalmissingancestors(object'
150 '''whether the common set has any non-trivial bases'''
150 '''whether the common set has any non-trivial bases'''
151 return self.bases and self.bases != set([nullrev])
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 def missingancestors(self, revs):
157 def missingancestors(self, revs):
154 '''return all the ancestors of revs that are not ancestors of self.bases
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 def __init__(self, ancs, bases):
45 def __init__(self, ancs, bases):
46 self.ancs = ancs
46 self.ancs = ancs
47 self.bases = set(bases)
47 self.bases = set(bases)
48 def addbases(self, newbases):
49 self.bases.update(newbases)
48 def missingancestors(self, revs):
50 def missingancestors(self, revs):
49 res = set()
51 res = set()
50 for rev in revs:
52 for rev in revs:
@@ -97,6 +99,11 b' def test_missingancestors(seed, rng):'
97 naiveinc = naiveincrementalmissingancestors(ancs, bases)
99 naiveinc = naiveincrementalmissingancestors(ancs, bases)
98 seq = []
100 seq = []
99 for _ in xrange(inccount):
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 revs = samplerevs(graphnodes)
107 revs = samplerevs(graphnodes)
101 seq.append(('missingancestors', revs))
108 seq.append(('missingancestors', revs))
102 h = inc.missingancestors(revs)
109 h = inc.missingancestors(revs)
General Comments 0
You need to be logged in to leave comments. Login now