Index: include/svn_delta.h
===================================================================
--- include/svn_delta.h	(revision 15261)
+++ include/svn_delta.h	(working copy)
@@ -716,7 +716,8 @@
                             const char *copy_path,
                             svn_revnum_t copy_revision,
                             apr_pool_t *file_pool,
-                            void **file_baton);
+                            void **file_baton,
+                            svn_boolean_t taking_over);
 
   /** We are going to make change to a file named @a path, which resides
    * in the directory identified by @a parent_baton.
@@ -813,6 +814,7 @@
   svn_error_t *(*abort_edit) (void *edit_baton,
                               apr_pool_t *pool);
 
+  svn_boolean_t taking_over;
 } svn_delta_editor_t;  
 
 
Index: include/svn_wc.h
===================================================================
--- include/svn_wc.h	(revision 15261)
+++ include/svn_wc.h	(working copy)
@@ -498,6 +498,9 @@
 
   /** Got an add in an update. */
   svn_wc_notify_update_add,
+  
+  /** Got a takeover in an update. */
+  svn_wc_notify_update_takeover,
 
   /** Got any other action in an update. */
   svn_wc_notify_update_update,
Index: include/svn_client.h
===================================================================
--- include/svn_client.h	(revision 15261)
+++ include/svn_client.h	(working copy)
@@ -486,6 +486,18 @@
  * Use @a pool for any temporary allocation.
  */
 svn_error_t *
+svn_client_checkout3 (svn_revnum_t *result_rev,
+                      const char *URL,
+                      const char *path,
+                      const svn_opt_revision_t *peg_revision,
+                      const svn_opt_revision_t *revision,
+                      svn_boolean_t recurse,
+                      svn_boolean_t ignore_externals,
+                      svn_client_ctx_t *ctx,
+                      apr_pool_t *pool,
+                      svn_boolean_t taking_over);
+                      
+svn_error_t *
 svn_client_checkout2 (svn_revnum_t *result_rev,
                       const char *URL,
                       const char *path,
Index: libsvn_wc/diff.c
===================================================================
--- libsvn_wc/diff.c	(revision 15261)
+++ libsvn_wc/diff.c	(working copy)
@@ -956,7 +956,8 @@
           const char *copyfrom_path,
           svn_revnum_t copyfrom_revision,
           apr_pool_t *file_pool,
-          void **file_baton)
+          void **file_baton,
+          svn_boolean_t taking_over__ignored)
 {
   struct dir_baton *pb = parent_baton;
   struct file_baton *b;
Index: libsvn_wc/status.c
===================================================================
--- libsvn_wc/status.c	(revision 15261)
+++ libsvn_wc/status.c	(working copy)
@@ -1535,7 +1535,8 @@
           const char *copyfrom_path,
           svn_revnum_t copyfrom_revision,
           apr_pool_t *pool,
-          void **file_baton)
+          void **file_baton,
+          svn_boolean_t taking_over__ignored)
 {
   struct dir_baton *pb = parent_baton;
   struct file_baton *new_fb = make_file_baton (pb, path, pool);
Index: libsvn_wc/update_editor.c
===================================================================
--- libsvn_wc/update_editor.c	(revision 15261)
+++ libsvn_wc/update_editor.c	(working copy)
@@ -511,6 +511,9 @@
   /* Set if this file is new. */
   svn_boolean_t added;
 
+  /* Set if this file already existed. */
+  svn_boolean_t taken_over;
+
   /* This gets set if the file underwent a text change, which guides
      the code that syncs up the adm dir and working copy. */
   svn_boolean_t text_changed;
@@ -574,6 +577,7 @@
   f->bump_info    = pb->bump_info;
   f->added        = adding;
   f->dir_baton    = pb;
+  f->taken_over   = FALSE;
 
   /* No need to initialize f->digest, since we used pcalloc(). */
 
@@ -1442,7 +1446,8 @@
                   svn_revnum_t copyfrom_rev,
                   void **file_baton,
                   svn_boolean_t adding, /* 0 if replacing */
-                  apr_pool_t *pool)
+                  apr_pool_t *pool,
+                  svn_boolean_t taking_over) /* 0 for normal checkout */
 {
   struct dir_baton *pb = parent_baton;
   struct edit_baton *eb = pb->edit_baton;
@@ -1473,10 +1478,15 @@
 
   /* If adding, there should be nothing with this name. */
   if (adding && (kind != svn_node_none))
-    return svn_error_createf
-      (SVN_ERR_WC_OBSTRUCTED_UPDATE, NULL,
-       _("Failed to add file '%s': object of the same name already exists"),
-       svn_path_local_style (fb->path, pool));
+  {
+    if (taking_over)
+      fb->taken_over = TRUE;
+    else
+      return svn_error_createf
+        (SVN_ERR_WC_OBSTRUCTED_UPDATE, NULL,
+         _("Failed to add file '%s': object of the same name already exists"),
+         svn_path_local_style (fb->path, pool));
+  }
 
   /* sussman sez: If we're trying to add a file that's already in
      `entries' (but not on disk), that's okay.  It's probably because
@@ -1528,10 +1538,11 @@
           const char *copyfrom_path,
           svn_revnum_t copyfrom_revision,
           apr_pool_t *pool,
-          void **file_baton)
+          void **file_baton,
+          svn_boolean_t taking_over)
 {
   return add_or_open_file (name, parent_baton, copyfrom_path, 
-                           copyfrom_revision, file_baton, TRUE, pool);
+                           copyfrom_revision, file_baton, TRUE, pool, taking_over);
 }
 
 
@@ -1543,7 +1554,7 @@
            void **file_baton)
 {
   return add_or_open_file (name, parent_baton, NULL, base_revision, 
-                           file_baton, FALSE, pool);
+                           file_baton, FALSE, pool, FALSE);
 }
 
 
@@ -1709,9 +1720,9 @@
      applied. */
   fb->prop_changed = 1;
 
-  /* Special case: if the file is added during a checkout, cache the
-     last-changed-date propval for future use. */
-  if (eb->use_commit_times
+  /* Special case: if the file is added during a checkout or taken over,
+     cache the last-changed-date propval for future use. */
+  if ((eb->use_commit_times || fb->taken_over)
       && (strcmp (name, SVN_PROP_ENTRY_COMMITTED_DATE) == 0))
     fb->last_changed_date = apr_pstrdup (fb->pool, value->data);
 
@@ -1815,7 +1826,8 @@
               svn_revnum_t copyfrom_rev,
               const char *diff3_cmd,
               const char *timestamp_string,
-              apr_pool_t *pool)
+              apr_pool_t *pool,
+              svn_boolean_t taken_over)
 {
   apr_file_t *log_fp = NULL;
   char *revision_str = NULL;
@@ -2029,8 +2041,11 @@
     *lock_state = svn_wc_notify_lock_state_unchanged;
 
   /* Has the user made local mods to the working file?  */
-  SVN_ERR (svn_wc_text_modified_p (&is_locally_modified,
-                                   file_path, FALSE, adm_access, pool));
+  if (taken_over)
+    is_locally_modified = TRUE;
+  else
+    SVN_ERR (svn_wc_text_modified_p (&is_locally_modified,
+                                     file_path, FALSE, adm_access, pool));
 
   if (new_text_path)   /* is there a new text-base to install? */
     {
@@ -2132,9 +2147,25 @@
                                  base_name,
                                  NULL);
         }
-  
-      else   /* working file is locally modified... */
+
+      else if (taken_over) /* working file already existed, and might
+                              be newer than the repository copy */
         {
+          /* Set the text-time property of the entry to the commit
+             date/time of the file in the repository */
+          svn_xml_make_open_tag (&log_accum,
+                                 pool,
+                                 svn_xml_self_closing,
+                                 SVN_WC__LOG_MODIFY_ENTRY,
+                                 SVN_WC__LOG_ATTR_NAME,
+                                 base_name,
+                                 SVN_WC__ENTRY_ATTR_TEXT_TIME,
+                                 timestamp_string,
+                                 NULL);
+        }
+ 
+      else /* working file is locally modified... */
+        {
           svn_node_kind_t wfile_kind = svn_node_unknown;
           
           SVN_ERR (svn_io_check_path (file_path, &wfile_kind, pool));
@@ -2409,7 +2440,8 @@
                          SVN_INVALID_REVNUM,
                          eb->diff3_cmd,
                          fb->last_changed_date,
-                         pool));
+                         pool,
+                         fb->taken_over));
 
   /* We have one less referrer to the directory's bump information. */
   SVN_ERR (maybe_bump_dir_info (eb, fb->bump_info, pool));
@@ -2419,10 +2451,18 @@
        (lock_state != svn_wc_notify_lock_state_unchanged)) &&
       eb->notify_func)
     {
-      svn_wc_notify_t *notify
-        = svn_wc_create_notify (fb->path,
-                                fb->added ? svn_wc_notify_update_add 
-                                : svn_wc_notify_update_update, pool);
+      svn_wc_notify_action_t notification;
+      svn_wc_notify_t *notify;
+
+      if (fb->taken_over)
+        notification = svn_wc_notify_update_takeover;
+      else if (fb->added)
+        notification = svn_wc_notify_update_add;
+      else
+        notification = svn_wc_notify_update_update;
+
+      notify = svn_wc_create_notify (fb->path, notification, pool);
+
       notify->kind = svn_node_file;
       notify->content_state = content_state;
       notify->prop_state = prop_state;
@@ -2519,7 +2559,8 @@
              const svn_delta_editor_t **editor,
              void **edit_baton,
              svn_wc_traversal_info_t *traversal_info,
-             apr_pool_t *pool)
+             apr_pool_t *pool,
+             svn_boolean_t taking_over)
 {
   struct edit_baton *eb;
   apr_pool_t *subpool = svn_pool_create (pool);
@@ -2559,6 +2600,8 @@
   tree_editor->absent_file = absent_file;
   tree_editor->close_edit = close_edit;
 
+  tree_editor->taking_over = taking_over;
+
   SVN_ERR (svn_delta_get_cancellation_editor (cancel_func,
                                               cancel_baton,
                                               tree_editor,
@@ -2572,6 +2615,29 @@
 
 
 svn_error_t *
+svn_wc_get_update_editor3 (svn_revnum_t *target_revision,
+                           svn_wc_adm_access_t *anchor,
+                           const char *target,
+                           svn_boolean_t use_commit_times,
+                           svn_boolean_t recurse,
+                           svn_wc_notify_func2_t notify_func,
+                           void *notify_baton,
+                           svn_cancel_func_t cancel_func,
+                           void *cancel_baton,
+                           const char *diff3_cmd,
+                           const svn_delta_editor_t **editor,
+                           void **edit_baton,
+                           svn_wc_traversal_info_t *traversal_info,
+                           apr_pool_t *pool,
+                           svn_boolean_t taking_over)
+{
+  return make_editor (target_revision, anchor, svn_wc_adm_access_path (anchor),
+                      target, use_commit_times, NULL, recurse, notify_func, 
+                      notify_baton, cancel_func, cancel_baton, diff3_cmd,
+                      editor, edit_baton, traversal_info, pool, taking_over);
+}
+
+svn_error_t *
 svn_wc_get_update_editor2 (svn_revnum_t *target_revision,
                            svn_wc_adm_access_t *anchor,
                            const char *target,
@@ -2590,7 +2656,7 @@
   return make_editor (target_revision, anchor, svn_wc_adm_access_path (anchor),
                       target, use_commit_times, NULL, recurse, notify_func, 
                       notify_baton, cancel_func, cancel_baton, diff3_cmd,
-                      editor, edit_baton, traversal_info, pool);
+                      editor, edit_baton, traversal_info, pool, FALSE);
 }
 
 svn_error_t *
@@ -2642,7 +2708,7 @@
   return make_editor (target_revision, anchor, svn_wc_adm_access_path (anchor),
                       target, use_commit_times, switch_url, recurse, 
                       notify_func, notify_baton, cancel_func, cancel_baton, 
-                      diff3_cmd, editor, edit_baton, traversal_info, pool);
+                      diff3_cmd, editor, edit_baton, traversal_info, pool, FALSE);
 }
 
 svn_error_t *
@@ -2958,7 +3024,8 @@
                          copyfrom_rev,
                          NULL,
                          NULL,
-                         pool));
+                         pool,
+                         FALSE));
 
   SVN_ERR (svn_wc__run_log (adm_access, NULL, pool));
 
Index: libsvn_client/externals.c
===================================================================
--- libsvn_client/externals.c	(revision 15261)
+++ libsvn_client/externals.c	(working copy)
@@ -249,7 +249,7 @@
                                                 &(new_item->revision),
                                                 TRUE, FALSE,
                                                 ib->timestamp_sleep,
-                                                ib->ctx, ib->pool));
+                                                ib->ctx, ib->pool, FALSE));
     }
   else if (! new_item)
     {
@@ -306,7 +306,7 @@
                                               &(new_item->revision),
                                               TRUE, FALSE,
                                               ib->timestamp_sleep,
-                                              ib->ctx, ib->pool));
+                                              ib->ctx, ib->pool, FALSE));
     }
   else if (ib->update_unchanged)
     {
@@ -345,7 +345,7 @@
                                                     &(new_item->revision),
                                                     TRUE, FALSE,
                                                     ib->timestamp_sleep,
-                                                    ib->ctx, ib->pool));
+                                                    ib->ctx, ib->pool, FALSE));
             }
           /* If, however, the URLs don't match, we need to relegate
              the one subdir, and then checkout a new one. */
@@ -363,7 +363,7 @@
                                                       &(new_item->revision),
                                                       TRUE, FALSE,
                                                       ib->timestamp_sleep,
-                                                      ib->ctx, ib->pool));
+                                                      ib->ctx, ib->pool, FALSE));
             }
         }
       else /* Not a directory at all -- just try the checkout. */
@@ -379,7 +379,7 @@
                                                   &(new_item->revision),
                                                   TRUE, FALSE,
                                                   ib->timestamp_sleep,
-                                                  ib->ctx, ib->pool));
+                                                  ib->ctx, ib->pool, FALSE));
         }
     }
 
Index: libsvn_client/repos_diff.c
===================================================================
--- libsvn_client/repos_diff.c	(revision 15261)
+++ libsvn_client/repos_diff.c	(working copy)
@@ -642,7 +642,8 @@
           const char *copyfrom_path,
           svn_revnum_t copyfrom_revision,
           apr_pool_t *pool,
-          void **file_baton)
+          void **file_baton,
+          svn_boolean_t taking_over__ignored)
 {
   struct dir_baton *pb = parent_baton;
   struct file_baton *b;
Index: libsvn_client/export.c
===================================================================
--- libsvn_client/export.c	(revision 15261)
+++ libsvn_client/export.c	(working copy)
@@ -541,7 +541,8 @@
           const char *copyfrom_path,
           svn_revnum_t copyfrom_revision,
           apr_pool_t *pool,
-          void **baton)
+          void **baton,
+          svn_boolean_t taking_over__ignored)
 {
   struct dir_baton *pb = parent_baton;
   struct edit_baton *eb = pb->edit_baton;
Index: libsvn_client/client.h
===================================================================
--- libsvn_client/client.h	(revision 15261)
+++ libsvn_client/client.h	(working copy)
@@ -322,7 +322,8 @@
                              svn_boolean_t ignore_externals,
                              svn_boolean_t *timestamp_sleep,
                              svn_client_ctx_t *ctx,
-                             apr_pool_t *pool);
+                             apr_pool_t *pool,
+                             svn_boolean_t taking_over);
 
 /* Checkout into PATH a working copy of URL at REVISION, and (if not
    NULL) set RESULT_REV to the checked out revision.  RECURSE if so
@@ -342,7 +343,8 @@
                                svn_boolean_t ignore_externals,
                                svn_boolean_t *timestamp_sleep,
                                svn_client_ctx_t *ctx,
-                               apr_pool_t *pool);
+                               apr_pool_t *pool,
+                               svn_boolean_t taking_over);
 
 /* ---------------------------------------------------------------- */
 
Index: libsvn_client/checkout.c
===================================================================
--- libsvn_client/checkout.c	(revision 15261)
+++ libsvn_client/checkout.c	(working copy)
@@ -39,7 +39,6 @@
 
 /*** Public Interfaces. ***/
 
-
 svn_error_t *
 svn_client__checkout_internal (svn_revnum_t *result_rev,
                                const char *url,
@@ -50,7 +49,8 @@
                                svn_boolean_t ignore_externals,
                                svn_boolean_t *timestamp_sleep,
                                svn_client_ctx_t *ctx,
-                               apr_pool_t *pool)
+                               apr_pool_t *pool,
+                               svn_boolean_t taking_over)
 {
   svn_wc_traversal_info_t *traversal_info = svn_wc_init_traversal_info (pool);
   svn_error_t *err = NULL;
@@ -98,6 +98,11 @@
 
       if (kind == svn_node_none)
         {
+          if (taking_over)
+            return svn_error_createf
+              (SVN_ERR_UNSUPPORTED_FEATURE , NULL,
+              _("URL '%s' refers to a non-existent repository path; the takeover command is supported only for existing repository paths"), URL);
+
           /* Bootstrap: create an incomplete working-copy root dir.  Its
              entries file should only have an entry for THIS_DIR with a
              URL, revnum, and an 'incomplete' flag.  */
@@ -107,7 +112,7 @@
           /* Have update fix the incompleteness. */
           err = svn_client__update_internal (result_rev, path, revision,
                                              recurse, ignore_externals,
-                                             use_sleep, ctx, pool);
+                                             use_sleep, ctx, pool, FALSE);
         }
       else if (kind == svn_node_dir)
         {
@@ -122,7 +127,7 @@
               SVN_ERR (svn_wc_ensure_adm (path, uuid, URL, revnum, pool));
               err = svn_client__update_internal (result_rev, path, revision,
                                                  recurse, ignore_externals,
-                                                 use_sleep, ctx, pool);
+                                                 use_sleep, ctx, pool, taking_over);
               goto done;
             }
 
@@ -140,7 +145,7 @@
             {
               err = svn_client__update_internal (result_rev, path, revision,
                                                  recurse, ignore_externals,
-                                                 use_sleep, ctx, pool);
+                                                 use_sleep, ctx, pool, taking_over);
             }
           else
             {
@@ -190,6 +195,23 @@
 }
 
 svn_error_t *
+svn_client_checkout3 (svn_revnum_t *result_rev,
+                      const char *URL,
+                      const char *path,
+                      const svn_opt_revision_t *peg_revision,
+                      const svn_opt_revision_t *revision,
+                      svn_boolean_t recurse,
+                      svn_boolean_t ignore_externals,
+                      svn_client_ctx_t *ctx,
+                      apr_pool_t *pool,
+                      svn_boolean_t taking_over)
+{
+  return svn_client__checkout_internal (result_rev, URL, path, peg_revision,
+                                        revision, recurse, ignore_externals,
+                                        NULL, ctx, pool, taking_over);
+}
+
+svn_error_t *
 svn_client_checkout2 (svn_revnum_t *result_rev,
                       const char *URL,
                       const char *path,
@@ -202,7 +224,7 @@
 {
   return svn_client__checkout_internal (result_rev, URL, path, peg_revision,
                                         revision, recurse, ignore_externals,
-                                        NULL, ctx, pool);
+                                        NULL, ctx, pool, FALSE);
 }
 
 svn_error_t *
@@ -220,5 +242,5 @@
   
   return svn_client__checkout_internal (result_rev, URL, path, &peg_revision,
                                         revision, recurse, FALSE, NULL, 
-                                        ctx, pool);
+                                        ctx, pool, FALSE);
 }
Index: libsvn_client/copy.c
===================================================================
--- libsvn_client/copy.c	(revision 15261)
+++ libsvn_client/copy.c	(working copy)
@@ -255,7 +255,7 @@
           SVN_ERR (cb_baton->editor->add_file (path, parent_baton, 
                                                cb_baton->src_url, 
                                                cb_baton->src_revnum, 
-                                               pool, &file_baton));
+                                               pool, &file_baton, FALSE));
           SVN_ERR (cb_baton->editor->close_file (file_baton, NULL, pool));
         }
       else
@@ -892,7 +892,7 @@
     {
       SVN_ERR (svn_client__checkout_internal
                (NULL, src_url, dst_path, &revision, &revision,
-                TRUE, FALSE, NULL, ctx, pool));
+                TRUE, FALSE, NULL, ctx, pool, FALSE));
 
       if ((revision.kind == svn_opt_revision_head) && same_repositories)
         {
Index: libsvn_client/update.c
===================================================================
--- libsvn_client/update.c	(revision 15261)
+++ libsvn_client/update.c	(working copy)
@@ -46,7 +46,8 @@
                              svn_boolean_t ignore_externals,
                              svn_boolean_t *timestamp_sleep,
                              svn_client_ctx_t *ctx,
-                             apr_pool_t *pool)
+                             apr_pool_t *pool,
+                             svn_boolean_t taking_over)
 {
   const svn_delta_editor_t *update_editor;
   void *update_edit_baton;
@@ -113,14 +114,14 @@
 
   /* Fetch the 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_update_editor2 (&revnum, adm_access, target,
+  SVN_ERR (svn_wc_get_update_editor3 (&revnum, adm_access, target,
                                       use_commit_times, recurse,
                                       ctx->notify_func2, ctx->notify_baton2,
                                       ctx->cancel_func, ctx->cancel_baton,
                                       diff3_cmd,
                                       &update_editor, &update_edit_baton,
                                       traversal_info,
-                                      pool));
+                                      pool, taking_over));
 
   /* Tell RA to do an update of URL+TARGET to REVISION; if we pass an
      invalid revnum, that means RA will use the latest revision.  */
@@ -210,7 +211,7 @@
 
       err = svn_client__update_internal (&result_rev, path, revision,
                                          recurse, ignore_externals, 
-                                         &sleep, ctx, subpool);
+                                         &sleep, ctx, subpool, FALSE);
       if (err && err->apr_err != SVN_ERR_WC_NOT_DIRECTORY)
         {
           return err;
@@ -246,5 +247,5 @@
                    apr_pool_t *pool)
 {
   return svn_client__update_internal (result_rev, path, revision, recurse, 
-                                      FALSE, NULL, ctx, pool);
+                                      FALSE, NULL, ctx, pool, FALSE);
 }
Index: libsvn_client/commit_util.c
===================================================================
--- libsvn_client/commit_util.c	(revision 15261)
+++ libsvn_client/commit_util.c	(working copy)
@@ -1084,7 +1084,7 @@
           SVN_ERR (editor->add_file 
                    (path, parent_baton, copyfrom_url, 
                     copyfrom_url ? item->revision : SVN_INVALID_REVNUM,
-                    file_pool, &file_baton));
+                    file_pool, &file_baton, FALSE));
         }
       else
         {
Index: libsvn_client/commit.c
===================================================================
--- libsvn_client/commit.c	(revision 15261)
+++ libsvn_client/commit.c	(working copy)
@@ -212,7 +212,7 @@
 
   /* Add the file, using the pool from the FILES hash. */
   SVN_ERR (editor->add_file (edit_path, dir_baton, NULL, SVN_INVALID_REVNUM, 
-                             pool, &file_baton));
+                             pool, &file_baton, FALSE));
 
   /* Remember that the repository was modified */
   import_ctx->repos_changed = TRUE;
Index: clients/cmdline/cl.h
===================================================================
--- clients/cmdline/cl.h	(revision 15261)
+++ clients/cmdline/cl.h	(working copy)
@@ -156,6 +156,7 @@
   svn_cl__add,
   svn_cl__blame,
   svn_cl__checkout,
+  svn_cl__takeover,
   svn_cl__cleanup,
   svn_cl__commit,
   svn_cl__copy,
Index: clients/cmdline/checkout-cmd.c
===================================================================
--- clients/cmdline/checkout-cmd.c	(revision 15261)
+++ clients/cmdline/checkout-cmd.c	(working copy)
@@ -55,6 +55,8 @@
   Is this the same as CVS?  Does it matter if it is not?
 */
 
+/* Forward declaration */
+svn_error_t *checkout_takeover_impl (apr_getopt_t *os, void *baton, apr_pool_t *pool, svn_boolean_t taking_over);
 
 /* This implements the `svn_opt_subcommand_t' interface. */
 svn_error_t *
@@ -62,6 +64,23 @@
                   void *baton,
                   apr_pool_t *pool)
 {
+  return checkout_takeover_impl(os, baton, pool, FALSE);
+}
+
+svn_error_t *
+svn_cl__takeover (apr_getopt_t *os,
+                  void *baton,
+                  apr_pool_t *pool)
+{
+  return checkout_takeover_impl(os, baton, pool, TRUE);
+}
+
+static svn_error_t *
+checkout_takeover_impl (apr_getopt_t *os,
+                        void *baton,
+                        apr_pool_t *pool,
+                        svn_boolean_t taking_over)
+{
   svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
   svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
   apr_pool_t *subpool;
@@ -146,12 +165,13 @@
       if (opt_state->start_revision.kind == svn_opt_revision_unspecified)
         opt_state->start_revision.kind = svn_opt_revision_head;
 
-      SVN_ERR (svn_client_checkout2 (NULL, true_url, target_dir,
+      SVN_ERR (svn_client_checkout3 (NULL, true_url, target_dir,
                                      &peg_revision,
                                      &(opt_state->start_revision),
                                      opt_state->nonrecursive ? FALSE : TRUE,
                                      opt_state->ignore_externals,
-                                     ctx, subpool));
+                                     ctx, subpool,
+                                     taking_over));
     }
   svn_pool_destroy (subpool);
   
Index: clients/cmdline/notify.c
===================================================================
--- clients/cmdline/notify.c	(revision 15261)
+++ clients/cmdline/notify.c	(working copy)
@@ -90,6 +90,12 @@
         goto print_error;
       break;
 
+    case svn_wc_notify_update_takeover:
+      nb->received_some_change = TRUE;
+      if ((err = svn_cmdline_printf (pool, "T    %s\n", path_local)))
+        goto print_error;
+      break;
+
     case svn_wc_notify_restore:
       if ((err = svn_cmdline_printf (pool, _("Restored '%s'\n"),
                                      path_local)))
Index: clients/cmdline/main.c
===================================================================
--- clients/cmdline/main.c	(revision 15261)
+++ clients/cmdline/main.c	(working copy)
@@ -216,6 +216,26 @@
     {'r', 'q', 'N', SVN_CL__AUTH_OPTIONS, svn_cl__config_dir_opt,
      svn_cl__ignore_externals_opt} },
 
+  { "takeover", svn_cl__takeover, {"to"}, N_
+    ("Make an existing source tree a working tree for a repository.\n"
+     "usage: takeover URL[@REV]... [PATH]\n"
+     "\n"
+     "  If specified, REV determines in which revision the URL is first\n"
+     "  looked up.\n"
+     "\n"
+     "  If PATH is omitted, the basename of the URL will be used as\n"
+     "  the destination. If multiple URLs are given each will be used to\n"
+     "  take over a sub-directory of PATH, with the name of the sub-directory\n"
+     "  being the basename of the URL.\n"
+     "\n"
+     "  The takeover command works exactly the same as the checkout command,\n"
+     "  except that existing files will be left as-is and will not obstruct\n"
+     "  the operation. Any such files will be treated as newer than the\n"
+     "  repository copy. That is, SVN will treat the files as though they\n"
+     "  had been checked out normally and then edited to their present state.\n"),
+    {'r', 'q', 'N', SVN_CL__AUTH_OPTIONS, svn_cl__config_dir_opt,
+     svn_cl__ignore_externals_opt} },
+
   { "cleanup", svn_cl__cleanup, {0},
     N_("Recursively clean up the working copy, removing locks, resuming\n"
        "unfinished operations, etc.\n"
Index: libsvn_repos/reporter.c
===================================================================
--- libsvn_repos/reporter.c	(revision 15261)
+++ libsvn_repos/reporter.c	(working copy)
@@ -727,7 +727,7 @@
                                        &new_baton));
       else
         SVN_ERR (b->editor->add_file (e_path, dir_baton, NULL,
-                                      SVN_INVALID_REVNUM, pool, &new_baton));
+                                      SVN_INVALID_REVNUM, pool, &new_baton, b->editor->taking_over));
       SVN_ERR (delta_files (b, new_baton, s_rev, s_path, t_path,
                             info ? info->lock_token : NULL, pool));
       SVN_ERR (svn_fs_file_md5_checksum (digest, b->t_root, t_path, pool));
Index: libsvn_repos/dump.c
===================================================================
--- libsvn_repos/dump.c	(revision 15261)
+++ libsvn_repos/dump.c	(working copy)
@@ -694,7 +694,8 @@
           const char *copyfrom_path,
           svn_revnum_t copyfrom_rev,
           apr_pool_t *pool,
-          void **file_baton)
+          void **file_baton,
+          svn_boolean_t taking_over)
 {
   struct dir_baton *pb = parent_baton;
   struct edit_baton *eb = pb->edit_baton;
Index: libsvn_repos/commit.c
===================================================================
--- libsvn_repos/commit.c	(revision 15261)
+++ libsvn_repos/commit.c	(working copy)
@@ -367,7 +367,8 @@
           const char *copy_path,
           svn_revnum_t copy_revision,
           apr_pool_t *pool,
-          void **file_baton)
+          void **file_baton,
+          svn_boolean_t taking_over__ignored)
 {
   struct file_baton *new_fb;
   struct dir_baton *pb = parent_baton;
Index: libsvn_repos/delta.c
===================================================================
--- libsvn_repos/delta.c	(revision 15261)
+++ libsvn_repos/delta.c	(working copy)
@@ -822,7 +822,7 @@
 
       SVN_ERR (context->editor->add_file (edit_path, dir_baton,
                                           NULL, SVN_INVALID_REVNUM, pool, 
-                                          &file_baton));
+                                          &file_baton, FALSE));
       SVN_ERR (delta_files (context, file_baton, NULL, target_path, pool));
       SVN_ERR (svn_fs_file_md5_checksum (digest, context->target_root,
                                          target_path, pool));
Index: libsvn_repos/replay.c
===================================================================
--- libsvn_repos/replay.c	(revision 15261)
+++ libsvn_repos/replay.c	(working copy)
@@ -180,7 +180,7 @@
         {
           SVN_ERR (editor->add_file (path, parent_baton, 
                                      copyfrom_path, copyfrom_rev, 
-                                     pool, &file_baton));
+                                     pool, &file_baton, FALSE));
         }
     }
   else if (! do_delete)
Index: libsvn_ra_svn/editor.c
===================================================================
--- libsvn_ra_svn/editor.c	(revision 15261)
+++ libsvn_ra_svn/editor.c	(working copy)
@@ -189,7 +189,8 @@
                                     const char *copy_path,
                                     svn_revnum_t copy_rev,
                                     apr_pool_t *pool,
-                                    void **file_baton)
+                                    void **file_baton,
+                                    svn_boolean_t taking_over__ignored)
 {
   ra_svn_baton_t *b = parent_baton;
   const char *token = make_token('c', b->eb, pool);
@@ -553,7 +554,8 @@
   file_entry = store_token(ds, NULL, file_token, subpool);
   file_entry->err = ds->editor->add_file(path, entry->baton, copy_path,
                                          copy_rev, subpool,
-                                         &file_entry->baton);
+                                         &file_entry->baton,
+                                         ds->editor->taking_over);
   return SVN_NO_ERROR;
 }
 
Index: libsvn_ra_svn/editorp.c
===================================================================
--- libsvn_ra_svn/editorp.c	(revision 15261)
+++ libsvn_ra_svn/editorp.c	(working copy)
@@ -221,7 +221,8 @@
                                     const char *copy_path,
                                     svn_revnum_t copy_rev,
                                     apr_pool_t *pool,
-                                    void **file_baton)
+                                    void **file_baton,
+                                    svn_boolean_t taking_over__ignored)
 {
   ra_svn_baton_t *b = parent_baton;
   const char *token = make_token('c', b->eb, pool);
@@ -565,7 +566,7 @@
     copy_path = svn_path_canonicalize(copy_path, pool);
   file_entry = store_token(ds, NULL, file_token, TRUE, ds->file_pool);
   SVN_CMD_ERR(ds->editor->add_file(path, entry->baton, copy_path, copy_rev,
-                                   ds->file_pool, &file_entry->baton));
+                                   ds->file_pool, &file_entry->baton, ds->editor->taking_over));
   return SVN_NO_ERROR;
 }
 
Index: libsvn_delta/cancel.c
===================================================================
--- libsvn_delta/cancel.c	(revision 15261)
+++ libsvn_delta/cancel.c	(working copy)
@@ -155,7 +155,8 @@
           const char *copyfrom_path,
           svn_revnum_t copyfrom_revision,
           apr_pool_t *pool,
-          void **file_baton)
+          void **file_baton,
+          svn_boolean_t taking_over)
 {
   struct dir_baton *pb = parent_baton;
   struct edit_baton *eb = pb->edit_baton;
@@ -168,7 +169,8 @@
                                          copyfrom_path,
                                          copyfrom_revision,
                                          pool,
-                                         &fb->wrapped_file_baton));
+                                         &fb->wrapped_file_baton,
+                                         taking_over));
 
   fb->edit_baton = eb;
   *file_baton = fb;
@@ -366,6 +368,8 @@
       tree_editor->absent_file = absent_file;
       tree_editor->close_edit = close_edit;
 
+      tree_editor->taking_over = wrapped_editor->taking_over;
+
       eb->wrapped_editor = wrapped_editor;
       eb->wrapped_edit_baton = wrapped_edit_baton;
       eb->cancel_func = cancel_func;
Index: libsvn_delta/default_editor.c
===================================================================
--- libsvn_delta/default_editor.c	(revision 15261)
+++ libsvn_delta/default_editor.c	(working copy)
@@ -31,12 +31,26 @@
 {
   return SVN_NO_ERROR;
 }
+
 static svn_error_t *
 add_item (const char *path,
           void *parent_baton,
           const char *copyfrom_path,
           svn_revnum_t copyfrom_revision,
           apr_pool_t *pool,
+          void **baton,
+          svn_boolean_t taking_over__ignored)
+{
+  *baton = NULL;
+  return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+add_directory (const char *path,
+          void *parent_baton,
+          const char *copyfrom_path,
+          svn_revnum_t copyfrom_revision,
+          apr_pool_t *pool,
           void **baton)
 {
   *baton = NULL;
@@ -134,7 +148,7 @@
   set_target_revision,  
   open_root,
   delete_entry,
-  add_item,
+  add_directory,
   open_item,
   change_prop,
   single_baton_func,
Index: libsvn_ra_dav/commit.c
===================================================================
--- libsvn_ra_dav/commit.c	(revision 15261)
+++ libsvn_ra_dav/commit.c	(working copy)
@@ -1078,7 +1078,8 @@
                                      const char *copyfrom_path,
                                      svn_revnum_t copyfrom_revision,
                                      apr_pool_t *file_pool,
-                                     void **file_baton)
+                                     void **file_baton,
+                                     svn_boolean_t taking_over__ignored)
 {
   resource_baton_t *parent = parent_baton;
   resource_baton_t *file;
Index: libsvn_ra_dav/fetch.c
===================================================================
--- libsvn_ra_dav/fetch.c	(revision 15261)
+++ libsvn_ra_dav/fetch.c	(working copy)
@@ -2139,7 +2139,8 @@
                                       parent_dir->baton,
                                       cpath ? cpath->data : NULL, 
                                       crev, rb->file_pool,
-                                      &rb->file_baton) );
+                                      &rb->file_baton,
+                                      rb->editor->taking_over) );
 
       /* Property fetching is implied in addition.  This flag is only
          for parsing old-style reports; it is ignored when talking to
