public String createDefaultTitle(final List<GitCommit> commits,final String sourceBranchName,final String targetBranchName){
  if (commits == null || commits.isEmpty()) {
    return StringUtils.EMPTY;
  }
  if (commits.size() == 1) {
    final GitCommit commit=commits.get(0);
    final String commitMessage=commit.getSubject();
    final int titleLength=120;
    if (commitMessage.length() < titleLength) {
      return commitMessage;
    }
 else {
      final String shortCommitMessage=commitMessage.substring(0,titleLength);
      return StringUtils.substringBeforeLast(shortCommitMessage,"\\s+");
    }
  }
  return TfPluginBundle.message(TfPluginBundle.KEY_CREATE_PR_DEFAULT_TITLE,sourceBranchName,targetBranchName);
}

public String createDefaultTitle ( final List < GitCommit > commits , final String sourceBranchName , final String targetBranchName ) { if ( commits == null || commits . isEmpty ( ) ) { return StringUtils . EMPTY ; } if ( commits . size ( ) == 1 ) { final GitCommit commit = commits . get ( 0 ) ; final String commitMessage = commit . getSubject ( ) ; final int titleLength = 120 ; if ( commitMessage . length ( ) < titleLength ) { return commitMessage ; } else { final String shortCommitMessage = commitMessage . substring ( 0 , titleLength ) ; return StringUtils . substringBeforeLast ( shortCommitMessage , "\\s+" ) ; } } return TfPluginBundle . message ( TfPluginBundle . KEY_CREATE_PR_DEFAULT_TITLE , sourceBranchName , targetBranchName ) ; }
create a default title for pull request < p / > if there is only one commit , use its subject ; otherwise use a standard template " merge source to target " . < p / > default titles will be less than 120 chars .
