# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 2021-04-14 18:32:53
# Node ID 92029a43debb707cc2dbbe7dd0d95d6dbb833f2b
# Parent  6904a9f33b302c9d1cf3625e438cc63e8133d562

perf-discovery: use `get_unique_pull_path`

This performance command now use the new API, unless the benchmarked Mercurial
is older.

Differential Revision: https://phab.mercurial-scm.org/D10423

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -915,7 +915,13 @@ def perfdiscovery(ui, repo, path, **opts
     """benchmark discovery between local repo and the peer at given path"""
     repos = [repo, None]
     timer, fm = gettimer(ui, opts)
-    path = ui.expandpath(path)
+
+    try:
+        from mercurial.utils.urlutil import get_unique_pull_path
+
+        path = get_unique_pull_path(b'perfdiscovery', repo, ui, path)[0]
+    except ImportError:
+        path = ui.expandpath(path)
 
     def s():
         repos[1] = hg.peer(ui, opts, path)