[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Fix failing three-way diff for properties

From: Daniel Näslund <daniel_at_longitudo.com>
Date: Sat, 31 Oct 2009 14:41:04 +0100

Hi Julian,

On Fri, Oct 30, 2009 at 04:39:28PM +0000, Julian Foad wrote:
> Daniel Näslund wrote:
> > [[[
> > Fix failing three way diff for properties when invoking diff-full (df)
> > in the interactive conflict resolutioner.
> >
> > * subversion/libsvn_wc/util.c
> > (svn_wc__cd2_to_cd): All the usual files needed in a three way diff is
> > available for properties as well as markers for binary format and
> > mime.
> >
> > * subversion/svn/conflict-callbacks.c
> > (svn_cl__conflict_handler): Set diff_allowed only if desc->is_binary
> > is false.
> > ]]]

> > I changed the condition for when a diff is allowed in the conflict
> > handler but I wonder... If no mime-type is set is_binary is set to false
> > for properties. But how do I set a mime-type for a property? This may be
> > a bit too simple.
> On this point, does the "is_binary" flag refer to a property or to the
> versioned file's content? From what you say here, it sounds like it
> refers to the versioned file's content. In that case, you cannot use it
> to decide whether a property value is diffable.

I found this comment in svn_wc_conflict_description2_t:

  /** Whether svn thinks ('my' version of) @c path is a 'binary' file.
   * (Only if @c kind is 'text', else undefined.) */
  svn_boolean_t is_binary;

When looking in libsvn_wc/props.c (maybe_generate_propconflict) the
is_binary flag and mime_type is handled like this:

  if (!is_dir && working_props)
    mime_propval = apr_hash_get(working_props, SVN_PROP_MIME_TYPE,
  cdesc->mime_type = mime_propval ? mime_propval->data : NULL;
  cdesc->is_binary = mime_propval ?
      svn_mime_type_is_binary(mime_propval->data) : FALSE;

So the mime_type and is_binary flag refers to the file the properties
belongs to. We were hoping that it would refer to the mime_type of the

Why do we just look at 'mine' for mime_type? If 'theirs' is a binary
file I guess we still can't do a diff? Or is that a tree conflict? If
the mime_type of a file has changed then it's assumed that it's a replaced

> I think we have an API for empirically determining whether a certain
> file or a certain text contains non-text characters. It is used for
> automatically detecting "binary" files during import/add. Maybe you
> could use it.

Found it! svn_io_detect_mimetype2() was just what I was looking for.

BUT it needs a map of mime-types. svn_client_context_t contains one of
those. How can I get a hold of that from deep inside libsvn_wc? There is
currently 18 stack-levels of merge_report_editor-driven function calls
between me and that precious ctx struct!


Received on 2009-10-31 14:41:21 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.