[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Issue #1935: svn status too verbose with svn:externals definitions

From: Scott Palmer <scott.palmer_at_2connected.org>
Date: 2005-08-06 00:19:43 CEST

Sorry to include the patch inline... Apple's Mail program wanted to
use octet-stream instead of text when I tried it as an attachment.

This patch is against the trunk. Be gentle - it's my first time ;-)

[[[
Fix issue #1935: svn status too verbose with svn:externals definitions

* subversion/clients/cmdline/cl.h
     Moved status_baton and notify baton to here
* subversion/clients/cmdline/notify.c
     Modified processing of svn_wc_notify_status_external to suppress
output unless -v specified
* subversion/clients/cmdline/status-cmd.c
     Print the svn_wc_notify_status_external message from here, if
there is status to print and -q was specified with -v

NOTE: This will break test scripts.
]]]

Index: subversion/clients/cmdline/cl.h
===================================================================
--- subversion/clients/cmdline/cl.h (revision 15608)
+++ subversion/clients/cmdline/cl.h (working copy)
@@ -150,7 +150,38 @@
    svn_client_ctx_t *ctx;
} svn_cl__cmd_baton_t;
+struct svn_cl__notify_baton;
+struct svn_cl__status_baton
+{
+ /* These fields all correspond to the ones in the
+ svn_cl__print_status() interface. */
+ svn_boolean_t detailed;
+ svn_boolean_t show_last_committed;
+ svn_boolean_t skip_unrecognized;
+ svn_boolean_t repos_locks;
+ apr_pool_t *pool;
+ svn_boolean_t had_print_error; /* To avoid printing lots of
errors if we get
+ errors while printing to stdout */
+ svn_boolean_t xml_mode;
+ struct svn_cl__notify_baton *nb;
+};
+
+/* Baton for notify and friends. */
+struct svn_cl__notify_baton
+{
+ svn_boolean_t received_some_change;
+ svn_boolean_t is_checkout;
+ svn_boolean_t is_export;
+ svn_boolean_t suppress_final_line;
+ svn_boolean_t sent_first_txdelta;
+ svn_boolean_t in_external;
+ svn_boolean_t had_print_error; /* Used to not keep printing error
messages
+ when we've already had one print error. */
+ int extern_path_prefix_length; /* Used to recreate external folder
name */
+ struct svn_cl__status_baton *sb;
+};
+
/* Declare all the command procedures */
svn_opt_subcommand_t
    svn_cl__add,
Index: subversion/clients/cmdline/notify.c
===================================================================
--- subversion/clients/cmdline/notify.c (revision 15608)
+++ subversion/clients/cmdline/notify.c (working copy)
@@ -33,27 +33,12 @@
#include "svn_private_config.h"
-
-/* Baton for notify and friends. */
-struct notify_baton
-{
- svn_boolean_t received_some_change;
- svn_boolean_t is_checkout;
- svn_boolean_t is_export;
- svn_boolean_t suppress_final_line;
- svn_boolean_t sent_first_txdelta;
- svn_boolean_t in_external;
- svn_boolean_t had_print_error; /* Used to not keep printing error
messages
- when we've already had one print
error. */
-};
-
-
/* This implements `svn_wc_notify_func2_t'.
   * NOTE: This function can't fail, so we just ignore any print
errors. */
static void
notify (void *baton, const svn_wc_notify_t *n, apr_pool_t *pool)
{
- struct notify_baton *nb = baton;
+ struct svn_cl__notify_baton *nb = baton;
    char statchar_buf[5] = " ";
    const char *path_local;
    svn_error_t *err;
@@ -281,10 +266,25 @@
        break;
      case svn_wc_notify_status_external:
- if ((err = svn_cmdline_printf
- (pool, _("\nPerforming status on external item at '%s'\n"),
- path_local)))
- goto print_error;
+ if (nb->sb->detailed) /* -v, --verbose */
+ {
+ if (nb->sb->skip_unrecognized) /* -q, --quiet */
+ {
+ nb->extern_path_prefix_length = strlen(path_local);
+ }
+ else
+ {
+ nb->extern_path_prefix_length = 0;
+ if ((err = svn_cmdline_printf
+ (pool, _("\nPerforming status on external item at
'%s'\n"),
+ path_local)))
+ goto print_error;
+ }
+ }
+ else
+ {
+ nb->extern_path_prefix_length = 0;
+ }
        break;
      case svn_wc_notify_status_completed:
@@ -391,7 +391,7 @@
                        svn_boolean_t suppress_final_line,
                        apr_pool_t *pool)
{
- struct notify_baton *nb = apr_palloc (pool, sizeof (*nb));
+ struct svn_cl__notify_baton *nb = apr_palloc (pool, sizeof (*nb));
    nb->received_some_change = FALSE;
    nb->sent_first_txdelta = FALSE;
@@ -400,6 +400,8 @@
    nb->suppress_final_line = suppress_final_line;
    nb->in_external = FALSE;
    nb->had_print_error = FALSE;
+ nb->extern_path_prefix_length = 0;
+ nb->sb = NULL;
    *notify_func_p = notify;
    *notify_baton_p = nb;
Index: subversion/clients/cmdline/status-cmd.c
===================================================================
--- subversion/clients/cmdline/status-cmd.c (revision 15608)
+++ subversion/clients/cmdline/status-cmd.c (working copy)
@@ -22,6 +22,7 @@
/*** Includes. ***/
+#include "svn_cmdline.h"
#include "svn_wc.h"
#include "svn_client.h"
#include "svn_error.h"
@@ -32,26 +33,8 @@
#include "svn_private_config.h"
-
-
/*** Code. ***/
-struct status_baton
-{
- /* These fields all correspond to the ones in the
- svn_cl__print_status() interface. */
- svn_boolean_t detailed;
- svn_boolean_t show_last_committed;
- svn_boolean_t skip_unrecognized;
- svn_boolean_t repos_locks;
- apr_pool_t *pool;
-
- svn_boolean_t had_print_error; /* To avoid printing lots of
errors if we get
- errors while printing to stdout */
- svn_boolean_t xml_mode;
-};
-
-
/* Prints XML target element with path attribute TARGET, using POOL for
     temporary allocations. */
static svn_error_t *
@@ -119,9 +102,23 @@
                const char *path,
                svn_wc_status2_t *status)
{
- struct status_baton *sb = baton;
+ struct svn_cl__status_baton *sb = baton;
    svn_error_t *err;
-
+
+ if (sb->nb->extern_path_prefix_length > 0)
+ {
+ char *tmp = malloc((sb->nb->extern_path_prefix_length+1) *
sizeof(char));
+ strncpy(tmp, path, sb->nb->extern_path_prefix_length);
+ tmp[sb->nb->extern_path_prefix_length] = 0;
+
+ err = svn_cmdline_printf
+ (sb->pool, _("\nPerforming status on external item
at '%s'\n"),
+ tmp);
+
+ free(tmp);
+ sb->nb->extern_path_prefix_length = 0;
+ }
+
    if (sb->xml_mode)
      err = svn_cl__print_status_xml (path, status, sb->pool);
    else
@@ -156,7 +153,7 @@
    apr_pool_t * subpool;
    int i;
    svn_opt_revision_t rev;
- struct status_baton sb;
+ struct svn_cl__status_baton sb;
    svn_revnum_t repos_rev = SVN_INVALID_REVNUM;
    SVN_ERR (svn_opt_args_to_target_array2 (&targets, os,
@@ -169,7 +166,10 @@
    if (! opt_state->xml)
      svn_cl__get_notifier (&ctx->notify_func2, &ctx->notify_baton2,
FALSE,
                            FALSE, FALSE, pool);
-
+ struct svn_cl__notify_baton *nb = ctx->notify_baton2;
+ sb.nb = nb;
+ nb->sb = &sb;
+
    /* Add "." if user passed 0 arguments */
    svn_opt_push_implicit_dot_target(targets, pool);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Aug 6 00:19:37 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.