subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pbu...@apache.org
Subject svn commit: r937465 - /subversion/trunk/subversion/libsvn_repos/dump.c
Date Fri, 23 Apr 2010 18:52:06 GMT
Author: pburba
Date: Fri Apr 23 18:52:06 2010
New Revision: 937465

URL: http://svn.apache.org/viewvc?rev=937465&view=rev
Log:
Issue inline and end-of-dump summary warnings when dumping mergeinfo that
refers to revisions outside of the requested dump range.

This is analogous to the warnings we issue for copy-from revisions older
than the oldest dumped rev and is part of a group of fixes for issue #3020,
see http://svn.haxx.se/dev/archive-2010-04/0475.shtml

* subversion/libsvn_repos/dump.c

  (global): include svn_mergeinfo_private.h

  (edit_baton): Add new member found_old_mergeinfo.

  (dump_node): Issue inline warning.

  (svn_repos_dump_fs3): Issue end-of-dump summary warning.

Modified:
    subversion/trunk/subversion/libsvn_repos/dump.c

Modified: subversion/trunk/subversion/libsvn_repos/dump.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/dump.c?rev=937465&r1=937464&r2=937465&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/dump.c (original)
+++ subversion/trunk/subversion/libsvn_repos/dump.c Fri Apr 23 18:52:06 2010
@@ -34,6 +34,7 @@
 #include "svn_checksum.h"
 #include "svn_props.h"
 
+#include "private/svn_mergeinfo_private.h"
 
 #define ARE_VALID_COPY_ARGS(p,r) ((p) && SVN_IS_VALID_REVNUM(r))
 
@@ -200,6 +201,10 @@ struct edit_baton
      OLDEST_DUMPED_REV were found in the dumpstream. */
   svn_boolean_t found_old_reference;
 
+  /* Set to true if any mergeinfo was dumped which contains revisions
+     older than OLDEST_DUMPED_REV. */
+  svn_boolean_t found_old_mergeinfo;
+
   /* reusable buffer for writing file contents */
   char buffer[SVN__STREAM_CHUNK_SIZE];
   apr_size_t bufsize;
@@ -504,6 +509,43 @@ dump_node(struct edit_baton *eb,
       apr_size_t proplen;
 
       SVN_ERR(svn_fs_node_proplist(&prophash, eb->fs_root, path, pool));
+
+      /* If this is a partial dump, then issue a warning if we dump mergeinfo
+         properties that refer to revisions older than the first revision
+         dumped. */
+      if (eb->progress_func && eb->oldest_dumped_rev > 1)
+        {
+          svn_string_t *mergeinfo_str = apr_hash_get(prophash,
+                                                     SVN_PROP_MERGEINFO,
+                                                     APR_HASH_KEY_STRING);
+          if (mergeinfo_str)
+            {
+              svn_mergeinfo_t mergeinfo, old_mergeinfo;
+
+              SVN_ERR(svn_mergeinfo_parse(&mergeinfo, mergeinfo_str->data,
+                                          pool));
+              SVN_ERR(svn_mergeinfo__filter_mergeinfo_by_ranges(
+                &old_mergeinfo, mergeinfo,
+                eb->oldest_dumped_rev - 1, 0,
+                TRUE, pool, pool));
+              if (apr_hash_count(old_mergeinfo))
+                {
+                  const char *warning = apr_psprintf(
+                    pool,
+                    _("WARNING: Mergeinfo referencing revision(s) prior "
+                      "to the oldest dumped revision (%ld).\n"
+                      "WARNING: Loading this dump may result in invalid "
+                      "mergeinfo.\n"),
+                    eb->oldest_dumped_rev);
+
+                  eb->found_old_mergeinfo = TRUE;
+                  SVN_ERR(eb->progress_func(eb->progress_baton,
+                                            SVN_INVALID_REVNUM,
+                                            warning, pool));
+                }
+            }
+        }
+
       if (eb->use_deltas && compare_root)
         {
           /* Fetch the old property hash to diff against and output a header
@@ -987,6 +1029,7 @@ svn_repos_dump_fs3(svn_repos_t *repos,
   const char *uuid;
   int version;
   svn_boolean_t found_old_reference = FALSE;
+  svn_boolean_t found_old_mergeinfo = FALSE;
 
   /* Determine the current youngest revision of the filesystem. */
   SVN_ERR(svn_fs_youngest_rev(&youngest, fs, pool));
@@ -1115,21 +1158,39 @@ svn_repos_dump_fs3(svn_repos_t *repos,
       if (progress_func)
         SVN_ERR(progress_func(progress_baton, to_rev, NULL, subpool));
 
-      if (dump_edit_baton /* We never get an edit baton for r0. */
-          && ((struct edit_baton *)dump_edit_baton)->found_old_reference)
-        found_old_reference = TRUE;
+      if (dump_edit_baton) /* We never get an edit baton for r0. */
+        {
+          if (((struct edit_baton *)dump_edit_baton)->found_old_reference)
+            found_old_reference = TRUE;
+          if (((struct edit_baton *)dump_edit_baton)->found_old_mergeinfo)
+            found_old_mergeinfo = TRUE;
+        }
     }
 
-  /* Did we issue any warnings about references to revisions older than
-     the oldest dumped revision?  If so, then issue a final generic
-     warning, since the inline warnings already issued might easily be
-     missed. */
-  if (progress_func && found_old_reference)
-    SVN_ERR(progress_func(progress_baton, SVN_INVALID_REVNUM,
-                          _("WARNING: The range of revisions dumped "
-                            "contained references to\n"
-                            "WARNING: copy sources outside that range.\n"),
-                            subpool));
+  if (progress_func)
+    {
+      /* Did we issue any warnings about references to revisions older than
+         the oldest dumped revision?  If so, then issue a final generic
+         warning, since the inline warnings already issued might easily be
+         missed. */
+      if (found_old_reference)
+        SVN_ERR(progress_func(progress_baton, SVN_INVALID_REVNUM,
+                              _("WARNING: The range of revisions dumped "
+                                "contained references to\n"
+                                "WARNING: copy sources outside that "
+                                "range.\n"),
+                              subpool));
+
+      /* Ditto if we issued any warnings about old revisions referenced
+         in dumped mergeinfo. */
+      if (found_old_mergeinfo)
+        SVN_ERR(progress_func(progress_baton, SVN_INVALID_REVNUM,
+                              _("WARNING: The range of revisions dumped "
+                                "contained mergeinfo\n"
+                                "WARNING: which reference revisions outside "
+                                "that range.\n"),
+                              subpool));
+    }
 
   svn_pool_destroy(subpool);
 



Mime
View raw message