# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1533130666 -7200
#      Wed Aug 01 15:37:46 2018 +0200
# Node ID 4b53bc85964f278108463cac3bc073e36668c7a3
# Parent  b29d146ce714e64110283f09f5c18afeff984397
Add a script to rename reference repos instead of rename cli

diff --git a/launch.sh b/launch.sh
--- a/launch.sh
+++ b/launch.sh
@@ -21,7 +21,7 @@
     ../../repo-scripts/make-partial-repos ../../partial-sets.yaml ../*.benchrepo
 )
 
-rename 's/-reference//' repos/*
+./repo-scripts/rename-reference-directories repos
 
 python create_skip_file.py
 
diff --git a/repo-scripts/rename-reference-directories b/repo-scripts/rename-reference-directories
new file mode 100755
--- /dev/null
+++ b/repo-scripts/rename-reference-directories
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+import sys
+import os
+
+SUFFIX = "-reference"
+
+def main(repo_dir):
+    for file in sorted(os.listdir(repo_dir)):
+        file_path = os.path.join(repo_dir, file)
+        if not os.path.isdir(file_path):
+            continue
+
+        if not file_path.endswith(SUFFIX):
+            continue
+
+        new_dir_path = file_path[:-len(SUFFIX)]
+
+        print("Renaming %s into %s" % (file_path, new_dir_path))
+        os.rename(file_path, new_dir_path)
+
+
+if __name__ == "__main__":
+    main(sys.argv[1])