Exemple #1
0
		/// <summary>
		/// This means that is a tree that doesn't cotains children trees
		/// </summary>
		/// <param name="tree">
		/// A <see cref="Tree"/>
		/// </param>
		/// <param name="store">
		/// A <see cref="ObjectStore"/>
		/// </param>
		/// <returns>
		/// A <see cref="System.Boolean"/>
		/// </returns>
		protected static bool IsLastChild (Tree tree, ObjectStore store)
		{
			foreach (TreeEntry entry in tree.Entries) {
				if (store.Get (entry.Id).Type == Type.Tree)
					return false;
			}
			
			return true;
		}
		public static void LsTreeTest (string tree, string path)
		{
			ObjectStore store = new ObjectStore (path);
			store.LsTree (tree);
		}
		public static void CheckinObject (string filePath, string storePath)
		{
			ObjectStore store = new ObjectStore (storePath);
			store.Checkin (filePath);
			
			store.Write ();
		}
		public static void CheckoutTest (string hash, string objStorePath)
		{
			ObjectStore store = new ObjectStore (objStorePath);
			
			SHA1 id = new SHA1 (SHA1.FromHexString (hash), false);
			
			Console.WriteLine ("Hash: " + hash);
			Console.WriteLine ("Id:   " + id.ToHexString ());
			
			Console.WriteLine ("hash created");
			
			Tree tree = (Tree) store.Get (id);
			
			Console.WriteLine ("tree created No. entries: " + tree.Entries.Length);
			
			store.Checkout (Environment.CurrentDirectory, tree);
			
			Console.WriteLine ("Checkout done WIIIII!!!");
		}