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

Re: [PATCH] issue 1493 - use libsvn_diff for diffing props

From: Daniel Näslund <daniel_at_longitudo.com>
Date: Mon, 27 Jul 2009 12:48:27 +0200

Attaching my new patch with the proposed changes from stsp.

[[[
Fix part of issue 1493: Property diffs/merge should use libsvn_diff.
For properties I have removed the diff headers and replaced the @@-characters
with ##.

*subversion/libsvn_diff/diff_memory.c
(output_unified_flush_hunk2): Added parameter for choosing delimiter, for
instance '##' instead of '@@'.

*subversion/libsvn_diff/diff_memory.c
(svn_diff_mem_string_output_unified2): Added parameter for choosing if the diff
should be formatted as a property diff, '##' as delimiters.

*subversion/include/svn_diff.h
(output_unified_flush_hunk2): Declaration
(svn_diff_mem_string_output_unified2): Declaration

*subversion/libsvn_client/diff.c
(append_eol): Appends an end of line character if missing.

*subversion/libsvn_client/diff.c
(display_prop_diffs): Use libsvn_diff for diffing properties.
]]]

> > + const char *curp;
> > +
> > + if (token->len == 0)
> > + return token;
> > +
> > + curp = token->data + token->len - 1;
>
> Please use svn_subst_detect_eol() if possible.
> See include/svn_subst.h.
svn_subst_detect_eol() detects the first eol in the string. I need to
check if there is one at the end. I could have just checked the last two
positions for an eol but since the eol can be one or two characters that
wont work, "\nx" for example.
>
> > + if (*curp == '\r')
> > + {
> > + return token;
> > + }
> > + else if (*curp != '\n')
> > + {
> > + const char *tmp = apr_psprintf(pool, "%s%s", token->data, APR_EOL_STR);
> > + return svn_string_create(tmp, pool);
> > + }
> > + else
> > + {
> > + return token;
> > + }
> > +}

Received on 2009-07-27 13:44:36 CEST

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.