commit 7cced2505610e6cebecdd6552edb86be3828a39b
Author: Boris Parkanski <boris.parkanski@mattersight.com>
Date:   Wed Aug 24 17:52:56 2011 -0500

    When updating a relevant JIRA issue, the plugin should add the overall
    result (Result = SUCCESS | FAILURE | UNSTABLE | ...) to the comments.
    
    Signed-off-by: Boris Parkanski <boris.parkanski@mattersight.com>

diff --git a/src/main/java/hudson/plugins/jira/Updater.java b/src/main/java/hudson/plugins/jira/Updater.java
index 23a33c3..2d8db7d 100755
--- a/src/main/java/hudson/plugins/jira/Updater.java
+++ b/src/main/java/hudson/plugins/jira/Updater.java
@@ -32,14 +32,14 @@ import org.apache.commons.lang.StringUtils;
 /**
  * Actual JIRA update logic.
  *
- * 
+ *
  * @author Kohsuke Kawaguchi
  */
 class Updater {
     static boolean perform(AbstractBuild<?, ?> build, BuildListener listener) throws InterruptedException, IOException {
         PrintStream logger = listener.getLogger();
         List<JiraIssue> issues = null;
-        
+
         try {
             JiraSite site = JiraSite.get(build.getProject());
             if(site==null) {
@@ -47,22 +47,22 @@ class Updater {
                 build.setResult(Result.FAILURE);
                 return true;
             }
-    
+
             String rootUrl = Hudson.getInstance().getRootUrl();
             if(rootUrl==null) {
                 logger.println(Messages.Updater_NoJenkinsUrl());
                 build.setResult(Result.FAILURE);
                 return true;
             }
-            
+
             Set<String> ids = findIssueIdsRecursive(build, site.getIssuePattern(), listener);
-    
+
             if(ids.isEmpty()) {
                 if(debug)
                     logger.println("No JIRA issues found.");
                 return true;    // nothing found here.
             }
-            
+
             JiraSession session = null;
     		try {
     			session = site.createSession();
@@ -75,7 +75,7 @@ class Updater {
                 build.setResult(Result.FAILURE);
                 return true;
             }
-    
+
             boolean doUpdate = false;
             if (site.updateJiraIssueForAllStatus){
                 doUpdate = true;
@@ -83,10 +83,10 @@ class Updater {
               doUpdate = build.getResult().isBetterOrEqualTo(Result.UNSTABLE);
             }
             boolean useWikiStyleComments = site.supportsWikiStyleComment;
-            
+
             issues = getJiraIssues(ids, session, logger);
             build.getActions().add(new JiraBuildAction(build,issues));
-            
+
             if (doUpdate) {
                 submitComments(build, logger, rootUrl, issues,
                         session, useWikiStyleComments, site.recordScmChanges, site.groupVisibility, site.roleVisibility);
@@ -105,7 +105,7 @@ class Updater {
         return true;
     }
 
- 
+
     /**
      * Submits comments for the given issues.
      * Removes from <code>issues</code> the ones which appear to be invalid.
@@ -151,8 +151,8 @@ class Updater {
             }
         }
     }
-	
-	private static List<JiraIssue> getJiraIssues( 
+
+	private static List<JiraIssue> getJiraIssues(
             Set<String> ids, JiraSession session, PrintStream logger) throws RemoteException {
         List<JiraIssue> issues = new ArrayList<JiraIssue>(ids.size());
         for (String id : ids) {
@@ -166,7 +166,7 @@ class Updater {
         }
         return issues;
     }
-	
+
 
     /**
      * Creates a comment to be used in JIRA for the build.
@@ -175,13 +175,21 @@ class Updater {
             boolean wikiStyle, String jenkinsRootUrl, String scmComments, boolean recordScmChanges, JiraIssue jiraIssue) {
 		String comment = String.format(
 		    wikiStyle ?
-		    "Integrated in !%1$simages/16x16/%3$s! [%2$s|%4$s]\n     %5$s":
-		    "Integrated in %2$s (See [%4$s])\n    %5$s",
+// [BP] 2010-08-05 | Original code
+//		    "Integrated in !%1$simages/16x16/%3$s! [%2$s|%4$s]\n     %5$s":
+//		    "Integrated in %2$s (See [%4$s])\n    %5$s",
+// [BP] 2010-08-05 | Adding a line with build result
+		    "Integrated in !%1$simages/16x16/%3$s! [%2$s|%4$s]\n     %5$s\n     Result = %6$s":
+		    "Integrated in %2$s (See [%4$s])\n    %5$s\n     Result = %6$s",
 		    jenkinsRootUrl,
 		    build,
 		    build.getResult().color.getImage(),
 		    Util.encode(jenkinsRootUrl+build.getUrl()),
-		    scmComments);
+// [BP] 2010-08-05 | Original code
+//		    scmComments);
+// [BP] 2010-08-05 | Adding a line with build result
+                    scmComments,
+                    build.getResult().toString());
 		if (recordScmChanges) {
 		    List<String> scmChanges = getScmComments(wikiStyle, build, jiraIssue );
 		    StringBuilder sb = new StringBuilder(comment);
@@ -193,7 +201,7 @@ class Updater {
 		}
 		return comment;
 	}
-	
+
 	private static List<String> getScmComments(boolean wikiStyle, AbstractBuild<?, ?> build, JiraIssue jiraIssue)
 	{
 	    RepositoryBrowser repoBrowser = null;
@@ -241,7 +249,7 @@ class Updater {
 	    	        for (String affectedPath : change.getAffectedPaths()) {
 	    	            scmChange.append( "* " ).append( affectedPath ).append( "\n" );
 	    	        }
-    	            
+
     	        }
     	        if (scmChange.length()>0) {
     	            scmChanges.add( scmChange.toString() );
@@ -252,7 +260,7 @@ class Updater {
 	    }
 	    return scmChanges;
 	}
-	
+
 	private static String getRevision(Entry entry) {
 	    // svn at least can get the revision
 	    try {
@@ -267,7 +275,7 @@ class Updater {
 	        return null;
 	    }
 	}
-	
+
 
     /**
      * Finds the strings that match JIRA issue ID patterns.
@@ -308,7 +316,7 @@ class Updater {
         for (Entry change : build.getChangeSet()) {
             LOGGER.fine("Looking for JIRA ID in "+change.getMsg());
             Matcher m = pattern.matcher(change.getMsg());
-            
+
             while (m.find()) {
             	if (m.groupCount() >= 1) {
 	                String content = StringUtils.upperCase( m.group(1));
@@ -317,7 +325,7 @@ class Updater {
             		listener.getLogger().println("Warning: The JIRA pattern " + pattern + " doesn't define a capturing group!");
             	}
             }
-            
+
         }
     }