From fe0fc2600cfa721b3e53483ec621b372e7c857e5 Mon Sep 17 00:00:00 2001 From: Alejandro del Castillo Date: Thu, 16 Nov 2017 18:00:17 -0600 Subject: [PATCH 1/2] TfsUserLookup.find: fix logging message Signed-off-by: Alejandro del Castillo --- tfs/src/main/java/hudson/plugins/tfs/model/TfsUserLookup.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tfs/src/main/java/hudson/plugins/tfs/model/TfsUserLookup.java b/tfs/src/main/java/hudson/plugins/tfs/model/TfsUserLookup.java index cc041a75b..d07176fd7 100644 --- a/tfs/src/main/java/hudson/plugins/tfs/model/TfsUserLookup.java +++ b/tfs/src/main/java/hudson/plugins/tfs/model/TfsUserLookup.java @@ -34,11 +34,11 @@ public TfsUserLookup(final IIdentityManagementService ims, final UserAccountMapp */ public User find(final String accountName) { final String mappedAccountName = userAccountMapper.mapUserAccount(accountName); - logger.log(Level.FINE, "Looking up Jenkins user for account '%s'.", mappedAccountName); + logger.log(Level.FINE, String.format("Looking up Jenkins user for account '%s'.", mappedAccountName)); final User jenkinsUser = User.get(mappedAccountName); Mailer.UserProperty mailerProperty = jenkinsUser.getProperty(Mailer.UserProperty.class); if (mailerProperty == null || mailerProperty.getAddress() == null || mailerProperty.getAddress().length() == 0) { - logger.log(Level.FINE, "No Mailer.UserProperty defined for '%s', looking in TFS", mappedAccountName); + logger.log(Level.FINE, String.format("No Mailer.UserProperty defined for '%s', looking in TFS", mappedAccountName)); final TeamFoundationIdentity tfsUser = ims.readIdentity( IdentitySearchFactor.ACCOUNT_NAME, accountName, From db7ccae6ccb5e1ea7088134b3987450844e04ac2 Mon Sep 17 00:00:00 2001 From: Alejandro del Castillo Date: Thu, 16 Nov 2017 18:01:15 -0600 Subject: [PATCH 2/2] tfs: use owner instead of commiter as author It is not uncommon to have automatic processes to merge between branches, run validation before submission, etc. When that happens, the submitter may be different than the owner (the submitter tends to be an account used for automation). In those cases, the Jenkins UI will show the same name for all commits. Use owner name instead, as it better reflects the name of the person that authored the commit. Signed-off-by: Alejandro del Castillo --- .../plugins/tfs/commands/RemoteChangesetVersionCommand.java | 2 +- tfs/src/main/java/hudson/plugins/tfs/model/Project.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tfs/src/main/java/hudson/plugins/tfs/commands/RemoteChangesetVersionCommand.java b/tfs/src/main/java/hudson/plugins/tfs/commands/RemoteChangesetVersionCommand.java index 487479313..90a77387c 100644 --- a/tfs/src/main/java/hudson/plugins/tfs/commands/RemoteChangesetVersionCommand.java +++ b/tfs/src/main/java/hudson/plugins/tfs/commands/RemoteChangesetVersionCommand.java @@ -83,7 +83,7 @@ public Integer call() throws Exception { final Changeset serverChangeset = serverChangeSets[0]; changeSetNumber = serverChangeset.getChangesetID(); final Date changeSetDate = serverChangeset.getDate().getTime(); - final String author = serverChangeset.getCommitter(); + final String author = serverChangeset.getOwner(); final SimpleDateFormat simpleDateFormat = DateUtil.TFS_DATETIME_FORMATTER.get(); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); final String changeSetDateIso8601 = simpleDateFormat.format(changeSetDate); diff --git a/tfs/src/main/java/hudson/plugins/tfs/model/Project.java b/tfs/src/main/java/hudson/plugins/tfs/model/Project.java index 8e8bd0585..c4062bb45 100644 --- a/tfs/src/main/java/hudson/plugins/tfs/model/Project.java +++ b/tfs/src/main/java/hudson/plugins/tfs/model/Project.java @@ -56,7 +56,7 @@ public String getProjectPath() { (com.microsoft.tfs.core.clients.versioncontrol.soapextensions.Changeset serverChangeset, UserLookup userLookup) { final String version = Integer.toString(serverChangeset.getChangesetID(), 10); final Date date = serverChangeset.getDate().getTime(); - final String author = serverChangeset.getCommitter(); + final String author = serverChangeset.getOwner(); final User authorUser = userLookup.find(author); final String comment = serverChangeset.getComment();