Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Commit 43d7640

Browse files
mlippertRubenWillems
authored andcommitted
Add support for an incrementOnFailure node in the DateLabeller similar to the DefaultLabeller
1 parent 3374418 commit 43d7640

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

project/core/label/DateLabeller.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public DateLabeller(DateTimeProvider dateTimeProvider)
4949
this.MonthFormat = "00";
5050
this.DayFormat = "00";
5151
RevisionFormat = "000";
52+
IncrementOnFailed = false;
5253
}
5354
#endregion
5455

@@ -84,6 +85,16 @@ public DateLabeller(DateTimeProvider dateTimeProvider)
8485
[ReflectorProperty("revisionFormat", Required = false)]
8586
public string RevisionFormat { get; set; }
8687

88+
/// <summary>
89+
/// Determines if the build should be labeled even if it fails.
90+
/// So you can examine previous failed builds to determine why
91+
/// it failed.
92+
/// </summary>
93+
/// <version>1.0</version>
94+
/// <default>false</default>
95+
[ReflectorProperty("incrementOnFailure", Required = false)]
96+
public bool IncrementOnFailed { get; set; }
97+
8798
/// <summary>
8899
/// Generates the specified integration result.
89100
/// </summary>
@@ -113,12 +124,15 @@ private Version ParseVersion(DateTime date, IntegrationSummary lastIntegrationSu
113124
{
114125
try
115126
{
116-
return new Version(lastIntegrationSummary.LastSuccessfulIntegrationLabel);
127+
if (IncrementOnFailed)
128+
return new Version(lastIntegrationSummary.Label);
129+
else
130+
return new Version(lastIntegrationSummary.LastSuccessfulIntegrationLabel);
117131
}
118132
catch (SystemException)
119133
{
120134
return new Version(date.Year, date.Month, date.Day, 0);
121135
}
122136
}
123137
}
124-
}
138+
}

0 commit comments

Comments
 (0)