Author: julianfoad
Date: Thu Apr 21 13:46:48 2022
New Revision: 1900110

URL: http://svn.apache.org/viewvc?rev=1900110&view=rev
Log:
On the 'pristines-on-demand-on-mwf' branch: A follow-up to r1899173 "notify
when hydrating".

Don't unconditionally suppress all notifications in 'cat' and 'diff', just
suppress the progress feedback for text base hydration, in case (now or
later) we are using notifications for something else in 'cat' (less likely)
or 'diff' (more likely).

* subversion/svn/cl.h
  (svn_cl__notifier_suppress_progress_output): New.

* subversion/svn/cat-cmd.c
  (svn_cl__cat): Don't disable the notification callback entirely.

* subversion/svn/diff-cmd.c
  (svn_cl__diff): Same.

* subversion/svn/notify.c
  (notify_baton): Add a flag.
  (notify_body): Print text base hydration progress only if the flag is set.
  (svn_cl__get_notifier): Initialize the flag.
  (svn_cl__notifier_suppress_progress_output): New.

* subversion/svn/svn.c
  (sub_main): Tell our notifier to suppress progress output for 'cat' and
    'diff'.

Modified:
    subversion/branches/pristines-on-demand-on-mwf/subversion/svn/cat-cmd.c
    subversion/branches/pristines-on-demand-on-mwf/subversion/svn/cl.h
    subversion/branches/pristines-on-demand-on-mwf/subversion/svn/diff-cmd.c
    subversion/branches/pristines-on-demand-on-mwf/subversion/svn/notify.c
    subversion/branches/pristines-on-demand-on-mwf/subversion/svn/svn.c

Modified: 
subversion/branches/pristines-on-demand-on-mwf/subversion/svn/cat-cmd.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/svn/cat-cmd.c?rev=1900110&r1=1900109&r2=1900110&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/subversion/svn/cat-cmd.c 
(original)
+++ subversion/branches/pristines-on-demand-on-mwf/subversion/svn/cat-cmd.c Thu 
Apr 21 13:46:48 2022
@@ -53,9 +53,6 @@ svn_cl__cat(apr_getopt_t *os,
   apr_array_header_t *errors = apr_array_make(pool, 0, sizeof(apr_status_t));
   svn_error_t *err;
 
-  /* Don't print any feedback notifications. (At least not on stdout.) */
-  ctx->notify_func2 = NULL;
-
   SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
                                                       opt_state->targets,
                                                       ctx, FALSE, pool));

Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/svn/cl.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/svn/cl.h?rev=1900110&r1=1900109&r2=1900110&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/subversion/svn/cl.h 
(original)
+++ subversion/branches/pristines-on-demand-on-mwf/subversion/svn/cl.h Thu Apr 
21 13:46:48 2022
@@ -709,6 +709,11 @@ svn_cl__notifier_mark_export(void *baton
 svn_error_t *
 svn_cl__notifier_mark_wc_to_repos_copy(void *baton);
 
+/* Make the notifier for use with BATON suppress progress notifications
+ */
+svn_error_t *
+svn_cl__notifier_suppress_progress_output(void *baton);
+
 /* Baton for use with svn_cl__check_externals_failed_notify_wrapper(). */
 struct svn_cl__check_externals_failed_notify_baton
 {

Modified: 
subversion/branches/pristines-on-demand-on-mwf/subversion/svn/diff-cmd.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/svn/diff-cmd.c?rev=1900110&r1=1900109&r2=1900110&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/subversion/svn/diff-cmd.c 
(original)
+++ subversion/branches/pristines-on-demand-on-mwf/subversion/svn/diff-cmd.c 
Thu Apr 21 13:46:48 2022
@@ -222,9 +222,6 @@ svn_cl__diff(apr_getopt_t *os,
     opt_state->diff.patch_compatible || opt_state->diff.ignore_properties;
   int i;
 
-  /* Don't print any feedback notifications. (At least not on stdout.) */
-  ctx->notify_func2 = NULL;
-
   if (opt_state->extensions)
     options = svn_cstring_split(opt_state->extensions, " \t\n\r", TRUE, pool);
   else

Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/svn/notify.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/svn/notify.c?rev=1900110&r1=1900109&r2=1900110&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/subversion/svn/notify.c 
(original)
+++ subversion/branches/pristines-on-demand-on-mwf/subversion/svn/notify.c Thu 
Apr 21 13:46:48 2022
@@ -56,6 +56,7 @@ struct notify_baton
   svn_boolean_t hydrating_printed_start;
   int in_external;
   svn_revnum_t progress_revision;
+  svn_boolean_t progress_output;
   svn_boolean_t had_print_error; /* Used to not keep printing error messages
                                     when we've already had one print error. */
   svn_boolean_t wc_was_upgraded;
@@ -1215,16 +1216,19 @@ notify_body(struct notify_baton *nb,
     case svn_wc_notify_hydrating_file:
       if (!nb->hydrating_printed_start)
         {
-          SVN_ERR(svn_cmdline_printf(pool, _("Fetching text bases ")));
+          if (nb->progress_output)
+            SVN_ERR(svn_cmdline_printf(pool, _("Fetching text bases ")));
           nb->hydrating_printed_start = TRUE;
         }
-      SVN_ERR(svn_cmdline_printf(pool, "."));
+      if (nb->progress_output)
+        SVN_ERR(svn_cmdline_printf(pool, "."));
       break;
 
     case svn_wc_notify_hydrating_end:
       if (nb->hydrating_printed_start)
         {
-          SVN_ERR(svn_cmdline_printf(pool, _("done\n")));
+          if (nb->progress_output)
+            SVN_ERR(svn_cmdline_printf(pool, _("done\n")));
         }
       break;
 
@@ -1288,6 +1292,7 @@ svn_cl__get_notifier(svn_wc_notify_func2
   nb->is_wc_to_repos_copy = FALSE;
   nb->in_external = 0;
   nb->progress_revision = 0;
+  nb->progress_output = TRUE;
   nb->had_print_error = FALSE;
   nb->conflict_stats = conflict_stats;
   SVN_ERR(svn_dirent_get_absolute(&nb->path_prefix, "", pool));
@@ -1324,6 +1329,15 @@ svn_cl__notifier_mark_wc_to_repos_copy(v
   return SVN_NO_ERROR;
 }
 
+svn_error_t *
+svn_cl__notifier_suppress_progress_output(void *baton)
+{
+  struct notify_baton *nb = baton;
+
+  nb->progress_output = FALSE;
+  return SVN_NO_ERROR;
+}
+
 void
 svn_cl__check_externals_failed_notify_wrapper(void *baton,
                                               const svn_wc_notify_t *n,

Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/svn/svn.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/svn/svn.c?rev=1900110&r1=1900109&r2=1900110&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/subversion/svn/svn.c 
(original)
+++ subversion/branches/pristines-on-demand-on-mwf/subversion/svn/svn.c Thu Apr 
21 13:46:48 2022
@@ -3244,6 +3244,12 @@ sub_main(int *exit_code, int argc, const
     {
       SVN_ERR(svn_cl__get_notifier(&ctx->notify_func2, &ctx->notify_baton2,
                                    conflict_stats, pool));
+
+      /* Data-outputting commands should not print progress notifications
+       * (such as hydrating text bases) on stdout. */
+      if (subcommand->cmd_func == svn_cl__cat
+          || subcommand->cmd_func == svn_cl__diff)
+        SVN_ERR(svn_cl__notifier_suppress_progress_output(ctx->notify_baton2));
     }
 
   /* Get password from stdin if necessary */


Reply via email to