hgext/largefiles/remotestore.py
author Pierre-Yves David <pierre-yves.david@octobus.net>
Tue, 23 Nov 2021 18:13:33 +0100
changeset 48396 c0d88407b7d4
parent 46907 ffd3e823a7e5
child 48875 6000f5b25c9b
permissions -rw-r--r--
largefile: use the proper "mtime boundary" logic during fixup This will prevent ambiguous cache entry to be used in racy situation. This fix flakiness in test and some real live misbehavior. Differential Revision: https://phab.mercurial-scm.org/D11800
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
     1
# Copyright 2010-2011 Fog Creek Software
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
     2
# Copyright 2010-2011 Unity Technologies
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
     3
#
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
     4
# This software may be used and distributed according to the terms of the
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
     5
# GNU General Public License version 2 or any later version.
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
     6
17425
e95ec38f86b0 fix wording and not-completely-trivial spelling errors and bad docstrings
Mads Kiilerich <mads@kiilerich.com>
parents: 17127
diff changeset
     7
'''remote largefile store; the base class for wirestore'''
29313
0ccab84f9630 py3: make largefiles/remotestore.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 29218
diff changeset
     8
from __future__ import absolute_import
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
     9
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    10
from mercurial.i18n import _
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    11
29313
0ccab84f9630 py3: make largefiles/remotestore.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 29218
diff changeset
    12
from mercurial import (
0ccab84f9630 py3: make largefiles/remotestore.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 29218
diff changeset
    13
    error,
43105
649d3ac37a12 py3: define and use pycompat.iteritems() for hgext/
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43077
diff changeset
    14
    pycompat,
29313
0ccab84f9630 py3: make largefiles/remotestore.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 29218
diff changeset
    15
    util,
0ccab84f9630 py3: make largefiles/remotestore.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 29218
diff changeset
    16
)
0ccab84f9630 py3: make largefiles/remotestore.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 29218
diff changeset
    17
46907
ffd3e823a7e5 urlutil: extract `url` related code from `util` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45942
diff changeset
    18
from mercurial.utils import (
ffd3e823a7e5 urlutil: extract `url` related code from `util` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45942
diff changeset
    19
    stringutil,
ffd3e823a7e5 urlutil: extract `url` related code from `util` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45942
diff changeset
    20
    urlutil,
ffd3e823a7e5 urlutil: extract `url` related code from `util` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45942
diff changeset
    21
)
37084
f0b6fbea00cf stringutil: bulk-replace call sites to point to new module
Yuya Nishihara <yuya@tcha.org>
parents: 36562
diff changeset
    22
29313
0ccab84f9630 py3: make largefiles/remotestore.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 29218
diff changeset
    23
from . import (
0ccab84f9630 py3: make largefiles/remotestore.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 29218
diff changeset
    24
    basestore,
0ccab84f9630 py3: make largefiles/remotestore.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 29218
diff changeset
    25
    lfutil,
0ccab84f9630 py3: make largefiles/remotestore.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 29218
diff changeset
    26
    localstore,
0ccab84f9630 py3: make largefiles/remotestore.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 29218
diff changeset
    27
)
0ccab84f9630 py3: make largefiles/remotestore.py use absolute_import
liscju <piotr.listkiewicz@gmail.com>
parents: 29218
diff changeset
    28
28883
032c4c2f802a pycompat: switch to util.urlreq/util.urlerr for py3 compat
timeless <timeless@mozdev.org>
parents: 28442
diff changeset
    29
urlerr = util.urlerr
032c4c2f802a pycompat: switch to util.urlreq/util.urlerr for py3 compat
timeless <timeless@mozdev.org>
parents: 28442
diff changeset
    30
urlreq = util.urlreq
032c4c2f802a pycompat: switch to util.urlreq/util.urlerr for py3 compat
timeless <timeless@mozdev.org>
parents: 28442
diff changeset
    31
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
    32
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    33
class remotestore(basestore.basestore):
15252
6e809bb4f969 largefiles: improve comments, internal docstrings
Greg Ward <greg@gerg.ca>
parents: 15188
diff changeset
    34
    '''a largefile store accessed over a network'''
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
    35
15168
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
        super(remotestore, self).__init__(ui, repo, url)
35564
cf841f2b5a72 largefiles: add support for 'largefiles://' url scheme
Boris Feld <boris.feld@octobus.net>
parents: 33763
diff changeset
    38
        self._lstore = None
cf841f2b5a72 largefiles: add support for 'largefiles://' url scheme
Boris Feld <boris.feld@octobus.net>
parents: 33763
diff changeset
    39
        if repo is not None:
cf841f2b5a72 largefiles: add support for 'largefiles://' url scheme
Boris Feld <boris.feld@octobus.net>
parents: 33763
diff changeset
    40
            self._lstore = localstore.localstore(self.ui, self.repo, self.repo)
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    41
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    42
    def put(self, source, hash):
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    43
        if self.sendfile(source, hash):
26587
56b2bcea2529 error: get Abort from 'error' instead of 'util'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25660
diff changeset
    44
            raise error.Abort(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
    45
                _(b'remotestore: could not put %s to remote store %s')
46907
ffd3e823a7e5 urlutil: extract `url` related code from `util` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45942
diff changeset
    46
                % (source, urlutil.hidepassword(self.url))
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
    47
            )
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    48
        self.ui.debug(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
    49
            _(b'remotestore: put %s to remote store %s\n')
46907
ffd3e823a7e5 urlutil: extract `url` related code from `util` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45942
diff changeset
    50
            % (source, urlutil.hidepassword(self.url))
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
    51
        )
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    52
17127
9e1616307c4c largefiles: batch statlfile requests when pushing a largefiles repo (issue3386)
Na'Tosha Bard <natosha@unity3d.com>
parents: 15253
diff changeset
    53
    def exists(self, hashes):
44452
9d2b2df2c2ba cleanup: run pyupgrade on our source tree to clean up varying things
Augie Fackler <augie@google.com>
parents: 43105
diff changeset
    54
        return {
9d2b2df2c2ba cleanup: run pyupgrade on our source tree to clean up varying things
Augie Fackler <augie@google.com>
parents: 43105
diff changeset
    55
            h: s == 0
43105
649d3ac37a12 py3: define and use pycompat.iteritems() for hgext/
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43077
diff changeset
    56
            for (h, s) in pycompat.iteritems(
649d3ac37a12 py3: define and use pycompat.iteritems() for hgext/
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43077
diff changeset
    57
                self._stat(hashes)
649d3ac37a12 py3: define and use pycompat.iteritems() for hgext/
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43077
diff changeset
    58
            )  # dict-from-generator
44452
9d2b2df2c2ba cleanup: run pyupgrade on our source tree to clean up varying things
Augie Fackler <augie@google.com>
parents: 43105
diff changeset
    59
        }
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    60
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    61
    def sendfile(self, filename, hash):
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
    62
        self.ui.debug(b'remotestore: sendfile(%s, %s)\n' % (filename, hash))
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    63
        try:
30142
3dcaf1c4e90d largefiles: use context for file closing
Mads Kiilerich <madski@unity3d.com>
parents: 29313
diff changeset
    64
            with lfutil.httpsendfile(self.ui, filename) as fd:
3dcaf1c4e90d largefiles: use context for file closing
Mads Kiilerich <madski@unity3d.com>
parents: 29313
diff changeset
    65
                return self._put(hash, fd)
25660
328739ea70c3 global: mass rewrite to use modern exception syntax
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25079
diff changeset
    66
        except IOError as e:
26587
56b2bcea2529 error: get Abort from 'error' instead of 'util'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25660
diff changeset
    67
            raise error.Abort(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
    68
                _(b'remotestore: could not open file %s: %s')
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
    69
                % (filename, stringutil.forcebytestr(e))
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
    70
            )
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    71
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    72
    def _getfile(self, tmpfile, filename, hash):
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    73
        try:
19004
6614e5e24e66 largefiles: move protocol conversion into getlfile and make it an iterable
Mads Kiilerich <madski@unity3d.com>
parents: 19003
diff changeset
    74
            chunks = self._get(hash)
28883
032c4c2f802a pycompat: switch to util.urlreq/util.urlerr for py3 compat
timeless <timeless@mozdev.org>
parents: 28442
diff changeset
    75
        except urlerr.httperror as e:
26587
56b2bcea2529 error: get Abort from 'error' instead of 'util'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25660
diff changeset
    76
            # 401s get converted to error.Aborts; everything else is fine being
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    77
            # turned into a StoreError
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
    78
            raise basestore.StoreError(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
    79
                filename, hash, self.url, stringutil.forcebytestr(e)
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
    80
            )
28883
032c4c2f802a pycompat: switch to util.urlreq/util.urlerr for py3 compat
timeless <timeless@mozdev.org>
parents: 28442
diff changeset
    81
        except urlerr.urlerror as e:
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    82
            # This usually indicates a connection problem, so don't
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    83
            # keep trying with the other files... they will probably
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    84
            # all fail too.
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
    85
            raise error.Abort(
46907
ffd3e823a7e5 urlutil: extract `url` related code from `util` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45942
diff changeset
    86
                b'%s: %s' % (urlutil.hidepassword(self.url), e.reason)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
    87
            )
25660
328739ea70c3 global: mass rewrite to use modern exception syntax
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25079
diff changeset
    88
        except IOError as e:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
    89
            raise basestore.StoreError(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
    90
                filename, hash, self.url, stringutil.forcebytestr(e)
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
    91
            )
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    92
19004
6614e5e24e66 largefiles: move protocol conversion into getlfile and make it an iterable
Mads Kiilerich <madski@unity3d.com>
parents: 19003
diff changeset
    93
        return lfutil.copyandhash(chunks, tmpfile)
15168
cfccd3bee7b3 hgext: add largefiles extension
various
parents:
diff changeset
    94
29218
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
    95
    def _hashesavailablelocally(self, hashes):
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
    96
        existslocallymap = self._lstore.exists(hashes)
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
    97
        localhashes = [hash for hash in hashes if existslocallymap[hash]]
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
    98
        return localhashes
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
    99
29067
207c0db08953 largefiles: change basestore._verifyfile to take list of files to check
liscju <piotr.listkiewicz@gmail.com>
parents: 28883
diff changeset
   100
    def _verifyfiles(self, contents, filestocheck):
207c0db08953 largefiles: change basestore._verifyfile to take list of files to check
liscju <piotr.listkiewicz@gmail.com>
parents: 28883
diff changeset
   101
        failed = False
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
   102
        expectedhashes = [
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
   103
            expectedhash for cset, filename, expectedhash in filestocheck
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
   104
        ]
29218
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
   105
        localhashes = self._hashesavailablelocally(expectedhashes)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
   106
        stats = self._stat(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
   107
            [
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
   108
                expectedhash
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
   109
                for expectedhash in expectedhashes
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
   110
                if expectedhash not in localhashes
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
   111
            ]
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
   112
        )
29218
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
   113
29067
207c0db08953 largefiles: change basestore._verifyfile to take list of files to check
liscju <piotr.listkiewicz@gmail.com>
parents: 28883
diff changeset
   114
        for cset, filename, expectedhash in filestocheck:
29218
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
   115
            if expectedhash in localhashes:
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
   116
                filetocheck = (cset, filename, expectedhash)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
   117
                verifyresult = self._lstore._verifyfiles(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
   118
                    contents, [filetocheck]
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
   119
                )
29218
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
   120
                if verifyresult:
29067
207c0db08953 largefiles: change basestore._verifyfile to take list of files to check
liscju <piotr.listkiewicz@gmail.com>
parents: 28883
diff changeset
   121
                    failed = True
29218
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
   122
            else:
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
   123
                stat = stats[expectedhash]
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
   124
                if stat:
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
   125
                    if stat == 1:
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
   126
                        self.ui.warn(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   127
                            _(b'changeset %s: %s: contents differ\n')
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
   128
                            % (cset, filename)
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
   129
                        )
29218
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
   130
                        failed = True
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
   131
                    elif stat == 2:
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
   132
                        self.ui.warn(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   133
                            _(b'changeset %s: %s missing\n') % (cset, filename)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
   134
                        )
29218
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
   135
                        failed = True
fd288d118074 largefiles: send statlfile remote calls only for nonexisting locally files
liscju <piotr.listkiewicz@gmail.com>
parents: 29068
diff changeset
   136
                    else:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
   137
                        raise RuntimeError(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   138
                            b'verify failed: unexpected response '
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   139
                            b'from statlfile (%r)' % stat
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37084
diff changeset
   140
                        )
29067
207c0db08953 largefiles: change basestore._verifyfile to take list of files to check
liscju <piotr.listkiewicz@gmail.com>
parents: 28883
diff changeset
   141
        return failed
17127
9e1616307c4c largefiles: batch statlfile requests when pushing a largefiles repo (issue3386)
Na'Tosha Bard <natosha@unity3d.com>
parents: 15253
diff changeset
   142
28442
3be2e89c5d9f largefiles: add abstract methods in remotestore class
liscju <piotr.listkiewicz@gmail.com>
parents: 26587
diff changeset
   143
    def _put(self, hash, fd):
3be2e89c5d9f largefiles: add abstract methods in remotestore class
liscju <piotr.listkiewicz@gmail.com>
parents: 26587
diff changeset
   144
        '''Put file with the given hash in the remote store.'''
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   145
        raise NotImplementedError(b'abstract method')
28442
3be2e89c5d9f largefiles: add abstract methods in remotestore class
liscju <piotr.listkiewicz@gmail.com>
parents: 26587
diff changeset
   146
3be2e89c5d9f largefiles: add abstract methods in remotestore class
liscju <piotr.listkiewicz@gmail.com>
parents: 26587
diff changeset
   147
    def _get(self, hash):
30180
736f92c44656 largefiles: always use filechunkiter when iterating files
Mads Kiilerich <madski@unity3d.com>
parents: 30142
diff changeset
   148
        '''Get a iterator for content with the given hash.'''
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   149
        raise NotImplementedError(b'abstract method')
28442
3be2e89c5d9f largefiles: add abstract methods in remotestore class
liscju <piotr.listkiewicz@gmail.com>
parents: 26587
diff changeset
   150
3be2e89c5d9f largefiles: add abstract methods in remotestore class
liscju <piotr.listkiewicz@gmail.com>
parents: 26587
diff changeset
   151
    def _stat(self, hashes):
45942
89a2afe31e82 formating: upgrade to black 20.8b1
Augie Fackler <raf@durin42.com>
parents: 44452
diff changeset
   152
        """Get information about availability of files specified by
28442
3be2e89c5d9f largefiles: add abstract methods in remotestore class
liscju <piotr.listkiewicz@gmail.com>
parents: 26587
diff changeset
   153
        hashes in the remote store. Return dictionary mapping hashes
3be2e89c5d9f largefiles: add abstract methods in remotestore class
liscju <piotr.listkiewicz@gmail.com>
parents: 26587
diff changeset
   154
        to return code where 0 means that file is available, other
45942
89a2afe31e82 formating: upgrade to black 20.8b1
Augie Fackler <raf@durin42.com>
parents: 44452
diff changeset
   155
        values if not."""
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
   156
        raise NotImplementedError(b'abstract method')