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

Martin Geisler mg at aragost.com
Wed Nov 17 03:01:15 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 26ddc30bd301eadc5278e2161ebdae91a1a28025
> # Parent  26f185c76ba4a869426dd705ae4c168296397a42
> httprepo: remove is-comparisons with non-singletons.

I have pushed this one to the stable branch (ea68947ad0ce), thanks!

I tried to tighten up the language in the commit message and I removed
the part about negligible CPU overhead since -- as the commit message
explained -- this is not a concern here.

> An identity check between variable and a string literal was recently
> added to the pushkey implementation.
>
> When true, the value of the variable should be a the same string
> literal but from a different module. Although this is quite likely to
> be safe, using an equality operation should be more in line with the
> intended semantics. As pushkey involves a network roundtrip, any extra
> CPU overhead should be negligible.
>
> diff --git a/mercurial/httprepo.py b/mercurial/httprepo.py
> --- a/mercurial/httprepo.py
> +++ b/mercurial/httprepo.py
> @@ -68,7 +68,7 @@ class httprepository(wireproto.wirerepos
>          raise util.Abort(_('operation not supported over http'))
>  
>      def _callstream(self, cmd, **args):
> -        if cmd is 'pushkey':
> +        if cmd == 'pushkey':
>              args['data'] = ''
>          data = args.pop('data', None)
>          headers = args.pop('headers', {})
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://mercurial.aragost.com/kick-start/


More information about the Mercurial-devel mailing list