Source:
private void check(BranchData branchData) { BranchState state = branchData.getBranchState(); BranchType type = branchData.getBranchType(); if (BranchType.SYSTEM_ROOT.equals(type)) { if (!BranchState.CREATED.equals(state)) { branchData.setBranchState(BranchState.CREATED); branchData.setReason("System Root should always be set to created"); } } else if (state != BranchState.DELETED && state != BranchState.COMMIT_IN_PROGRESS && state != BranchState.REBASELINE_IN_PROGRESS && state != BranchState.DELETE_IN_PROGRESS && state != BranchState.PURGE_IN_PROGRESS && state != BranchState.PURGED) { if (BranchType.WORKING.equals(type)) { if (isRebaselined(branchData)) { branchData.setBranchState(BranchState.REBASELINED); branchData.setReason("Rebaselined case - detected from name"); } else if (hasBeenCommitted(branchData)) { branchData.setBranchState(BranchState.COMMITTED); branchData.setReason("Committed case - detected"); } else if (branchData.getNumberOfTxs() > 1) { branchData.setBranchState(BranchState.MODIFIED); branchData.setReason("Modified case - detected"); } else { branchData.setBranchState(BranchState.CREATED); branchData.setReason("Was Created case - detected"); } } else if (BranchType.MERGE.equals(type)) { if (hasBeenCommitted(branchData)) { branchData.setBranchState(BranchState.COMMITTED); branchData.setReason("Committed case - detected"); } else if (branchData.getNumberOfTxs() > 1) { branchData.setBranchState(BranchState.MODIFIED); branchData.setReason("Modified case - detected"); } else { branchData.setBranchState(BranchState.CREATED); branchData.setReason("Was Created case - detected"); } } } }

Target:
private void check(BranchData branchData) { BranchState state = branchData.getBranchState(); BranchType type = branchData.getBranchType(); if (BranchType.SYSTEM_ROOT.equals(type)) { if (!BranchState.CREATED.equals(state)) { branchData.setBranchState(BranchState.CREATED); branchData.setReason("System Root should always be set to created"); } } else if (state == BranchState.CREATED || state == BranchState.MODIFIED || state == BranchState.COMMITTED || state == BranchState.REBASELINED || state == BranchState.CREATION_IN_PROGRESS) { if (BranchType.WORKING.equals(type)) { if (isRebaselined(branchData)) { branchData.setBranchState(BranchState.REBASELINED); branchData.setReason("Rebaselined case - detected from name"); } else if (hasBeenCommitted(branchData)) { branchData.setBranchState(BranchState.COMMITTED); branchData.setReason("Committed case - detected"); } else if (branchData.getNumberOfTxs() > 1) { branchData.setBranchState(BranchState.MODIFIED); branchData.setReason("Modified case - detected"); } else { branchData.setBranchState(BranchState.CREATED); branchData.setReason("Was Created case - detected"); } } else if (BranchType.MERGE.equals(type)) { if (hasBeenCommitted(branchData)) { branchData.setBranchState(BranchState.COMMITTED); branchData.setReason("Committed case - detected"); } else if (branchData.getNumberOfTxs() > 1) { branchData.setBranchState(BranchState.MODIFIED); branchData.setReason("Modified case - detected"); } else { branchData.setBranchState(BranchState.CREATED); branchData.setReason("Was Created case - detected"); } } } }