@@ -108,6 +108,11 @@ type Change struct {
108108// The returned entries includes all the changes between the base and revision specs included the one
109109// marked as hidden.
110110func NewEntries (basePath , revisionPath , exceptionFilePath string ) ([]* Entry , error ) {
111+ return NewEntriesWithRunDate (basePath , revisionPath , exceptionFilePath , time .Now ().Format ("2006-01-02" ))
112+ }
113+
114+ // NewEntriesWithRunDate generates the changelog entries with a specific run date.
115+ func NewEntriesWithRunDate (basePath , revisionPath , exceptionFilePath , runDate string ) ([]* Entry , error ) {
111116 baseMetadata , err := newMetadataFromFile (basePath )
112117 if err != nil {
113118 return nil , err
@@ -120,7 +125,7 @@ func NewEntries(basePath, revisionPath, exceptionFilePath string) ([]*Entry, err
120125 }
121126 log .Printf ("Revision Metadata: %s" , newStringFromStruct (revisionMetadata ))
122127
123- revisionMetadata .RunDate = time . Now (). Format ( "2006-01-02" )
128+ revisionMetadata .RunDate = runDate
124129
125130 baseActiveVersionOnPreviousRunDate , err := latestVersionActiveOnDate (baseMetadata .RunDate , baseMetadata .Versions )
126131 if err != nil {
@@ -208,7 +213,12 @@ func NewEntries(basePath, revisionPath, exceptionFilePath string) ([]*Entry, err
208213// The returned entries includes the changes between the base and revision specs that are not
209214// marked as hidden.
210215func NewEntriesWithoutHidden (basePath , revisionPath , exceptionFilePath string ) ([]* Entry , error ) {
211- entries , err := NewEntries (basePath , revisionPath , exceptionFilePath )
216+ return NewEntriesWithoutHiddenWithRunDate (basePath , revisionPath , exceptionFilePath , time .Now ().Format ("2006-01-02" ))
217+ }
218+
219+ // NewEntriesWithoutHiddenWithRunDate generates the changelog entries with a specific run date.
220+ func NewEntriesWithoutHiddenWithRunDate (basePath , revisionPath , exceptionFilePath , runDate string ) ([]* Entry , error ) {
221+ entries , err := NewEntriesWithRunDate (basePath , revisionPath , exceptionFilePath , runDate )
212222 if err != nil {
213223 return nil , err
214224 }
@@ -218,6 +228,11 @@ func NewEntriesWithoutHidden(basePath, revisionPath, exceptionFilePath string) (
218228
219229// NewEntriesBetweenRevisionVersions generates the changelog entries between the revision versions.
220230func NewEntriesBetweenRevisionVersions (revisionPath , exceptionFilePath string ) ([]* Entry , error ) {
231+ return NewEntriesBetweenRevisionVersionsWithRunDate (revisionPath , exceptionFilePath , time .Now ().Format ("2006-01-02" ))
232+ }
233+
234+ // NewEntriesBetweenRevisionVersionsWithRunDate generates the changelog entries between the revision versions with a specific run date.
235+ func NewEntriesBetweenRevisionVersionsWithRunDate (revisionPath , exceptionFilePath , runDate string ) ([]* Entry , error ) {
221236 revisionMetadata , err := newMetadataFromFile (revisionPath )
222237 if err != nil {
223238 return nil , err
@@ -231,7 +246,7 @@ func NewEntriesBetweenRevisionVersions(revisionPath, exceptionFilePath string) (
231246 continue
232247 }
233248
234- entry , err := newEntriesBetweenVersion (revisionMetadata , fromVersion , toVersion , exceptionFilePath )
249+ entry , err := newEntriesBetweenVersionWithRunDate (revisionMetadata , fromVersion , toVersion , exceptionFilePath , runDate )
235250 if err != nil {
236251 return nil , err
237252 }
@@ -242,19 +257,19 @@ func NewEntriesBetweenRevisionVersions(revisionPath, exceptionFilePath string) (
242257 return newVersionEntries (entries ), nil
243258}
244259
245- func newEntriesBetweenVersion (metadata * Metadata , fromVersion , toVersion , exceptionFilePath string ) (* Entry , error ) {
260+ func newEntriesBetweenVersionWithRunDate (metadata * Metadata , fromVersion , toVersion , exceptionFilePath , runDate string ) (* Entry , error ) {
246261 baseMetadata := & Metadata {
247262 Path : metadata .Path ,
248263 ActiveVersion : fromVersion ,
249- RunDate : time . Now (). Format ( "2006-01-02" ) ,
264+ RunDate : runDate ,
250265 SpecRevision : metadata .SpecRevision ,
251266 Versions : metadata .Versions ,
252267 }
253268
254269 revisionMetadata := & Metadata {
255270 Path : metadata .Path ,
256271 ActiveVersion : toVersion ,
257- RunDate : time . Now (). Format ( "2006-01-02" ) ,
272+ RunDate : runDate ,
258273 SpecRevision : metadata .SpecRevision ,
259274 Versions : metadata .Versions ,
260275 }
0 commit comments