hgext/largefiles/basestore.py
author Mads Kiilerich <madski@unity3d.com>
Mon, 28 Jan 2013 15:19:44 +0100
branchstable
changeset 18483 ce5f529deb36
parent 18461 abfbb04fab8e
child 18486 1067a6240f86
permissions -rw-r--r--
largefiles: don't allow corruption to propagate after detection basestore.get uses util.atomictempfile when checking and receiving a new largefile ... but the close/discard logic was too clever for largefiles. Largefiles relied on being able to discard the file and thus prevent it from being written to the store. That was however too brittle. lfutil.copyandhash closes the infile after writing to it ... with a 'blecch' comment. The discard was thus a silent noop, and as a result of that corruption would be detected ... and then the corrupted files would be used anyway. Instead we now use a tmp file and rename or unlink it after validating it. A better solution should be implemented ... but not now.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
     1
# Copyright 2009-2010 Gregory P. Ward
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
     2
# Copyright 2009-2010 Intelerad Medical Systems Incorporated
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
     3
# Copyright 2010-2011 Fog Creek Software
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
     4
# Copyright 2010-2011 Unity Technologies
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
     5
#
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
     6
# This software may be used and distributed according to the terms of the
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
     7
# GNU General Public License version 2 or any later version.
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
     8
15252
6e809bb4f969 largefiles: improve comments, internal docstrings
Greg Ward <greg@gerg.ca>
parents: 15169
diff changeset
     9
'''base class for store implementations and store-related utility code'''
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    10
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    11
import binascii
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    12
import re
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    13
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    14
from mercurial import util, node, hg
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    15
from mercurial.i18n import _
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    16
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    17
import lfutil
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    18
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    19
class StoreError(Exception):
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    20
    '''Raised when there is a problem getting files from or putting
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    21
    files to a central store.'''
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    22
    def __init__(self, filename, hash, url, detail):
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    23
        self.filename = filename
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    24
        self.hash = hash
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    25
        self.url = url
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    26
        self.detail = detail
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    27
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    28
    def longmessage(self):
18461
abfbb04fab8e largefiles: enhance error message to make it more i18n-friendly
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 18155
diff changeset
    29
        return (_("error getting id %s from url %s for file %s: %s\n") %
18155
5206af8894a3 largefiles: cleanup of warnings on errors getting largefiles
Mads Kiilerich <madski@unity3d.com>
parents: 17424
diff changeset
    30
                 (self.hash, self.url, self.filename, self.detail))
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    31
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    32
    def __str__(self):
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    33
        return "%s: %s" % (self.url, self.detail)
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    34
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    35
class basestore(object):
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    36
    def __init__(self, ui, repo, url):
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    37
        self.ui = ui
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    38
        self.repo = repo
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    39
        self.url = url
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    40
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    41
    def put(self, source, hash):
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    42
        '''Put source file into the store under <filename>/<hash>.'''
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    43
        raise NotImplementedError('abstract method')
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    44
17127
9e1616307c4c largefiles: batch statlfile requests when pushing a largefiles repo (issue3386)
Na'Tosha Bard <natosha@unity3d.com>
parents: 16247
diff changeset
    45
    def exists(self, hashes):
9e1616307c4c largefiles: batch statlfile requests when pushing a largefiles repo (issue3386)
Na'Tosha Bard <natosha@unity3d.com>
parents: 16247
diff changeset
    46
        '''Check to see if the store contains the given hashes.'''
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    47
        raise NotImplementedError('abstract method')
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    48
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    49
    def get(self, files):
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    50
        '''Get the specified largefiles from the store and write to local
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    51
        files under repo.root.  files is a list of (filename, hash)
17424
e7cfe3587ea4 fix trivial spelling errors
Mads Kiilerich <mads@kiilerich.com>
parents: 17127
diff changeset
    52
        tuples.  Return (success, missing), lists of files successfully
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    53
        downloaded and those not found in the store.  success is a list
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    54
        of (filename, hash) tuples; missing is a list of filenames that
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    55
        we could not get.  (The detailed error message will already have
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    56
        been presented to the user, so missing is just supplied as a
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    57
        summary.)'''
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    58
        success = []
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    59
        missing = []
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    60
        ui = self.ui
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    61
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    62
        at = 0
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    63
        for filename, hash in files:
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    64
            ui.progress(_('getting largefiles'), at, unit='lfile',
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    65
                total=len(files))
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    66
            at += 1
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    67
            ui.note(_('getting %s:%s\n') % (filename, hash))
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    68
15316
c65f5b6e26d4 largefiles: rename functions and methods to match desired behavior
Benjamin Pollack <benjamin@bitquabit.com>
parents: 15302
diff changeset
    69
            storefilename = lfutil.storepath(self.repo, hash)
18483
ce5f529deb36 largefiles: don't allow corruption to propagate after detection
Mads Kiilerich <madski@unity3d.com>
parents: 18461
diff changeset
    70
            tmpfile = util.atomictempfile(storefilename + '.tmp',
16154
9b072a5f8f92 largefiles: respect store.createmode in basestore.get
Martin Geisler <mg@aragost.com>
parents: 15943
diff changeset
    71
                                          createmode=self.repo.store.createmode)
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    72
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    73
            try:
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    74
                hhash = binascii.hexlify(self._getfile(tmpfile, filename, hash))
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    75
            except StoreError, err:
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    76
                ui.warn(err.longmessage())
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    77
                hhash = ""
18483
ce5f529deb36 largefiles: don't allow corruption to propagate after detection
Mads Kiilerich <madski@unity3d.com>
parents: 18461
diff changeset
    78
            tmpfile.close() # has probably already been closed!
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    79
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    80
            if hhash != hash:
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    81
                if hhash != "":
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    82
                    ui.warn(_('%s: data corruption (expected %s, got %s)\n')
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    83
                            % (filename, hash, hhash))
18483
ce5f529deb36 largefiles: don't allow corruption to propagate after detection
Mads Kiilerich <madski@unity3d.com>
parents: 18461
diff changeset
    84
                util.unlink(storefilename + '.tmp')
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    85
                missing.append(filename)
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    86
                continue
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    87
18483
ce5f529deb36 largefiles: don't allow corruption to propagate after detection
Mads Kiilerich <madski@unity3d.com>
parents: 18461
diff changeset
    88
            util.rename(storefilename + '.tmp', storefilename)
15316
c65f5b6e26d4 largefiles: rename functions and methods to match desired behavior
Benjamin Pollack <benjamin@bitquabit.com>
parents: 15302
diff changeset
    89
            lfutil.linktousercache(self.repo, hash)
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    90
            success.append((filename, hhash))
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    91
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    92
        ui.progress(_('getting largefiles'), None)
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    93
        return (success, missing)
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    94
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    95
    def verify(self, revs, contents=False):
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    96
        '''Verify the existence (and, optionally, contents) of every big
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    97
        file revision referenced by every changeset in revs.
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    98
        Return 0 if all is well, non-zero on any errors.'''
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    99
        write = self.ui.write
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   100
        failed = False
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   101
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   102
        write(_('searching %d changesets for largefiles\n') % len(revs))
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   103
        verified = set()                # set of (filename, filenode) tuples
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   104
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   105
        for rev in revs:
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   106
            cctx = self.repo[rev]
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   107
            cset = "%d:%s" % (cctx.rev(), node.short(cctx.node()))
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   108
15319
9da7e96cd5c2 largefiles: remove redundant any_ function
Benjamin Pollack <benjamin@bitquabit.com>
parents: 15316
diff changeset
   109
            failed = util.any(self._verifyfile(
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   110
                cctx, cset, contents, standin, verified) for standin in cctx)
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   111
16247
d87d9d8a8e03 largefiles: remove use of underscores that breaks coding convention
Na'Tosha Bard <natosha@unity3d.com>
parents: 16154
diff changeset
   112
        numrevs = len(verified)
d87d9d8a8e03 largefiles: remove use of underscores that breaks coding convention
Na'Tosha Bard <natosha@unity3d.com>
parents: 16154
diff changeset
   113
        numlfiles = len(set([fname for (fname, fnode) in verified]))
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   114
        if contents:
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   115
            write(_('verified contents of %d revisions of %d largefiles\n')
16247
d87d9d8a8e03 largefiles: remove use of underscores that breaks coding convention
Na'Tosha Bard <natosha@unity3d.com>
parents: 16154
diff changeset
   116
                  % (numrevs, numlfiles))
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   117
        else:
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   118
            write(_('verified existence of %d revisions of %d largefiles\n')
16247
d87d9d8a8e03 largefiles: remove use of underscores that breaks coding convention
Na'Tosha Bard <natosha@unity3d.com>
parents: 16154
diff changeset
   119
                  % (numrevs, numlfiles))
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   120
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   121
        return int(failed)
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   122
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   123
    def _getfile(self, tmpfile, filename, hash):
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   124
        '''Fetch one revision of one file from the store and write it
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   125
        to tmpfile.  Compute the hash of the file on-the-fly as it
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   126
        downloads and return the binary hash.  Close tmpfile.  Raise
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   127
        StoreError if unable to download the file (e.g. it does not
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   128
        exist in the store).'''
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   129
        raise NotImplementedError('abstract method')
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   130
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   131
    def _verifyfile(self, cctx, cset, contents, standin, verified):
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   132
        '''Perform the actual verification of a file in the store.
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   133
        '''
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   134
        raise NotImplementedError('abstract method')
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   135
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   136
import localstore, wirestore
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   137
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   138
_storeprovider = {
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   139
    'file':  [localstore.localstore],
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   140
    'http':  [wirestore.wirestore],
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   141
    'https': [wirestore.wirestore],
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   142
    'ssh': [wirestore.wirestore],
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   143
    }
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   144
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   145
_scheme_re = re.compile(r'^([a-zA-Z0-9+-.]+)://')
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   146
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   147
# During clone this function is passed the src's ui object
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   148
# but it needs the dest's ui object so it can read out of
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   149
# the config file. Use repo.ui instead.
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   150
def _openstore(repo, remote=None, put=False):
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   151
    ui = repo.ui
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   152
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   153
    if not remote:
15943
f9efb325ea32 largefiles: fix caching largefiles from an aliased repo (issue3212)
Na'Tosha Bard <natosha@unity3d.com>
parents: 15319
diff changeset
   154
        lfpullsource = getattr(repo, 'lfpullsource', None)
f9efb325ea32 largefiles: fix caching largefiles from an aliased repo (issue3212)
Na'Tosha Bard <natosha@unity3d.com>
parents: 15319
diff changeset
   155
        if lfpullsource:
f9efb325ea32 largefiles: fix caching largefiles from an aliased repo (issue3212)
Na'Tosha Bard <natosha@unity3d.com>
parents: 15319
diff changeset
   156
            path = ui.expandpath(lfpullsource)
f9efb325ea32 largefiles: fix caching largefiles from an aliased repo (issue3212)
Na'Tosha Bard <natosha@unity3d.com>
parents: 15319
diff changeset
   157
        else:
f9efb325ea32 largefiles: fix caching largefiles from an aliased repo (issue3212)
Na'Tosha Bard <natosha@unity3d.com>
parents: 15319
diff changeset
   158
            path = ui.expandpath('default-push', 'default')
15252
6e809bb4f969 largefiles: improve comments, internal docstrings
Greg Ward <greg@gerg.ca>
parents: 15169
diff changeset
   159
6e809bb4f969 largefiles: improve comments, internal docstrings
Greg Ward <greg@gerg.ca>
parents: 15169
diff changeset
   160
        # ui.expandpath() leaves 'default-push' and 'default' alone if
6e809bb4f969 largefiles: improve comments, internal docstrings
Greg Ward <greg@gerg.ca>
parents: 15169
diff changeset
   161
        # they cannot be expanded: fallback to the empty string,
6e809bb4f969 largefiles: improve comments, internal docstrings
Greg Ward <greg@gerg.ca>
parents: 15169
diff changeset
   162
        # meaning the current directory.
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   163
        if path == 'default-push' or path == 'default':
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   164
            path = ''
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   165
            remote = repo
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   166
        else:
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   167
            remote = hg.peer(repo, {}, path)
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   169
    # The path could be a scheme so use Mercurial's normal functionality
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   170
    # to resolve the scheme to a repository and use its path
15169
aa262fff87ac largefile: fix up hasattr usage
Matt Mackall <mpm@selenic.com>
parents: 15168
diff changeset
   171
    path = util.safehasattr(remote, 'url') and remote.url() or remote.path
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   172
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   173
    match = _scheme_re.match(path)
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   174
    if not match:                       # regular filesystem path
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   175
        scheme = 'file'
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   176
    else:
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   177
        scheme = match.group(1)
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   178
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   179
    try:
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   180
        storeproviders = _storeprovider[scheme]
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   181
    except KeyError:
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   182
        raise util.Abort(_('unsupported URL scheme %r') % scheme)
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   183
16247
d87d9d8a8e03 largefiles: remove use of underscores that breaks coding convention
Na'Tosha Bard <natosha@unity3d.com>
parents: 16154
diff changeset
   184
    for classobj in storeproviders:
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   185
        try:
16247
d87d9d8a8e03 largefiles: remove use of underscores that breaks coding convention
Na'Tosha Bard <natosha@unity3d.com>
parents: 16154
diff changeset
   186
            return classobj(ui, repo, remote)
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   187
        except lfutil.storeprotonotcapable:
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   188
            pass
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
   189
15302
225d30bacabd largefiles: string formatting typo in basestore._openstore where comma is used instead of modulo
Hao Lian <hao@fogcreek.com>
parents: 15255
diff changeset
   190
    raise util.Abort(_('%s does not appear to be a largefile store') % path)