示例#1
0
    def Stat(self, path):
        '''Stats |path| returning its version as as StatInfo object. If |path| ends
    with a '/', it is assumed to be a directory and the StatInfo object returned
    includes child_versions for all paths in the directory.

    File paths do not include the name of the zip file, which is arbitrary and
    useless to consumers.

    Because the repository will only be downloaded once per server version, all
    stat versions are always 0.
    '''
        self._EnsureRepoZip()
        repo_zip = self._repo_zip.Get()

        if path not in repo_zip.Paths():
            raise FileNotFoundError(
                '"%s" does not contain file "%s"' % (self._repo_key, path))

        version = self._stat_cache.Get(self._repo_key).Get()
        assert version is not None, ('There was a zipball in datastore; there '
                                     'should be a version cached for it')

        stat_info = StatInfo(version)
        if IsDirectory(path):
            stat_info.child_versions = dict(
                (p, StatInfo(version)) for p in repo_zip.List(path))
        return stat_info
    def Stat(self, path):
        '''Stats |path| returning its version as as StatInfo object. If |path| ends
    with a '/', it is assumed to be a directory and the StatInfo object returned
    includes child_versions for all paths in the directory.

    File paths do not include the name of the zip file, which is arbitrary and
    useless to consumers.

    Because the repository will only be downloaded once per server version, all
    stat versions are always 0.
    '''
        self._EnsureRepoZip()
        repo_zip = self._repo_zip.Get()

        if path not in repo_zip.Paths():
            raise FileNotFoundError('"%s" does not contain file "%s"' %
                                    (self._repo_key, path))

        version = self._stat_cache.Get(self._repo_key).Get()
        assert version is not None, ('There was a zipball in datastore; there '
                                     'should be a version cached for it')

        stat_info = StatInfo(version)
        if IsDirectory(path):
            stat_info.child_versions = dict(
                (p, StatInfo(version)) for p in repo_zip.List(path))
        return stat_info
 def Stat(self, path):
   read_result = self.ReadSingle(path)
   stat_result = StatInfo(str(self._stat))
   if isinstance(read_result, list):
     stat_result.child_versions = dict((file_result, str(self._stat))
                                       for file_result in read_result)
   return stat_result
 def Stat(self, path):
   read_result = self.Read([path]).Get().get(path)
   stat_result = StatInfo(self._SinglePathStat(path))
   if isinstance(read_result, list):
     stat_result.child_versions = dict(
         (file_result, self._SinglePathStat('%s%s' % (path, file_result)))
         for file_result in read_result)
   return stat_result
示例#5
0
 def Stat(self, path):
   read_result = self.ReadSingle(path).Get()
   stat_result = StatInfo(str(self._stat_tracker.GetVersion(path)))
   if isinstance(read_result, list):
     stat_result.child_versions = dict(
         (file_result,
          str(self._stat_tracker.GetVersion('%s%s' % (path, file_result))))
         for file_result in read_result)
   return stat_result
 def Stat(self, path):
   read_result = self.ReadSingle(path).Get()
   stat_result = StatInfo(str(self._stat_tracker.GetVersion(path)))
   if isinstance(read_result, list):
     stat_result.child_versions = dict(
         (file_result,
          str(self._stat_tracker.GetVersion('%s%s' % (path, file_result))))
         for file_result in read_result)
   return stat_result