private void createNewReviewTask(TaskRepository repository,TaskData taskData) throws CoreException {
  Repository repo=AppraisePluginUtils.getGitRepoForRepository(repository);
  AppraisePluginReviewClient client;
  try {
    client=new AppraisePluginReviewClient(repository);
  }
 catch (  GitClientException e1) {
    throw new CoreException(new Status(IStatus.ERROR,AppraiseConnectorPlugin.PLUGIN_ID,"Failed to initialize git client"));
  }
  String currentBranch;
  try {
    currentBranch=repo.getFullBranch();
  }
 catch (  IOException e) {
    throw new CoreException(new Status(IStatus.ERROR,AppraiseConnectorPlugin.PLUGIN_ID,"Error retrieving current branch",e));
  }
  if (MASTER_REF.equals(currentBranch)) {
    throw new CoreException(new Status(IStatus.ERROR,AppraiseConnectorPlugin.PLUGIN_ID,"Cannot create review on master branch"));
  }
  setAttributeValue(taskData,schema.REQUESTER,repository.getUserName());
  setAttributeValue(taskData,schema.TARGET_REF,MASTER_REF);
  setAttributeValue(taskData,schema.REVIEW_REF,currentBranch);
  RevCommit reviewCommit;
  try {
    reviewCommit=client.getReviewCommit(currentBranch,MASTER_REF);
  }
 catch (  GitClientException e) {
    throw new CoreException(new Status(IStatus.ERROR,AppraiseConnectorPlugin.PLUGIN_ID,"Cannot find a merge base",e));
  }
  if (reviewCommit == null) {
    throw new CoreException(new Status(IStatus.INFO,AppraiseConnectorPlugin.PLUGIN_ID,"No commits to review on " + currentBranch));
  }
  setAttributeValue(taskData,schema.DESCRIPTION,reviewCommit.getFullMessage());
  setAttributeValue(taskData,schema.REVIEW_COMMIT,reviewCommit.getName());
  try {
    List<DiffEntry> diffs=client.getReviewDiffs(currentBranch,MASTER_REF);
    populateDiffs(repository,diffs,taskData);
  }
 catch (  Exception e) {
    throw new CoreException(new Status(IStatus.ERROR,AppraiseConnectorPlugin.PLUGIN_ID,"Failed to load review diffs",e));
  }
}

private void createNewReviewTask ( TaskRepository repository , TaskData taskData ) throws CoreException { Repository repo = AppraisePluginUtils . getGitRepoForRepository ( repository ) ; AppraisePluginReviewClient client ; try { client = new AppraisePluginReviewClient ( repository ) ; } catch ( GitClientException e1 ) { throw new CoreException ( new Status ( IStatus . ERROR , AppraiseConnectorPlugin . PLUGIN_ID , "Failed to initialize git client" ) ) ; } String currentBranch ; try { currentBranch = repo . getFullBranch ( ) ; } catch ( IOException e ) { throw new CoreException ( new Status ( IStatus . ERROR , AppraiseConnectorPlugin . PLUGIN_ID , "Error retrieving current branch" , e ) ) ; } if ( MASTER_REF . equals ( currentBranch ) ) { throw new CoreException ( new Status ( IStatus . ERROR , AppraiseConnectorPlugin . PLUGIN_ID , "Cannot create review on master branch" ) ) ; } setAttributeValue ( taskData , schema . REQUESTER , repository . getUserName ( ) ) ; setAttributeValue ( taskData , schema . TARGET_REF , MASTER_REF ) ; setAttributeValue ( taskData , schema . REVIEW_REF , currentBranch ) ; RevCommit reviewCommit ; try { reviewCommit = client . getReviewCommit ( currentBranch , MASTER_REF ) ; } catch ( GitClientException e ) { throw new CoreException ( new Status ( IStatus . ERROR , AppraiseConnectorPlugin . PLUGIN_ID , "Cannot find a merge base" , e ) ) ; } if ( reviewCommit == null ) { throw new CoreException ( new Status ( IStatus . INFO , AppraiseConnectorPlugin . PLUGIN_ID , "No commits to review on " + currentBranch ) ) ; } setAttributeValue ( taskData , schema . DESCRIPTION , reviewCommit . getFullMessage ( ) ) ; setAttributeValue ( taskData , schema . REVIEW_COMMIT , reviewCommit . getName ( ) ) ; try { List < DiffEntry > diffs = client . getReviewDiffs ( currentBranch , MASTER_REF ) ; populateDiffs ( repository , diffs , taskData ) ; } catch ( Exception e ) { throw new CoreException ( new Status ( IStatus . ERROR , AppraiseConnectorPlugin . PLUGIN_ID , "Failed to load review diffs" , e ) ) ; } }
sets up a new review on the current branch , as a task .
