##// END OF EJS Templates
hidden: remove _consistencyblockers()...
hidden: remove _consistencyblockers() Roughly speaking, we currently do this to reveal hidden ancestors of visible revisions: 1. Iterate over all visible non-public revisions and see if they have hidden parents 2. For each revision found in step (1) walk the chain of hidden commits and reveal it We can simplify that by skipping step (1) and doing step (2) from all visible non-public revisions instead. This doesn't seem to have much impact on "perfvolatilesets". Before: ! obsolete ! wall 0.004616 comb 0.000000 user 0.000000 sys 0.000000 (best of 570) ! visible ! wall 0.008235 comb 0.010000 user 0.010000 sys 0.000000 (best of 326) After: ! obsolete ! wall 0.004727 comb 0.010000 user 0.010000 sys 0.000000 (best of 543) ! visible ! wall 0.008371 comb 0.000000 user 0.000000 sys 0.000000 (best of 324)

File last commit:

r32513:25b37900 default
r32584:c777dac2 default
Show More
bdiff.py
76 lines | 2.1 KiB | text/x-python | PythonLexer
# bdiff.py - CFFI implementation of bdiff.c
#
# Copyright 2016 Maciej Fijalkowski <fijall@gmail.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
import struct
from ..pure.bdiff import *
from . import _bdiff
ffi = _bdiff.ffi
lib = _bdiff.lib
def blocks(sa, sb):
a = ffi.new("struct bdiff_line**")
b = ffi.new("struct bdiff_line**")
ac = ffi.new("char[]", str(sa))
bc = ffi.new("char[]", str(sb))
l = ffi.new("struct bdiff_hunk*")
try:
an = lib.bdiff_splitlines(ac, len(sa), a)
bn = lib.bdiff_splitlines(bc, len(sb), b)
if not a[0] or not b[0]:
raise MemoryError
count = lib.bdiff_diff(a[0], an, b[0], bn, l)
if count < 0:
raise MemoryError
rl = [None] * count
h = l.next
i = 0
while h:
rl[i] = (h.a1, h.a2, h.b1, h.b2)
h = h.next
i += 1
finally:
lib.free(a[0])
lib.free(b[0])
lib.bdiff_freehunks(l.next)
return rl
def bdiff(sa, sb):
a = ffi.new("struct bdiff_line**")
b = ffi.new("struct bdiff_line**")
ac = ffi.new("char[]", str(sa))
bc = ffi.new("char[]", str(sb))
l = ffi.new("struct bdiff_hunk*")
try:
an = lib.bdiff_splitlines(ac, len(sa), a)
bn = lib.bdiff_splitlines(bc, len(sb), b)
if not a[0] or not b[0]:
raise MemoryError
count = lib.bdiff_diff(a[0], an, b[0], bn, l)
if count < 0:
raise MemoryError
rl = []
h = l.next
la = lb = 0
while h:
if h.a1 != la or h.b1 != lb:
lgt = (b[0] + h.b1).l - (b[0] + lb).l
rl.append(struct.pack(">lll", (a[0] + la).l - a[0].l,
(a[0] + h.a1).l - a[0].l, lgt))
rl.append(str(ffi.buffer((b[0] + lb).l, lgt)))
la = h.a2
lb = h.b2
h = h.next
finally:
lib.free(a[0])
lib.free(b[0])
lib.bdiff_freehunks(l.next)
return "".join(rl)