Patchwork D10413: lfs: use the new APIs

login
register
mail settings
Submitter phabricator
Date April 14, 2021, 11:38 p.m.
Message ID <differential-rev-PHID-DREV-zt2e2acqylcl7vamdv5j-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48730/
State Superseded
Headers show

Comments

phabricator - April 14, 2021, 11:38 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The part of the lfs store that requires a destination cannot operate on multiple destination (yet). So we move them to the dedicated APIs.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10413

AFFECTED FILES
  hgext/largefiles/storefactory.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/hgext/largefiles/storefactory.py b/hgext/largefiles/storefactory.py
--- a/hgext/largefiles/storefactory.py
+++ b/hgext/largefiles/storefactory.py
@@ -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.
         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