Example #1
0
        public void ToYaml_ProducesValidYaml()
        {
            var doc = new GitBinDocument("name");

            doc.RecordChunk("abcde");
            doc.RecordChunk("zyxwv");

            var actualYaml = GitBinDocument.ToYaml(doc);

            Assert.AreEqual(expectedYaml, actualYaml);
        }
Example #2
0
        public void Execute()
        {
            GitBinConsole.WriteLine("Cleaning {0}", _filename);

            var document = new GitBinDocument(_filename);

            var chunkBuffer = new byte[_configurationProvider.ChunkSize];
            int numberOfBytesRead;

            var stdin = Console.OpenStandardInput();

            do
            {
                numberOfBytesRead = stdin.Read(chunkBuffer, 0, chunkBuffer.Length);

                if (numberOfBytesRead > 0)
                {
                    var hash = GetHashForChunk(chunkBuffer, numberOfBytesRead);
                    _cacheManager.WriteFileToCache(hash, chunkBuffer, numberOfBytesRead);
                    document.RecordChunk(hash);
                }
            } while (numberOfBytesRead == chunkBuffer.Length);

            Console.Write(GitBinDocument.ToYaml(document));
            Console.Out.Flush();
        }
Example #3
0
        public void Execute()
        {
            GitBinConsole.WriteLine("Cleaning {0}", _filename);

            var document = new GitBinDocument(_filename);

            var chunkBuffer = new byte[_configurationProvider.ChunkSize];
            int numberOfBytesRead;
            int totalBytesInChunk = 0;

            var stdin = Console.OpenStandardInput();

            do
            {
                numberOfBytesRead = stdin.Read(chunkBuffer, totalBytesInChunk, chunkBuffer.Length - totalBytesInChunk);

                totalBytesInChunk += numberOfBytesRead;

                if ((totalBytesInChunk == chunkBuffer.Length || numberOfBytesRead == 0) && totalBytesInChunk > 0)
                {
                    var hash = GetHashForChunk(chunkBuffer, totalBytesInChunk);
                    _cacheManager.WriteFileToCache(hash, chunkBuffer, totalBytesInChunk);
                    document.RecordChunk(hash);
                    totalBytesInChunk = 0;
                }
            } while (numberOfBytesRead > 0);

            var yamlString = GitBinDocument.ToYaml(document);

            Console.Write(yamlString);
            Console.Out.Flush();
        }
Example #4
0
        public void Execute()
        {
            GitBinConsole.WriteLine("Cleaning {0}", _filename);

            var document = new GitBinDocument(_filename);

            var chunkBuffer = new byte[_configurationProvider.ChunkSize];
            int numberOfBytesRead;

            var stdin = Console.OpenStandardInput();

            do
            {
                numberOfBytesRead = stdin.Read(chunkBuffer, 0, chunkBuffer.Length);

                if (numberOfBytesRead > 0)
                {
                    var hash = GetHashForChunk(chunkBuffer, numberOfBytesRead);
                    _cacheManager.WriteFileToCache(hash, chunkBuffer, numberOfBytesRead);
                    document.RecordChunk(hash);
                }
            } while (numberOfBytesRead == chunkBuffer.Length);

            Console.Write(GitBinDocument.ToYaml(document));
            Console.Out.Flush();
        }
Example #5
0
        public void Execute()
        {
            GitBinConsole.WriteLine("Cleaning {0}", _filename);

            var document = new GitBinDocument(_filename);

            var chunkBuffer = new byte[_configurationProvider.ChunkSize];
            int numberOfBytesRead;
            int totalBytesInChunk = 0;

            var stdin = Console.OpenStandardInput();

            do
            {
                numberOfBytesRead = stdin.Read(chunkBuffer, totalBytesInChunk, chunkBuffer.Length - totalBytesInChunk);

                totalBytesInChunk += numberOfBytesRead;

                if ((totalBytesInChunk == chunkBuffer.Length || numberOfBytesRead == 0) && totalBytesInChunk > 0)
                {
                    var hash = GetHashForChunk(chunkBuffer, totalBytesInChunk);
                    _cacheManager.WriteFileToCache(hash, chunkBuffer, totalBytesInChunk);
                    document.RecordChunk(hash);
                    totalBytesInChunk = 0;
                }
            } while (numberOfBytesRead > 0);

            var yamlString = GitBinDocument.ToYaml(document);

            Console.Write(yamlString);
            Console.Out.Flush();
        }