subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1135501 - in /subversion/trunk/subversion: include/private/svn_fspath.h libsvn_client/merge.c libsvn_client/mergeinfo.c libsvn_subr/dirent_uri.c
Date Tue, 14 Jun 2011 11:48:58 GMT
Author: julianfoad
Date: Tue Jun 14 11:48:57 2011
New Revision: 1135501

URL: http://svn.apache.org/viewvc?rev=1135501&view=rev
Log:
Simplify the semantics of svn_fspath__skip_ancestor() to return NULL if the
supposed child is not in fact a child.

* subversion/include/private/svn_fspath.h,
  subversion/libsvn_subr/dirent_uri.c
  (svn_fspath__skip_ancestor): Return NULL if 'child' is not a child.

* subversion/libsvn_client/merge.c
  (log_noop_revs, log_find_operative_revs): Adjust and simplify accordingly,
    eliminating the use of 'is_ancestor()' to test the result.

* subversion/libsvn_client/mergeinfo.c
  (filter_log_entry_with_rangelist): Same.

Modified:
    subversion/trunk/subversion/include/private/svn_fspath.h
    subversion/trunk/subversion/libsvn_client/merge.c
    subversion/trunk/subversion/libsvn_client/mergeinfo.c
    subversion/trunk/subversion/libsvn_subr/dirent_uri.c

Modified: subversion/trunk/subversion/include/private/svn_fspath.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_fspath.h?rev=1135501&r1=1135500&r2=1135501&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_fspath.h (original)
+++ subversion/trunk/subversion/include/private/svn_fspath.h Tue Jun 14 11:48:57 2011
@@ -142,10 +142,8 @@ svn_fspath__is_child(const char *parent_
 
 /** Return the relative path part of @a child_fspath that is below
  * @a parent_fspath, or just "" if @a parent_fspath is equal to
- * @a child_fspath. If @a child_fspath is not below @a parent_fspath,
- * return @a child_fspath.
- *
- * ### Returning the child in the no-match case is a bad idea.
+ * @a child_fspath. If @a child_fspath is not below @a parent_fspath
+ * or equal to it, return @c NULL.
  *
  * @since New in 1.7.
  */

Modified: subversion/trunk/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1135501&r1=1135500&r2=1135501&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/merge.c (original)
+++ subversion/trunk/subversion/libsvn_client/merge.c Tue Jun 14 11:48:57 2011
@@ -7840,14 +7840,12 @@ log_noop_revs(void *baton,
          calculate what path in the merge target would be affected by this
          revision. */
       rel_path = svn_fspath__skip_ancestor(log_gap_baton->source_repos_abs, path);
-      cwmi_path = svn_dirent_join(log_gap_baton->merge_b->target_abspath,
-                                  rel_path, pool);
-
       /* Is PATH even within the merge target?  If it isn't we
          can disregard it altogether. */
-      if (!svn_dirent_is_ancestor(log_gap_baton->merge_b->target_abspath,
-                                  cwmi_path))
+      if (rel_path == NULL)
         continue;
+      cwmi_path = svn_dirent_join(log_gap_baton->merge_b->target_abspath,
+                                  rel_path, pool);
 
       /* Find any explicit or inherited mergeinfo for PATH. */
       while (!log_entry_rev_required)
@@ -9611,11 +9609,11 @@ log_find_operative_revs(void *baton,
       svn_boolean_t in_catalog;
       svn_mergeinfo_t log_entry_as_mergeinfo;
 
+      rel_path = svn_fspath__skip_ancestor(log_baton->target_abspath, path);
       /* Easy out: The path is not within the tree of interest. */
-      if (!svn_fspath__is_ancestor(log_baton->target_abspath, path))
+      if (rel_path == NULL)
         continue;
 
-      rel_path = svn_fspath__skip_ancestor(log_baton->target_abspath, path);
       source_rel_path = svn_relpath_join(log_baton->source_repos_rel_path,
                                          rel_path, pool);
 

Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=1135501&r1=1135500&r2=1135501&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Tue Jun 14 11:48:57 2011
@@ -1400,7 +1400,6 @@ filter_log_entry_with_rangelist(void *ba
           svn_mergeinfo_t nearest_ancestor_mergeinfo;
           apr_hash_index_t *hi2;
           svn_boolean_t found_this_revision = FALSE;
-          const char *merge_source_path;
           const char *merge_source_rel_target;
 
           svn_pool_clear(iterpool);
@@ -1409,14 +1408,17 @@ filter_log_entry_with_rangelist(void *ba
              merge sources.  If not then ignore this path.  */
           for (i = 0; i < fleb->merge_source_paths->nelts; i++)
             {
-              merge_source_path =
-                APR_ARRAY_IDX(fleb->merge_source_paths, i, const char *);
-              if (svn_fspath__is_ancestor(merge_source_path, path))
+              const char *merge_source_path
+                = APR_ARRAY_IDX(fleb->merge_source_paths, i, const char *);
+
+              merge_source_rel_target
+                = svn_fspath__skip_ancestor(merge_source_path, path);
+              if (merge_source_rel_target)
                 {
                   /* If MERGE_SOURCE was itself deleted, replaced, or added
                      in LOG_ENTRY->REVISION then ignore this PATH since you
                      can't merge a addition or deletion of yourself. */
-                  if (strcmp(merge_source_path, path) == 0
+                  if (merge_source_rel_target[0] == '\0'
                       && (change->action != 'M'))
                     i = fleb->merge_source_paths->nelts;
                   break;
@@ -1428,8 +1430,6 @@ filter_log_entry_with_rangelist(void *ba
             continue;
 
           /* Calculate the target path which PATH would affect if merged. */
-          merge_source_rel_target = svn_fspath__skip_ancestor(merge_source_path,
-                                                              path);
           target_path_affected = svn_fspath__join(fleb->abs_repos_target_path,
                                                   merge_source_rel_target,
                                                   iterpool);

Modified: subversion/trunk/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/dirent_uri.c?rev=1135501&r1=1135500&r2=1135501&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/trunk/subversion/libsvn_subr/dirent_uri.c Tue Jun 14 11:48:57 2011
@@ -2424,12 +2424,13 @@ svn_fspath__skip_ancestor(const char *pa
   assert(svn_fspath__is_canonical(child_fspath));
 
   if (svn_relpath_is_ancestor(parent_fspath + 1, child_fspath + 1))
-    result = svn_relpath_skip_ancestor(parent_fspath + 1, child_fspath + 1);
+    {
+      result = svn_relpath_skip_ancestor(parent_fspath + 1, child_fspath + 1);
+      assert(svn_relpath_is_canonical(result));
+    }
   else
-    result = child_fspath;
+    result = NULL;
 
-  assert(svn_relpath_is_canonical(result)
-         || strcmp(result, child_fspath) == 0);
   return result;
 }
 



Mime
View raw message