You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2019/01/08 18:45:46 UTC
svn commit: r1850781 - in /subversion/trunk/subversion: include/svn_client.h
libsvn_client/blame.c libsvn_client/deprecated.c
Author: steveking
Date: Tue Jan 8 18:45:45 2019
New Revision: 1850781
URL: http://svn.apache.org/viewvc?rev=1850781&view=rev
Log:
Extend the blame callback with a string length parameter.
* subversion/incluce/svn_client.h
* subversion/libsvn_client/blame.c
(svn_client_blame_receiver4_t): typedef for new callback
(svn_client_blame6): new API using the svn_client_blame_receiver4_t callback
* subversion/libsvn_client/deprecated.c
(svn_client_blame5): moved API there, calling svn_client_blame6 using a
callback shim
(blame_wrapper_receiver3): callback shim for svn_client_blame5
Modified:
subversion/trunk/subversion/include/svn_client.h
subversion/trunk/subversion/libsvn_client/blame.c
subversion/trunk/subversion/libsvn_client/deprecated.c
Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1850781&r1=1850780&r2=1850781&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Tue Jan 8 18:45:45 2019
@@ -736,10 +736,11 @@ typedef svn_error_t *(*svn_client_get_co
* @{
*/
-/** Callback type used by svn_client_blame5() to notify the caller
+/** Callback type used by svn_client_blame6() to notify the caller
* that line @a line_no of the blamed file was last changed in @a revision
* which has the revision properties @a rev_props, and that the contents were
- * @a line.
+ * @a line. The @a line content is delivered as is. It is up to the client to
+ * determine the encoding. The line does not contain the cr/lf at the end.
*
* @a start_revnum and @a end_revnum contain the start and end revision
* number of the entire blame operation, as determined from the repository
@@ -758,6 +759,33 @@ typedef svn_error_t *(*svn_client_get_co
* will be true if the reason there is no blame information is that the line
* was modified locally. In all other cases @a local_change will be false.
*
+ * @note the line is split on LF characters. Clients must be aware of this
+ * when dealing with different encodings of the file/line.
+ * Blaming non ASCII/UTF-8 files requires the @a force flag to be set when
+ * calling the svn_client_blame6 function.
+ *
+ * @since New in 1.12.
+ */
+typedef svn_error_t *(*svn_client_blame_receiver4_t)(
+ void *baton,
+ svn_revnum_t start_revnum,
+ svn_revnum_t end_revnum,
+ apr_int64_t line_no,
+ svn_revnum_t revision,
+ apr_hash_t *rev_props,
+ svn_revnum_t merged_revision,
+ apr_hash_t *merged_rev_props,
+ const char *merged_path,
+ const svn_string_t *line,
+ svn_boolean_t local_change,
+ apr_pool_t *pool);
+
+/**
+ * Similar to #svn_client_blame_receiver4_t, but with the line parameter
+ * as a (const char*) instead of an svn_string_t.
+ *
+ * @deprecated Provided for backward compatibility with the 1.11 API.
+ *
* @since New in 1.7.
*/
typedef svn_error_t *(*svn_client_blame_receiver3_t)(
@@ -2928,6 +2956,28 @@ svn_client_log(const apr_array_header_t
*
* Use @a pool for any temporary allocation.
*
+ * @since New in 1.12.
+ */
+svn_error_t *
+svn_client_blame6(const char *path_or_url,
+ const svn_opt_revision_t *peg_revision,
+ const svn_opt_revision_t *start,
+ const svn_opt_revision_t *end,
+ const svn_diff_file_options_t *diff_options,
+ svn_boolean_t ignore_mime_type,
+ svn_boolean_t include_merged_revisions,
+ svn_client_blame_receiver4_t receiver,
+ void *receiver_baton,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool);
+
+
+/**
+ * Similar to svn_client_blame6(), but with #svn_client_blame_receiver3_t
+ * as the receiver.
+ *
+ * @deprecated Provided for backwards compatibility with the 1.11 API.
+ *
* @since New in 1.7.
*/
svn_error_t *
@@ -2943,9 +2993,8 @@ svn_client_blame5(const char *path_or_ur
svn_client_ctx_t *ctx,
apr_pool_t *pool);
-
/**
- * Similar to svn_client_blame5(), but with #svn_client_blame_receiver3_t
+ * Similar to svn_client_blame5(), but with #svn_client_blame_receiver2_t
* as the receiver.
*
* @deprecated Provided for backwards compatibility with the 1.6 API.
Modified: subversion/trunk/subversion/libsvn_client/blame.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/blame.c?rev=1850781&r1=1850780&r2=1850781&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/blame.c (original)
+++ subversion/trunk/subversion/libsvn_client/blame.c Tue Jan 8 18:45:45 2019
@@ -656,14 +656,14 @@ normalize_blames(struct blame_chain *cha
}
svn_error_t *
-svn_client_blame5(const char *target,
+svn_client_blame6(const char *target,
const svn_opt_revision_t *peg_revision,
const svn_opt_revision_t *start,
const svn_opt_revision_t *end,
const svn_diff_file_options_t *diff_options,
svn_boolean_t ignore_mime_type,
svn_boolean_t include_merged_revisions,
- svn_client_blame_receiver3_t receiver,
+ svn_client_blame_receiver4_t receiver,
void *receiver_baton,
svn_client_ctx_t *ctx,
apr_pool_t *pool)
@@ -941,18 +941,21 @@ svn_client_blame5(const char *target,
SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
if (!eof || sb->len)
{
+ svn_string_t line;
+ line.data = sb->data;
+ line.len = sb->len;
if (walk->rev)
SVN_ERR(receiver(receiver_baton, start_revnum, end_revnum,
line_no, walk->rev->revision,
walk->rev->rev_props, merged_rev,
merged_rev_props, merged_path,
- sb->data, FALSE, iterpool));
+ &line, FALSE, iterpool));
else
SVN_ERR(receiver(receiver_baton, start_revnum, end_revnum,
line_no, SVN_INVALID_REVNUM,
NULL, SVN_INVALID_REVNUM,
NULL, NULL,
- sb->data, TRUE, iterpool));
+ &line, TRUE, iterpool));
}
if (eof) break;
}
Modified: subversion/trunk/subversion/libsvn_client/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/deprecated.c?rev=1850781&r1=1850780&r2=1850781&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_client/deprecated.c Tue Jan 8 18:45:45 2019
@@ -166,6 +166,58 @@ svn_client_mkdir(svn_client_commit_info_
}
/*** From blame.c ***/
+struct blame_receiver_wrapper_baton3 {
+ void *baton;
+ svn_client_blame_receiver3_t receiver;
+};
+
+static svn_error_t *
+blame_wrapper_receiver3(void *baton,
+ svn_revnum_t start_revnum,
+ svn_revnum_t end_revnum,
+ apr_int64_t line_no,
+ svn_revnum_t revision,
+ apr_hash_t *rev_props,
+ svn_revnum_t merged_revision,
+ apr_hash_t *merged_rev_props,
+ const char *merged_path,
+ const svn_string_t *line,
+ svn_boolean_t local_change,
+ apr_pool_t *pool)
+{
+ struct blame_receiver_wrapper_baton3 *brwb = baton;
+
+ if (brwb->receiver)
+ return brwb->receiver(brwb->baton, start_revnum, end_revnum, line_no,
+ revision, rev_props, merged_revision,
+ merged_rev_props, merged_path, line->data,
+ local_change, pool);
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_client_blame5(const char *target,
+ const svn_opt_revision_t *peg_revision,
+ const svn_opt_revision_t *start,
+ const svn_opt_revision_t *end,
+ const svn_diff_file_options_t *diff_options,
+ svn_boolean_t ignore_mime_type,
+ svn_boolean_t include_merged_revisions,
+ svn_client_blame_receiver3_t receiver,
+ void *receiver_baton,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool)
+{
+ struct blame_receiver_wrapper_baton3 baton;
+
+ baton.receiver = receiver;
+ baton.baton = receiver_baton;
+
+ return svn_client_blame6(target, peg_revision, start, end, diff_options,
+ ignore_mime_type, include_merged_revisions,
+ blame_wrapper_receiver3, &baton, ctx, pool);
+}
struct blame_receiver_wrapper_baton2 {
void *baton;
Re: svn commit: r1850781 - in /subversion/trunk/subversion:
include/svn_client.h libsvn_client/blame.c libsvn_client/deprecated.c
Posted by Stefan Kueng <to...@gmail.com>.
On 08.01.2019 19:58, Branko Čibej wrote:
> On 08.01.2019 19:45, steveking@apache.org wrote:
>> Author: steveking
>> Date: Tue Jan 8 18:45:45 2019
>> New Revision: 1850781
>>
>> URL: http://svn.apache.org/viewvc?rev=1850781&view=rev
>> Log:
>> Extend the blame callback with a string length parameter.
>>
>> * subversion/incluce/svn_client.h
>> * subversion/libsvn_client/blame.c
>> (svn_client_blame_receiver4_t): typedef for new callback
>> (svn_client_blame6): new API using the svn_client_blame_receiver4_t callback
>> * subversion/libsvn_client/deprecated.c
>> (svn_client_blame5): moved API there, calling svn_client_blame6 using a
>> callback shim
>> (blame_wrapper_receiver3): callback shim for svn_client_blame5
>>
>> Modified:
>> subversion/trunk/subversion/include/svn_client.h
>> subversion/trunk/subversion/libsvn_client/blame.c
>> subversion/trunk/subversion/libsvn_client/deprecated.c
>>
>> Modified: subversion/trunk/subversion/include/svn_client.h
>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1850781&r1=1850780&r2=1850781&view=diff
>> ==============================================================================
>> --- subversion/trunk/subversion/include/svn_client.h (original)
>> +++ subversion/trunk/subversion/include/svn_client.h Tue Jan 8 18:45:45 2019
>> @@ -736,10 +736,11 @@ typedef svn_error_t *(*svn_client_get_co
>> * @{
>> */
>>
>> -/** Callback type used by svn_client_blame5() to notify the caller
>> +/** Callback type used by svn_client_blame6() to notify the caller
>> * that line @a line_no of the blamed file was last changed in @a revision
>> * which has the revision properties @a rev_props, and that the contents were
>> - * @a line.
>> + * @a line. The @a line content is delivered as is. It is up to the client to
>> + * determine the encoding. The line does not contain the cr/lf at the end.
>
> I don't think we even care about CR, only LF.
when splitting the line, but I never got a CR either in the callback, so
it is removed.
Stefan
Re: svn commit: r1850781 - in /subversion/trunk/subversion:
include/svn_client.h libsvn_client/blame.c libsvn_client/deprecated.c
Posted by Branko Čibej <br...@apache.org>.
On Wed, 9 Jan 2019, 10:03 Bert Huijben <bert@qqmail.nl wrote:
> As far as I can tell blame handles all svn:eol-style values, which can be
> a simple 'CR' in which case the normalized form has a plain '\r'. (Only in
> case of native and 'LF' the normalized form is a single '\n') Are we sure
> this case is properly handled now?
>
> (I read a comment that this is just stripped now)
>
Our transformation code /should/ only strip away CR when it's immediately
followed by LF, which won't affect UTF-16. But that only happens when a
file is installed in the working copy. Maybe blame reads files in text mode
and the Windows runtime does some magic?
-- Brane
On Tue, Jan 8, 2019 at 8:41 PM Stefan Kueng <to...@gmail.com> wrote:
>
>>
>>
>> On 08.01.2019 20:30, Michael Pilato wrote:
>> >> On 08.01.2019 19:45, steveking@apache.org wrote:
>> >>> Author: steveking
>> >>> Date: Tue Jan 8 18:45:45 2019
>> >>> New Revision: 1850781
>> >
>> > [...]
>> >
>> >>> Modified: subversion/trunk/subversion/include/svn_client.h
>> >>> URL:
>> http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1850781&r1=1850780&r2=1850781&view=diff
>> >>>
>> ==============================================================================
>> >>> --- subversion/trunk/subversion/include/svn_client.h (original)
>> >>> +++ subversion/trunk/subversion/include/svn_client.h Tue Jan 8
>> 18:45:45 2019
>> >>> @@ -736,10 +736,11 @@ typedef svn_error_t *(*svn_client_get_co
>> >>> * @{
>> >>> */
>> >>>
>> >>> -/** Callback type used by svn_client_blame5() to notify the caller
>> >>> +/** Callback type used by svn_client_blame6() to notify the caller
>> >>> * that line @a line_no of the blamed file was last changed in @a
>> revision
>> >>> * which has the revision properties @a rev_props, and that the
>> contents were
>> >>> - * @a line.
>> >>> + * @a line. The @a line content is delivered as is. It is up to the
>> client to
>> >>> + * determine the encoding. The line does not contain the cr/lf at
>> the end.
>> >
>> > Minor nit: please use all-caps "CR" and "LF" in this context.
>>
>> Done.
>>
>> Stefan
>>
>
Re: svn commit: r1850781 - in /subversion/trunk/subversion:
include/svn_client.h libsvn_client/blame.c libsvn_client/deprecated.c
Posted by Bert Huijben <be...@qqmail.nl>.
As far as I can tell blame handles all svn:eol-style values, which can be a
simple 'CR' in which case the normalized form has a plain '\r'. (Only in
case of native and 'LF' the normalized form is a single '\n') Are we sure
this case is properly handled now?
(I read a comment that this is just stripped now)
Bert
On Tue, Jan 8, 2019 at 8:41 PM Stefan Kueng <to...@gmail.com> wrote:
>
>
> On 08.01.2019 20:30, Michael Pilato wrote:
> >> On 08.01.2019 19:45, steveking@apache.org wrote:
> >>> Author: steveking
> >>> Date: Tue Jan 8 18:45:45 2019
> >>> New Revision: 1850781
> >
> > [...]
> >
> >>> Modified: subversion/trunk/subversion/include/svn_client.h
> >>> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1850781&r1=1850780&r2=1850781&view=diff
> >>>
> ==============================================================================
> >>> --- subversion/trunk/subversion/include/svn_client.h (original)
> >>> +++ subversion/trunk/subversion/include/svn_client.h Tue Jan 8
> 18:45:45 2019
> >>> @@ -736,10 +736,11 @@ typedef svn_error_t *(*svn_client_get_co
> >>> * @{
> >>> */
> >>>
> >>> -/** Callback type used by svn_client_blame5() to notify the caller
> >>> +/** Callback type used by svn_client_blame6() to notify the caller
> >>> * that line @a line_no of the blamed file was last changed in @a
> revision
> >>> * which has the revision properties @a rev_props, and that the
> contents were
> >>> - * @a line.
> >>> + * @a line. The @a line content is delivered as is. It is up to the
> client to
> >>> + * determine the encoding. The line does not contain the cr/lf at the
> end.
> >
> > Minor nit: please use all-caps "CR" and "LF" in this context.
>
> Done.
>
> Stefan
>
Re: svn commit: r1850781 - in /subversion/trunk/subversion:
include/svn_client.h libsvn_client/blame.c libsvn_client/deprecated.c
Posted by Stefan Kueng <to...@gmail.com>.
On 08.01.2019 20:30, Michael Pilato wrote:
>> On 08.01.2019 19:45, steveking@apache.org wrote:
>>> Author: steveking
>>> Date: Tue Jan 8 18:45:45 2019
>>> New Revision: 1850781
>
> [...]
>
>>> Modified: subversion/trunk/subversion/include/svn_client.h
>>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1850781&r1=1850780&r2=1850781&view=diff
>>> ==============================================================================
>>> --- subversion/trunk/subversion/include/svn_client.h (original)
>>> +++ subversion/trunk/subversion/include/svn_client.h Tue Jan 8 18:45:45 2019
>>> @@ -736,10 +736,11 @@ typedef svn_error_t *(*svn_client_get_co
>>> * @{
>>> */
>>>
>>> -/** Callback type used by svn_client_blame5() to notify the caller
>>> +/** Callback type used by svn_client_blame6() to notify the caller
>>> * that line @a line_no of the blamed file was last changed in @a revision
>>> * which has the revision properties @a rev_props, and that the contents were
>>> - * @a line.
>>> + * @a line. The @a line content is delivered as is. It is up to the client to
>>> + * determine the encoding. The line does not contain the cr/lf at the end.
>
> Minor nit: please use all-caps "CR" and "LF" in this context.
Done.
Stefan
Re: svn commit: r1850781 - in /subversion/trunk/subversion:
include/svn_client.h libsvn_client/blame.c libsvn_client/deprecated.c
Posted by Michael Pilato <cm...@collab.net>.
> On 08.01.2019 19:45, steveking@apache.org wrote:
>> Author: steveking
>> Date: Tue Jan 8 18:45:45 2019
>> New Revision: 1850781
[...]
>> Modified: subversion/trunk/subversion/include/svn_client.h
>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1850781&r1=1850780&r2=1850781&view=diff
>> ==============================================================================
>> --- subversion/trunk/subversion/include/svn_client.h (original)
>> +++ subversion/trunk/subversion/include/svn_client.h Tue Jan 8 18:45:45 2019
>> @@ -736,10 +736,11 @@ typedef svn_error_t *(*svn_client_get_co
>> * @{
>> */
>>
>> -/** Callback type used by svn_client_blame5() to notify the caller
>> +/** Callback type used by svn_client_blame6() to notify the caller
>> * that line @a line_no of the blamed file was last changed in @a revision
>> * which has the revision properties @a rev_props, and that the contents were
>> - * @a line.
>> + * @a line. The @a line content is delivered as is. It is up to the client to
>> + * determine the encoding. The line does not contain the cr/lf at the end.
Minor nit: please use all-caps "CR" and "LF" in this context.
Re: svn commit: r1850781 - in /subversion/trunk/subversion:
include/svn_client.h libsvn_client/blame.c libsvn_client/deprecated.c
Posted by Branko Čibej <br...@apache.org>.
On 08.01.2019 19:45, steveking@apache.org wrote:
> Author: steveking
> Date: Tue Jan 8 18:45:45 2019
> New Revision: 1850781
>
> URL: http://svn.apache.org/viewvc?rev=1850781&view=rev
> Log:
> Extend the blame callback with a string length parameter.
>
> * subversion/incluce/svn_client.h
> * subversion/libsvn_client/blame.c
> (svn_client_blame_receiver4_t): typedef for new callback
> (svn_client_blame6): new API using the svn_client_blame_receiver4_t callback
> * subversion/libsvn_client/deprecated.c
> (svn_client_blame5): moved API there, calling svn_client_blame6 using a
> callback shim
> (blame_wrapper_receiver3): callback shim for svn_client_blame5
>
> Modified:
> subversion/trunk/subversion/include/svn_client.h
> subversion/trunk/subversion/libsvn_client/blame.c
> subversion/trunk/subversion/libsvn_client/deprecated.c
>
> Modified: subversion/trunk/subversion/include/svn_client.h
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1850781&r1=1850780&r2=1850781&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/include/svn_client.h (original)
> +++ subversion/trunk/subversion/include/svn_client.h Tue Jan 8 18:45:45 2019
> @@ -736,10 +736,11 @@ typedef svn_error_t *(*svn_client_get_co
> * @{
> */
>
> -/** Callback type used by svn_client_blame5() to notify the caller
> +/** Callback type used by svn_client_blame6() to notify the caller
> * that line @a line_no of the blamed file was last changed in @a revision
> * which has the revision properties @a rev_props, and that the contents were
> - * @a line.
> + * @a line. The @a line content is delivered as is. It is up to the client to
> + * determine the encoding. The line does not contain the cr/lf at the end.
I don't think we even care about CR, only LF.
-- Brane