You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2012/07/26 18:50:49 UTC

svn commit: r1366080 - in /subversion/trunk/subversion/libsvn_wc: adm_files.c adm_ops.c cleanup.c merge.c

Author: rhuijben
Date: Thu Jul 26 16:50:49 2012
New Revision: 1366080

URL: http://svn.apache.org/viewvc?rev=1366080&view=rev
Log:
If we just want to know whether a path is the working copy root ask
for that instead of asking for the path and performing a comparison.

* subversion/libsvn_wc/adm_files.c
  (svn_wc__adm_destroy): Simplify code.

* subversion/libsvn_wc/adm_ops.c
  (revert_internal): Simplify code.

* subversion/libsvn_wc/cleanup.c
  (cleanup_internal): Simplify code.

* subversion/libsvn_wc/merge.c
  (detranslate_wc_file): Don't fetch an unused variable.

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_files.c
    subversion/trunk/subversion/libsvn_wc/adm_ops.c
    subversion/trunk/subversion/libsvn_wc/cleanup.c
    subversion/trunk/subversion/libsvn_wc/merge.c

Modified: subversion/trunk/subversion/libsvn_wc/adm_files.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_files.c?rev=1366080&r1=1366079&r2=1366080&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_files.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_files.c Thu Jul 26 16:50:49 2012
@@ -528,23 +528,22 @@ svn_wc__adm_destroy(svn_wc__db_t *db,
                     void *cancel_baton,
                     apr_pool_t *scratch_pool)
 {
-  const char *adm_abspath;
+  svn_boolean_t is_wcroot;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(dir_abspath));
 
   SVN_ERR(svn_wc__write_check(db, dir_abspath, scratch_pool));
 
-  SVN_ERR(svn_wc__db_get_wcroot(&adm_abspath, db, dir_abspath,
-                                scratch_pool, scratch_pool));
+  SVN_ERR(svn_wc__db_is_wcroot(&is_wcroot, db, dir_abspath, scratch_pool));
 
   /* Well, the coast is clear for blowing away the administrative
      directory, which also removes remaining locks */
 
   /* Now close the DB, and we can delete the working copy */
-  if (strcmp(adm_abspath, dir_abspath) == 0)
+  if (is_wcroot)
     {
-      SVN_ERR(svn_wc__db_drop_root(db, adm_abspath, scratch_pool));
-      SVN_ERR(svn_io_remove_dir2(svn_wc__adm_child(adm_abspath, NULL,
+      SVN_ERR(svn_wc__db_drop_root(db, dir_abspath, scratch_pool));
+      SVN_ERR(svn_io_remove_dir2(svn_wc__adm_child(dir_abspath, NULL,
                                                    scratch_pool),
                                  FALSE,
                                  cancel_func, cancel_baton,

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1366080&r1=1366079&r2=1366080&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Thu Jul 26 16:50:49 2012
@@ -1952,12 +1952,14 @@ revert_internal(svn_wc__db_t *db,
      when local_abspath is the working copy root. */
   {
     const char *dir_abspath;
+    svn_boolean_t is_wcroot;
 
-    SVN_ERR(svn_wc__db_get_wcroot(&dir_abspath, db, local_abspath,
-                                  scratch_pool, scratch_pool));
+    SVN_ERR(svn_wc__db_is_wcroot(&is_wcroot, db, local_abspath, scratch_pool));
 
-    if (svn_dirent_is_child(dir_abspath, local_abspath, NULL))
+    if (! is_wcroot)
       dir_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
+    else
+      dir_abspath = local_abspath;
 
     SVN_ERR(svn_wc__write_check(db, dir_abspath, scratch_pool));
   }

Modified: subversion/trunk/subversion/libsvn_wc/cleanup.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/cleanup.c?rev=1366080&r1=1366079&r2=1366080&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/cleanup.c (original)
+++ subversion/trunk/subversion/libsvn_wc/cleanup.c Thu Jul 26 16:50:49 2012
@@ -142,7 +142,7 @@ cleanup_internal(svn_wc__db_t *db,
                  apr_pool_t *scratch_pool)
 {
   int wc_format;
-  const char *cleanup_abspath;
+  svn_boolean_t is_wcroot;
 
   /* Can we even work with this directory?  */
   SVN_ERR(can_be_cleaned(&wc_format, db, dir_abspath, scratch_pool));
@@ -157,8 +157,7 @@ cleanup_internal(svn_wc__db_t *db,
     SVN_ERR(svn_wc__wq_run(db, dir_abspath, cancel_func, cancel_baton,
                            scratch_pool));
 
-  SVN_ERR(svn_wc__db_get_wcroot(&cleanup_abspath, db, dir_abspath,
-                                scratch_pool, scratch_pool));
+  SVN_ERR(svn_wc__db_is_wcroot(&is_wcroot, db, dir_abspath, scratch_pool));
 
 #ifdef SVN_DEBUG
   SVN_ERR(svn_wc__db_verify(db, dir_abspath, scratch_pool));
@@ -169,7 +168,7 @@ cleanup_internal(svn_wc__db_t *db,
      svn_wc__check_wcroot() as that function, will just return true
      once we start sharing databases with externals.
    */
-  if (strcmp(cleanup_abspath, dir_abspath) == 0)
+  if (is_wcroot)
     {
     /* Cleanup the tmp area of the admin subdir, if running the log has not
        removed it!  The logs have been run, so anything left here has no hope

Modified: subversion/trunk/subversion/libsvn_wc/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/merge.c?rev=1366080&r1=1366079&r2=1366080&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/merge.c (original)
+++ subversion/trunk/subversion/libsvn_wc/merge.c Thu Jul 26 16:50:49 2012
@@ -241,13 +241,11 @@ detranslate_wc_file(const char **detrans
 
   if (force_copy || keywords || eol || special)
     {
-      const char *wcroot_abspath, *temp_dir_abspath;
+      const char *temp_dir_abspath;
       const char *detranslated;
 
       /* Force a copy into the temporary wc area to avoid having
          temporary files created below to appear in the actual wc. */
-      SVN_ERR(svn_wc__db_get_wcroot(&wcroot_abspath, mt->db, mt->wri_abspath,
-                                    scratch_pool, scratch_pool));
       SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&temp_dir_abspath, mt->db,
                                              mt->wri_abspath,
                                              scratch_pool, scratch_pool));