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

Dan Villiom Podlaski Christiansen danchr at gmail.com
Tue Nov 16 14:36:12 CST 2010


# 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.

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', {})


More information about the Mercurial-devel mailing list