当前位置: 首页>>代码示例>>C#>>正文


C# ObjectId.Equals方法代码示例

本文整理汇总了C#中NGit.ObjectId.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectId.Equals方法的具体用法?C# ObjectId.Equals怎么用?C# ObjectId.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NGit.ObjectId的用法示例。


在下文中一共展示了ObjectId.Equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EqualIdAndMode

        /// <summary>Compares whether two pairs of ObjectId and FileMode are equal.</summary>
        /// <remarks>Compares whether two pairs of ObjectId and FileMode are equal.</remarks>
        /// <param name="id1"></param>
        /// <param name="mode1"></param>
        /// <param name="id2"></param>
        /// <param name="mode2"></param>
        /// <returns>
        /// <code>true</code> if FileModes and ObjectIds are equal.
        /// <code>false</code> otherwise
        /// </returns>
        private bool EqualIdAndMode(ObjectId id1, FileMode mode1, ObjectId id2, FileMode 
			mode2)
        {
            if (!mode1.Equals(mode2))
            {
                return false;
            }
            return id1 != null ? id1.Equals(id2) : id2 == null;
        }
开发者ID:stinos,项目名称:ngit,代码行数:19,代码来源:DirCacheCheckout.cs

示例2: GetRawText

		/// <exception cref="System.IO.IOException"></exception>
		private static RawText GetRawText(ObjectId id, Repository db)
		{
			if (id.Equals(ObjectId.ZeroId))
			{
				return new RawText(new byte[] {  });
			}
			return new RawText(db.Open(id, Constants.OBJ_BLOB).GetCachedBytes());
		}
开发者ID:stewartwhaley,项目名称:monodevelop,代码行数:9,代码来源:ResolveMerger.cs

示例3: RemoteRefUpdate

        /// <summary>Construct remote ref update request by providing an update specification.
        /// 	</summary>
        /// <remarks>
        /// Construct remote ref update request by providing an update specification.
        /// Object is created with default
        /// <see cref="Status.NOT_ATTEMPTED">Status.NOT_ATTEMPTED</see>
        /// status and no
        /// message.
        /// </remarks>
        /// <param name="localDb">local repository to push from.</param>
        /// <param name="srcRef">
        /// source revision to label srcId with. If null srcId.name() will
        /// be used instead.
        /// </param>
        /// <param name="srcId">
        /// The new object that the caller wants remote ref to be after
        /// update. Use null or
        /// <see cref="NGit.ObjectId.ZeroId()">NGit.ObjectId.ZeroId()</see>
        /// for delete
        /// request.
        /// </param>
        /// <param name="remoteName">
        /// full name of a remote ref to update, e.g. "refs/heads/master"
        /// (no wildcard, no short name).
        /// </param>
        /// <param name="forceUpdate">
        /// true when caller want remote ref to be updated regardless
        /// whether it is fast-forward update (old object is ancestor of
        /// new object).
        /// </param>
        /// <param name="localName">
        /// optional full name of a local stored tracking branch, to
        /// update after push, e.g. "refs/remotes/zawir/dirty" (no
        /// wildcard, no short name); null if no local tracking branch
        /// should be updated.
        /// </param>
        /// <param name="expectedOldObjectId">
        /// optional object id that caller is expecting, requiring to be
        /// advertised by remote side before update; update will take
        /// place ONLY if remote side advertise exactly this expected id;
        /// null if caller doesn't care what object id remote side
        /// advertise. Use
        /// <see cref="NGit.ObjectId.ZeroId()">NGit.ObjectId.ZeroId()</see>
        /// when expecting no
        /// remote ref with this name.
        /// </param>
        /// <exception cref="System.IO.IOException">
        /// when I/O error occurred during creating
        /// <see cref="TrackingRefUpdate">TrackingRefUpdate</see>
        /// for local tracking branch or srcRef
        /// can't be resolved to any object.
        /// </exception>
        /// <exception cref="System.ArgumentException">if some required parameter was null</exception>
        public RemoteRefUpdate(Repository localDb, string srcRef, ObjectId srcId, string 
			remoteName, bool forceUpdate, string localName, ObjectId expectedOldObjectId)
        {
            if (remoteName == null)
            {
                throw new ArgumentException(JGitText.Get().remoteNameCantBeNull);
            }
            if (srcId == null && srcRef != null)
            {
                throw new IOException(MessageFormat.Format(JGitText.Get().sourceRefDoesntResolveToAnyObject
                    , srcRef));
            }
            if (srcRef != null)
            {
                this.srcRef = srcRef;
            }
            else
            {
                if (srcId != null && !srcId.Equals(ObjectId.ZeroId))
                {
                    this.srcRef = srcId.Name;
                }
                else
                {
                    this.srcRef = null;
                }
            }
            if (srcId != null)
            {
                this.newObjectId = srcId;
            }
            else
            {
                this.newObjectId = ObjectId.ZeroId;
            }
            this.remoteName = remoteName;
            this.forceUpdate = forceUpdate;
            if (localName != null && localDb != null)
            {
                trackingRefUpdate = new TrackingRefUpdate(localDb, localName, remoteName, true, newObjectId
                    , "push");
            }
            else
            {
                trackingRefUpdate = null;
            }
            this.localDb = localDb;
//.........这里部分代码省略.........
开发者ID:kenji-tan,项目名称:ngit,代码行数:101,代码来源:RemoteRefUpdate.cs


注:本文中的NGit.ObjectId.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。