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

Re: svn commit: r1079983 - in /subversion/trunk/subversion: include/ libsvn_ra_neon/ libsvn_ra_serf/ libsvn_ra_svn/ libsvn_repos/ mod_dav_svn/reports/ svn/ svnserve/ tests/cmdline/

From: Paul Burba <ptburba_at_gmail.com>
Date: Wed, 9 Mar 2011 18:02:14 -0500

On Wed, Mar 9, 2011 at 5:19 PM, Paul Burba <ptburba_at_gmail.com> wrote:
> I think/hope I found the problem (well certainly *a* problem):
> Allocating mergeinfo in a short-lived iterpool, see
> http://svn.apache.org/viewvc?view=revision&revision=1080034

Yup, that was it. Nothing more to see here.

> /me watches the buildbots expectantly...
>
> On Wed, Mar 9, 2011 at 5:00 PM, Paul Burba <ptburba_at_gmail.com> wrote:
>> The test I tried to fix in this commit,
>>
>> log_tests.py 31: log -g differentiates forward and reverse merges,
>>
>> is failing on the buildbots :
>>
>> With bdb x ra_neon the server has problems:
>> http://ci.apache.org/builders/svn-x64-centos%20gcc/builds/2442/steps/Test%20bdb%2Bra_neon/logs/faillog
>> [[[
>> CMD: svn log -g -r8 svn-test-work/working_copies/log_tests-31/A_COPY/D
>> --config-dir /home/bt/slaves/x64-centos/build/subversion/tests/cmdline/svn-test-work/local_tmp/config
>> --password rayjandom --no-auth-cache --username jrandom
>> CMD: /home/bt/slaves/x64-centos/build/subversion/svn/svn log -g -r8
>> svn-test-work/working_copies/log_tests-31/A_COPY/D --config-dir
>> /home/bt/slaves/x64-centos/build/subversion/tests/cmdline/svn-test-work/local_tmp/config
>> --password rayjandom --no-auth-cache --username jrandom exited with 1
>> <TIME = 0.069142>
>> subversion/svn/log-cmd.c:746: (apr_err=175002)
>> subversion/libsvn_client/log.c:617: (apr_err=175002)
>> subversion/libsvn_ra_neon/util.c:1322: (apr_err=175002)
>> subversion/libsvn_ra_neon/util.c:659: (apr_err=175002)
>> svn: E175002: REPORT of
>> '/svn-test-work/repositories/log_tests-31/!svn/bc/8/A_COPY/D': Could
>> not read status line: connection was closed by server.
>> (http://localhost:19930)
>> ]]]
>>
>> With fsfs x ra_svn the log command works, but an expected revision is missing:
>> http://ci.apache.org/builders/svn-debian-x86_64-32%20shared%20gcc/builds/2964/steps/Test%20fsfs%2Bra_svn/logs/faillog
>> [[[
>> CMD: svn log -g -r8 svn-test-work/working_copies/log_tests-31/A_COPY/D
>> --config-dir /home/svnbuilder/slave/eh-debsarge1/build/subversion/tests/cmdline/svn-test-work/local_tmp/config
>> --password rayjandom --no-auth-cache --username jrandom
>> <TIME = 0.037864>
>> ------------------------------------------------------------------------
>> r8 | jrandom | 2011-03-09 20:49:28 +0000 (Wed, 09 Mar 2011) | 1 line
>>
>> Merge -c-3,-5,4,6 from A to A_COPY
>> ------------------------------------------------------------------------
>> r6 | jrandom | 2011-03-09 20:49:27 +0000 (Wed, 09 Mar 2011) | 1 line
>> Merged via: r8
>>
>> log msg
>> ------------------------------------------------------------------------
>> r4 | jrandom | 2011-03-09 20:49:27 +0000 (Wed, 09 Mar 2011) | 1 line
>> Merged via: r8
>>
>> log msg
>> ------------------------------------------------------------------------
>> CWD: /home/svnbuilder/slave/eh-debsarge1/build/subversion/tests/cmdline
>> EXCEPTION: SVNUnexpectedLogs: Reverse merged revision '3' missing:
>> Actual revision list was [8, 6, 4]
>> Traceback (most recent call last):
>>  File "/home/svnbuilder/slave/eh-debsarge1/build/subversion/tests/cmdline/svntest/main.py",
>> line 1263, in run
>>    rc = self.pred.run(sandbox)
>>  File "/home/svnbuilder/slave/eh-debsarge1/build/subversion/tests/cmdline/svntest/testcase.py",
>> line 254, in run
>>    return self._delegate.run(sandbox)
>>  File "/home/svnbuilder/slave/eh-debsarge1/build/subversion/tests/cmdline/svntest/testcase.py",
>> line 176, in run
>>    return self.func(sandbox)
>>  File "/home/svnbuilder/slave/eh-debsarge1/build/subversion/tests/cmdline/log_tests.py",
>> line 1870, in merge_sensitive_log_reverse_merges
>>    check_merge_results(log_chain, expected_merges, expected_reverse_merges)
>>  File "/home/svnbuilder/slave/eh-debsarge1/build/subversion/tests/cmdline/log_tests.py",
>> line 1193, in check_merge_results
>>    log_chain)
>> SVNUnexpectedLogs: Reverse merged revision '3' missing: Actual
>> revision list was [8, 6, 4]
>> FAIL:  log_tests.py 31: log -g differentiates forward and reverse merges
>> ]]]
>>
>> Unfortunately I can't replicate these failures on my local machine (in
>> either debug or release builds).  Is anyone seeing these locally?
>>
>> Paul
>>
>> On Wed, Mar 9, 2011 at 3:37 PM,  <pburba_at_apache.org> wrote:
>>> Author: pburba
>>> Date: Wed Mar  9 20:37:55 2011
>>> New Revision: 1079983
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1079983&view=rev
>>> Log:
>>> Fix issue #3176 'log -g output for merge reversal is bit confusing'.
>>>
>>> The output of 'svn log -g' now differentiates between merged revisions that
>>> resulting from forward merges and those resulting from reverse merges.  In a
>>> nutshell: svn_log_entry_t has a new member 'subtractive_merge' that
>>> identifies merged revisions that result from reverse merges.
>>>
>>> * subversion/include/svn_types.h
>>>
>>>  (svn_log_entry_t): Add a new member to flag log entries resulting from
>>>   reverse merges.  Note: No need to update svn_log_entry_dup() since the
>>>   new member is a boolean.
>>>
>>> * subversion/libsvn_ra_neon/log.c
>>>
>>>  (reset_log_item): Reset new svn_log_entry_t member.
>>>
>>>  (log_start_element): Parse "subtractive-merge" element.
>>>
>>> * subversion/libsvn_ra_neon/ra_neon.h
>>>
>>>  (global): Add 'ELEM_subtractive_merge' to the Neon element enums.
>>>
>>> * subversion/libsvn_ra_serf/log.c
>>>
>>>  (log_state_e): Add 'SUBTRACTIVE_MERGE' enum.
>>>
>>>  (start_log): Parse "subtractive-merge" element.
>>>
>>>  (end_log): Set new svn_log_entry_t member.
>>>
>>> * subversion/libsvn_ra_svn/client.c
>>>
>>>  (ra_svn_log): Parse "subtractive-merge" element.
>>>
>>> * subversion/libsvn_ra_svn/protocol:
>>>
>>>  Note changes to 'log-entry' protocol.
>>>
>>> * subversion/libsvn_repos/log.c
>>>
>>>  (get_combined_mergeinfo_changes): Return added and deleted mergeinfo
>>>   separately, rather than as a single mergeinfo.
>>>
>>>  (send_log): Add an argument to identify logs which are the result of a
>>>   reverse merged revision, use this to populate the new svn_log_entry_t
>>>   member.
>>>
>>>  (path_list_range): Add new member to identify revisions resulting from a
>>>   reverse merge.
>>>
>>>  (combine_mergeinfo_path_lists): Add new member to identify mergeinfo
>>>   resulting from a reverse merge.
>>>
>>>  (compare_path_list_range): New sort helper for handle_merged_revisions().
>>>
>>>  (handle_merged_revisions): Split MERGEINFO argument into two,
>>>   differentiating between added and deleted mergeinfo.  Update call to
>>>   do_logs().
>>>
>>>  (added_deleted_mergeinfo): New struct.
>>>
>>>  (do_logs): Add an argument to identify logs which are the result of a
>>>   reverse merge.  Track mergeinfo changes from forward and reverse merges
>>>   separately and pass this along to send_log and when we recurse.
>>>
>>>  (svn_repos_get_logs4): Update calls to send_log() and do_logs().
>>>
>>> * subversion/mod_dav_svn/reports/log.c
>>>
>>>  (log_receiver): Send the new 'subtractive-merge' element.
>>>
>>> * subversion/svn/log-cmd.c
>>>
>>>  (log_entry_receiver): Print new 'Reverse merged via' message for merged
>>>   revisions resulting from a reverse merge.
>>>
>>> * subversion/svnserve/serve.c
>>>
>>>  (log_receiver): Send the new 'subtractive-merge' element
>>>
>>> * subversion/tests/cmdline/log_tests.py
>>>
>>>  (merge_sensitive_log_added_mergeinfo_replaces_inherited): Tweak test
>>>   expecatations to account for new reverse merge log text.
>>>
>>>  (merge_sensitive_log_reverse_merges): Remove XFail decorator and comments
>>>   regarding failure status.
>>>
>>> Modified:
>>>    subversion/trunk/subversion/include/svn_types.h
>>>    subversion/trunk/subversion/libsvn_ra_neon/log.c
>>>    subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h
>>>    subversion/trunk/subversion/libsvn_ra_serf/log.c
>>>    subversion/trunk/subversion/libsvn_ra_svn/client.c
>>>    subversion/trunk/subversion/libsvn_ra_svn/protocol
>>>    subversion/trunk/subversion/libsvn_repos/log.c
>>>    subversion/trunk/subversion/mod_dav_svn/reports/log.c
>>>    subversion/trunk/subversion/svn/log-cmd.c
>>>    subversion/trunk/subversion/svnserve/serve.c
>>>    subversion/trunk/subversion/tests/cmdline/log_tests.py
>>>
>>> Modified: subversion/trunk/subversion/include/svn_types.h
>>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_types.h?rev=1079983&r1=1079982&r2=1079983&view=diff
>>> ==============================================================================
>>> --- subversion/trunk/subversion/include/svn_types.h (original)
>>> +++ subversion/trunk/subversion/include/svn_types.h Wed Mar  9 20:37:55 2011
>>> @@ -854,6 +854,13 @@ typedef struct svn_log_entry_t
>>>    */
>>>   svn_boolean_t non_inheritable;
>>>
>>> +  /**
>>> +   * Whether @a revision is a merged revision resulting from a reverse merge.
>>> +   *
>>> +   * @since New in 1.7.
>>> +   */
>>> +  svn_boolean_t subtractive_merge;
>>> +
>>>   /* NOTE: Add new fields at the end to preserve binary compatibility.
>>>      Also, if you add fields here, you have to update
>>>      svn_log_entry_dup(). */
>>>
>>> Modified: subversion/trunk/subversion/libsvn_ra_neon/log.c
>>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/log.c?rev=1079983&r1=1079982&r2=1079983&view=diff
>>> ==============================================================================
>>> --- subversion/trunk/subversion/libsvn_ra_neon/log.c (original)
>>> +++ subversion/trunk/subversion/libsvn_ra_neon/log.c Wed Mar  9 20:37:55 2011
>>> @@ -101,6 +101,7 @@ reset_log_item(struct log_baton *lb)
>>>   lb->log_entry->changed_paths  = NULL;
>>>   lb->log_entry->has_children   = FALSE;
>>>   lb->log_entry->changed_paths2 = NULL;
>>> +  lb->log_entry->subtractive_merge = FALSE;
>>>
>>>   svn_pool_clear(lb->subpool);
>>>  }
>>> @@ -137,6 +138,8 @@ log_start_element(int *elem, void *baton
>>>       { "DAV:", "comment", ELEM_comment, SVN_RA_NEON__XML_CDATA },
>>>       { SVN_XML_NAMESPACE, "has-children", ELEM_has_children,
>>>         SVN_RA_NEON__XML_CDATA },
>>> +      { SVN_XML_NAMESPACE, "subtractive-merge", ELEM_subtractive_merge,
>>> +        SVN_RA_NEON__XML_CDATA },
>>>       { NULL }
>>>     };
>>>   const svn_ra_neon__xml_elm_t *elm
>>> @@ -172,6 +175,9 @@ log_start_element(int *elem, void *baton
>>>     case ELEM_has_children:
>>>       lb->log_entry->has_children = TRUE;
>>>       break;
>>> +    case ELEM_subtractive_merge:
>>> +      lb->log_entry->subtractive_merge = TRUE;
>>> +      break;
>>>
>>>     default:
>>>       lb->want_cdata = NULL;
>>>
>>> Modified: subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h
>>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h?rev=1079983&r1=1079982&r2=1079983&view=diff
>>> ==============================================================================
>>> --- subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h (original)
>>> +++ subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h Wed Mar  9 20:37:55 2011
>>> @@ -862,7 +862,8 @@ enum {
>>>   ELEM_has_children,
>>>   ELEM_merged_revision,
>>>   ELEM_deleted_rev_report,
>>> -  ELEM_validate_inherited_mergeinfo
>>> +  ELEM_validate_inherited_mergeinfo,
>>> +  ELEM_subtractive_merge,
>>>  };
>>>
>>>  /* ### docco */
>>>
>>> Modified: subversion/trunk/subversion/libsvn_ra_serf/log.c
>>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/log.c?rev=1079983&r1=1079982&r2=1079983&view=diff
>>> ==============================================================================
>>> --- subversion/trunk/subversion/libsvn_ra_serf/log.c (original)
>>> +++ subversion/trunk/subversion/libsvn_ra_serf/log.c Wed Mar  9 20:37:55 2011
>>> @@ -63,6 +63,7 @@ typedef enum log_state_e {
>>>   REPLACED_PATH,
>>>   DELETED_PATH,
>>>   MODIFIED_PATH,
>>> +  SUBTRACTIVE_MERGE,
>>>  } log_state_e;
>>>
>>>  typedef struct log_info_t {
>>> @@ -231,6 +232,10 @@ start_log(svn_ra_serf__xml_parser_t *par
>>>         {
>>>           push_state(parser, log_ctx, HAS_CHILDREN);
>>>         }
>>> +      else if (strcmp(name.name, "subtractive-merge") == 0)
>>> +        {
>>> +          push_state(parser, log_ctx, SUBTRACTIVE_MERGE);
>>> +        }
>>>       else if (strcmp(name.name, "added-path") == 0)
>>>         {
>>>           const char *copy_path, *copy_rev_str;
>>> @@ -401,6 +406,12 @@ end_log(svn_ra_serf__xml_parser_t *parse
>>>       info->log_entry->has_children = TRUE;
>>>       svn_ra_serf__xml_pop_state(parser);
>>>     }
>>> +  else if (state == SUBTRACTIVE_MERGE &&
>>> +           strcmp(name.name, "subtractive-merge") == 0)
>>> +    {
>>> +      info->log_entry->subtractive_merge = TRUE;
>>> +      svn_ra_serf__xml_pop_state(parser);
>>> +    }
>>>   else if ((state == ADDED_PATH &&
>>>             strcmp(name.name, "added-path") == 0) ||
>>>            (state == DELETED_PATH &&
>>>
>>> Modified: subversion/trunk/subversion/libsvn_ra_svn/client.c
>>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/client.c?rev=1079983&r1=1079982&r2=1079983&view=diff
>>> ==============================================================================
>>> --- subversion/trunk/subversion/libsvn_ra_svn/client.c (original)
>>> +++ subversion/trunk/subversion/libsvn_ra_svn/client.c Wed Mar  9 20:37:55 2011
>>> @@ -1405,10 +1405,12 @@ static svn_error_t *ra_svn_log(svn_ra_se
>>>   while (1)
>>>     {
>>>       apr_uint64_t has_children_param, invalid_revnum_param;
>>> +      apr_uint64_t has_subtractive_merge_param;
>>>       svn_string_t *author, *date, *message;
>>>       apr_array_header_t *cplist, *rplist;
>>>       svn_log_entry_t *log_entry;
>>>       svn_boolean_t has_children;
>>> +      svn_boolean_t subtractive_merge = FALSE;
>>>       apr_uint64_t revprop_count;
>>>       svn_ra_svn_item_t *item;
>>>       apr_hash_t *cphash;
>>> @@ -1423,11 +1425,12 @@ static svn_error_t *ra_svn_log(svn_ra_se
>>>         return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
>>>                                 _("Log entry not a list"));
>>>       SVN_ERR(svn_ra_svn_parse_tuple(item->u.list, iterpool,
>>> -                                     "lr(?s)(?s)(?s)?BBnl",
>>> +                                     "lr(?s)(?s)(?s)?BBnl?B",
>>>                                      &cplist, &rev, &author, &date,
>>>                                      &message, &has_children_param,
>>>                                      &invalid_revnum_param,
>>> -                                     &revprop_count, &rplist));
>>> +                                     &revprop_count, &rplist,
>>> +                                     &has_subtractive_merge_param));
>>>       if (want_custom_revprops && rplist == NULL)
>>>         {
>>>           /* Caller asked for custom revprops, but server is too old. */
>>> @@ -1441,6 +1444,11 @@ static svn_error_t *ra_svn_log(svn_ra_se
>>>       else
>>>         has_children = (svn_boolean_t) has_children_param;
>>>
>>> +      if (has_subtractive_merge_param == SVN_RA_SVN_UNSPECIFIED_NUMBER)
>>> +        subtractive_merge = FALSE;
>>> +      else
>>> +        subtractive_merge = (svn_boolean_t) has_subtractive_merge_param;
>>> +
>>>       /* Because the svn protocol won't let us send an invalid revnum, we have
>>>          to recover that fact using the extra parameter. */
>>>       if (invalid_revnum_param != SVN_RA_SVN_UNSPECIFIED_NUMBER
>>> @@ -1493,6 +1501,7 @@ static svn_error_t *ra_svn_log(svn_ra_se
>>>           log_entry->changed_paths2 = cphash;
>>>           log_entry->revision = rev;
>>>           log_entry->has_children = has_children;
>>> +          log_entry->subtractive_merge = subtractive_merge;
>>>           if (rplist)
>>>             SVN_ERR(svn_ra_svn_parse_proplist(rplist, pool,
>>>                                               &log_entry->revprops));
>>>
>>> Modified: subversion/trunk/subversion/libsvn_ra_svn/protocol
>>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/protocol?rev=1079983&r1=1079982&r2=1079983&view=diff
>>> ==============================================================================
>>> --- subversion/trunk/subversion/libsvn_ra_svn/protocol (original)
>>> +++ subversion/trunk/subversion/libsvn_ra_svn/protocol Wed Mar  9 20:37:55 2011
>>> @@ -378,7 +378,8 @@ second place for auth-request point as n
>>>     log-entry: ( ( change:changed-path-entry ... ) rev:number
>>>                  [ author:string ] [ date:string ] [ message:string ]
>>>                  ? has-children:bool invalid-revnum:bool
>>> -                 revprop-count:number rev-props:proplist )
>>> +                 revprop-count:number rev-props:proplist
>>> +                 ? subtractive-merge:bool )
>>>              | done
>>>     changed-path-entry: ( path:string A|D|R|M
>>>                           ? ( ? copy-path:string copy-rev:number )
>>>
>>> Modified: subversion/trunk/subversion/libsvn_repos/log.c
>>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/log.c?rev=1079983&r1=1079982&r2=1079983&view=diff
>>> ==============================================================================
>>> --- subversion/trunk/subversion/libsvn_repos/log.c (original)
>>> +++ subversion/trunk/subversion/libsvn_repos/log.c Wed Mar  9 20:37:55 2011
>>> @@ -731,10 +731,12 @@ fs_mergeinfo_changed(svn_mergeinfo_catal
>>>
>>>
>>>  /* Determine what (if any) mergeinfo for PATHS was modified in
>>> -   revision REV, returning the diffs as a single combined rangelist in
>>> -   *COMBINED_MERGEINFO.  Use POOL for all allocations. */
>>> +   revision REV, returning the differences for added mergeinfo in
>>> +   *ADDED_MERGEINFO and deleted mergeinfo in *DELETED_MERGEINFO.
>>> +   Use POOL for all allocations. */
>>>  static svn_error_t *
>>> -get_combined_mergeinfo_changes(svn_mergeinfo_t *combined_mergeinfo,
>>> +get_combined_mergeinfo_changes(svn_mergeinfo_t *added_mergeinfo,
>>> +                               svn_mergeinfo_t *deleted_mergeinfo,
>>>                                svn_fs_t *fs,
>>>                                const apr_array_header_t *paths,
>>>                                svn_revnum_t rev,
>>> @@ -747,7 +749,8 @@ get_combined_mergeinfo_changes(svn_merge
>>>   int i;
>>>
>>>   /* Initialize return value. */
>>> -  *combined_mergeinfo = apr_hash_make(pool);
>>> +  *added_mergeinfo = apr_hash_make(pool);
>>> +  *deleted_mergeinfo = apr_hash_make(pool);
>>>
>>>   /* If we're asking about revision 0, there's no mergeinfo to be found. */
>>>   if (rev == 0)
>>> @@ -839,12 +842,9 @@ get_combined_mergeinfo_changes(svn_merge
>>>       /* Compare, constrast, and combine the results. */
>>>       SVN_ERR(svn_mergeinfo_diff(&deleted, &added, prev_mergeinfo,
>>>                                  mergeinfo, FALSE, iterpool));
>>> -      mergeinfo = deleted;
>>> -      SVN_ERR(svn_mergeinfo_merge(mergeinfo, added, iterpool));
>>> -      SVN_ERR(svn_mergeinfo_merge(*combined_mergeinfo,
>>> -                                  svn_mergeinfo_dup(mergeinfo, pool),
>>> -                                  pool));
>>> -    }
>>> +      SVN_ERR(svn_mergeinfo_merge(*deleted_mergeinfo, deleted, pool));
>>> +      SVN_ERR(svn_mergeinfo_merge(*added_mergeinfo, added, pool));
>>> +     }
>>>   svn_pool_destroy(iterpool);
>>>
>>>   /* Merge all the mergeinfos which are, or are children of, one of
>>> @@ -856,28 +856,22 @@ get_combined_mergeinfo_changes(svn_merge
>>>       apr_ssize_t klen;
>>>       void *val;
>>>       const char *changed_path;
>>> -      svn_mergeinfo_t added_mergeinfo, deleted_mergeinfo;
>>> +      svn_mergeinfo_t added, deleted;
>>>
>>>       /* The path is the key, the mergeinfo delta is the value. */
>>>       apr_hash_this(hi, &key, &klen, &val);
>>>       changed_path = key;
>>> -      added_mergeinfo = val;
>>> +      added = val;
>>>
>>>       for (i = 0; i < paths->nelts; i++)
>>>         {
>>>           const char *path = APR_ARRAY_IDX(paths, i, const char *);
>>>           if (! svn_dirent_is_ancestor(path, changed_path))
>>>             continue;
>>> -          deleted_mergeinfo =
>>> -            apr_hash_get(deleted_mergeinfo_catalog, key, klen);
>>> -          SVN_ERR(svn_mergeinfo_merge(*combined_mergeinfo,
>>> -                                      svn_mergeinfo_dup(deleted_mergeinfo,
>>> -                                                        pool),
>>> -                                      pool));
>>> -          SVN_ERR(svn_mergeinfo_merge(*combined_mergeinfo,
>>> -                                      svn_mergeinfo_dup(added_mergeinfo,
>>> -                                                        pool),
>>> -                                      pool));
>>> +          deleted = apr_hash_get(deleted_mergeinfo_catalog, key, klen);
>>> +          SVN_ERR(svn_mergeinfo_merge(*deleted_mergeinfo, deleted, pool));
>>> +          SVN_ERR(svn_mergeinfo_merge(*added_mergeinfo, added, pool));
>>> +
>>>           break;
>>>         }
>>>     }
>>> @@ -1010,12 +1004,14 @@ fill_log_entry(svn_log_entry_t *log_entr
>>>    per the arguments of the same name to DO_LOGS.  If
>>>    HANDLING_MERGED_REVISIONS is true and *all* changed paths within REV are
>>>    already represented in LOG_TARGET_HISTORY_AS_MERGEINFO, then don't send
>>> -   the log message for REV. */
>>> +   the log message for REV.  If SUBTRACTIVE_MERGE is true, then REV was
>>> +   reverse merged */
>>>  static svn_error_t *
>>>  send_log(svn_revnum_t rev,
>>>          svn_fs_t *fs,
>>>          svn_mergeinfo_t log_target_history_as_mergeinfo,
>>>          svn_boolean_t discover_changed_paths,
>>> +         svn_boolean_t subtractive_merge,
>>>          svn_boolean_t handling_merged_revision,
>>>          const apr_array_header_t *revprops,
>>>          svn_boolean_t has_children,
>>> @@ -1035,6 +1031,7 @@ send_log(svn_revnum_t rev,
>>>                          revprops, authz_read_func, authz_read_baton,
>>>                          pool));
>>>   log_entry->has_children = has_children;
>>> +  log_entry->subtractive_merge = subtractive_merge;
>>>
>>>   /* Is REV a merged revision that is already part of
>>>      LOG_TARGET_HISTORY_AS_MERGEINFO?  If so then there is no
>>> @@ -1247,6 +1244,9 @@ struct path_list_range
>>>  {
>>>   apr_array_header_t *paths;
>>>   svn_merge_range_t range;
>>> +
>>> +  /* Is RANGE the result of a reverse merge? */
>>> +  svn_boolean_t reverse_merge;
>>>  };
>>>
>>>  /* A struct which represents "inverse mergeinfo", that is, instead of having
>>> @@ -1292,10 +1292,13 @@ compare_rangelist_paths(const void *a, c
>>>
>>>  /* From MERGEINFO, return in *COMBINED_LIST, allocated in POOL, a list of
>>>    'struct path_list_range's.  This list represents the rangelists in
>>> -   MERGEINFO and each path which has mergeinfo in that range.  */
>>> +   MERGEINFO and each path which has mergeinfo in that range.
>>> +   If REVERSE_MERGE is true, then MERGEINFO represents mergeinfo removed
>>> +   as the result of a reverse merge. */
>>>  static svn_error_t *
>>>  combine_mergeinfo_path_lists(apr_array_header_t **combined_list,
>>>                              svn_mergeinfo_t mergeinfo,
>>> +                             svn_boolean_t reverse_merge,
>>>                              apr_pool_t *pool)
>>>  {
>>>   apr_hash_index_t *hi;
>>> @@ -1326,7 +1329,9 @@ combine_mergeinfo_path_lists(apr_array_h
>>>   /* Loop over the (revision range, path) tuples, chopping them into
>>>      (revision range, paths) tuples, and appending those to the output
>>>      list. */
>>> -  *combined_list = apr_array_make(pool, 0, sizeof(struct path_list_range *));
>>> +  if (! *combined_list)
>>> +    *combined_list = apr_array_make(pool, 0, sizeof(struct path_list_range *));
>>> +
>>>   while (rangelist_paths->nelts > 1)
>>>     {
>>>       svn_revnum_t youngest, next_youngest, tail, youngest_end;
>>> @@ -1375,6 +1380,7 @@ combine_mergeinfo_path_lists(apr_array_h
>>>       /* Insert the (earliest, tail) tuple into the output list, along with
>>>          a list of paths which match it. */
>>>       plr = apr_palloc(pool, sizeof(*plr));
>>> +      plr->reverse_merge = reverse_merge;
>>>       plr->range.start = youngest;
>>>       plr->range.end = tail;
>>>       plr->paths = apr_array_make(pool, num_revs, sizeof(const char *));
>>> @@ -1426,6 +1432,7 @@ combine_mergeinfo_path_lists(apr_array_h
>>>         {
>>>           struct path_list_range *plr = apr_palloc(pool, sizeof(*plr));
>>>
>>> +          plr->reverse_merge = reverse_merge;
>>>           plr->paths = apr_array_make(pool, 1, sizeof(const char *));
>>>           APR_ARRAY_PUSH(plr->paths, const char *) = first_rp->path;
>>>           plr->range = *APR_ARRAY_IDX(first_rp->rangelist, 0,
>>> @@ -1453,6 +1460,7 @@ do_logs(svn_fs_t *fs,
>>>         svn_boolean_t strict_node_history,
>>>         svn_boolean_t include_merged_revisions,
>>>         svn_boolean_t handling_merged_revisions,
>>> +        svn_boolean_t subtractive_merge,
>>>         svn_boolean_t ignore_missing_locations,
>>>         const apr_array_header_t *revprops,
>>>         svn_boolean_t descending_order,
>>> @@ -1462,14 +1470,34 @@ do_logs(svn_fs_t *fs,
>>>         void *authz_read_baton,
>>>         apr_pool_t *pool);
>>>
>>> +/* Comparator function for handle_merged_revisions().  Sorts path_list_range
>>> +   structs in increasing order based on the struct's RANGE.START revision,
>>> +   then RANGE.END revision. */
>>> +static int
>>> +compare_path_list_range(const void *a, const void *b)
>>> +{
>>> +  struct path_list_range *plr_a = *((struct path_list_range *const *) a);
>>> +  struct path_list_range *plr_b = *((struct path_list_range *const *) b);
>>> +
>>> +  if (plr_a->range.start < plr_b->range.start)
>>> +    return -1;
>>> +  if (plr_a->range.start > plr_b->range.start)
>>> +    return 1;
>>> +  if (plr_a->range.end < plr_b->range.end)
>>> +    return -1;
>>> +  if (plr_a->range.end > plr_b->range.end)
>>> +    return 1;
>>> +
>>> +  return 0;
>>> +}
>>>
>>> -/* Examine the combined mergeinfo for revision REV in FS (as collected
>>> -   by examining paths of interest to a log operation), and determine
>>> -   which revisions to report as having been merged via the commit
>>> -   resulting in REV.
>>> +/* Examine the ADDED_MERGEINFO and DELETED_MERGEINFO for revision REV in FS
>>> +   (as collected by examining paths of interest to a log operation), and
>>> +   determine which revisions to report as having been merged or reverse-merged
>>> +   via the commit resulting in REV.
>>>
>>>    Silently ignore some failures to find the revisions mentioned in the
>>> -   mergeinfo, as might happen if there is invalid mergeinfo.
>>> +   added/deleted mergeinfos, as might happen if there is invalid mergeinfo.
>>>
>>>    Other parameters are as described by do_logs(), around which this
>>>    is a recursion wrapper. */
>>> @@ -1477,7 +1505,8 @@ static svn_error_t *
>>>  handle_merged_revisions(svn_revnum_t rev,
>>>                         svn_fs_t *fs,
>>>                         svn_mergeinfo_t log_target_history_as_mergeinfo,
>>> -                        svn_mergeinfo_t mergeinfo,
>>> +                        svn_mergeinfo_t added_mergeinfo,
>>> +                        svn_mergeinfo_t deleted_mergeinfo,
>>>                         svn_boolean_t discover_changed_paths,
>>>                         svn_boolean_t strict_node_history,
>>>                         const apr_array_header_t *revprops,
>>> @@ -1487,15 +1516,25 @@ handle_merged_revisions(svn_revnum_t rev
>>>                         void *authz_read_baton,
>>>                         apr_pool_t *pool)
>>>  {
>>> -  apr_array_header_t *combined_list;
>>> +  apr_array_header_t *combined_list = NULL;
>>>   svn_log_entry_t *empty_log_entry;
>>>   apr_pool_t *iterpool;
>>>   int i;
>>>
>>> -  if (apr_hash_count(mergeinfo) == 0)
>>> +  if (apr_hash_count(added_mergeinfo) == 0
>>> +      && apr_hash_count(deleted_mergeinfo) == 0)
>>>     return SVN_NO_ERROR;
>>>
>>> -  SVN_ERR(combine_mergeinfo_path_lists(&combined_list, mergeinfo, pool));
>>> +  if (apr_hash_count(added_mergeinfo))
>>> +    SVN_ERR(combine_mergeinfo_path_lists(&combined_list, added_mergeinfo,
>>> +                                          FALSE, pool));
>>> +
>>> +  if (apr_hash_count(deleted_mergeinfo))
>>> +    SVN_ERR(combine_mergeinfo_path_lists(&combined_list, deleted_mergeinfo,
>>> +                                          TRUE, pool));
>>> +
>>> +  qsort(combined_list->elts, combined_list->nelts,
>>> +        combined_list->elt_size, compare_path_list_range);
>>>
>>>   /* Because the combined_lists are ordered youngest to oldest,
>>>      iterate over them in reverse. */
>>> @@ -1509,9 +1548,9 @@ handle_merged_revisions(svn_revnum_t rev
>>>       SVN_ERR(do_logs(fs, pl_range->paths, log_target_history_as_mergeinfo,
>>>                       pl_range->range.start, pl_range->range.end, 0,
>>>                       discover_changed_paths, strict_node_history,
>>> -                      TRUE, TRUE, TRUE, revprops, TRUE,
>>> -                      receiver, receiver_baton, authz_read_func,
>>> -                      authz_read_baton, iterpool));
>>> +                      TRUE, pl_range->reverse_merge, TRUE, TRUE,
>>> +                      revprops, TRUE, receiver, receiver_baton,
>>> +                      authz_read_func, authz_read_baton, iterpool));
>>>     }
>>>   svn_pool_destroy(iterpool);
>>>
>>> @@ -1521,6 +1560,14 @@ handle_merged_revisions(svn_revnum_t rev
>>>   return (*receiver)(receiver_baton, empty_log_entry, pool);
>>>  }
>>>
>>> +/* This is used by do_logs to differentiate between forward and
>>> +   reverse merges. */
>>> +struct added_deleted_mergeinfo
>>> +{
>>> +  svn_mergeinfo_t added_mergeinfo;
>>> +  svn_mergeinfo_t deleted_mergeinfo;
>>> +};
>>> +
>>>  /* Find logs for PATHS from HIST_START to HIST_END in FS, and invoke
>>>    RECEIVER with RECEIVER_BATON on them.  If DESCENDING_ORDER is TRUE, send
>>>    the logs back as we find them, else buffer the logs and send them back
>>> @@ -1534,7 +1581,8 @@ handle_merged_revisions(svn_revnum_t rev
>>>
>>>    If HANDLING_MERGED_REVISIONS is TRUE then this is a recursive call for
>>>    merged revisions, see INCLUDE_MERGED_REVISIONS argument to
>>> -   svn_repos_get_logs4().
>>> +   svn_repos_get_logs4().  If SUBTRACTIVE_MERGE is true, then this is a
>>> +   recursive call for reverse merged revisions.
>>>
>>>    Other parameters are the same as svn_repos_get_logs4().
>>>  */
>>> @@ -1548,6 +1596,7 @@ do_logs(svn_fs_t *fs,
>>>         svn_boolean_t discover_changed_paths,
>>>         svn_boolean_t strict_node_history,
>>>         svn_boolean_t include_merged_revisions,
>>> +        svn_boolean_t subtractive_merge,
>>>         svn_boolean_t handling_merged_revisions,
>>>         svn_boolean_t ignore_missing_locations,
>>>         const apr_array_header_t *revprops,
>>> @@ -1603,7 +1652,8 @@ do_logs(svn_fs_t *fs,
>>>       /* If any of the paths changed in this rev then add or send it. */
>>>       if (changed)
>>>         {
>>> -          svn_mergeinfo_t mergeinfo = NULL;
>>> +          svn_mergeinfo_t added_mergeinfo = NULL;
>>> +          svn_mergeinfo_t deleted_mergeinfo = NULL;
>>>           svn_boolean_t has_children = FALSE;
>>>
>>>           /* If we're including merged revisions, we need to calculate
>>> @@ -1623,9 +1673,12 @@ do_logs(svn_fs_t *fs,
>>>                                                          struct path_info *);
>>>                   APR_ARRAY_PUSH(cur_paths, const char *) = info->path->data;
>>>                 }
>>> -              SVN_ERR(get_combined_mergeinfo_changes(&mergeinfo, fs, cur_paths,
>>> +              SVN_ERR(get_combined_mergeinfo_changes(&added_mergeinfo,
>>> +                                                     &deleted_mergeinfo,
>>> +                                                     fs, cur_paths,
>>>                                                      current, iterpool));
>>> -              has_children = (apr_hash_count(mergeinfo) > 0);
>>> +              has_children = (apr_hash_count(added_mergeinfo) > 0
>>> +                              || apr_hash_count(deleted_mergeinfo) > 0);
>>>             }
>>>
>>>           /* If our caller wants logs in descending order, we can send
>>> @@ -1636,15 +1689,16 @@ do_logs(svn_fs_t *fs,
>>>               SVN_ERR(send_log(current, fs,
>>>                                log_target_history_as_mergeinfo,
>>>                                discover_changed_paths,
>>> -                               handling_merged_revisions, revprops,
>>> -                               has_children, receiver, receiver_baton,
>>> +                               subtractive_merge, handling_merged_revisions,
>>> +                               revprops, has_children,
>>> +                               receiver, receiver_baton,
>>>                                authz_read_func, authz_read_baton, iterpool));
>>>               if (has_children)
>>>                 {
>>>                   SVN_ERR(handle_merged_revisions(
>>>                     current, fs,
>>>                     log_target_history_as_mergeinfo,
>>> -                    mergeinfo,
>>> +                    added_mergeinfo, deleted_mergeinfo,
>>>                     discover_changed_paths,
>>>                     strict_node_history,
>>>                     revprops,
>>> @@ -1666,14 +1720,25 @@ do_logs(svn_fs_t *fs,
>>>                 revs = apr_array_make(pool, 64, sizeof(svn_revnum_t));
>>>               APR_ARRAY_PUSH(revs, svn_revnum_t) = current;
>>>
>>> -              if (mergeinfo)
>>> +              if (added_mergeinfo || deleted_mergeinfo)
>>>                 {
>>> -                  svn_revnum_t *cur_rev = apr_palloc(pool, sizeof(*cur_rev));
>>> +                  svn_revnum_t *cur_rev = apr_pcalloc(pool, sizeof(*cur_rev));
>>> +                  struct added_deleted_mergeinfo *add_and_del_mergeinfo =
>>> +                    apr_palloc(pool, sizeof(*add_and_del_mergeinfo));
>>> +
>>> +                  if (added_mergeinfo)
>>> +                    add_and_del_mergeinfo->added_mergeinfo =
>>> +                      svn_mergeinfo_dup(added_mergeinfo, pool);
>>> +
>>> +                  if (deleted_mergeinfo)
>>> +                    add_and_del_mergeinfo->deleted_mergeinfo =
>>> +                      svn_mergeinfo_dup(deleted_mergeinfo, pool);
>>> +
>>>                   *cur_rev = current;
>>>                   if (! rev_mergeinfo)
>>>                     rev_mergeinfo = apr_hash_make(pool);
>>>                   apr_hash_set(rev_mergeinfo, cur_rev, sizeof(*cur_rev),
>>> -                               svn_mergeinfo_dup(mergeinfo, pool));
>>> +                               add_and_del_mergeinfo);
>>>                 }
>>>             }
>>>         }
>>> @@ -1687,7 +1752,8 @@ do_logs(svn_fs_t *fs,
>>>       iterpool = svn_pool_create(pool);
>>>       for (i = 0; i < revs->nelts; ++i)
>>>         {
>>> -          svn_mergeinfo_t mergeinfo;
>>> +          svn_mergeinfo_t added_mergeinfo;
>>> +          svn_mergeinfo_t deleted_mergeinfo;
>>>           svn_boolean_t has_children = FALSE;
>>>
>>>           svn_pool_clear(iterpool);
>>> @@ -1699,21 +1765,25 @@ do_logs(svn_fs_t *fs,
>>>              revisions we need to handle recursively. */
>>>           if (rev_mergeinfo)
>>>             {
>>> -              mergeinfo = apr_hash_get(rev_mergeinfo, &current,
>>> -                                       sizeof(svn_revnum_t));
>>> -              has_children = (apr_hash_count(mergeinfo) > 0);
>>> +              struct added_deleted_mergeinfo *add_and_del_mergeinfo =
>>> +                apr_hash_get(rev_mergeinfo, &current, sizeof(svn_revnum_t));
>>> +              added_mergeinfo = add_and_del_mergeinfo->added_mergeinfo;
>>> +              deleted_mergeinfo = add_and_del_mergeinfo->deleted_mergeinfo;
>>> +              has_children = (apr_hash_count(added_mergeinfo) > 0
>>> +                              || apr_hash_count(deleted_mergeinfo) > 0);
>>>             }
>>>
>>>           SVN_ERR(send_log(current, fs, log_target_history_as_mergeinfo,
>>> -                           discover_changed_paths, handling_merged_revisions,
>>> -                           revprops, has_children,
>>> +                           discover_changed_paths, subtractive_merge,
>>> +                           handling_merged_revisions, revprops, has_children,
>>>                            receiver, receiver_baton, authz_read_func,
>>>                            authz_read_baton, iterpool));
>>>           if (has_children)
>>>             {
>>>               SVN_ERR(handle_merged_revisions(current, fs,
>>>                                               log_target_history_as_mergeinfo,
>>> -                                              mergeinfo,
>>> +                                              added_mergeinfo,
>>> +                                              deleted_mergeinfo,
>>>                                               discover_changed_paths,
>>>                                               strict_node_history, revprops,
>>>                                               receiver, receiver_baton,
>>> @@ -1896,8 +1966,8 @@ svn_repos_get_logs4(svn_repos_t *repos,
>>>           if (descending_order)
>>>             rev = end - i;
>>>           SVN_ERR(send_log(rev, fs, NULL, discover_changed_paths, FALSE,
>>> -                           revprops, FALSE,
>>> -                           receiver, receiver_baton, authz_read_func,
>>> +                           FALSE, revprops, FALSE, receiver,
>>> +                           receiver_baton, authz_read_func,
>>>                            authz_read_baton, iterpool));
>>>         }
>>>       svn_pool_destroy(iterpool);
>>> @@ -1924,7 +1994,7 @@ svn_repos_get_logs4(svn_repos_t *repos,
>>>
>>>   return do_logs(repos->fs, paths, paths_history_mergeinfo, start, end,
>>>                  limit, discover_changed_paths, strict_node_history,
>>> -                 include_merged_revisions, FALSE, FALSE, revprops,
>>> +                 include_merged_revisions, FALSE, FALSE, FALSE, revprops,
>>>                  descending_order, receiver, receiver_baton,
>>>                  authz_read_func, authz_read_baton, pool);
>>>  }
>>>
>>> Modified: subversion/trunk/subversion/mod_dav_svn/reports/log.c
>>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/log.c?rev=1079983&r1=1079982&r2=1079983&view=diff
>>> ==============================================================================
>>> --- subversion/trunk/subversion/mod_dav_svn/reports/log.c (original)
>>> +++ subversion/trunk/subversion/mod_dav_svn/reports/log.c Wed Mar  9 20:37:55 2011
>>> @@ -158,6 +158,10 @@ log_receiver(void *baton,
>>>       lrb->stack_depth++;
>>>     }
>>>
>>> +  if (log_entry->subtractive_merge)
>>> +    SVN_ERR(dav_svn__brigade_puts(lrb->bb, lrb->output,
>>> +                                  "<S:subtractive-merge/>"));
>>> +
>>>   if (log_entry->changed_paths2)
>>>     {
>>>       apr_hash_index_t *hi;
>>>
>>> Modified: subversion/trunk/subversion/svn/log-cmd.c
>>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/log-cmd.c?rev=1079983&r1=1079982&r2=1079983&view=diff
>>> ==============================================================================
>>> --- subversion/trunk/subversion/svn/log-cmd.c (original)
>>> +++ subversion/trunk/subversion/svn/log-cmd.c Wed Mar  9 20:37:55 2011
>>> @@ -248,7 +248,10 @@ log_entry_receiver(void *baton,
>>>       int i;
>>>
>>>       /* Print the result of merge line */
>>> -      SVN_ERR(svn_cmdline_printf(pool, _("Merged via:")));
>>> +      if (log_entry->subtractive_merge)
>>> +        SVN_ERR(svn_cmdline_printf(pool, _("Reverse merged via:")));
>>> +      else
>>> +        SVN_ERR(svn_cmdline_printf(pool, _("Merged via:")));
>>>       for (i = 0; i < lb->merge_stack->nelts; i++)
>>>         {
>>>           svn_revnum_t rev = APR_ARRAY_IDX(lb->merge_stack, i, svn_revnum_t);
>>>
>>> Modified: subversion/trunk/subversion/svnserve/serve.c
>>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnserve/serve.c?rev=1079983&r1=1079982&r2=1079983&view=diff
>>> ==============================================================================
>>> --- subversion/trunk/subversion/svnserve/serve.c (original)
>>> +++ subversion/trunk/subversion/svnserve/serve.c Wed Mar  9 20:37:55 2011
>>> @@ -1970,7 +1970,8 @@ static svn_error_t *log_receiver(void *b
>>>                                  log_entry->has_children,
>>>                                  invalid_revnum, revprop_count));
>>>   SVN_ERR(svn_ra_svn_write_proplist(conn, pool, log_entry->revprops));
>>> -  SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!)"));
>>> +  SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!)b",
>>> +                                 log_entry->subtractive_merge));
>>>
>>>   if (log_entry->has_children)
>>>     b->stack_depth++;
>>>
>>> Modified: subversion/trunk/subversion/tests/cmdline/log_tests.py
>>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/log_tests.py?rev=1079983&r1=1079982&r2=1079983&view=diff
>>> ==============================================================================
>>> --- subversion/trunk/subversion/tests/cmdline/log_tests.py (original)
>>> +++ subversion/trunk/subversion/tests/cmdline/log_tests.py Wed Mar  9 20:37:55 2011
>>> @@ -1686,7 +1686,8 @@ def merge_sensitive_log_added_mergeinfo_
>>>
>>>   def run_log_g_r8(log_target):
>>>     expected_merges = {
>>> -      8 : [],
>>> +      8 : []}
>>> +    expected_reverse_merges = {
>>>       3 : [8]}
>>>     exit_code, output, err = svntest.actions.run_and_verify_svn(None, None,
>>>                                                                 [],
>>> @@ -1694,7 +1695,7 @@ def merge_sensitive_log_added_mergeinfo_
>>>                                                                 '-r8',
>>>                                                                 log_target)
>>>     log_chain = parse_log_output(output)
>>> -    check_merge_results(log_chain, expected_merges)
>>> +    check_merge_results(log_chain, expected_merges, expected_reverse_merges)
>>>
>>>   run_log_g_r8(wc_dir)
>>>   run_log_g_r8(os.path.join(wc_dir, "A_COPY"))
>>> @@ -1814,7 +1815,6 @@ def log_of_local_copy(sbox):
>>>
>>>  @SkipUnless(server_has_mergeinfo)
>>>  @Issue(3176)
>>> -_at_XFail()
>>>  def merge_sensitive_log_reverse_merges(sbox):
>>>   "log -g differentiates forward and reverse merges"
>>>
>>> @@ -1845,8 +1845,6 @@ def merge_sensitive_log_reverse_merges(s
>>>   exit_code, out, err = svntest.actions.run_and_verify_svn(None, None, [],
>>>                                                            'log', '-g', '-r8',
>>>                                                            A_COPY_path)
>>> -  # This test currently fails because reverse merges are not differentiated
>>> -  # from forward merges.
>>>   log_chain = parse_log_output(out)
>>>   expected_merges = {
>>>     8 : [],
>>>
>>>
>>>
>>
>
Received on 2011-03-10 00:03:11 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.