subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1676748 - /subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c
Date Wed, 29 Apr 2015 14:08:14 GMT
Author: julianfoad
Date: Wed Apr 29 14:04:54 2015
New Revision: 1676748

URL: http://svn.apache.org/r1676748
Log:
On the 'move-tracking-2' branch: Add assertions.

* subversion/libsvn_delta/branch.c
  (branch_validate_element): Also validate that a subbranch root element is
    not the branch root element. Simplify an existing assertion.
  (svn_branch_update_subbranch_root_element): Don't call
    branch_validate_element() here, as it is called inside branch_map_set().
  (svn_branch_add_new_branch): Assert that a branch does not already
    exist at this location.

Modified:
    subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c

Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c?rev=1676748&r1=1676747&r2=1676748&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c Wed Apr 29 14:04:54
2015
@@ -273,11 +273,17 @@ branch_validate_element(const svn_branch
 
   /* Payload, if specified, must be in full or by reference. */
   if (element->payload)
-    SVN_ERR_ASSERT_NO_RETURN(element->payload
-                             && ((SVN_IS_VALID_REVNUM(element->payload->ref.rev)
-                                  && element->payload->ref.relpath)
-                                 || (element->payload->kind != svn_node_unknown
-                                     && element->payload->kind != svn_node_none)));
+    {
+      SVN_ERR_ASSERT_NO_RETURN((SVN_IS_VALID_REVNUM(element->payload->ref.rev)
+                                && element->payload->ref.relpath)
+                               || (element->payload->kind != svn_node_unknown
+                                   && element->payload->kind != svn_node_none));
+    }
+  else /* it's a subbranch root */
+    {
+      /* a subbranch root element must not be the branch root element */
+      SVN_ERR_ASSERT_NO_RETURN(eid != branch->root_eid);
+    }
 }
 
 svn_branch_el_rev_content_t *
@@ -360,7 +366,6 @@ svn_branch_update_subbranch_root_element
 
   /* EID must be a valid element id */
   SVN_ERR_ASSERT_NO_RETURN(EID_IS_ALLOCATED(branch, eid));
-  branch_validate_element(branch, eid, element);
 
   /* Insert the new version */
   branch_map_set(branch, eid, element);
@@ -788,6 +793,10 @@ svn_branch_add_new_branch(svn_branch_sta
                               outer_branch, outer_eid,
                               outer_branch->rev_root->repos->pool);
 
+  /* A branch must not already exist at this outer element */
+  SVN_ERR_ASSERT_NO_RETURN(svn_branch_get_subbranch_at_eid(
+                             outer_branch, outer_eid, scratch_pool) == NULL);
+
   SVN_ARRAY_PUSH(new_branch->rev_root->branches) = new_branch;
 
   return new_branch;



Mime
View raw message