[PATCH 1 of 3] Provide a version independent way to use the set datatype
Eric Hopper
hopper at omnifarious.org
Thu Jun 21 01:11:00 UTC 2007
On Wed, Jun 20, 2007 at 05:46:16PM -0700, Brendan Cully wrote:
> On Tuesday, 19 June 2007 at 08:40, Eric Hopper wrote:
> > # HG changeset patch
> > # User Eric Hopper <hopper at omnifarious.org>
> > # Date 1182267461 25200
> > # Node ID 5504bb9e36600c6d967a0eb2bd63ba213e75e5e4
> > # Parent 8d46056960ab555053fd1f2e6536711277609941
> > Provide a version independent way to use the set datatype.
> >
> > diff --git a/mercurial/util.py b/mercurial/util.py
> > --- a/mercurial/util.py
> > +++ b/mercurial/util.py
> > @@ -15,6 +15,12 @@ from i18n import _
> > from i18n import _
> > import cStringIO, errno, getpass, popen2, re, shutil, sys, tempfile
> > import os, threading, time, calendar, ConfigParser, locale, glob
> > +
> > +try:
> > + set = set
> > + frozenset = frozenset
> > +except NameError:
> > + from sets import Set as set, ImmutableSet as frozenset
> >
> > try:
> > _encoding = os.environ.get("HGENCODING")
> >
>
> sorry, this doesn't work as written. On python 2.3, you're importing
> set into util only. It'll still raise a NameError in other
> modules. For example, heads . via your second patch fails on py2.3.
>
> I'll change it to use util.set().
Actually, there are a few small problems with my patches. That's what
comes from getting frustrated and impatient with making several rounds
of very tiny changes. :-(
Anyway, I've fixed them so the tests run in Python 2.3, 2.4 or 2.5 now
and I'll re-post them.
Thanks,
--
"It does me no injury for my neighbor to say there are twenty gods or no God.
It neither picks my pocket nor breaks my leg." --- Thomas Jefferson
"Go to Heaven for the climate, Hell for the company." -- Mark Twain
-- Eric Hopper (http://www.omnifarious.org/~hopper) --
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20070620/909b446f/attachment.asc>
More information about the Mercurial-devel
mailing list