You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2010/03/07 15:12:22 UTC
svn commit: r919999 [1/5] - in /subversion/branches/svn-patch-improvements:
./ build/generator/templates/ subversion/bindings/javahl/native/
subversion/bindings/javahl/src/org/apache/subversion/javahl/
subversion/bindings/javahl/src/org/apache/subversi...
Author: dannas
Date: Sun Mar 7 14:12:20 2010
New Revision: 919999
URL: http://svn.apache.org/viewvc?rev=919999&view=rev
Log:
Sync svn-patch-improvements branch with trunk.
Added:
subversion/branches/svn-patch-improvements/subversion/tests/cmdline/upgrade_tests_data/upgrade_1_0.tar.bz2
- copied unchanged from r919998, subversion/trunk/subversion/tests/cmdline/upgrade_tests_data/upgrade_1_0.tar.bz2
Modified:
subversion/branches/svn-patch-improvements/ (props changed)
subversion/branches/svn-patch-improvements/Makefile.in
subversion/branches/svn-patch-improvements/build/generator/templates/vcnet_vcproj.ezt
subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/CommitMessage.cpp
subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/CreateJ.cpp
subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/CreateJ.h
subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/LogMessageCallback.cpp
subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/SVNClient.cpp
subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitMessage.java
subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/LogMessage.java
subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/Mergeinfo.java
subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java
subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/LogMessageCallback.java
subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ChangePath.java
subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Mergeinfo.java
subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
subversion/branches/svn-patch-improvements/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
subversion/branches/svn-patch-improvements/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java
subversion/branches/svn-patch-improvements/subversion/include/private/svn_wc_private.h
subversion/branches/svn-patch-improvements/subversion/include/svn_client.h
subversion/branches/svn-patch-improvements/subversion/include/svn_subst.h
subversion/branches/svn-patch-improvements/subversion/include/svn_wc.h
subversion/branches/svn-patch-improvements/subversion/libsvn_client/cleanup.c
subversion/branches/svn-patch-improvements/subversion/libsvn_client/client.h
subversion/branches/svn-patch-improvements/subversion/libsvn_client/deprecated.c
subversion/branches/svn-patch-improvements/subversion/libsvn_client/externals.c
subversion/branches/svn-patch-improvements/subversion/libsvn_client/patch.c
subversion/branches/svn-patch-improvements/subversion/libsvn_client/ra.c
subversion/branches/svn-patch-improvements/subversion/libsvn_client/switch.c
subversion/branches/svn-patch-improvements/subversion/libsvn_client/update.c
subversion/branches/svn-patch-improvements/subversion/libsvn_wc/adm_files.c
subversion/branches/svn-patch-improvements/subversion/libsvn_wc/adm_files.h
subversion/branches/svn-patch-improvements/subversion/libsvn_wc/entries.c
subversion/branches/svn-patch-improvements/subversion/libsvn_wc/entries.h
subversion/branches/svn-patch-improvements/subversion/libsvn_wc/lock.c
subversion/branches/svn-patch-improvements/subversion/libsvn_wc/log.c
subversion/branches/svn-patch-improvements/subversion/libsvn_wc/old-and-busted.c
subversion/branches/svn-patch-improvements/subversion/libsvn_wc/update_editor.c
subversion/branches/svn-patch-improvements/subversion/libsvn_wc/upgrade.c
subversion/branches/svn-patch-improvements/subversion/libsvn_wc/wc-queries.sql
subversion/branches/svn-patch-improvements/subversion/libsvn_wc/wc_db.c
subversion/branches/svn-patch-improvements/subversion/libsvn_wc/wc_db.h
subversion/branches/svn-patch-improvements/subversion/po/fr.po
subversion/branches/svn-patch-improvements/subversion/svn/cl.h
subversion/branches/svn-patch-improvements/subversion/svn/main.c
subversion/branches/svn-patch-improvements/subversion/svn/patch-cmd.c
subversion/branches/svn-patch-improvements/subversion/tests/cmdline/merge_tests.py
subversion/branches/svn-patch-improvements/subversion/tests/cmdline/patch_tests.py
subversion/branches/svn-patch-improvements/subversion/tests/cmdline/svntest/main.py
subversion/branches/svn-patch-improvements/subversion/tests/cmdline/upgrade_tests.py
subversion/branches/svn-patch-improvements/tools/dev/unix-build/Makefile.svn
Propchange: subversion/branches/svn-patch-improvements/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Mar 7 14:12:20 2010
@@ -33,3 +33,4 @@
/subversion/branches/tc_url_rev:874351-874483
/subversion/branches/tree-conflicts:868291-873154
/subversion/branches/tree-conflicts-notify:873926-874008
+/subversion/trunk:918519-919998
Modified: subversion/branches/svn-patch-improvements/Makefile.in
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/Makefile.in?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/Makefile.in (original)
+++ subversion/branches/svn-patch-improvements/Makefile.in Sun Mar 7 14:12:20 2010
@@ -605,7 +605,9 @@
$(JAVADOC) -d $(top_srcdir)/doc/javadoc \
-sourcepath $(top_srcdir)/subversion/bindings/javahl/src \
-link http://java.sun.com/javase/6/docs/api/ \
- org.tigris.subversion.javahl
+ org.tigris.subversion.javahl \
+ org.apache.subversion.javahl \
+ org.apache.subversion.javahl.callback
doc-clean:
rm -rf $(top_srcdir)/doc/doxygen
Modified: subversion/branches/svn-patch-improvements/build/generator/templates/vcnet_vcproj.ezt
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/build/generator/templates/vcnet_vcproj.ezt?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/build/generator/templates/vcnet_vcproj.ezt (original)
+++ subversion/branches/svn-patch-improvements/build/generator/templates/vcnet_vcproj.ezt Sun Mar 7 14:12:20 2010
@@ -49,6 +49,7 @@
PreprocessorDefinitions="[if-any instrument_apr_pools]APR_POOL_DEBUG=[instrument_apr_pools];[end][for configs.defines][configs.defines][if-index configs.defines last][else];[end][end];_CRT_SECURE_NO_WARNINGS"
[is configs.name "Debug"] MinimalRebuild="TRUE"
RuntimeLibrary="3"
+ BasicRuntimeChecks="3"
BufferSecurityCheck="TRUE"
EnableFunctionLevelLinking="TRUE"
[else] StringPooling="TRUE"
Modified: subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/CommitMessage.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/CommitMessage.cpp?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/CommitMessage.cpp (original)
+++ subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/CommitMessage.cpp Sun Mar 7 14:12:20 2010
@@ -25,6 +25,7 @@
*/
#include "CommitMessage.h"
+#include "CreateJ.h"
#include "JNIUtil.h"
#include <apr_tables.h>
#include "svn_client.h"
@@ -95,11 +96,6 @@
if (JNIUtil::isExceptionThrown())
return NULL;
- int count = commit_items->nelts;
- jobjectArray jitems = env->NewObjectArray(count, clazz, NULL);
- if (JNIUtil::isExceptionThrown())
- return NULL;
-
// Java method ids will not change during the time this library is
// loaded, so they can be cached.
@@ -124,8 +120,7 @@
return NULL;
midCallback = env->GetMethodID(clazz2, "getLogMessage",
- "([L"JAVA_PACKAGE"/CommitItem;)"
- "Ljava/lang/String;");
+ "(Ljava/util/Set;)Ljava/lang/String;");
if (JNIUtil::isJavaExceptionThrown())
return NULL;
@@ -135,7 +130,8 @@
}
// create a Java CommitItem for each of the passed in commit items
- for (int i = 0; i < count; ++i)
+ std::vector<jobject> jitems;
+ for (int i = 0; i < commit_items->nelts; ++i)
{
svn_client_commit_item3_t *item =
APR_ARRAY_IDX(commit_items, i, svn_client_commit_item3_t *);
@@ -190,10 +186,9 @@
return NULL;
// store the Java object into the array
- env->SetObjectArrayElement(jitems, i, jitem);
- if (JNIUtil::isJavaExceptionThrown())
- return NULL;
+ jitems.push_back(jitem);
}
+
env->DeleteLocalRef(clazz);
if (JNIUtil::isJavaExceptionThrown())
return NULL;
@@ -201,12 +196,7 @@
// call the Java callback method
jstring jmessage = (jstring)env->CallObjectMethod(m_jcommitMessage,
midCallback,
- jitems);
- if (JNIUtil::isJavaExceptionThrown())
- return NULL;
-
- // release the Java object array
- env->DeleteLocalRef(jitems);
+ CreateJ::Set(jitems));
if (JNIUtil::isJavaExceptionThrown())
return NULL;
Modified: subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/CreateJ.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/CreateJ.cpp?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/CreateJ.cpp (original)
+++ subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/CreateJ.cpp Sun Mar 7 14:12:20 2010
@@ -354,36 +354,57 @@
}
-jobjectArray
-CreateJ::RevisionRangeArray(apr_array_header_t *ranges)
+jobject
+CreateJ::RevisionRangeList(apr_array_header_t *ranges)
{
- JNIEnv *env = JNIUtil::getEnv();
+ JNIEnv *env = JNIUtil::getEnv();
+
+ jclass clazz = env->FindClass("java/util/ArrayList");
+ if (JNIUtil::isJavaExceptionThrown())
+ return NULL;
- jclass clazz = env->FindClass(JAVA_PACKAGE "/RevisionRange");
- if (JNIUtil::isJavaExceptionThrown())
+ static jmethodID init_mid = 0;
+ if (init_mid == 0)
+ {
+ init_mid = env->GetMethodID(clazz, "<init>", "()V");
+ if (JNIUtil::isJavaExceptionThrown())
return NULL;
+ }
- jobjectArray jranges = env->NewObjectArray(ranges->nelts, clazz, NULL);
+ static jmethodID add_mid = 0;
+ if (add_mid == 0)
+ {
+ add_mid = env->GetMethodID(clazz, "add", "(Ljava/lang/Object;)Z");
+ if (JNIUtil::isJavaExceptionThrown())
+ return NULL;
+ }
+
+ jobject jranges = env->NewObject(clazz, init_mid);
- for (int i = 0; i < ranges->nelts; ++i)
+ for (int i = 0; i < ranges->nelts; ++i)
{
- // Convert svn_merge_range_t *'s to Java RevisionRange objects.
- svn_merge_range_t *range =
- APR_ARRAY_IDX(ranges, i, svn_merge_range_t *);
- jobject jrange = RevisionRange::makeJRevisionRange(range);
- if (jrange == NULL)
- return NULL;
+ // Convert svn_merge_range_t *'s to Java RevisionRange objects.
+ svn_merge_range_t *range =
+ APR_ARRAY_IDX(ranges, i, svn_merge_range_t *);
- env->SetObjectArrayElement(jranges, i, jrange);
- if (JNIUtil::isJavaExceptionThrown())
- return NULL;
+ jobject jrange = RevisionRange::makeJRevisionRange(range);
+ if (jrange == NULL)
+ return NULL;
+
+ env->CallObjectMethod(jranges, add_mid, jrange);
+ if (JNIUtil::isJavaExceptionThrown())
+ return NULL;
- env->DeleteLocalRef(jrange);
- if (JNIUtil::isJavaExceptionThrown())
- return NULL;
+ env->DeleteLocalRef(jrange);
+ if (JNIUtil::isJavaExceptionThrown())
+ return NULL;
}
- return jranges;
+ env->DeleteLocalRef(clazz);
+ if (JNIUtil::isJavaExceptionThrown())
+ return NULL;
+
+ return jranges;
}
jobject
Modified: subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/CreateJ.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/CreateJ.h?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/CreateJ.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/CreateJ.h Sun Mar 7 14:12:20 2010
@@ -49,8 +49,8 @@
static jobject
Lock(const svn_lock_t *lock);
- static jobjectArray
- RevisionRangeArray(apr_array_header_t *ranges);
+ static jobject
+ RevisionRangeList(apr_array_header_t *ranges);
static jobject
StringSet(apr_array_header_t *strings);
@@ -66,6 +66,9 @@
protected:
static jobject
ConflictVersion(const svn_wc_conflict_version_t *version);
+
+ static jobject
+ Collection(std::vector<jobject> &object, const char *className);
};
#endif // CREATEJ_H
Modified: subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/LogMessageCallback.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/LogMessageCallback.cpp?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/LogMessageCallback.cpp (original)
+++ subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/LogMessageCallback.cpp Sun Mar 7 14:12:20 2010
@@ -81,8 +81,7 @@
sm_mid = env->GetMethodID(clazz,
"singleMessage",
- "([L"JAVA_PACKAGE"/ChangePath;"
- "JLjava/util/Map;Z)V");
+ "(Ljava/util/Set;JLjava/util/Map;Z)V");
if (JNIUtil::isJavaExceptionThrown())
return SVN_NO_ERROR;
@@ -105,29 +104,19 @@
return SVN_NO_ERROR;
}
- jobjectArray jChangedPaths = NULL;
+ jobject jChangedPaths = NULL;
if (log_entry->changed_paths)
{
- apr_array_header_t *sorted_paths;
- int i;
+ apr_hash_index_t *hi;
+ std::vector<jobject> jcps;
- /* Get an array of sorted hash keys. */
- sorted_paths = svn_sort__hash(log_entry->changed_paths,
- svn_sort_compare_items_as_paths,
- pool);
-
- jChangedPaths = env->NewObjectArray(sorted_paths->nelts,
- clazzCP,
- NULL);
-
- for (i = 0; i < sorted_paths->nelts; ++i)
+ for (hi = apr_hash_first(pool, log_entry->changed_paths);
+ hi;
+ hi = apr_hash_next(hi))
{
- svn_sort__item_t *item = &(APR_ARRAY_IDX(sorted_paths, i,
- svn_sort__item_t));
- const char *path = (const char *)item->key;
- svn_log_changed_path2_t *log_item
- = (svn_log_changed_path2_t *)
- apr_hash_get(log_entry->changed_paths, item->key, item->klen);
+ const char *path = (const char *) svn_apr_hash_index_key(hi);
+ svn_log_changed_path2_t *log_item =
+ (svn_log_changed_path2_t *) svn_apr_hash_index_val(hi);
jstring jpath = JNIUtil::makeJString(path);
if (JNIUtil::isJavaExceptionThrown())
@@ -147,13 +136,7 @@
if (JNIUtil::isJavaExceptionThrown())
return SVN_NO_ERROR;
- env->SetObjectArrayElement(jChangedPaths, i, cp);
- if (JNIUtil::isJavaExceptionThrown())
- return SVN_NO_ERROR;
-
- env->DeleteLocalRef(cp);
- if (JNIUtil::isJavaExceptionThrown())
- return SVN_NO_ERROR;
+ jcps.push_back(cp);
env->DeleteLocalRef(jpath);
if (JNIUtil::isJavaExceptionThrown())
@@ -163,6 +146,8 @@
if (JNIUtil::isJavaExceptionThrown())
return SVN_NO_ERROR;
}
+
+ jChangedPaths = CreateJ::Set(jcps);
}
jobject jrevprops = NULL;
Modified: subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/SVNClient.cpp?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/branches/svn-patch-improvements/subversion/bindings/javahl/native/SVNClient.cpp Sun Mar 7 14:12:20 2010
@@ -793,7 +793,7 @@
{
addRevisions = env->GetMethodID(clazz, "addRevisions",
"(Ljava/lang/String;"
- "[L"JAVA_PACKAGE"/RevisionRange;)V");
+ "Ljava/util/List;)V");
if (JNIUtil::isJavaExceptionThrown())
return NULL;
}
@@ -812,8 +812,8 @@
apr_hash_this(hi, &path, NULL, &val);
jstring jpath = JNIUtil::makeJString((const char *) path);
- jobjectArray jranges =
- CreateJ::RevisionRangeArray((apr_array_header_t *) val);
+ jobject jranges =
+ CreateJ::RevisionRangeList((apr_array_header_t *) val);
env->CallVoidMethod(jmergeinfo, addRevisions, jpath, jranges);
@@ -825,6 +825,10 @@
return NULL;
}
+ env->DeleteLocalRef(clazz);
+ if (JNIUtil::isJavaExceptionThrown())
+ return NULL;
+
return jmergeinfo;
}
Modified: subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitMessage.java
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitMessage.java?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitMessage.java (original)
+++ subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitMessage.java Sun Mar 7 14:12:20 2010
@@ -23,6 +23,8 @@
package org.apache.subversion.javahl;
+import java.util.Set;
+
/**
* This is callback interface which has to implemented by the client
* to receive which files will be commited and to enter the log
@@ -36,5 +38,5 @@
* @param elementsToBeCommited Array of elements to be commited
* @return the log message of the commit.
*/
- String getLogMessage(CommitItem[] elementsToBeCommited);
+ String getLogMessage(Set<CommitItem> elementsToBeCommited);
}
Modified: subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/LogMessage.java
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/LogMessage.java?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/LogMessage.java (original)
+++ subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/LogMessage.java Sun Mar 7 14:12:20 2010
@@ -24,6 +24,8 @@
package org.apache.subversion.javahl;
import java.util.Date;
+import java.util.Map;
+import java.util.Set;
/**
* This class describes a single subversion revision with log message,
@@ -71,7 +73,7 @@
* SVNClientInterface.logMessages is used with discoverPaths
* true).
*/
- private ChangePath[] changedPaths;
+ private Set<ChangePath> changedPaths;
/**
* This constructor is the original constructor from Subversion
@@ -85,7 +87,7 @@
* of microseconds since 00:00:00 January 1,
* 1970 UTC
*/
- LogMessage(ChangePath[] cp, long r, String a, Date d, String m)
+ LogMessage(Set<ChangePath> cp, long r, String a, Date d, String m)
{
changedPaths = cp;
revision = r;
@@ -106,7 +108,7 @@
* @param message the log message text
* @since 1.5
*/
- LogMessage(ChangePath[] cp, long r, String a, long t, String m)
+ LogMessage(Set<ChangePath> cp, long r, String a, long t, String m)
{
changedPaths = cp;
revision = r;
@@ -191,7 +193,7 @@
* Returns the changes items by this commit
* @return the changes items by this commit
*/
- public ChangePath[] getChangedPaths()
+ public Set<ChangePath> getChangedPaths()
{
return changedPaths;
}
Modified: subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/Mergeinfo.java
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/Mergeinfo.java?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/Mergeinfo.java (original)
+++ subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/Mergeinfo.java Sun Mar 7 14:12:20 2010
@@ -77,10 +77,10 @@
* @throws SubversionException If range list contains objects of
* type other than RevisionRange.
*/
- public void addRevisions(String mergeSrc, RevisionRange[] ranges)
+ public void addRevisions(String mergeSrc, List<RevisionRange> ranges)
{
- for (int i = 0; i < ranges.length; i++)
- addRevisionRange(mergeSrc, ranges[i]);
+ for (RevisionRange range : ranges)
+ addRevisionRange(mergeSrc, range);
}
/**
@@ -103,12 +103,9 @@
* Get the merge source URLs.
* @return The merge source URLs.
*/
- public String[] getPaths()
+ public Set<String> getPaths()
{
- Set<String> pathSet = mergeSources.keySet();
- if (pathSet == null)
- return null;
- return pathSet.toArray(new String[pathSet.size()]);
+ return mergeSources.keySet();
}
/**
@@ -128,12 +125,9 @@
* @param mergeSrc The merge source URL, or <code>null</code>.
* @return Array of RevisionRange objects, or <code>null</code>.
*/
- public RevisionRange[] getRevisionRange(String mergeSrc)
+ public List<RevisionRange> getRevisionRange(String mergeSrc)
{
- List<RevisionRange> revisions = this.getRevisions(mergeSrc);
- if (revisions == null)
- return null;
- return revisions.toArray(new RevisionRange[revisions.size()]);
+ return this.getRevisions(mergeSrc);
}
/**
Modified: subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java (original)
+++ subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java Sun Mar 7 14:12:20 2010
@@ -80,11 +80,11 @@
// Try to load the library by its name. Failing that, try to
// load it by its old name.
String[] libraryNames = {"svnjavahl-1", "libsvnjavahl-1", "svnjavahl"};
- for (int i = 0; i < libraryNames.length; i++)
+ for (String libraryName : libraryNames)
{
try
{
- System.loadLibrary(libraryNames[i]);
+ System.loadLibrary(libraryName);
init();
return;
}
Modified: subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/LogMessageCallback.java
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/LogMessageCallback.java?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/LogMessageCallback.java (original)
+++ subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/LogMessageCallback.java Sun Mar 7 14:12:20 2010
@@ -26,6 +26,7 @@
import org.apache.subversion.javahl.ChangePath;
import java.util.Map;
+import java.util.Set;
/**
* This interface is used to receive every log message for the log
@@ -49,7 +50,7 @@
/**
* The method will be called for every log message.
*
- * @param changedPaths the paths that were changed
+ * @param changedPaths a set of the paths that were changed
* @param revision the revision of the commit
* @param revprops All of the requested revision properties,
* possibly including svn:date, svn:author,
@@ -57,7 +58,7 @@
* @param hasChildren when merge sensitive option was requested,
* whether or not this entry has child entries.
*/
- public void singleMessage(ChangePath[] changedPaths,
+ public void singleMessage(Set<ChangePath> changedPaths,
long revision,
Map<String, byte[]> revprops,
boolean hasChildren);
Modified: subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ChangePath.java
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ChangePath.java?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ChangePath.java (original)
+++ subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ChangePath.java Sun Mar 7 14:12:20 2010
@@ -23,7 +23,7 @@
package org.tigris.subversion.javahl;
-public class ChangePath implements java.io.Serializable
+public class ChangePath implements java.io.Serializable, Comparable
{
// Update the serialVersionUID when there is a incompatible change
// made to this class. See any of the following, depending upon
@@ -62,6 +62,11 @@
aChangePath.getNodeKind());
}
+ public int compareTo(Object other)
+ {
+ return path.compareTo(((ChangePath)other).path);
+ }
+
/** Path of commited item */
private String path;
Modified: subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Mergeinfo.java
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Mergeinfo.java?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Mergeinfo.java (original)
+++ subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Mergeinfo.java Sun Mar 7 14:12:20 2010
@@ -74,19 +74,19 @@
public Mergeinfo(org.apache.subversion.javahl.Mergeinfo aMergeinfo)
{
this();
- String[] srcPaths = aMergeinfo.getPaths();
+ Set<String> srcPaths = aMergeinfo.getPaths();
- for (int i = 0; i < srcPaths.length; i++)
+ for (String srcPath : srcPaths)
{
- org.apache.subversion.javahl.RevisionRange[] aRange =
- aMergeinfo.getRevisionRange(srcPaths[i]);
+ List<org.apache.subversion.javahl.RevisionRange> aRanges =
+ aMergeinfo.getRevisionRange(srcPath);
List<RevisionRange> list = new ArrayList<RevisionRange>();
- for (int j = 0; j < aRange.length; j++)
+ for (org.apache.subversion.javahl.RevisionRange range : aRanges)
{
- list.add(new RevisionRange(aRange[j]));
+ list.add(new RevisionRange(range));
}
- mergeSources.put(srcPaths[i], list);
+ mergeSources.put(srcPath, list);
}
}
Modified: subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java (original)
+++ subversion/branches/svn-patch-improvements/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java Sun Mar 7 14:12:20 2010
@@ -28,6 +28,7 @@
import java.io.OutputStream;
import java.util.Map;
+import java.util.Set;
import java.util.HashMap;
import java.util.List;
import java.util.HashSet;
@@ -469,7 +470,7 @@
}
public void singleMessage(
- org.apache.subversion.javahl.ChangePath[] aChangedPaths,
+ Set<org.apache.subversion.javahl.ChangePath> aChangedPaths,
long revision, Map<String, byte[]> revprops,
boolean hasChildren)
{
@@ -479,12 +480,16 @@
if (aChangedPaths != null)
{
- changedPaths = new ChangePath[aChangedPaths.length];
+ changedPaths = new ChangePath[aChangedPaths.size()];
- for (int i = 0; i < aChangedPaths.length; i++)
+ int i = 0;
+ for (org.apache.subversion.javahl.ChangePath cp
+ : aChangedPaths)
{
- changedPaths[i] = new ChangePath(aChangedPaths[i]);
+ changedPaths[i] = new ChangePath(cp);
+ i++;
}
+ Arrays.sort(changedPaths);
}
else
{
@@ -650,14 +655,17 @@
implements org.apache.subversion.javahl.CommitMessage
{
public String getLogMessage(
- org.apache.subversion.javahl.CommitItem[] elementsToBeCommited)
+ Set<org.apache.subversion.javahl.CommitItem> elementsToBeCommited)
{
CommitItem[] aElements =
- new CommitItem[elementsToBeCommited.length];
+ new CommitItem[elementsToBeCommited.size()];
- for (int i = 0; i < elementsToBeCommited.length; i++)
+ int i = 0;
+ for (org.apache.subversion.javahl.CommitItem item
+ : elementsToBeCommited)
{
- aElements[i] = new CommitItem(elementsToBeCommited[i]);
+ aElements[i] = new CommitItem(item);
+ i++;
}
if (messageHandler == null)
@@ -1342,18 +1350,22 @@
implements org.apache.subversion.javahl.callback.LogMessageCallback
{
public void singleMessage(
- org.apache.subversion.javahl.ChangePath[] aChangedPaths,
- long revision, Map revprops, boolean hasChildren)
+ Set<org.apache.subversion.javahl.ChangePath> aChangedPaths,
+ long revision, Map<String, byte[]> revprops,
+ boolean hasChildren)
{
ChangePath[] changedPaths;
if (aChangedPaths != null)
{
- changedPaths = new ChangePath[aChangedPaths.length];
+ changedPaths = new ChangePath[aChangedPaths.size()];
- for (int i = 0; i < aChangedPaths.length; i++)
+ int i = 0;
+ for (org.apache.subversion.javahl.ChangePath cp
+ : aChangedPaths)
{
- changedPaths[i] = new ChangePath(aChangedPaths[i]);
+ changedPaths[i] = new ChangePath(cp);
+ i++;
}
}
else
Modified: subversion/branches/svn-patch-improvements/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java (original)
+++ subversion/branches/svn-patch-improvements/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java Sun Mar 7 14:12:20 2010
@@ -189,17 +189,17 @@
String mergeInfoPropertyValue =
"/trunk:1-300,305,307,400-405\n/branches/branch:308-400";
Mergeinfo info = new Mergeinfo(mergeInfoPropertyValue);
- String[] paths = info.getPaths();
- assertEquals(2, paths.length);
- RevisionRange[] trunkRange = info.getRevisionRange("/trunk");
- assertEquals(4, trunkRange.length);
- assertEquals("1-300", trunkRange[0].toString());
- assertEquals("305", trunkRange[1].toString());
- assertEquals("307", trunkRange[2].toString());
- assertEquals("400-405", trunkRange[3].toString());
- RevisionRange[] branchRange =
+ Set<String> paths = info.getPaths();
+ assertEquals(2, paths.size());
+ List<RevisionRange> trunkRange = info.getRevisionRange("/trunk");
+ assertEquals(4, trunkRange.size());
+ assertEquals("1-300", trunkRange.get(0).toString());
+ assertEquals("305", trunkRange.get(1).toString());
+ assertEquals("307", trunkRange.get(2).toString());
+ assertEquals("400-405", trunkRange.get(3).toString());
+ List<RevisionRange> branchRange =
info.getRevisionRange("/branches/branch");
- assertEquals(1, branchRange.length);
+ assertEquals(1, branchRange.size());
}
/**
@@ -2119,12 +2119,14 @@
assertEquals("wrong revision", 1, lm[0].getRevisionNumber());
assertEquals("wrong user", "jrandom", lm[0].getAuthor());
assertNotNull("changed paths set", lm[0].getChangedPaths());
- ChangePath cp[] = lm[0].getChangedPaths();
- assertEquals("wrong number of chang pathes", 20, cp.length);
- assertEquals("wrong path", "/A", cp[0].getPath());
- assertEquals("wrong copy source rev", -1, cp[0].getCopySrcRevision());
- assertNull("wrong copy source path", cp[0].getCopySrcPath());
- assertEquals("wrong action", 'A', cp[0].getAction());
+ Set<ChangePath> cp = lm[0].getChangedPaths();
+ assertEquals("wrong number of chang pathes", 20, cp.size());
+ ChangePath changedApath = cp.toArray(new ChangePath[1])[0];
+ assertNotNull("wrong path", changedApath);
+ assertEquals("wrong copy source rev", -1,
+ changedApath.getCopySrcRevision());
+ assertNull("wrong copy source path", changedApath.getCopySrcPath());
+ assertEquals("wrong action", 'A', changedApath.getAction());
assertEquals("wrong time with getTimeMicros()",
lm[0].getTimeMicros()/1000,
lm[0].getDate().getTime());
@@ -2360,8 +2362,9 @@
List<Long> revList = new ArrayList<Long>();
- public void singleMessage(ChangePath[] changedPaths, long revision,
- Map<String, byte[]> revprops, boolean hasChildren) {
+ public void singleMessage(Set<ChangePath> changedPaths,
+ long revision, Map<String, byte[]> revprops,
+ boolean hasChildren) {
revList.add(new Long(revision));
}
@@ -3460,7 +3463,7 @@
{
Map<String, byte[]> revprops;
- public void singleMessage(ChangePath[] changedPaths,
+ public void singleMessage(Set<ChangePath> changedPaths,
long revision,
Map<String, byte[]> revprops,
boolean hasChildren)
@@ -3759,7 +3762,7 @@
{
private List<LogMessage> messages = new ArrayList<LogMessage>();
- public void singleMessage(ChangePath[] changedPaths,
+ public void singleMessage(Set<ChangePath> changedPaths,
long revision,
Map<String, byte[]> revprops,
boolean hasChildren)
Modified: subversion/branches/svn-patch-improvements/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java (original)
+++ subversion/branches/svn-patch-improvements/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java Sun Mar 7 14:12:20 2010
@@ -842,7 +842,7 @@
* @param elementsToBeCommited Array of elements to be commited
* @return the log message of the commit.
*/
- public String getLogMessage(CommitItem[] elementsToBeCommited)
+ public String getLogMessage(Set<CommitItem> elementsToBeCommited)
{
// check all received CommitItems are expected as received
for (CommitItem commitItem : elementsToBeCommited)
Modified: subversion/branches/svn-patch-improvements/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/include/private/svn_wc_private.h?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/include/private/svn_wc_private.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/include/private/svn_wc_private.h Sun Mar 7 14:12:20 2010
@@ -520,7 +520,14 @@
* @a anchor_abspath is NULL. If @a anchor_abspath is not NULL then
* recursively acquire write locks for the anchor of @a local_abspath
* and return the anchor path in @a *anchor_abspath. Use @a wc_ctx
- * for working copy access.
+ * for working copy access.
+ *
+ * Returns @c SVN_ERR_WC_LOCKED an existing lock is encountered, but
+ * may have set locks of it's own; it's not clear how the caller is
+ * expected to handle this.
+ *
+ * If @a *anchor_abspath is not NULL it will be set evenwhen
+ * SVN_ERR_WC_LOCKED is returned.
*
* ### @a anchor_abspath should be removed when we move to centralised
* ### metadata as it will be unnecessary.
@@ -535,7 +542,8 @@
/**
* Recursively release write locks for @a local_abspath, using @a wc_ctx
- * for working copy access.
+ * for working copy access. Locks are not removed if work queue items are
+ * present. Only the @c db member of @c wc_ctx is used.
*/
svn_error_t *
svn_wc__release_write_lock(svn_wc_context_t *wc_ctx,
Modified: subversion/branches/svn-patch-improvements/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/include/svn_client.h?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/include/svn_client.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/include/svn_client.h Sun Mar 7 14:12:20 2010
@@ -4840,7 +4840,7 @@
* notification feedback is provided, but the working copy is not modified.
*
* @a strip_count specifies how many leading path components should be
- * stripped from paths obtained from the patch. It is an error is a
+ * stripped from paths obtained from the patch. It is an error if a
* negative strip count is passed.
*
* If @a reverse is @c TRUE, apply patches in reverse, deleting lines
@@ -4848,6 +4848,12 @@
* This is useful when applying a unidiff which was created with the
* original and modified files swapped due to human error.
*
+ * Excluding patch targets from the patching process is possible by
+ * passing a @a filter_globs array containing elements of type const char *.
+ * If @a filter_globs is not NULL, patch targets matching any glob pattern
+ * in @a filter_globs will not be patched. The match is performed on the
+ * target path as parsed from the patch file, after canonicalization.
+ *
* If @a ctx->notify_func2 is non-NULL, invoke @a ctx->notify_func2 with
* @a ctx->notify_baton2 as patching progresses.
*
@@ -4862,6 +4868,7 @@
svn_boolean_t dry_run,
int strip_count,
svn_boolean_t reverse,
+ apr_array_header_t *filter_globs,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
Modified: subversion/branches/svn-patch-improvements/subversion/include/svn_subst.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/include/svn_subst.h?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/include/svn_subst.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/include/svn_subst.h Sun Mar 7 14:12:20 2010
@@ -292,6 +292,13 @@
* contract keywords. One stream supports both read and write
* operations. Reads and writes may be mixed.
*
+ * If @a eol_str is non-@c NULL, replace whatever bytestring the input uses
+ * to denote line endings with @a eol_str in the output. If the input has an
+ * inconsistent line ending style, then: if @a repair is @c FALSE, return
+ * @c SVN_ERR_IO_INCONSISTENT_EOL, else if @a repair is @c TRUE, convert any
+ * line ending to @a eol_str in @a . Recognized line endings are:
+ * "\n", "\r", and "\r\n".
+ *
* The stream returned is allocated in @a pool.
*
* If the inner stream implements resetting via svn_stream_reset(),
Modified: subversion/branches/svn-patch-improvements/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/include/svn_wc.h?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/include/svn_wc.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/include/svn_wc.h Sun Mar 7 14:12:20 2010
@@ -2608,16 +2608,18 @@
/* Asking questions about a working copy. */
-/** Set @a *wc_format to @a path's working copy format version number if
- * @a path is a valid working copy directory, else set it to 0.
- * Return error @c APR_ENOENT if @a path does not exist at all.
+/** Set @a *wc_format to @a local_abspath's working copy format version
+ * number if @a local_abspath is a valid working copy directory, else set it
+ * to 0.
+ *
+ * Return error @c APR_ENOENT if @a local_abspath does not exist at all.
*
* @since New in 1.7.
*/
svn_error_t *
svn_wc_check_wc2(int *wc_format,
svn_wc_context_t *wc_ctx,
- const char *local_path,
+ const char *local_abspath,
apr_pool_t *scratch_pool);
/**
@@ -6431,7 +6433,7 @@
/**
* Recurse from @a local_abspath, cleaning up unfinished log business. Perform
* any temporary allocations in @a scratch_pool. Any working copy locks under
- * @a local_path will be taken over and then cleared by this function.
+ * @a local_abspath will be taken over and then cleared by this function.
*
* WARNING: there is no mechanism that will protect locks that are still being
* used.
@@ -6479,6 +6481,22 @@
void *cancel_baton,
apr_pool_t *pool);
+/** Callback for retrieving a repository root for a url from upgrade.
+ *
+ * Called by svn_wc_upgrade() when no repository root and/or repository
+ * uuid are recorded in the working copy. For normal Subversion 1.5 and
+ * later working copies, this callback will not be used.
+ *
+ * @since New in 1.7.
+ */
+typedef svn_error_t * (*svn_wc_upgrade_get_repos_info_t)(
+ const char **repos_root,
+ const char **repos_uuid,
+ void *baton,
+ const char *url,
+ apr_pool_t *scratch_pool,
+ apr_pool_t *result_pool);
+
/**
* Upgrade the working copy at @a local_abspath to the latest metadata
* storage format. @a local_abspath should be an absolute path to the
@@ -6493,11 +6511,17 @@
* the path of the upgraded directory. @a notify_func may be @c NULL
* if this notification is not needed.
*
+ * If the old working copy doesn't contain a repository root and/or
+ * repository uuid, @a repos_info_func (if non-NULL) will be called
+ * with @a repos_info_baton to provide the missing information.
+ *
* @since New in 1.7.
*/
svn_error_t *
svn_wc_upgrade(svn_wc_context_t *wc_ctx,
const char *local_abspath,
+ svn_wc_upgrade_get_repos_info_t repos_info_func,
+ void *repos_info_baton,
svn_cancel_func_t cancel_func,
void *cancel_baton,
svn_wc_notify_func2_t notify_func,
@@ -6914,7 +6938,7 @@
svn_wc_transmit_text_deltas3(const char **tempfile,
unsigned char digest[],
svn_wc_context_t *wc_ctx,
- const char *local_path,
+ const char *local_abspath,
svn_boolean_t fulltext,
const svn_delta_editor_t *editor,
void *file_baton,
Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/cleanup.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/cleanup.c?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/cleanup.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/cleanup.c Sun Mar 7 14:12:20 2010
@@ -32,6 +32,7 @@
#include "svn_client.h"
#include "svn_config.h"
#include "svn_dirent_uri.h"
+#include "svn_pools.h"
#include "client.h"
#include "svn_private_config.h"
@@ -56,15 +57,68 @@
}
+/* callback baton for fetch_repos_info */
+struct repos_info_baton
+{
+ apr_pool_t *pool;
+ svn_client_ctx_t *ctx;
+ const char *last_repos;
+ const char *last_uuid;
+};
+
+/* svn_wc_upgrade_get_repos_info_t implementation for calling
+ svn_wc_upgrade() from svn_client_upgrade() */
+static svn_error_t *
+fetch_repos_info(const char **repos_root,
+ const char **repos_uuid,
+ void *baton,
+ const char *url,
+ apr_pool_t *scratch_pool,
+ apr_pool_t *result_pool)
+{
+ struct repos_info_baton *ri = baton;
+ apr_pool_t *subpool;
+ svn_ra_session_t *ra_session;
+
+ /* The same info is likely to retrieved multiple times (e.g. externals) */
+ if (ri->last_repos && svn_uri_is_child(ri->last_repos, url, NULL))
+ {
+ *repos_root = apr_pstrdup(result_pool, ri->last_repos);
+ *repos_uuid = apr_pstrdup(result_pool, ri->last_uuid);
+ return SVN_NO_ERROR;
+ }
+
+ subpool = svn_pool_create(scratch_pool);
+
+ SVN_ERR(svn_client_open_ra_session(&ra_session, url, ri->ctx, subpool));
+
+ SVN_ERR(svn_ra_get_repos_root2(ra_session, repos_root, result_pool));
+ SVN_ERR(svn_ra_get_uuid2(ra_session, repos_uuid, result_pool));
+
+ /* Store data for further calls */
+ ri->last_repos = apr_pstrdup(ri->pool, *repos_root);
+ ri->last_uuid = apr_pstrdup(ri->pool, *repos_uuid);
+
+ svn_pool_destroy(subpool);
+
+ return SVN_NO_ERROR;
+}
+
svn_error_t *
svn_client_upgrade(const char *path,
svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool)
{
const char *local_abspath;
+ struct repos_info_baton info_baton;
+ info_baton.pool = scratch_pool;
+ info_baton.ctx = ctx;
+ info_baton.last_repos = NULL;
+ info_baton.last_uuid = NULL;
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, scratch_pool));
SVN_ERR(svn_wc_upgrade(ctx->wc_ctx, local_abspath,
+ fetch_repos_info, &info_baton,
ctx->cancel_func, ctx->cancel_baton,
ctx->notify_func2, ctx->notify_baton2,
scratch_pool));
Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/client.h?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/client.h (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/client.h Sun Mar 7 14:12:20 2010
@@ -615,9 +615,8 @@
apr_pool_t *pool);
/* Switch a working copy PATH to URL@PEG_REVISION at REVISION, and (if not
- NULL) set RESULT_REV to the switch revision. ADM_ACCESS may be NULL, but
- if is not, it is a write locked working copy administrative access baton
- that has an associated baton for PATH. Only switch as deeply as DEPTH
+ NULL) set RESULT_REV to the switch revision. A write lock will be
+ acquired and released if not held. Only switch as deeply as DEPTH
indicates. If TIMESTAMP_SLEEP is NULL this function will sleep before
returning to ensure timestamp integrity. If TIMESTAMP_SLEEP is not
NULL then the function will not sleep but will set *TIMESTAMP_SLEEP
@@ -637,7 +636,6 @@
const char *url,
const svn_opt_revision_t *peg_revision,
const svn_opt_revision_t *revision,
- svn_wc_adm_access_t *adm_access,
svn_depth_t depth,
svn_boolean_t depth_is_sticky,
svn_boolean_t *timestamp_sleep,
@@ -951,10 +949,11 @@
/*** Externals (Modules) ***/
/* Handle changes to the svn:externals property described by EXTERNALS_OLD,
- EXTERNALS_NEW, and AMBIENT_DEPTHS. The tree's top level
- directory is at TO_PATH and should have a write lock in ADM_ACCESS
- and corresponds to FROM_URL URL in the repository, which has a root
- URL of REPOS_ROOT_URL.
+
+ EXTERNALS_NEW, and AMBIENT_DEPTHS. The tree's top level directory
+ is at TO_PATH and corresponds to FROM_URL URL in the repository,
+ which has a root URL of REPOS_ROOT_URL. A write lock should be
+ held.
For each changed value of the property, discover the nature of the
change and behave appropriately -- either check a new "external"
@@ -984,8 +983,7 @@
Use POOL for temporary allocation. */
svn_error_t *
-svn_client__handle_externals(svn_wc_adm_access_t *adm_access,
- apr_hash_t *externals_old,
+svn_client__handle_externals(apr_hash_t *externals_old,
apr_hash_t *externals_new,
apr_hash_t *ambient_depths,
const char *from_url,
Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/deprecated.c?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/deprecated.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/deprecated.c Sun Mar 7 14:12:20 2010
@@ -1614,7 +1614,7 @@
svn_opt_revision_t peg_revision;
peg_revision.kind = svn_opt_revision_unspecified;
return svn_client__switch_internal(result_rev, path, switch_url,
- &peg_revision, revision, NULL,
+ &peg_revision, revision,
SVN_DEPTH_INFINITY_OR_FILES(recurse),
FALSE, NULL, FALSE, FALSE, FALSE, ctx,
pool);
Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/externals.c?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/externals.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/externals.c Sun Mar 7 14:12:20 2010
@@ -53,10 +53,6 @@
/* The directory that has this externals property. */
const char *parent_dir;
- /* Access baton for parent_dir. If the external is an export, this
- this must be NULL, otherwise it must be non-NULL. */
- svn_wc_adm_access_t *adm_access;
-
/* The URL for the directory that has this externals property. */
const char *parent_dir_url;
@@ -235,7 +231,7 @@
SVN_ERR(svn_client__switch_internal(NULL, path, url,
peg_revision, revision,
- NULL, svn_depth_infinity,
+ svn_depth_infinity,
TRUE, timestamp_sleep,
FALSE, FALSE, TRUE, ctx,
subpool));
@@ -293,7 +289,6 @@
const char *url,
const svn_opt_revision_t *peg_revision,
const svn_opt_revision_t *revision,
- svn_wc_adm_access_t *adm_access,
svn_ra_session_t *ra_session,
const char *ra_session_url,
svn_revnum_t ra_revnum,
@@ -303,7 +298,6 @@
apr_pool_t *pool)
{
apr_pool_t *subpool = svn_pool_create(pool);
- svn_wc_adm_access_t *target_adm_access;
const char *anchor;
const char *anchor_abspath;
const char *local_abspath;
@@ -316,9 +310,14 @@
svn_boolean_t unlink_file = FALSE;
svn_boolean_t revert_file = FALSE;
svn_boolean_t remove_from_revision_control = FALSE;
- svn_boolean_t close_adm_access = FALSE;
+ svn_boolean_t locked_here;
svn_error_t *err = NULL;
+ /* See if the user wants last-commit timestamps instead of current ones. */
+ SVN_ERR(svn_config_get_bool(cfg, &use_commit_times,
+ SVN_CONFIG_SECTION_MISCELLANY,
+ SVN_CONFIG_OPTION_USE_COMMIT_TIMES, FALSE));
+
/* There must be a working copy to place the file external into. */
SVN_ERR(svn_wc_get_actual_target2(&anchor, &target, ctx->wc_ctx, path,
subpool, subpool));
@@ -329,52 +328,42 @@
baton. If this fails and returns SVN_ERR_WC_NOT_LOCKED, then try
to get a new access baton to support inserting a file external
into a directory external. */
- err = svn_wc_adm_retrieve(&target_adm_access, adm_access, anchor, subpool);
- if (err)
- {
- if (err->apr_err == SVN_ERR_WC_NOT_LOCKED)
- {
- const char *dest_wc_repos_root_url;
- svn_opt_revision_t peg_rev;
+ SVN_ERR(svn_wc_locked2(&locked_here, NULL, ctx->wc_ctx, anchor_abspath,
+ subpool));
+ if (!locked_here)
+ {
+ const char *dest_wc_repos_root_url;
+ svn_opt_revision_t peg_rev;
+
+ /* Check that the repository root URL for the newly opened
+ wc is the same as the file external. */
+ peg_rev.kind = svn_opt_revision_base;
+ SVN_ERR(svn_client__get_repos_root(&dest_wc_repos_root_url,
+ anchor_abspath, &peg_rev,
+ ctx, subpool, subpool));
- svn_error_clear(err);
- close_adm_access = TRUE;
- SVN_ERR(svn_wc__adm_open_in_context(&target_adm_access, ctx->wc_ctx,
- anchor, TRUE, -1,
- ctx->cancel_func,
- ctx->cancel_baton, subpool));
-
- /* Check that the repository root URL for the newly opened
- wc is the same as the file external. */
- peg_rev.kind = svn_opt_revision_base;
- SVN_ERR(svn_client__get_repos_root(&dest_wc_repos_root_url,
- anchor_abspath, &peg_rev,
- ctx, subpool, subpool));
-
- if (0 != strcmp(repos_root_url, dest_wc_repos_root_url))
- return svn_error_createf
- (SVN_ERR_RA_REPOS_ROOT_URL_MISMATCH, NULL,
- _("Cannot insert a file external from '%s' into a working "
- "copy from a different repository rooted at '%s'"),
- url, dest_wc_repos_root_url);
- }
- else
- return svn_error_return(err);
+ if (0 != strcmp(repos_root_url, dest_wc_repos_root_url))
+ return svn_error_createf
+ (SVN_ERR_RA_REPOS_ROOT_URL_MISMATCH, NULL,
+ _("Cannot insert a file external from '%s' into a working "
+ "copy from a different repository rooted at '%s'"),
+ url, dest_wc_repos_root_url);
+
+ SVN_ERR(svn_wc__acquire_write_lock(NULL, ctx->wc_ctx, anchor_abspath,
+ subpool, subpool));
}
- SVN_ERR(svn_wc__maybe_get_entry(&entry, ctx->wc_ctx, local_abspath,
- svn_node_unknown, FALSE, FALSE, subpool,
- subpool));
+ err = svn_wc__maybe_get_entry(&entry, ctx->wc_ctx, local_abspath,
+ svn_node_unknown, FALSE, FALSE, subpool,
+ subpool);
+ if (err)
+ goto cleanup;
+
/* Only one notification is done for the external, so don't notify
for any following steps. Use the following trick to add the file
then switch it to the external URL. */
- /* See if the user wants last-commit timestamps instead of current ones. */
- SVN_ERR(svn_config_get_bool(cfg, &use_commit_times,
- SVN_CONFIG_SECTION_MISCELLANY,
- SVN_CONFIG_OPTION_USE_COMMIT_TIMES, FALSE));
-
/* If there is a versioned item with this name, ensure it's a file
external before working with it. If there is no entry in the
working copy, then create an empty file and add it to the working
@@ -383,8 +372,9 @@
{
if (! entry->file_external_path)
{
- if (close_adm_access)
- SVN_ERR(svn_wc_adm_close2(target_adm_access, subpool));
+ if (!locked_here)
+ SVN_ERR(svn_wc__release_write_lock(ctx->wc_ctx, anchor_abspath,
+ subpool));
return svn_error_createf
(SVN_ERR_CLIENT_FILE_EXTERNAL_OVERWRITE_VERSIONED, 0,
@@ -405,9 +395,12 @@
conflict on the directory. To prevent resolving a conflict
due to another change on the directory, do not allow a file
external to be added when one exists. */
- SVN_ERR(svn_wc_conflicted_p3(&text_conflicted, &prop_conflicted,
- &tree_conflicted, ctx->wc_ctx,
- anchor_abspath, subpool));
+ err = svn_wc_conflicted_p3(&text_conflicted, &prop_conflicted,
+ &tree_conflicted, ctx->wc_ctx,
+ anchor_abspath, subpool);
+ if (err)
+ goto cleanup;
+
if (text_conflicted || prop_conflicted || tree_conflicted)
return svn_error_createf
(SVN_ERR_WC_FOUND_CONFLICT, 0,
@@ -417,11 +410,14 @@
/* Try to create an empty file. If there is a file already
there, then don't touch it. */
- SVN_ERR(svn_io_file_open(&f,
- local_abspath,
- APR_WRITE | APR_CREATE | APR_EXCL,
- APR_OS_DEFAULT,
- subpool));
+ err = svn_io_file_open(&f,
+ local_abspath,
+ APR_WRITE | APR_CREATE | APR_EXCL,
+ APR_OS_DEFAULT,
+ subpool);
+ if (err)
+ goto cleanup;
+
unlink_file = TRUE;
err = svn_io_file_close(f, pool);
if (err)
@@ -446,7 +442,7 @@
}
err = svn_client__switch_internal(NULL, path, url, peg_revision, revision,
- target_adm_access, svn_depth_empty,
+ svn_depth_empty,
FALSE, /* depth_is_sticky */
timestamp_sleep,
TRUE, /* ignore_externals */
@@ -468,8 +464,8 @@
remove_from_revision_control = TRUE;
}
- if (close_adm_access)
- SVN_ERR(svn_wc_adm_close2(target_adm_access, subpool));
+ if (!locked_here)
+ SVN_ERR(svn_wc__release_write_lock(ctx->wc_ctx, anchor_abspath, subpool));
svn_pool_destroy(subpool);
return SVN_NO_ERROR;
@@ -501,8 +497,9 @@
if (unlink_file)
svn_error_clear(svn_io_remove_file2(path, TRUE, subpool));
- if (close_adm_access)
- SVN_ERR(svn_wc_adm_close2(target_adm_access, subpool));
+ if (!locked_here)
+ svn_error_clear(svn_wc__release_write_lock(ctx->wc_ctx, anchor_abspath,
+ subpool));
svn_pool_destroy(subpool);
return svn_error_return(err);
@@ -877,7 +874,6 @@
new_item->url,
&new_item->peg_revision,
&new_item->revision,
- ib->adm_access,
ra_session,
ra_cache.ra_session_url,
ra_cache.ra_revnum,
@@ -994,7 +990,6 @@
new_item->url,
&new_item->peg_revision,
&new_item->revision,
- ib->adm_access,
ra_session,
ra_cache.ra_session_url,
ra_cache.ra_revnum,
@@ -1067,7 +1062,6 @@
const char *to_path;
/* Passed through to handle_external_item_change_baton. */
- svn_wc_adm_access_t *adm_access;
svn_client_ctx_t *ctx;
const char *repos_root_url;
svn_boolean_t *timestamp_sleep;
@@ -1099,11 +1093,6 @@
const char *abs_parent_dir;
svn_error_t *err;
- if (cb->is_export)
- SVN_ERR_ASSERT(!cb->adm_access);
- else
- SVN_ERR_ASSERT(cb->adm_access);
-
if (cb->ambient_depths)
{
ambient_depth_w = apr_hash_get(cb->ambient_depths, key, klen);
@@ -1168,7 +1157,6 @@
ib.new_desc = new_desc_hash;
ib.parent_dir = (const char *) key;
ib.repos_root_url = cb->repos_root_url;
- ib.adm_access = cb->adm_access;
ib.ctx = cb->ctx;
ib.is_export = cb->is_export;
ib.timestamp_sleep = cb->timestamp_sleep;
@@ -1246,8 +1234,7 @@
svn_error_t *
-svn_client__handle_externals(svn_wc_adm_access_t *adm_access,
- apr_hash_t *externals_old,
+svn_client__handle_externals(apr_hash_t *externals_old,
apr_hash_t *externals_new,
apr_hash_t *ambient_depths,
const char *from_url,
@@ -1272,7 +1259,6 @@
cb.from_url = from_url;
cb.to_path = to_path;
cb.repos_root_url = repos_root_url;
- cb.adm_access = adm_access;
cb.ctx = ctx;
cb.timestamp_sleep = timestamp_sleep;
cb.is_export = FALSE;
@@ -1300,7 +1286,6 @@
cb.externals_old = apr_hash_make(pool);
cb.requested_depth = requested_depth;
cb.ambient_depths = NULL;
- cb.adm_access = NULL;
cb.ctx = ctx;
cb.from_url = from_url;
cb.to_path = to_path;
Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/patch.c?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/patch.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/patch.c Sun Mar 7 14:12:20 2010
@@ -28,6 +28,7 @@
/*** Includes. ***/
#include <apr_hash.h>
+#include <apr_fnmatch.h>
#include "svn_client.h"
#include "svn_dirent_uri.h"
#include "svn_io.h"
@@ -107,7 +108,13 @@
/* The line last read from the target file. */
svn_linenum_t current_line;
- /* EOL-marker used by target file. */
+ /* The EOL-style of the target. Either 'none', 'fixed', or 'native'.
+ * See the documentation of svn_subst_eol_style_t. */
+ svn_subst_eol_style_t eol_style;
+
+ /* If the EOL_STYLE above is not 'none', this is the EOL string
+ * corresponding to the EOL-style. Else, it is the EOL string the
+ * last line read from the target file was using. */
const char *eol_str;
/* An array containing stream markers marking the beginning
@@ -127,6 +134,9 @@
/* True if the target had to be skipped for some reason. */
svn_boolean_t skipped;
+ /* True if the target matches a filter glob pattern. */
+ svn_boolean_t filtered;
+
/* True if at least one hunk was rejected. */
svn_boolean_t had_rejects;
@@ -150,9 +160,6 @@
/* The keywords of the target. */
apr_hash_t *keywords;
- /* The EOL-style of the target. */
- svn_subst_eol_style_t eol_style;
-
/* The pool the target is allocated in. */
apr_pool_t *pool;
} patch_target_t;
@@ -312,49 +319,24 @@
return SVN_NO_ERROR;
}
-/* Indicate in *LOCAL_MODS whether the file at LOCAL_ABSPATH, has local
- modifications. */
-static svn_error_t *
-check_local_mods(svn_boolean_t *local_mods,
- svn_wc_context_t *wc_ctx,
- const char *local_abspath,
- apr_pool_t *pool)
-{
- svn_error_t *err;
-
- err = svn_wc_text_modified_p2(local_mods, wc_ctx, local_abspath, FALSE,
- pool);
- if (err)
- {
- if (err->apr_err == SVN_ERR_ENTRY_NOT_FOUND)
- {
- /* The target file is not versioned, that's OK.
- * We can treat it as unmodified. */
- svn_error_clear(err);
- *local_mods = FALSE;
- }
- else
- return svn_error_return(err);
- }
-
- return SVN_NO_ERROR;
-}
-
/* Attempt to initialize a *PATCH_TARGET structure for a target file
* described by PATCH. Use working copy context WC_CTX.
* STRIP_COUNT specifies the number of leading path components
* which should be stripped from target paths in the patch.
* Upon success, allocate the patch target structure in RESULT_POOL.
* Else, set *target to NULL.
+ * If a target matches a glob in FILTER_GLOBS, mark it as filtered.
* Use SCRATCH_POOL for all other allocations. */
static svn_error_t *
init_patch_target(patch_target_t **patch_target,
const svn_patch_t *patch,
const char *base_dir,
svn_wc_context_t *wc_ctx, int strip_count,
+ apr_array_header_t *filter_globs,
apr_pool_t *result_pool, apr_pool_t *scratch_pool)
{
patch_target_t *target;
+ int i;
target = apr_pcalloc(result_pool, sizeof(*target));
@@ -362,6 +344,25 @@
base_dir, strip_count, wc_ctx,
result_pool, scratch_pool));
+ target->filtered = FALSE;
+ if (filter_globs)
+ {
+ for (i = 0; i < filter_globs->nelts; i++)
+ {
+ const char *glob;
+
+ glob = APR_ARRAY_IDX(filter_globs, i, const char *);
+ target->filtered = (apr_fnmatch(glob,
+ target->canon_path_from_patchfile,
+ APR_FNM_CASE_BLIND) == APR_SUCCESS);
+ if (target->filtered)
+ {
+ *patch_target = target;
+ return SVN_NO_ERROR;
+ }
+ }
+ }
+
target->local_mods = FALSE;
target->executable = FALSE;
@@ -371,11 +372,12 @@
svn_string_t *keywords_val;
svn_string_t *eol_style_val;
const char *diff_header;
+ svn_boolean_t repair_eol;
apr_size_t len;
- target->eol_str = APR_EOL_STR;
target->keywords = NULL;
- target->eol_style = svn_subst_eol_style_unknown;
+ target->eol_style = svn_subst_eol_style_none;
+ target->eol_str = NULL;
if (target->kind == svn_node_file)
{
@@ -422,46 +424,31 @@
&target->eol_str,
eol_style_val->data);
}
- else
- {
- /* Just use the first EOL sequence we can find in the file. */
- SVN_ERR(svn_eol__detect_file_eol(&target->eol_str,
- target->file, scratch_pool));
- /* But don't enforce any particular EOL-style. */
- target->eol_style = svn_subst_eol_style_none;
- }
-
- if (target->eol_str == NULL)
- {
- /* We couldn't figure out the target files's EOL scheme,
- * just use native EOL makers. */
- target->eol_str = APR_EOL_STR;
- target->eol_style = svn_subst_eol_style_native;
- }
/* Create a stream to read from the target. */
target->stream = svn_stream_from_aprfile2(target->file,
- FALSE, result_pool);
+ FALSE, result_pool);
/* Also check the file for local mods and the Xbit. */
- SVN_ERR(check_local_mods(&target->local_mods, wc_ctx,
- target->abs_path, scratch_pool));
+ SVN_ERR(svn_wc_text_modified_p2(&target->local_mods, wc_ctx,
+ target->abs_path, FALSE,
+ scratch_pool));
SVN_ERR(svn_io_is_file_executable(&target->executable,
target->abs_path,
scratch_pool));
}
- /* Create a temporary file to write the patched result to.
- * Expand keywords in the patched file. */
+ /* Create a temporary file to write the patched result to. */
SVN_ERR(svn_stream_open_unique(&target->patched_raw,
&target->patched_path, NULL,
svn_io_file_del_on_pool_cleanup,
result_pool, scratch_pool));
+ /* Expand keywords in the patched file.
+ * Repair newlines if svn:eol-style dictates a particular style. */
+ repair_eol = (target->eol_style == svn_subst_eol_style_fixed ||
+ target->eol_style == svn_subst_eol_style_native);
target->patched = svn_subst_stream_translated(
- target->patched_raw,
- target->eol_str,
- target->eol_style ==
- svn_subst_eol_style_fixed,
+ target->patched_raw, target->eol_str, repair_eol,
target->keywords, TRUE, result_pool);
/* We'll also need a stream to write rejected hunks to.
@@ -507,6 +494,7 @@
apr_pool_t *result_pool)
{
svn_stringbuf_t *line_raw;
+ const char *eol_str;
if (target->eof)
{
@@ -522,11 +510,15 @@
APR_ARRAY_PUSH(target->lines, svn_stream_mark_t *) = mark;
}
- SVN_ERR(svn_stream_readline(target->stream, &line_raw, target->eol_str,
- &target->eof, scratch_pool));
+ SVN_ERR(svn_stream_readline_detect_eol(target->stream, &line_raw,
+ &eol_str, &target->eof,
+ scratch_pool));
+ if (target->eol_style == svn_subst_eol_style_none)
+ target->eol_str = eol_str;
+
/* Contract keywords. */
SVN_ERR(svn_subst_translate_cstring2(line_raw->data, line,
- target->eol_str, FALSE,
+ NULL, FALSE,
target->keywords, FALSE,
result_pool));
if (! target->eof)
@@ -613,17 +605,16 @@
do
{
const char *hunk_line_translated;
- const char *eol_str;
svn_pool_clear(iterpool);
SVN_ERR(svn_stream_readline_detect_eol(hunk->original_text,
- &hunk_line, &eol_str,
+ &hunk_line, NULL,
&hunk_eof, iterpool));
/* Contract keywords, if any, before matching. */
SVN_ERR(svn_subst_translate_cstring2(hunk_line->data,
&hunk_line_translated,
- eol_str, FALSE,
+ NULL, FALSE,
target->keywords, FALSE,
iterpool));
lines_read++;
@@ -866,7 +857,7 @@
hi->hunk->original_length,
hi->hunk->modified_start,
hi->hunk->modified_length,
- target->eol_str);
+ APR_EOL_STR);
len = strlen(hunk_header);
SVN_ERR(svn_stream_write(target->reject, hunk_header, &len));
@@ -921,7 +912,6 @@
/* Skip the target's version of the hunk.
* Don't skip trailing lines which matched with fuzz. */
- /* ### What if current line is part of hunk context? */
line = target->current_line + hi->hunk->original_length - (2 * hi->fuzz);
SVN_ERR(seek_to_line(target, line, pool));
if (target->current_line != line)
@@ -956,8 +946,15 @@
hunk_line->data, hunk_line->len,
iterpool));
if (eol_str)
- SVN_ERR(try_stream_write(target->patched, target->patched_path,
- eol_str, strlen(eol_str), iterpool));
+ {
+ /* Use the EOL as it was read from the patch file,
+ * unless the target's EOL style is set by svn:eol-style */
+ if (target->eol_style != svn_subst_eol_style_none)
+ eol_str = target->eol_str;
+
+ SVN_ERR(try_stream_write(target->patched, target->patched_path,
+ eol_str, strlen(eol_str), iterpool));
+ }
}
}
while (! eof);
@@ -1058,12 +1055,13 @@
* in RESULT_POOL. Use WC_CTX as the working copy context.
* STRIP_COUNT specifies the number of leading path components
* which should be stripped from target paths in the patch.
+ * If a target matches a glob in FILTER_GLOBS, mark it as filtered.
* Do temporary allocations in SCRATCH_POOL. */
static svn_error_t *
apply_one_patch(patch_target_t **patch_target, svn_patch_t *patch,
const char *abs_wc_path, svn_wc_context_t *wc_ctx,
- int strip_count, apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
+ int strip_count, apr_array_header_t *filter_globs,
+ apr_pool_t *result_pool, apr_pool_t *scratch_pool)
{
patch_target_t *target;
apr_pool_t *iterpool;
@@ -1071,9 +1069,9 @@
static const int MAX_FUZZ = 2;
SVN_ERR(init_patch_target(&target, patch, abs_wc_path, wc_ctx, strip_count,
- result_pool, scratch_pool));
+ filter_globs, result_pool, scratch_pool));
- if (target->skipped)
+ if (target->skipped || target->filtered)
{
*patch_target = target;
return SVN_NO_ERROR;
@@ -1380,6 +1378,9 @@
/* Whether to apply the patch in reverse. */
svn_boolean_t reverse;
+ /* Glob patterns. Files matching any of these patterns won't be patched. */
+ apr_array_header_t *filter_globs;
+
/* The client context. */
svn_client_ctx_t *ctx;
} apply_patches_baton_t;
@@ -1432,8 +1433,11 @@
SVN_ERR(apply_one_patch(&target, patch, btn->abs_wc_path,
btn->ctx->wc_ctx, btn->strip_count,
- scratch_pool, iterpool));
- APR_ARRAY_PUSH(targets, patch_target_t *) = target;
+ btn->filter_globs, scratch_pool, iterpool));
+ if (target->filtered)
+ SVN_ERR(svn_diff__close_patch(patch));
+ else
+ APR_ARRAY_PUSH(targets, patch_target_t *) = target;
}
}
while (patch);
@@ -1456,6 +1460,8 @@
SVN_ERR(svn_diff__close_patch(target->patch));
}
+ SVN_ERR(svn_io_file_close(patch_file, iterpool));
+
svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
@@ -1467,6 +1473,7 @@
svn_boolean_t dry_run,
int strip_count,
svn_boolean_t reverse,
+ apr_array_header_t *filter_globs,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
{
@@ -1482,6 +1489,7 @@
baton.ctx = ctx;
baton.strip_count = strip_count;
baton.reverse = reverse;
+ baton.filter_globs = filter_globs;
SVN_ERR(svn_wc__call_with_write_lock(apply_patches, &baton,
ctx->wc_ctx, local_abspath,
Modified: subversion/branches/svn-patch-improvements/subversion/libsvn_client/ra.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-patch-improvements/subversion/libsvn_client/ra.c?rev=919999&r1=919998&r2=919999&view=diff
==============================================================================
--- subversion/branches/svn-patch-improvements/subversion/libsvn_client/ra.c (original)
+++ subversion/branches/svn-patch-improvements/subversion/libsvn_client/ra.c Sun Mar 7 14:12:20 2010
@@ -322,11 +322,22 @@
if (base_dir)
{
const char *base_dir_abspath;
+ svn_error_t *err;
SVN_ERR(svn_dirent_get_absolute(&base_dir_abspath, base_dir, pool));
- SVN_ERR(svn_wc__node_get_repos_info(NULL, &uuid, ctx->wc_ctx,
- base_dir_abspath, FALSE,
- pool, pool));
+ err = svn_wc__node_get_repos_info(NULL, &uuid, ctx->wc_ctx,
+ base_dir_abspath, FALSE,
+ pool, pool);
+
+ if (err && (err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY
+ || err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND
+ || err->apr_err == SVN_ERR_WC_UPGRADE_REQUIRED))
+ {
+ svn_error_clear(err);
+ uuid = NULL;
+ }
+ else
+ SVN_ERR(err);
}
return svn_error_return(svn_ra_open3(ra_session, base_url, uuid, cbtable, cb,