subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1682260 - in /subversion/branches/move-tracking-2/subversion: libsvn_delta/editor3e.c svnmover/svnmover.c tests/cmdline/svnmover_tests.py
Date Thu, 28 May 2015 15:26:30 GMT
Author: julianfoad
Date: Thu May 28 15:26:30 2015
New Revision: 1682260

URL: http://svn.apache.org/r1682260
Log:
On the 'move-tracking-2' branch: Fix editing a branch-root node's
payload (props, text). This was aborting.

* subversion/libsvn_delta/editor3e.c
  (svn_editor3_instantiate,
   svn_editor3_alter): Expect parent-EID and name to be null values when
    editing the root element.

* subversion/svnmover/svnmover.c
  (execute): Pass parent-EID and name as null values when editing the root
    element.

* subversion/tests/cmdline/svnmover_tests.py
  (modify_payload_of_branch_root_element): New test.
  (test_list): Run it.

Modified:
    subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3e.c
    subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c
    subversion/branches/move-tracking-2/subversion/tests/cmdline/svnmover_tests.py

Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3e.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3e.c?rev=1682260&r1=1682259&r2=1682260&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3e.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/editor3e.c Thu May 28 15:26:30
2015
@@ -225,8 +225,10 @@ svn_editor3_instantiate(svn_editor3_t *e
                         const svn_element_payload_t *new_payload)
 {
   SVN_ERR_ASSERT(VALID_EID(local_eid));
-  SVN_ERR_ASSERT(VALID_EID(new_parent_eid));
-  SVN_ERR_ASSERT(VALID_NAME(new_name));
+  SVN_ERR_ASSERT(local_eid == branch->root_eid ? new_parent_eid == -1
+                                               : VALID_EID(new_parent_eid));
+  SVN_ERR_ASSERT(local_eid == branch->root_eid ? *new_name == '\0'
+                                               : VALID_NAME(new_name));
   SVN_ERR_ASSERT(!new_payload || VALID_PAYLOAD(new_payload));
   VERIFY(instantiate, new_parent_eid != local_eid);
   /* TODO: verify this element does not exist (in initial state) */
@@ -306,8 +308,10 @@ svn_editor3_alter(svn_editor3_t *editor,
                   const svn_element_payload_t *new_payload)
 {
   SVN_ERR_ASSERT(VALID_EID(eid));
-  SVN_ERR_ASSERT(VALID_EID(new_parent_eid));
-  SVN_ERR_ASSERT(VALID_NAME(new_name));
+  SVN_ERR_ASSERT(eid == branch->root_eid ? new_parent_eid == -1
+                                         : VALID_EID(new_parent_eid));
+  SVN_ERR_ASSERT(eid == branch->root_eid ? *new_name == '\0'
+                                         : VALID_NAME(new_name));
   SVN_ERR_ASSERT(! new_payload || VALID_PAYLOAD(new_payload));
   VERIFY(alter, new_parent_eid != eid);
   /* TODO: verify this element exists (in initial state) */

Modified: subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c?rev=1682260&r1=1682259&r2=1682260&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c Thu May 28 15:26:30
2015
@@ -2048,6 +2048,8 @@ execute(const apr_array_header_t *action
           {
             apr_hash_t *props = apr_hash_make(iterpool);
             svn_stringbuf_t *text;
+            int parent_eid;
+            const char *name;
             svn_element_payload_t *payload;
 
             if (arg[1]->el_rev->eid >= 0)
@@ -2073,11 +2075,23 @@ execute(const apr_array_header_t *action
             }
             payload = svn_element_payload_create_file(props, text, iterpool);
 
+            if (is_branch_root_element(arg[1]->el_rev->branch,
+                                       arg[1]->el_rev->eid))
+              {
+                parent_eid = -1;
+                name = "";
+              }
+            else
+              {
+                parent_eid = arg[1]->parent_el_rev->eid;
+                name = arg[1]->path_name;
+              }
+
             if (arg[1]->el_rev->eid >= 0)
               {
                 SVN_ERR(svn_editor3_alter(editor,
                                           arg[1]->el_rev->branch, arg[1]->el_rev->eid,
-                                          arg[1]->parent_el_rev->eid, arg[1]->path_name,
+                                          parent_eid, name,
                                           payload));
               }
             else
@@ -2086,7 +2100,7 @@ execute(const apr_array_header_t *action
 
                 SVN_ERR(svn_editor3_add(editor, &new_eid, svn_node_file,
                                         arg[1]->parent_el_rev->branch,
-                                        arg[1]->parent_el_rev->eid, arg[1]->path_name,
+                                        parent_eid, name,
                                         payload));
               }
           }

Modified: subversion/branches/move-tracking-2/subversion/tests/cmdline/svnmover_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/tests/cmdline/svnmover_tests.py?rev=1682260&r1=1682259&r2=1682260&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/tests/cmdline/svnmover_tests.py (original)
+++ subversion/branches/move-tracking-2/subversion/tests/cmdline/svnmover_tests.py Thu May
28 15:26:30 2015
@@ -1228,6 +1228,18 @@ def merge_from_subbranch_to_subtree(sbox
                  reported_add('A/B1/C1/D'),
                  'merge A/B1/C2 A/B1/C1 A/B1/C1@2')
 
+def modify_payload_of_branch_root_element(sbox):
+  "modify payload of branch root element"
+  sbox_build_svnmover(sbox)
+
+  # Make a file, and branch it
+  test_svnmover2(sbox, '', None,
+                 'put ' + mk_file(sbox, 'f1') + ' f1 ' +
+                 'branch f1 f2')
+
+  # Modify the file-branch
+  test_svnmover2(sbox, '', None,
+                 'put ' + mk_file(sbox, 'f2') + ' f2')
 
 ######################################################################
 
@@ -1248,6 +1260,7 @@ test_list = [ None,
               merge_added_subbranch,
               branch_to_subbranch_of_self,
               merge_from_subbranch_to_subtree,
+              modify_payload_of_branch_root_element,
             ]
 
 if __name__ == '__main__':



Mime
View raw message