attic extension broken by updatedir move in hg 1.7+

Matt Mackall mpm at selenic.com
Thu Nov 11 21:23:03 CST 2010


On Fri, 2010-11-12 at 02:40 +0000, John Hein wrote:
> updatedir() was moved from patch.py to cmdutils.py.  It was called by
> the attic extension, so that is now broken when using mercurial 1.7.
> 
> It's easy enough to call cmdutils.updatedir instead of
> patch.updatedir, but that means it will break if used with hg 1.6 or
> earlier.  What's the right way for 3rd party extensions to be portable
> across different mercurial versions?

Looks like attic hasn't been touched in 8 months, might be abandoned.

My general advice would be:

a) subscribe to the API changes on the wiki: 

http://mercurial.selenic.com/wiki/ApiChanges

b) test extensions BEFORE the release date (Nov 1, Mar 1, Jul 1)

c) make wrapper functions that use introspection to check whether they
have the old API or the new API

ie:

def updatedir(*args)
    if hasattr(patch, 'updatedir'):
        patch.updatedir(*args)
    else:
        cmdutil.updatedir(*args)

Occasionally, we'll change argument lists, which can be examined with
inspect.getargspec.

I've stuck this on the wiki under ApiChanges.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list