Author: rhuijben
Date: Sat May 19 00:21:31 2012
New Revision: 1340318

URL: http://svn.apache.org/viewvc?rev=1340318&view=rev
Log:
Avoid an unneeded ancestor check in the status walker. This has the added
benefit that api users can now see a different error code for not in a working
copy and not below a working copy.

* subversion/libsvn_client/status.c
  (svn_client_status5): Don't perform an unneeded ancestor check when not using
    the status editor.

* subversion/svn/status-cmd.c
  (svn_cl__status): Add the standard node not found error.

* subversion/tests/cmdline/stat_tests.py
  (status_on_unversioned_dotdot): Use run_and_verify_svn2 to verify the exit
    code and warning text.

Modified:
    subversion/trunk/subversion/libsvn_client/status.c
    subversion/trunk/subversion/svn/status-cmd.c
    subversion/trunk/subversion/tests/cmdline/stat_tests.py

Modified: subversion/trunk/subversion/libsvn_client/status.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/status.c?rev=1340318&r1=1340317&r2=1340318&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/status.c (original)
+++ subversion/trunk/subversion/libsvn_client/status.c Sat May 19 00:21:31 2012
@@ -292,40 +292,51 @@ svn_client_status5(svn_revnum_t *result_
   sb.wc_ctx = ctx->wc_ctx;
 
   SVN_ERR(svn_dirent_get_absolute(&target_abspath, path, pool));
-  {
-    svn_node_kind_t kind;
 
-    SVN_ERR(svn_wc_read_kind(&kind, ctx->wc_ctx, target_abspath, FALSE, pool));
+  if (update)
+    {
+      /* The status editor only works on directories, so get the ancestor
+         if necessary */
+
+     svn_node_kind_t kind;
+
+     SVN_ERR(svn_wc_read_kind(&kind, ctx->wc_ctx, target_abspath, FALSE,
+                              pool));
 
-    /* Dir must be a working copy directory or the status editor fails */
-    if (kind == svn_node_dir)
-      {
-        dir_abspath = target_abspath;
-        target_basename = "";
-        dir = path;
-      }
-    else
-      {
-        dir_abspath = svn_dirent_dirname(target_abspath, pool);
-        target_basename = svn_dirent_basename(target_abspath, NULL);
-        dir = svn_dirent_dirname(path, pool);
-
-        if (kind != svn_node_file)
-          {
-            err = svn_wc_read_kind(&kind, ctx->wc_ctx, dir_abspath, FALSE,
-                                   pool);
-
-            svn_error_clear(err);
-
-            if (err || kind != svn_node_dir)
-              {
-                return svn_error_createf(SVN_ERR_WC_NOT_WORKING_COPY, NULL,
-                                         _("'%s' is not a working copy"),
-                                         svn_dirent_local_style(path, pool));
-              }
-          }
-      }
-  }
+     /* Dir must be a working copy directory or the status editor fails */
+     if (kind == svn_node_dir)
+       {
+         dir_abspath = target_abspath;
+         target_basename = "";
+         dir = path;
+       }
+     else
+       {
+         dir_abspath = svn_dirent_dirname(target_abspath, pool);
+         target_basename = svn_dirent_basename(target_abspath, NULL);
+         dir = svn_dirent_dirname(path, pool);
+
+         if (kind != svn_node_file)
+           {
+             err = svn_wc_read_kind(&kind, ctx->wc_ctx, dir_abspath, FALSE,
+                                    pool);
+
+             svn_error_clear(err);
+
+             if (err || kind != svn_node_dir)
+               {
+                 return svn_error_createf(SVN_ERR_WC_NOT_WORKING_COPY, NULL,
+                                          _("'%s' is not a working copy"),
+                                          svn_dirent_local_style(path, pool));
+               }
+           }
+       }
+    }
+  else
+    {
+      dir = path;
+      dir_abspath = target_abspath;
+    }
 
   if (svn_dirent_is_absolute(dir))
     {

Modified: subversion/trunk/subversion/svn/status-cmd.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/status-cmd.c?rev=1340318&r1=1340317&r2=1340318&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/status-cmd.c (original)
+++ subversion/trunk/subversion/svn/status-cmd.c Sat May 19 00:21:31 2012
@@ -349,7 +349,7 @@ svn_cl__status(apr_getopt_t *os,
                           NULL, opt_state->quiet,
                           /* not versioned: */
                           SVN_ERR_WC_NOT_WORKING_COPY,
-                          SVN_NO_ERROR));
+                          SVN_ERR_WC_PATH_NOT_FOUND));
 
       if (opt_state->xml)
         SVN_ERR(print_finish_target_xml(repos_rev, iterpool));

Modified: subversion/trunk/subversion/tests/cmdline/stat_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/stat_tests.py?rev=1340318&r1=1340317&r2=1340318&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/stat_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/stat_tests.py Sat May 19 00:21:31 
2012
@@ -814,12 +814,9 @@ def status_on_unversioned_dotdot(sbox):
   os.mkdir(new_subsub)
 
   os.chdir(new_subsub)
-  exit_code, out, err = svntest.main.run_svn(1, 'st', '..')
-  for line in err:
-    if line.find('svn: warning: W155007: \'..\' is not a working copy') != -1:
-      break
-  else:
-    raise svntest.Failure
+  svntest.actions.run_and_verify_svn2(None, None,
+                                     "svn: warning: W155(010|007):.*'.*'.*not",
+                                      0, 'st', '..')
 
 #----------------------------------------------------------------------
 


Reply via email to