本文整理汇总了C#中AnyObjectId类的典型用法代码示例。如果您正苦于以下问题:C# AnyObjectId类的具体用法?C# AnyObjectId怎么用?C# AnyObjectId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnyObjectId类属于命名空间,在下文中一共展示了AnyObjectId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PlotCommit
/// <summary>
/// Create a new commit.
/// </summary>
/// <param name="id">the identity of this commit.</param>
/// <param name="tags">the tags associated with this commit, null for no tags</param>
public PlotCommit(AnyObjectId id, Ref[] tags)
: base(id)
{
this.refs = tags;
passingLanes = NO_LANES;
children = NO_CHILDREN;
}
示例2: include
public void include(string name, AnyObjectId id)
{
if (!Repository.IsValidRefName(name))
throw new ArgumentException("Invalid ref name: " + name, "name");
if (includeObjects.ContainsKey(name))
throw new ApplicationException("Duplicate ref: " + name);
includeObjects.Add(name, id.ToObjectId());
}
示例3: TrackingRefUpdate
public TrackingRefUpdate(Repository db, string localName, string remoteName, bool forceUpdate, AnyObjectId nv, string msg)
{
RemoteName = remoteName;
update = db.UpdateRef(localName);
update.IsForceUpdate = forceUpdate;
update.NewObjectId = nv.Copy();
update.SetRefLogMessage(msg, true);
}
示例4: ObjectId
public ObjectId(AnyObjectId src)
{
this.W1 = src.W1;
this.W2 = src.W2;
this.W3 = src.W3;
this.W4 = src.W4;
this.W5 = src.W5;
}
示例5: SetBase
/**
* Set the common ancestor tree.
*
* @param id
* common base treeish; null to automatically compute the common
* base from the input commits during
* {@link #merge(AnyObjectId, AnyObjectId)}.
* @throws IncorrectObjectTypeException
* the object is not a treeish.
* @throws MissingObjectException
* the object does not exist.
* @throws IOException
* the object could not be read.
*/
public void SetBase(AnyObjectId id)
{
if (id != null)
{
_baseTree = Walk.parseTree(id);
}
else
{
_baseTree = null;
}
}
示例6: Entry
private static byte[] Entry(FileMode mode, string name, AnyObjectId id)
{
var @out = new MemoryStream();
mode.CopyTo(@out);
@out.WriteByte((byte) ' ');
byte[] bytes = Constants.encode(name);
@out.Write(bytes, 0, bytes.Length);
@out.WriteByte(0);
id.copyRawTo(@out);
return @out.ToArray();
}
示例7: TrackingRefUpdate
public TrackingRefUpdate(Repository db, string localName, string remoteName, bool forceUpdate, AnyObjectId nv, string msg)
{
if (db == null)
throw new System.ArgumentNullException("db");
if (nv == null)
throw new System.ArgumentNullException("nv");
RemoteName = remoteName;
update = db.UpdateRef(localName);
update.IsForceUpdate = forceUpdate;
update.NewObjectId = nv.Copy();
update.setRefLogMessage(msg, true);
}
示例8: BinarySearchLevelTwo
private int BinarySearchLevelTwo(AnyObjectId objId, int levelOne)
{
int[] data = _names[levelOne];
var high = (int)((uint)(_offset32[levelOne].Length) >> 2);
if (high == 0)
{
return -1;
}
int low = 0;
do
{
var mid = (int)((uint)(low + high) >> 1);
int mid4 = mid << 2;
int cmp = objId.CompareTo(data, mid4 + mid);
if (cmp < 0)
{
high = mid;
}
else if (cmp == 0)
{
return mid;
}
else
{
low = mid + 1;
}
} while (low < high);
return -1;
}
示例9: decodeTypeString
/// <summary>
/// Parse an encoded type string into a type constant.
/// </summary>
/// <param name="id">
/// <see cref="ObjectId" /> this type string came from; may be null if
/// that is not known at the time the parse is occurring.
/// </param>
/// <param name="typeString">string version of the type code.</param>
/// <param name="endMark">
/// Character immediately following the type string. Usually ' '
/// (space) or '\n' (line feed).
/// </param>
/// <param name="offset">
/// Position within <paramref name="typeString"/> where the parse
/// should start. Updated with the new position (just past
/// <paramref name="endMark"/> when the parse is successful).
/// </param>
/// <returns>
/// A type code constant (one of <see cref="OBJ_BLOB"/>,
/// <see cref="OBJ_COMMIT"/>, <see cref="OBJ_TAG"/>, <see cref="OBJ_TREE"/>
/// </returns>
/// <exception cref="CorruptObjectException"></exception>
public static int decodeTypeString(AnyObjectId id, byte[] typeString, byte endMark, MutableInteger offset)
{
try
{
int position = offset.value;
switch (typeString[position])
{
case (byte)'b':
if (typeString[position + 1] != (byte)'l'
|| typeString[position + 2] != (byte)'o'
|| typeString[position + 3] != (byte)'b'
|| typeString[position + 4] != endMark)
{
throw new CorruptObjectException(id, "invalid type");
}
offset.value = position + 5;
return OBJ_BLOB;
case (byte)'c':
if (typeString[position + 1] != (byte)'o'
|| typeString[position + 2] != (byte)'m'
|| typeString[position + 3] != (byte)'m'
|| typeString[position + 4] != (byte)'i'
|| typeString[position + 5] != (byte)'t'
|| typeString[position + 6] != endMark)
{
throw new CorruptObjectException(id, "invalid type");
}
offset.value = position + 7;
return OBJ_COMMIT;
case (byte)'t':
switch (typeString[position + 1])
{
case (byte)'a':
if (typeString[position + 2] != (byte)'g'
|| typeString[position + 3] != endMark)
throw new CorruptObjectException(id, "invalid type");
offset.value = position + 4;
return OBJ_TAG;
case (byte)'r':
if (typeString[position + 2] != (byte)'e'
|| typeString[position + 3] != (byte)'e'
|| typeString[position + 4] != endMark)
throw new CorruptObjectException(id, "invalid type");
offset.value = position + 5;
return OBJ_TREE;
default:
throw new CorruptObjectException(id, "invalid type");
}
default:
throw new CorruptObjectException(id, "invalid type");
}
}
catch (IndexOutOfRangeException)
{
throw new CorruptObjectException(id, "invalid type");
}
}
示例10: FindCRC32
public override long FindCRC32(AnyObjectId objId)
{
int levelOne = objId.GetFirstByte();
int levelTwo = BinarySearchLevelTwo(objId, levelOne);
if (levelTwo == -1)
{
throw new MissingObjectException(objId.Copy(), ObjectType.Unknown);
}
return NB.DecodeUInt32(_crc32[levelOne], levelTwo << 2);
}
示例11: FindOffset
public override long FindOffset(AnyObjectId objId)
{
int levelOne = objId.GetFirstByte();
int levelTwo = BinarySearchLevelTwo(objId, levelOne);
if (levelTwo == -1)
{
return -1;
}
long p = NB.DecodeUInt32(_offset32[levelOne], levelTwo << 2);
if ((p & IS_O64) != 0)
{
return NB.DecodeUInt64(_offset64, (8 * (int)(p & ~IS_O64)));
}
return p;
}
示例12: writeLooseRef
private void writeLooseRef(string name, AnyObjectId id)
{
writeLooseRef(name, id.Name + "\n");
}
示例13: writePackedRef
private void writePackedRef(string name, AnyObjectId id)
{
writePackedRefs(id.Name + " " + name + "\n");
}
示例14: CanonicalTreeParser
/**
* Create a new parser for a tree appearing in a subset of a repository.
*
* @param prefix
* position of this iterator in the repository tree. The value
* may be null or the empty array to indicate the prefix is the
* root of the repository. A trailing slash ('/') is
* automatically appended if the prefix does not end in '/'.
* @param repo
* repository to load the tree data from.
* @param treeId
* identity of the tree being parsed; used only in exception
* messages if data corruption is found.
* @param curs
* a window cursor to use during data access from the repository.
* @throws MissingObjectException
* the object supplied is not available from the repository.
* @throws IncorrectObjectTypeException
* the object supplied as an argument is not actually a tree and
* cannot be parsed as though it were a tree.
* @throws IOException
* a loose object or pack file could not be read.
*/
public CanonicalTreeParser(byte[] prefix, Repository repo, AnyObjectId treeId, WindowCursor curs)
: base(prefix)
{
reset(repo, treeId, curs);
}
示例15: openObject
/**
* @param curs
* temporary working space associated with the calling thread.
* @param id
* SHA-1 of an object.
*
* @return a {@link ObjectLoader} for accessing the data of the named
* object, or null if the object does not exist.
* @
*/
public ObjectLoader openObject(WindowCursor curs, AnyObjectId id)
{
return objectDatabase.openObject(curs, id);
}