You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2015/05/08 17:48:27 UTC

svn commit: r1678387 - /subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c

Author: julianfoad
Date: Fri May  8 15:48:27 2015
New Revision: 1678387

URL: http://svn.apache.org/r1678387
Log:
On the 'move-tracking-2' branch: Tweak error handling.

* subversion/libsvn_delta/branch.c
  (svn_branch_instantiate_subtree): Error if specified target element is its own
    parent, to avoid an assertion failure further down.
  (svn_branch_branch_into): Tweak error message to match our conventions.

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=1678387&r1=1678386&r2=1678387&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/branch.c Fri May  8 15:48:27 2015
@@ -707,6 +707,17 @@ svn_branch_instantiate_subtree(svn_branc
   apr_hash_index_t *hi;
   svn_branch_el_rev_content_t *new_root_content;
 
+  /* Source element must not be the same as the target parent element */
+  if (new_subtree.root_eid == new_parent_eid)
+    {
+      return svn_error_createf(SVN_ERR_BRANCHING, NULL,
+                               _("Cannot branch from e%d to %s e%d/%s: "
+                                 "target element cannot be its own parent"),
+                               new_subtree.root_eid,
+                               svn_branch_get_id(to_branch, scratch_pool),
+                               new_parent_eid, new_name);
+    }
+
   /* Instantiate the root element of NEW_SUBTREE */
   new_root_content = svn_int_hash_get(new_subtree.e_map, new_subtree.root_eid);
   if (new_root_content->payload)
@@ -1381,7 +1392,7 @@ svn_branch_branch_into(svn_branch_state_
   if (! svn_branch_get_path_by_eid(from_branch, from_eid, scratch_pool))
     {
       return svn_error_createf(SVN_ERR_BRANCHING, NULL,
-                               _("cannot branch from b%s e%d: "
+                               _("Cannot branch from %s e%d: "
                                  "does not exist"),
                                svn_branch_get_id(
                                  from_branch, scratch_pool), from_eid);