Example #1
0
        AnkhGlyph GetPathGlyph(string path, bool lookForChildren)
        {
            SvnItem item = StatusCache[path];

            if (item == null || StatusImages == null)
            {
                return(AnkhGlyph.None);
            }

            AnkhGlyph glyph = StatusImages.GetStatusImageForSvnItem(item);

            switch (glyph)
            {
            case AnkhGlyph.Normal:
                break;     // See below

            default:
                return(glyph);
            }

            // Let's try to do some simple inheritance trick on scc-special files with a normal icon
            // as those are collapsed by default

            SccProjectFile file;

            if (!lookForChildren || !ProjectMap.TryGetFile(item.FullPath, out file))
            {
                return(glyph);
            }

            SccProjectFileReference rf = file.FirstReference;

            if (rf != null)
            {
                foreach (string fn in rf.GetSubFiles())
                {
                    if (IsChildChanged(fn))
                    {
                        return(AnkhGlyph.ChildChanged);
                    }
                }

                // TODO: Make configurable and review missing/lock etc.
                //if (ProjectGlyphRecursive && rf.IsProjectFile)
                //{
                //    foreach (string fn in rf.Project.GetAllFiles())
                //    {
                //        if (IsChildChanged(fn))
                //            return AnkhGlyph.ChildChanged;
                //    }
                //}
            }

            return(AnkhGlyph.Normal);
        }
Example #2
0
        protected uint GlyphToStatus(AnkhGlyph glyph)
        {
            SccStatus status;

            switch (glyph)
            {
            case AnkhGlyph.None:
            case AnkhGlyph.Blank:
            case AnkhGlyph.Ignored:
            case AnkhGlyph.FileMissing:
                // Not versioned
                status = SccStatus.SCC_STATUS_NOTCONTROLLED;
                break;

            case AnkhGlyph.Normal:
            case AnkhGlyph.LockedNormal:
            case AnkhGlyph.ChildChanged:
                // Not changed / no real pending change by itself
                // (Some tools keep track of checked out as a pending change)
                status = SccStatus.SCC_STATUS_CONTROLLED;
                break;

            case AnkhGlyph.MustLock:
                // Not changed, but needs a lock before editting
                status = SccStatus.SCC_STATUS_CONTROLLED | SccStatus.SCC_STATUS_LOCKED;
                break;

            case AnkhGlyph.LockedModified:
                // Modified under a lock
                status = SccStatus.SCC_STATUS_CONTROLLED | SccStatus.SCC_STATUS_CHECKEDOUT
                         | SccStatus.SCC_STATUS_OUTBYUSER | SccStatus.SCC_STATUS_OUTEXCLUSIVE;
                break;

            case AnkhGlyph.InConflict:
                // Needs fixups after merging. Probably ignored
                status = SccStatus.SCC_STATUS_CONTROLLED | SccStatus.SCC_STATUS_CHECKEDOUT
                         | SccStatus.SCC_STATUS_OUTBYUSER | SccStatus.SCC_STATUS_MERGED;
                break;

            //case AnkhGlyph.Added:
            //case AnkhGlyph.ShouldBeAdded:
            //case AnkhGlyph.Deleted:
            //case AnkhGlyph.FileDirty:
            //case AnkhGlyph.CopiedOrMoved:
            default:
                // Pending change + Checked out
                status = SccStatus.SCC_STATUS_CONTROLLED | SccStatus.SCC_STATUS_CHECKEDOUT
                         | SccStatus.SCC_STATUS_OUTBYUSER;
                break;
            }

            return((uint)status);
        }
Example #3
0
        [CLSCompliant(false)] // Implements 2 interfaces
        public int GetSccGlyph(int cFiles, string[] rgpszFullPaths, VsStateIcon[] rgsiGlyphs, uint[] rgdwSccStatus)
        {
            try
            {
                if (rgpszFullPaths == null || rgsiGlyphs == null)
                {
                    return(VSErr.E_POINTER); // Documented as impossible
                }
                if (!IsActive)
                {
                    for (int i = 0; i < cFiles; i++)
                    {
                        if (rgsiGlyphs != null)
                        {
                            rgsiGlyphs[i] = VsStateIcon.STATEICON_NOSTATEICON;
                        }
                        if (rgdwSccStatus != null)
                        {
                            rgdwSccStatus[i] = (uint)SccStatus.SCC_STATUS_NOTCONTROLLED;
                        }
                    }
                    return(VSErr.S_OK);
                }

                for (int i = 0; i < cFiles; i++)
                {
                    string file = rgpszFullPaths[i];
                    if (!IsSafeSccPath(file))
                    {
                        rgsiGlyphs[i] = VsStateIcon.STATEICON_BLANK;
                        if (rgdwSccStatus != null)
                        {
                            rgdwSccStatus[i] = (uint)SccStatus.SCC_STATUS_NOTCONTROLLED;
                        }
                        continue;
                    }

                    AnkhGlyph glyph = GetPathGlyph(file);

                    if (rgsiGlyphs != null)
                    {
                        VsStateIcon icon = (VsStateIcon)glyph;

                        if (icon == VsStateIcon.STATEICON_BLANK || icon == VsStateIcon.STATEICON_NOSTATEICON)
                        {
                            rgsiGlyphs[i] = icon;
                        }
                        else
                        {
                            rgsiGlyphs[i] = (VsStateIcon)((int)icon + _glyphOffset);
                        }
                    }

                    if (rgdwSccStatus != null)
                    {
                        // This will make VS use the right texts on refactor, replace, etc.
                        rgdwSccStatus[i] = GlyphToStatus(glyph);
                    }
                }

                return(VSErr.S_OK);
            }
            catch (Exception e)
            {
                return(VSErr.GetHRForException(e));
            }
        }
Example #4
0
        uint GlyphToStatus(AnkhGlyph glyph)
        {
            SccStatus status;
            switch (glyph)
            {
                case AnkhGlyph.MustLock:
                    status = SccStatus.SCC_STATUS_CONTROLLED | SccStatus.SCC_STATUS_LOCKED;
                    break;
                case AnkhGlyph.None:
                case AnkhGlyph.Blank:
                case AnkhGlyph.Ignored:
                case AnkhGlyph.FileMissing:
                    status = SccStatus.SCC_STATUS_NOTCONTROLLED;
                    break;
                case AnkhGlyph.LockedModified:
                case AnkhGlyph.LockedNormal:
                    status = SccStatus.SCC_STATUS_CONTROLLED | SccStatus.SCC_STATUS_CHECKEDOUT
                        | SccStatus.SCC_STATUS_OUTBYUSER | SccStatus.SCC_STATUS_OUTEXCLUSIVE;
                    break;
                default:
                    status = SccStatus.SCC_STATUS_CONTROLLED | SccStatus.SCC_STATUS_CHECKEDOUT
                        | SccStatus.SCC_STATUS_OUTBYUSER;
                    break;
            }

            return (uint)status;
        }