[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r25010 - trunk/subversion/libsvn_client

From: David Glasser <glasser_at_mit.edu>
Date: 2007-05-14 13:57:15 CEST

On 5/14/07, glasser@tigris.org <glasser@tigris.org> wrote:
> Modified: trunk/subversion/libsvn_client/switch.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_client/switch.c?pathrev=25010&r1=25009&r2=25010
> ==============================================================================
> /usr/bin/diff: /tmp/tmpA5ngoq: No such file or directory

Um, that's kind of broken... svn.collab.net people maybe want to take a look?

(Diff pasted below, for review purposes.)

--dave

-- 
David Glasser | glasser_at_mit.edu | http://www.davidglasser.net/
Index: trunk/subversion/libsvn_client/switch.c
===================================================================
--- trunk/subversion/libsvn_client/switch.c	(revision 25009)
+++ trunk/subversion/libsvn_client/switch.c	(revision 25010)
@@ -67,9 +67,10 @@
   const svn_ra_reporter3_t *reporter;
   void *report_baton;
   const svn_wc_entry_t *entry;
-  const char *URL, *anchor, *target;
+  const char *URL, *anchor, *target, *source_root;
   svn_ra_session_t *ra_session;
   svn_revnum_t revnum;
+  svn_node_kind_t switch_url_kind;
   svn_error_t *err = SVN_NO_ERROR;
   svn_wc_adm_access_t *adm_access, *dir_access;
   const char *diff3_cmd;
@@ -125,7 +126,32 @@
                                                ctx, pool));
   SVN_ERR(svn_client__get_revision_number
           (&revnum, ra_session, revision, path, pool));
+  SVN_ERR(svn_ra_get_repos_root(ra_session, &source_root, pool));
+
+  /* Disallow a switch operation to change the repository root of the
target. */
+  if (! svn_path_is_ancestor(source_root, switch_url))
+    return svn_error_createf
+      (SVN_ERR_WC_INVALID_SWITCH, NULL,
+       _("'%s'\n"
+         "is not the same repository as\n"
+         "'%s'"), switch_url, source_root);
+  /* Check to make sure that the switch target actually exists. */
+  SVN_ERR(svn_ra_reparent(ra_session, source_root, pool));
+  SVN_ERR(svn_ra_check_path(ra_session,
+                            svn_path_is_child(source_root, switch_url, pool),
+                            revnum,
+                            &switch_url_kind,
+                            pool));
+
+  if (switch_url_kind == svn_node_none)
+    return svn_error_createf
+      (SVN_ERR_WC_INVALID_SWITCH, NULL,
+       _("Destination does not exist: '%s'"), switch_url);
+
+  SVN_ERR(svn_ra_reparent(ra_session, URL, pool));
+
+
   /* Fetch the switch (update) editor.  If REVISION is invalid, that's
      okay; the RA driver will call editor->set_target_revision() later on. */
   SVN_ERR(svn_wc_get_switch_editor3(&revnum, adm_access, target,
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon May 14 14:17:31 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.