Iterate and update a DirCache as part of a TreeWalk. Like DirCacheIterator this iterator allows a DirCache to be used in parallel with other sorts of iterators in a TreeWalk. However any entry which appears in the source DirCache and which is skipped by the TreeFilter is automatically copied into DirCacheBuilder, thus retaining it in the newly updated index. This iterator is suitable for update processes, or even a simple delete algorithm. For example deleting a path: DirCache dirc = DirCache.lock(db); DirCacheBuilder edit = dirc.builder(); TreeWalk walk = new TreeWalk(db); walk.reset(); walk.setRecursive(true); walk.setFilter(PathFilter.Create("name/to/remove")); walk.addTree(new DirCacheBuildIterator(edit)); while (walk.next()) ; // do nothing on a match as we want to remove matches edit.commit();
Inheritance: DirCacheIterator
        /// <summary>
        /// Create a new iterator for an already loaded <see cref="DirCache"/> instance.
        /// <para/>
        /// The iterator implementation may copy part of the cache's data during
        /// construction, so the cache must be Read in prior to creating the
        /// iterator.
        /// </summary>
        /// <param name="parentIterator">The parent iterator</param>
        /// <param name="cacheTree">The cache tree</param>
        DirCacheBuildIterator(DirCacheBuildIterator parentIterator, DirCacheTree cacheTree)
            : base(parentIterator, cacheTree)
        {
            if (parentIterator == null)
            {
                throw new System.ArgumentNullException("parentIterator");
            }

            _builder = parentIterator._builder;
        }
 /// <summary>
 /// Create a new iterator for an already loaded <see cref="DirCache"/> instance.
 /// <para/>
 /// The iterator implementation may copy part of the cache's data during
 /// construction, so the cache must be Read in prior to creating the
 /// iterator.
 /// </summary>
 /// <param name="parentIterator">The parent iterator</param>
 /// <param name="cacheTree">The cache tree</param>
 DirCacheBuildIterator(DirCacheBuildIterator parentIterator, DirCacheTree cacheTree)
     : base(parentIterator, cacheTree)
 {
     _builder = parentIterator._builder;
 }
Example #3
0
		/// <summary>
		/// Create a new iterator for an already loaded <see cref="DirCache"/> instance.
		/// <para/>
		/// The iterator implementation may copy part of the cache's data during
		/// construction, so the cache must be Read in prior to creating the
		/// iterator.
		/// </summary>
		/// <param name="parentIterator">The parent iterator</param>
		/// <param name="cacheTree">The cache tree</param>
        DirCacheBuildIterator(DirCacheBuildIterator parentIterator, DirCacheTree cacheTree)
            : base(parentIterator, cacheTree)
        {
			if (parentIterator == null)
				throw new System.ArgumentNullException ("parentIterator");
			
            _builder = parentIterator._builder;
        }
Example #4
0
 /// <summary>
 /// Create a new iterator for an already loaded <see cref="DirCache"/> instance.
 /// <para/>
 /// The iterator implementation may copy part of the cache's data during
 /// construction, so the cache must be Read in prior to creating the
 /// iterator.
 /// </summary>
 /// <param name="parentIterator">The parent iterator</param>
 /// <param name="cacheTree">The cache tree</param>
 DirCacheBuildIterator(DirCacheBuildIterator parentIterator, DirCacheTree cacheTree)
     : base(parentIterator, cacheTree)
 {
     _builder = parentIterator._builder;
 }