[PATCH 4 of 6] commands: allow argument similarity to be int 0

Simon Heimberg simohe at besonet.ch
Sun Sep 11 10:46:24 CDT 2011


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1315755235 -7200
# Node ID f0590f1fc041129c84f3b9a4500ad9fdac4591c2
# Parent  aa38d95881065c24eb4a8bc441cb2514c166c32e
commands: allow argument similarity to be int 0

diff -r aa38d9588106 -r f0590f1fc041 mercurial/commands.py
--- a/mercurial/commands.py	Mit Sep 07 18:22:30 2011 +0200
+++ b/mercurial/commands.py	Son Sep 11 17:33:55 2011 +0200
@@ -194,8 +194,11 @@
 
     Returns 0 if all files are successfully added.
     """
+    sim = opts.get('similarity')
+    if not sim and sim != 0:
+        sim = 100
     try:
-        sim = float(opts.get('similarity') or 100)
+        sim = float(sim)
     except ValueError:
         raise util.Abort(_('similarity must be a number'))
     if sim < 0 or sim > 100:


More information about the Mercurial-devel mailing list