/// <summary>Create a new rename detector for the given repository</summary>
        /// <param name="repo">the repository to use for rename detection</param>
        public RenameDetector(Repository repo)
        {
            this.repo = repo;
            DiffConfig cfg = repo.GetConfig().Get(DiffConfig.KEY);

            renameLimit = cfg.GetRenameLimit();
            Reset();
        }
示例#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));
        }