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 2013/10/10 10:12:34 UTC

svn commit: r1530871 - in /subversion/trunk/subversion/libsvn_wc: wc_db.c wc_db_private.h

Author: rhuijben
Date: Thu Oct 10 08:12:33 2013
New Revision: 1530871

URL: http://svn.apache.org/r1530871
Log:
Simplify loop construction. No functional changes.

* subversion/libsvn_wc/wc_db_private.h
  (svn_wc__db_op_depth_moved_to): Move documentation here.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_op_depth_moved_to): Move documentation to header.
    Verify precondition. Remove duplicated loop condition by adding
    explicit break.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db_private.h

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1530871&r1=1530870&r2=1530871&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Oct 10 08:12:33 2013
@@ -12128,38 +12128,6 @@ svn_wc__db_follow_moved_to(apr_array_hea
   return SVN_NO_ERROR;
 }
 
-/* Extract the moved-to information for LOCAL_RELPATH at OP-DEPTH by
-   examining the lowest working node above OP_DEPTH.  The output paths
-   are NULL if there is no move, otherwise:
-
-   *MOVE_DST_RELPATH: the moved-to destination of LOCAL_RELPATH.
-
-   *MOVE_DST_OP_ROOT_RELPATH: the moved-to destination of the root of
-   the move of LOCAL_RELPATH. This may be equal to *MOVE_DST_RELPATH
-   if LOCAL_RELPATH is the root of the move.
-
-   *MOVE_SRC_ROOT_RELPATH: the root of the move source.  For moves
-   inside a delete this will be different from *MOVE_SRC_OP_ROOT_RELPATH.
-
-   *MOVE_SRC_OP_ROOT_RELPATH: the root of the source layer that
-   contains the move.  For moves inside deletes this is the root of
-   the delete, for other moves this is the root of the move.
-
-   Given a path A/B/C with A/B moved to X then for A/B/C
-
-     MOVE_DST_RELPATH is X/C
-     MOVE_DST_OP_ROOT_RELPATH is X
-     MOVE_SRC_ROOT_RELPATH is A/B
-     MOVE_SRC_OP_ROOT_RELPATH is A/B
-
-   If A is then deleted the MOVE_DST_RELPATH, MOVE_DST_OP_ROOT_RELPATH
-   and MOVE_SRC_ROOT_RELPATH remain the same but MOVE_SRC_OP_ROOT_RELPATH
-   changes to A.
-
-   ### Think about combining with scan_deletion?  Also with
-   ### scan_addition to get moved-to for replaces?  Do we need to
-   ### return the op-root of the move source, i.e. A/B in the example
-   ### above?  */
 svn_error_t *
 svn_wc__db_op_depth_moved_to(const char **move_dst_relpath,
                              const char **move_dst_op_root_relpath,
@@ -12176,6 +12144,8 @@ svn_wc__db_op_depth_moved_to(const char 
   int delete_op_depth;
   const char *relpath = local_relpath;
 
+  SVN_ERR_ASSERT(local_relpath[0]); /* Not valid on the WC root */
+
   *move_dst_relpath = *move_dst_op_root_relpath = NULL;
   *move_src_root_relpath = *move_src_op_root_relpath = NULL;
 
@@ -12191,14 +12161,17 @@ svn_wc__db_op_depth_moved_to(const char 
           *move_dst_op_root_relpath = svn_sqlite__column_text(stmt, 3,
                                                               result_pool);
           if (*move_dst_op_root_relpath)
-            *move_src_root_relpath = apr_pstrdup(result_pool, relpath);
+            {
+              *move_src_root_relpath = apr_pstrdup(result_pool, relpath);
+              SVN_ERR(svn_sqlite__reset(stmt));
+
+              break;
+            }
         }
       SVN_ERR(svn_sqlite__reset(stmt));
-      if (!*move_dst_op_root_relpath)
-        relpath = svn_relpath_dirname(relpath, scratch_pool);
+      relpath = svn_relpath_dirname(relpath, scratch_pool);
     }
-  while (!*move_dst_op_root_relpath
-        && have_row && delete_op_depth <= relpath_depth(relpath));
+  while (have_row && delete_op_depth <= relpath_depth(relpath));
 
   if (*move_dst_op_root_relpath)
     {

Modified: subversion/trunk/subversion/libsvn_wc/wc_db_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_private.h?rev=1530871&r1=1530870&r2=1530871&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_private.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_private.h Thu Oct 10 08:12:33 2013
@@ -423,6 +423,38 @@ svn_wc__db_retract_parent_delete(svn_wc_
                                  int op_depth,
                                  apr_pool_t *scratch_pool);
 
+/* Extract the moved-to information for LOCAL_RELPATH at OP-DEPTH by
+   examining the lowest working node above OP_DEPTH.  The output paths
+   are NULL if there is no move, otherwise:
+
+   *MOVE_DST_RELPATH: the moved-to destination of LOCAL_RELPATH.
+
+   *MOVE_DST_OP_ROOT_RELPATH: the moved-to destination of the root of
+   the move of LOCAL_RELPATH. This may be equal to *MOVE_DST_RELPATH
+   if LOCAL_RELPATH is the root of the move.
+
+   *MOVE_SRC_ROOT_RELPATH: the root of the move source.  For moves
+   inside a delete this will be different from *MOVE_SRC_OP_ROOT_RELPATH.
+
+   *MOVE_SRC_OP_ROOT_RELPATH: the root of the source layer that
+   contains the move.  For moves inside deletes this is the root of
+   the delete, for other moves this is the root of the move.
+
+   Given a path A/B/C with A/B moved to X then for A/B/C
+
+     MOVE_DST_RELPATH is X/C
+     MOVE_DST_OP_ROOT_RELPATH is X
+     MOVE_SRC_ROOT_RELPATH is A/B
+     MOVE_SRC_OP_ROOT_RELPATH is A/B
+
+   If A is then deleted the MOVE_DST_RELPATH, MOVE_DST_OP_ROOT_RELPATH
+   and MOVE_SRC_ROOT_RELPATH remain the same but MOVE_SRC_OP_ROOT_RELPATH
+   changes to A.
+
+   ### Think about combining with scan_deletion?  Also with
+   ### scan_addition to get moved-to for replaces?  Do we need to
+   ### return the op-root of the move source, i.e. A/B in the example
+   ### above?  */
 svn_error_t *
 svn_wc__db_op_depth_moved_to(const char **move_dst_relpath,
                              const char **move_dst_op_root_relpath,