Пример #1
0
        internal SvnInfoEventArgs(string path, svn_client_info2_t info, AprPool pool)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }
            if (info == null)
            {
                throw new ArgumentNullException(nameof(info));
            }
            if (pool == null)
            {
                throw new ArgumentNullException(nameof(pool));
            }

            _info = info;
            _pool = pool;

            Path               = path;
            Revision           = info.rev;
            NodeKind           = (SvnNodeKind)info.kind;
            LastChangeRevision = info.last_changed_rev;
            LastChangeTime     = SvnBase.DateTimeFromAprTime(info.last_changed_date);
            HasLocalInfo       = (info.wc_info != null);

            if (info.wc_info != null)
            {
                _wcSchedule      = (SvnSchedule)info.wc_info.schedule;
                CopyFromRevision = info.wc_info.copyfrom_rev;
                Depth            = (SvnDepth)info.wc_info.depth;

                ContentTime = SvnBase.DateTimeFromAprTime(info.wc_info.recorded_time);
                if (info.wc_info.recorded_size == -1)
                {
                    WorkingCopySize = -1;
                }
                else
                {
                    WorkingCopySize = info.wc_info.recorded_size;
                }

                Conflicted = info.wc_info.conflicts != null && (info.wc_info.conflicts.nelts > 0);
            }
            else
            {
                Depth            = SvnDepth.Unknown;
                WorkingCopySize  = -1;
                CopyFromRevision = -1;
            }

            if (info.size == -1)
            {
                RepositorySize = -1;
            }
            else
            {
                RepositorySize = info.size;
            }
        }
Пример #2
0
        protected internal override void Detach(bool keepProperties)
        {
            try
            {
                if (keepProperties)
                {
                    // Use all properties to get them cached in .Net memory
                    GC.KeepAlive(Path);
                    GC.KeepAlive(Uri);
                    GC.KeepAlive(RepositoryRoot);
                    GC.KeepAlive(RepositoryId);
                    GC.KeepAlive(LastChangeAuthor);
                    GC.KeepAlive(Lock);
                    GC.KeepAlive(CopyFromUri);
                    GC.KeepAlive(Checksum);
                    GC.KeepAlive(ConflictOld);
                    GC.KeepAlive(ConflictNew);
                    GC.KeepAlive(ConflictWork);
                    GC.KeepAlive(PropertyEditFile);
                    GC.KeepAlive(ChangeList);
                    GC.KeepAlive(Conflicts);
                    GC.KeepAlive(WorkingCopyRoot);
                    GC.KeepAlive(MovedFrom);
                    GC.KeepAlive(MovedTo);
                }

                if (_conflicts != null)
                {
                    foreach (SvnConflictData cd in _conflicts)
                    {
                        cd.Detach(keepProperties);
                    }
                }

                _lock?.Detach(keepProperties);
            }
            finally
            {
                _info = null;
                _pool = null;
                base.Detach(keepProperties);
            }
        }