subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svn-r...@apache.org
Subject svn commit: r1499195 - in /subversion/branches/1.8.x: ./ STATUS subversion/include/private/svn_io_private.h subversion/libsvn_client/diff.c subversion/libsvn_subr/stream.c subversion/svnlook/svnlook.c
Date Wed, 03 Jul 2013 04:00:57 GMT
Author: svn-role
Date: Wed Jul  3 04:00:56 2013
New Revision: 1499195

URL: http://svn.apache.org/r1499195
Log:
Merge r1497002 from trunk:

 * r1497002
   Avoid temporary files when calling external diff. Fixes issue 4382.
   Justification:
     Regression from 1.7.
   Votes:
     +1: philip, stsp, rhuijben

Modified:
    subversion/branches/1.8.x/   (props changed)
    subversion/branches/1.8.x/STATUS
    subversion/branches/1.8.x/subversion/include/private/svn_io_private.h
    subversion/branches/1.8.x/subversion/libsvn_client/diff.c
    subversion/branches/1.8.x/subversion/libsvn_subr/stream.c
    subversion/branches/1.8.x/subversion/svnlook/svnlook.c

Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1497002

Modified: subversion/branches/1.8.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1499195&r1=1499194&r2=1499195&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Wed Jul  3 04:00:56 2013
@@ -208,13 +208,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1497002
-   Avoid temporary files when calling external diff. Fixes issue 4382.
-   Justification:
-     Regression from 1.7.
-   Votes:
-     +1: philip, stsp, rhuijben
-
  * r1493703, r1494171
    Fix upgrade notification for explicit upgrades of post-WC-NG working copies.
    Justification:

Modified: subversion/branches/1.8.x/subversion/include/private/svn_io_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/include/private/svn_io_private.h?rev=1499195&r1=1499194&r2=1499195&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/include/private/svn_io_private.h (original)
+++ subversion/branches/1.8.x/subversion/include/private/svn_io_private.h Wed Jul  3 04:00:56
2013
@@ -90,6 +90,11 @@ svn_stream__set_is_buffered(svn_stream_t
 svn_boolean_t
 svn_stream__is_buffered(svn_stream_t *stream);
 
+/** Return the underlying file, if any, associated with the stream, or
+ * NULL if not available.  Accessing the file bypasses the stream.
+ */
+apr_file_t *
+svn_stream__aprfile(svn_stream_t *stream);
 
 #ifdef __cplusplus
 }

Modified: subversion/branches/1.8.x/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_client/diff.c?rev=1499195&r1=1499194&r2=1499195&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_client/diff.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_client/diff.c Wed Jul  3 04:00:56 2013
@@ -51,6 +51,7 @@
 #include "private/svn_wc_private.h"
 #include "private/svn_diff_private.h"
 #include "private/svn_subr_private.h"
+#include "private/svn_io_private.h"
 
 #include "svn_private_config.h"
 
@@ -807,14 +808,23 @@ diff_content_changed(svn_boolean_t *wrot
        * ### a non-git compatible diff application.*/
 
       /* We deal in streams, but svn_io_run_diff2() deals in file handles,
-         unfortunately, so we need to make these temporary files, and then
-         copy the contents to our stream. */
-      SVN_ERR(svn_io_open_unique_file3(&outfile, &outfilename, NULL,
-                                       svn_io_file_del_on_pool_cleanup,
-                                       scratch_pool, scratch_pool));
-      SVN_ERR(svn_io_open_unique_file3(&errfile, &errfilename, NULL,
-                                       svn_io_file_del_on_pool_cleanup,
-                                       scratch_pool, scratch_pool));
+         so we may need to make temporary files and then copy the contents
+         to our stream. */
+      outfile = svn_stream__aprfile(outstream);
+      if (outfile)
+        outfilename = NULL;
+      else
+        SVN_ERR(svn_io_open_unique_file3(&outfile, &outfilename, NULL,
+                                         svn_io_file_del_on_pool_cleanup,
+                                         scratch_pool, scratch_pool));
+
+      errfile = svn_stream__aprfile(errstream);
+      if (errfile)
+        errfilename = NULL;
+      else
+        SVN_ERR(svn_io_open_unique_file3(&errfile, &errfilename, NULL,
+                                         svn_io_file_del_on_pool_cleanup,
+                                         scratch_pool, scratch_pool));
 
       SVN_ERR(svn_io_run_diff2(".",
                                diff_cmd_baton->options.for_external.argv,
@@ -824,20 +834,25 @@ diff_content_changed(svn_boolean_t *wrot
                                &exitcode, outfile, errfile,
                                diff_cmd_baton->diff_cmd, scratch_pool));
 
-      SVN_ERR(svn_io_file_close(outfile, scratch_pool));
-      SVN_ERR(svn_io_file_close(errfile, scratch_pool));
-
       /* Now, open and copy our files to our output streams. */
-      SVN_ERR(svn_stream_open_readonly(&stream, outfilename,
-                                       scratch_pool, scratch_pool));
-      SVN_ERR(svn_stream_copy3(stream, svn_stream_disown(outstream,
-                               scratch_pool),
-                               NULL, NULL, scratch_pool));
-      SVN_ERR(svn_stream_open_readonly(&stream, errfilename,
-                                       scratch_pool, scratch_pool));
-      SVN_ERR(svn_stream_copy3(stream, svn_stream_disown(errstream,
-                                                         scratch_pool),
-                               NULL, NULL, scratch_pool));
+      if (outfilename)
+        {
+          SVN_ERR(svn_io_file_close(outfile, scratch_pool));
+          SVN_ERR(svn_stream_open_readonly(&stream, outfilename,
+                                           scratch_pool, scratch_pool));
+          SVN_ERR(svn_stream_copy3(stream, svn_stream_disown(outstream,
+                                                             scratch_pool),
+                                   NULL, NULL, scratch_pool));
+        }
+      if (errfilename)
+        {
+          SVN_ERR(svn_io_file_close(errfile, scratch_pool));
+          SVN_ERR(svn_stream_open_readonly(&stream, errfilename,
+                                           scratch_pool, scratch_pool));
+          SVN_ERR(svn_stream_copy3(stream, svn_stream_disown(errstream,
+                                                             scratch_pool),
+                                   NULL, NULL, scratch_pool));
+        }
 
       /* We have a printed a diff for this path, mark it as visited. */
       *wrote_header = TRUE;

Modified: subversion/branches/1.8.x/subversion/libsvn_subr/stream.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_subr/stream.c?rev=1499195&r1=1499194&r2=1499195&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_subr/stream.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_subr/stream.c Wed Jul  3 04:00:56 2013
@@ -56,6 +56,7 @@ struct svn_stream_t {
   svn_stream_mark_fn_t mark_fn;
   svn_stream_seek_fn_t seek_fn;
   svn_stream__is_buffered_fn_t is_buffered_fn;
+  apr_file_t *file; /* Maybe NULL */
 };
 
 
@@ -81,6 +82,7 @@ svn_stream_create(void *baton, apr_pool_
   stream->mark_fn = NULL;
   stream->seek_fn = NULL;
   stream->is_buffered_fn = NULL;
+  stream->file = NULL;
   return stream;
 }
 
@@ -913,6 +915,7 @@ svn_stream_from_aprfile2(apr_file_t *fil
   svn_stream_set_mark(stream, mark_handler_apr);
   svn_stream_set_seek(stream, seek_handler_apr);
   svn_stream__set_is_buffered(stream, is_buffered_handler_apr);
+  stream->file = file;
 
   if (! disown)
     svn_stream_set_close(stream, close_handler_apr);
@@ -920,6 +923,12 @@ svn_stream_from_aprfile2(apr_file_t *fil
   return stream;
 }
 
+apr_file_t *
+svn_stream__aprfile(svn_stream_t *stream)
+{
+  return stream->file;
+}
+
 
 /* Compressed stream support */
 

Modified: subversion/branches/1.8.x/subversion/svnlook/svnlook.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/svnlook/svnlook.c?rev=1499195&r1=1499194&r2=1499195&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/svnlook/svnlook.c (original)
+++ subversion/branches/1.8.x/subversion/svnlook/svnlook.c Wed Jul  3 04:00:56 2013
@@ -57,6 +57,7 @@
 #include "private/svn_diff_private.h"
 #include "private/svn_cmdline_private.h"
 #include "private/svn_fspath.h"
+#include "private/svn_io_private.h"
 
 #include "svn_private_config.h"
 
@@ -983,12 +984,21 @@ print_diff_tree(svn_stream_t *out_stream
               SVN_ERR(generate_label(&new_label, root, path, pool));
 
               /* We deal in streams, but svn_io_run_diff2() deals in file
-                 handles, unfortunately, so we need to make these temporary
-                 files, and then copy the contents to our stream. */
-              SVN_ERR(svn_io_open_unique_file3(&outfile, &outfilename, NULL,
-                        svn_io_file_del_on_pool_cleanup, pool, pool));
-              SVN_ERR(svn_io_open_unique_file3(&errfile, &errfilename, NULL,
-                        svn_io_file_del_on_pool_cleanup, pool, pool));
+                 handles, so we may need to make temporary files and then
+                 copy the contents to our stream. */
+              outfile = svn_stream__aprfile(out_stream);
+              if (outfile)
+                outfilename = NULL;
+              else
+                SVN_ERR(svn_io_open_unique_file3(&outfile, &outfilename, NULL,
+                          svn_io_file_del_on_pool_cleanup, pool, pool));
+              SVN_ERR(svn_stream_for_stderr(&err_stream, pool));
+              errfile = svn_stream__aprfile(err_stream);
+              if (errfile)
+                errfilename = NULL;
+              else
+                SVN_ERR(svn_io_open_unique_file3(&errfile, &errfilename, NULL,
+                          svn_io_file_del_on_pool_cleanup, pool, pool));
 
               SVN_ERR(svn_io_run_diff2(".",
                                        diff_cmd_argv,
@@ -998,21 +1008,25 @@ print_diff_tree(svn_stream_t *out_stream
                                        &exitcode, outfile, errfile,
                                        c->diff_cmd, pool));
 
-              SVN_ERR(svn_io_file_close(outfile, pool));
-              SVN_ERR(svn_io_file_close(errfile, pool));
-
               /* Now, open and copy our files to our output streams. */
-              SVN_ERR(svn_stream_for_stderr(&err_stream, pool));
-              SVN_ERR(svn_stream_open_readonly(&stream, outfilename,
-                                               pool, pool));
-              SVN_ERR(svn_stream_copy3(stream,
-                                       svn_stream_disown(out_stream, pool),
-                                       NULL, NULL, pool));
-              SVN_ERR(svn_stream_open_readonly(&stream, errfilename,
-                                               pool, pool));
-              SVN_ERR(svn_stream_copy3(stream,
-                                       svn_stream_disown(err_stream, pool),
-                                       NULL, NULL, pool));
+              if (outfilename)
+                {
+                  SVN_ERR(svn_io_file_close(outfile, pool));
+                  SVN_ERR(svn_stream_open_readonly(&stream, outfilename,
+                                                   pool, pool));
+                  SVN_ERR(svn_stream_copy3(stream,
+                                           svn_stream_disown(out_stream, pool),
+                                           NULL, NULL, pool));
+                }
+              if (errfilename)
+                {
+                  SVN_ERR(svn_io_file_close(errfile, pool));
+                  SVN_ERR(svn_stream_open_readonly(&stream, errfilename,
+                                                   pool, pool));
+                  SVN_ERR(svn_stream_copy3(stream,
+                                           svn_stream_disown(err_stream, pool),
+                                           NULL, NULL, pool));
+                }
 
               SVN_ERR(svn_stream_printf_from_utf8(out_stream, encoding, pool,
                                                   "\n"));



Mime
View raw message