コード例 #1
0
 internal Entry(GitIndex _enclosing, TreeEntry f, int stage)
 {
     this._enclosing = _enclosing;
     this.ctime      = -1;
     // hmm
     this.mtime = -1;
     this.dev   = -1;
     this.ino   = -1;
     this.mode  = f.GetMode().GetBits();
     this.uid   = -1;
     this.gid   = -1;
     try
     {
         this.size = (int)this._enclosing.db.Open(f.GetId(), Constants.OBJ_BLOB).GetSize();
     }
     catch (IOException e)
     {
         Sharpen.Runtime.PrintStackTrace(e);
         this.size = -1;
     }
     this.sha1  = f.GetId();
     this.name  = Constants.Encode(f.GetFullName());
     this.flags = (short)((stage << 12) | this.name.Length);
     // TODO: fix flags
     this.stages = (1 >> this.GetStage());
 }
コード例 #2
0
 /// <summary>Add tree entry to index</summary>
 /// <param name="te">tree entry</param>
 /// <returns>new or modified index entry</returns>
 /// <exception cref="System.IO.IOException">System.IO.IOException</exception>
 public virtual GitIndex.Entry AddEntry(TreeEntry te)
 {
     byte[]         key = Constants.Encode(te.GetFullName());
     GitIndex.Entry e   = new GitIndex.Entry(this, te, 0);
     entries.Put(key, e);
     return(e);
 }
コード例 #3
0
            public override void VisitEntry(TreeEntry treeEntry, GitIndex.Entry indexEntry, FilePath
				 file)
            {
                if (treeEntry == null)
                {
                    this._enclosing.indexOnlyEntriesVisited.AddItem(indexEntry.GetName());
                }
                else
                {
                    if (indexEntry == null)
                    {
                        this._enclosing.treeOnlyEntriesVisited.AddItem(treeEntry.GetFullName());
                    }
                    else
                    {
                        this._enclosing.bothVisited.AddItem(indexEntry.GetName());
                    }
                }
            }
コード例 #4
0
		/// <exception cref="System.IO.IOException"></exception>
		internal virtual void ProcessEntry(TreeEntry h, TreeEntry m, GitIndex.Entry i)
		{
			ObjectId iId = (i == null ? null : i.GetObjectId());
			ObjectId mId = (m == null ? null : m.GetId());
			ObjectId hId = (h == null ? null : h.GetId());
			string name = (i != null ? i.GetName() : (h != null ? h.GetFullName() : m.GetFullName
				()));
			if (i == null)
			{
				if (h == null)
				{
					updated.Put(name, mId);
				}
				else
				{
					if (m == null)
					{
						removed.AddItem(name);
					}
					else
					{
						updated.Put(name, mId);
					}
				}
			}
			else
			{
				if (h == null)
				{
					if (m == null || mId.Equals(iId))
					{
						if (HasParentBlob(merge, name))
						{
							if (i.IsModified(root, true))
							{
								conflicts.AddItem(name);
							}
							else
							{
								removed.AddItem(name);
							}
						}
					}
					else
					{
						conflicts.AddItem(name);
					}
				}
				else
				{
					if (m == null)
					{
						if (hId.Equals(iId))
						{
							if (i.IsModified(root, true))
							{
								conflicts.AddItem(name);
							}
							else
							{
								removed.AddItem(name);
							}
						}
						else
						{
							conflicts.AddItem(name);
						}
					}
					else
					{
						if (!hId.Equals(mId) && !hId.Equals(iId) && !mId.Equals(iId))
						{
							conflicts.AddItem(name);
						}
						else
						{
							if (hId.Equals(iId) && !mId.Equals(iId))
							{
								if (i.IsModified(root, true))
								{
									conflicts.AddItem(name);
								}
								else
								{
									updated.Put(name, mId);
								}
							}
						}
					}
				}
			}
		}
コード例 #5
0
		/// <exception cref="System.IO.IOException"></exception>
		private void FinishVisitTree(TreeEntry t1, TreeEntry t2, int curIndexPos)
		{
			if (t1 != null && t1.GetParent() == null)
			{
				t1 = null;
			}
			if (t2 != null && t2.GetParent() == null)
			{
				t2 = null;
			}
			FilePath f = null;
			string c = null;
			if (t1 != null)
			{
				c = t1.GetFullName();
				f = new FilePath(root, c);
			}
			else
			{
				if (t2 != null)
				{
					c = t2.GetFullName();
					f = new FilePath(root, c);
				}
			}
			if (t1 is Tree || t2 is Tree)
			{
				if (threeTrees)
				{
					visitor.FinishVisitTree((Tree)t1, (Tree)t2, c);
				}
				else
				{
					visitor.FinishVisitTree((Tree)t1, indexCounter - curIndexPos, c);
				}
			}
			else
			{
				if (t1 != null || t2 != null)
				{
					if (threeTrees)
					{
						visitor.VisitEntry(t1, t2, null, f);
					}
					else
					{
						visitor.VisitEntry(t1, null, f);
					}
				}
			}
		}
コード例 #6
0
		/// <exception cref="System.IO.IOException"></exception>
		private void VisitEntry(TreeEntry t1, TreeEntry t2, GitIndex.Entry i)
		{
			// assert t1 != null || t2 != null || i != null :
			// org.eclipse.jgit.JGitText.get().needsAtLeastOneEntry;
			// assert root != null : JGitText.get().needsWorkdir;
			if (t1 != null && t1.GetParent() == null)
			{
				t1 = null;
			}
			if (t2 != null && t2.GetParent() == null)
			{
				t2 = null;
			}
			FilePath f = null;
			if (i != null)
			{
				f = new FilePath(root, i.GetName());
			}
			else
			{
				if (t1 != null)
				{
					f = new FilePath(root, t1.GetFullName());
				}
				else
				{
					if (t2 != null)
					{
						f = new FilePath(root, t2.GetFullName());
					}
				}
			}
			if (t1 != null || t2 != null || i != null)
			{
				if (threeTrees)
				{
					visitor.VisitEntry(t1, t2, i, f);
				}
				else
				{
					visitor.VisitEntry(t1, i, f);
				}
			}
		}