コード例 #1
0
    def _verifyfile(self, cctx, cset, contents, standin, verified):
        filename = lfutil.splitstandin(standin)
        if not filename:
            return False
        fctx = cctx[standin]
        key = (filename, fctx.filenode())
        if key in verified:
            return False

        expecthash = fctx.data()[0:40]
        verified.add(key)
        if not lfutil.instore(self.remote, expecthash):
            self.ui.warn(
                _('changeset %s: %s missing\n'
                  '  (looked for hash %s)\n') % (cset, filename, expecthash))
            return True  # failed

        if contents:
            storepath = lfutil.storepath(self.remote, expecthash)
            actualhash = lfutil.hashfile(storepath)
            if actualhash != expecthash:
                self.ui.warn(
                    _('changeset %s: %s: contents differ\n'
                      '  (%s:\n'
                      '  expected hash %s,\n'
                      '  but got %s)\n') %
                    (cset, filename, storepath, expecthash, actualhash))
                return True  # failed
        return False
コード例 #2
0
    def _verifyfile(self, cctx, cset, contents, standin, verified):
        filename = lfutil.splitstandin(standin)
        if not filename:
            return False
        fctx = cctx[standin]
        key = (filename, fctx.filenode())
        if key in verified:
            return False

        expecthash = fctx.data()[0:40]
        verified.add(key)
        if not lfutil.instore(self.remote, expecthash):
            self.ui.warn(
                _('changeset %s: %s missing\n'
                  '  (looked for hash %s)\n')
                % (cset, filename, expecthash))
            return True                 # failed

        if contents:
            storepath = lfutil.storepath(self.remote, expecthash)
            actualhash = lfutil.hashfile(storepath)
            if actualhash != expecthash:
                self.ui.warn(
                    _('changeset %s: %s: contents differ\n'
                      '  (%s:\n'
                      '  expected hash %s,\n'
                      '  but got %s)\n')
                    % (cset, filename, storepath, expecthash, actualhash))
                return True             # failed
        return False
コード例 #3
0
    def _verifyfile(self, cctx, cset, contents, standin, verified):
        filename = lfutil.splitstandin(standin)
        if not filename:
            return False
        fctx = cctx[standin]
        key = (filename, fctx.filenode())
        if key in verified:
            return False

        expecthash = fctx.data()[0:40]
        storepath = lfutil.storepath(self.remote, expecthash)
        verified.add(key)
        if not lfutil.instore(self.remote, expecthash):
            self.ui.warn(
                _('changeset %s: %s references missing %s\n') %
                (cset, filename, storepath))
            return True  # failed

        if contents:
            actualhash = lfutil.hashfile(storepath)
            if actualhash != expecthash:
                self.ui.warn(
                    _('changeset %s: %s references corrupted %s\n') %
                    (cset, filename, storepath))
                return True  # failed
        return False
コード例 #4
0
    def _verifyfile(self, cctx, cset, contents, standin, verified):
        filename = lfutil.splitstandin(standin)
        if not filename:
            return False
        fctx = cctx[standin]
        key = (filename, fctx.filenode())
        if key in verified:
            return False

        expecthash = fctx.data()[0:40]
        storepath = lfutil.storepath(self.remote, expecthash)
        verified.add(key)
        if not lfutil.instore(self.remote, expecthash):
            self.ui.warn(
                _('changeset %s: %s references missing %s\n')
                % (cset, filename, storepath))
            return True                 # failed

        if contents:
            actualhash = lfutil.hashfile(storepath)
            if actualhash != expecthash:
                self.ui.warn(
                    _('changeset %s: %s references corrupted %s\n')
                    % (cset, filename, storepath))
                return True             # failed
        return False
コード例 #5
0
 def _getfile(self, tmpfile, filename, hash):
     if lfutil.instore(self.remote, hash):
         path = lfutil.storepath(self.remote, hash)
     elif lfutil.inusercache(self.ui, hash):
         path = lfutil.usercachepath(self.ui, hash)
     else:
         raise basestore.StoreError(filename, hash, '',
                                    _("Can't get file locally"))
     fd = open(path, 'rb')
     try:
         return lfutil.copyandhash(fd, tmpfile)
     finally:
         fd.close()
コード例 #6
0
 def _getfile(self, tmpfile, filename, hash):
     if lfutil.instore(self.remote, hash):
         path = lfutil.storepath(self.remote, hash)
     elif lfutil.inusercache(self.ui, hash):
         path = lfutil.usercachepath(self.ui, hash)
     else:
         raise basestore.StoreError(filename, hash, '',
             _("Can't get file locally"))
     fd = open(path, 'rb')
     try:
         return lfutil.copyandhash(fd, tmpfile)
     finally:
         fd.close()
コード例 #7
0
 def exists(self, hashes):
     retval = {}
     for hash in hashes:
         retval[hash] = lfutil.instore(self.remote, hash)
     return retval
コード例 #8
0
 def put(self, source, hash):
     if lfutil.instore(self.remote, hash):
         return
     lfutil.link(source, lfutil.storepath(self.remote, hash))
コード例 #9
0
 def exists(self, hash):
     return lfutil.instore(self.remote, hash)
コード例 #10
0
 def put(self, source, hash):
     util.makedirs(os.path.dirname(lfutil.storepath(self.remote, hash)))
     if lfutil.instore(self.remote, hash):
         return
     lfutil.link(lfutil.storepath(self.repo, hash),
                 lfutil.storepath(self.remote, hash))
コード例 #11
0
 def exists(self, hash):
     return lfutil.instore(self.remote, hash)
コード例 #12
0
 def put(self, source, hash):
     util.makedirs(os.path.dirname(lfutil.storepath(self.remote, hash)))
     if lfutil.instore(self.remote, hash):
         return
     lfutil.link(lfutil.storepath(self.repo, hash),
             lfutil.storepath(self.remote, hash))