示例#1
0
        public void Checkout(string commit_hash)
        {
            Chunker chunker = new Chunker(DatabasePath);

            chunker.ChunkCrypto = new Crypto("cGFzc3dvcmQAAAAAAAAAAA==");

            // TODO: walk the HEAD tree
            //chunker.ChunksToFile (chunks, path);

            // TODO: write cache
        }
示例#2
0
        public void Commit ()
        {
            Chunker chunker = new Chunker (DatabasePath);
            chunker.ChunkCrypto = new Crypto ("cGFzc3dvcmQAAAAAAAAAAA==");

            // Tell the chunker to save in our database format
            chunker.NameChunk = delegate (string chunk_file_name) {
                string hash            = chunk_file_name;
                string chunk_container = hash.Substring (0, 2);
                chunk_file_name        = hash.Substring (2);

                return Path.Combine (chunker.OutputDirectory, chunk_container, chunk_file_name);
            };

            // TransferManager transfer_manager = new TransferManager (
            // DatabasePath, "/Users/hbons/rsync-test");

            chunker.ChunkCreated += delegate (string chunk_file_path, int chunk_size,
                                              string chunk_hash) {
              // add hash to "todo" transfer list
              //transfer_manager.UploadObject (chunk_file_path);
              // remove hash to "todo" transfer list
            };


            //chunker.Finished += delegate (Chunk [] chunks) {
              //  Blob blob = Blob.Write (chunks);
            //};

            // TODO: needs to block


            chunker.FileToChunks ("/Users/hbons/hp2.avi", 4 * 1024 * 1024);

            User author = new User { Name = "Hylke Bons", Email = "*****@*****.**" };












            Objects.Commit.Write (author, DateTime.UtcNow, Head, null);

            // TODO: Walk the new tree and create blobs, trees, commit
            //
            // foreach
            //   Hashtable trees = new Hashtable ();
            //   Hashtable blobs = new Hashtable ();
            //   trees.Add ("", new Tree ());
            //   blobs.Add ("", new Blob ());
            // - Upload all trees and blobs
            //   Tree tree = new Tree ("123456");
            // transfer_manager.UploadObject ("12345");
            //
            // tree.Trees = trees;
            // tree.Blobs = blobs;
            //
            // Commit commit    = new Commit ("abcdef");
            // commit.Tree      = tree;
            // commit.Author    = user.Name;
            // commit.Email     = user.Email;
            // commit.Timestamp = DateTime.UtcNow;
            //
            // transfer_manager.UploadObject ("abcdef");
            // - Update HEAD file
        }
示例#3
0
        public void Checkout (string commit_hash)
        {
            Chunker chunker = new Chunker (DatabasePath);
            chunker.ChunkCrypto = new Crypto ("cGFzc3dvcmQAAAAAAAAAAA==");

            // TODO: walk the HEAD tree
            //chunker.ChunksToFile (chunks, path);

            // TODO: write cache
        }
示例#4
0
        public void Commit()
        {
            Chunker chunker = new Chunker(DatabasePath);

            chunker.ChunkCrypto = new Crypto("cGFzc3dvcmQAAAAAAAAAAA==");

            // Tell the chunker to save in our database format
            chunker.NameChunk = delegate(string chunk_file_name) {
                string hash            = chunk_file_name;
                string chunk_container = hash.Substring(0, 2);
                chunk_file_name = hash.Substring(2);

                return(Path.Combine(chunker.OutputDirectory, chunk_container, chunk_file_name));
            };

            // TransferManager transfer_manager = new TransferManager (
            // DatabasePath, "/Users/hbons/rsync-test");

            chunker.ChunkCreated += delegate(string chunk_file_path, int chunk_size,
                                             string chunk_hash) {
                // add hash to "todo" transfer list
                //transfer_manager.UploadObject (chunk_file_path);
                // remove hash to "todo" transfer list
            };


            //chunker.Finished += delegate (Chunk [] chunks) {
            //  Blob blob = Blob.Write (chunks);
            //};

            // TODO: needs to block


            chunker.FileToChunks("/Users/hbons/hp2.avi", 4 * 1024 * 1024);

            User author = new User {
                Name = "Hylke Bons", Email = "*****@*****.**"
            };



            Objects.Commit.Write(author, DateTime.UtcNow, Head, null);

            // TODO: Walk the new tree and create blobs, trees, commit
            //
            // foreach
            //   Hashtable trees = new Hashtable ();
            //   Hashtable blobs = new Hashtable ();
            //   trees.Add ("", new Tree ());
            //   blobs.Add ("", new Blob ());
            // - Upload all trees and blobs
            //   Tree tree = new Tree ("123456");
            // transfer_manager.UploadObject ("12345");
            //
            // tree.Trees = trees;
            // tree.Blobs = blobs;
            //
            // Commit commit    = new Commit ("abcdef");
            // commit.Tree      = tree;
            // commit.Author    = user.Name;
            // commit.Email     = user.Email;
            // commit.Timestamp = DateTime.UtcNow;
            //
            // transfer_manager.UploadObject ("abcdef");
            // - Update HEAD file
        }