C# 클래스 GitSharp.Core.DirectoryCache.DirCache

Support for the Git dircache (aka index file). The index file keeps track of which objects are currently checked out in the working directory, and the last modified time of those working files. Changes in the working directory can be detected by comparing the modification times to the cached modification time within the index file. Index files are also used during merges, where the merge happens within the index file first, and the working directory is updated as a post-merge step. Conflicts are stored in the index file to allow tool (and human) based resolutions to be easily performed.
파일 보기 프로젝트 열기: jagregory/GitSharp 1 사용 예제들

공개 메소드들

메소드 설명
Compare ( DirCacheEntry a, DirCacheEntry b ) : int
Compare ( byte aPath, int aLen, byte bPath, int bLen ) : int
DirCache ( FileInfo indexLocation ) : System

Create a new in-core index representation. The new index will be empty. Callers may wish to read from the on disk file first with read().

Lock ( FileInfo indexLocation ) : DirCache

Create a new in-core index representation, lock it, and read from disk. The new index will be locked and then read before it is returned to the caller. Read failures are reported as exceptions and therefore prevent the method from returning a partially populated index. On read failure, the lock is released.

Lock ( Repository db ) : DirCache

Create a new in-core index representation, lock it, and read from disk. The new index will be locked and then read before it is returned to the caller. Read failures are reported as exceptions and therefore prevent the method from returning a partially populated index.

Lock ( ) : bool

Try to establish an update lock on the cache file.

builder ( ) : DirCacheBuilder

Create a new builder to update this cache. Callers should add all entries to the builder, then use DirCacheBuilder.finish() to update this instance.

clear ( ) : void

Empty this index, removing all entries.

commit ( ) : bool

Commit this change and release the lock. If this method fails (returns false) the lock is still released.

editor ( ) : DirCacheEditor

Create a new editor to recreate this cache. Callers should add commands to the editor, then use DirCacheEditor.finish() to update this instance.

findEntry ( byte p, int pLen ) : int
findEntry ( string path ) : int

Locate the position a path's entry is at in the index. If there is at least one entry in the index for this path the position of the lowest stage is returned. Subsequent stages can be identified by testing consecutive entries until the path differs. If no path matches the entry -(position+1) is returned, where position is the location it would have gone within the index.

getCacheTree ( bool build ) : DirCacheTree

Obtain (or build) the current cache tree structure. This method can optionally recreate the cache tree, without flushing the tree objects themselves to disk.

getEntriesWithin ( string path ) : GitSharp.Core.DirectoryCache.DirCacheEntry[]

Recursively get all entries within a subtree.

getEntry ( int i ) : DirCacheEntry

Get a specific entry.

getEntry ( string path ) : DirCacheEntry

Get a specific entry.

getEntryCount ( ) : int

Total number of file entries stored in the index. This count includes unmerged stages for a file entry if the file is currently conflicted in a merge. This means the total number of entries in the index may be up to 3 times larger than the number of files in the working directory. Note that this value counts only files.

newInCore ( ) : DirCache

Create a new empty index which is never stored on disk.

nextEntry ( byte p, int pLen, int nextIdx ) : int
nextEntry ( int position ) : int

Determine the next index position past all entries with the same name. As index entries are sorted by path name, then stage number, this method advances the supplied position to the first position in the index whose path name does not match the path name of the supplied position's entry.

read ( FileInfo indexLocation ) : DirCache

Create a new in-core index representation and read an index from disk. The new index will be read before it is returned to the caller. Read failures are reported as exceptions and therefore prevent the method from returning a partially populated index.

read ( Repository db ) : DirCache

Create a new in-core index representation and read an index from disk. The new index will be read before it is returned to the caller. Read failures are reported as exceptions and therefore prevent the method from returning a partially populated index.

read ( ) : void

Read the index from disk, if it has changed on disk. This method tries to avoid loading the index if it has not changed since the last time we consulted it. A missing index file will be treated as though it were present but had no file entries in it.

replace ( DirCacheEntry e, int cnt ) : void
toArray ( int i, DirCacheEntry dst, int off, int cnt ) : void
unlock ( ) : void

Unlock this file and abort this change. The temporary file (if created) is deleted before returning.

write ( ) : void

Write the entry records from memory to disk. The cache must be locked first by calling Lock() and receiving true as the return value. Applications are encouraged to lock the index, then invoke read() to ensure the in-memory data is current, prior to updating the in-memory entries. Once written the lock is closed and must be either committed with commit() or rolled back with unlock().

writeTree ( ObjectWriter ow ) : ObjectId

Write all index trees to the object store, returning the root tree.

비공개 메소드들

메소드 설명
Compare ( byte aPath, int aLen, DirCacheEntry b ) : int
IsDIRC ( byte header ) : bool
ReadFrom ( Stream inStream ) : void
RequireLocked ( LockFile tmp ) : void
WriteTo ( Stream os ) : void

메소드 상세

Compare() 공개 정적인 메소드

public static Compare ( DirCacheEntry a, DirCacheEntry b ) : int
a DirCacheEntry
b DirCacheEntry
리턴 int

Compare() 공개 정적인 메소드

public static Compare ( byte aPath, int aLen, byte bPath, int bLen ) : int
aPath byte
aLen int
bPath byte
bLen int
리턴 int

DirCache() 공개 메소드

Create a new in-core index representation. The new index will be empty. Callers may wish to read from the on disk file first with read().
public DirCache ( FileInfo indexLocation ) : System
indexLocation System.IO.FileInfo location of the index file on disk.
리턴 System

Lock() 공개 정적인 메소드

Create a new in-core index representation, lock it, and read from disk. The new index will be locked and then read before it is returned to the caller. Read failures are reported as exceptions and therefore prevent the method from returning a partially populated index. On read failure, the lock is released.
/// The index file is present but could not be read, or the lock /// could not be obtained. /// /// the index file is using a format or extension that this /// library does not support. ///
public static Lock ( FileInfo indexLocation ) : DirCache
indexLocation System.IO.FileInfo /// location of the index file on disk. ///
리턴 DirCache

Lock() 공개 정적인 메소드

Create a new in-core index representation, lock it, and read from disk. The new index will be locked and then read before it is returned to the caller. Read failures are reported as exceptions and therefore prevent the method from returning a partially populated index.
/// The index file is present but could not be read, or the lock /// could not be obtained. /// /// The index file is using a format or extension that this /// library does not support. ///
public static Lock ( Repository db ) : DirCache
db Repository /// Repository the caller wants to read the default index of. ///
리턴 DirCache

Lock() 공개 메소드

Try to establish an update lock on the cache file.
/// The output file could not be created. The caller does not /// hold the lock. ///
public Lock ( ) : bool
리턴 bool

builder() 공개 메소드

Create a new builder to update this cache. Callers should add all entries to the builder, then use DirCacheBuilder.finish() to update this instance.
public builder ( ) : DirCacheBuilder
리턴 DirCacheBuilder

clear() 공개 메소드

Empty this index, removing all entries.
public clear ( ) : void
리턴 void

commit() 공개 메소드

Commit this change and release the lock. If this method fails (returns false) the lock is still released.
/// the lock is not held. ///
public commit ( ) : bool
리턴 bool

editor() 공개 메소드

Create a new editor to recreate this cache. Callers should add commands to the editor, then use DirCacheEditor.finish() to update this instance.
public editor ( ) : DirCacheEditor
리턴 DirCacheEditor

findEntry() 공개 메소드

public findEntry ( byte p, int pLen ) : int
p byte
pLen int
리턴 int

findEntry() 공개 메소드

Locate the position a path's entry is at in the index. If there is at least one entry in the index for this path the position of the lowest stage is returned. Subsequent stages can be identified by testing consecutive entries until the path differs. If no path matches the entry -(position+1) is returned, where position is the location it would have gone within the index.
public findEntry ( string path ) : int
path string The path to search for.
리턴 int

getCacheTree() 공개 메소드

Obtain (or build) the current cache tree structure. This method can optionally recreate the cache tree, without flushing the tree objects themselves to disk.
public getCacheTree ( bool build ) : DirCacheTree
build bool /// If true and the cache tree is not present in the index it will /// be generated and returned to the caller. ///
리턴 DirCacheTree

getEntriesWithin() 공개 메소드

Recursively get all entries within a subtree.
public getEntriesWithin ( string path ) : GitSharp.Core.DirectoryCache.DirCacheEntry[]
path string /// The subtree path to get all entries within. ///
리턴 GitSharp.Core.DirectoryCache.DirCacheEntry[]

getEntry() 공개 메소드

Get a specific entry.
public getEntry ( int i ) : DirCacheEntry
i int /// position of the entry to get. ///
리턴 DirCacheEntry

getEntry() 공개 메소드

Get a specific entry.
public getEntry ( string path ) : DirCacheEntry
path string The path to search for.
리턴 DirCacheEntry

getEntryCount() 공개 메소드

Total number of file entries stored in the index. This count includes unmerged stages for a file entry if the file is currently conflicted in a merge. This means the total number of entries in the index may be up to 3 times larger than the number of files in the working directory. Note that this value counts only files.
public getEntryCount ( ) : int
리턴 int

newInCore() 공개 정적인 메소드

Create a new empty index which is never stored on disk.
public static newInCore ( ) : DirCache
리턴 DirCache

nextEntry() 공개 메소드

public nextEntry ( byte p, int pLen, int nextIdx ) : int
p byte
pLen int
nextIdx int
리턴 int

nextEntry() 공개 메소드

Determine the next index position past all entries with the same name. As index entries are sorted by path name, then stage number, this method advances the supplied position to the first position in the index whose path name does not match the path name of the supplied position's entry.
public nextEntry ( int position ) : int
position int /// entry position of the path that should be skipped. ///
리턴 int

read() 공개 정적인 메소드

Create a new in-core index representation and read an index from disk. The new index will be read before it is returned to the caller. Read failures are reported as exceptions and therefore prevent the method from returning a partially populated index.
/// The index file is present but could not be read. /// /// The index file is using a format or extension that this /// library does not support. ///
public static read ( FileInfo indexLocation ) : DirCache
indexLocation System.IO.FileInfo Location of the index file on disk.
리턴 DirCache

read() 공개 정적인 메소드

Create a new in-core index representation and read an index from disk. The new index will be read before it is returned to the caller. Read failures are reported as exceptions and therefore prevent the method from returning a partially populated index.
/// The index file is present but could not be read. /// /// The index file is using a format or extension that this /// library does not support. ///
public static read ( Repository db ) : DirCache
db Repository /// repository the caller wants to read the default index of. ///
리턴 DirCache

read() 공개 메소드

Read the index from disk, if it has changed on disk. This method tries to avoid loading the index if it has not changed since the last time we consulted it. A missing index file will be treated as though it were present but had no file entries in it.
/// The index file is present but could not be read. This /// instance may not be populated correctly. /// /// The index file is using a format or extension that this /// library does not support. ///
public read ( ) : void
리턴 void

replace() 공개 메소드

public replace ( DirCacheEntry e, int cnt ) : void
e DirCacheEntry
cnt int
리턴 void

toArray() 공개 메소드

public toArray ( int i, DirCacheEntry dst, int off, int cnt ) : void
i int
dst DirCacheEntry
off int
cnt int
리턴 void

unlock() 공개 메소드

Unlock this file and abort this change. The temporary file (if created) is deleted before returning.
public unlock ( ) : void
리턴 void

write() 공개 메소드

Write the entry records from memory to disk. The cache must be locked first by calling Lock() and receiving true as the return value. Applications are encouraged to lock the index, then invoke read() to ensure the in-memory data is current, prior to updating the in-memory entries. Once written the lock is closed and must be either committed with commit() or rolled back with unlock().
/// The output file could not be created. The caller no longer /// holds the lock. ///
public write ( ) : void
리턴 void

writeTree() 공개 메소드

Write all index trees to the object store, returning the root tree.
/// One or more paths contain higher-order stages (stage > 0), /// which cannot be stored in a tree object. /// /// One or more paths contain an invalid mode which should never /// appear in a tree object. /// /// An unexpected error occurred writing to the object store. ///
public writeTree ( ObjectWriter ow ) : ObjectId
ow ObjectWriter /// The writer to use when serializing to the store. ///
리턴 ObjectId