diff tests/test_fetch_renames.py @ 1485:6088597abd20 stable

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.
author Augie Fackler <raf@durin42.com>
date Sun, 26 Jun 2016 20:28:34 -0400
parents 9f1fa3cc6ba5
children
line wrap: on
line diff
--- 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)