private static SvnStringPathStatus StatusRobust_Internal(this SvnCommand svnCommand, AbsolutePath absolutePath)
        {
            var arguments = SvnCommandServicesProvider.GetStatusVerboseForInstanceOnly(absolutePath)
                            .AddXml(); // Get XML.

            var outputCollector = SvnCommandServicesProvider.Run(svnCommand.SvnExecutableFilePath, arguments, false);

            if (outputCollector.AnyError)
            {
                var errorText = outputCollector.GetErrorText().Trim();

                var notWorkingCopyText = $"svn: warning: W155007: '{absolutePath}' is not a working copy";
                if (errorText == notWorkingCopyText)
                {
                    var output = new SvnStringPathStatus {
                        Path = absolutePath.Value, ItemStatus = ItemStatus.NotWorkingCopy
                    };
                    return(output);
                }

                var notFoundText = $"svn: warning: W155010: The node '{absolutePath}' was not found.";
                if (errorText == notFoundText)
                {
                    var output = new SvnStringPathStatus {
                        Path = absolutePath.Value, ItemStatus = ItemStatus.NotFound
                    };
                    return(output);
                }

                throw new Exception($"Unknown SVN error:\n{errorText}");
            }

            var xmlText = outputCollector.GetOutputText();

            using (var stream = StreamHelper.FromString(xmlText))
            {
                var xmlStatusType = XmlStreamSerializer.Deserialize <StatusType>(stream, SvnXml.DefaultNamespace);

                var statuses = SvnCommandServicesProvider.GetStatuses(xmlStatusType);

                var status = statuses.Count() < 1
                    ? new SvnStringPathStatus {
                    Path = absolutePath.Value, ItemStatus = ItemStatus.None
                }
                    : statuses.Single() // Should be only 1.
                ;

                return(status);
            }
        }
        public static string GetStatusXmlText2(FilePath svnExecutableFilePath, AbsolutePath path, ILogger logger)
        {
            logger.LogDebug($"Getting SVN status XML text for path {path}...");

            var arguments = SvnCommandServicesProvider.GetStatusVerboseForInstanceOnly(path)
                            .AddFlagFull("xml")
                            .Build();

            var outputCollector = SvnCommandServicesProvider.Run(svnExecutableFilePath, arguments);

            logger.LogInformation($"Got SVN status XML text of path {path}.");

            var output = outputCollector.GetOutputText();

            return(output);
        }
        /// <summary>s
        /// Get only the SVN status of a specific directory, and not its children.
        /// If the directory path does not exist, returns a result with status <see cref="ItemStatus.None"/>.
        /// </summary>
        public static SvnStringPathStatus Status(this SvnCommand svnCommand, DirectoryPath directoryPath)
        {
            svnCommand.Logger.LogDebug($"Getting SVN status of directory path {directoryPath}...");

            var arguments = SvnCommandServicesProvider.GetStatusVerboseForInstanceOnly(directoryPath);

            var statuses = SvnCommandServicesProvider.GetStatuses(svnCommand.SvnExecutableFilePath, arguments);

            var status = statuses.Count() < 1
                ? new SvnStringPathStatus {
                Path = directoryPath.Value, ItemStatus = ItemStatus.None
            }
                : statuses.Single() // Should be only 1.
            ;

            svnCommand.Logger.LogDebug($"Got SVN status of directory path {directoryPath}.");

            return(status);
        }