You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gb...@apache.org on 2013/07/08 12:50:32 UTC

svn commit: r1500647 - in /subversion/branches/invoke-diff-cmd-feature/subversion: include/svn_io.h libsvn_subr/deprecated.c libsvn_subr/io.c

Author: gbg
Date: Mon Jul  8 10:50:32 2013
New Revision: 1500647

URL: http://svn.apache.org/r1500647
Log:
On the invoke-diff-cmd branch: Deprecate svn_io_run_diff2.

* subversion/include/svn_io.h
  (svn_io_run_diff2): Deprecate function.

* subversion/libsvn_subr/io.c
  (svn_io_run_diff2): Remove function.

* subversion/libsvn_subr/deprecated.c
  (svn_io_run_diff2): New function.  

Modified:
    subversion/branches/invoke-diff-cmd-feature/subversion/include/svn_io.h
    subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/deprecated.c
    subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/io.c

Modified: subversion/branches/invoke-diff-cmd-feature/subversion/include/svn_io.h
URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/include/svn_io.h?rev=1500647&r1=1500646&r2=1500647&view=diff
==============================================================================
--- subversion/branches/invoke-diff-cmd-feature/subversion/include/svn_io.h (original)
+++ subversion/branches/invoke-diff-cmd-feature/subversion/include/svn_io.h Mon Jul  8 10:50:32 2013
@@ -1801,7 +1801,8 @@ svn_io_run_cmd(const char *path,
  *
  * Do all allocation in @a pool.
  * @since New in 1.6.0.
- */
+ * @deprecated Provided for backwards compatibility with the 1.6 API. */
+SVN_DEPRECATED
 svn_error_t *
 svn_io_run_diff2(const char *dir,
                  const char *const *user_args,

Modified: subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/deprecated.c?rev=1500647&r1=1500646&r2=1500647&view=diff
==============================================================================
--- subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/deprecated.c (original)
+++ subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/deprecated.c Mon Jul  8 10:50:32 2013
@@ -1302,3 +1302,52 @@ svn_subst_build_keywords(svn_subst_keywo
 }
 
 
+svn_error_t *
+svn_io_run_diff2(const char *dir,
+                 const char *const *user_args,
+                 int num_user_args,
+                 const char *label1,
+                 const char *label2,
+                 const char *from,
+                 const char *to,
+                 int *pexitcode,
+                 apr_file_t *outfile,
+                 apr_file_t *errfile,
+                 const char *diff_cmd,
+                 apr_pool_t *pool)
+{
+  svn_stringbuf_t *com;
+  com = svn_stringbuf_create_empty(pool);
+  svn_stringbuf_appendcstr(com, diff_cmd);
+  svn_stringbuf_appendcstr(com, " ");
+
+  if (user_args != NULL)
+    {
+      int j;
+      for (j = 0; j < num_user_args; ++j) {
+        svn_stringbuf_appendcstr(com, user_args[j]);
+        svn_stringbuf_appendcstr(com, " ");
+      }
+    }
+  else /* assume -u if the user didn't give us any args */
+    svn_stringbuf_appendcstr(com, "-u "); 
+
+  if (label1 != NULL)
+    svn_stringbuf_appendcstr(com,"-L ;l1 ");
+
+  if (label2 != NULL)
+    svn_stringbuf_appendcstr(com,"-L ;l2 ");
+
+  svn_stringbuf_appendcstr(com,";f1 ;f2 "); 
+
+  return diff2_err = svn_io_run_external_diff(dir,
+                                              label1,
+                                              label2,
+                                              from,
+                                              to,
+                                              pexitcode,
+                                              outfile,
+                                              errfile,
+                                              com->data,
+                                              pool);
+}

Modified: subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/io.c?rev=1500647&r1=1500646&r2=1500647&view=diff
==============================================================================
--- subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/invoke-diff-cmd-feature/subversion/libsvn_subr/io.c Mon Jul  8 10:50:32 2013
@@ -2832,95 +2832,6 @@ svn_io_run_cmd(const char *path,
   return svn_io_wait_for_cmd(&cmd_proc, cmd, exitcode, exitwhy, pool);
 }
 
-
-svn_error_t *
-svn_io_run_diff2(const char *dir,
-                 const char *const *user_args,
-                 int num_user_args,
-                 const char *label1,
-                 const char *label2,
-                 const char *from,
-                 const char *to,
-                 int *pexitcode,
-                 apr_file_t *outfile,
-                 apr_file_t *errfile,
-                 const char *diff_cmd,
-                 apr_pool_t *pool)
-{
-  const char **args;
-  int i;
-  int exitcode;
-  int nargs = 4; /* the diff command itself, two paths, plus a trailing NULL */
-  apr_pool_t *subpool = svn_pool_create(pool);
-
-  if (pexitcode == NULL)
-    pexitcode = &exitcode;
-
-  if (user_args != NULL)
-    nargs += num_user_args;
-  else
-    nargs += 1; /* -u */
-
-  if (label1 != NULL)
-    nargs += 2; /* the -L and the label itself */
-  if (label2 != NULL)
-    nargs += 2; /* the -L and the label itself */
-
-  args = apr_palloc(subpool, nargs * sizeof(char *));
-
-  i = 0;
-  args[i++] = diff_cmd;
-
-  if (user_args != NULL)
-    {
-      int j;
-      for (j = 0; j < num_user_args; ++j)
-        args[i++] = user_args[j];
-    }
-  else
-    args[i++] = "-u"; /* assume -u if the user didn't give us any args */
-
-  if (label1 != NULL)
-    {
-      args[i++] = "-L";
-      args[i++] = label1;
-    }
-  if (label2 != NULL)
-    {
-      args[i++] = "-L";
-      args[i++] = label2;
-    }
-
-  args[i++] = svn_dirent_local_style(from, subpool);
-  args[i++] = svn_dirent_local_style(to, subpool);
-  args[i++] = NULL;
-
-  SVN_ERR_ASSERT(i == nargs);
-
-  SVN_ERR(svn_io_run_cmd(dir, diff_cmd, args, pexitcode, NULL, TRUE,
-                         NULL, outfile, errfile, subpool));
-
-  /* The man page for (GNU) diff describes the return value as:
-
-       "An exit status of 0 means no differences were found, 1 means
-        some differences were found, and 2 means trouble."
-
-     A return value of 2 typically occurs when diff cannot read its input
-     or write to its output, but in any case we probably ought to return an
-     error for anything other than 0 or 1 as the output is likely to be
-     corrupt.
-   */
-  if (*pexitcode != 0 && *pexitcode != 1)
-    return svn_error_createf(SVN_ERR_EXTERNAL_PROGRAM, NULL,
-                             _("'%s' returned %d"),
-                             svn_dirent_local_style(diff_cmd, pool),
-                             *pexitcode);
-
-  svn_pool_destroy(subpool);
-
-  return SVN_NO_ERROR;
-}
-
 const char **
 svn_io_create_custom_diff_cmd(const char *label1,
                               const char *label2,