# HG changeset patch # User Augie Fackler # Date 2014-08-21 14:07:30 # Node ID 90cf454edd709c616d1e5ea4f30fb4d02f0c01a4 # Parent 711de9dcb1d37f639ceb36ef4dd7d366df3da20a cvsps: add two more tiebreakers in cscmp test-convert-cvs.t has been a little flaky for a while now. Add an extra tiebreaker in cscmp so that all the cases in the test will sort reliably. Without this patch, test-convert-cvs.t failed after 346 runs. With this patch, I stopped trying to get it to fail after 615 runs. While not conclusive, that makes me pretty optimistic that this is a working fix. diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -631,7 +631,19 @@ def createchangeset(ui, log, fuzz=60, me odd.add((l, r)) d = -1 break + # By this point, the changesets are sufficiently compared that + # we don't really care about ordering. However, this leaves + # some race conditions in the tests, so we compare on the + # number of files modified and the number of branchpoints in + # each changeset to ensure test output remains stable. + # recommended replacement for cmp from + # https://docs.python.org/3.0/whatsnew/3.0.html + c = lambda x, y: (x > y) - (x < y) + if not d: + d = c(len(l.entries), len(r.entries)) + if not d: + d = c(len(l.branchpoints), len(r.branchpoints)) return d changesets.sort(cscmp)