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

Simon Heimberg simohe at besonet.ch
Sun Sep 11 10:29:08 CDT 2011


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

diff -r 4392307896ba -r ca8d71dfe752 mercurial/commands.py
--- a/mercurial/commands.py	Mit Sep 07 18:22:30 2011 +0200
+++ b/mercurial/commands.py	Son Sep 11 17:00:30 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