Source:
public void handleTxWork(JdbcConnection connection) { BranchId parentBranch = newBranchData.getParentBranch(); Long destinationBranchUuid = newBranchData.getMergeDestinationBranchId().getId(); checkPreconditions(connection, parentBranch, destinationBranchUuid); BranchId branch = newBranchData.getBranch(); final String truncatedName = Strings.truncate(newBranchData.getName(), 195, true); Timestamp timestamp = GlobalTime.GreenwichMeanTimestamp(); TransactionId nextTransactionId = idManager.getNextTransactionId(); TransactionId tobeTransactionId = nextTransactionId; boolean needsUpdate = jdbcClient.getDbType().matches(JdbcDbType.hsql, JdbcDbType.mysql); if (needsUpdate) { nextTransactionId = TransactionId.valueOf(1); } TransactionId sourceTx; if (newBranchData.getBranchType().isSystemRootBranch()) { sourceTx = tobeTransactionId; } else { sourceTx = TransactionId.SENTINEL; if (BranchType.SYSTEM_ROOT != newBranchData.getBranchType()) { sourceTx = newBranchData.getFromTransaction(); } } int inheritAccessControl = jdbcClient.fetch(connection, 0, SELECT_INHERIT_ACCESS_CONTROL, parentBranch); Object[] toInsert = new Object[] { branch, truncatedName, parentBranch, sourceTx, BranchArchivedState.UNARCHIVED.getValue(), newBranchData.getAssociatedArtifact(), newBranchData.getBranchType().getValue(), BranchState.CREATED.getValue(), nextTransactionId, inheritAccessControl}; jdbcClient.runPreparedUpdate(connection, INSERT_BRANCH, toInsert); if (inheritAccessControl != 0) { copyAccessRules(newBranchData.getAuthor(), parentBranch, branch); } nextTransactionId = tobeTransactionId; jdbcClient.runPreparedUpdate(connection, INSERT_TX_DETAILS, branch, nextTransactionId, newBranchData.getCreationComment(), timestamp, newBranchData.getAuthor(), TransactionDetailsType.Baselined.getId()); if (needsUpdate) { jdbcClient.runPreparedUpdate(connection, UPDATE_BASELINE_BRANCH_TX, nextTransactionId, branch); } populateBaseTransaction(0.30, connection, nextTransactionId, sourceTx); addMergeBranchEntry(0.20, connection); }

Target:
public void handleTxWork(JdbcConnection connection) { BranchId parentBranch = newBranchData.getParentBranch(); BranchId destinationBranchUuid = newBranchData.getMergeDestinationBranchId(); checkPreconditions(connection, parentBranch, destinationBranchUuid); BranchId branch = newBranchData.getBranch(); final String truncatedName = Strings.truncate(newBranchData.getName(), 195, true); Timestamp timestamp = GlobalTime.GreenwichMeanTimestamp(); TransactionId nextTransactionId = idManager.getNextTransactionId(); TransactionId tobeTransactionId = nextTransactionId; boolean needsUpdate = jdbcClient.getDbType().matches(JdbcDbType.hsql, JdbcDbType.mysql); if (needsUpdate) { nextTransactionId = TransactionId.valueOf(1); } TransactionId sourceTx; if (newBranchData.getBranchType().isSystemRootBranch()) { sourceTx = tobeTransactionId; } else { sourceTx = TransactionId.SENTINEL; if (BranchType.SYSTEM_ROOT != newBranchData.getBranchType()) { sourceTx = newBranchData.getFromTransaction(); } } int inheritAccessControl = jdbcClient.fetch(connection, 0, SELECT_INHERIT_ACCESS_CONTROL, parentBranch); Object[] toInsert = new Object[] { branch, truncatedName, parentBranch, sourceTx, BranchArchivedState.UNARCHIVED.getValue(), newBranchData.getAssociatedArtifact(), newBranchData.getBranchType().getValue(), BranchState.CREATED.getValue(), nextTransactionId, inheritAccessControl}; jdbcClient.runPreparedUpdate(connection, INSERT_BRANCH, toInsert); if (inheritAccessControl != 0) { copyAccessRules(newBranchData.getAuthor(), parentBranch, branch); } nextTransactionId = tobeTransactionId; jdbcClient.runPreparedUpdate(connection, INSERT_TX_DETAILS, branch, nextTransactionId, newBranchData.getCreationComment(), timestamp, newBranchData.getAuthor(), TransactionDetailsType.Baselined.getId()); if (needsUpdate) { jdbcClient.runPreparedUpdate(connection, UPDATE_BASELINE_BRANCH_TX, nextTransactionId, branch); } populateBaseTransaction(0.30, connection, nextTransactionId, sourceTx); addMergeBranchEntry(0.20, connection); }