Ejemplo n.º 1
0
        private bool IsChildChanged(string path)
        {
            SvnItem item = StatusCache[path];

            if (item == null)
            {
                return(false);
            }

            return(PendingChange.IsPending(item));
        }
Ejemplo n.º 2
0
        private void ItemRefresh(string file)
        {
            SvnItem item = Cache[file];

            file = item.FullPath; // Use existing normalization

            bool          inProject = item.InSolution;
            bool          inExtra   = _extraFiles.Contains(file);
            PendingChange pc;

            if (!inProject && !inExtra)
            {
                _pendingChanges.Remove(file);

                return;
            }
            else if (inProject && inExtra)
            {
                _extraFiles.Remove(file);
            }

            if (item == null)
            {
                return;
            }

            if (_pendingChanges.TryGetValue(file, out pc))
            {
                if (pc.Refresh(RefreshContext, item))
                {
                    if (pc.IsClean)
                    {
                        _pendingChanges.Remove(file);
                        _extraFiles.Remove(file);
                    }
                    else
                    {
                        RaiseChanged(pc);
                    }
                }
            }
            else if (PendingChange.CreateIfPending(RefreshContext, item, out pc))
            {
                _pendingChanges.Add(pc);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates if pending.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="item">The item.</param>
        /// <param name="pc">The pc.</param>
        /// <returns></returns>
        public static bool CreateIfPending(RefreshContext context, SvnItem item, out PendingChange pc)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            else if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (IsPending(item))
            {
                pc = new PendingChange(context, item);
                return(true);
            }

            pc = null;
            return(false);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Tries to get a matching file from the specified text
        /// </summary>
        /// <param name="text"></param>
        /// <param name="change"></param>
        /// <returns></returns>
        /// <remarks>Called from the log message editor in an attempt to provide a mouse over</remarks>
        public bool TryMatchFile(string text, out PendingChange change)
        {
            change = null;
            if (string.IsNullOrEmpty(text))
            {
                return(false);
            }

            lock (_toRefresh)
            {
                text = text.Replace(Path.DirectorySeparatorChar, '/');
                foreach (PendingChange pc in _pendingChanges)
                {
                    if (pc.RelativePath == text)
                    {
                        change = pc;
                        return(true);
                    }
                }

                int liSlash = text.LastIndexOf('/');
                if (liSlash > 0)
                {
                    text = text.Substring(liSlash + 1);
                }

                foreach (PendingChange pc in _pendingChanges)
                {
                    if (text == pc.Name || text == Path.GetFileNameWithoutExtension(pc.Name))
                    {
                        change = pc;
                        return(true);
                    }
                }

                return(false);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Raises the <see cref="E:Changed"/> event.
 /// </summary>
 /// <param name="e">The <see cref="Ankh.Scc.PendingChangeEventArgs"/> instance containing the event data.</param>
 void RaiseChanged(PendingChange pc)
 {
     _pendingChangesRo.RaiseChanged(pc);
 }
Ejemplo n.º 6
0
        void InnerRefresh()
        {
            using (BatchStartedEventArgs br = BatchRefresh())
            {
                HybridCollection <string> mapped = new HybridCollection <string>(StringComparer.OrdinalIgnoreCase);

                ISvnStatusCache cache = Cache;

                foreach (string file in Mapper.GetAllFilesOfAllProjects())
                {
                    br.Tick();
                    _extraFiles.Remove(file); // If we find it here; it is no longer 'extra'!

                    SvnItem item = cache[file];

                    if (item == null)
                    {
                        continue;
                    }

                    PendingChange pc = UpdatePendingChange(item);

                    if (pc != null)
                    {
                        mapped.Add(pc.FullPath);
                    }
                }

                foreach (string file in new List <string>(_extraFiles))
                {
                    br.Tick();
                    SvnItem item = cache[file];

                    if (item == null)
                    {
                        _extraFiles.Remove(file);
                        continue;
                    }

                    PendingChange pc = UpdatePendingChange(item);

                    if (pc != null)
                    {
                        mapped.Add(pc.FullPath);
                    }
                    else
                    {
                        _extraFiles.Remove(file);
                    }
                }

                for (int i = 0; i < _pendingChanges.Count; i++)
                {
                    br.Tick();
                    PendingChange pc = _pendingChanges[i];

                    if (mapped.Contains(pc.FullPath))
                    {
                        continue;
                    }

                    _pendingChanges.RemoveAt(i--);
                }
            }
        }