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

Dan Villiom Podlaski Christiansen danchr at gmail.com
Tue Nov 16 20:36:16 UTC 2010


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

diff --git a/mercurial/fancyopts.py b/mercurial/fancyopts.py
--- a/mercurial/fancyopts.py
+++ b/mercurial/fancyopts.py
@@ -102,15 +102,15 @@ def fancyopts(args, options, state, gnu=
     for opt, val in opts:
         name = argmap[opt]
         t = type(defmap[name])
-        if t is type(fancyopts):
+        if t == type(fancyopts):
             state[name] = defmap[name](val)
-        elif t is type(1):
+        elif t == type(1):
             state[name] = int(val)
-        elif t is type(''):
+        elif t == type(''):
             state[name] = val
-        elif t is type([]):
+        elif t == type([]):
             state[name].append(val)
-        elif t is type(None) or t is type(False):
+        elif t == type(None) or t == type(False):
             state[name] = True
 
     # return unparsed args



More information about the Mercurial-devel mailing list