[PATCH 1 of 3] Provide a version independent way to use the set datatype
Eric Hopper
hopper at omnifarious.org
Wed Jun 20 19:50:47 CDT 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().
Bother! I should've tested on Python 2.3 even though that's a big pain.
I meant to use util.set in branchheads but forgot.
*sigh*,
--
"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://selenic.com/pipermail/mercurial-devel/attachments/20070620/e1670535/attachment.pgp
More information about the Mercurial-devel
mailing list