hgext/largefiles/storefactory.py
changeset 46947 3f29765e0d95
parent 46908 4452cb788404
child 48875 6000f5b25c9b
equal deleted inserted replaced
46946:b6b696442a4d 46947:3f29765e0d95
    20     lfutil,
    20     lfutil,
    21     localstore,
    21     localstore,
    22     wirestore,
    22     wirestore,
    23 )
    23 )
    24 
    24 
       
    25 
    25 # During clone this function is passed the src's ui object
    26 # During clone this function is passed the src's ui object
    26 # but it needs the dest's ui object so it can read out of
    27 # but it needs the dest's ui object so it can read out of
    27 # the config file. Use repo.ui instead.
    28 # the config file. Use repo.ui instead.
    28 def openstore(repo=None, remote=None, put=False, ui=None):
    29 def openstore(repo=None, remote=None, put=False, ui=None):
    29     if ui is None:
    30     if ui is None:
    30         ui = repo.ui
    31         ui = repo.ui
    31 
    32 
    32     if not remote:
    33     if not remote:
    33         lfpullsource = getattr(repo, 'lfpullsource', None)
    34         lfpullsource = getattr(repo, 'lfpullsource', None)
    34         if lfpullsource:
    35         if put:
    35             path = ui.expandpath(lfpullsource)
    36             path = urlutil.get_unique_push_path(
    36         elif put:
    37                 b'lfpullsource', repo, ui, lfpullsource
    37             path = ui.expandpath(b'default-push', b'default')
    38             )
    38         else:
    39         else:
    39             path = ui.expandpath(b'default')
    40             path, _branches = urlutil.get_unique_pull_path(
       
    41                 b'lfpullsource', repo, ui, lfpullsource
       
    42             )
    40 
    43 
    41         # ui.expandpath() leaves 'default-push' and 'default' alone if
    44         # XXX we should not explicitly pass b'default', as this will result in
    42         # they cannot be expanded: fallback to the empty string,
    45         # b'default' being returned if no `paths.default` was defined. We
    43         # meaning the current directory.
    46         # should explicitely handle the lack of value instead.
    44         if repo is None:
    47         if repo is None:
    45             path = ui.expandpath(b'default')
    48             path, _branches = urlutil.get_unique_pull_path(
    46             path, _branches = urlutil.parseurl(path)
    49                 b'lfs', repo, ui, b'default'
       
    50             )
    47             remote = hg.peer(repo or ui, {}, path)
    51             remote = hg.peer(repo or ui, {}, path)
    48         elif path == b'default-push' or path == b'default':
    52         elif path == b'default-push' or path == b'default':
    49             remote = repo
    53             remote = repo
    50         else:
    54         else:
    51             path, _branches = urlutil.parseurl(path)
    55             path, _branches = urlutil.parseurl(path)