Matches() public method

public Matches ( string path ) : bool
path string
return bool
Exemplo n.º 1
0
        private void ProcessItem(VssItem item, string path, PathMatcher exclusionMatcher)
        {
            try
            {
                VssRevision previousRevision                = null;
                LinkedList <VssRevision>  revisions         = new LinkedList <VssRevision>();
                IEnumerable <VssRevision> originalRevisions = item.Revisions; // this is recreated from the file each time it is queried!!!
                foreach (VssRevision vssRevision in originalRevisions)
                {
                    if (previousRevision != null)
                    {
                        checkRevisionTime(item, previousRevision, vssRevision);
                    }
                    previousRevision = vssRevision;
                    revisions.AddLast(vssRevision);
                }
                foreach (VssRevision vssRevision in revisions)
                {
                    var actionType  = vssRevision.Action.Type;
                    var namedAction = vssRevision.Action as VssNamedAction;
                    if (namedAction != null)
                    {
                        if (actionType == VssActionType.Destroy)
                        {
                            // track destroyed files so missing history can be anticipated
                            // (note that Destroy actions on shared files simply delete
                            // that copy, so destroyed files can't be completely ignored)
                            destroyedFiles.Add(namedAction.Name.PhysicalName);
                        }

                        var targetPath = path + VssDatabase.ProjectSeparator + namedAction.Name.LogicalName;
                        if (exclusionMatcher != null && exclusionMatcher.Matches(targetPath))
                        {
                            // project action targets an excluded file
                            continue;
                        }
                    }

                    Revision revision = new Revision(vssRevision.DateTime,
                                                     vssRevision.User, item.ItemName, vssRevision.Version,
                                                     vssRevision.Comment, vssRevision.Action);

                    ICollection <Revision> revisionSet;
                    if (!sortedRevisions.TryGetValue(vssRevision.DateTime, out revisionSet))
                    {
                        revisionSet = new LinkedList <Revision>();
                        sortedRevisions[vssRevision.DateTime] = revisionSet;
                    }
                    revisionSet.Add(revision);
                    ++revisionCount;
                }
            }
            catch (RecordException e)
            {
                var message = string.Format("Failed to read revisions for {0} ({1}): {2}",
                                            path, item.PhysicalName, ExceptionFormatter.Format(e));
                LogException(e, message);
                ReportError(message);
            }
        }
Exemplo n.º 2
0
        private void ProcessItem(VssItem item, string path, PathMatcher exclusionMatcher)
        {
            try
            {
                foreach (var vssRevision in item.Revisions)
                {
                    var actionType = vssRevision.Action.Type;
                    if (vssRevision.Action is VssNamedAction namedAction)
                    {
                        if (actionType == VssActionType.Destroy)
                        {
                            // track destroyed files so missing history can be anticipated
                            // (note that Destroy actions on shared files simply delete
                            // that copy, so destroyed files can't be completely ignored)
                            DestroyedFiles.Add(namedAction.Name.PhysicalName);
                        }

                        var targetPath = path + VssDatabase.ProjectSeparator + namedAction.Name.LogicalName;
                        if (exclusionMatcher != null && exclusionMatcher.Matches(targetPath))
                        {
                            // project action targets an excluded file
                            continue;
                        }
                    }

                    var revision = new Revision(vssRevision.DateTime,
                                                vssRevision.User, item.ItemName, vssRevision.Version,
                                                vssRevision.Comment, vssRevision.Action);

                    ICollection <Revision> revisionSet;
                    if (!SortedRevisions.TryGetValue(vssRevision.DateTime, out revisionSet))
                    {
                        revisionSet = new LinkedList <Revision>();
                        SortedRevisions[vssRevision.DateTime] = revisionSet;
                    }
                    revisionSet.Add(revision);
                    ++revisionCount;
                }
            }
            catch (RecordException e)
            {
                var message = string.Format("Failed to read revisions for {0} ({1}): {2}",
                                            path, item.PhysicalName, ExceptionFormatter.Format(e));
                LogException(e, message);
                ReportError(message);
            }
        }
Exemplo n.º 3
0
        private void ProcessProject(VssProject project, string path, PathMatcher exclusionMatcher)
        {
            try
            {
                ProjectLocation projectLocation;
                if (sortedProjectLocations.TryGetValue(project.PhysicalName, out projectLocation))
                {
                    logger.WriteLine("Unexpected: ProjectAnalyzer.ProcessProject: sortedProjectLocations already contains project: {0}", project.PhysicalName);
                }
                else
                {
                    projectLocation = new ProjectLocation(project.PhysicalName, path);
                    sortedProjectLocations[project.PhysicalName] = projectLocation;
                };

                foreach (VssRevision vssRevision in project.Revisions)
                {
                    var actionType  = vssRevision.Action.Type;
                    var namedAction = vssRevision.Action as VssNamedAction;
                    if (namedAction != null)
                    {
                        var targetPath = path + VssDatabase.ProjectSeparator + namedAction.Name.LogicalName;
                        if (exclusionMatcher != null && exclusionMatcher.Matches(targetPath))
                        {
                            // project action targets an excluded file
                            continue;
                        }

                        if (namedAction.Name.IsProject)
                        {
                            if (
                                (actionType == VssActionType.Delete) ||
                                (actionType == VssActionType.Destroy)
                                )
                            {
                                deletedProjects.Add(namedAction.Name.PhysicalName);
                            }
                            else if (
                                (actionType == VssActionType.Recover) ||
                                (actionType == VssActionType.Share)
                                )
                            {
                                deletedProjects.Remove(namedAction.Name.PhysicalName);
                            }
                        }
                        else
                        {
                            if (
                                (actionType == VssActionType.Delete) ||
                                (actionType == VssActionType.Destroy)
                                )
                            {
                                projectLocation.DeletedFiles.Add(namedAction.Name.PhysicalName);
                            }
                            else if (
                                (actionType == VssActionType.Recover) ||
                                (actionType == VssActionType.Share)
                                )
                            {
                                projectLocation.DeletedFiles.Remove(namedAction.Name.PhysicalName);
                            }
                        }
                    }
                }
            }
            catch (RecordException e)
            {
                var message = string.Format("ProjectAnalyzer.ProcessProject: Failed to process project for {0} ({1}): {2}",
                                            path, project.PhysicalName, ExceptionFormatter.Format(e));
                LogException(e, message);
                ReportError(message);
            }
        }
Exemplo n.º 4
0
        private void ProcessItem(VssItem item, string path, PathMatcher exclusionMatcher)
        {
            try
            {
                VssRevision previousRevision = null;
                LinkedList<VssRevision> revisions = new LinkedList<VssRevision>();
                IEnumerable<VssRevision> originalRevisions = item.Revisions; // this is recreated from the file each time it is queried!!!
                foreach (VssRevision vssRevision in originalRevisions)
                {
                    if (previousRevision != null)
                    {
                        checkRevisionTime(item, previousRevision, vssRevision);
                    }
                    previousRevision = vssRevision;
                    revisions.AddLast(vssRevision);
                }
                foreach (VssRevision vssRevision in revisions)
                {
                    var actionType = vssRevision.Action.Type;
                    var namedAction = vssRevision.Action as VssNamedAction;
                    if (namedAction != null)
                    {
                        if (actionType == VssActionType.Destroy)
                        {
                            // track destroyed files so missing history can be anticipated
                            // (note that Destroy actions on shared files simply delete
                            // that copy, so destroyed files can't be completely ignored)
                            destroyedFiles.Add(namedAction.Name.PhysicalName);
                        }

                        var targetPath = path + VssDatabase.ProjectSeparator + namedAction.Name.LogicalName;
                        if (exclusionMatcher != null && exclusionMatcher.Matches(targetPath))
                        {
                            // project action targets an excluded file
                            continue;
                        }
                    }

                    Revision revision = new Revision(vssRevision.DateTime,
                        vssRevision.User, item.ItemName, vssRevision.Version,
                        vssRevision.Comment, vssRevision.Action);

                    ICollection<Revision> revisionSet;
                    if (!sortedRevisions.TryGetValue(vssRevision.DateTime, out revisionSet))
                    {
                        revisionSet = new LinkedList<Revision>();
                        sortedRevisions[vssRevision.DateTime] = revisionSet;
                    }
                    revisionSet.Add(revision);
                    ++revisionCount;
                }
            }
            catch (RecordException e)
            {
                var message = string.Format("Failed to read revisions for {0} ({1}): {2}",
                    path, item.PhysicalName, ExceptionFormatter.Format(e));
                LogException(e, message);
                ReportError(message);
            }
        }
Exemplo n.º 5
0
        private void ProcessProject(VssProject project, string path, PathMatcher exclusionMatcher)
        {
            try
            {
                ProjectLocation projectLocation;
                if (sortedProjectLocations.TryGetValue(project.PhysicalName, out projectLocation))
                    logger.WriteLine("Unexpected: ProjectAnalyzer.ProcessProject: sortedProjectLocations already contains project: {0}", project.PhysicalName);
                else
                {
                    projectLocation = new ProjectLocation(project.PhysicalName, path);
                    sortedProjectLocations[project.PhysicalName] = projectLocation;
                };

                foreach (VssRevision vssRevision in project.Revisions)
                {
                    var actionType = vssRevision.Action.Type;
                    var namedAction = vssRevision.Action as VssNamedAction;
                    if (namedAction != null)
                    {
                        var targetPath = path + VssDatabase.ProjectSeparator + namedAction.Name.LogicalName;
                        if (exclusionMatcher != null && exclusionMatcher.Matches(targetPath))
                        {
                            // project action targets an excluded file
                            continue;
                        }

                        if (namedAction.Name.IsProject)
                        {
                            if (
                                (actionType == VssActionType.Delete) ||
                                (actionType == VssActionType.Destroy)
                            )
                                deletedProjects.Add(namedAction.Name.PhysicalName);
                            else if (
                                (actionType == VssActionType.Recover) ||
                                (actionType == VssActionType.Share)
                            )
                                deletedProjects.Remove(namedAction.Name.PhysicalName);
                        }
                        else
                        {
                            if (
                                (actionType == VssActionType.Delete) ||
                                (actionType == VssActionType.Destroy)
                            )
                                projectLocation.DeletedFiles.Add(namedAction.Name.PhysicalName);
                            else if (
                                (actionType == VssActionType.Recover) ||
                                (actionType == VssActionType.Share)
                            )
                                projectLocation.DeletedFiles.Remove(namedAction.Name.PhysicalName);
                        }

                    }
                }
            }
            catch (RecordException e)
            {
                var message = string.Format("ProjectAnalyzer.ProcessProject: Failed to process project for {0} ({1}): {2}",
                    path, project.PhysicalName, ExceptionFormatter.Format(e));
                LogException(e, message);
                ReportError(message);
            }
        }