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/12/07 16:25:07 UTC

svn commit: r1817393 - /subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelve.c

Author: julianfoad
Date: Thu Dec  7 16:25:07 2017
New Revision: 1817393

URL: http://svn.apache.org/viewvc?rev=1817393&view=rev
Log:
On the 'shelve-checkpoint' branch: Implement an export-as-patch command.

svn savepoint|sp|checkpoint export NAME [VERSION]

* subversion/include/svn_client.h,
  subversion/libsvn_client/shelve.c
  (svn_client_shelf_export_patch): New.
  (svn_client_shelf_version_get_info): Bail out if not found. (Unrelated.)

* subversion/svn/shelve-cmd.c
  (export_as_patch): New.
  (svn_cl__checkpoint): Call it when 'export' command is used.

* subversion/svn/svn.c
  (svn_cl__cmd_table): Update the command help.

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

Modified: subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelve.c
URL: http://svn.apache.org/viewvc/subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelve.c?rev=1817393&r1=1817392&r2=1817393&view=diff
==============================================================================
--- subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelve.c (original)
+++ subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelve.c Thu Dec  7 16:25:07 2017
@@ -468,6 +468,25 @@ svn_client_shelf_get_files(apr_array_hea
 }
 
 svn_error_t *
+svn_client_shelf_export_patch(svn_client_shelf_t *shelf,
+                              int version,
+                              svn_stream_t *outstream,
+                              apr_pool_t *scratch_pool)
+{
+  const char *patch_abspath;
+  svn_stream_t *instream;
+
+  SVN_ERR(get_existing_patch_abspath(&patch_abspath, shelf, version,
+                                     scratch_pool, scratch_pool));
+  SVN_ERR(svn_stream_open_readonly(&instream, patch_abspath,
+                                   scratch_pool, scratch_pool));
+  SVN_ERR(svn_stream_copy3(instream,
+                           svn_stream_disown(outstream, scratch_pool),
+                           NULL, NULL, scratch_pool));
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
 svn_client_shelf_save_new_version(svn_client_shelf_t *shelf,
                                   const apr_array_header_t *paths,
                                   svn_depth_t depth,
@@ -589,8 +608,8 @@ svn_client_shelf_version_get_info(svn_cl
     = apr_palloc(result_pool, sizeof(*info));
   const svn_io_dirent2_t *dirent;
 
-  SVN_ERR(get_patch_abspath(&info->patch_abspath, shelf, version,
-                            result_pool, scratch_pool));
+  SVN_ERR(get_existing_patch_abspath(&info->patch_abspath, shelf, version,
+                                     result_pool, scratch_pool));
   SVN_ERR(svn_io_stat_dirent2(&dirent,
                               info->patch_abspath,
                               FALSE /*verify_truename*/,