##// END OF EJS Templates
annotate: memory efficiency...
mpm@selenic.com -
r200:8450c18f default
parent child Browse files
Show More
@@ -41,6 +41,7 b' class filelog(revlog):'
41 new += child[s:t]
41 new += child[s:t]
42 return new
42 return new
43
43
44 # find all ancestors
44 needed = {}
45 needed = {}
45 visit = [node]
46 visit = [node]
46 while visit:
47 while visit:
@@ -49,7 +50,11 b' class filelog(revlog):'
49 if p not in needed:
50 if p not in needed:
50 needed[p] = 1
51 needed[p] = 1
51 visit.append(p)
52 visit.append(p)
53 else:
54 # count how many times we'll use this
55 needed[p] += 1
52
56
57 # sort by revision which is a topological order
53 visit = needed.keys()
58 visit = needed.keys()
54 visit = [ (self.rev(n), n) for n in visit ]
59 visit = [ (self.rev(n), n) for n in visit ]
55 visit.sort()
60 visit.sort()
@@ -61,6 +66,10 b' class filelog(revlog):'
61 for p in self.parents(n):
66 for p in self.parents(n):
62 if p != nullid:
67 if p != nullid:
63 curr = pair(hist[p], curr)
68 curr = pair(hist[p], curr)
69 # trim the history of unneeded revs
70 needed[p] -= 1
71 if not needed[p]:
72 del hist[p]
64 hist[n] = curr
73 hist[n] = curr
65
74
66 return hist[n]
75 return hist[n]
General Comments 0
You need to be logged in to leave comments. Login now