# HG changeset patch # User Augie Fackler # Date 1466987314 14400 # Node ID 6088597abd20b84d1782908682fddc1f8a65521d # Parent 9f1fa3cc6ba5500359156ffcbb4fc4e08ee0992c test_fetch_renames: avoid hash randomization bug in test When hash randomization is enabled, the order in which revisions are committed to the Mercurial repository can vary for revisions which span branches. In order to work around this, we key the dictionary of golden values for copy data using the suffix of the convert_revision metadata rather than the Mercurial changelog index of the revision. diff --git a/tests/test_fetch_renames.py b/tests/test_fetch_renames.py --- a/tests/test_fetch_renames.py +++ b/tests/test_fetch_renames.py @@ -34,12 +34,16 @@ class TestFetchRenames(test_util.TestBas repo = self._load_fixture_and_fetch('renames_with_prefix.svndump', subdir='prefix', config=config) - self._run_assertions(repo) + self._run_assertions(repo, prefix=True) - def _run_assertions(self, repo): + def _run_assertions(self, repo, prefix=False): # Map revnum to mappings of dest name to (source name, dest content) + if prefix: + prefixlen = len('svn:ae30a990-0fd3-493e-b5d7-883bdd606745/prefix') + else: + prefixlen = len('svn:ae30a990-0fd3-493e-b5d7-883bdd606745') copies = { - 4: { + '/trunk@6': { 'a1': ('a', 'a\n'), 'linka1': ('linka', 'a'), 'a2': ('a', 'a\n'), @@ -55,24 +59,25 @@ class TestFetchRenames(test_util.TestBas 'da2/db/dbf': ('da/db/dbf', 'd\n'), 'da2/db/dblink': ('da/db/dblink', '../daf'), }, - 5: { + '/branches/branch1@6': { 'c1': ('c', 'c\nc\n'), 'linkc1': ('linkc', 'cc'), }, - 9: { + '/trunk@10': { 'unchanged2': ('unchanged', 'unchanged\n'), 'unchangedlink2': ('unchangedlink', 'unchanged'), 'unchangeddir2/f': ('unchangeddir/f', 'unchanged2\n'), 'unchangeddir2/link': ('unchangeddir/link', 'f'), }, - 10: { + '/trunk@11': { 'groupdir2/b': ('groupdir/b', 'b\n'), 'groupdir2/linkb': ('groupdir/linkb', 'b'), }, } for rev in repo: ctx = repo[rev] - copymap = copies.get(rev, {}) + copymap = copies.get(ctx.extra()['convert_revision'][prefixlen:], + {}) for f in ctx.manifest(): cp = ctx[f].renamed() want = copymap.get(f)