mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 07:49:11 +03:00
Optimize annotate a bit
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Optimize annotate a bit Keep the original text around so we don't need to rejoin it Use slice insert-in-place rather than += to construct new lists Construct the decorated list with list multiply rather than comprehension manifest hash: 8c0effb9777750d524d71ad3a2eade3c6ddd579e -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCuca0ywK+sNU5EO8RAtvQAJwOViomGCtlZx/R76i8/CZGvGPqUwCfdybd nRUv1854GjzCbfygzXfeIes= =6Q+E -----END PGP SIGNATURE-----
This commit is contained in:
parent
cd9928ff94
commit
20411bdc00
@ -63,19 +63,16 @@ class filelog(revlog):
|
||||
def annotate(self, node):
|
||||
|
||||
def decorate(text, rev):
|
||||
return [(rev, l) for l in text.splitlines(1)]
|
||||
|
||||
def strip(annotation):
|
||||
return "".join([e[1] for e in annotation])
|
||||
return ([rev] * len(text.splitlines()), text)
|
||||
|
||||
def pair(parent, child):
|
||||
new = []
|
||||
lb = 0
|
||||
for a1, a2, b1, b2 in bdiff.blocks(strip(parent), strip(child)):
|
||||
new += child[lb:b1]
|
||||
new += parent[a1:a2]
|
||||
for a1, a2, b1, b2 in bdiff.blocks(parent[1], child[1]):
|
||||
new[lb:] = child[0][lb:b1]
|
||||
new[b1:] = parent[0][a1:a2]
|
||||
lb = b2
|
||||
return new
|
||||
return (new, child[1])
|
||||
|
||||
# find all ancestors
|
||||
needed = {node:1}
|
||||
@ -108,7 +105,7 @@ class filelog(revlog):
|
||||
del hist[p]
|
||||
hist[n] = curr
|
||||
|
||||
return hist[n]
|
||||
return zip(hist[n][0], hist[n][1].splitlines(1))
|
||||
|
||||
class manifest(revlog):
|
||||
def __init__(self, opener):
|
||||
|
Loading…
Reference in New Issue
Block a user