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

Re: Re-merge a change from own history - corrupts svn:mergeinfo

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Mon, 31 Mar 2008 21:04:32 +0100

The following merge corrupts svn:mergeinfo:

svn merge --ignore-ancestry --accept=mine-full -c26169 \
   subversion/tests/cmdline/merge_tests.py \
   subversion/tests/cmdline/merge_tests.py

because (in subversion/libsvn_client/merge.c) do_file_merge() says:

   if (honor_mergeinfo)
     {
       ...
       calculate mergeinfo_path
       ...
     }
   ...
   if (record_mergeinfo ...)
     {
       ...
       use mergeinfo_path
       ...
     }

and, in merges like this one, "record_mergeinfo" is true but "honor_mergeinfo"
isn't.

One interpretation of the bug is to say that we should never be recording
mergeinfo when we're not honouring it, because we decided that we never would
want to and that "ignore_ancestry" should prevent both things. In that case,
the following should fix it:

[[[
  /* Set *HONOR_MERGEINFO and *RECORD_MERGEINFO (if non-NULL)
- appropriately for MERGE_B. */
+ appropriately for MERGE_B.
+ One rule is that we shan't record mergeinfo if we're not honoring it. */
  static APR_INLINE void
  mergeinfo_behavior(svn_boolean_t *honor_mergeinfo,
                     svn_boolean_t *record_mergeinfo,
                     merge_cmd_baton_t *merge_b)
  {
    if (honor_mergeinfo)
      *honor_mergeinfo = (merge_b->mergeinfo_capable
                          && merge_b->sources_ancestral
                          && merge_b->same_repos
                          && (! merge_b->ignore_ancestry));

    if (record_mergeinfo)
      *record_mergeinfo = (merge_b->mergeinfo_capable
                           && merge_b->sources_ancestral
                           && merge_b->same_repos
+ && (! merge_b->ignore_ancestry)
                           && (! merge_b->dry_run));
  }
]]]

Paul, can you verify this is a correct fix? Can you see any knock-on effect?
The only other code path it affects is do_directory_merge, which is structured
a little differently and doesn't suffer the same problem.

It certainly seems to fix the problem. I'm running "make check" now. (I don't
have a specific test for this. Symptom is sometimes/on-some-systems it crashes,
sometimes it produces bogus results...)

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-03-31 22:04:48 CEST

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