Index: subversion/libsvn_client/merge.c
===================================================================
--- subversion/libsvn_client/merge.c	(revision 27367)
+++ subversion/libsvn_client/merge.c	(working copy)
@@ -1432,6 +1432,7 @@
 {
   apr_size_t nbr_skips = (notify_b->skipped_paths != NULL ?
                           apr_hash_count(notify_b->skipped_paths) : 0);
+  apr_hash_t *skipped_parents = apr_hash_make(pool);
   *merges = apr_hash_make(pool);
 
   /* If there have been no operative merges on any subtree merged so far and
@@ -1462,19 +1463,127 @@
            hi = apr_hash_next(hi))
         {
           const void *skipped_path;
+          const void *parent_path;
+          const svn_wc_entry_t *parent_dir_entry = NULL;
           apr_hash_this(hi, &skipped_path, NULL, NULL);
 
           /* Add an empty range list for this path. */
           apr_hash_set(*merges, (const char *) skipped_path,
                        APR_HASH_KEY_STRING,
                        apr_array_make(pool, 0, sizeof(svn_merge_range_t *)));
+          parent_path = svn_path_dirname((const char *) skipped_path, pool);
 
-          if (nbr_skips < notify_b->nbr_notifications)
-            /* ### Use RANGELIST as the mergeinfo for all children of
-               ### this path which were not also explicitly
-               ### skipped? */
-            ;
+          /* Find the exact parent dir path, in which mergeinfo must be set
+             for this skipped path */
+          while (!parent_dir_entry)
+            {
+              svn_error_t *err;
+              err = svn_wc__entry_versioned(&parent_dir_entry,
+                                            (const char *) parent_path,
+                                            adm_access, FALSE, pool);
+
+              if (err || parent_dir_entry->schedule == svn_wc_schedule_delete
+                  || parent_dir_entry->deleted || parent_dir_entry->absent)
+                {
+                  parent_path = svn_path_dirname((const char *) parent_path,
+                                                 pool);
+                  parent_dir_entry = NULL;
+                  svn_error_clear(err);
+                  continue;
+                }
+              else
+                break;
+            }
+
+          /* Populate the skipped parent path hash. */
+          if (!apr_hash_get(skipped_parents, parent_path, APR_HASH_KEY_STRING))
+            {
+              apr_hash_t *child_entries;
+              svn_wc_adm_access_t *parent_dir_access;
+
+              /* Get the children of skipped parent path. */
+              SVN_ERR(svn_wc_adm_probe_retrieve(&parent_dir_access, adm_access,
+                                                parent_path, pool));
+              SVN_ERR(svn_wc_entries_read(&child_entries, parent_dir_access,
+                                          FALSE, pool));
+
+              /* Associate the child entries hash with the parent path. */
+              apr_hash_set(skipped_parents, parent_path, APR_HASH_KEY_STRING,
+                           child_entries);
+            }
         }
+
+      /* Use MERGE_RANGES as the mergeinfo for all children of the parent paths
+         which were not also explicitly skipped */
+      for (hi = apr_hash_first(NULL, skipped_parents); hi;
+           hi = apr_hash_next(hi))
+        {
+          apr_hash_index_t *child_hi;
+          apr_hash_t *child_entries;
+          const void *parent_path;
+          apr_hash_this(hi, &parent_path, NULL, NULL);
+
+          child_entries = apr_hash_get(skipped_parents, parent_path,
+                                       APR_HASH_KEY_STRING);
+          for (child_hi = apr_hash_first(NULL, child_entries); child_hi;
+               child_hi = apr_hash_next(child_hi))
+            {
+              const void *child_path;
+              const svn_wc_entry_t *child_dir_entry;
+              apr_hash_this(child_hi, &child_path, NULL, NULL);
+
+              child_path = svn_path_join((const char *)parent_path,
+                                         (const char *)child_path, pool);
+
+              /* If child path is present in the merges hash table, then
+                 it has been assigned EMPTY or MERGE_RANGES as mergeinfo
+                 previously */
+              if (!apr_hash_get(*merges, child_path, APR_HASH_KEY_STRING))
+                {
+                  svn_error_t *err;
+                  apr_hash_t *child_mergeinfo;
+                  svn_boolean_t child_indirect_mergeinfo;
+
+                  err = svn_wc__entry_versioned(&child_dir_entry,
+                                                (const char *) child_path,
+                                                adm_access, FALSE, pool);
+                  if (err
+                      || (child_dir_entry->schedule == svn_wc_schedule_delete)
+                      || (child_dir_entry->deleted))
+                    {
+                      /* If the child entry is not versioned or scheduled 
+                         for deletion, do not set the mergeinfo on the 
+                         child path */
+                      svn_error_clear(err);
+                    }
+                  else
+                    {
+                      SVN_ERR(svn_client__get_wc_or_repos_mergeinfo(
+                                                 &(child_mergeinfo),
+                                                 child_dir_entry,
+                                                 &(child_indirect_mergeinfo),
+                                                 FALSE,
+                                                 svn_mergeinfo_inherited,
+                                                 NULL, child_path,
+                                                 adm_access, merge_b->ctx,
+                                                 pool));
+                      if (child_indirect_mergeinfo)
+                        {
+                          SVN_ERR(svn_client__record_wc_mergeinfo(
+                                                              child_path,
+                                                              child_mergeinfo,
+                                                              adm_access,
+                                                              pool));
+                          if (!strcmp((const char *)parent_path,
+                                      (const char *)child_path))
+                            continue;
+                        }
+                      apr_hash_set(*merges, (const char *)child_path,
+                                   APR_HASH_KEY_STRING, merge_ranges);
+                    }
+                }
+            }
+        }
     }
   if ((depth != svn_depth_infinity) && notify_b->merged_paths)
     {
Index: subversion/tests/cmdline/merge_tests.py
===================================================================
--- subversion/tests/cmdline/merge_tests.py	(revision 27367)
+++ subversion/tests/cmdline/merge_tests.py	(working copy)
@@ -988,13 +988,14 @@
     })
   expected_disk = wc.State('', {
     ''        : Item(props={SVN_PROP_MERGE_INFO : '/A/B:1,3'}),
-    'F'       : Item(),
-    'lambda'  : Item("This is the file 'lambda'.\nchange lambda.\n"),
+    'F'       : Item(props={SVN_PROP_MERGE_INFO : '/A/B/F:1,3'}),
+    'lambda'  : Item(contents="This is the file 'lambda'.\nchange lambda.\n",
+                     props={SVN_PROP_MERGE_INFO : '/A/B/lambda:1,3'}),
     })
   expected_status = wc.State(I_path, {
     ''        : Item(status=' M'),
-    'F'       : Item(status='  '),
-    'lambda'  : Item(status='M '),
+    'F'       : Item(status=' M'),
+    'lambda'  : Item(status='MM'),
     })
   expected_status.tweak(wc_rev=4)
   expected_skip = wc.State(I_path, {
@@ -1824,7 +1825,7 @@
     })
   expected_disk = wc.State('', {
     ''       : Item(props={SVN_PROP_MERGE_INFO : '/A/B/F:2'}),
-    'Q'      : Item(),
+    'Q'      : Item(props={SVN_PROP_MERGE_INFO : '/A/B/F/Q:2'}),
     'Q/bar'  : Item("bar"),
     'foo'    : Item("foo"),
     })
@@ -1871,7 +1872,8 @@
   expected_disk = wc.State('', {
     ''       : Item(props={SVN_PROP_MERGE_INFO : '/A/B/F:2'}),
     'Q'      : Item("foo"),
-    'foo'    : Item("foo"),
+    'foo'    : Item(contents="foo",
+                    props={SVN_PROP_MERGE_INFO : '/A/B/F/foo:2'}),
     })
   expected_status = wc.State(short_C_path, {
     ''     : Item(status=' M', wc_rev=1),
@@ -7206,45 +7208,48 @@
     })
   expected_status = wc.State(short_path, {
     ''          : Item(status=' M', wc_rev=8),
-    'D/H/chi'   : Item(status='  ', wc_rev=8),
-    'D/H/psi'   : Item(status='M ', wc_rev=8),
+    'D/H/chi'   : Item(status=' M', wc_rev=8),
+    'D/H/psi'   : Item(status='MM', wc_rev=8),
     'D/H/omega' : Item(status='!M', wc_rev=8),
-    'D/H'       : Item(status='  ', wc_rev=8),
+    'D/H'       : Item(status=' M', wc_rev=8),
     'D/G/pi'    : Item(status='  ', wc_rev=8),
     'D/G/rho'   : Item(status='M ', wc_rev=8),
     'D/G/tau'   : Item(status='  ', wc_rev=8),
     'D/G'       : Item(status='  ', wc_rev=8),
     'D/gamma'   : Item(status='  ', wc_rev=8),
     'D'         : Item(status='  ', wc_rev=8),
-    'B/lambda'  : Item(status='  ', wc_rev=8),
+    'B/lambda'  : Item(status=' M', wc_rev=8),
     'B/E'       : Item(status=' M', wc_rev=8),
     'B/E/alpha' : Item(status='  ', wc_rev=8),
     'B/E/beta'  : Item(status='  ', wc_rev=8),
-    'B/F'       : Item(status='  ', wc_rev=8),
-    'B'         : Item(status='  ', wc_rev=8),
+    'B/F'       : Item(status=' M', wc_rev=8),
+    'B'         : Item(status=' M', wc_rev=8),
     'mu'        : Item(status='  ', wc_rev=8),
     'C'         : Item(status='  ', wc_rev=8),
     })
   expected_disk = wc.State('', {
     ''          : Item(props={SVN_PROP_MERGE_INFO : '/A:1,5-8'}),
-    'D/H/psi'   : Item("New content"),
-    'D/H/chi'   : Item("This is the file 'chi'.\n"),
+    'D/H/psi'   : Item(contents="New content",
+                       props={SVN_PROP_MERGE_INFO : '/A/D/H/psi:1,5-8'}),
+    'D/H/chi'   : Item(contents="This is the file 'chi'.\n",
+                       props={SVN_PROP_MERGE_INFO : '/A/D/H/chi:1,5-8'}),
      # 'D/H/omega' : run_and_verify_merge() doesn't support checking
      #               the props on a missing path, so we do that
      #               manually (see below).
-    'D/H'       : Item(),
+    'D/H'       : Item(props={SVN_PROP_MERGE_INFO : '/A/D/H:1'}),
     'D/G/pi'    : Item("This is the file 'pi'.\n"),
     'D/G/rho'   : Item("New content"),
     'D/G/tau'   : Item("This is the file 'tau'.\n"),
     'D/G'       : Item(),
     'D/gamma'   : Item("This is the file 'gamma'.\n"),
     'D'         : Item(),
-    'B/lambda'  : Item("This is the file 'lambda'.\n"),
+    'B/lambda'  : Item(contents="This is the file 'lambda'.\n",
+                       props={SVN_PROP_MERGE_INFO : '/A/B/lambda:1,5-8'}),
     'B/E'       : Item(props={SVN_PROP_MERGE_INFO : '/A/B/E:1'}),
     'B/E/alpha' : Item("This is the file 'alpha'.\n"),
     'B/E/beta'  : Item("This is the file 'beta'.\n"),
-    'B/F'       : Item(),
-    'B'         : Item(),
+    'B/F'       : Item(props={SVN_PROP_MERGE_INFO : '/A/B/F:1,5-8'}),
+    'B'         : Item(props={SVN_PROP_MERGE_INFO : '/A/B:1'}),
     'mu'        : Item("This is the file 'mu'.\n"),
     'C'         : Item(),
     })
@@ -7296,12 +7301,12 @@
     'D/H'       : Item(status=' M', wc_rev=8),
     'D/gamma'   : Item(status=' M', wc_rev=8),
     'D'         : Item(status=' M', wc_rev=8),
-    'B/lambda'  : Item(status='  ', wc_rev=8),
+    'B/lambda'  : Item(status=' M', wc_rev=8),
     'B/E'       : Item(status=' M', wc_rev=8),
     'B/E/alpha' : Item(status='  ', wc_rev=8),
     'B/E/beta'  : Item(status='  ', wc_rev=8),
-    'B/F'       : Item(status='  ', wc_rev=8),
-    'B'         : Item(status='  ', wc_rev=8),
+    'B/F'       : Item(status=' M', wc_rev=8),
+    'B'         : Item(status=' M', wc_rev=8),
     'mu'        : Item(status='  ', wc_rev=8),
     'C'         : Item(status='  ', wc_rev=8),
     })
@@ -7315,12 +7320,13 @@
     'D/gamma'   : Item("This is the file 'gamma'.\n",
                        props={SVN_PROP_MERGE_INFO : '/A/D/gamma:1-2,5-8'}),
     'D'         : Item(props={SVN_PROP_MERGE_INFO : '/A/D:1-2,5-8*'}),
-    'B/lambda'  : Item("This is the file 'lambda'.\n"),
+    'B/lambda'  : Item(contents="This is the file 'lambda'.\n",
+                       props={SVN_PROP_MERGE_INFO : '/A/B/lambda:1-2,5-8'}),
     'B/E'       : Item(props={SVN_PROP_MERGE_INFO : '/A/B/E:1-2'}),
     'B/E/alpha' : Item("This is the file 'alpha'.\n"),
     'B/E/beta'  : Item("This is the file 'beta'.\n"),
-    'B/F'       : Item(),
-    'B'         : Item(),
+    'B/F'       : Item(props={SVN_PROP_MERGE_INFO : '/A/B/F:1-2,5-8'}),
+    'B'         : Item(props={SVN_PROP_MERGE_INFO : '/A/B:1-2'}),
     'mu'        : Item("This is the file 'mu'.\n"),
     'C'         : Item(),
     })
@@ -9125,8 +9131,8 @@
     'D'        : Item(),
     'B'        : Item(props={SVN_PROP_MERGE_INFO : '/A/B:1'}),
     'B/lambda' : Item(contents="This is the file 'lambda'.\n",
-                      props={SVN_PROP_MERGE_INFO : '/A/B/lambda:2-4'}),
-    'B/F'      : Item(props={SVN_PROP_MERGE_INFO : '/A/B/F:2-4'}),
+                      props={SVN_PROP_MERGE_INFO : '/A/B/lambda:1-4'}),
+    'B/F'      : Item(props={SVN_PROP_MERGE_INFO : '/A/B/F:1-4'}),
     'B/E'      : Item(),
     'D/gamma'  : Item("This is the file 'gamma'.\n"),
     'D/G'      : Item(),
@@ -9730,7 +9736,7 @@
               merge_with_child_having_different_rev_ranges_to_merge,
               merge_old_and_new_revs_from_renamed_file,
               merge_with_auto_rev_range_detection,
-              XFail(mergeinfo_recording_in_skipped_merge),
+              mergeinfo_recording_in_skipped_merge,
               cherry_picking,
               propchange_of_subdir_raises_conflict,
               reverse_merge_prop_add_on_child,


