Ejemplo n.º 1
0
        public GitStatusData(GitStatusEventArgs status)
        {
            if (status == null)
            {
                throw new ArgumentNullException("status");
            }

            _conflicted  = status.Conflicted;
            _indexStatus = status.IndexStatus;
            _workStatus  = status.WorkingDirectoryStatus;
            _ignored     = status.Ignored;
            _conflicted  = status.Conflicted;
            _kind        = (SvnNodeKind)(int)status.NodeKind;
            _modified    = status.IndexModified || status.WorkingDirectoryModified;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Called from RefreshPath's call to <see cref="GitClient::Status"/>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        /// All information we receive here is live from Git and Disk and is therefore propagated
        /// in all GitItems wishing information
        /// </remarks>
        void RefreshCallback(object sender, GitStatusEventArgs e)
        {
            // Note: There is a lock(_lock) around this in our caller

            GitStatusData status = new GitStatusData(e);
            string        path   = e.FullPath; // Fully normalized

            if (_root == null)
            {
                _root = new string[] { e.FullPath, e.RelativePath }
            }
            ;

            GitItem item;

            if (!_map.TryGetValue(path, out item) || !NewFullPathOk(item, path, status))
            {
                // We only create an item if we don't have an existing
                // with a valid path. (No casing changes allowed!)

                GitItem newItem = CreateItem(path, status);
                StoreItem(newItem);

                if (item != null)
                {
                    ((IGitItemUpdate)item).RefreshTo(newItem);
                    item.Dispose();
                }

                item = newItem;
            }
            else
            {
                ((IGitItemUpdate)item).RefreshTo(status);
            }

            // Note: There is a lock(_lock) around this in our caller
        }

        /// <summary>
        /// Marks the specified file dirty
        /// </summary>
        /// <param name="file"></param>
        void ISccStatusCache.MarkDirty(string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            string normPath = SvnTools.GetNormalizedFullPath(path);

            lock (_lock)
            {
                GitItem item;

                if (_map.TryGetValue(normPath, out item))
                {
                    item.MarkDirty();
                }
            }
        }

        void ISccStatusCache.MarkDirtyRecursive(string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            lock (_lock)
            {
                List <string> names = new List <string>();

                foreach (GitItem v in _map.Values)
                {
                    string name = v.FullPath;
                    if (v.IsBelowPath(path))
                    {
                        v.MarkDirty();
                    }
                }
            }
        }