⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 svnclient.cpp

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    {        JNIUtil::handleSVNError(Err);        return -1;    }    svn_revnum_t retval;    svn_client_ctx_t *ctx = getContext(NULL);    if(ctx == NULL)    {        return -1;    }    Err = svn_client_export3 (&retval, sourcePath.c_str (),                                          destinationPath.c_str (),                                          pegRevision.revision(),                                          revision.revision (),                                          force,                                          ignoreExternals,                                          recurse,                                          nativeEOL,                                          ctx,                                          apr_pool);    if(Err != NULL)    {        JNIUtil::handleSVNError(Err);        return -1;    }    return retval;}jlong SVNClient::doSwitch(const char *path, const char *url,                           Revision &revision, bool recurse){    Pool requestPool;    apr_pool_t * apr_pool = requestPool.pool ();    if(path == NULL)    {        JNIUtil::throwNullPointerException("path");        return -1;    }    if(url == NULL)    {        JNIUtil::throwNullPointerException("url");        return -1;    }    Path intUrl(url);    svn_error_t *Err = intUrl.error_occured();    if(Err != NULL)    {        JNIUtil::handleSVNError(Err);        return -1;    }    Path intPath(path);    Err = intPath.error_occured();    if(Err != NULL)    {        JNIUtil::handleSVNError(Err);        return -1;    }    svn_revnum_t retval;    svn_client_ctx_t *ctx = getContext(NULL);    if(ctx == NULL)    {        return -1;    }    Err = svn_client_switch (&retval, intPath.c_str (),                                          intUrl.c_str(),                                          revision.revision (),                                          recurse,                                          ctx,                                          apr_pool);    if(Err != NULL)    {         JNIUtil::handleSVNError(Err);        return -1;    }    return retval;}void SVNClient::doImport(const char *path, const char *url,                          const char *message, bool recurse){    Pool requestPool;    apr_pool_t * apr_pool = requestPool.pool ();    if(path == NULL)    {        JNIUtil::throwNullPointerException("path");        return;    }    if(url == NULL)    {        JNIUtil::throwNullPointerException("url");        return;    }    Path intPath(path);    svn_error_t *Err = intPath.error_occured();    if(Err != NULL)    {        JNIUtil::handleSVNError(Err);        return;    }    Path intUrl(url);    Err = intUrl.error_occured();    if(Err != NULL)    {        JNIUtil::handleSVNError(Err);        return;    }    svn_client_commit_info_t *commit_info = NULL;    svn_client_ctx_t *ctx = getContext(message);    if(ctx == NULL)    {        return;    }    Err = svn_client_import (&commit_info,                                          intPath.c_str (),                                          intUrl.c_str(),                                          !recurse,                                          ctx,                                          apr_pool);    if(Err != NULL)         JNIUtil::handleSVNError(Err);}void SVNClient::merge(const char *path1, Revision &revision1,                       const char *path2, Revision &revision2,                       const char *localPath, bool force, bool recurse,                      bool ignoreAncestry, bool dryRun){    Pool requestPool;    if(path1 == NULL)    {        JNIUtil::throwNullPointerException("path1");        return;    }    if(path2 == NULL)    {        JNIUtil::throwNullPointerException("path2");        return;    }    if(localPath == NULL)    {        JNIUtil::throwNullPointerException("localPath");        return;    }    apr_pool_t * apr_pool = requestPool.pool ();    Path intLocalPath(localPath);    svn_error_t *Err = intLocalPath.error_occured();    if(Err != NULL)    {        JNIUtil::handleSVNError(Err);        return;    }    Path srcPath1(path1);    Err = srcPath1.error_occured();    if(Err != NULL)    {        JNIUtil::handleSVNError(Err);        return;    }    Path srcPath2 = path2;    Err = srcPath2.error_occured();    if(Err != NULL)    {        JNIUtil::handleSVNError(Err);        return;    }    svn_client_ctx_t *ctx = getContext(NULL);    if(ctx == NULL)    {        return;    }    Err = svn_client_merge (srcPath1.c_str (),                                         revision1.revision (),                                         srcPath2.c_str (),                                         revision2.revision (),                                         intLocalPath.c_str(),                                         recurse,                                         ignoreAncestry,                                         force,                                         dryRun,                                         ctx,                                         apr_pool);    if(Err != NULL)         JNIUtil::handleSVNError(Err);}void SVNClient::merge(const char *path, Revision &pegRevision,                       Revision &revision1, Revision &revision2,                       const char *localPath, bool force, bool recurse,                      bool ignoreAncestry, bool dryRun){    Pool requestPool;    if(path == NULL)    {        JNIUtil::throwNullPointerException("path");        return;    }    if(localPath == NULL)    {        JNIUtil::throwNullPointerException("localPath");        return;    }    apr_pool_t * apr_pool = requestPool.pool ();    Path intLocalPath(localPath);    svn_error_t *Err = intLocalPath.error_occured();    if(Err != NULL)    {        JNIUtil::handleSVNError(Err);        return;    }    Path srcPath(path);    Err = srcPath.error_occured();    if(Err != NULL)    {        JNIUtil::handleSVNError(Err);        return;    }    svn_client_ctx_t *ctx = getContext(NULL);    if(ctx == NULL)    {        return;    }    Err = svn_client_merge_peg (srcPath.c_str (),                                         revision1.revision (),                                         revision2.revision (),                                         pegRevision.revision(),                                          intLocalPath.c_str(),                                         recurse,                                         ignoreAncestry,                                         force,                                         dryRun,                                         ctx,                                         apr_pool);    if(Err != NULL)         JNIUtil::handleSVNError(Err);}/** * Get a property */jobject SVNClient::propertyGet(jobject jthis, const char *path,                                const char *name, Revision &revision,                                Revision &pegRevision){    Pool requestPool;    if(path == NULL)    {        JNIUtil::throwNullPointerException("path");        return NULL;    }    if(name == NULL)    {        JNIUtil::throwNullPointerException("name");        return NULL;    }    apr_pool_t * apr_pool = requestPool.pool ();    Path intPath(path);    svn_error_t *Err = intPath.error_occured();    if(Err != NULL)    {        JNIUtil::handleSVNError(Err);        return NULL;    }    svn_client_ctx_t *ctx = getContext(NULL);    if(ctx == NULL)    {        return NULL;    }    apr_hash_t *props;    Err = svn_client_propget2(&props,                                          name,                                          intPath.c_str(),                                          pegRevision.revision(),                                          revision.revision(),                                          FALSE,                                          ctx,                                          apr_pool);    if(Err != NULL)    {        JNIUtil::handleSVNError(Err);        return NULL;    }    apr_hash_index_t *hi;    // only one element since we disabled recurse    hi = apr_hash_first (apr_pool, props);     if (hi == NULL)        return NULL; // no property with this name    const char *filename;    svn_string_t *propval;    apr_hash_this (hi, (const void **)&filename, NULL, (void**)&propval);    if(propval == NULL)        return NULL;    return createJavaProperty(jthis, path, name, propval);}jobjectArray SVNClient::properties(jobject jthis, const char *path,                                    Revision & revision, Revision &pegRevision){    apr_array_header_t * props;    Pool requestPool;    if(path == NULL)    {        JNIUtil::throwNullPointerException("path");        return NULL;    }    apr_pool_t * apr_pool = requestPool.pool ();    Path intPath(path);    svn_error_t *Err = intPath.error_occured();    if(Err != NULL)    {        JNIUtil::handleSVNError(Err);        return NULL;    }    svn_client_ctx_t *ctx = getContext(NULL);    if(ctx == NULL)    {        return NULL;    }    Err = svn_client_proplist2 (&props,                                            intPath.c_str (),                                            pegRevision.revision(),                                            revision.revision(),                                            FALSE,                                            ctx,                                            apr_pool);    if(Err != NULL)    {        JNIUtil::handleSVNError(Err);        return NULL;    }    // since we disabled recurse, props->nelts should be 1    for (int j = 0; j < props->nelts; ++j)    {        svn_client_proplist_item_t *item =            ((svn_client_proplist_item_t **)props->elts)[j];        apr_hash_index_t *hi;        int count = apr_hash_count (item->prop_hash);        JNIEnv *env = JNIUtil::getEnv();        jclass clazz = env->FindClass(JAVA_PACKAGE"/PropertyData");        if(JNIUtil::isJavaExceptionThrown())        {            return NULL;        }        jobjectArray ret = env->NewObjectArray(count, clazz, NULL);        if(JNIUtil::isJavaExceptionThrown())        {            return NULL;        }        env->DeleteLocalRef(clazz);        if(JNIUtil::isJavaExceptionThrown())        {            return NULL;        }        int i = 0;        for (hi = apr_hash_first (apr_pool, item->prop_hash); hi;             hi = apr_hash_next (hi), i++)        {            const char *key;            svn_string_t *val;            apr_hash_this (hi, (const void **)&key, NULL, (void**)&val);            jobject object = createJavaProperty(jthis, item->node_name->data,                                                 key, val);            env->SetObjectArrayElement(ret, i, object);            if(JNIUtil::isJavaExceptionThrown())            {                return NULL;            }            env->DeleteLocalRef(object);            if(JNIUtil::isJavaExceptionThrown())            {                return NULL;            }        }        return ret;    }    return NULL;}void SVNClient::propertySet(const char *path, const char *name,                             const char *value, bool recurse, bool force){    Pool requestPool;    if(path == NULL)    {        JNIUtil::throwNullPointerException("path");        return;    }    if(name == NULL)    {        JNIUtil::throwNullPointerException("name");        return;    }    if(value == NULL)    {        JNIUtil::throwNullPointerException("value");        return;    }    svn_string_t *val = svn_string_create(value, requestPool.pool());    propertySet(path, name, val, recurse, force);}void SVNClient::propertySet(const char *path, const char *name,                             JNIByteArray &value, bool recurse, bool force){    Pool requestPool;    if(path == NULL)    {        JNIUtil::throwNullPointerException("path");        return;    }    if(name == NULL)    {        JNIUtil::throwNullPointerException("name");        return;    }    if(value.isNull())    {        JNIUtil::throwNullPointerException("value");        return;    }    svn_string_t *val = svn_string_ncreate((const char *)value.getBytes(),                                            value.getLength(),                                            requestPool.pool());    propertySet(path, name, val, recurse, force);}void SVNClient::propertyRemove(const char *path, const char *name,                                bool recurse){

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -