You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2010/11/01 18:15:29 UTC

svn commit: r1029751 - in /subversion/trunk/subversion: include/svn_client.h libsvn_client/export.c svn/export-cmd.c tests/cmdline/export_tests.py

Author: philip
Date: Mon Nov  1 17:15:29 2010
New Revision: 1029751

URL: http://svn.apache.org/viewvc?rev=1029751&view=rev
Log:
Fix issue 3727: Fix regression caused by r880559

* subversion/tests/cmdline/export_tests.py
  (export_to_explicit_cwd): Remove XFail.

* subversion/svn/export-cmd.c
  (svn_cl__export): Move logic into subversion/libsvn_client/export.c

* subversion/include/svn_client.h
  (svn_client_export5): Update docstring.

* subversion/libsvn_client/export.c
  (svn_client_export5): If the TO path is empty when exporting an
   single file then use the basename of the URL.

Patch by: Noorul Islam K M <noorul{_AT_}collab.net>
Tweaked by: me

Modified:
    subversion/trunk/subversion/include/svn_client.h
    subversion/trunk/subversion/libsvn_client/export.c
    subversion/trunk/subversion/svn/export-cmd.c
    subversion/trunk/subversion/tests/cmdline/export_tests.py

Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1029751&r1=1029750&r2=1029751&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Mon Nov  1 17:15:29 2010
@@ -4461,8 +4461,10 @@ svn_client_revprop_list(apr_hash_t **pro
  * @a from is either the path the working copy on disk, or a URL to the
  * repository you wish to export.
  *
- * @a to is the path to the directory where you wish to create the exported
- * tree.
+ * When exporting a directory @a to is the path to the directory where
+ * you wish to create the exported tree, when exporting a file it is
+ * the path of the file that will be created.  If @a to is the empty
+ * path the name of the file/directory in the repository will be used.
  *
  * @a peg_revision is the revision where the path is first looked up
  * when exporting from a repository.  If @a peg_revision->kind is

Modified: subversion/trunk/subversion/libsvn_client/export.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/export.c?rev=1029751&r1=1029750&r2=1029751&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/export.c (original)
+++ subversion/trunk/subversion/libsvn_client/export.c Mon Nov  1 17:15:29 2010
@@ -993,6 +993,12 @@ svn_client_export5(svn_revnum_t *result_
           apr_hash_index_t *hi;
           struct file_baton *fb = apr_pcalloc(pool, sizeof(*fb));
 
+          if (svn_path_is_empty(to))
+            {
+              to = svn_path_uri_decode(svn_uri_basename(from, NULL), pool);
+              eb->root_path = to;
+            }
+          
           /* Since you cannot actually root an editor at a file, we
            * manually drive a few functions of our editor. */
 

Modified: subversion/trunk/subversion/svn/export-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/export-cmd.c?rev=1029751&r1=1029750&r2=1029751&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/export-cmd.c (original)
+++ subversion/trunk/subversion/svn/export-cmd.c Mon Nov  1 17:15:29 2010
@@ -79,10 +79,7 @@ svn_cl__export(apr_getopt_t *os,
     {
       to = APR_ARRAY_IDX(targets, 1, const char *);
 
-      /* If given the cwd, pretend we weren't given anything. */
-      if (strcmp("", to) == 0)
-        to = svn_path_uri_decode(svn_uri_basename(truefrom, pool), pool);
-      else
+      if (strcmp("", to) != 0)
         /* svn_cl__eat_peg_revisions() but only on one target */
         SVN_ERR(svn_opt__split_arg_at_peg_revision(&to, NULL, to, pool));
     }

Modified: subversion/trunk/subversion/tests/cmdline/export_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/export_tests.py?rev=1029751&r1=1029750&r2=1029751&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/export_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/export_tests.py Mon Nov  1 17:15:29 2010
@@ -680,7 +680,7 @@ test_list = [ None,
               export_with_url_unsafe_characters,
               XFail(export_working_copy_with_depths),
               export_externals_with_native_eol,
-              XFail(export_to_current_dir),
+              export_to_current_dir,
              ]
 
 if __name__ == '__main__':



Re: svn commit: r1029751 - in /subversion/trunk/subversion: include/svn_client.h libsvn_client/export.c svn/export-cmd.c tests/cmdline/export_tests.py

Posted by Philip Martin <ph...@wandisco.com>.
Julian Foad <ju...@wandisco.com> writes:

>> - * @a to is the path to the directory where you wish to create the exported
>> - * tree.
>> + * When exporting a directory @a to is the path to the directory where
>> + * you wish to create the exported tree, when exporting a file it is
>> + * the path of the file that will be created.  If @a to is the empty
>> + * path the name of the file/directory in the repository will be used.
>
> I'm not sure that last sentence is true for a directory, only for a
> file.

It describes the command line client behaviour, and the client doesn't
distinguish files/directories when calling svn_client_export5.

> I think this doc string may need to explain more subtleties to the total
> behaviour, but I haven't quite grokked it all.  For example: does it
> make any difference whether the specified path already exists on disk?
> For a dir, is the exported tree's root created *at* or *below* the
> specified dir?

There is a difference between files and directories, files overwrite
while directories give an error saying "use --force".

-- 
Philip

Re: svn commit: r1029751 - in /subversion/trunk/subversion: include/svn_client.h libsvn_client/export.c svn/export-cmd.c tests/cmdline/export_tests.py

Posted by Julian Foad <ju...@wandisco.com>.
On Mon, 2010-11-01 at 17:15 +0000, philip@apache.org wrote:
> Author: philip
> Date: Mon Nov  1 17:15:29 2010
> New Revision: 1029751
> 
> URL: http://svn.apache.org/viewvc?rev=1029751&view=rev
> Log:
> Fix issue 3727: Fix regression caused by r880559
> 
> * subversion/tests/cmdline/export_tests.py
>   (export_to_explicit_cwd): Remove XFail.
> 
> * subversion/svn/export-cmd.c
>   (svn_cl__export): Move logic into subversion/libsvn_client/export.c
> 
> * subversion/include/svn_client.h
>   (svn_client_export5): Update docstring.
> 
> * subversion/libsvn_client/export.c
>   (svn_client_export5): If the TO path is empty when exporting an
>    single file then use the basename of the URL.
> 
> Patch by: Noorul Islam K M <noorul{_AT_}collab.net>
> Tweaked by: me
> 
> Modified:
>     subversion/trunk/subversion/include/svn_client.h
>     subversion/trunk/subversion/libsvn_client/export.c
>     subversion/trunk/subversion/svn/export-cmd.c
>     subversion/trunk/subversion/tests/cmdline/export_tests.py
> 
> Modified: subversion/trunk/subversion/include/svn_client.h
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1029751&r1=1029750&r2=1029751&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/include/svn_client.h (original)
> +++ subversion/trunk/subversion/include/svn_client.h Mon Nov  1 17:15:29 2010
> @@ -4461,8 +4461,10 @@ svn_client_revprop_list(apr_hash_t **pro
>   * @a from is either the path the working copy on disk, or a URL to the
>   * repository you wish to export.
>   *
> - * @a to is the path to the directory where you wish to create the exported
> - * tree.
> + * When exporting a directory @a to is the path to the directory where
> + * you wish to create the exported tree, when exporting a file it is
> + * the path of the file that will be created.  If @a to is the empty
> + * path the name of the file/directory in the repository will be used.

I'm not sure that last sentence is true for a directory, only for a
file.

I think this doc string may need to explain more subtleties to the total
behaviour, but I haven't quite grokked it all.  For example: does it
make any difference whether the specified path already exists on disk?
For a dir, is the exported tree's root created *at* or *below* the
specified dir?

- Julian


>   * @a peg_revision is the revision where the path is first looked up
>   * when exporting from a repository.  If @a peg_revision->kind is
> 
> Modified: subversion/trunk/subversion/libsvn_client/export.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/export.c?rev=1029751&r1=1029750&r2=1029751&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_client/export.c (original)
> +++ subversion/trunk/subversion/libsvn_client/export.c Mon Nov  1 17:15:29 2010
> @@ -993,6 +993,12 @@ svn_client_export5(svn_revnum_t *result_
>            apr_hash_index_t *hi;
>            struct file_baton *fb = apr_pcalloc(pool, sizeof(*fb));
>  
> +          if (svn_path_is_empty(to))
> +            {
> +              to = svn_path_uri_decode(svn_uri_basename(from, NULL), pool);
> +              eb->root_path = to;
> +            }
> +          
>            /* Since you cannot actually root an editor at a file, we
>             * manually drive a few functions of our editor. */
>  
> 
> Modified: subversion/trunk/subversion/svn/export-cmd.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/export-cmd.c?rev=1029751&r1=1029750&r2=1029751&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/svn/export-cmd.c (original)
> +++ subversion/trunk/subversion/svn/export-cmd.c Mon Nov  1 17:15:29 2010
> @@ -79,10 +79,7 @@ svn_cl__export(apr_getopt_t *os,
>      {
>        to = APR_ARRAY_IDX(targets, 1, const char *);
>  
> -      /* If given the cwd, pretend we weren't given anything. */
> -      if (strcmp("", to) == 0)
> -        to = svn_path_uri_decode(svn_uri_basename(truefrom, pool), pool);
> -      else
> +      if (strcmp("", to) != 0)
>          /* svn_cl__eat_peg_revisions() but only on one target */
>          SVN_ERR(svn_opt__split_arg_at_peg_revision(&to, NULL, to, pool));
>      }
> 
> Modified: subversion/trunk/subversion/tests/cmdline/export_tests.py
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/export_tests.py?rev=1029751&r1=1029750&r2=1029751&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/tests/cmdline/export_tests.py (original)
> +++ subversion/trunk/subversion/tests/cmdline/export_tests.py Mon Nov  1 17:15:29 2010
> @@ -680,7 +680,7 @@ test_list = [ None,
>                export_with_url_unsafe_characters,
>                XFail(export_working_copy_with_depths),
>                export_externals_with_native_eol,
> -              XFail(export_to_current_dir),
> +              export_to_current_dir,
>               ]
>  
>  if __name__ == '__main__':
> 
> 



Re: svn commit: r1029751 - in /subversion/trunk/subversion: include/svn_client.h libsvn_client/export.c svn/export-cmd.c tests/cmdline/export_tests.py

Posted by Julian Foad <ju...@wandisco.com>.
On Mon, 2010-11-01 at 17:15 +0000, philip@apache.org wrote:
> Author: philip
> Date: Mon Nov  1 17:15:29 2010
> New Revision: 1029751
> 
> URL: http://svn.apache.org/viewvc?rev=1029751&view=rev
> Log:
> Fix issue 3727: Fix regression caused by r880559
> 
> * subversion/tests/cmdline/export_tests.py
>   (export_to_explicit_cwd): Remove XFail.
> 
> * subversion/svn/export-cmd.c
>   (svn_cl__export): Move logic into subversion/libsvn_client/export.c
> 
> * subversion/include/svn_client.h
>   (svn_client_export5): Update docstring.
> 
> * subversion/libsvn_client/export.c
>   (svn_client_export5): If the TO path is empty when exporting an
>    single file then use the basename of the URL.
> 
> Patch by: Noorul Islam K M <noorul{_AT_}collab.net>
> Tweaked by: me
> 
> Modified:
>     subversion/trunk/subversion/include/svn_client.h
>     subversion/trunk/subversion/libsvn_client/export.c
>     subversion/trunk/subversion/svn/export-cmd.c
>     subversion/trunk/subversion/tests/cmdline/export_tests.py
> 
> Modified: subversion/trunk/subversion/include/svn_client.h
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1029751&r1=1029750&r2=1029751&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/include/svn_client.h (original)
> +++ subversion/trunk/subversion/include/svn_client.h Mon Nov  1 17:15:29 2010
> @@ -4461,8 +4461,10 @@ svn_client_revprop_list(apr_hash_t **pro
>   * @a from is either the path the working copy on disk, or a URL to the
>   * repository you wish to export.
>   *
> - * @a to is the path to the directory where you wish to create the exported
> - * tree.
> + * When exporting a directory @a to is the path to the directory where
> + * you wish to create the exported tree, when exporting a file it is
> + * the path of the file that will be created.  If @a to is the empty
> + * path the name of the file/directory in the repository will be used.

I'm not sure that last sentence is true for a directory, only for a
file.

I think this doc string may need to explain more subtleties to the total
behaviour, but I haven't quite grokked it all.  For example: does it
make any difference whether the specified path already exists on disk?
For a dir, is the exported tree's root created *at* or *below* the
specified dir?

- Julian


>   * @a peg_revision is the revision where the path is first looked up
>   * when exporting from a repository.  If @a peg_revision->kind is
> 
> Modified: subversion/trunk/subversion/libsvn_client/export.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/export.c?rev=1029751&r1=1029750&r2=1029751&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_client/export.c (original)
> +++ subversion/trunk/subversion/libsvn_client/export.c Mon Nov  1 17:15:29 2010
> @@ -993,6 +993,12 @@ svn_client_export5(svn_revnum_t *result_
>            apr_hash_index_t *hi;
>            struct file_baton *fb = apr_pcalloc(pool, sizeof(*fb));
>  
> +          if (svn_path_is_empty(to))
> +            {
> +              to = svn_path_uri_decode(svn_uri_basename(from, NULL), pool);
> +              eb->root_path = to;
> +            }
> +          
>            /* Since you cannot actually root an editor at a file, we
>             * manually drive a few functions of our editor. */
>  
> 
> Modified: subversion/trunk/subversion/svn/export-cmd.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/export-cmd.c?rev=1029751&r1=1029750&r2=1029751&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/svn/export-cmd.c (original)
> +++ subversion/trunk/subversion/svn/export-cmd.c Mon Nov  1 17:15:29 2010
> @@ -79,10 +79,7 @@ svn_cl__export(apr_getopt_t *os,
>      {
>        to = APR_ARRAY_IDX(targets, 1, const char *);
>  
> -      /* If given the cwd, pretend we weren't given anything. */
> -      if (strcmp("", to) == 0)
> -        to = svn_path_uri_decode(svn_uri_basename(truefrom, pool), pool);
> -      else
> +      if (strcmp("", to) != 0)
>          /* svn_cl__eat_peg_revisions() but only on one target */
>          SVN_ERR(svn_opt__split_arg_at_peg_revision(&to, NULL, to, pool));
>      }
> 
> Modified: subversion/trunk/subversion/tests/cmdline/export_tests.py
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/export_tests.py?rev=1029751&r1=1029750&r2=1029751&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/tests/cmdline/export_tests.py (original)
> +++ subversion/trunk/subversion/tests/cmdline/export_tests.py Mon Nov  1 17:15:29 2010
> @@ -680,7 +680,7 @@ test_list = [ None,
>                export_with_url_unsafe_characters,
>                XFail(export_working_copy_with_depths),
>                export_externals_with_native_eol,
> -              XFail(export_to_current_dir),
> +              export_to_current_dir,
>               ]
>  
>  if __name__ == '__main__':
> 
>