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));
        }
        /// <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));
        }