subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1134470 - in /subversion/trunk/subversion: include/svn_repos.h libsvn_repos/deprecated.c libsvn_repos/dump.c svnadmin/main.c
Date Fri, 10 Jun 2011 23:04:45 GMT
Author: danielsh
Date: Fri Jun 10 23:04:45 2011
New Revision: 1134470

URL: http://svn.apache.org/viewvc?rev=1134470&view=rev
Log:
Tweak the svn_repos_notify_* API to be less tailored for svnadmin.

Note, since the notifications were printed both during the dump and once
more at the end, the API will now generate the same svn_repos_notify_action_t
twice: once during the dump and once at the end.  This should be fine for API
users since we have (or are about to have) a "Done" notification.

* subversion/include/svn_repos.h
  (svn_repos_notify_warning_t): New enum and typedef.
  (svn_repos_notify_t):
    Rename 'warning' to 'warning_str' and add 'warning' members.

* subversion/libsvn_repos/deprecated.c
  (repos_notify_handler): Track rename.

* subversion/libsvn_repos/dump.c
  (dump_node, svn_repos_dump_fs3): Track rename.
    Don't format the error message in an svnadmin-specific way.

* subversion/svnadmin/main.c
  (repos_notify_handler): Format the error message here.

Modified:
    subversion/trunk/subversion/include/svn_repos.h
    subversion/trunk/subversion/libsvn_repos/deprecated.c
    subversion/trunk/subversion/libsvn_repos/dump.c
    subversion/trunk/subversion/svnadmin/main.c

Modified: subversion/trunk/subversion/include/svn_repos.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_repos.h?rev=1134470&r1=1134469&r2=1134470&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_repos.h (original)
+++ subversion/trunk/subversion/include/svn_repos.h Fri Jun 10 23:04:45 2011
@@ -240,6 +240,21 @@ typedef enum svn_repos_notify_action_t
 
 } svn_repos_notify_action_t;
 
+/** The type of error occurring.
+ *
+ * @since New in 1.7.
+ */
+typedef enum svn_repos_notify_warning_t
+{
+  /** Referencing copy source data from a revision earlier than the
+   * first revision dumped. */
+  svn_repos_notify_warning_found_old_reference,
+
+  /** An #SVN_PROP_MERGEINFO property's encoded mergeinfo references a
+   * revision earlier than the first revision dumped. */
+  svn_repos_notify_warning_found_old_mergeinfo,
+} svn_repos_notify_warning_t;
+
 /**
  * Structure used by #svn_repos_notify_func_t.
  *
@@ -261,8 +276,10 @@ typedef struct svn_repos_notify_t
    * the revision which just completed. */
   svn_revnum_t revision;
 
-  /** For #svn_repos_notify_warning, the warning text. */
-  const char *warning;
+  /** For #svn_repos_notify_warning, the warning object. Must be cleared
+      by the consumer of the notification. */
+  const char *warning_str;
+  svn_repos_notify_warning_t warning;
 
   /** For #svn_repos_notify_pack_shard_start,
       #svn_repos_notify_pack_shard_end,

Modified: subversion/trunk/subversion/libsvn_repos/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/deprecated.c?rev=1134470&r1=1134469&r2=1134470&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_repos/deprecated.c Fri Jun 10 23:04:45 2011
@@ -570,8 +570,8 @@ repos_notify_handler(void *baton,
   switch (notify->action)
   {
     case svn_repos_notify_warning:
-      len = strlen(notify->warning);
-      svn_error_clear(svn_stream_write(feedback_stream, notify->warning, &len));
+      len = strlen(notify->warning_str);
+      svn_error_clear(svn_stream_write(feedback_stream, notify->warning_str, &len));
       return;
 
     case svn_repos_notify_dump_rev_end:

Modified: subversion/trunk/subversion/libsvn_repos/dump.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/dump.c?rev=1134470&r1=1134469&r2=1134470&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/dump.c (original)
+++ subversion/trunk/subversion/libsvn_repos/dump.c Fri Jun 10 23:04:45 2011
@@ -353,13 +353,14 @@ dump_node(struct edit_baton *eb,
               svn_repos_notify_t *notify =
                     svn_repos_notify_create(svn_repos_notify_warning, pool);
 
-              notify->warning = apr_psprintf(
+              notify->warning = svn_repos_notify_warning_found_old_reference;
+              notify->warning_str = apr_psprintf(
                      pool,
-                     _("WARNING: Referencing data in revision %ld,"
-                       " which is older than the oldest\n"
-                       "WARNING: dumped revision (%ld).  Loading this dump"
-                       " into an empty repository\n"
-                       "WARNING: will fail.\n"),
+                     _("Referencing data in revision %ld,"
+                       " which is older than the oldest"
+                       " dumped revision (%ld).  Loading this dump"
+                       " into an empty repository"
+                       " will fail."),
                      cmp_rev, eb->oldest_dumped_rev);
               eb->found_old_reference = TRUE;
               eb->notify_func(eb->notify_baton, notify, pool);
@@ -457,12 +458,13 @@ dump_node(struct edit_baton *eb,
                   svn_repos_notify_t *notify =
                     svn_repos_notify_create(svn_repos_notify_warning, pool);
 
-                  notify->warning = apr_psprintf(
+                  notify->warning = svn_repos_notify_warning_found_old_mergeinfo;
+                  notify->warning_str = 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"),
+                    _("Mergeinfo referencing revision(s) prior "
+                      "to the oldest dumped revision (%ld). "
+                      "Loading this dump may result in invalid "
+                      "mergeinfo."),
                     eb->oldest_dumped_rev);
 
                   eb->found_old_mergeinfo = TRUE;
@@ -1122,10 +1124,11 @@ svn_repos_dump_fs3(svn_repos_t *repos,
 
       if (found_old_reference)
         {
-          notify->warning = _("WARNING: The range of revisions dumped "
-                              "contained references to\n"
-                              "WARNING: copy sources outside that "
-                              "range.\n");
+          notify->warning = svn_repos_notify_warning_found_old_reference;
+          notify->warning_str = _("The range of revisions dumped "
+                                  "contained references to "
+                                  "copy sources outside that "
+                                  "range.");
           notify_func(notify_baton, notify, subpool);
         }
 
@@ -1133,10 +1136,11 @@ svn_repos_dump_fs3(svn_repos_t *repos,
          in dumped mergeinfo. */
       if (found_old_mergeinfo)
         {
-          notify->warning = _("WARNING: The range of revisions dumped "
-                              "contained mergeinfo\n"
-                              "WARNING: which reference revisions outside "
-                              "that range.\n");
+          notify->warning = svn_repos_notify_warning_found_old_mergeinfo;
+          notify->warning_str = _("The range of revisions dumped "
+                                  "contained mergeinfo "
+                                  "which reference revisions outside "
+                                  "that range.");
           notify_func(notify_baton, notify, subpool);
         }
     }

Modified: subversion/trunk/subversion/svnadmin/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnadmin/main.c?rev=1134470&r1=1134469&r2=1134470&view=diff
==============================================================================
--- subversion/trunk/subversion/svnadmin/main.c (original)
+++ subversion/trunk/subversion/svnadmin/main.c Fri Jun 10 23:04:45 2011
@@ -684,9 +684,9 @@ repos_notify_handler(void *baton,
   switch (notify->action)
   {
     case svn_repos_notify_warning:
-      len = strlen(notify->warning);
-      svn_error_clear(svn_stream_write(feedback_stream, notify->warning,
-                                       &len));
+      svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool,
+                                        "WARNING %d: %s\n", notify->warning,
+                                        notify->warning_str));
       return;
 
     case svn_repos_notify_dump_rev_end:



Mime
View raw message