Exemple #1
0
        public void Execute()
        {
            var filesInRemote = _remote.ListFiles();
            var filesInCache  = _cacheManager.ListFiles();

            var filesToUpload = filesInCache.Except(filesInRemote).Select(x => x.Name).ToArray();

            if (filesToUpload.Length == 0)
            {
                GitBinConsole.Write("All chunks already present on remote");
            }
            else
            {
                if (filesToUpload.Length == 1)
                {
                    GitBinConsole.Write("Uploading 1 chunk: ");
                }
                else
                {
                    GitBinConsole.Write("Uploading {0} chunks: ", filesToUpload.Length);
                }

                AsyncFileProcessor.ProcessFiles(filesToUpload,
                                                (files, index) =>
                {
                    var file = filesToUpload[index];
                    _remote.UploadFile(_cacheManager.GetPathForFile(file), file);
                });
            }
            Console.WriteLine();
        }
Exemple #2
0
        public void Execute()
        {
            var filesInRemote = _remote.ListFiles();
            var filesInCache  = _cacheManager.ListFiles();

            var filesToUpload = filesInCache.Except(filesInRemote).ToList();

            if (filesToUpload.Count == 0)
            {
                GitBinConsole.WriteLine("All chunks already present on remote");
            }
            else
            {
                if (filesToUpload.Count == 1)
                {
                    GitBinConsole.WriteLine("Uploading 1 chunk");
                }
                else
                {
                    GitBinConsole.WriteLine("Uploading {0} chunks", filesToUpload.Count);
                }

                for (int i = 0; i < filesToUpload.Count; i++)
                {
                    using (new RemoteProgressPrinter(i + 1, filesToUpload.Count, _remote))
                    {
                        var file = filesToUpload[i];
                        _remote.UploadFile(_cacheManager.GetPathForFile(file.Name), file.Name);
                    }
                }
            }
        }
Exemple #3
0
        private void PrintStatusAboutRemote()
        {
            var remoteFiles = _remote.ListFiles();

            GitBinConsole.WriteLineNoPrefix("\nRemote repo:");
            GitBinConsole.WriteLineNoPrefix("  items: {0}", remoteFiles.Length);
            GitBinConsole.WriteLineNoPrefix("  size:  {0}", GitBinFileInfoUtils.GetHumanReadableSize(remoteFiles));

            var filesToPush = _filesInLocalCache.Except(remoteFiles).ToList();

            GitBinConsole.WriteLineNoPrefix("\nTo push:");
            GitBinConsole.WriteLineNoPrefix("  items: {0}", filesToPush.Count);
            GitBinConsole.WriteLineNoPrefix("  size:  {0}", GitBinFileInfoUtils.GetHumanReadableSize(filesToPush));
        }