You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2017/07/14 14:03:25 UTC

svn commit: r1801967 - in /subversion/branches/shelve-checkpoint/subversion: libsvn_client/checkpoint.c svn/checkpoint-cmd.c

Author: julianfoad
Date: Fri Jul 14 14:03:24 2017
New Revision: 1801967

URL: http://svn.apache.org/viewvc?rev=1801967&view=rev
Log:
On the 'shelve-checkpoint' branch: make 'svn checkpoint list' more verbose.

* subversion/libsvn_client/checkpoint.c
  (svn_client_checkpoint_list): Retrieve more stats including file size and
    mtime.

* subversion/svn/checkpoint-cmd.c
  (checkpoint_list): Print each patch's age and size, and run 'diffstat' if
    found in the path.
  (svn_cl__checkpoint,
   svn_cl__checkpoints): Update caller.

Modified:
    subversion/branches/shelve-checkpoint/subversion/libsvn_client/checkpoint.c
    subversion/branches/shelve-checkpoint/subversion/svn/checkpoint-cmd.c

Modified: subversion/branches/shelve-checkpoint/subversion/libsvn_client/checkpoint.c
URL: http://svn.apache.org/viewvc/subversion/branches/shelve-checkpoint/subversion/libsvn_client/checkpoint.c?rev=1801967&r1=1801966&r2=1801967&view=diff
==============================================================================
--- subversion/branches/shelve-checkpoint/subversion/libsvn_client/checkpoint.c (original)
+++ subversion/branches/shelve-checkpoint/subversion/libsvn_client/checkpoint.c Fri Jul 14 14:03:24 2017
@@ -258,7 +258,7 @@ svn_client_checkpoint_list(apr_array_hea
   SVN_ERR(svn_wc__get_shelves_dir(&checkpoints_dir, ctx->wc_ctx, local_abspath,
                                   scratch_pool, scratch_pool));
   SVN_ERR(svn_io_get_dirents3(&dirents, checkpoints_dir,
-                              TRUE /*only_check_type*/,
+                              FALSE /*only_check_type*/,
                               scratch_pool, scratch_pool));
 
   /* Remove non-checkpoint entries */

Modified: subversion/branches/shelve-checkpoint/subversion/svn/checkpoint-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/shelve-checkpoint/subversion/svn/checkpoint-cmd.c?rev=1801967&r1=1801966&r2=1801967&view=diff
==============================================================================
--- subversion/branches/shelve-checkpoint/subversion/svn/checkpoint-cmd.c (original)
+++ subversion/branches/shelve-checkpoint/subversion/svn/checkpoint-cmd.c Fri Jul 14 14:03:24 2017
@@ -36,6 +36,7 @@
 /*  */
 static svn_error_t *
 checkpoint_list(const char *local_abspath,
+                svn_boolean_t diffstat,
                 svn_client_ctx_t *ctx,
                 apr_pool_t *scratch_pool)
 {
@@ -57,9 +58,22 @@ checkpoint_list(const char *local_abspat
     {
       svn_sort__item_t *item = &APR_ARRAY_IDX(checkpoints, i, svn_sort__item_t);
       const char *name = item->key;
+      svn_io_dirent2_t *dirent = item->value;
       char marker = ((strcmp(name, current_checkpoint_name) == 0) ? '*' : ' ');
+      int age = (apr_time_now() - dirent->mtime) / 1000000 / 60;
 
-      printf("%c %s\n", marker, name);
+      printf("%c %s %6d mins old %10ld bytes\n",
+             marker, name, age, (long)dirent->filesize);
+
+      if (diffstat)
+        {
+          char *path = svn_path_join_many(scratch_pool,
+                                          local_abspath, ".svn/shelves", name,
+                                          SVN_VA_NULL);
+
+          system(apr_psprintf(scratch_pool, "diffstat %s 2> /dev/null", path));
+          printf("\n");
+        }
     }
 
   return SVN_NO_ERROR;
@@ -179,7 +193,9 @@ svn_cl__checkpoint(apr_getopt_t *os,
         return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
                                 _("Too many arguments"));
 
-      SVN_ERR(checkpoint_list(local_abspath, ctx, pool));
+      SVN_ERR(checkpoint_list(local_abspath,
+                              ! opt_state->quiet /*diffstat*/,
+                              ctx, pool));
     }
   else if (strcmp(subsubcommand, "save") == 0)
     {
@@ -258,6 +274,6 @@ svn_cl__checkpoints(apr_getopt_t *os,
 
   SVN_ERR(svn_dirent_get_absolute(&local_abspath, "", pool));
 
-  SVN_ERR(checkpoint_list(local_abspath, ctx, pool));
+  SVN_ERR(checkpoint_list(local_abspath, TRUE/*diffstat*/, ctx, pool));
   return SVN_NO_ERROR;
 }