You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2013/10/31 17:07:29 UTC

svn commit: r1537542 - in /subversion/trunk/subversion/bindings/javahl: native/CommitEditor.cpp tests/org/apache/subversion/javahl/SVNRemoteTests.java

Author: brane
Date: Thu Oct 31 16:07:29 2013
New Revision: 1537542

URL: http://svn.apache.org/r1537542
Log:
Fixed a thinko in the JavaHL implementation of the Ev2 driver.

* subversion/bindings/javahl/native/CommitEditor.cpp
  (CommitEditor::alterDirectory, CommitEditor::alterFile): An empty
   property set must be passed on as an empty hash, not a NULL hash,
   since the latter means the props should be left alone.

* subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
  (SVNRemoteTests.testEditorDeleteFileProps): New test case for
   remote property deletion.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp
    subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java

Modified: subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp?rev=1537542&r1=1537541&r2=1537542&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp Thu Oct 31 16:07:29 2013
@@ -303,7 +303,7 @@ void CommitEditor::alterDirectory(jstrin
   SVN_JNI_ERR(svn_editor_alter_directory(
                   m_editor, relpath.c_str(), svn_revnum_t(jrevision),
                   (jchildren ? build_children(children, subPool) : NULL),
-                  properties.hash(subPool, true)),);
+                  properties.hash(subPool, false)),);
 }
 
 void CommitEditor::alterFile(jstring jrelpath, jlong jrevision,
@@ -331,7 +331,7 @@ void CommitEditor::alterFile(jstring jre
                   m_editor, relpath.c_str(), svn_revnum_t(jrevision),
                   (jcontents ? &checksum : NULL),
                   (jcontents ? contents.getStream(subPool) : NULL),
-                  properties.hash(subPool, true)),);
+                  properties.hash(subPool, false)),);
 }
 
 void CommitEditor::alterSymlink(jstring jrelpath, jlong jrevision,

Modified: subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java?rev=1537542&r1=1537541&r2=1537542&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java (original)
+++ subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java Thu Oct 31 16:07:29 2013
@@ -644,6 +644,53 @@ public class SVNRemoteTests extends SVNT
         assertTrue(Arrays.equals(eolstyle, propval));
     }
 
+    public void testEditorDeleteFileProps() throws Exception
+    {
+        Charset UTF8 = Charset.forName("UTF-8");
+        client.propertySetRemote(
+             thisTest.getUrl() + "/iota", 1L,
+             "name", "value".getBytes(UTF8),
+             new CommitMessageCallback() {
+                 public String getLogMessage(Set<CommitItem> elements) {
+                     return "Set property 'name' to 'value'";
+                 }
+             }, false, null, null);
+
+        ISVNRemote session = getSession();
+        HashMap<String, byte[]> props = new HashMap<String, byte[]>();
+        assertEquals(2L, session.getFile(Revision.SVN_INVALID_REVNUM, "iota",
+                                         null, props));
+
+        int propcount = 0;
+        for (Map.Entry<String, byte[]> e : props.entrySet()) {
+            final String key = e.getKey();
+            if (key.startsWith("svn:entry:") || key.startsWith("svn:wc:"))
+                continue;
+            ++propcount;
+        }
+        assertEquals(1, propcount);
+
+        CommitContext cc = new CommitContext(session, "Remove all props");
+        try {
+            props.clear();
+            cc.editor.alterFile("iota", 2L, null, null, props);
+            cc.editor.complete();
+        } finally {
+            cc.editor.dispose();
+        }
+
+        assertEquals(3L, session.getFile(Revision.SVN_INVALID_REVNUM, "iota",
+                                         null, props));
+        propcount = 0;
+        for (Map.Entry<String, byte[]> e : props.entrySet()) {
+            final String key = e.getKey();
+            if (key.startsWith("svn:entry:") || key.startsWith("svn:wc:"))
+                continue;
+            ++propcount;
+        }
+        assertEquals(0, propcount);
+    }
+
     public void testEditorSetFileContents() throws Exception
     {
         Charset UTF8 = Charset.forName("UTF-8");