subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1647592 - in /subversion/trunk/subversion: libsvn_repos/load-fs-vtable.c svnrdump/load_editor.c
Date Tue, 23 Dec 2014 15:24:39 GMT
Author: julianfoad
Date: Tue Dec 23 15:24:39 2014
New Revision: 1647592

URL: http://svn.apache.org/r1647592
Log:
Cosmetically tweak some duplicated code to be even more identical. No
functional change.

* subversion/libsvn_repos/load-fs-vtable.c
  (parse_baton): Rename 'oldest_old_rev' to 'oldest_dumpstream_rev' for
    consistency with svnrdump/load_editor.c, and update all references.
  (adjust_mergeinfo_property): Correct a comment.

* subversion/svnrdump/load_editor.c
  (adjust_mergeinfo_property): New, factored out...
  (set_node_property): ... of here.

Modified:
    subversion/trunk/subversion/libsvn_repos/load-fs-vtable.c
    subversion/trunk/subversion/svnrdump/load_editor.c

Modified: subversion/trunk/subversion/libsvn_repos/load-fs-vtable.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/load-fs-vtable.c?rev=1647592&r1=1647591&r2=1647592&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/load-fs-vtable.c (original)
+++ subversion/trunk/subversion/libsvn_repos/load-fs-vtable.c Tue Dec 23 15:24:39 2014
@@ -84,9 +84,9 @@ struct parse_baton
      SVN_INVALID_REVNUM. */
   svn_revnum_t last_rev_mapped;
 
-  /* The oldest old revision loaded from the dump stream.  If no revisions
+  /* The oldest revision loaded from the dump stream.  If no revisions
      have been loaded yet, this is set to SVN_INVALID_REVNUM. */
-  svn_revnum_t oldest_old_rev;
+  svn_revnum_t oldest_dumpstream_rev;
 };
 
 struct revision_baton
@@ -248,15 +248,15 @@ renumber_mergeinfo_revs(svn_string_t **f
      Remove mergeinfo older than the oldest revision in the dump stream
      and adjust its revisions by the difference between the head rev of
      the target repository and the current dump stream rev. */
-  if (rb->pb->oldest_old_rev > 1)
+  if (rb->pb->oldest_dumpstream_rev > 1)
     {
       SVN_ERR(svn_mergeinfo__filter_mergeinfo_by_ranges(
         &predates_stream_mergeinfo, mergeinfo,
-        rb->pb->oldest_old_rev - 1, 0,
+        rb->pb->oldest_dumpstream_rev - 1, 0,
         TRUE, subpool, subpool));
       SVN_ERR(svn_mergeinfo__filter_mergeinfo_by_ranges(
         &mergeinfo, mergeinfo,
-        rb->pb->oldest_old_rev - 1, 0,
+        rb->pb->oldest_dumpstream_rev - 1, 0,
         FALSE, subpool, subpool));
       SVN_ERR(svn_mergeinfo__adjust_mergeinfo_rangelists(
         &predates_stream_mergeinfo, predates_stream_mergeinfo,
@@ -285,7 +285,7 @@ renumber_mergeinfo_revs(svn_string_t **f
             {
               range->start = rev_from_map;
             }
-          else if (range->start == pb->oldest_old_rev - 1)
+          else if (range->start == pb->oldest_dumpstream_rev - 1)
             {
               /* Since the start revision of svn_merge_range_t are not
                  inclusive there is one possible valid start revision that
@@ -300,7 +300,7 @@ renumber_mergeinfo_revs(svn_string_t **f
                  oldest rev from the load stream and subtract 1 to get the
                  renumbered, non-inclusive, start revision. */
               rev_from_map = get_revision_mapping(pb->rev_map,
-                                                  pb->oldest_old_rev);
+                                                  pb->oldest_dumpstream_rev);
               if (SVN_IS_VALID_REVNUM(rev_from_map))
                 range->start = rev_from_map - 1;
             }
@@ -325,8 +325,10 @@ renumber_mergeinfo_revs(svn_string_t **f
     }
 
   if (predates_stream_mergeinfo)
+    {
       SVN_ERR(svn_mergeinfo_merge2(final_mergeinfo, predates_stream_mergeinfo,
                                    subpool, subpool));
+    }
 
   SVN_ERR(svn_mergeinfo__canonicalize_ranges(final_mergeinfo, subpool));
 
@@ -505,8 +507,8 @@ new_revision_record(void **revision_bato
         }
 
       /* Stash the oldest "old" revision committed from the load stream. */
-      if (!SVN_IS_VALID_REVNUM(pb->oldest_old_rev))
-        pb->oldest_old_rev = rb->rev;
+      if (!SVN_IS_VALID_REVNUM(pb->oldest_dumpstream_rev))
+        pb->oldest_dumpstream_rev = rb->rev;
     }
 
   /* If we're skipping this revision, try to notify someone. */
@@ -760,8 +762,7 @@ adjust_mergeinfo_property(struct revisio
 
   /* Tolerate mergeinfo with "\r\n" line endings because some
      dumpstream sources might contain as much.  If so normalize
-     the line endings to '\n' and make a notification to
-     PARSE_BATON->FEEDBACK_STREAM that we have made this
+     the line endings to '\n' and notify that we have made this
      correction. */
   if (strstr(prop_val.data, "\r"))
     {
@@ -793,6 +794,7 @@ adjust_mergeinfo_property(struct revisio
   /* Renumber mergeinfo as appropriate. */
   SVN_ERR(renumber_mergeinfo_revs(new_value_p, &prop_val, rb,
                                   result_pool));
+
   if (pb->parent_dir)
     {
       /* Prefix the merge source paths with PB->parent_dir. */
@@ -1174,7 +1176,7 @@ svn_repos_get_fs_build_parser5(const svn
   pb->pool = pool;
   pb->notify_pool = svn_pool_create(pool);
   pb->rev_map = apr_hash_make(pool);
-  pb->oldest_old_rev = SVN_INVALID_REVNUM;
+  pb->oldest_dumpstream_rev = SVN_INVALID_REVNUM;
   pb->last_rev_mapped = SVN_INVALID_REVNUM;
   pb->start_rev = start_rev;
   pb->end_rev = end_rev;

Modified: subversion/trunk/subversion/svnrdump/load_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/load_editor.c?rev=1647592&r1=1647591&r2=1647592&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/load_editor.c (original)
+++ subversion/trunk/subversion/svnrdump/load_editor.c Tue Dec 23 15:24:39 2014
@@ -878,6 +878,56 @@ set_revision_property(void *baton,
   return SVN_NO_ERROR;
 }
 
+/* Adjust mergeinfo:
+ *   - normalize line endings (if all CRLF, change to LF; but error if mixed);
+ *   - adjust revision numbers (see renumber_mergeinfo_revs());
+ *   - adjust paths (see prefix_mergeinfo_paths()).
+ */
+static svn_error_t *
+adjust_mergeinfo_property(struct revision_baton *rb,
+                          svn_string_t **new_value_p,
+                          const svn_string_t *old_value,
+                          apr_pool_t *result_pool)
+{
+  struct parse_baton *pb = rb->pb;
+  svn_string_t prop_val = *old_value;
+
+  /* Tolerate mergeinfo with "\r\n" line endings because some
+     dumpstream sources might contain as much.  If so normalize
+     the line endings to '\n' and notify that we have made this
+     correction. */
+  if (strstr(prop_val.data, "\r"))
+    {
+      const char *prop_eol_normalized;
+
+      SVN_ERR(svn_subst_translate_cstring2(prop_val.data,
+                                           &prop_eol_normalized,
+                                           "\n",  /* translate to LF */
+                                           FALSE, /* no repair */
+                                           NULL,  /* no keywords */
+                                           FALSE, /* no expansion */
+                                           result_pool));
+      prop_val.data = prop_eol_normalized;
+      prop_val.len = strlen(prop_eol_normalized);
+
+      /* ### TODO: notify? */
+    }
+
+  /* Renumber mergeinfo as appropriate. */
+  SVN_ERR(renumber_mergeinfo_revs(new_value_p, &prop_val, rb,
+                                  result_pool));
+
+  if (pb->parent_dir)
+    {
+      /* Prefix the merge source paths with PB->parent_dir. */
+      /* ASSUMPTION: All source paths are included in the dump stream. */
+      SVN_ERR(prefix_mergeinfo_paths(new_value_p, *new_value_p,
+                                     pb->parent_dir, result_pool));
+    }
+
+  return SVN_NO_ERROR;
+}
+
 static svn_error_t *
 set_node_property(void *baton,
                   const char *name,
@@ -889,46 +939,10 @@ set_node_property(void *baton,
 
   if (value && strcmp(name, SVN_PROP_MERGEINFO) == 0)
     {
-      svn_string_t *renumbered_mergeinfo;
-      svn_string_t prop_val;
+      svn_string_t *new_value;
 
-      /* Tolerate mergeinfo with "\r\n" line endings because some
-         dumpstream sources might contain as much.  If so normalize
-         the line endings to '\n' and make a notification to
-         PARSE_BATON->FEEDBACK_STREAM that we have made this
-         correction. */
-      if (strstr(value->data, "\r"))
-        {
-          const char *prop_eol_normalized;
-
-          SVN_ERR(svn_subst_translate_cstring2(value->data,
-                                               &prop_eol_normalized,
-                                               "\n",  /* translate to LF */
-                                               FALSE, /* no repair */
-                                               NULL,  /* no keywords */
-                                               FALSE, /* no expansion */
-                                               pool));
-          prop_val.data = prop_eol_normalized;
-          prop_val.len = strlen(prop_eol_normalized);
-          value = &prop_val;
-
-          /* ### TODO: notify? */
-        }
-
-      /* Renumber mergeinfo as appropriate. */
-      SVN_ERR(renumber_mergeinfo_revs(&renumbered_mergeinfo, value,
-                                      nb->rb, pool));
-      value = renumbered_mergeinfo;
-
-      if (nb->rb->pb->parent_dir)
-        {
-          /* Prefix the merge source paths with PB->parent_dir. */
-          /* ASSUMPTION: All source paths are included in the dump stream. */
-          svn_string_t *mergeinfo_val;
-          SVN_ERR(prefix_mergeinfo_paths(&mergeinfo_val, value,
-                                         nb->rb->pb->parent_dir, pool));
-          value = mergeinfo_val;
-        }
+      SVN_ERR(adjust_mergeinfo_property(nb->rb, &new_value, value, pool));
+      value = new_value;
     }
 
   SVN_ERR(svn_rdump__normalize_prop(name, &value, pool));



Mime
View raw message