changeset 46947:3f29765e0d95

lfs: use the new APIs The part of the lfs store that requires a destination cannot operate on multiple destination (yet). So we move them to the dedicated APIs. Differential Revision: https://phab.mercurial-scm.org/D10413
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 14 Apr 2021 14:35:13 +0200
parents b6b696442a4d
children 946db89607c8
files hgext/largefiles/storefactory.py
diffstat 1 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/storefactory.py	Wed Apr 14 13:06:09 2021 +0200
+++ b/hgext/largefiles/storefactory.py	Wed Apr 14 14:35:13 2021 +0200
@@ -22,6 +22,7 @@
     wirestore,
 )
 
+
 # During clone this function is passed the src's ui object
 # but it needs the dest's ui object so it can read out of
 # the config file. Use repo.ui instead.
@@ -31,19 +32,22 @@
 
     if not remote:
         lfpullsource = getattr(repo, 'lfpullsource', None)
-        if lfpullsource:
-            path = ui.expandpath(lfpullsource)
-        elif put:
-            path = ui.expandpath(b'default-push', b'default')
+        if put:
+            path = urlutil.get_unique_push_path(
+                b'lfpullsource', repo, ui, lfpullsource
+            )
         else:
-            path = ui.expandpath(b'default')
+            path, _branches = urlutil.get_unique_pull_path(
+                b'lfpullsource', repo, ui, lfpullsource
+            )
 
-        # ui.expandpath() leaves 'default-push' and 'default' alone if
-        # they cannot be expanded: fallback to the empty string,
-        # meaning the current directory.
+        # XXX we should not explicitly pass b'default', as this will result in
+        # b'default' being returned if no `paths.default` was defined. We
+        # should explicitely handle the lack of value instead.
         if repo is None:
-            path = ui.expandpath(b'default')
-            path, _branches = urlutil.parseurl(path)
+            path, _branches = urlutil.get_unique_pull_path(
+                b'lfs', repo, ui, b'default'
+            )
             remote = hg.peer(repo or ui, {}, path)
         elif path == b'default-push' or path == b'default':
             remote = repo