C# Класс GitSharp.Core.DirectoryCache.DirCacheBuilder

Updates a DirCache by adding individual DirCacheEntrys. A builder always starts from a clean slate and appends in every single DirCacheEntry which the final updated index must have to reflect its new content. For maximum performance applications should add entries in path name order. Adding entries out of order is permitted, however a final sorting pass will be implicitly performed during finish() to correct any out-of-order entries. Duplicate detection is also delayed until the sorting is complete.
Наследование: GitSharp.Core.DirectoryCache.BaseDirCacheEditor
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
DirCacheBuilder ( DirCache dc, int ecnt ) : System

Construct a new builder.

add ( DirCacheEntry newEntry ) : void

Append one entry into the resulting entry list. The entry is placed at the end of the entry list. If the entry causes the list to now be incorrectly sorted a final sorting phase will be automatically enabled within finish(). The internal entry table is automatically expanded if there is insufficient space for the new addition.

addTree ( byte pathPrefix, int stage, Repository db, AnyObjectId tree ) : void

Recursively add an entire tree into this builder. If pathPrefix is "a/b" and the tree contains file "c" then the resulting DirCacheEntry will have the path "a/b/c". All entries are inserted at stage 0, therefore assuming that the application will not insert any other paths with the same pathPrefix.

finish ( ) : void
keep ( int pos, int cnt ) : void

Add a range of existing entries from the destination cache. The entries are placed at the end of the entry list. If any of the entries causes the list to now be incorrectly sorted a final sorting phase will be automatically enabled within finish(). This method copies from the destination cache, which has not yet been updated with this editor's new table. So all offsets into the destination cache are not affected by any updates that may be currently taking place in this editor. The internal entry table is automatically expanded if there is insufficient space for the new additions.

Приватные методы

Метод Описание
Bad ( DirCacheEntry a, string msg ) : InvalidOperationException
BeforeAdd ( DirCacheEntry newEntry ) : void
Resort ( ) : void
ToEntry ( int stage, TreeWalk tw ) : DirCacheEntry

Описание методов

DirCacheBuilder() публичный Метод

Construct a new builder.
public DirCacheBuilder ( DirCache dc, int ecnt ) : System
dc DirCache /// the cache this builder will eventually update. ///
ecnt int /// Estimated number of entries the builder will have upon /// completion. This sizes the initial entry table. ///
Результат System

add() публичный Метод

Append one entry into the resulting entry list. The entry is placed at the end of the entry list. If the entry causes the list to now be incorrectly sorted a final sorting phase will be automatically enabled within finish(). The internal entry table is automatically expanded if there is insufficient space for the new addition.
public add ( DirCacheEntry newEntry ) : void
newEntry DirCacheEntry the new entry to add.
Результат void

addTree() публичный Метод

Recursively add an entire tree into this builder. If pathPrefix is "a/b" and the tree contains file "c" then the resulting DirCacheEntry will have the path "a/b/c". All entries are inserted at stage 0, therefore assuming that the application will not insert any other paths with the same pathPrefix.
/// A tree cannot be read to iterate through its entries. ///
public addTree ( byte pathPrefix, int stage, Repository db, AnyObjectId tree ) : void
pathPrefix byte /// UTF-8 encoded prefix to mount the tree's entries at. If the /// path does not end with '/' one will be automatically inserted /// as necessary. ///
stage int Stage of the entries when adding them.
db Repository /// Repository the tree(s) will be read from during recursive /// traversal. This must be the same repository that the resulting /// would be written out to (or used in) otherwise /// the caller is simply asking for deferred MissingObjectExceptions. ///
tree AnyObjectId /// The tree to recursively add. This tree's contents will appear /// under . The ObjectId must be that of a /// tree; the caller is responsible for dereferencing a tag or /// commit (if necessary). ///
Результат void

finish() публичный Метод

public finish ( ) : void
Результат void

keep() публичный Метод

Add a range of existing entries from the destination cache. The entries are placed at the end of the entry list. If any of the entries causes the list to now be incorrectly sorted a final sorting phase will be automatically enabled within finish(). This method copies from the destination cache, which has not yet been updated with this editor's new table. So all offsets into the destination cache are not affected by any updates that may be currently taking place in this editor. The internal entry table is automatically expanded if there is insufficient space for the new additions.
public keep ( int pos, int cnt ) : void
pos int /// First entry to copy from the destination cache. ///
cnt int Number of entries to copy.
Результат void