Example #1
0
        private bool IsInInterval(SnPatch snPatch, SnComponentDescriptor target, bool onBefore)
        {
            Version version;

            if (onBefore)
            {
                if (target.State == ExecutionResult.Unfinished ||
                    target.State == ExecutionResult.FaultyBefore ||
                    target.State == ExecutionResult.Faulty)
                {
                    version = target.Version;
                }
                else
                {
                    version = target.TempVersionBefore ?? target.Version;
                }
            }
            else
            {
                if (target.State == ExecutionResult.Faulty || target.State == ExecutionResult.SuccessfulBefore)
                {
                    version = target.Version;
                }
                else
                {
                    version = target.TempVersionAfter ?? target.Version;
                }
            }
            return(snPatch.Boundary.ContainsVersion(version));
        }
Example #2
0
        private ItemBuilder Patch(VersionBoundary from, string fromSrc, string to, string released, string description)
        {
            var patch = new SnPatch
            {
                ComponentId = _component.ComponentId,
                Version     = new Version(0, 0),
                Boundary    = new VersionBoundary
                {
                    MinVersion = new Version(0, 0),
                    MaxVersion = new Version(0, 0)
                }
            };

            var targetVersion = ParseVersion(to, patch);

            patch.Version     = targetVersion;
            patch.Boundary    = BuildBoundary(from ?? ParseFromVersion(fromSrc, patch), targetVersion);
            patch.ReleaseDate = ParseDate(released, patch);
            patch.Description = CheckDescription(description, patch);

            if (patch.Boundary.MinVersion != null)
            {
                if (targetVersion <= patch.Boundary.MinVersion)
                {
                    throw new InvalidPatchException(PatchErrorCode.TooSmallTargetVersion, patch,
                                                    "The 'Version' need to be higher than minimal version.");
                }
            }

            _patches.Add(patch);

            return(new ItemBuilder(patch, this));
        }
Example #3
0
 private bool ValidSnPatch(SnPatch snPatch)
 {
     if (!CheckSelfDependency(snPatch))
     {
         return(false);
     }
     return(true);
 }