[PATCH 8 of 8] cvsps: remove is-comparisons with non-singletons

Martin Geisler mg at lazybytes.net
Tue Nov 16 17:04:50 CST 2010


Dan Villiom Podlaski Christiansen <danchr at gmail.com> writes:

> # HG changeset patch
> # User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
> # Date 1289939758 -3600
> # Branch stable
> # Node ID 05d1044efdf7e9c3b3feefb48bf19ae0d62a128a
> # Parent  cc1abbd22d4ae99c4c096c2d7682d7758de583d2
> cvsps: remove is-comparisons with non-singletons.

The '==' is unneeded since the code sets up the globaltags dict just
above to contain the objects that we are searching for.

All in all, I would only use '==' when there is a chance that the object
you are searching for has been copied somehow to another instance which
is then equal in value but differnet in identity. Whenever all the
objects are in scope, then it's easy to see that there is no copying or
cloning going on, and so '==' is needless complexity.

> diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py
> --- a/hgext/convert/cvsps.py
> +++ b/hgext/convert/cvsps.py
> @@ -618,7 +618,7 @@ def createchangeset(ui, log, fuzz=60, me
>          for e in c.entries:
>              tags.update(e.tags)
>          # remember tags only if this is the latest changeset to have it
> -        c.tags = sorted(tag for tag in tags if globaltags[tag] is c)
> +        c.tags = sorted(tag for tag in tags if globaltags[tag] == c)
>  
>      # Find parent changesets, handle {{mergetobranch BRANCHNAME}}
>      # by inserting dummy changesets with two parents, and handle
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

-- 
Martin Geisler

Mercurial links: http://mercurial.ch/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20101117/11799c80/attachment.pgp>


More information about the Mercurial-devel mailing list