# # # patch "viewmtn.py" # from [da104e5b02b48460051a6371cc78a0b71dcc9083] # to [78255ee04b4c50220ae89a9dc08a9b6f99e820fc] # ============================================================ --- viewmtn.py da104e5b02b48460051a6371cc78a0b71dcc9083 +++ viewmtn.py 78255ee04b4c50220ae89a9dc08a9b6f99e820fc @@ -385,7 +385,7 @@ class BranchChanges: # irritating edge-case, heapq compares us to empty string if # there's only one thing in the list if not other: return 1 - return cmp(self.date, other.date) + return cmp(other.date, self.date) def on_our_branch(r): rv = False @@ -398,25 +398,25 @@ class BranchChanges: if not heads: raise Exception("get_last_changes() unable to find somewhere to start - probably a non-existent branch?") + last_result = None result = [] revq = [] - to_parent = map (lambda r: ComparisonRev(r), heads) + for rev in heads: + heapq.heappush(revq, ComparisonRev(rev)) while len(result) < to_change: - for rev in to_parent: - parents = filter(None, ops.parents(rev.revision)) +# print >>sys.stderr, "revq state:", map(lambda x: (x.revision, x.date), revq) + # update based on the last result we output + if last_result != None: + parents = filter(None, ops.parents(last_result.revision)) for parent_rev in parents: if parent_rev == None or not on_our_branch(parent_rev): continue heapq.heappush(revq, ComparisonRev(parent_rev)) - if len(revq) == 0: - to_parent = None - break - # follow the newest edge - next_rev = heapq.heappop(revq) - to_parent = [ next_rev ] - result.append(next_rev) - if to_parent == None: + if len(revq) == 0: break + # follow the newest edge + last_result = heapq.heappop(revq) + result.append(last_result) rv = map (lambda x: (x.revision, x.certs), result[from_change:to_change]), revq return rv