Program: 97335
Project: 97335
Buggy source:
@Test public void testCommitWithMergeAbandon() throws Exception {
  ConflictResolverOperation resolverOperation=new ConflictResolverOperation("String_Node_Str",MergeManagerTest.class.getCanonicalName()){
    @Override protected void doWork(    IProgressMonitor monitor) throws Exception {
      assertTrue("String_Node_Str",wasExecuted());
    }
  }
;
  boolean committed=CommitHandler.commitBranch(new ConflictManagerExternal(DemoBranches.SAW_Bld_1,workingBranch),false,true);
  assertTrue("String_Node_Str",!committed);
  List<MergeBranch> mergeBranches=BranchManager.getMergeBranches(workingBranch);
  assertTrue("String_Node_Str",mergeBranches.size() == 1);
  MergeBranch mergeBranchFromFirstCommit=mergeBranches.get(0);
  assertTrue("String_Node_Str",mergeBranchFromFirstCommit.getSourceBranch().equals(workingBranch));
  boolean committed2=CommitHandler.commitBranch(new ConflictManagerExternal(DemoBranches.SAW_Bld_1,workingBranch),false,true);
  assertTrue("String_Node_Str",!committed2);
  List<MergeBranch> mergeBranches2=BranchManager.getMergeBranches(workingBranch);
  assertTrue("String_Node_Str",mergeBranches2.size() == 1);
  MergeBranch mergeBranchFromSecondCommit=mergeBranches2.get(0);
  assertTrue("String_Node_Str",mergeBranchFromSecondCommit.equals(mergeBranchFromFirstCommit));
  UpdateBranchOperation update=new UpdateBranchOperation(workingBranch,resolverOperation);
  Operations.executeAsJob(update,true);
  assertTrue("String_Node_Str",!workingBranch.getBranchState().isRebaselineInProgress() && !workingBranch.getBranchState().isRebaselineInProgress());
  MergeInProgressHandler.handleCommitInProgressPostPrompt(new ConflictManagerExternal(DemoBranches.SAW_Bld_1,workingBranch),DELETE_MERGE,true);
  assertTrue("String_Node_Str",!BranchManager.hasMergeBranches(workingBranch));
  UpdateBranchOperation update2=new UpdateBranchOperation(workingBranch,resolverOperation);
  Operations.executeAsJob(update2,true);
  Thread.sleep(1000);
  assertTrue("String_Node_Str",workingBranch.getBranchState().isRebaselineInProgress());
  Branch branchForUpdate=BranchManager.getFirstMergeBranch(workingBranch);
  FinishUpdateBranchOperation finishUpdateOperation=new FinishUpdateBranchOperation(resolverOperation.getConflictManager(),true,true);
  Operations.executeAsJob(finishUpdateOperation,true);
  Thread.sleep(1000);
  assertTrue("String_Node_Str",workingBranch.getBranchState().isRebaselined());
  Artifact artOnUpdateBranch=ArtifactQuery.getArtifactFromToken(NewArtifactToken,branchForUpdate);
  Operations.executeWorkAndCheckStatus(new PurgeArtifacts(Arrays.asList(artOnUpdateBranch)));
  Thread.sleep(1000);
  BranchManager.purgeBranch(branchForUpdate);
}

Fixed version (ground truth):
@Test public void testCommitWithMergeAbandon() throws Exception {
  ConflictResolverOperation resolverOperation=new ConflictResolverOperation("String_Node_Str",MergeManagerTest.class.getCanonicalName()){
    @Override protected void doWork(    IProgressMonitor monitor) throws Exception {
      assertTrue("String_Node_Str",wasExecuted());
    }
  }
;
  boolean committed=CommitHandler.commitBranch(new ConflictManagerExternal(DemoBranches.SAW_Bld_1,workingBranch),false,true);
  assertTrue("String_Node_Str",!committed);
  List<MergeBranch> mergeBranches=BranchManager.getMergeBranches(workingBranch);
  assertTrue("String_Node_Str",mergeBranches.size() == 1);
  MergeBranch mergeBranchFromFirstCommit=mergeBranches.get(0);
  assertTrue("String_Node_Str",mergeBranchFromFirstCommit.getSourceBranch().equals(workingBranch));
  boolean committed2=CommitHandler.commitBranch(new ConflictManagerExternal(DemoBranches.SAW_Bld_1,workingBranch),false,true);
  assertTrue("String_Node_Str",!committed2);
  List<MergeBranch> mergeBranches2=BranchManager.getMergeBranches(workingBranch);
  assertTrue("String_Node_Str",mergeBranches2.size() == 1);
  MergeBranch mergeBranchFromSecondCommit=mergeBranches2.get(0);
  assertTrue("String_Node_Str",mergeBranchFromSecondCommit.equals(mergeBranchFromFirstCommit));
  UpdateBranchOperation update=new UpdateBranchOperation(workingBranch,resolverOperation);
  Operations.executeWorkAndCheckStatus(update);
  assertTrue("String_Node_Str",!workingBranch.getBranchState().isRebaselineInProgress() && !workingBranch.getBranchState().isRebaselineInProgress());
  MergeInProgressHandler.handleCommitInProgressPostPrompt(new ConflictManagerExternal(DemoBranches.SAW_Bld_1,workingBranch),DELETE_MERGE,true);
  assertTrue("String_Node_Str",!BranchManager.hasMergeBranches(workingBranch));
  UpdateBranchOperation update2=new UpdateBranchOperation(workingBranch,resolverOperation);
  Operations.executeWorkAndCheckStatus(update2);
  assertTrue("String_Node_Str",workingBranch.getBranchState().isRebaselineInProgress());
  Branch branchForUpdate=BranchManager.getFirstMergeBranch(workingBranch);
  FinishUpdateBranchOperation finishUpdateOperation=new FinishUpdateBranchOperation(resolverOperation.getConflictManager(),true,true);
  Operations.executeWorkAndCheckStatus(finishUpdateOperation);
  assertTrue("String_Node_Str",workingBranch.getBranchState().isRebaselined());
  Artifact artOnUpdateBranch=ArtifactQuery.getArtifactFromToken(NewArtifactToken,branchForUpdate);
  Operations.executeWorkAndCheckStatus(new PurgeArtifacts(Arrays.asList(artOnUpdateBranch)));
  Thread.sleep(1000);
  BranchManager.purgeBranch(branchForUpdate);
}