[PATCH 1 of 8] bdiff: add _version to help detect breaking binary changes

Jun Wu quark at fb.com
Tue May 2 21:33:50 EDT 2017


Excerpts from Yuya Nishihara's message of 2017-05-03 10:18:46 +0900:
> On Tue, 2 May 2017 17:19:58 -0700, Jun Wu wrote:
> > # HG changeset patch
> > # User Jun Wu <quark at fb.com>
> > # Date 1493166881 25200
> > #      Tue Apr 25 17:34:41 2017 -0700
> > # Node ID 9073b1dfb58eb71c1005dad5267b6ee4f09790da
> > # Parent  6cacc271ee0a9385be483314dc73be176a13c891
> > # Available At https://bitbucket.org/quark-zju/hg-draft 
> > #              hg pull https://bitbucket.org/quark-zju/hg-draft  -r 9073b1dfb58e
> > bdiff: add _version to help detect breaking binary changes
> 
> For reference, my series:
> https://bitbucket.org/yuja/hg-work/commits/cbfd47adf9d6bbdbab7ed61338b2dcf5877b90f2 
> https://bitbucket.org/yuja/hg-work/commits/c84185741bf4063e296c82b9c3571a87c9f61eed 
> https://bitbucket.org/yuja/hg-work/commits/54531fe0b1f9950db5b496b21cf06badb25b56eb 
> 
> I have no strong opinion that we should stick to the current per-function
> versioning, but I believe some bits in this series can be reused so we won't
> mess up our importer hack anymore.

I like the idea moving C extensions to "cext". We should probably do that.

The problem we faced for issue4042 fix is to maintain compatibility in both
directions without copy-paste.

The "_duralmodule" approach is while smart, does not really solve the above
problem. i.e. copy-paste is still needed.

I believe avoiding copy-paste (or dead-code) is much more important than
avoiding re-compiling for mercurial developers. That's the motivation of
this series.

> > --- a/mercurial/bdiff_module.c
> > +++ b/mercurial/bdiff_module.c
> > @@ -193,4 +193,8 @@ static PyMethodDef methods[] = {
> >  };
> >  
> > +/* Binary version. When breaking changes are made, bump this number and change
> > + * __init__.py, so the module loader can notice and fallback to pure. */
> > +static const int _version = 1;
> 
> Nit: '_' prefix is reserved for compiler authors.


More information about the Mercurial-devel mailing list