Re: svn commit: r39598 - in trunk/subversion: include libsvn_wc

Julian Foad <[email protected]>
Newsgroups gmane.comp.version-control.subversion.rapidsvn.devel,gmane.comp.version-control.subversion.svn
Message-ID <1255970411.27527.24.camel__17489.1682029285$1255970458$gmane$org@edith.foad.me.uk>
On Fri, 2009-09-25, Bert Huijben wrote:
> Author: rhuijben
> Date: Fri Sep 25 06:14:56 2009
> New Revision: 39598
> 
> Log:
> Add some Request-For-Comment (RFC) version of the new working copy conflict
> api, to allow in-file commenting and sharing the load of updating :)

Problem below...

> Copied and modified: trunk/subversion/libsvn_wc/conflicts.c (from r39596, trunk/subversion/libsvn_wc/adm_ops.c)
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/conflicts.c?pathrev=39598&r1=39596&r2=39598
> ==============================================================================
> --- trunk/subversion/libsvn_wc/adm_ops.c	Fri Sep 25 02:44:57 2009	(r39596, copy source)
> +++ trunk/subversion/libsvn_wc/conflicts.c	Fri Sep 25 06:14:56 2009	(r39598)
> @@ -1,10 +1,7 @@
>  /*
> + * conflicts.c: routines for managing conflict data.
> + *            NOTE: this code doesn't know where the conflict is
> + *            actually stored. 
>   *
>   * ====================================================================
>   *    Licensed to the Subversion Corporation (SVN Corp.) under one

> +struct svn_wc_conflict_t
> +{
> +  /* Pool conflict is allocated in */
> +  apr_pool_t *pool;
>  
> +  /* ### kind + property name are the primary keys of a conflict */
> +  /* The kind of conflict recorded */
> +  svn_wc_conflict_kind_t kind;
> +
> +  /* When describing a property conflict the property name
> +     or "" when no property name is available. (Upgrade from old WC or 
> +     raised via compatibility apis). */
> +  const char *property_name;

> +  /* ### TODO: Add more fields */
> +};
 
> +svn_error_t *
> +svn_wc_conflict_dup(svn_wc_conflict_t** duplicate,
> +                    svn_wc_conflict_t* base,
> +                    apr_pool_t *result_pool)
>  {
> +  svn_wc_conflict_t *c;
> +  if (result_pool == base->pool)
>      {
> +      /* No need to duplicate; base has the same liftime and its inner
> +         values can't change */

... This is trying to be too clever. The doc string promises to return a
copy of the structure, allocated in result_pool. If it's important to
implement such an optimisation (and I don't know that it is) the
doc-string should allow it.

> +      *duplicate = base;
> +      return SVN_NO_ERROR;
>      }
> +  
> +  SVN_ERR(conflict_alloc(&c, result_pool));
>  
> +  c->kind = base->kind;
> +  c->property_name = base->property_name
> +                          ? apr_pstrdup(result_pool, base->property_name)
> +                          : NULL;
>  
> +  *duplicate = c;
>    return SVN_NO_ERROR;
>  }

- Julian

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=2409028
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.