JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_doImport
(JNIEnv *env, jobject jthis, jstring jpath, jstring jurl, jobject jdepth,
 jboolean jnoIgnore, jboolean jignoreUnknownNodeTypes, jobject jrevpropTable,
 jobject jmessage, jobject jcallback)
{
  JNIEntry(SVNClient, doImport);
  SVNClient *cl = SVNClient::getCppObject(jthis);
  if (cl == NULL)
    {
      JNIUtil::throwError(_("bad C++ this"));
      return;
    }
  JNIStringHolder path(jpath);
  if (JNIUtil::isExceptionThrown())
    return;

  JNIStringHolder url(jurl);
  if (JNIUtil::isExceptionThrown())
    return;

  CommitMessage message(jmessage);
  if (JNIUtil::isExceptionThrown())
    return;

  RevpropTable revprops(jrevpropTable);
  if (JNIUtil::isExceptionThrown())
    return;

  CommitCallback callback(jcallback);
  cl->doImport(path, url, &message, EnumMapper::toDepth(jdepth),
               jnoIgnore ? true : false,
               jignoreUnknownNodeTypes ? true : false, revprops,
               jcallback ? &callback : NULL);
}
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_mkdir
(JNIEnv *env, jobject jthis, jobject jtargets, jboolean jmakeParents,
 jobject jrevpropTable, jobject jmessage, jobject jcallback)
{
  JNIEntry(SVNClient, mkdir);
  SVNClient *cl = SVNClient::getCppObject(jthis);
  if (cl == NULL)
    {
      JNIUtil::throwError(_("bad C++ this"));
      return;
    }
  SVN::Pool tmpPool;
  StringArray targetsArr(jtargets);
  Targets targets(targetsArr, tmpPool);
  if (JNIUtil::isExceptionThrown())
    return;

  CommitMessage message(jmessage);
  if (JNIUtil::isExceptionThrown())
    return;

  RevpropTable revprops(jrevpropTable);
  if (JNIUtil::isExceptionThrown())
    return;

  CommitCallback callback(jcallback);
  cl->mkdir(targets, &message, jmakeParents ? true : false, revprops,
            jcallback ? &callback : NULL);
}
예제 #3
0
CommitEditor::CommitEditor(RemoteSession* session,
                           jobject jrevprops, jobject jcommit_callback,
                           jobject jlock_tokens, jboolean jkeep_locks,
                           jobject jget_base_cb, jobject jget_props_cb,
                           jobject jget_kind_cb)

  : m_valid(false),
    m_callback(jcommit_callback),
    m_session(session),
    m_editor(NULL),
    m_get_base_cb(Java::Env(), jget_base_cb),
    m_get_props_cb(Java::Env(), jget_props_cb),
    m_get_kind_cb(Java::Env(), jget_kind_cb),
    m_callback_session(NULL),
    m_callback_session_url(NULL),
    m_callback_session_uuid(NULL)
{
  // Store the repository root identity from the current session as we
  // may need it to open another session in get_copysrc_kind_cb.
  SVN_JNI_ERR(svn_ra_get_repos_root2(session->m_session,
                                     &m_callback_session_url,
                                     pool.getPool()),);
  SVN_JNI_ERR(svn_ra_get_uuid2(session->m_session,
                               &m_callback_session_uuid,
                               pool.getPool()),);

  PropertyTable revprops(jrevprops, true, true);
  if (JNIUtil::isJavaExceptionThrown())
    return;
  LockTokenTable lock_tokens(jlock_tokens);
  if (JNIUtil::isJavaExceptionThrown())
    return;

  SVN::Pool subPool(pool);
  SVN_JNI_ERR(svn_ra__get_commit_ev2(
                  &m_editor,
                  session->m_session,
                  revprops.hash(subPool),
                  m_callback.callback, &m_callback,
                  lock_tokens.hash(subPool, true),
                  bool(jkeep_locks),
                  this->provide_base_cb,
                  this->provide_props_cb,
                  this->get_copysrc_kind_cb, this,
                  pool.getPool(),     // result pool
                  subPool.getPool()), // scratch pool
              );
  m_valid = true;
}
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_copy
(JNIEnv *env, jobject jthis, jobject jcopySources, jstring jdestPath,
 jboolean jcopyAsChild, jboolean jmakeParents, jboolean jignoreExternals,
 jobject jrevpropTable, jobject jmessage, jobject jcallback)
{
  JNIEntry(SVNClient, copy);

  SVNClient *cl = SVNClient::getCppObject(jthis);
  if (cl == NULL)
    {
      JNIUtil::throwError(_("bad C++ this"));
      return;
    }
  Array copySrcArray(jcopySources);
  if (JNIUtil::isExceptionThrown())
    return;

  CopySources copySources(copySrcArray);
  if (JNIUtil::isExceptionThrown())
    return;

  JNIStringHolder destPath(jdestPath);
  if (JNIUtil::isExceptionThrown())
    return;

  CommitMessage message(jmessage);
  if (JNIUtil::isExceptionThrown())
    return;

  RevpropTable revprops(jrevpropTable);
  if (JNIUtil::isExceptionThrown())
    return;

  CommitCallback callback(jcallback);
  cl->copy(copySources, destPath, &message, jcopyAsChild ? true : false,
           jmakeParents ? true : false, jignoreExternals ? true : false,
           revprops, jcallback ? &callback : NULL);
}
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_propertySetRemote
(JNIEnv *env, jobject jthis, jstring jpath, jlong jbaseRev, jstring jname,
 jbyteArray jval, jobject jmessage, jboolean jforce, jobject jrevpropTable,
 jobject jcallback)
{
  JNIEntry(SVNClient, propertySet);
  SVNClient *cl = SVNClient::getCppObject(jthis);
  if (cl == NULL)
    {
      JNIUtil::throwError(_("bad C++ this"));
      return;
    }
  JNIStringHolder path(jpath);
  if (JNIUtil::isExceptionThrown())
    return;

  JNIStringHolder name(jname);
  if (JNIUtil::isExceptionThrown())
    return;

  CommitMessage message(jmessage);
  if (JNIUtil::isExceptionThrown())
    return;

  JNIByteArray value(jval);
  if (JNIUtil::isExceptionThrown())
    return;

  RevpropTable revprops(jrevpropTable);
  if (JNIUtil::isExceptionThrown())
    return;

  CommitCallback callback(jcallback);
  cl->propertySetRemote(path, jbaseRev, name, &message, value,
                        jforce ? true:false,
                        revprops, jcallback ? &callback : NULL);
}
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_commit
(JNIEnv *env, jobject jthis, jobject jtargets, jobject jdepth,
 jboolean jnoUnlock, jboolean jkeepChangelist, jobject jchangelists,
 jobject jrevpropTable, jobject jmessage, jobject jcallback)
{
  JNIEntry(SVNClient, commit);
  SVNClient *cl = SVNClient::getCppObject(jthis);
  if (cl == NULL)
    {
      JNIUtil::throwError(_("bad C++ this"));
      return;
    }
  SVN::Pool tmpPool;
  StringArray targetsArr(jtargets);
  Targets targets(targetsArr, tmpPool);
  if (JNIUtil::isExceptionThrown())
    return;

  CommitMessage message(jmessage);
  if (JNIUtil::isExceptionThrown())
    return;

  // Build the changelist vector from the Java array.
  StringArray changelists(jchangelists);
  if (JNIUtil::isExceptionThrown())
    return;

  RevpropTable revprops(jrevpropTable);
  if (JNIUtil::isExceptionThrown())
    return;

  CommitCallback callback(jcallback);
  cl->commit(targets, &message, EnumMapper::toDepth(jdepth),
             jnoUnlock ? true : false, jkeepChangelist ? true : false,
             changelists, revprops,
             jcallback ? &callback : NULL);
}
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_move
(JNIEnv *env, jobject jthis, jobject jsrcPaths, jstring jdestPath,
 jboolean jforce, jboolean jmoveAsChild, jboolean jmakeParents,
 jobject jrevpropTable, jobject jmessage, jobject jcallback)
{
  JNIEntry(SVNClient, move);

  SVNClient *cl = SVNClient::getCppObject(jthis);
  if (cl == NULL)
    {
      JNIUtil::throwError(_("bad C++ this"));
      return;
    }
  SVN::Pool tmpPool;
  StringArray srcPathArr(jsrcPaths);
  Targets srcPaths(srcPathArr, tmpPool);
  if (JNIUtil::isExceptionThrown())
    return;
  JNIStringHolder destPath(jdestPath);
  if (JNIUtil::isExceptionThrown())
    return;

  CommitMessage message(jmessage);
  if (JNIUtil::isExceptionThrown())
    return;

  RevpropTable revprops(jrevpropTable);
  if (JNIUtil::isExceptionThrown())
    return;

  CommitCallback callback(jcallback);
  cl->move(srcPaths, destPath, &message, jforce ? true : false,
           jmoveAsChild ? true : false, jmakeParents ? true : false,
           revprops, jcallback ? &callback : NULL);
}