Hi!

resolve_target_path() makes a few assumptions about the target for a
patch file beeing a wc_dir. Currently we can only invoke svn patch like
this:

  svn patch PATCH_FILE WC_DIR_PATH

Is this the intended behavoiour?

[[[

Make it clearer that the patch code can only use base paths that are
dirs.

* subversion/svn/main.c
  (svn_opt_subcommand_desc2_t): Clarify help text.

* subversion/include/svn_client.h
  (svn_client_patch): Replace parameter 'local_abspath' with
    'base_dir_abspath'.

* subversion/libsvn_client/patch.c
  (resolve_target_path,
   svn_client_patch): Replace parameter 'local_abspath' with
    'base_dir_abspath'
]]]
  
Cheers,
Daniel
Index: subversion/svn/main.c
===================================================================
--- subversion/svn/main.c       (revision 981230)
+++ subversion/svn/main.c       (arbetskopia)
@@ -812,10 +812,10 @@ const svn_opt_subcommand_desc2_t svn_cl__cmd_table
 
   { "patch", svn_cl__patch, {0}, N_
     ("Apply a patch to a working copy.\n"
-     "usage: patch PATCHFILE [WCPATH]\n"
+     "usage: patch PATCHFILE [WC_DIR_PATH]\n"
      "\n"
-     "  Apply a unidiff patch in PATCHFILE to the working copy WCPATH.\n"
-     "  If WCPATH is omitted, '.' is assumed.\n"
+     "  Apply a unidiff patch in PATCHFILE to the working copy WC_DIR_PATH.\n"
+     "  If WC_DIR_PATH is omitted, '.' is assumed.\n"
      "\n"
      "  A unidiff patch suitable for application to a working copy can be\n"
      "  produced with the 'svn diff' command or third-party diffing tools.\n"
Index: subversion/include/svn_client.h
===================================================================
--- subversion/include/svn_client.h     (revision 981230)
+++ subversion/include/svn_client.h     (arbetskopia)
@@ -5204,7 +5204,7 @@ typedef svn_error_t *(*svn_client_patch_func_t)(
 
 /**
  * Apply a unidiff patch that's located at absolute path
- * @a patch_abspath to the working copy at @a local_abspath.
+ * @a patch_abspath to the working copy at @a base_dir_abspath.
  *
  * This function makes a best-effort attempt at applying the patch.
  * It might skip patch targets which cannot be patched (e.g. targets
@@ -5247,7 +5247,7 @@ typedef svn_error_t *(*svn_client_patch_func_t)(
  */
 svn_error_t *
 svn_client_patch(const char *patch_abspath,
-                 const char *local_abspath,
+                 const char *base_dir_abspath,
                  svn_boolean_t dry_run,
                  int strip_count,
                  svn_boolean_t reverse,
Index: subversion/libsvn_client/patch.c
===================================================================
--- subversion/libsvn_client/patch.c    (revision 981230)
+++ subversion/libsvn_client/patch.c    (arbetskopia)
@@ -329,7 +329,7 @@ obtain_eol_and_keywords_for_file(apr_hash_t **keyw
 static svn_error_t *
 resolve_target_path(patch_target_t *target,
                     const char *path_from_patchfile,
-                    const char *local_abspath,
+                    const char *base_dir_abspath,
                     int strip_count,
                     svn_boolean_t prop_changes_only,
                     svn_wc_context_t *wc_ctx,
@@ -359,7 +359,7 @@ resolve_target_path(patch_target_t *target,
 
   if (svn_dirent_is_absolute(stripped_path))
     {
-      target->local_relpath = svn_dirent_is_child(local_abspath, stripped_path,
+      target->local_relpath = svn_dirent_is_child(base_dir_abspath, 
stripped_path,
                                                   result_pool);
 
       /* ### We need to allow setting props on the wc root dir */
@@ -380,7 +380,7 @@ resolve_target_path(patch_target_t *target,
 
   /* Make sure the path is secure to use. We want the target to be inside
    * of the working copy and not be fooled by symlinks it might contain. */
-  if (! svn_dirent_is_under_root(&target->local_abspath, local_abspath,
+  if (! svn_dirent_is_under_root(&target->local_abspath, base_dir_abspath,
                                  target->local_relpath, result_pool))
     {
       /* The target path is outside of the working copy. Skip it. */
@@ -2582,7 +2582,7 @@ apply_patches(void *baton,
 
 svn_error_t *
 svn_client_patch(const char *patch_abspath,
-                 const char *local_abspath,
+                 const char *base_dir_abspath,
                  svn_boolean_t dry_run,
                  int strip_count,
                  svn_boolean_t reverse,

Reply via email to