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

Re: Issue 1493 - property merges should use libsvn_diff

From: Daniel Näslund <daniel_at_longitudo.com>
Date: Wed, 28 Oct 2009 22:59:41 +0100

On Tue, Oct 27, 2009 at 11:09:40PM +0100, Stefan Sperling wrote:
> > When digging into the merge code for issue 1493 I found that it does use
> > svn_diff_mem_string_diff3() and svn_diff_mem_string_output_unified() in
> > libsvn_wc/props.c (maybe_generate_propconflict). I suppose the issue
> > should be closed then?
> >
> > On the other hand I haven't been able to view the resulting three way
> > diff! If I choose 'diff-full' in the interactive conflict resolutioner I
> > get this:
> >
> > [[[
> > Conflict for property 'prop' discovered on '/tmp/wc2/foo'.
> > Select: (p) postpone,
> > (mf) mine-full, (tf) theirs-full,
> > (s) show all options: df
> > Invalid option; there's no merged version to diff.
>
> No idea what's going wrong here yet, but it certainly doesn't look
> right.

> > Where foo.prej contains:
> >
> > [[[
> > Trying to change property 'prop' from 'dog' to 'horse',
> > but the property has been locally changed from 'dog' to 'cat'.
> > ]]]
>
> Isn't that the best 3-way diff format ever?

Maybe... It is declared in this piece of code in libsvn_wc/props.c
(apply_single_generic_prop_change):
[[[

      if (got_conflict)
        {
          /* Describe the conflict, referring to base_val as well as
             working_val for the user's convenience. */
          if (working_val && base_val
              && svn_string_compare(working_val, base_val))
            *conflict = svn_string_createf
              (result_pool,
               _("Trying to change property '%s' from '%s' to '%s',\n"
                 "but property already exists with value '%s'."),
               propname, old_val->data, new_val->data, working_val->data);
          else if (working_val && base_val)
            *conflict = svn_string_createf
              (result_pool,
               _("Trying to change property '%s' from '%s' to '%s',\n"
                 "but the property has been locally changed from '%s' to "
                 "'%s'."),
               propname, old_val->data, new_val->data,
               base_val->data, working_val->data);
          else if (working_val)
            *conflict = svn_string_createf
              (result_pool,
               _("Trying to change property '%s' from '%s' to '%s',\n"
                 "but property has been locally added with value "
                 "'%s'."),
               propname, old_val->data, new_val->data, working_val->data);
          else if (base_val)
            *conflict = svn_string_createf
              (result_pool,
               _("Trying to change property '%s' from '%s' to '%s',\n"
                 "but it has been locally deleted."),
               propname, old_val->data, new_val->data);
          else
            *conflict = svn_string_createf
              (result_pool,
               _("Trying to change property '%s' from '%s' to '%s',\n"
                 "but the property does not exist."),
               propname, old_val->data, new_val->data);
        }
    }
]]]

I could create a string from the svn_diff_mem_string_output_merge2()
created stream and pass that back to be used in the above code. But
would it be a problem to have a diff3 text for some conflicts and the
error message for others?

Does the diff3 format handle deletes and adds? I first thought that it
was just a question of leaving one part of the diff blank but that seems
to easy.
 
> Well we just had a good laugh here by modifying your script to set
> an SVG image as the property value instead of 'horse'.
> I'm not gonna try a PNG because that would probably screw the terminal :)
 
I could write a parser for translating svg files into ascii art when
stored as a property. :-)

/Daniel

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2412268
Received on 2009-10-28 23:00:02 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.