/// <summary>
        /// Executes the increment.
        /// </summary>
        /// <param name="context">The context of the increment.</param>
        /// <param name="versionComponent">The version component that needs to be incremented.</param>
        /// <remarks>
        /// Use the method <see cref="IncrementContext.SetNewVersionComponentValue"/> to set the new version component value.
        /// Set the  <see cref="IncrementContext.Continue"/> property to <c>false</c> to skip updating the other component values.
        /// </remarks>
        public override void Increment(IncrementContext context, VersionComponent versionComponent)
        {
            // Find out the directory
            String projectPath = context.ProjectFilename;
            String projectPathDirectory = Directory.GetParent(projectPath).FullName;

            //Logger.Write("PATH: " + projectPath, LogLevel.Debug);
            //Logger.Write("PATH: " + projectPathDirectory, LogLevel.Debug);

            if (!String.IsNullOrEmpty(projectPath) && !String.IsNullOrEmpty(projectPathDirectory))
            {
                try
                {
                    long svnRevision = GetRevision(projectPathDirectory);
                    Logger.Write("Revision retrieved from the working copy: " + svnRevision, LogLevel.Info);

                    // Return the head revision or "0" if not under version control
                    context.SetNewVersionComponentValue(versionComponent, svnRevision.ToString());
                }
                catch (Exception ex)
                {
                    Logger.Write("Error while retrieving revision: " + ex.ToString(), LogLevel.Error);
                }
            }
        }
        public override void Execute(IncrementContext context, VersionComponent versionComponent)
        {
            var currentValue = context.GetCurrentVersionComponentValue(versionComponent);
            var newValue     = IncrementImpl(currentValue, context.BuildStartDate, context.ProjectStartDate);

            context.SetNewVersionComponentValue(versionComponent, newValue);
        }
예제 #3
0
        public override void Increment(IncrementContext context, VersionComponent versionComponent)
        {
            string currentVersionComponentValue = context.GetCurrentVersionComponentValue(versionComponent);
            string value = this.Increment(currentVersionComponentValue, context.BuildStartDate, context.ProjectStartDate, context.ProjectFilename);

            context.SetNewVersionComponentValue(versionComponent, value);
        }
 public override void Increment(IncrementContext context, VersionComponent versionComponent)
 {
     string currentVersionComponentValue = context.GetCurrentVersionComponentValue(versionComponent);
     string value = this.Increment(currentVersionComponentValue, context.BuildStartDate, context.ProjectStartDate, context.ProjectFilename);
     context.SetNewVersionComponentValue(versionComponent, value);
 }