subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1817400 - in /subversion/trunk: ./ subversion/include/svn_client.h subversion/libsvn_client/shelve.c subversion/svn/shelve-cmd.c
Date Thu, 07 Dec 2017 17:26:13 GMT
Author: julianfoad
Date: Thu Dec  7 17:26:13 2017
New Revision: 1817400

URL: http://svn.apache.org/viewvc?rev=1817400&view=rev
Log:
Merge r1817320 from the 'shelve-checkpoint' branch: Add an API to get the
affected paths. Use it in 'svn shelves' to print how many paths are affected.

* subversion/include/svn_client.h,
  subversion/libsvn_client/shelve.c
  (svn_client_shelf_get_paths): New.

* subversion/svn/shelve-cmd.c
  (shelves_list): Use it.

Modified:
    subversion/trunk/   (props changed)
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/libsvn_client/shelve.c
    subversion/trunk/subversion/svn/shelve-cmd.c

Propchange: subversion/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Dec  7 17:26:13 2017
@@ -76,7 +76,7 @@
 /subversion/branches/revprop-caching-ng:1620597,1620599
 /subversion/branches/revprop-packing:1143907,1143971,1143997,1144017,1144499,1144568,1146145
 /subversion/branches/shelve:1802592-1815226
-/subversion/branches/shelve-checkpoint:1801593-1801923,1801970
+/subversion/branches/shelve-checkpoint:1801593-1801923,1801970,1817320
 /subversion/branches/subtree-mergeinfo:876734-878766
 /subversion/branches/svn-auth-x509:1603509-1655900
 /subversion/branches/svn-info-detail:1660035-1662618

Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1817400&r1=1817399&r2=1817400&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Thu Dec  7 17:26:13 2017
@@ -6828,6 +6828,22 @@ svn_client_shelves_any(svn_boolean_t *an
                        svn_client_ctx_t *ctx,
                        apr_pool_t *scratch_pool);
 
+/** Set @a *affected_paths to a hash with one entry for each path affected
+ * by the shelf @a name. The hash key is the old path and value is
+ * the new path, both relative to the WC root. The key and value are the
+ * same except when a path is moved or copied.
+ *
+ * @since New in 1.X.
+ */
+SVN_EXPERIMENTAL
+svn_error_t *
+svn_client_shelf_get_paths(apr_hash_t **affected_paths,
+                           const char *name,
+                           const char *local_abspath,
+                           svn_client_ctx_t *ctx,
+                           apr_pool_t *result_pool,
+                           apr_pool_t *scratch_pool);
+
 /** Write local changes to a patch file for shelved change @a name.
  *
  * @a message: An optional log message.

Modified: subversion/trunk/subversion/libsvn_client/shelve.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/shelve.c?rev=1817400&r1=1817399&r2=1817400&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/shelve.c (original)
+++ subversion/trunk/subversion/libsvn_client/shelve.c Thu Dec  7 17:26:13 2017
@@ -340,6 +340,50 @@ svn_client_shelves_delete(const char *na
   return SVN_NO_ERROR;
 }
 
+svn_error_t *
+svn_client_shelf_get_paths(apr_hash_t **affected_paths,
+                           const char *name,
+                           const char *local_abspath,
+                           svn_client_ctx_t *ctx,
+                           apr_pool_t *result_pool,
+                           apr_pool_t *scratch_pool)
+{
+  const char *wc_root_abspath;
+  char *patch_abspath;
+  svn_patch_file_t *patch_file;
+  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+  apr_hash_t *paths = apr_hash_make(result_pool);
+
+  SVN_ERR(validate_name(name, scratch_pool));
+
+  SVN_ERR(svn_client_get_wc_root(&wc_root_abspath,
+                                 local_abspath, ctx, scratch_pool, scratch_pool));
+  SVN_ERR(get_patch_abspath(&patch_abspath, name, wc_root_abspath,
+                            ctx, scratch_pool, scratch_pool));
+  SVN_ERR(svn_diff_open_patch_file(&patch_file, patch_abspath, result_pool));
+
+  while (1)
+    {
+      svn_patch_t *patch;
+
+      svn_pool_clear(iterpool);
+      SVN_ERR(svn_diff_parse_next_patch(&patch, patch_file,
+                                        FALSE /*reverse*/,
+                                        FALSE /*ignore_whitespace*/,
+                                        iterpool, iterpool));
+      if (! patch)
+        break;
+      svn_hash_sets(paths,
+                    apr_pstrdup(result_pool, patch->old_filename),
+                    apr_pstrdup(result_pool, patch->new_filename));
+    }
+  SVN_ERR(svn_diff_close_patch_file(patch_file, iterpool));
+  svn_pool_destroy(iterpool);
+
+  *affected_paths = paths;
+  return SVN_NO_ERROR;
+}
+
 /* Set *LOGMSG to the log message stored in the file PATCH_ABSPATH.
  *
  * ### Currently just reads the first line.

Modified: subversion/trunk/subversion/svn/shelve-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/shelve-cmd.c?rev=1817400&r1=1817399&r2=1817400&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/shelve-cmd.c (original)
+++ subversion/trunk/subversion/svn/shelve-cmd.c Thu Dec  7 17:26:13 2017
@@ -103,10 +103,16 @@ shelves_list(const char *local_abspath,
       const char *name = item->key;
       svn_client_shelved_patch_info_t *info = item->value;
       int age = (int)((apr_time_now() - info->mtime) / 1000000 / 60);
+      apr_hash_t *paths;
+
+      SVN_ERR(svn_client_shelf_get_paths(&paths,
+                                         name, local_abspath, ctx,
+                                         scratch_pool, scratch_pool));
 
       SVN_ERR(svn_cmdline_printf(scratch_pool,
-                                 _("%-30s %6d mins old %10ld bytes\n"),
-                                 name, age, (long)info->dirent->filesize));
+                                 _("%-30s %6d mins old %10ld bytes %4d paths changed\n"),
+                                 name, age, (long)info->dirent->filesize,
+                                 apr_hash_count(paths)));
       SVN_ERR(svn_cmdline_printf(scratch_pool,
                                  _(" %.50s\n"),
                                  info->message));



Mime
View raw message