示例#1
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);
            }
        }
示例#2
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);
            }
        }