[PATCH hglib] hglib: Eliminate named tuples for Python 2.4 and 2.5 compatibility

Matt Mackall mpm at selenic.com
Mon Nov 28 17:40:33 CST 2011


On Mon, 2011-11-28 at 11:06 -0500, Jeff Laughlin wrote:
> # HG changeset patch
> # User Jeff Laughlin <jmlaughlin at integrated-informatics.com>
> # Date 1321987954 18000
> # Node ID 317a25e6c619ed59c94d583f96d3763ccc8b47e4
> # Parent  3bbf6a3266f44ce822b19b0a857dd3a3cea1d515
> hglib: Eliminate named tuples for Python 2.4 and 2.5 compatibility.
> 
> Named tuples were not introduced until Python 2.6. Since Mercurial advertises compatibility
> backwards with Python 2.4, it seems as though hglib ought to be compatible as well. This
> patch replaces usage of the revision named tuple in client.py with a Revision class. It passes all
> tests.

This is a pretty decent start on a solution, but I think the resulting
object also needs to be tuple-like (ie by subclassing tuple) for
compatibility. That'll give you __cmp__ for free, btw.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list