internal static Result Try( IRestApi restApi, string repository, string srcTaskBranch, string dstTrunkBranch) { int shelveId = 0; Result opResult = new Result(); try { RestApi.MergeToResponse mergeToResult = restApi.MergeBranchToShelve(repository, srcTaskBranch, dstTrunkBranch); mLog.DebugFormat( "Try merge from branch {0} to branch {1} finished with status {2} and message: {3}", srcTaskBranch, dstTrunkBranch, mergeToResult.Status, mergeToResult.Message); if (mergeToResult.Status == RestApi.MergeToResponse.MergeToResultStatus.MergeNotNeeded) { mLog.InfoFormat("Branch {0} is already merged in branch {1}. Won't be processed anymore...", srcTaskBranch, dstTrunkBranch); return(null); } if (mergeToResult.Status == RestApi.MergeToResponse.MergeToResultStatus.OK) { shelveId = mergeToResult.ChangesetNumber; opResult.HasManualConflicts = false; return(opResult); } opResult.HasManualConflicts = true; opResult.Message = mergeToResult.Message; return(opResult); } finally { if (shelveId != 0) { SafeDeleteShelve(restApi, repository, shelveId); } } }