/// <exception cref="NGit.Errors.MissingObjectException"></exception>
        /// <exception cref="NGit.Errors.IncorrectObjectTypeException"></exception>
        /// <exception cref="NGit.Errors.CorruptObjectException"></exception>
        /// <exception cref="System.IO.IOException"></exception>
        private void UpdateFollowFilter(ObjectId[] trees)
        {
            TreeWalk     tw        = pathFilter;
            FollowFilter oldFilter = (FollowFilter)tw.Filter;

            tw.Filter = TreeFilter.ANY_DIFF;
            tw.Reset(trees);
            IList <DiffEntry> files = DiffEntry.Scan(tw);
            RenameDetector    rd    = new RenameDetector(repository);

            rd.AddAll(files);
            files = rd.Compute();
            TreeFilter newFilter = oldFilter;

            foreach (DiffEntry ent in files)
            {
                if (IsRename(ent) && ent.GetNewPath().Equals(oldFilter.GetPath()))
                {
                    newFilter = FollowFilter.Create(ent.GetOldPath());
                    RenameCallback callback = oldFilter.GetRenameCallback();
                    if (callback != null)
                    {
                        callback.Renamed(ent);
                        // forward the callback to the new follow filter
                        ((FollowFilter)newFilter).SetRenameCallback(callback);
                    }
                    break;
                }
            }
            tw.Filter = newFilter;
        }
Ejemplo n.º 2
0
 /// <summary>Sets the callback to which renames shall be reported.</summary>
 /// <remarks>Sets the callback to which renames shall be reported.</remarks>
 /// <param name="callback">the callback to use</param>
 public virtual void SetRenameCallback(RenameCallback callback)
 {
     renameCallback = callback;
 }
Ejemplo n.º 3
0
 /// <summary>Sets the callback to which renames shall be reported.</summary>
 /// <remarks>Sets the callback to which renames shall be reported.</remarks>
 /// <param name="callback">the callback to use</param>
 public virtual void SetRenameCallback(RenameCallback callback)
 {
     renameCallback = callback;
 }