Show More
@@ -24,26 +24,46 b' class filelog(revlog):' | |||
|
24 | 24 | return self.addrevision(text, transaction, link, p1, p2) |
|
25 | 25 | |
|
26 | 26 | def annotate(self, node): |
|
27 | revs = [] | |
|
28 | while node != nullid: | |
|
29 | revs.append(node) | |
|
30 | node = self.parents(node)[0] | |
|
31 | revs.reverse() | |
|
32 | prev = [] | |
|
33 | annotate = [] | |
|
34 | ||
|
35 | for node in revs: | |
|
36 | curr = self.read(node).splitlines(1) | |
|
37 | linkrev = self.linkrev(node) | |
|
38 | sm = SequenceMatcher(None, prev, curr) | |
|
27 | ||
|
28 | def decorate(text, rev): | |
|
29 | return [(rev, l) for l in text.splitlines(1)] | |
|
30 | ||
|
31 | def strip(annotation): | |
|
32 | return [e[1] for e in annotation] | |
|
33 | ||
|
34 | def pair(parent, child): | |
|
39 | 35 | new = [] |
|
36 | sm = SequenceMatcher(None, strip(parent), strip(child)) | |
|
40 | 37 | for o, m, n, s, t in sm.get_opcodes(): |
|
41 | 38 | if o == 'equal': |
|
42 |
new += |
|
|
39 | new += parent[m:n] | |
|
43 | 40 | else: |
|
44 |
new += |
|
|
45 |
|
|
|
46 | return annotate | |
|
41 | new += child[s:t] | |
|
42 | return new | |
|
43 | ||
|
44 | needed = {} | |
|
45 | visit = [node] | |
|
46 | while visit: | |
|
47 | n = visit.pop(0) | |
|
48 | for p in self.parents(n): | |
|
49 | if p not in needed: | |
|
50 | needed[p] = 1 | |
|
51 | visit.append(p) | |
|
52 | ||
|
53 | visit = needed.keys() | |
|
54 | visit = [ (self.rev(n), n) for n in visit ] | |
|
55 | visit.sort() | |
|
56 | visit = [ p[1] for p in visit ] | |
|
57 | hist = {} | |
|
58 | ||
|
59 | for n in visit: | |
|
60 | curr = decorate(self.read(n), self.linkrev(n)) | |
|
61 | for p in self.parents(n): | |
|
62 | if p != nullid: | |
|
63 | curr = pair(hist[p], curr) | |
|
64 | hist[n] = curr | |
|
65 | ||
|
66 | return hist[n] | |
|
47 | 67 | |
|
48 | 68 | class manifest(revlog): |
|
49 | 69 | def __init__(self, opener): |
General Comments 0
You need to be logged in to leave comments.
Login now