You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Ben Collins-Sussman <su...@red-bean.com> on 2007/10/14 21:15:49 UTC

new conflict API

I committed the new conflict-callback API.  It has less cruft and now
is ready for dealing with property conflicts.  Nothing actually *uses*
the property-conflict part yet, but at least 'make check' still
passes... and hand-tests show interactive conflict prompting working
as usual.

I'm aware that my commit broke JavaHL.  I spent 10 minutes trying to
update JavaHL, but there's some serious background I'm missing.  I was
able to grok how to add new fields to the conflict_description_t, but
what's much harder now is that the callback is returning a structure
rather than an enum.  And that structure must be created with a C
constructor.  I'll post my half-patch here, and maybe dlr (or other
javahl person) can finish the job?

Index: subversion/bindings/javahl/native/ConflictResolverCallback.cpp
===================================================================
--- subversion/bindings/javahl/native/ConflictResolverCallback.cpp	(revision
27179)
+++ subversion/bindings/javahl/native/ConflictResolverCallback.cpp	(working
copy)
@@ -73,7 +73,7 @@
 }

 svn_error_t *
-ConflictResolverCallback::resolveConflict(svn_wc_conflict_result_t *result,
+ConflictResolverCallback::resolveConflict(svn_wc_conflict_result_t **result,
                                           const svn_wc_conflict_description_t *
                                           desc,
                                           void *baton,
@@ -86,7 +86,7 @@
 }

 svn_error_t *
-ConflictResolverCallback::resolve(svn_wc_conflict_result_t *result,
+ConflictResolverCallback::resolve(svn_wc_conflict_result_t **result,
                                   const svn_wc_conflict_description_t *desc,
                                   apr_pool_t *pool)
 {
@@ -131,6 +131,9 @@
   jstring jpath = JNIUtil::makeJString(desc->path);
   if (JNIUtil::isJavaExceptionThrown())
     return SVN_NO_ERROR;
+  jstring jpropertyName = JNIUtil::makeJString(desc->property_name);
+  if (JNIUtil::isJavaExceptionThrown())
+    return SVN_NO_ERROR;
   jstring jmimeType = JNIUtil::makeJString(desc->mime_type);
   if (JNIUtil::isJavaExceptionThrown())
     return SVN_NO_ERROR;
@@ -150,6 +153,8 @@
   // Instantiate the conflict descriptor.
   jobject jdesc = env->NewObject(clazz, ctor, jpath,
                                  EnumMapper::mapNodeKind(desc->node_kind),
+                                 EnumMapper::mapConflictKind(desc->kind),
+                                 jpropertyName,
                                  (jboolean) desc->is_binary, jmimeType,
                                  EnumMapper::mapConflictAction(desc->action),
                                  EnumMapper::mapConflictReason(desc->reason),
@@ -176,6 +181,9 @@
   env->DeleteLocalRef(jpath);
   if (JNIUtil::isJavaExceptionThrown())
     return SVN_NO_ERROR;
+  env->DeleteLocalRef(jpropertyName);
+  if (JNIUtil::isJavaExceptionThrown())
+    return SVN_NO_ERROR;
   env->DeleteLocalRef(jmimeType);
   if (JNIUtil::isJavaExceptionThrown())
     return SVN_NO_ERROR;
Index: subversion/bindings/javahl/native/EnumMapper.cpp
===================================================================
--- subversion/bindings/javahl/native/EnumMapper.cpp	(revision 27179)
+++ subversion/bindings/javahl/native/EnumMapper.cpp	(working copy)
@@ -374,6 +374,19 @@
     }
 }

+jint EnumMapper::mapConflictKind(svn_wc_conflict_kind_t kind)
+{
+  switch (kind)
+    {
+    case svn_wc_conflict_kind_text:
+    default:
+      return org_tigris_subversion_javahl_ConflictDescriptor_Kind_text;
+
+    case svn_wc_conflict_kind_property:
+      return org_tigris_subversion_javahl_ConflictDescriptor_Kind_property;
+    }
+}
+
 jint EnumMapper::mapConflictAction(svn_wc_conflict_action_t action)
 {
   switch (action)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org