diff --git a/Tasks/CopyFilesV2/copyfiles.ts b/Tasks/CopyFilesV2/copyfiles.ts index 17efe1b86947..c789c1ae5e7c 100644 --- a/Tasks/CopyFilesV2/copyfiles.ts +++ b/Tasks/CopyFilesV2/copyfiles.ts @@ -2,6 +2,21 @@ import fs = require('fs'); import path = require('path'); import tl = require('azure-pipelines-task-lib/task'); +/** + * Shows timestamp change operation results + * @param fileStats file stats + * @param err error - null if there is no error + */ +function displayTimestampChangeResults( + fileStats: tl.FsStats, + err: NodeJS.ErrnoException +) { + if (err) { + console.warn(`Problem applying the timestamp: ${err}`); + } else { + console.log(`Timestamp preserved successfully - access time: ${fileStats.atime}, modified time: ${fileStats.mtime}`) + } +} // we allow broken symlinks - since there could be broken symlinks found in source folder, but filtered by contents pattern const findOptions: tl.FindOptions = { @@ -124,7 +139,7 @@ if (matchedFiles.length > 0) { try { const fileStats = tl.stats(file); fs.utimes(targetPath, fileStats.atime, fileStats.mtime, (err) => { - console.warn(`Problem applying the timestamp: ${err}`); + displayTimestampChangeResults(fileStats, err); }); } catch (err) { @@ -160,7 +175,7 @@ if (matchedFiles.length > 0) { try { const fileStats: tl.FsStats = tl.stats(file); fs.utimes(targetPath, fileStats.atime, fileStats.mtime, (err) => { - console.warn(`Problem applying the timestamp: ${err}`); + displayTimestampChangeResults(fileStats, err); }); } catch (err) { diff --git a/Tasks/CopyFilesV2/task.json b/Tasks/CopyFilesV2/task.json index 5514ed4d8017..353371a392d0 100644 --- a/Tasks/CopyFilesV2/task.json +++ b/Tasks/CopyFilesV2/task.json @@ -16,8 +16,8 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 186, - "Patch": 1 + "Minor": 188, + "Patch": 0 }, "releaseNotes": "Match pattern consistency.", "demands": [], diff --git a/Tasks/CopyFilesV2/task.loc.json b/Tasks/CopyFilesV2/task.loc.json index 4171c5bc85e6..019ed34c7b17 100644 --- a/Tasks/CopyFilesV2/task.loc.json +++ b/Tasks/CopyFilesV2/task.loc.json @@ -16,8 +16,8 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 186, - "Patch": 1 + "Minor": 188, + "Patch": 0 }, "releaseNotes": "ms-resource:loc.releaseNotes", "demands": [],