changeset 19503:f2dfda6ac152 stable

ancestor.deepest: decrement ninteresting correctly (issue3984) The invariant this code tries to hold is that ninteresting is the number of non-zero elements in the interesting array. interesting[nsp] is incremented at the same time as interesting[sp] is decremented. So if interesting[nsp] was previously 0, ninteresting shouldn't be decremented.
author Wei, Elson <elson.wei@gmail.com>
date Thu, 25 Jul 2013 17:35:53 +0800
parents 8704477ad3b6
children 2fa303619b4d
files mercurial/parsers.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/parsers.c	Thu Jul 25 14:20:37 2013 -0700
+++ b/mercurial/parsers.c	Thu Jul 25 17:35:53 2013 +0800
@@ -1362,10 +1362,10 @@
 				if (nsp == sp)
 					continue;
 				seen[p] = nsp;
+				interesting[sp] -= 1;
+				if (interesting[sp] == 0 && interesting[nsp] > 0)
+					ninteresting -= 1;
 				interesting[nsp] += 1;
-				interesting[sp] -= 1;
-				if (interesting[sp] == 0)
-					ninteresting -= 1;
 			}
 		}
 		interesting[sv] -= 1;