You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2012/06/27 21:32:16 UTC

svn commit: r1354683 - in /subversion/trunk/subversion: svn/log-cmd.c tests/cmdline/log_tests.py

Author: stsp
Date: Wed Jun 27 19:32:15 2012
New Revision: 1354683

URL: http://svn.apache.org/viewvc?rev=1354683&view=rev
Log:
Make the new 'svn log' --search option coexist peacefully with the -g option.
The new log --search code broke accounting of the merge stack used to determine
merged revisions during log -g.

* subversion/svn/log-cmd.c
  (log_entry_receiver, log_entry_receiver_xml): Push revisions which don't
   match the search pattern but have children onto the merge stack before
   returning early.

* subversion/tests/cmdline/log_tests.py
  (merge_sensitive_log_with_search, test_list): New test which fails without
   the above fix.

Modified:
    subversion/trunk/subversion/svn/log-cmd.c
    subversion/trunk/subversion/tests/cmdline/log_tests.py

Modified: subversion/trunk/subversion/svn/log-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/log-cmd.c?rev=1354683&r1=1354682&r2=1354683&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/log-cmd.c (original)
+++ subversion/trunk/subversion/svn/log-cmd.c Wed Jun 27 19:32:15 2012
@@ -303,11 +303,14 @@ log_entry_receiver(void *baton,
   if (! lb->omit_log_message && message == NULL)
     message = "";
 
-  if (lb->search_pattern)
+  if (lb->search_pattern &&
+      ! match_search_pattern(lb->search_pattern, author, message,
+                             log_entry->changed_paths2, pool))
     {
-      if (! match_search_pattern(lb->search_pattern, author, message,
-                                 log_entry->changed_paths2, pool))
-        return SVN_NO_ERROR;
+      if (log_entry->has_children)
+        APR_ARRAY_PUSH(lb->merge_stack, svn_revnum_t) = log_entry->revision;
+
+      return SVN_NO_ERROR;
     }
 
   SVN_ERR(svn_cmdline_printf(pool,
@@ -483,12 +486,15 @@ log_entry_receiver_xml(void *baton,
       return SVN_NO_ERROR;
     }
 
-  if (lb->search_pattern)
+  /* Match search pattern before XML-escaping. */
+  if (lb->search_pattern &&
+      ! match_search_pattern(lb->search_pattern, author, message,
+                             log_entry->changed_paths2, pool))
     {
-      /* Match search pattern before XML-escaping. */
-      if (! match_search_pattern(lb->search_pattern, author, message,
-                                 log_entry->changed_paths2, pool))
-        return SVN_NO_ERROR;
+      if (log_entry->has_children)
+        APR_ARRAY_PUSH(lb->merge_stack, svn_revnum_t) = log_entry->revision;
+
+      return SVN_NO_ERROR;
     }
 
   if (author)

Modified: subversion/trunk/subversion/tests/cmdline/log_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/log_tests.py?rev=1354683&r1=1354682&r2=1354683&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/log_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/log_tests.py Wed Jun 27 19:32:15 2012
@@ -2296,6 +2296,31 @@ def log_search(sbox):
   log_chain = parse_log_output(output)
   check_log_chain(log_chain, [7, 6, 3])
 
+@SkipUnless(server_has_mergeinfo)
+def merge_sensitive_log_with_search(sbox):
+  "test 'svn log -g --search'"
+
+  merge_history_repos(sbox)
+
+  TRUNK_path = os.path.join(sbox.wc_dir, "trunk")
+
+  # Run log -g on a non-copying revision that adds mergeinfo,
+  # and perform a search that only matches the merged revision
+  exit_code, output, err = svntest.actions.run_and_verify_svn(None, None, [],
+                                                              'log', '-g',
+                                                              '-r6',
+                                                              '--search',
+                                                              'upsilon',
+                                                              TRUNK_path)
+
+  # Parse and check output. The only revision should be r4 (the merge rev).
+  log_chain = parse_log_output(output)
+  expected_merges = {
+    4 : [6],
+  }
+  check_merge_results(log_chain, expected_merges)
+
+
 ########################################################################
 # Run the tests
 
@@ -2340,6 +2365,7 @@ test_list = [ None,
               log_xml_old,
               log_diff_moved,
               log_search,
+              merge_sensitive_log_with_search,
              ]
 
 if __name__ == '__main__':