# # # patch "viewmtn.py" # from [be2566f22b012e9d6299c4eb6e842279056f16a1] # to [59dc301d06bb38d604e2bc17651e8a2c3c4d9fe1] # ============================================================ --- viewmtn.py be2566f22b012e9d6299c4eb6e842279056f16a1 +++ viewmtn.py 59dc301d06bb38d604e2bc17651e8a2c3c4d9fe1 @@ -351,11 +351,11 @@ class BranchChanges: class BranchChanges: def get_last_changes(self, branch, heads, from_change, to_change): - revs = heads + revs = set(heads) if len(revs) == 0: raise Exception("get_last_changes() unable to find somewhere to start - probably a non-existent branch?") - to_parent = revs+[] # copy - new_to_parent = [] + new_to_parent = set() + to_parent = revs.copy() count = to_change def on_our_branch(r): @@ -365,19 +365,23 @@ class BranchChanges: if cert[7] == branch.name: rv = True return rv - + while len(revs) < count: - new_to_parent = [] + new_to_parent = set() for rev in to_parent: # we must be cautious; we only want to look at parents on our branch! parents = map(None, ops.parents(rev)) parents = filter(on_our_branch, parents) - new_to_parent += parents + for rev in parents: + if rev == None or not on_our_branch(rev): + continue + new_to_parent.add(rev) if len(new_to_parent) == 0: # out of revisions... break to_parent = new_to_parent - revs += new_to_parent + for rev in new_to_parent: + revs.add(rev) # toposort seems pretty darn slow; let's avoid this one.. # revs = map(None, ops.toposort(revs))[:count] certs_for_revs = [] @@ -389,7 +393,7 @@ class BranchChanges: return common.parse_timecert(cert[7]) return None certs_for_revs.sort(lambda b, a: cmp(cd(a[1]), cd(b[1]))) - return certs_for_revs[from_change:to_change], new_to_parent + return certs_for_revs[from_change:to_change], list(new_to_parent) def GET(self, branch, from_change, to_change, template_name): def for_template(revs):