本文整理汇总了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;
}
示例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());
}
示例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;
//.........这里部分代码省略.........