[PATCH 1 of 3] Provide a version independent way to use the set datatype

Brendan Cully brendan at kublai.com
Wed Jun 20 20:14:13 CDT 2007


On Wednesday, 20 June 2007 at 18:11, Eric Hopper wrote:
> 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.

Please use crew tip - I just applied your last round (set and heads,
not branches -- I'm personally still on the fence about it).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20070620/a912e813/attachment.pgp 


More information about the Mercurial-devel mailing list