Exemple #1
0
 /// <summary>Create a new in-core index representation, lock it, and read from disk.</summary>
 /// <remarks>
 /// Create a new in-core index representation, lock it, and read from disk.
 /// <p>
 /// 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.
 /// </remarks>
 /// <param name="indexLocation">location of the index file on disk.</param>
 /// <param name="fs">
 /// the file system abstraction which will be necessary to perform
 /// certain file system operations.
 /// </param>
 /// <param name="indexChangedListener">listener to be informed when DirCache is committed
 ///     </param>
 /// <returns>
 /// a cache representing the contents of the specified index file (if
 /// it exists) or an empty cache if the file does not exist.
 /// </returns>
 /// <exception cref="System.IO.IOException">
 /// the index file is present but could not be read, or the lock
 /// could not be obtained.
 /// </exception>
 /// <exception cref="NGit.Errors.CorruptObjectException">
 /// the index file is using a format or extension that this
 /// library does not support.
 /// </exception>
 public static NGit.Dircache.DirCache Lock(FilePath indexLocation, FS fs, IndexChangedListener
                                           indexChangedListener)
 {
     NGit.Dircache.DirCache c = Lock(indexLocation, fs);
     c.RegisterIndexChangedListener(indexChangedListener);
     return(c);
 }
Exemple #2
0
 /// <summary>Create a new in-core index representation, lock it, and read from disk.</summary>
 /// <remarks>
 /// Create a new in-core index representation, lock it, and read from disk.
 /// <p>
 /// 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.
 /// </remarks>
 /// <param name="repository">repository containing the index to lock and read</param>
 /// <param name="indexChangedListener">listener to be informed when DirCache is committed
 ///     </param>
 /// <returns>
 /// a cache representing the contents of the specified index file (if
 /// it exists) or an empty cache if the file does not exist.
 /// </returns>
 /// <exception cref="System.IO.IOException">
 /// the index file is present but could not be read, or the lock
 /// could not be obtained.
 /// </exception>
 /// <exception cref="NGit.Errors.CorruptObjectException">
 /// the index file is using a format or extension that this
 /// library does not support.
 /// </exception>
 /// <since>2.0</since>
 public static NGit.Dircache.DirCache Lock(Repository repository, IndexChangedListener
                                           indexChangedListener)
 {
     NGit.Dircache.DirCache c = Lock(repository.GetIndexFile(), repository.FileSystem,
                                     indexChangedListener);
     c.repository = repository;
     return(c);
 }
Exemple #3
0
 /// <summary>Register an IndexChangedListener.</summary>
 /// <remarks>Register an IndexChangedListener.</remarks>
 /// <param name="listener">the listener implementation.</param>
 /// <returns>handle to later remove the listener.</returns>
 public virtual ListenerHandle AddIndexChangedListener(IndexChangedListener listener
                                                       )
 {
     return(AddListener <IndexChangedListener>(listener));
 }
Exemple #4
0
 private void RegisterIndexChangedListener(IndexChangedListener listener)
 {
     this.indexChangedListener = listener;
 }