subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1697356 - /subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c
Date Mon, 24 Aug 2015 11:29:51 GMT
Author: julianfoad
Date: Mon Aug 24 11:29:50 2015
New Revision: 1697356

URL: http://svn.apache.org/r1697356
Log:
On the 'move-tracking-2' branch: Update a check now that svnmover
accepts paths specified with respect to a branch (r1696816).

* subversion/svnmover/svnmover.c
  (VERIFY_NOT_CHILD_OF_SELF): New macro, extracted from 'execute' and
    updated to work properly when a path is specified relative to a branch.
  (execute): Use VERIFY_NOT_CHILD_OF_SELF in the 'mv' command.

Modified:
    subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c

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=1697356&r1=1697355&r2=1697356&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c Mon Aug 24 11:29:50
2015
@@ -2768,6 +2768,15 @@ typedef struct arg_t
                              _("%s: Element not found at path '%s'"),   \
                              op, svn_relpath_dirname(action->relpath[i], pool));
 
+#define VERIFY_NOT_CHILD_OF_SELF(op, i, j, pool)                        \
+  if (svn_relpath_skip_ancestor(                                        \
+        svn_branch_get_rrpath_by_eid(arg[i]->el_rev->branch,            \
+                                     arg[i]->el_rev->eid, pool),        \
+        svn_branch_get_rrpath_by_eid(arg[j]->parent_el_rev->branch,     \
+                                     arg[j]->parent_el_rev->eid, pool))) \
+    return svn_error_createf(SVN_ERR_BRANCHING, NULL,                   \
+                             _("%s: Cannot move to child of self"), op);
+
 /* If EL_REV is the root element of a branch, return the corresponding
  * subbranch-root element of its outer branch.
  *
@@ -3068,14 +3077,12 @@ execute(svnmover_wc_t *wc,
             return svn_error_createf(SVN_ERR_BRANCHING, NULL,
                                      _("mv: cannot move the repository root"));
 
-          if (svn_relpath_skip_ancestor(action->relpath[0], action->relpath[1]))
-            return svn_error_createf(SVN_ERR_BRANCHING, NULL,
-                                     _("mv: cannot move to child of self"));
           VERIFY_REV_UNSPECIFIED("mv", 0);
           VERIFY_EID_EXISTS("mv", 0);
           VERIFY_REV_UNSPECIFIED("mv", 1);
           VERIFY_EID_NONEXISTENT("mv", 1);
           VERIFY_PARENT_EID_EXISTS("mv", 1);
+          VERIFY_NOT_CHILD_OF_SELF("mv", 0, 1, iterpool);
           SVN_ERR(do_move(editor, arg[0]->el_rev, arg[1]->parent_el_rev, arg[1]->path_name,
                           iterpool));
           break;



Mime
View raw message