Index: subversion/libsvn_repos/load.c
===================================================================
--- subversion/libsvn_repos/load.c	(revision 27426)
+++ subversion/libsvn_repos/load.c	(working copy)
@@ -26,6 +26,7 @@
 #include "svn_props.h"
 #include "repos.h"
 #include "svn_private_config.h"
+#include "svn_mergeinfo.h"
 
 #include <apr_lib.h>
 
@@ -232,6 +233,29 @@
   return SVN_NO_ERROR;
 }
 
+/* Prefix the mergeinfo source path to have PARENT_DIR */
+static void
+prefix_mergeinfo_source_paths(char **mergeinfo_val,
+                              apr_hash_t *mergeinfo, const char *parent_dir,
+                              apr_pool_t *pool)
+{
+  apr_hash_t *new_mergeinfo = apr_hash_make(pool);
+  apr_hash_index_t *hi;
+  svn_stringbuf_t *merge_val;
+  const char *path;
+  const void *merge_source;
+  void *rangelist;
+
+  for (hi = apr_hash_first(NULL, mergeinfo); hi; hi = apr_hash_next(hi))
+    {
+      apr_hash_this(hi, &merge_source, NULL, &rangelist);
+      path = svn_path_join(parent_dir, (const char*)merge_source+1, pool);
+      apr_hash_set(new_mergeinfo, path, APR_HASH_KEY_STRING, rangelist);
+    }
+  svn_mergeinfo_to_stringbuf(&merge_val, new_mergeinfo, pool);
+  *mergeinfo_val = merge_val->data;
+}
+
 /* Read CONTENT_LENGTH bytes from STREAM, parsing the bytes as an
    encoded Subversion properties hash, and making multiple calls to
    PARSE_FNS->set_*_property on RECORD_BATON (depending on the value
@@ -306,9 +330,29 @@
 
               /* Now, send the property pair to the vtable! */
               if (is_node)
-                SVN_ERR(parse_fns->set_node_property(record_baton,
-                                                     keybuf,
-                                                     &propstring));
+                {
+                  struct node_baton *nb = record_baton;
+                  struct revision_baton *rb = nb->rb;
+                  const char *parent_dir = rb->pb->parent_dir;
+
+                  /* If the property is SVN_PROP_MERGE_INFO and we have
+                     PARENT_DIR specified, then prefix the mergeinfo sources */
+                  if (! strcmp(keybuf, SVN_PROP_MERGE_INFO) && (parent_dir))
+                    {
+                      apr_hash_t *mergeinfo;
+                      char *mergeinfo_val;
+                      SVN_ERR(svn_mergeinfo_parse(&mergeinfo,
+                                                  propstring.data,
+                                                  proppool));
+                      prefix_mergeinfo_source_paths(&mergeinfo_val, mergeinfo,
+                                                    parent_dir, pool);
+                      propstring.len = strlen(mergeinfo_val);
+                      propstring.data = mergeinfo_val;
+                    }
+                  SVN_ERR(parse_fns->set_node_property(record_baton,
+                                                       keybuf,
+                                                       &propstring));
+                }
               else
                 SVN_ERR(parse_fns->set_revision_property(record_baton,
                                                          keybuf,


