##// 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
mpatch.py
48 lines | 1.4 KiB | text/x-python | PythonLexer
Yuya Nishihara
cffi: split modules from pure...
r32512 # mpatch.py - CFFI implementation of mpatch.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
from ..pure.mpatch import *
from ..pure.mpatch import mpatchError # silence pyflakes
from . import _mpatch
ffi = _mpatch.ffi
lib = _mpatch.lib
Yuya Nishihara
cffi: remove superfluous "if True" blocks
r32513 @ffi.def_extern()
def cffi_get_next_item(arg, pos):
all, bins = ffi.from_handle(arg)
container = ffi.new("struct mpatch_flist*[1]")
to_pass = ffi.new("char[]", str(bins[pos]))
all.append(to_pass)
r = lib.mpatch_decode(to_pass, len(to_pass) - 1, container)
if r < 0:
return ffi.NULL
return container[0]
Yuya Nishihara
cffi: split modules from pure...
r32512
Yuya Nishihara
cffi: remove superfluous "if True" blocks
r32513 def patches(text, bins):
lgt = len(bins)
all = []
if not lgt:
return text
arg = (all, bins)
patch = lib.mpatch_fold(ffi.new_handle(arg),
lib.cffi_get_next_item, 0, lgt)
if not patch:
raise mpatchError("cannot decode chunk")
outlen = lib.mpatch_calcsize(len(text), patch)
if outlen < 0:
lib.mpatch_lfree(patch)
raise mpatchError("inconsistency detected")
buf = ffi.new("char[]", outlen)
if lib.mpatch_apply(buf, text, len(text), patch) < 0:
lib.mpatch_lfree(patch)
raise mpatchError("error applying patches")
res = ffi.buffer(buf, outlen)[:]
lib.mpatch_lfree(patch)
return res