On Tue, Jul 13, 2010 at 06:46:31PM -0000, [email protected] wrote:
> Author: dannas
> Date: Tue Jul 13 18:46:31 2010
> New Revision: 963814

> @@ -933,6 +933,22 @@ svn_linenum_t
>  svn_diff_hunk_get_trailing_context(const svn_hunk_t *hunk);
>  
>  /**
> + * Data type to manage parsing of properties in patches.
> + * 
> + * @since New in 1.7. */
> +typedef struct svn_prop_patch_t {
> +  const char *name;
> +
> +  /** Represents the operation performed on the property */
> +  svn_diff_operation_kind_t operation;

Maybe call this svn_diff_prop_operation_kind_t?
The current name is pretty generic.

> @@ -1042,6 +1046,47 @@ git_deleted_file(enum parse_state *new_s
>    return SVN_NO_ERROR;
>  }
>  
> +/* Add a HUNK associated with the property PROP_NAME to PATCH. */
> +static svn_error_t *
> +add_property_hunk(svn_patch_t *patch, const char *prop_name, 
> +                  svn_hunk_t *hunk, svn_diff_operation_kind_t operation,
> +                  apr_pool_t *result_pool)
> +{
> +  int i;
> +  svn_boolean_t prop_name_seen = FALSE;
> +
> +  /* Find the right property name and insert the hunk.. */
> +  for (i = 0; i < patch->prop_patches->nelts; i++)
> +    {
> +      svn_prop_patch_t *prop_patch = APR_ARRAY_IDX(patch->prop_patches,
> +                                                   i,
> +                                                   svn_prop_patch_t *);

Maybe a hash table indexed by property name would be easier to
deal with here? (Somehow I think we've had this discussion before
and I proposed arrays???)

> @@ -1182,33 +1227,28 @@ svn_diff_parse_next_patch(svn_patch_t **

>        do
>          {
>            svn_pool_clear(iterpool);
>  
> -          SVN_ERR(parse_next_hunk(&hunk, &prop_name, *patch, stream,
> -                                  reverse, ignore_whitespace,
> +          SVN_ERR(parse_next_hunk(&hunk, &prop_name, &prop_operation,
> +                                  *patch, stream, reverse,
> +                                  ignore_whitespace,
>                                    result_pool, iterpool));
> +
> +          /* We have a property hunk. */
>            if (hunk && prop_name)
>              {
> -              apr_array_header_t *hunks;
> -

Can parse_next_hunk() please get an output paramter is_property?

Looks very neat!
Stefan

Reply via email to