# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1556464723 -7200
#      Sun Apr 28 17:18:43 2019 +0200
# Node ID d2b101bafc33fa5df3b353c957c842bef67d6340
# Parent  dbceefc6ee37aed81436a30f41715c8a2a8135d5
make-reference: include the roles section in the benchrepo

The roles are important we should include them in order to be able to use them.

diff --git a/repo-scripts/make-reference b/repo-scripts/make-reference
--- a/repo-scripts/make-reference
+++ b/repo-scripts/make-reference
@@ -145,6 +145,8 @@
     contents = read_yaml(partial_sets_file_path)
 
     data["partial-sets"] = contents["partial-sets"]
+    if "roles" in contents:
+        data["roles"] = contents["roles"]
 
     # Write data to the benchrepo file
     with open(repo_details, "w") as repo_details_file:
diff --git a/tests/test-find-asv-variants.t b/tests/test-find-asv-variants.t
--- a/tests/test-find-asv-variants.t
+++ b/tests/test-find-asv-variants.t
@@ -98,6 +98,12 @@
     repo-hash: 2b380e39
     repo-prefix: my-reference-I-2b380e39
     source: some-dir/my-source-repo
+  roles:
+    pull:
+      noop:
+        same:
+          source: reference
+          target: same
 
   $ cat my-reference-I-d9c2fe76.benchrepo
   partial-sets:
@@ -128,6 +134,12 @@
     repo-hash: d9c2fe76
     repo-prefix: my-reference-I-d9c2fe76
     source: some-dir/my-source-repo
+  roles:
+    pull:
+      noop:
+        same:
+          source: reference
+          target: same
 
 Call the function to get the ASV variants
 -----------------------------------------
@@ -171,7 +183,9 @@
                                                                         'visible': 53},
                                                    'repo-hash': '2b380e39',
                                                    'repo-prefix': 'my-reference-I-2b380e39',
-                                                   'source': 'some-dir/my-source-repo'}},
+                                                   'source': 'some-dir/my-source-repo'},
+                                'roles': {'pull': {'noop': {'same': {'source': 'reference',
+                                                                     'target': 'same'}}}}},
     'my-reference-I-d9c2fe76': {'partial-sets': {'missing-last-10': {'remove': 'last(all(), 10)'},
                                                  'same': None},
                                 'reference-repo': {'enabled': True,
@@ -192,7 +206,9 @@
                                                                         'visible': 53},
                                                    'repo-hash': 'd9c2fe76',
                                                    'repo-prefix': 'my-reference-I-d9c2fe76',
-                                                   'source': 'some-dir/my-source-repo'}}},
+                                                   'source': 'some-dir/my-source-repo'},
+                                'roles': {'pull': {'noop': {'same': {'source': 'reference',
+                                                                     'target': 'same'}}}}}},
    {('my-reference-I', (('repo-format-compression', 'zlib'), ('repo-format-compression-level', 'default'), ('repo-format-dotencode', True), ('repo-format-fncache', True), ('repo-format-generaldelta', False), ('repo-format-plain-cl-delta', True), ('repo-format-sparserevlog', False))): 'my-reference-I-2b380e39',
     ('my-reference-I', (('repo-format-compression', 'zlib'), ('repo-format-compression-level', 'default'), ('repo-format-dotencode', True), ('repo-format-fncache', True), ('repo-format-generaldelta', True), ('repo-format-plain-cl-delta', True), ('repo-format-sparserevlog', False))): 'my-reference-I-d9c2fe76'},
    ['missing-last-10', 'same'])
diff --git a/tests/test-make-reference.t b/tests/test-make-reference.t
--- a/tests/test-make-reference.t
+++ b/tests/test-make-reference.t
@@ -94,6 +94,12 @@
     repo-hash: 0c229866
     repo-prefix: my-reference-0c229866
     source: some-dir/my-source-repo
+  roles:
+    pull:
+      noop:
+        same:
+          source: reference
+          target: same
 
 Call with existing data
 -----------------
@@ -147,6 +153,12 @@
     repo-hash: 0c229866
     repo-prefix: my-reference-0c229866
     source: some-dir/my-source-repo
+  roles:
+    pull:
+      noop:
+        same:
+          source: reference
+          target: same
   $ tar tf my-reference-*-reference.tar | sort
   my-reference-0c229866-reference/
   my-reference-0c229866-reference/.hg/
@@ -262,6 +274,12 @@
     repo-hash: 0c229866
     repo-prefix: my-reference-0c229866
     source: some-dir/my-source-repo
+  roles:
+    pull:
+      noop:
+        same:
+          source: reference
+          target: same
   $ cat << EOF > editor.sh
   > #!/bin/bash
   > sed -i 's,some-dir/my-source-repo,some-dir/my-other-source-repo,' \$1
@@ -302,6 +320,12 @@
     repo-hash: 0c229866
     repo-prefix: my-reference-0c229866
     source: some-dir/my-other-source-repo
+  roles:
+    pull:
+      noop:
+        same:
+          source: reference
+          target: same
   $ cd ..
 
 Call from scratch with explicit optimization
@@ -359,6 +383,12 @@
     repo-hash: 0c229866
     repo-prefix: my-reference-0c229866
     source: some-dir/my-source-repo
+  roles:
+    pull:
+      noop:
+        same:
+          source: reference
+          target: same
 
 Call from scratch with given hgrc file
 --------------------------------------
@@ -429,3 +459,9 @@
     repo-hash: 8e2c7069
     repo-prefix: my-reference-8e2c7069
     source: some-dir/my-source-repo
+  roles:
+    pull:
+      noop:
+        same:
+          source: reference
+          target: same