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 20:52:12 UTC
svn commit: r1537601 - in
/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl: ./
native/ tests/org/apache/subversion/javahl/
Author: brane
Date: Thu Oct 31 19:52:12 2013
New Revision: 1537601
URL: http://svn.apache.org/r1537601
Log:
On the javahl-1.8-extensions branch: Sync JavaHL with trunk up to r1537596.
Modified:
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/ (props changed)
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CommitEditor.cpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/PropertyTable.cpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/PropertyTable.h
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
Propchange: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/
------------------------------------------------------------------------------
Merged /subversion/trunk/subversion/bindings/javahl:r1536325-1537596
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CommitEditor.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CommitEditor.cpp?rev=1537601&r1=1537600&r2=1537601&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CommitEditor.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/CommitEditor.cpp Thu Oct 31 19:52:12 2013
@@ -89,7 +89,7 @@ CommitEditor::CommitEditor(RemoteSession
&m_callback_session_uuid,
pool.getPool()),);
- PropertyTable revprops(jrevprops, true);
+ PropertyTable revprops(jrevprops, true, true);
if (JNIUtil::isJavaExceptionThrown())
return;
LockTokenTable lock_tokens(jlock_tokens);
@@ -100,7 +100,7 @@ CommitEditor::CommitEditor(RemoteSession
SVN_JNI_ERR(svn_ra__get_commit_ev2(
&m_editor,
session->m_session,
- revprops.hash(subPool, false),
+ revprops.hash(subPool),
m_callback.callback, &m_callback,
lock_tokens.hash(subPool, true),
bool(jkeep_locks),
@@ -213,7 +213,7 @@ void CommitEditor::addDirectory(jstring
Iterator children(jchildren);
if (JNIUtil::isJavaExceptionThrown())
return;
- PropertyTable properties(jproperties, true);
+ PropertyTable properties(jproperties, true, true);
if (JNIUtil::isJavaExceptionThrown())
return;
@@ -225,7 +225,7 @@ void CommitEditor::addDirectory(jstring
SVN_JNI_ERR(svn_editor_add_directory(m_editor, relpath.c_str(),
build_children(children, subPool),
- properties.hash(subPool, false),
+ properties.hash(subPool),
svn_revnum_t(jreplaces_revision)),);
}
@@ -238,7 +238,7 @@ void CommitEditor::addFile(jstring jrelp
SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
InputStream contents(jcontents);
- PropertyTable properties(jproperties, true);
+ PropertyTable properties(jproperties, true, true);
if (JNIUtil::isJavaExceptionThrown())
return;
@@ -253,7 +253,7 @@ void CommitEditor::addFile(jstring jrelp
return;
SVN_JNI_ERR(svn_editor_add_file(m_editor, relpath.c_str(),
&checksum, contents.getStream(subPool),
- properties.hash(subPool, false),
+ properties.hash(subPool),
svn_revnum_t(jreplaces_revision)),);
}
@@ -290,7 +290,7 @@ void CommitEditor::alterDirectory(jstrin
Iterator children(jchildren);
if (JNIUtil::isJavaExceptionThrown())
return;
- PropertyTable properties(jproperties, true);
+ PropertyTable properties(jproperties, true, false);
if (JNIUtil::isJavaExceptionThrown())
return;
@@ -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)),);
}
void CommitEditor::alterFile(jstring jrelpath, jlong jrevision,
@@ -314,7 +314,7 @@ void CommitEditor::alterFile(jstring jre
SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
InputStream contents(jcontents);
- PropertyTable properties(jproperties, true);
+ PropertyTable properties(jproperties, true, false);
if (JNIUtil::isJavaExceptionThrown())
return;
@@ -329,7 +329,7 @@ void CommitEditor::alterFile(jstring jre
return;
SVN_JNI_ERR(svn_editor_alter_file(
m_editor, relpath.c_str(), svn_revnum_t(jrevision),
- properties.hash(subPool, true),
+ properties.hash(subPool),
(jcontents ? &checksum : NULL),
(jcontents ? contents.getStream(subPool) : NULL)),);
}
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/PropertyTable.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/PropertyTable.cpp?rev=1537601&r1=1537600&r2=1537601&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/PropertyTable.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/PropertyTable.cpp Thu Oct 31 19:52:12 2013
@@ -42,9 +42,9 @@ PropertyTable::~PropertyTable()
JNIUtil::getEnv()->DeleteLocalRef(m_revpropTable);
}
-apr_hash_t *PropertyTable::hash(const SVN::Pool &pool, bool nullIfEmpty)
+apr_hash_t *PropertyTable::hash(const SVN::Pool &pool)
{
- if (m_revprops.size() == 0 && nullIfEmpty)
+ if (!m_revpropTable && !m_empty_if_null)
return NULL;
apr_hash_t *revprop_table = apr_hash_make(pool.getPool());
@@ -73,7 +73,10 @@ apr_hash_t *PropertyTable::hash(const SV
return revprop_table;
}
-PropertyTable::PropertyTable(jobject jrevpropTable, bool bytearray_values)
+PropertyTable::PropertyTable(jobject jrevpropTable, bool bytearray_values,
+ bool empty_if_null)
+ : m_revpropTable(jrevpropTable),
+ m_empty_if_null(empty_if_null)
{
m_revpropTable = jrevpropTable;
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/PropertyTable.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/PropertyTable.h?rev=1537601&r1=1537600&r2=1537601&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/PropertyTable.h (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/PropertyTable.h Thu Oct 31 19:52:12 2013
@@ -41,10 +41,13 @@ class PropertyTable
private:
std::map<std::string, std::string> m_revprops;
jobject m_revpropTable;
+ bool m_empty_if_null;
public:
- PropertyTable(jobject jrevpropTable, bool bytearray_values=false);
+ PropertyTable(jobject jrevpropTable,
+ bool bytearray_values,
+ bool empty_if_null);
~PropertyTable();
- apr_hash_t *hash(const SVN::Pool &pool, bool nullIfEmpty = true);
+ apr_hash_t *hash(const SVN::Pool &pool);
};
#endif // REVPROPTABLE_H
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp?rev=1537601&r1=1537600&r2=1537601&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp Thu Oct 31 19:52:12 2013
@@ -384,7 +384,7 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- PropertyTable revprops(jrevpropTable);
+ PropertyTable revprops(jrevpropTable, false, false);
if (JNIUtil::isExceptionThrown())
return;
@@ -498,7 +498,7 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- PropertyTable revprops(jrevpropTable);
+ PropertyTable revprops(jrevpropTable, false, false);
if (JNIUtil::isExceptionThrown())
return;
@@ -539,7 +539,7 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- PropertyTable revprops(jrevpropTable);
+ PropertyTable revprops(jrevpropTable, false, false);
if (JNIUtil::isExceptionThrown())
return;
@@ -577,7 +577,7 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- PropertyTable revprops(jrevpropTable);
+ PropertyTable revprops(jrevpropTable, false, false);
if (JNIUtil::isExceptionThrown())
return;
@@ -610,7 +610,7 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- PropertyTable revprops(jrevpropTable);
+ PropertyTable revprops(jrevpropTable, false, false);
if (JNIUtil::isExceptionThrown())
return;
@@ -761,7 +761,7 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- PropertyTable revprops(jrevpropTable);
+ PropertyTable revprops(jrevpropTable, false, false);
if (JNIUtil::isExceptionThrown())
return;
@@ -1012,7 +1012,7 @@ Java_org_apache_subversion_javahl_SVNCli
if (JNIUtil::isExceptionThrown())
return;
- PropertyTable revprops(jrevpropTable);
+ PropertyTable revprops(jrevpropTable, false, false);
if (JNIUtil::isExceptionThrown())
return;
Modified: subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java?rev=1537601&r1=1537600&r2=1537601&view=diff
==============================================================================
--- subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java (original)
+++ subversion/branches/javahl-1.8-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java Thu Oct 31 19:52:12 2013
@@ -642,6 +642,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");