Author: rhuijben
Date: Thu Oct 11 14:58:07 2012
New Revision: 1397097

URL: http://svn.apache.org/viewvc?rev=1397097&view=rev
Log:
Simplify some code in 'svn cat' handling.

* subversion/libsvn_client/cat.c
  (svn_client__get_normalized_stream): Avoid a call to a wc_db function by
    only obtaining the time when necessary and even then in an existing call.

Modified:
    subversion/trunk/subversion/libsvn_client/cat.c

Modified: subversion/trunk/subversion/libsvn_client/cat.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/cat.c?rev=1397097&r1=1397096&r2=1397097&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/cat.c (original)
+++ subversion/trunk/subversion/libsvn_client/cat.c Thu Oct 11 14:58:07 2012
@@ -62,7 +62,6 @@ svn_client__get_normalized_stream(svn_st
   svn_string_t *eol_style, *keywords, *special;
   const char *eol = NULL;
   svn_boolean_t local_mod = FALSE;
-  apr_time_t tm;
   svn_stream_t *input;
   svn_node_kind_t kind;
 
@@ -118,27 +117,15 @@ svn_client__get_normalized_stream(svn_st
   if (eol_style)
     svn_subst_eol_style_from_value(&style, &eol, eol_style->data);
 
-  if (local_mod && (! special))
-    {
-      /* Use the modified time from the working copy if
-         the file */
-      SVN_ERR(svn_io_file_affected_time(&tm, local_abspath, scratch_pool));
-    }
-  else
-    {
-      SVN_ERR(svn_wc__node_get_changed_info(NULL, &tm, NULL, wc_ctx,
-                                            local_abspath, scratch_pool,
-                                            scratch_pool));
-    }
-
   if (keywords)
     {
       svn_revnum_t changed_rev;
       const char *rev_str;
       const char *author;
       const char *url;
+      apr_time_t tm;
 
-      SVN_ERR(svn_wc__node_get_changed_info(&changed_rev, NULL, &author, 
wc_ctx,
+      SVN_ERR(svn_wc__node_get_changed_info(&changed_rev, &tm, &author, wc_ctx,
                                             local_abspath, scratch_pool,
                                             scratch_pool));
       SVN_ERR(svn_wc__node_get_url(&url, wc_ctx, local_abspath, scratch_pool,
@@ -152,6 +139,13 @@ svn_client__get_normalized_stream(svn_st
              current user's username */
           rev_str = apr_psprintf(scratch_pool, "%ldM", changed_rev);
           author = _("(local)");
+
+          if (! special)
+            {
+              /* Use the modified time from the working copy for files */
+              SVN_ERR(svn_io_file_affected_time(&tm, local_abspath,
+                                                scratch_pool));
+            }
         }
       else
         {


Reply via email to