[PATCH 5 of 5] mpatch: write a cffi version of mpatch.patches
Kevin Bullock
kbullock+mercurial at ringworld.org
Fri Aug 5 11:14:45 EDT 2016
> On Jul 25, 2016, at 08:10, Maciej Fijalkowski <fijall at gmail.com> wrote:
>
> # HG changeset patch
> # User Maciej Fijalkowski <fijall at gmail.com>
> # Date 1469452252 -7200
> # Mon Jul 25 15:10:52 2016 +0200
> # Node ID a1892edea7f58fc97730db354877ae590446b292
> # Parent 8e2d1b2d5248620ff4ccfcb61e1b383cf0e4e204
> mpatch: write a cffi version of mpatch.patches
>
> diff --git a/mercurial/pure/mpatch.py b/mercurial/pure/mpatch.py
> --- a/mercurial/pure/mpatch.py
> +++ b/mercurial/pure/mpatch.py
> @@ -9,8 +9,10 @@
>
> import struct
>
> -from . import pycompat
> +from . import policy, pycompat
> stringio = pycompat.stringio
> +modulepolicy = policy.policy
> +policynocffi = policy.policynocffi
>
> class mpatchError(Exception):
> """error raised when a delta cannot be decoded
> @@ -125,3 +127,44 @@
>
> outlen += orig - last
> return outlen
> +
> +if modulepolicy not in policynocffi:
> + try:
> + from _mpatch_cffi import ffi, lib
> + except ImportError:
> + if modulepolicy == 'cffi': # strict cffi import
> + raise
> + else:
> + @ffi.def_extern()
> + def cffi_get_next_item(arg, pos):
test-check-commit.t is puking on this function name. We probably need a special case for cffi in contrib/check-commit?
pacem in terris / мир / शान्ति / سَلاَم / 平和
Kevin R. Bullock
More information about the Mercurial-devel
mailing list