예제 #1
0
        async private Task <bool> fetchSingleFileAsync(FileInternal file)
        {
            if (_repositoryAccessor == null)
            {
                return(false);
            }

            traceDebug(String.Format("Fetching file {0} with SHA {1}...", file.Path, file.SHA));
            File gitlabFile = await _repositoryAccessor.LoadFile(file.Path, file.SHA);

            if (gitlabFile == null)
            {
                return(false);
            }

            byte[] content = System.Convert.FromBase64String(gitlabFile.Content);
            try
            {
                _fileStorage.FileCache.WriteFileRevision(file.Path, file.SHA, content);
                traceDebug(String.Format("Saved file {0} with SHA {1}", file.Path, file.SHA));
            }
            catch (FileStorageRevisionCacheException ex)
            {
                ExceptionHandlers.Handle(String.Format("Cannot save a file {0} with SHA {1}", file.Path, file.SHA), ex);
            }
            return(true);
        }
예제 #2
0
 private bool isMissingFile(FileInternal file)
 {
     return(!_fileStorage.FileCache.ContainsFileRevision(new FileRevision(file.Path, file.SHA)));
 }