/// <summary> /// Mark an object to not produce in the output. /// <para /> /// Uninteresting objects denote not just themselves but also their entire /// reachable chain, back until the merge base of an uninteresting commit and /// an otherwise interesting commit. /// <para /> /// Callers are encouraged to use <see cref="RevWalk.parseAny(AnyObjectId)"/> /// instead of <see cref="RevWalk.lookupAny(AnyObjectId, int)"/>, as this method /// requires the object to be parsed before it can be added as a root for the /// traversal. /// <para /> /// The method will automatically parse an unparsed object, but error /// handling may be more difficult for the application to explain why a /// RevObject is not actually valid. The object pool of this walker would /// also be 'poisoned' by the invalid <see cref="RevObject"/>. /// <para /> /// This method will automatically call <see cref="RevWalk.markStart(RevCommit)"/> /// if passed RevCommit instance, or a <see cref="RevTag"/> that directly (or indirectly) /// references a <see cref="RevCommit"/>. /// </summary> /// <param name="o"> /// The object to start traversing from. The object passed must be /// from this same revision walker. /// </param> /// <exception cref="MissingObjectException"> /// The object supplied is not available from the object /// database. This usually indicates the supplied object is /// invalid, but the reference was constructed during an earlier /// invocation to <see cref="RevWalk.lookupAny(AnyObjectId, int)"/>. /// </exception> /// <exception cref="IncorrectObjectTypeException"> /// The object was not parsed yet and it was discovered during /// parsing that it is not actually the type of the instance /// passed in. This usually indicates the caller used the wrong /// type in a <see cref="RevWalk.lookupAny(AnyObjectId, int)"/> call. /// </exception> /// <exception cref="Exception"> /// A pack file or loose object could not be Read. /// </exception> public void markUninteresting(RevObject o) { RevTag oTag = (o as RevTag); while (oTag != null) { o.Flags |= UNINTERESTING; if (hasRevSort(RevSort.BOUNDARY)) { AddObject(o); } o = oTag.getObject(); parseHeaders(o); } RevCommit oComm = (o as RevCommit); if (oComm != null) { base.markUninteresting(oComm); } else if (o is RevTree) { MarkTreeUninteresting(o); } else { o.Flags |= UNINTERESTING; } if (o.Type != Constants.OBJ_COMMIT && hasRevSort(RevSort.BOUNDARY)) { AddObject(o); } }
/// <summary> /// Verify all interesting objects are available, and reachable. /// <para /> /// Callers should populate starting points and ending points with /// <see cref="markStart(RevObject)"/> and <see cref="markUninteresting(RevObject)"/> /// and then use this method to verify all objects between those two points /// exist in the repository and are readable. /// <para /> /// This method returns successfully if everything is connected; it throws an /// exception if there is a connectivity problem. The exception message /// provides some detail about the connectivity failure. /// </summary> /// <exception cref="MissingObjectException"> /// One or or more of the next objects are not available from the /// object database, but were thought to be candidates for /// traversal. This usually indicates a broken link. /// </exception> /// <exception cref="IncorrectObjectTypeException"> /// One or or more of the objects in a tree do not match the type /// indicated. /// </exception> /// <exception cref="Exception"> /// A pack file or loose object could not be Read. /// </exception> public void checkConnectivity() { while (true) { RevCommit c = next(); if (c == null) { break; } } while (true) { RevObject o = nextObject(); if (o == null) { break; } if (o is RevBlob && !Repository.HasObject(o)) { throw new MissingObjectException(o, Constants.TYPE_BLOB); } } }
public override void Dispose() { base.Dispose(); _pendingObjects = new BlockObjQueue(); _treeWalk = new CanonicalTreeParser(); _currentTree = null; last = null; }
internal override void reset(int retainFlags) { base.reset(retainFlags); _pendingObjects = new BlockObjQueue(); _treeWalk = new CanonicalTreeParser(); _currentTree = null; last = null; }
private void AddObject(RevObject obj) { if ((obj.Flags & InPending) != 0) { return; } obj.Flags |= InPending; _pendingObjects.add(obj); }
private CanonicalTreeParser enter(RevObject tree) { CanonicalTreeParser p = _treeWalk.createSubtreeIterator0(Repository, tree, WindowCursor); if (p.eof()) { // We can't tolerate the subtree being an empty tree, as // that will break us out early before we visit all names. // If it is, advance to the parent's next record. // return(_treeWalk.next()); } return(p); }
public bool Equals(RevObject other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(base.Equals(other) && other.Flags == Flags); }
public void parseCanonical(RevWalk walk, byte[] rawTag) { var pos = new MutableInteger { value = 53 }; int oType = Constants.decodeTypeString(this, rawTag, (byte)'\n', pos); walk.IdBuffer.FromString(rawTag, 7); _object = walk.lookupAny(walk.IdBuffer, oType); int p = pos.value += 4; // "tag " int nameEnd = RawParseUtils.nextLF(rawTag, p) - 1; _tagName = RawParseUtils.decode(Constants.CHARSET, rawTag, p, nameEnd); if (walk.isRetainBody()) _buffer = rawTag; Flags |= PARSED; }
private void MarkTreeUninteresting(RevObject tree) { if ((tree.Flags & UNINTERESTING) != 0) { return; } tree.Flags |= UNINTERESTING; _treeWalk = _treeWalk.resetRoot(Repository, tree, WindowCursor); while (!_treeWalk.eof()) { FileMode mode = _treeWalk.EntryFileMode; var sType = (int)mode.ObjectType; switch (sType) { case Constants.OBJ_BLOB: _treeWalk.getEntryObjectId(IdBuffer); lookupBlob(IdBuffer).Flags |= UNINTERESTING; break; case Constants.OBJ_TREE: _treeWalk.getEntryObjectId(IdBuffer); RevTree t = lookupTree(IdBuffer); if ((t.Flags & UNINTERESTING) == 0) { t.Flags |= UNINTERESTING; _treeWalk = _treeWalk.createSubtreeIterator0(Repository, t, WindowCursor); continue; } break; default: if (FileMode.GitLink == FileMode.FromBits(mode.Bits)) { break; } _treeWalk.getEntryObjectId(IdBuffer); throw new CorruptObjectException("Invalid mode " + mode + " for " + IdBuffer + " " + _treeWalk.EntryPathString + " in " + tree + "."); } _treeWalk = _treeWalk.next(); } }
/// <summary> /// Mark an object or commit to start graph traversal from. /// <para /> /// Callers are encouraged to use <see cref="RevWalk.parseAny(AnyObjectId)"/> /// instead of <see cref="RevWalk.lookupAny(AnyObjectId, int)"/>, as this method /// requires the object to be parsed before it can be added as a root for the /// traversal. /// <para /> /// The method will automatically parse an unparsed object, but error /// handling may be more difficult for the application to explain why a /// RevObject is not actually valid. The object pool of this walker would /// also be 'poisoned' by the invalid <see cref="RevObject"/>. /// <para /> /// This method will automatically call <see cref="RevWalk.markStart(RevCommit)"/> /// if passed RevCommit instance, or a <see cref="RevTag"/> that directly (or indirectly) /// references a <see cref="RevCommit"/>. /// </summary> /// <param name="o"> /// The object to start traversing from. The object passed must be /// from this same revision walker. /// </param> /// <exception cref="MissingObjectException"> /// The object supplied is not available from the object /// database. This usually indicates the supplied object is /// invalid, but the reference was constructed during an earlier /// invocation to <see cref="RevWalk.lookupAny(AnyObjectId, int)"/>. /// </exception> /// <exception cref="IncorrectObjectTypeException"> /// The object was not parsed yet and it was discovered during /// parsing that it is not actually the type of the instance /// passed in. This usually indicates the caller used the wrong /// type in a <see cref="RevWalk.lookupAny(AnyObjectId, int)"/> call. /// </exception> /// <exception cref="Exception"> /// A pack file or loose object could not be Read. /// </exception> public void markStart(RevObject o) { while (o is RevTag) { AddObject(o); o = ((RevTag)o).getObject(); parseHeaders(o); } RevCommit oComm = (o as RevCommit); if (oComm != null) { base.markStart(oComm); } else { AddObject(o); } }
public void parseCanonical(RevWalk walk, byte[] rawTag) { var pos = new MutableInteger { value = 53 }; int oType = Constants.decodeTypeString(this, rawTag, (byte)'\n', pos); walk.IdBuffer.FromString(rawTag, 7); _object = walk.lookupAny(walk.IdBuffer, oType); int p = pos.value += 4; // "tag " int nameEnd = RawParseUtils.nextLF(rawTag, p) - 1; _tagName = RawParseUtils.decode(Constants.CHARSET, rawTag, p, nameEnd); if (walk.isRetainBody()) { _buffer = rawTag; } Flags |= PARSED; }
private void ProcessBlob(RevObject obj) { if (!_local.HasObject(obj)) { throw new TransportException("Cannot Read blob " + obj.Name, new MissingObjectException(obj, Constants.TYPE_BLOB)); } obj.add(COMPLETE); }
private void MarkCommon(RevObject obj) { obj.add(COMMON); RevCommit oComm = (obj as RevCommit); if (oComm != null) { oComm.carry(COMMON); } }
/// <summary> /// Pop the next most recent object. /// </summary> /// <returns>next most recent object; null if traversal is over.</returns> /// <exception cref="MissingObjectException"> /// One or or more of the next objects are not available from the /// object database, but were thought to be candidates for /// traversal. This usually indicates a broken link. /// </exception> /// <exception cref="IncorrectObjectTypeException"> /// One or or more of the objects in a tree do not match the type indicated. /// </exception> /// <exception cref="Exception"> /// A pack file or loose object could not be Read. /// </exception> public RevObject nextObject() { if (last != null) { _treeWalk = last is RevTree ? enter(last) : _treeWalk.next(); } while (!_treeWalk.eof()) { FileMode mode = _treeWalk.EntryFileMode; switch ((int)mode.ObjectType) { case Constants.OBJ_BLOB: _treeWalk.getEntryObjectId(IdBuffer); RevBlob blob = lookupBlob(IdBuffer); if ((blob.Flags & SEEN) != 0) break; blob.Flags |= SEEN; if (ShouldSkipObject(blob)) break; last = blob; return blob; case Constants.OBJ_TREE: _treeWalk.getEntryObjectId(IdBuffer); RevTree tree = lookupTree(IdBuffer); if ((tree.Flags & SEEN) != 0) break; tree.Flags |= SEEN; if (ShouldSkipObject(tree)) break; last = tree; return tree; default: if (FileMode.GitLink.Equals(mode.Bits)) break; _treeWalk.getEntryObjectId(IdBuffer); throw new CorruptObjectException("Invalid mode " + mode + " for " + IdBuffer.Name + " '" + _treeWalk.EntryPathString + "' in " + _currentTree.Name + "."); } _treeWalk = _treeWalk.next(); } last = null; while (true) { RevObject obj = _pendingObjects.next(); if (obj == null) return null; if ((obj.Flags & SEEN) != 0) continue; obj.Flags |= SEEN; if (ShouldSkipObject(obj)) continue; RevTree oTree = (obj as RevTree); if (oTree != null) { _currentTree = oTree; _treeWalk = _treeWalk.resetRoot(Repository, _currentTree, WindowCursor); } return obj; } }
private void AddObject(RevObject obj) { if ((obj.Flags & InPending) != 0) return; obj.Flags |= InPending; _pendingObjects.add(obj); }
private void advertiseAnyOnce(RevObject obj, string refName) { if (!obj.has(ADVERTISED)) { advertiseAny(obj, refName); } }
/// <summary> /// Mark an object or commit to start graph traversal from. /// <para /> /// Callers are encouraged to use <see cref="RevWalk.parseAny(AnyObjectId)"/> /// instead of <see cref="RevWalk.lookupAny(AnyObjectId, int)"/>, as this method /// requires the object to be parsed before it can be added as a root for the /// traversal. /// <para /> /// The method will automatically parse an unparsed object, but error /// handling may be more difficult for the application to explain why a /// RevObject is not actually valid. The object pool of this walker would /// also be 'poisoned' by the invalid <see cref="RevObject"/>. /// <para /> /// This method will automatically call <see cref="RevWalk.markStart(RevCommit)"/> /// if passed RevCommit instance, or a <see cref="RevTag"/> that directly (or indirectly) /// references a <see cref="RevCommit"/>. /// </summary> /// <param name="o"> /// The object to start traversing from. The object passed must be /// from this same revision walker. /// </param> /// <exception cref="MissingObjectException"> /// The object supplied is not available from the object /// database. This usually indicates the supplied object is /// invalid, but the reference was constructed during an earlier /// invocation to <see cref="RevWalk.lookupAny(AnyObjectId, int)"/>. /// </exception> /// <exception cref="IncorrectObjectTypeException"> /// The object was not parsed yet and it was discovered during /// parsing that it is not actually the type of the instance /// passed in. This usually indicates the caller used the wrong /// type in a <see cref="RevWalk.lookupAny(AnyObjectId, int)"/> call. /// </exception> /// <exception cref="Exception"> /// A pack file or loose object could not be Read. /// </exception> public void markStart(RevObject o) { RevTag oTag = (o as RevTag); while (oTag != null) { AddObject(o); o = oTag.getObject(); parseHeaders(o); } RevCommit oComm = (o as RevCommit); if (oComm != null) { base.markStart(oComm); } else { AddObject(o); } }
private bool ShouldSkipObject(RevObject o) { return((o.Flags & UNINTERESTING) != 0 && !hasRevSort(RevSort.BOUNDARY)); }
public bool Equals(RevObject other) { if (ReferenceEquals(null, other)) { return false; } if (ReferenceEquals(this, other)) { return true; } return base.Equals(other) && other.Flags == Flags; }
private void MarkTreeComplete(RevObject tree) { if (tree.has(COMPLETE)) return; tree.add(COMPLETE); _treeWalk.reset(tree); while (_treeWalk.next()) { FileMode mode = _treeWalk.getFileMode(0); int sType = mode.Bits; switch (sType) { case Constants.OBJ_BLOB: _treeWalk.getObjectId(_idBuffer, 0); _revWalk.lookupAny(_idBuffer, sType).add(COMPLETE); continue; case Constants.OBJ_TREE: { _treeWalk.getObjectId(_idBuffer, 0); RevObject o = _revWalk.lookupAny(_idBuffer, sType); if (!o.has(COMPLETE)) { o.add(COMPLETE); _treeWalk.enterSubtree(); } continue; } default: if (FileMode.GitLink.Equals(sType)) continue; _treeWalk.getObjectId(_idBuffer, 0); throw new CorruptObjectException("Invalid mode " + mode + " for " + _idBuffer.Name + " " + _treeWalk.getPathString() + " in " + tree.Name); } } }
/// <summary> /// Pop the next most recent object. /// </summary> /// <returns>next most recent object; null if traversal is over.</returns> /// <exception cref="MissingObjectException"> /// One or or more of the next objects are not available from the /// object database, but were thought to be candidates for /// traversal. This usually indicates a broken link. /// </exception> /// <exception cref="IncorrectObjectTypeException"> /// One or or more of the objects in a tree do not match the type indicated. /// </exception> /// <exception cref="Exception"> /// A pack file or loose object could not be Read. /// </exception> public RevObject nextObject() { _fromTreeWalk = false; if (_nextSubtree != null) { _treeWalk = _treeWalk.createSubtreeIterator0(Repository, _nextSubtree, WindowCursor); _nextSubtree = null; } while (!_treeWalk.eof()) { FileMode mode = _treeWalk.EntryFileMode; var sType = (int)mode.ObjectType; switch (sType) { case Constants.OBJ_BLOB: _treeWalk.getEntryObjectId(IdBuffer); RevBlob blob = lookupBlob(IdBuffer); if ((blob.Flags & SEEN) != 0) { break; } blob.Flags |= SEEN; if (ShouldSkipObject(blob)) { break; } _fromTreeWalk = true; return(blob); case Constants.OBJ_TREE: _treeWalk.getEntryObjectId(IdBuffer); RevTree tree = lookupTree(IdBuffer); if ((tree.Flags & SEEN) != 0) { break; } tree.Flags |= SEEN; if (ShouldSkipObject(tree)) { break; } _nextSubtree = tree; _fromTreeWalk = true; return(tree); default: if (FileMode.GitLink.Equals(mode.Bits)) { break; } _treeWalk.getEntryObjectId(IdBuffer); throw new CorruptObjectException("Invalid mode " + mode + " for " + IdBuffer + " " + _treeWalk.EntryPathString + " in " + _currentTree + "."); } _treeWalk = _treeWalk.next(); } while (true) { RevObject obj = _pendingObjects.next(); if (obj == null) { return(null); } if ((obj.Flags & SEEN) != 0) { continue; } obj.Flags |= SEEN; if (ShouldSkipObject(obj)) { continue; } RevTree oTree = (obj as RevTree); if (oTree != null) { _currentTree = oTree; _treeWalk = _treeWalk.resetRoot(Repository, _currentTree, WindowCursor); } return(obj); } }
private void ProcessTree(RevObject obj) { try { _treeWalk.reset(obj); while (_treeWalk.next()) { FileMode mode = _treeWalk.getFileMode(0); int sType = mode.Bits; switch (sType) { case Constants.OBJ_BLOB: case Constants.OBJ_TREE: _treeWalk.getObjectId(_idBuffer, 0); Needs(_revWalk.lookupAny(_idBuffer, sType)); continue; default: if (FileMode.GitLink.Equals(sType)) continue; _treeWalk.getObjectId(_idBuffer, 0); throw new CorruptObjectException("Invalid mode " + mode + " for " + _idBuffer.Name + " " + _treeWalk.getPathString() + " in " + obj.getId().Name + "."); } } } catch (IOException ioe) { throw new TransportException("Cannot Read tree " + obj.Name, ioe); } obj.add(COMPLETE); }
private void ProcessTag(RevObject obj) { var tag = (RevTag)obj; Needs(tag.getObject()); obj.add(COMPLETE); }
private void ProcessCommit(RevObject obj) { var commit = (RevCommit)obj; MarkLocalCommitsComplete(commit.CommitTime); Needs(commit.Tree); foreach (RevCommit p in commit.Parents) { Needs(p); } obj.add(COMPLETE); }
private void Want(RevObject o) { if (o.has(WANT)) return; o.add(WANT); _wantAll.Add(o); if (o is RevCommit) _wantCommits.Add((RevCommit)o); else if (o is RevTag) { do { o = ((RevTag)o).getObject(); } while (o is RevTag); if (o is RevCommit) Want(o); } }
/// <summary> /// Mark an object to not produce in the output. /// <para /> /// Uninteresting objects denote not just themselves but also their entire /// reachable chain, back until the merge base of an uninteresting commit and /// an otherwise interesting commit. /// <para /> /// Callers are encouraged to use <see cref="RevWalk.parseAny(AnyObjectId)"/> /// instead of <see cref="RevWalk.lookupAny(AnyObjectId, int)"/>, as this method /// requires the object to be parsed before it can be added as a root for the /// traversal. /// <para /> /// The method will automatically parse an unparsed object, but error /// handling may be more difficult for the application to explain why a /// RevObject is not actually valid. The object pool of this walker would /// also be 'poisoned' by the invalid <see cref="RevObject"/>. /// <para /> /// This method will automatically call <see cref="RevWalk.markStart(RevCommit)"/> /// if passed RevCommit instance, or a <see cref="RevTag"/> that directly (or indirectly) /// references a <see cref="RevCommit"/>. /// </summary> /// <param name="o"> /// The object to start traversing from. The object passed must be /// from this same revision walker. /// </param> /// <exception cref="MissingObjectException"> /// The object supplied is not available from the object /// database. This usually indicates the supplied object is /// invalid, but the reference was constructed during an earlier /// invocation to <see cref="RevWalk.lookupAny(AnyObjectId, int)"/>. /// </exception> /// <exception cref="IncorrectObjectTypeException"> /// The object was not parsed yet and it was discovered during /// parsing that it is not actually the type of the instance /// passed in. This usually indicates the caller used the wrong /// type in a <see cref="RevWalk.lookupAny(AnyObjectId, int)"/> call. /// </exception> /// <exception cref="Exception"> /// A pack file or loose object could not be Read. /// </exception> public void markUninteresting(RevObject o) { while (o is RevTag) { o.Flags |= UNINTERESTING; if (hasRevSort(RevSort.BOUNDARY)) { AddObject(o); } o = ((RevTag)o).getObject(); parseHeaders(o); } if (o is RevCommit) { base.markUninteresting((RevCommit)o); } else if (o is RevTree) { MarkTreeUninteresting(o); } else { o.Flags |= UNINTERESTING; } if (o.Type != Constants.OBJ_COMMIT && hasRevSort(RevSort.BOUNDARY)) { AddObject(o); } }
private void AddCommonBase(RevObject o) { if (o.has(COMMON)) return; o.add(COMMON); _commonBase.Add(o); okToGiveUp = null; }
/// <summary> /// Mark an object or commit to start graph traversal from. /// <para /> /// Callers are encouraged to use <see cref="RevWalk.parseAny(AnyObjectId)"/> /// instead of <see cref="RevWalk.lookupAny(AnyObjectId, int)"/>, as this method /// requires the object to be parsed before it can be added as a root for the /// traversal. /// <para /> /// The method will automatically parse an unparsed object, but error /// handling may be more difficult for the application to explain why a /// RevObject is not actually valid. The object pool of this walker would /// also be 'poisoned' by the invalid <see cref="RevObject"/>. /// <para /> /// This method will automatically call <see cref="RevWalk.markStart(RevCommit)"/> /// if passed RevCommit instance, or a <see cref="RevTag"/> that directly (or indirectly) /// references a <see cref="RevCommit"/>. /// </summary> /// <param name="o"> /// The object to start traversing from. The object passed must be /// from this same revision walker. /// </param> /// <exception cref="MissingObjectException"> /// The object supplied is not available from the object /// database. This usually indicates the supplied object is /// invalid, but the reference was constructed during an earlier /// invocation to <see cref="RevWalk.lookupAny(AnyObjectId, int)"/>. /// </exception> /// <exception cref="IncorrectObjectTypeException"> /// The object was not parsed yet and it was discovered during /// parsing that it is not actually the type of the instance /// passed in. This usually indicates the caller used the wrong /// type in a <see cref="RevWalk.lookupAny(AnyObjectId, int)"/> call. /// </exception> /// <exception cref="Exception"> /// A pack file or loose object could not be Read. /// </exception> public void markStart(RevObject o) { while (o is RevTag) { AddObject(o); o = ((RevTag)o).getObject(); parseHeaders(o); } if (o is RevCommit) { base.markStart((RevCommit)o); } else { AddObject(o); } }
private void advertiseAny(RevObject obj, string refName) { obj.add(ADVERTISED); advertiseId(obj, refName); }
private void MarkLocalObjComplete(RevObject obj) { while (obj.Type == Constants.OBJ_TAG) { obj.add(COMPLETE); obj.DisposeBody(); obj = ((RevTag)obj).getObject(); _revWalk.parseHeaders(obj); } switch (obj.Type) { case Constants.OBJ_BLOB: obj.add(COMPLETE); break; case Constants.OBJ_COMMIT: PushLocalCommit((RevCommit)obj); break; case Constants.OBJ_TREE: MarkTreeComplete(obj); break; } }
private void MarkTreeUninteresting(RevObject tree) { if ((tree.Flags & UNINTERESTING) != 0) return; tree.Flags |= UNINTERESTING; _treeWalk = _treeWalk.resetRoot(Repository, tree, WindowCursor); while (!_treeWalk.eof()) { FileMode mode = _treeWalk.EntryFileMode; var sType = (int)mode.ObjectType; switch (sType) { case Constants.OBJ_BLOB: _treeWalk.getEntryObjectId(IdBuffer); lookupBlob(IdBuffer).Flags |= UNINTERESTING; break; case Constants.OBJ_TREE: _treeWalk.getEntryObjectId(IdBuffer); RevTree t = lookupTree(IdBuffer); if ((t.Flags & UNINTERESTING) == 0) { t.Flags |= UNINTERESTING; _treeWalk = _treeWalk.createSubtreeIterator0(Repository, t, WindowCursor); continue; } break; default: if (FileMode.GitLink == FileMode.FromBits(mode.Bits)) break; _treeWalk.getEntryObjectId(IdBuffer); throw new CorruptObjectException("Invalid mode " + mode + " for " + IdBuffer + " " + _treeWalk.EntryPathString + " in " + tree + "."); } _treeWalk = _treeWalk.next(); } }
private void Want(RevObject o) { if (o.has(WANT)) return; o.add(WANT); _wantAll.Add(o); RevTag oTag = (o as RevTag); while (oTag != null) { o = oTag.getObject(); oTag = (o as RevTag); } RevCommit oComm = (o as RevCommit); if (oComm != null) { _wantCommits.Add(oComm); } }
public void testWritePack3() { _writer.ReuseDeltas = false; var forcedOrder = new[] { ObjectId.FromString("82c6b885ff600be425b4ea96dee75dca255b69e7"), ObjectId.FromString("c59759f143fb1fe21c197981df75a7ee00290799"), ObjectId.FromString("aabf2ffaec9b497f0950352b3e582d73035c2035"), ObjectId.FromString("902d5476fa249b7abc9d84c611577a81381f0327"), ObjectId.FromString("5b6e7c66c276e7610d4a73c70ec1a1f7c1003259"), ObjectId.FromString("6ff87c4664981e4397625791c8ea3bbb5f2279a3") }; var parser = new GitSharp.Core.RevWalk.RevWalk(db); var forcedOrderRevs = new RevObject[forcedOrder.Length]; for (int i = 0; i < forcedOrder.Length; i++) { forcedOrderRevs[i] = parser.parseAny(forcedOrder[i]); } CreateVerifyOpenPack(forcedOrderRevs.AsEnumerable()); Assert.AreEqual(forcedOrder.Length, _writer.getObjectsNumber()); VerifyObjectsOrder(forcedOrder); Assert.AreEqual("ed3f96b8327c7c66b0f8f70056129f0769323d86", _writer.computeName().Name); }
private CanonicalTreeParser enter(RevObject tree) { CanonicalTreeParser p = _treeWalk.createSubtreeIterator0(Repository, tree, WindowCursor); if (p.eof()) { // We can't tolerate the subtree being an empty tree, as // that will break us out early before we visit all names. // If it is, advance to the parent's next record. // return _treeWalk.next(); } return p; }
private void Needs(RevObject obj) { if (obj.has(COMPLETE)) return; if (!obj.has(IN_WORK_QUEUE)) { obj.add(IN_WORK_QUEUE); _workQueue.AddLast(obj); } }
private bool ShouldSkipObject(RevObject o) { return (o.Flags & UNINTERESTING) != 0 && !hasRevSort(RevSort.BOUNDARY); }
private void MarkCommon(RevObject obj) { obj.add(COMMON); if (obj is RevCommit) { ((RevCommit)obj).carry(COMMON); } }