Exemplo n.º 1
0
		public override void SetUp()
		{
			base.SetUp();
			toLoad = new AList<WindowCacheGetTest.TestObject>();
			BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(
				JGitTestUtil.GetTestResourceFile("all_packed_objects.txt")), Constants.CHARSET));
			try
			{
				string line;
				while ((line = br.ReadLine()) != null)
				{
					string[] parts = line.Split(" {1,}");
					WindowCacheGetTest.TestObject o = new WindowCacheGetTest.TestObject(this);
					o.id = ObjectId.FromString(parts[0]);
					o.SetType(parts[1]);
					// parts[2] is the inflate size
					// parts[3] is the size-in-pack
					// parts[4] is the offset in the pack
					toLoad.AddItem(o);
				}
			}
			finally
			{
				br.Close();
			}
			NUnit.Framework.Assert.AreEqual(96, toLoad.Count);
		}
Exemplo n.º 2
0
 // expected
 /// <exception cref="System.IO.IOException"></exception>
 private int CountPicks()
 {
     int count = 0;
     FilePath todoFile = new FilePath(db.Directory, "rebase-merge/git-rebase-todo");
     BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(
         todoFile), "UTF-8"));
     try
     {
         string line = br.ReadLine();
         while (line != null)
         {
             string actionToken = Sharpen.Runtime.Substring(line, 0, line.IndexOf(' '));
             RebaseCommand.Action action = null;
             try
             {
                 action = RebaseCommand.Action.Parse(actionToken);
             }
             catch (Exception)
             {
             }
             // ignore
             if (action != null)
             {
                 count++;
             }
             line = br.ReadLine();
         }
         return count;
     }
     finally
     {
         br.Close();
     }
 }
		/// <exception cref="System.Exception"></exception>
		private IDictionary<string, DirCacheCGitCompatabilityTest.CGitLsTreeRecord> ReadLsTree
			()
		{
			LinkedHashMap<string, DirCacheCGitCompatabilityTest.CGitLsTreeRecord> r = new LinkedHashMap
				<string, DirCacheCGitCompatabilityTest.CGitLsTreeRecord>();
			BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(
				PathOf("gitgit.lstree")), "UTF-8"));
			try
			{
				string line;
				while ((line = br.ReadLine()) != null)
				{
					DirCacheCGitCompatabilityTest.CGitLsTreeRecord cr = new DirCacheCGitCompatabilityTest.CGitLsTreeRecord
						(line);
					r.Put(cr.path, cr);
				}
			}
			finally
			{
				br.Close();
			}
			return r;
		}