Exemplo n.º 1
0
        private IEnumerable <PackageChange> DetermineChangedNugetPackages()
        {
            // Try to find a Directory.Packages.props file in the list of changed files
            var packagePropsPath = _changedFiles.Value
                                   .SingleOrDefault(f => f.EndsWith("Directory.Packages.props"));

            if (packagePropsPath is null)
            {
                return(Enumerable.Empty <PackageChange>());
            }

            // Get the contents of the file at from/to revisions
            var(fromFile, toFile) = _changesProvider.Value
                                    .GetTextFileContents(
                _executionData.RepositoryPath,
                packagePropsPath,
                _executionData.From,
                _executionData.To);

            // Parse props files into package and version dictionary
            var fromPackages = NugetHelper.ParseDirectoryPackageProps(fromFile);
            var toPackages   = NugetHelper.ParseDirectoryPackageProps(toFile);

            // Compare both dictionaries
            return(NugetHelper.DiffPackageDictionaries(fromPackages, toPackages));
        }