示例#1
0
        internal TrackingRefUpdate(bool canForceUpdate, string remoteName, string localName
			, AnyObjectId oldValue, AnyObjectId newValue)
        {
            this.remoteName = remoteName;
            this.localName = localName;
            this.forceUpdate = canForceUpdate;
            this.oldObjectId = oldValue.Copy();
            this.newObjectId = newValue.Copy();
        }
示例#2
0
 /// <summary>Add a parent onto the end of the parent list.</summary>
 /// <remarks>Add a parent onto the end of the parent list.</remarks>
 /// <param name="additionalParent">new parent to add onto the end of the current parent list.
 ///     </param>
 public virtual void AddParentId(AnyObjectId additionalParent)
 {
     if (parentIds.Length == 0)
     {
         SetParentId(additionalParent);
     }
     else
     {
         ObjectId[] newParents = new ObjectId[parentIds.Length + 1];
         System.Array.Copy(parentIds, 0, newParents, 0, parentIds.Length);
         newParents[parentIds.Length] = additionalParent.Copy();
         parentIds = newParents;
     }
 }
示例#3
0
 /// <summary>Add a parent onto the end of the parent list.</summary>
 /// <remarks>Add a parent onto the end of the parent list.</remarks>
 /// <param name="additionalParent">new parent to add onto the end of the current parent list.
 ///     </param>
 public virtual void AddParentId(AnyObjectId additionalParent)
 {
     if (parentIds.Length == 0)
     {
         SetParentId(additionalParent);
     }
     else
     {
         ObjectId[] newParents = new ObjectId[parentIds.Length + 1];
         for (int i = 0; i < parentIds.Length; i++)
         {
             newParents[i] = parentIds[i];
         }
         newParents[parentIds.Length] = additionalParent.Copy();
         parentIds = newParents;
     }
 }
示例#4
0
		/// <summary>Set the identity of the object, if its not already set.</summary>
		/// <remarks>Set the identity of the object, if its not already set.</remarks>
		/// <param name="id">the id of the object that is too large to process.</param>
		public virtual void SetObjectId(AnyObjectId id)
		{
			if (objectId == null)
			{
				objectId = id.Copy();
			}
		}
示例#5
0
			internal LargeObject(int type, long size, FilePath path, AnyObjectId id, FileObjectDatabase
				 db)
			{
				this.type = type;
				this.size = size;
				this.path = path;
				this.id = id.Copy();
				this.source = db;
			}
示例#6
0
		/// <summary>Set the new value the ref will update to.</summary>
		/// <remarks>Set the new value the ref will update to.</remarks>
		/// <param name="id">the new value.</param>
		public virtual void SetNewObjectId(AnyObjectId id)
		{
			newValue = id.Copy();
		}
示例#7
0
		/// <exception cref="NGit.Errors.MissingObjectException"></exception>
		public override long FindCRC32(AnyObjectId objId)
		{
			int levelOne = objId.FirstByte;
			int levelTwo = BinarySearchLevelTwo(objId, levelOne);
			if (levelTwo == -1)
			{
				throw new MissingObjectException(objId.Copy(), "unknown");
			}
			return NB.DecodeUInt32(crc32[levelOne], levelTwo << 2);
		}
示例#8
0
		/// <exception cref="NGit.Errors.MissingObjectException"></exception>
		/// <exception cref="NGit.Errors.IncorrectObjectTypeException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		public override ObjectLoader Open(AnyObjectId objectId, int typeHint)
		{
			ObjectLoader ldr = db.OpenObject(this, objectId);
			if (ldr == null)
			{
				if (typeHint == OBJ_ANY)
				{
					throw new MissingObjectException(objectId.Copy(), "unknown");
				}
				throw new MissingObjectException(objectId.Copy(), typeHint);
			}
			if (typeHint != OBJ_ANY && ldr.GetType() != typeHint)
			{
				throw new IncorrectObjectTypeException(objectId.Copy(), typeHint);
			}
			return ldr;
		}
示例#9
0
		/// <exception cref="NGit.Errors.MissingObjectException"></exception>
		/// <exception cref="NGit.Errors.IncorrectObjectTypeException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		public override long GetObjectSize(AnyObjectId objectId, int typeHint)
		{
			long sz = db.GetObjectSize(this, objectId);
			if (sz < 0)
			{
				if (typeHint == OBJ_ANY)
				{
					throw new MissingObjectException(objectId.Copy(), "unknown");
				}
				throw new MissingObjectException(objectId.Copy(), typeHint);
			}
			return sz;
		}
示例#10
0
 /// <summary>Set the object this tag refers to, and its type.</summary>
 /// <remarks>Set the object this tag refers to, and its type.</remarks>
 /// <param name="obj">the object.</param>
 /// <param name="objType">
 /// the type of
 /// <code>obj</code>
 /// . Must be a valid type code.
 /// </param>
 public virtual void SetObjectId(AnyObjectId obj, int objType)
 {
     @object = obj.Copy();
     type    = objType;
 }
		private void RecordError(AnyObjectId id, Exception what)
		{
			ObjectId objId = id.Copy();
			IList<Exception> errors = fetchErrors.Get(objId);
			if (errors == null)
			{
				errors = new AList<Exception>(2);
				fetchErrors.Put(objId, errors);
			}
			errors.AddItem(what);
		}
示例#12
0
		/// <summary>Set the object this tag refers to, and its type.</summary>
		/// <remarks>Set the object this tag refers to, and its type.</remarks>
		/// <param name="obj">the object.</param>
		/// <param name="objType">
		/// the type of
		/// <code>obj</code>
		/// . Must be a valid type code.
		/// </param>
		public virtual void SetObjectId(AnyObjectId obj, int objType)
		{
			@object = obj.Copy();
			type = objType;
		}
示例#13
0
 /// <summary>Set the new value the ref will update to.</summary>
 /// <remarks>Set the new value the ref will update to.</remarks>
 /// <param name="id">the new value.</param>
 public virtual void SetNewObjectId(AnyObjectId id)
 {
     newValue = id.Copy();
 }
示例#14
0
 /// <summary>Set the parents of this commit.</summary>
 /// <remarks>Set the parents of this commit.</remarks>
 /// <param name="parent1">
 /// the first parent of this commit. Typically this is the current
 /// value of the
 /// <code>HEAD</code>
 /// reference and is thus the current
 /// branch's position in history.
 /// </param>
 /// <param name="parent2">
 /// the second parent of this merge commit. Usually this is the
 /// branch being merged into the current branch.
 /// </param>
 public virtual void SetParentIds(AnyObjectId parent1, AnyObjectId parent2)
 {
     parentIds = new ObjectId[] { parent1.Copy(), parent2.Copy() };
 }
示例#15
0
 /// <summary>Set the parent of this commit.</summary>
 /// <remarks>Set the parent of this commit.</remarks>
 /// <param name="newParent">the single parent for the commit.</param>
 public virtual void SetParentId(AnyObjectId newParent)
 {
     parentIds = new ObjectId[] { newParent.Copy() };
 }
示例#16
0
			internal virtual bool Add(AnyObjectId toAdd)
			{
				int i = Index(toAdd);
				for (int n = 0; n < MAX_CHAIN; )
				{
					ObjectId obj = ids.Get(i);
					if (obj == null)
					{
						if (ids.CompareAndSet(i, null, toAdd.Copy()))
						{
							return true;
						}
						else
						{
							continue;
						}
					}
					if (AnyObjectId.Equals(obj, toAdd))
					{
						return true;
					}
					if (++i == ids.Length())
					{
						i = 0;
					}
					n++;
				}
				return false;
			}