Author: rhuijben
Date: Fri Jun  1 21:50:30 2012
New Revision: 1345361

URL: http://svn.apache.org/viewvc?rev=1345361&view=rev
Log:
Make the result of calling status on an unversioned directory inside a working
copy easier to understand.
(This is a followup to r1340318)

* subversion/libsvn_wc/status.c
  (svn_wc__internal_walk_status): Avoid an unneeded db call when there is no
    node. Provide a better error message when a node and its parent are not
    versioned, but are both below a working copy.

* subversion/tests/cmdline/stat_tests.py
  (status_unversioned_dir): Update expected result to handle testing in and
    out of tree.

Modified:
    subversion/trunk/subversion/libsvn_wc/status.c
    subversion/trunk/subversion/tests/cmdline/stat_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/status.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/status.c?rev=1345361&r1=1345360&r2=1345361&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/status.c (original)
+++ subversion/trunk/subversion/libsvn_wc/status.c Fri Jun  1 21:50:30 2012
@@ -2649,9 +2649,6 @@ svn_wc__internal_walk_status(svn_wc__db_
   wb.repos_root = NULL;
   wb.repos_locks = NULL;
 
-  SVN_ERR(svn_wc__db_externals_defined_below(&wb.externals, db, local_abspath,
-                                             scratch_pool, scratch_pool));
-
   /* Use the caller-provided ignore patterns if provided; the build-time
      configured defaults otherwise. */
   if (!ignore_patterns)
@@ -2673,7 +2670,12 @@ svn_wc__internal_walk_status(svn_wc__db_
         }
       else
         return svn_error_trace(err);
+
+      wb.externals = apr_hash_make(scratch_pool);
     }
+  else
+    SVN_ERR(svn_wc__db_externals_defined_below(&wb.externals, db, 
local_abspath,
+                                               scratch_pool, scratch_pool));
 
   SVN_ERR(svn_io_stat_dirent(&dirent, local_abspath, TRUE,
                              scratch_pool, scratch_pool));
@@ -2703,15 +2705,27 @@ svn_wc__internal_walk_status(svn_wc__db_
       /* It may be a file or an unversioned item. And this is an explicit
        * target, so no ignoring. An unversioned item (file or dir) shows a
        * status like '?', and can yield a tree conflicted path. */
-      SVN_ERR(get_child_status(&wb,
-                               local_abspath,
-                               info,
-                               dirent,
-                               ignore_patterns,
-                               get_all,
-                               status_func, status_baton,
-                               cancel_func, cancel_baton,
-                               scratch_pool));
+      err = get_child_status(&wb,
+                             local_abspath,
+                             info,
+                             dirent,
+                             ignore_patterns,
+                             get_all,
+                             status_func, status_baton,
+                             cancel_func, cancel_baton,
+                             scratch_pool);
+
+      if (!info && err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
+        {
+          /* The parent is also not versioned, but it is not nice to show
+             an error about a path a user didn't intend to touch. */
+          svn_error_clear(err);
+          return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
+                                   _("The node '%s' was not found."),
+                                   svn_dirent_local_style(local_abspath,
+                                                          scratch_pool));
+        }
+      SVN_ERR(err);
     }
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/tests/cmdline/stat_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/stat_tests.py?rev=1345361&r1=1345360&r2=1345361&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/stat_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/stat_tests.py Fri Jun  1 21:50:30 
2012
@@ -993,8 +993,16 @@ def status_unversioned_dir(sbox):
   dir = sbox.wc_dir
   svntest.main.safe_rmtree(sbox.wc_dir)
   os.mkdir(dir)
-  expected_err = "svn: warning: W155007: '.*(/|\\\\)" + os.path.basename(dir) 
+ \
-                 "' is not a working copy"
+
+  # Depending on whether you run the tests below a working copy
+  # or not, the error message might either be something like
+  # svn: warning: W155007: '...copies/stat_tests-19' is not a working copy
+  # or
+  # svn: warning: W155010: The node '...copies/stat_tests-19' was not found.
+
+  expected_err = "svn: warning: W1550(07|10): .*'.*(/|\\\\)" + \
+                 os.path.basename(dir) + \
+                 "' (is not a working copy|was not found)"
   svntest.actions.run_and_verify_svn2(None, [], expected_err, 0,
                                       "status", dir, dir)
 


Reply via email to