/// <summary>
        /// Robustly determines the SVN status of a path using the output of the SVN status command.
        /// Handles both files and directories, in the case of a directory the status of the directory only, and not all the file-system entries within it.
        /// Handles warnings by turning them into into the associated <see cref="ItemStatus"/> value.
        /// Resolves the ambiguous <see cref="ItemStatus.NotFound"/> item status by walking up the path hierarchy until an items status is found.
        /// </summary>
        public static SvnStringPathStatus StatusRobust(this SvnCommand svnCommand, AbsolutePath path)
        {
            var nonDirectoryIndicatedPath = PathUtilities.EnsurePathIsNotDirectoryIndicated(path.Value).AsAbsolutePath();

            var status = svnCommand.StatusRobust_Internal(nonDirectoryIndicatedPath);

            if (status.ItemStatus != ItemStatus.NotFound)
            {
                return(status);
            }

            // Determine whether the item is in 1) an ignored directory or 2) an unversioned directory by walking up the path hierarchy until
            var parentItemStatus = ItemStatus.None;
            var parentPath       = path;

            do
            {
                parentPath = PathUtilities.GetParentDirectoryPath(parentPath);

                var parentStatus = svnCommand.StatusRobust_Internal(parentPath);

                parentItemStatus = parentStatus.ItemStatus;
            }while (parentItemStatus == ItemStatus.NotFound);

            var output = new SvnStringPathStatus {
                Path = path.Value, ItemStatus = parentItemStatus
            };

            return(output);
        }
Exemplo n.º 2
0
        /// <summary>
        /// The directory containing the project-directory is the solution-directory.
        /// </summary>
        public static SolutionDirectoryPath GetSolutionDirectoryPath(ProjectDirectoryPath projectDirectoryPath)
        {
            var solutionDirectoryPath = PathUtilities.GetParentDirectoryPath(projectDirectoryPath).AsSolutionDirectoryPath();

            return(solutionDirectoryPath);
        }