diff --git a/mercurial/similar.py b/mercurial/similar.py --- a/mercurial/similar.py +++ b/mercurial/similar.py @@ -63,7 +63,10 @@ equal += len(line) lengths = len(text) + len(orig) - return equal * 2.0 / lengths + if lengths != 0: + return equal * 2.0 / lengths + else: + return 0 def score(fctx1, fctx2): return _score(fctx1, _ctxdata(fctx2))