Example #1
0
 private ContentSource Source(AbstractTreeIterator iterator)
 {
     if (iterator is WorkingTreeIterator)
     {
         return(ContentSource.Create((WorkingTreeIterator)iterator));
     }
     return(ContentSource.Create(reader));
 }
Example #2
0
        /// <summary>Set the repository the formatter can load object contents from.</summary>
        /// <remarks>
        /// Set the repository the formatter can load object contents from.
        /// Once a repository has been set, the formatter must be released to ensure
        /// the internal ObjectReader is able to release its resources.
        /// </remarks>
        /// <param name="repository">source repository holding referenced objects.</param>
        public virtual void SetRepository(Repository repository)
        {
            if (reader != null)
            {
                reader.Release();
            }
            db     = repository;
            reader = db.NewObjectReader();
            ContentSource cs = ContentSource.Create(reader);

            source = new ContentSource.Pair(cs, cs);
            DiffConfig dc = db.GetConfig().Get(DiffConfig.KEY);

            if (dc.IsNoPrefix())
            {
                SetOldPrefix(string.Empty);
                SetNewPrefix(string.Empty);
            }
            SetDetectRenames(dc.IsRenameDetectionEnabled());
            diffAlgorithm = DiffAlgorithm.GetAlgorithm(db.GetConfig().GetEnum(ConfigConstants
                                                                              .CONFIG_DIFF_SECTION, null, ConfigConstants.CONFIG_KEY_ALGORITHM, DiffAlgorithm.SupportedAlgorithm
                                                                              .HISTOGRAM));
        }
		internal SimilarityRenameDetector(ContentSource.Pair reader, IList<DiffEntry> srcs
			, IList<DiffEntry> dsts)
		{
			this.reader = reader;
			this.srcs = srcs;
			this.dsts = dsts;
		}
        /// <summary>Detect renames in the current file set.</summary>
        /// <remarks>Detect renames in the current file set.</remarks>
        /// <param name="reader">reader to obtain objects from the repository with.</param>
        /// <param name="pm">report progress during the detection phases.</param>
        /// <returns>
        /// an unmodifiable list of
        /// <see cref="DiffEntry">DiffEntry</see>
        /// s representing all files
        /// that have been changed.
        /// </returns>
        /// <exception cref="System.IO.IOException">file contents cannot be read from the repository.
        ///     </exception>
        public virtual IList <DiffEntry> Compute(ObjectReader reader, ProgressMonitor pm)
        {
            ContentSource cs = ContentSource.Create(reader);

            return(Compute(new ContentSource.Pair(cs, cs), pm));
        }
Example #5
0
 /// <summary>Construct a pair of sources.</summary>
 /// <remarks>Construct a pair of sources.</remarks>
 /// <param name="oldSource">source to read the old side of a DiffEntry.</param>
 /// <param name="newSource">source to read the new side of a DiffEntry.</param>
 public Pair(ContentSource oldSource, ContentSource newSource)
 {
     this.oldSource = oldSource;
     this.newSource = newSource;
 }
Example #6
0
			/// <summary>Construct a pair of sources.</summary>
			/// <remarks>Construct a pair of sources.</remarks>
			/// <param name="oldSource">source to read the old side of a DiffEntry.</param>
			/// <param name="newSource">source to read the new side of a DiffEntry.</param>
			public Pair(ContentSource oldSource, ContentSource newSource)
			{
				this.oldSource = oldSource;
				this.newSource = newSource;
			}