[PATCH 4 of 4] mpatch: implement cffi version of mpatch

Augie Fackler raf at durin42.com
Thu Jun 9 23:28:52 EDT 2016


On Wed, Jun 08, 2016 at 09:59:39AM +0200, Maciej Fijalkowski wrote:
> # HG changeset patch
> # User Maciej Fijalkowski <fijall at gmail.com>
> # Date 1465372757 -7200
> #      Wed Jun 08 09:59:17 2016 +0200
> # Node ID 037fce72309155ba3806753d4f1dc3a7db71ee39
> # Parent  26a4063b4f1f36607dd673849449292ebc34a91d
> mpatch: implement cffi version of mpatch

I'm happy with these, but I tripped over a nasty rebase and then tests
started failing, so I must have screwed up. Can you take a look at the
failures present in 61bec5d from http://hg.durin42.com/hg-wip/?

http://hg.durin42.com/hg-wip/rev/66c2d32dcba4 in particular took a
rough rebase that I suspect I messed up.

Patch 4 also flunks check-code, see below.

>
> This is a first go at working, but not 100% efficient version of mpatch
> for PyPy that uses cffi. Additional improvements might follow, but it
> already makes mercurial far more usable under pypy.
>
> diff -r 26a4063b4f1f -r 037fce723091 mercurial/build_mpatch_cffi.py
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/mercurial/build_mpatch_cffi.py	Wed Jun 08 09:59:17 2016 +0200

[elided]

> diff -r 26a4063b4f1f -r 037fce723091 mercurial/pure/mpatch.py
> --- a/mercurial/pure/mpatch.py	Tue Jun 07 15:35:58 2016 +0200
> +++ b/mercurial/pure/mpatch.py	Wed Jun 08 09:59:17 2016 +0200
> @@ -9,6 +9,8 @@
>
>  import struct
>
> +from .. import modulepolicy, policynocffi
> +
>  from . import pycompat
>  stringio = pycompat.stringio
>
> @@ -125,3 +127,43 @@
>
>      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):

could we call this something like cffigetnext() to make check-code happy?

(I like this name as-is, but the linter disagrees with us.)


More information about the Mercurial-devel mailing list