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

[PATCH] Add verbose support to blame

From: Ben Gollmer <ben_at_jatomail.net>
Date: 2004-02-15 02:11:29 CET

I was reading the thread 'annotate support for emacs', and I thought
I'd give this patching thing a shot. Yes, the date format is verbose,
but that's the way libsvn_subr/time.c said to do it.

Log:
* clients/cmdline/main.c: Add '-v | --verbose' switch support to
     svn blame.
* clients/cmdline/blame-cmd.c
     (svn__cl_blame): Pass the verbose argument to svn_client_blame().
     (blame_reciever): If the verbose argument is present, format the
     date and include it in the output.
* include/svn_client.h: Add 'svn_boolean_t verbose' argument to
     the declaration of svn_client_blame().
* libsvn_client/blame.c
     (svn_client_blame): Pass the verbose argument to blame receiver.

Index: subversion/include/svn_client.h
===================================================================
--- subversion/include/svn_client.h (revision 8640)
+++ subversion/include/svn_client.h (working copy)
@@ -332,6 +332,7 @@
                                  const char *author,
                                  const char *date,
                                  const char *line,
+ svn_boolean_t verbose,
                                  apr_pool_t *pool);

@@ -752,6 +753,7 @@
  svn_client_blame (const char *path_or_url,
                    const svn_opt_revision_t *start,
                    const svn_opt_revision_t *end,
+ svn_boolean_t verbose,
                    svn_client_blame_receiver_t receiver,
                    void *receiver_baton,
                    svn_client_ctx_t *ctx,
Index: subversion/libsvn_client/blame.c
===================================================================
--- subversion/libsvn_client/blame.c (revision 8640)
+++ subversion/libsvn_client/blame.c (working copy)
@@ -339,6 +339,7 @@
  svn_client_blame (const char *target,
                    const svn_opt_revision_t *start,
                    const svn_opt_revision_t *end,
+ svn_boolean_t verbose,
                    svn_client_blame_receiver_t receiver,
                    void *receiver_baton,
                    svn_client_ctx_t *ctx,
@@ -567,7 +568,7 @@
            if (!eof || sb->len)
              SVN_ERR (receiver (receiver_baton, line_no,
walk->rev->revision,
                                 walk->rev->author, walk->rev->date,
- sb->data, iterpool));
+ sb->data, verbose, iterpool));
            if (eof) break;
          }
      }
Index: subversion/clients/cmdline/blame-cmd.c
===================================================================
--- subversion/clients/cmdline/blame-cmd.c (revision 8640)
+++ subversion/clients/cmdline/blame-cmd.c (working copy)
@@ -22,6 +22,7 @@
  #include "svn_error.h"
  #include "svn_pools.h"
  #include "svn_cmdline.h"
+#include "svn_time.h"
  #include "cl.h"

  
@@ -33,14 +34,27 @@
                  const char *author,
                  const char *date,
                  const char *line,
+ svn_boolean_t print_date,
                  apr_pool_t *pool)
  {
    svn_stream_t *out = baton;
+ apr_time_t atime;
+ const char *time_utf8;
+ const char *time_stdout;
+
+ if (print_date)
+ {
+ SVN_ERR (svn_time_from_cstring (&atime, date, pool));
+ time_utf8 = svn_time_to_human_cstring (atime, pool);
+ SVN_ERR (svn_cmdline_cstring_from_utf8 (&time_stdout, time_utf8,
pool));
+ }
+
    const char *rev_str = SVN_IS_VALID_REVNUM (revision)
                          ? apr_psprintf (pool, "%6" SVN_REVNUM_T_FMT,
revision)
                          : " -";
- return svn_stream_printf (out, pool, "%s %10s %s\n", rev_str,
- author ? author : " -", line);
+ return svn_stream_printf (out, pool, "%s %10s %s %s\n", rev_str,
+ author ? author : " -",
+ print_date ? time_stdout : "", line);
  }

@@ -100,6 +114,7 @@
        err = svn_client_blame (target,
                                &opt_state->start_revision,
                                &opt_state->end_revision,
+ opt_state->verbose,
                                blame_receiver,
                                out,
                                ctx,
Index: subversion/clients/cmdline/main.c
===================================================================
--- subversion/clients/cmdline/main.c (revision 8640)
+++ subversion/clients/cmdline/main.c (working copy)
@@ -161,7 +161,7 @@
      "Output the content of specified files or\n"
      "URLs with revision and author information in-line.\n"
      "usage: blame TARGET...\n",
- {'r', SVN_CL__AUTH_OPTIONS, svn_cl__config_dir_opt} },
+ {'r', 'v', SVN_CL__AUTH_OPTIONS, svn_cl__config_dir_opt} },

    { "cat", svn_cl__cat, {0},
      "Output the content of specified files or URLs.\n"

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Feb 15 03:52:38 2004

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