static svn_error_t * call_conflict_func(svn_wc_conflict_result_t **result, const svn_wc_conflict_description2_t *conflict, void *baton, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { svn_client_ctx_t *ctx = baton; if (ctx->conflict_func) { const svn_wc_conflict_description_t *cd; cd = svn_wc__cd2_to_cd(conflict, scratch_pool); SVN_ERR(ctx->conflict_func(result, cd, ctx->conflict_baton, result_pool)); } else { /* We have to set a result; so we postpone */ *result = svn_wc_create_conflict_result(svn_wc_conflict_choose_postpone, NULL, result_pool); } return SVN_NO_ERROR; }
svn_wc_conflict_result_t * ClientContext::javaResultToC(jobject jresult, apr_pool_t *pool) { JNIEnv *env = JNIUtil::getEnv(); // Create a local frame for our references env->PushLocalFrame(LOCAL_FRAME_SIZE); if (JNIUtil::isJavaExceptionThrown()) return SVN_NO_ERROR; static jmethodID getChoice = 0; static jmethodID getMergedPath = 0; jclass clazz = NULL; if (getChoice == 0 || getMergedPath == 0) { clazz = env->FindClass(JAVAHL_CLASS("/ConflictResult")); if (JNIUtil::isJavaExceptionThrown()) POP_AND_RETURN_NULL; } if (getChoice == 0) { getChoice = env->GetMethodID(clazz, "getChoice", "()" JAVAHL_ARG("/ConflictResult$Choice;")); if (JNIUtil::isJavaExceptionThrown() || getChoice == 0) POP_AND_RETURN_NULL; } if (getMergedPath == 0) { getMergedPath = env->GetMethodID(clazz, "getMergedPath", "()Ljava/lang/String;"); if (JNIUtil::isJavaExceptionThrown() || getMergedPath == 0) POP_AND_RETURN_NULL; } jobject jchoice = env->CallObjectMethod(jresult, getChoice); if (JNIUtil::isJavaExceptionThrown()) POP_AND_RETURN_NULL; jstring jmergedPath = (jstring) env->CallObjectMethod(jresult, getMergedPath); if (JNIUtil::isJavaExceptionThrown()) POP_AND_RETURN_NULL; JNIStringHolder mergedPath(jmergedPath); if (JNIUtil::isJavaExceptionThrown()) POP_AND_RETURN_NULL; svn_wc_conflict_result_t *result = svn_wc_create_conflict_result(EnumMapper::toConflictChoice(jchoice), mergedPath.pstrdup(pool), pool); env->PopLocalFrame(NULL); return result; }
svn_wc_conflict_result_t * ConflictResolverCallback::javaResultToC(jobject jresult, apr_pool_t *pool) { JNIEnv *env = JNIUtil::getEnv(); static jmethodID getChoice = 0; static jmethodID getMergedPath = 0; jclass clazz = NULL; if (getChoice == 0 || getMergedPath == 0) { clazz = env->FindClass(JAVA_PACKAGE "/ConflictResult"); if (JNIUtil::isJavaExceptionThrown()) return NULL; } if (getChoice == 0) { getChoice = env->GetMethodID(clazz, "getChoice", "()I"); if (JNIUtil::isJavaExceptionThrown() || getChoice == 0) return NULL; } if (getMergedPath == 0) { getMergedPath = env->GetMethodID(clazz, "getMergedPath", "()Ljava/lang/String;"); if (JNIUtil::isJavaExceptionThrown() || getMergedPath == 0) return NULL; } if (clazz) { env->DeleteLocalRef(clazz); if (JNIUtil::isJavaExceptionThrown()) return NULL; } jint jchoice = env->CallIntMethod(jresult, getChoice); if (JNIUtil::isJavaExceptionThrown()) return NULL; jstring jmergedPath = (jstring) env->CallObjectMethod(jresult, getMergedPath); if (JNIUtil::isJavaExceptionThrown()) return NULL; JNIStringHolder mergedPath(jmergedPath); return svn_wc_create_conflict_result(javaChoiceToC(jchoice), mergedPath.pstrdup(pool), pool); }
/* A conflict callback that simply records the conflicted path in BATON. Implements svn_wc_conflict_resolver_func2_t. */ static svn_error_t * record_conflict(svn_wc_conflict_result_t **result, const svn_wc_conflict_description2_t *description, void *baton, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { apr_hash_t *conflicted_paths = baton; svn_hash_sets(conflicted_paths, apr_pstrdup(apr_hash_pool_get(conflicted_paths), description->local_abspath), ""); *result = svn_wc_create_conflict_result(svn_wc_conflict_choose_postpone, NULL, result_pool); return SVN_NO_ERROR; }
void ConflictResult::assignResult(svn_wc_conflict_result_t**aResult,const Pool&pool)const { #if ((SVN_VER_MAJOR == 1) && (SVN_VER_MINOR >= 5)) || (SVN_VER_MAJOR > 1) svn_wc_conflict_choice_t _choice; switch (choice()) { case ConflictResult::ChooseBase: _choice=svn_wc_conflict_choose_base; break; case ConflictResult::ChooseTheirsFull: _choice=svn_wc_conflict_choose_theirs_full; break; case ConflictResult::ChooseMineFull: _choice=svn_wc_conflict_choose_mine_full; break; case ConflictResult::ChooseTheirsConflict: _choice=svn_wc_conflict_choose_theirs_conflict; break; case ConflictResult::ChooseMineConflict: _choice=svn_wc_conflict_choose_mine_conflict; break; case ConflictResult::ChooseMerged: _choice=svn_wc_conflict_choose_merged; break; case ConflictResult::ChoosePostpone: default: _choice=svn_wc_conflict_choose_postpone; break; } const char* _merged_file = mergedFile().isNull()?0:apr_pstrdup (pool,mergedFile().toUtf8()); if ((*aResult)==0) { (*aResult) = svn_wc_create_conflict_result(_choice,_merged_file,pool); } else { (*aResult)->choice=_choice; (*aResult)->merged_file=_merged_file; } #else Q_UNUSED(aResult); Q_UNUSED(pool); #endif }