本文整理汇总了C#中AnyObjectId.Copy方法的典型用法代码示例。如果您正苦于以下问题:C# AnyObjectId.Copy方法的具体用法?C# AnyObjectId.Copy怎么用?C# AnyObjectId.Copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyObjectId
的用法示例。
在下文中一共展示了AnyObjectId.Copy方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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);
}
示例4: RecordError
private void RecordError(AnyObjectId id, Exception e)
{
ObjectId objId = id.Copy();
if (_fetchErrors.ContainsKey(objId))
{
_fetchErrors[objId].Add(e);
}
else
{
_fetchErrors.Add(objId, new List<Exception>(2) { e });
}
}
示例5: DownloadObject
private void DownloadObject(ProgressMonitor pm, AnyObjectId id)
{
if (_local.HasObject(id)) return;
while (true)
{
if (DownloadPackedObject(pm, id))
return;
string idStr = id.Name;
string subdir = idStr.Slice(0, 2);
string file = idStr.Substring(2);
string looseName = subdir + "/" + file;
for (int i = _lastRemoteIdx; i < _remotes.Count; i++)
{
if (DownloadLooseObject(id, looseName, _remotes[i]))
{
_lastRemoteIdx = i;
return;
}
}
for (int i = 0; i < _lastRemoteIdx; i++)
{
if (DownloadLooseObject(id, looseName, _remotes[i]))
{
_lastRemoteIdx = i;
return;
}
}
while (_noPacksYet.Count > 0)
{
WalkRemoteObjectDatabase wrr = _noPacksYet.First.Value;
_noPacksYet.RemoveFirst();
List<string> packNameList;
try
{
pm.BeginTask("Listing packs", ProgressMonitor.UNKNOWN);
packNameList = wrr.getPackNames();
}
catch (IOException e)
{
RecordError(id, e);
continue;
}
finally
{
pm.EndTask();
}
if (packNameList == null || packNameList.Count == 0)
continue;
foreach (string packName in packNameList)
{
if (!_packsConsidered.Contains(packName))
{
_packsConsidered.Add(packName);
_unfetchedPacks.AddLast(new RemotePack(_lockMessage, _packLocks, _objCheck, _local, wrr, packName));
}
}
if (DownloadPackedObject(pm, id))
return;
}
List<WalkRemoteObjectDatabase> al = ExpandOneAlternate(id, pm);
if (al != null && al.Count > 0)
{
foreach (WalkRemoteObjectDatabase alt in al)
{
_remotes.Add(alt);
_noPacksYet.AddLast(alt);
_noAlternatesYet.AddLast(alt);
}
continue;
}
List<Exception> failures = null;
if (_fetchErrors.ContainsKey(id.Copy()))
{
failures = _fetchErrors[id.Copy()];
}
TransportException te = null;
if (failures != null && failures.Count > 0)
{
te = failures.Count == 1 ?
new TransportException("Cannot get " + id.Name + ".", failures[0]) :
new TransportException("Cannot get " + id.Name + ".", new CompoundException(failures));
}
if (te == null)
{
te = new TransportException("Cannot get " + id.Name + ".");
}
throw te;
}
}
示例6: RecordError
private void RecordError(AnyObjectId id, Exception what)
{
ObjectId objId = id.Copy();
List<Exception> errors = _fetchErrors.get(objId);
if (errors == null)
{
errors = new List<Exception>(2);
_fetchErrors.put(objId, errors);
}
errors.Add(what);
}
示例7: DownloadObject
private void DownloadObject(ProgressMonitor pm, AnyObjectId id)
{
if (_local.HasObject(id)) return;
while (true)
{
// Try a pack file we know about, but don't have yet. Odds are
// that if it has this object, it has others related to it so
// getting the pack is a good bet.
//
if (DownloadPackedObject(pm, id))
return;
// Search for a loose object over all alternates, starting
// from the one we last successfully located an object through.
//
string idStr = id.Name;
string subdir = idStr.Slice(0, 2);
string file = idStr.Substring(2);
string looseName = subdir + "/" + file;
for (int i = _lastRemoteIdx; i < _remotes.Count; i++)
{
if (DownloadLooseObject(id, looseName, _remotes[i]))
{
_lastRemoteIdx = i;
return;
}
}
for (int i = 0; i < _lastRemoteIdx; i++)
{
if (DownloadLooseObject(id, looseName, _remotes[i]))
{
_lastRemoteIdx = i;
return;
}
}
// Try to obtain more pack information and search those.
//
while (_noPacksYet.Count > 0)
{
WalkRemoteObjectDatabase wrr = _noPacksYet.First.Value;
_noPacksYet.RemoveFirst();
ICollection<string> packNameList;
try
{
pm.BeginTask("Listing packs", ProgressMonitor.UNKNOWN);
packNameList = wrr.getPackNames();
}
catch (IOException e)
{
// Try another repository.
//
RecordError(id, e);
continue;
}
finally
{
pm.EndTask();
}
if (packNameList == null || packNameList.Count == 0)
continue;
foreach (string packName in packNameList)
{
bool contains = _packsConsidered.Contains(packName);
_packsConsidered.Add(packName);
if (!contains)
{
_unfetchedPacks.AddLast(new RemotePack(_lockMessage, _packLocks, _objCheck, _local, wrr, packName));
}
}
if (DownloadPackedObject(pm, id))
return;
}
// Try to expand the first alternate we haven't expanded yet.
//
ICollection<WalkRemoteObjectDatabase> al = ExpandOneAlternate(id, pm);
if (al != null && al.Count > 0)
{
foreach (WalkRemoteObjectDatabase alt in al)
{
_remotes.Add(alt);
_noPacksYet.AddLast(alt);
_noAlternatesYet.AddLast(alt);
}
continue;
}
// We could not obtain the object. There may be reasons why.
//
List<Exception> failures = _fetchErrors.get(id.Copy());
var te = new TransportException("Cannot get " + id.Name + ".");
if (failures != null && failures.Count > 0)
{
//.........这里部分代码省略.........
示例8: setNewObjectId
public static void setNewObjectId(this RefUpdate refUpdate, AnyObjectId id)
{
refUpdate.NewObjectId = id.Copy();
}