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

Re: Mergeinfo property diff regression

From: Stefan Sperling <stsp_at_elego.de>
Date: Thu, 3 Jul 2014 23:09:24 +0200

On Thu, Jul 03, 2014 at 05:27:00PM +0100, Julian Foad wrote:
> Stefan Sperling wrote:
> > On Thu, Jul 03, 2014 at 04:13:54PM +0100, Julian Foad wrote:
> >> With Subversion 1.8.9:
> >> [[[
> >> Modified: svn:mergeinfo
> >>    Merged /trunk:r16-18
> >> ]]]
> >>
> >> With Subversion trunk the last part of the output changes to:
> >>
> >> [[[
> >> Modified: svn:mergeinfo
> >> ## -0,0 +0,1 ##
> >>    Merged /trunk:r16-18
> >> ]]]
> >
> > There is a rational outlined in the commit which introduced this change.
> >
> > ------------------------------------------------------------------------
> > r1598092 | stsp | 2014-05-28 20:08:52 +0200 (Wed, 28 May 2014) | 14 lines
> >
> > For issue #3747, 'svn patch' support of svn:mergeinfo, make it
> > possible to parse svn:mergeinfo diffs regardless of i18n.
> >
> > * subversion/libsvn_diff/util.c
> >   (display_mergeinfo_diff): Print a hunk header line for mergeinfo diffs.
> >    The header indicates the number of reverse-merges and forward-merges in
> >    the diff. Before this change, this information was only printed as part
> >    of output which is translated for i18n. This made it impossible to reliably
> >    parse svn:mergeinfo diffs from patch files.
> >    Futher changes to the diff parser and svn patch are coming soon.
> > ------------------------------------------------------------------------
>
> Thanks for explaining the rationale.
>
> I like having parseable output.
>
> How exactly does the '##' line indicate the number of merges?

The docstring of libsvn_diff/parse-diff.c:parse_mergeinfo() mentions
how the format works. The leading zeroes (before comma) don't mean
anything. I kept them so I could reuse existing parser code, and for
visual consistency with other property diff hunk headers where these
numbers carry the same meaning as in regular unidiff file content
changes.

/* A helper function to parse svn:mergeinfo diffs.
 *
 * These diffs use a special pretty-print format, for instance:
 *
 * Added: svn:mergeinfo
 * ## -0,0 +0,1 ##
 * Merged /trunk:r2-3
 *
 * The hunk header has the following format:
 * ## -0,NUMBER_OF_REVERSE_MERGES +0,NUMBER_OF_FORWARD_MERGES ##
 *
 * At this point, the number of reverse merges has already been
 * parsed into HUNK->ORIGINAL_LENGTH, and the number of forward
 * merges has been parsed into HUNK->MODIFIED_LENGTH.
 *
 * The header is followed by a list of mergeinfo, one path per line.
 * This function parses such lines. Lines describing reverse merges
 * appear first, and then all lines describing forward merges appear.
 *
 * Parts of the line are affected by i18n. The words 'Merged'
 * and 'Reverse-merged' can appear in any language and at any
 * position within the line. We can only assume that a leading
 * '/' starts the merge source path, the path is followed by
 * ":r", which in turn is followed by a mergeinfo revision range,
 * which is terminated by whitespace or end-of-string.
 *
 * If the current line meets the above criteria and we're able
 * to parse valid mergeinfo from it, the resulting mergeinfo
 * is added to patch->mergeinfo or patch->reverse_mergeinfo,
 * and we proceed to the next line.
 */
static svn_error_t *
parse_mergeinfo(svn_boolean_t *found_mergeinfo,
                svn_stringbuf_t *line,
                svn_diff_hunk_t *hunk,
                svn_patch_t *patch,
                apr_pool_t *result_pool,
                apr_pool_t *scratch_pool)
Received on 2014-07-03 23:20:20 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.