hgext/largefiles/storefactory.py
changeset 43076 2372284d9457
parent 41365 876494fd967d
child 43077 687b865b95ad
equal deleted inserted replaced
43075:57875cf423c9 43076:2372284d9457
    51     # The path could be a scheme so use Mercurial's normal functionality
    51     # The path could be a scheme so use Mercurial's normal functionality
    52     # to resolve the scheme to a repository and use its path
    52     # to resolve the scheme to a repository and use its path
    53     path = util.safehasattr(remote, 'url') and remote.url() or remote.path
    53     path = util.safehasattr(remote, 'url') and remote.url() or remote.path
    54 
    54 
    55     match = _scheme_re.match(path)
    55     match = _scheme_re.match(path)
    56     if not match:                       # regular filesystem path
    56     if not match:  # regular filesystem path
    57         scheme = 'file'
    57         scheme = 'file'
    58     else:
    58     else:
    59         scheme = match.group(1)
    59         scheme = match.group(1)
    60 
    60 
    61     try:
    61     try:
    67         try:
    67         try:
    68             return classobj(ui, repo, remote)
    68             return classobj(ui, repo, remote)
    69         except lfutil.storeprotonotcapable:
    69         except lfutil.storeprotonotcapable:
    70             pass
    70             pass
    71 
    71 
    72     raise error.Abort(_('%s does not appear to be a largefile store') %
    72     raise error.Abort(
    73                      util.hidepassword(path))
    73         _('%s does not appear to be a largefile store')
       
    74         % util.hidepassword(path)
       
    75     )
       
    76 
    74 
    77 
    75 _storeprovider = {
    78 _storeprovider = {
    76     'file':  [localstore.localstore],
    79     'file': [localstore.localstore],
    77     'http':  [wirestore.wirestore],
    80     'http': [wirestore.wirestore],
    78     'https': [wirestore.wirestore],
    81     'https': [wirestore.wirestore],
    79     'ssh': [wirestore.wirestore],
    82     'ssh': [wirestore.wirestore],
    80     }
    83 }
    81 
    84 
    82 _scheme_re = re.compile(br'^([a-zA-Z0-9+-.]+)://')
    85 _scheme_re = re.compile(br'^([a-zA-Z0-9+-.]+)://')
    83 
    86 
       
    87 
    84 def getlfile(ui, hash):
    88 def getlfile(ui, hash):
    85     return util.chunkbuffer(openstore(ui=ui)._get(hash))
    89     return util.chunkbuffer(openstore(ui=ui)._get(hash))