本文整理汇总了C#中NGit.ObjectId类的典型用法代码示例。如果您正苦于以下问题:C# ObjectId类的具体用法?C# ObjectId怎么用?C# ObjectId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectId类属于NGit命名空间,在下文中一共展示了ObjectId类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Entry
internal Entry(byte[] raw, int pos)
{
oldId = ObjectId.FromString(raw, pos);
pos += Constants.OBJECT_ID_STRING_LENGTH;
if (raw[pos++] != ' ')
{
throw new ArgumentException(JGitText.Get().rawLogMessageDoesNotParseAsLogEntry);
}
newId = ObjectId.FromString(raw, pos);
pos += Constants.OBJECT_ID_STRING_LENGTH;
if (raw[pos++] != ' ')
{
throw new ArgumentException(JGitText.Get().rawLogMessageDoesNotParseAsLogEntry);
}
who = RawParseUtils.ParsePersonIdentOnly(raw, pos);
int p0 = RawParseUtils.Next(raw, pos, '\t');
if (p0 >= raw.Length)
{
comment = string.Empty;
}
else
{
// personident has no \t, no comment present
int p1 = RawParseUtils.NextLF(raw, p0);
comment = p1 > p0 ? RawParseUtils.Decode(raw, p0, p1 - 1) : string.Empty;
}
}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:27,代码来源:ReflogReader.cs
示例2: SubmoduleStatus
/// <summary>Create submodule status</summary>
/// <param name="type"></param>
/// <param name="path"></param>
/// <param name="indexId"></param>
/// <param name="headId"></param>
public SubmoduleStatus(SubmoduleStatusType type, string path, ObjectId indexId, ObjectId
headId)
{
this.type = type;
this.path = path;
this.indexId = indexId;
this.headId = headId;
}
开发者ID:LunarLanding,项目名称:ngit,代码行数:13,代码来源:SubmoduleStatus.cs
示例3: TrackingRefUpdate
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();
}
开发者ID:stinos,项目名称:ngit,代码行数:9,代码来源:TrackingRefUpdate.cs
示例4: NewDelta
internal static LocalObjectRepresentation NewDelta(PackFile f, long p, long n, ObjectId
@base)
{
LocalObjectRepresentation r = new LocalObjectRepresentation.Delta();
r.pack = f;
r.offset = p;
r.length = n;
r.baseId = @base;
return r;
}
开发者ID:LunarLanding,项目名称:ngit,代码行数:10,代码来源:LocalObjectRepresentation.cs
示例5: PrescanTwoTrees
/// <exception cref="System.InvalidOperationException"></exception>
/// <exception cref="System.IO.IOException"></exception>
private void PrescanTwoTrees(ObjectId head, ObjectId merge)
{
DirCache dc = db.LockDirCache();
try
{
dco = new DirCacheCheckout(db, head, dc, merge);
dco.PreScanTwoTrees();
}
finally
{
dc.Unlock();
}
}
开发者ID:LunarLanding,项目名称:ngit,代码行数:15,代码来源:DirCacheCheckoutTest.cs
示例6: LargeObject
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;
}
开发者ID:nocache,项目名称:monodevelop,代码行数:9,代码来源:UnpackedObject.cs
示例7: _InflaterInputStream_307
public _InflaterInputStream_307(long size, ObjectId id, InputStream baseArg1, Inflater
baseArg2) : base(baseArg1, baseArg2)
{
this.size = size;
this.id = id;
this.remaining = size;
}
开发者ID:nocache,项目名称:monodevelop,代码行数:7,代码来源:UnpackedObject.cs
示例8: Inflate
private static InputStream Inflate(InputStream @in, long size, ObjectId id)
{
Inflater inf = InflaterCache.Get();
return new _InflaterInputStream_307(size, id, @in, inf);
}
开发者ID:nocache,项目名称:monodevelop,代码行数:5,代码来源:UnpackedObject.cs
示例9: MakeDiffHeaderModeChange
//
//
//
private string MakeDiffHeaderModeChange(string pathA, string pathB, ObjectId aId,
ObjectId bId, string modeA, string modeB)
{
string a = aId.Abbreviate(8).Name;
string b = bId.Abbreviate(8).Name;
return DIFF + "a/" + pathA + " " + "b/" + pathB + "\n" + "old mode " + modeA + "\n"
+ "new mode " + modeB + "\n" + "index " + a + ".." + b + "\n" + "--- a/" + pathA
+ "\n" + "+++ b/" + pathB + "\n";
}
开发者ID:ashmind,项目名称:ngit,代码行数:12,代码来源:DiffFormatterTest.cs
示例10: RevisionObjectIdPair
public RevisionObjectIdPair(RevCommit revision, ObjectId objectId)
{
this.Commit = revision;
this.ObjectId = objectId;
}
开发者ID:stewartwhaley,项目名称:monodevelop,代码行数:5,代码来源:GitUtil.cs
示例11: ReceiveCommand
/// <summary>
/// Create a new command for
/// <see cref="BaseReceivePack">BaseReceivePack</see>
/// .
/// </summary>
/// <param name="oldId">
/// the old object id; must not be null. Use
/// <see cref="NGit.ObjectId.ZeroId()">NGit.ObjectId.ZeroId()</see>
/// to indicate a ref creation.
/// </param>
/// <param name="newId">
/// the new object id; must not be null. Use
/// <see cref="NGit.ObjectId.ZeroId()">NGit.ObjectId.ZeroId()</see>
/// to indicate a ref deletion.
/// </param>
/// <param name="name">name of the ref being affected.</param>
/// <param name="type">type of the command.</param>
/// <since>2.0</since>
public ReceiveCommand(ObjectId oldId, ObjectId newId, string name, ReceiveCommand.Type
type)
{
this.oldId = oldId;
this.newId = newId;
this.name = name;
this.type = type;
}
开发者ID:LunarLanding,项目名称:ngit,代码行数:26,代码来源:ReceiveCommand.cs
示例12: 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
示例13: MissingObjectException
/// <summary>Construct a MissingObjectException for the specified object id.</summary>
/// <remarks>
/// Construct a MissingObjectException for the specified object id.
/// Expected type is reported to simplify tracking down the problem.
/// </remarks>
/// <param name="id">SHA-1</param>
/// <param name="type">object type</param>
public MissingObjectException(ObjectId id, string type) : base(MessageFormat.Format
(JGitText.Get().missingObject, type, id.Name))
{
missing = id.Copy();
}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:12,代码来源:MissingObjectException.cs
示例14: Include
/// <exception cref="NGit.Errors.StopWalkException"></exception>
/// <exception cref="NGit.Errors.MissingObjectException"></exception>
/// <exception cref="NGit.Errors.IncorrectObjectTypeException"></exception>
/// <exception cref="System.IO.IOException"></exception>
public override bool Include(RevWalk walker, RevCommit c)
{
// Reset the tree filter to scan this commit and parents.
//
RevCommit[] pList = c.parents;
int nParents = pList.Length;
TreeWalk tw = pathFilter;
ObjectId[] trees = new ObjectId[nParents + 1];
for (int i = 0; i < nParents; i++)
{
RevCommit p = c.parents[i];
if ((p.flags & PARSED) == 0)
{
p.ParseHeaders(walker);
}
trees[i] = p.Tree;
}
trees[nParents] = c.Tree;
tw.Reset(trees);
if (nParents == 1)
{
// We have exactly one parent. This is a very common case.
//
int chgs = 0;
int adds = 0;
while (tw.Next())
{
chgs++;
if (tw.GetRawMode(0) == 0 && tw.GetRawMode(1) != 0)
{
adds++;
}
else
{
break;
}
}
// no point in looking at this further.
if (chgs == 0)
{
// No changes, so our tree is effectively the same as
// our parent tree. We pass the buck to our parent.
//
c.flags |= REWRITE;
return false;
}
else
{
// We have interesting items, but neither of the special
// cases denoted above.
//
if (adds > 0 && tw.Filter is FollowFilter)
{
// One of the paths we care about was added in this
// commit. We need to update our filter to its older
// name, if we can discover it. Find out what that is.
//
UpdateFollowFilter(trees);
}
return true;
}
}
else
{
if (nParents == 0)
{
// We have no parents to compare against. Consider us to be
// REWRITE only if we have no paths matching our filter.
//
if (tw.Next())
{
return true;
}
c.flags |= REWRITE;
return false;
}
}
// We are a merge commit. We can only be REWRITE if we are same
// to _all_ parents. We may also be able to eliminate a parent if
// it does not contribute changes to us. Such a parent may be an
// uninteresting side branch.
//
int[] chgs_1 = new int[nParents];
int[] adds_1 = new int[nParents];
while (tw.Next())
{
int myMode = tw.GetRawMode(nParents);
for (int i_1 = 0; i_1 < nParents; i_1++)
{
int pMode = tw.GetRawMode(i_1);
if (myMode == pMode && tw.IdEqual(i_1, nParents))
{
continue;
}
chgs_1[i_1]++;
if (pMode == 0 && myMode != 0)
//.........这里部分代码省略.........
开发者ID:sharwell,项目名称:ngit,代码行数:101,代码来源:RewriteTreeFilter.cs
示例15: UpdateFollowFilter
/// <exception cref="NGit.Errors.MissingObjectException"></exception>
/// <exception cref="NGit.Errors.IncorrectObjectTypeException"></exception>
/// <exception cref="NGit.Errors.CorruptObjectException"></exception>
/// <exception cref="System.IO.IOException"></exception>
private void UpdateFollowFilter(ObjectId[] trees)
{
TreeWalk tw = pathFilter;
FollowFilter oldFilter = (FollowFilter)tw.Filter;
tw.Filter = TreeFilter.ANY_DIFF;
tw.Reset(trees);
IList<DiffEntry> files = DiffEntry.Scan(tw);
RenameDetector rd = new RenameDetector(repository);
rd.AddAll(files);
files = rd.Compute();
TreeFilter newFilter = oldFilter;
foreach (DiffEntry ent in files)
{
if (IsRename(ent) && ent.GetNewPath().Equals(oldFilter.GetPath()))
{
newFilter = FollowFilter.Create(ent.GetOldPath());
RenameCallback callback = oldFilter.GetRenameCallback();
if (callback != null)
{
callback.Renamed(ent);
// forward the callback to the new follow filter
((FollowFilter)newFilter).SetRenameCallback(callback);
}
break;
}
}
tw.Filter = newFilter;
}
开发者ID:sharwell,项目名称:ngit,代码行数:32,代码来源:RewriteTreeFilter.cs
示例16: CreateBranch
/// <exception cref="System.IO.IOException"></exception>
private void CreateBranch(ObjectId objectId, string branchName)
{
RefUpdate updateRef = db.UpdateRef(branchName);
updateRef.SetNewObjectId(objectId);
updateRef.Update();
}
开发者ID:charles-cai,项目名称:ngit,代码行数:7,代码来源:RebaseCommandTest.cs
示例17:
/// <exception cref="System.IO.IOException"></exception>
internal override FileObjectDatabase.InsertLooseObjectResult InsertUnpackedObject
(FilePath tmp, ObjectId objectId, bool createDuplicate)
{
FileObjectDatabase.InsertLooseObjectResult result = wrapped.InsertUnpackedObject(
tmp, objectId, createDuplicate);
switch (result)
{
case FileObjectDatabase.InsertLooseObjectResult.INSERTED:
case FileObjectDatabase.InsertLooseObjectResult.EXISTS_LOOSE:
{
if (!unpackedObjects.Contains(objectId))
{
unpackedObjects.Add(objectId);
}
break;
}
case FileObjectDatabase.InsertLooseObjectResult.EXISTS_PACKED:
case FileObjectDatabase.InsertLooseObjectResult.FAILURE:
{
break;
}
}
return result;
}
开发者ID:nickname100,项目名称:monodevelop,代码行数:26,代码来源:CachedObjectDirectory.cs
示例18: Entry
/// <exception cref="System.Exception"></exception>
private static byte[] Entry(FileMode mode, string name, ObjectId id)
{
ByteArrayOutputStream @out = new ByteArrayOutputStream();
mode.CopyTo(@out);
@out.Write(' ');
@out.Write(Constants.Encode(name));
@out.Write(0);
id.CopyRawTo(@out);
return @out.ToByteArray();
}
开发者ID:LunarLanding,项目名称:ngit,代码行数:11,代码来源:CanonicalTreeParserTest.cs
示例19: SetObjectId
/// <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();
}
}
开发者ID:LunarLanding,项目名称:ngit,代码行数:10,代码来源:LargeObjectException.cs
示例20: HardReset
public static void HardReset (NGit.Repository repo, ObjectId newHead)
{
DirCache dc = null;
try {
// Reset head to upstream
RefUpdate ru = repo.UpdateRef (Constants.HEAD);
ru.SetNewObjectId (newHead);
ru.SetForceUpdate (true);
RefUpdate.Result rc = ru.Update ();
switch (rc) {
case RefUpdate.Result.NO_CHANGE:
case RefUpdate.Result.NEW:
case RefUpdate.Result.FAST_FORWARD:
case RefUpdate.Result.FORCED:
break;
case RefUpdate.Result.REJECTED:
case RefUpdate.Result.LOCK_FAILURE:
throw new ConcurrentRefUpdateException (JGitText.Get ().couldNotLockHEAD, ru.GetRef (), rc);
default:
throw new JGitInternalException ("Reference update failed: " + rc);
}
dc = repo.LockDirCache ();
RevWalk rw = new RevWalk (repo);
RevCommit c = rw.ParseCommit (newHead);
DirCacheCheckout checkout = new DirCacheCheckout (repo, null, dc, c.Tree);
checkout.Checkout ();
} catch {
if (dc != null)
dc.Unlock ();
throw;
}
}
开发者ID:stewartwhaley,项目名称:monodevelop,代码行数:37,代码来源:GitUtil.cs
注:本文中的NGit.ObjectId类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论