You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Julian Foad <ju...@btopenworld.com> on 2004/11/02 15:05:38 UTC

Improvements to "svn_opt_args_to_target_array" etc.

The doc string for "svn_opt_args_to_target_array" doesn't say that it strips 
the "@rev" part from the first two paths if @a extract_revisions is set.

Also, that feature of it is really an ugly way of combining two different 
functions into one; it should be split into two functions, the main one (used 
by nearly everything) which does not handle revisions, and a special one (only 
used by diff and merge) which ensures that there are only two targets, and 
extracts their revisions.

The doc string for "svn_opt_parse_path" doesn't say what it does if there is 
more than one "@" sign.  It lists examples of input, but not of the 
corresponding output.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Improvements to "svn_opt_args_to_target_array" etc.

Posted by Julian Foad <ju...@btopenworld.com>.
kfogel@collab.net wrote:
> Julian Foad <ju...@btopenworld.com> writes:
>>Heh!  I deliberately didn't say.  Depends whether I get around to it
>>any time soon.
> 
> Quite understandable, yes.  I deliberately didn't say, for the same
> reasons :-).  (But if you don't have time to do it soon, can you file
> it as an issue, so we don't forget?)

OK.  I'll keep an eye on it and file it or fix it.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Improvements to "svn_opt_args_to_target_array" etc.

Posted by kf...@collab.net.
Julian Foad <ju...@btopenworld.com> writes:
> Heh!  I deliberately didn't say.  Depends whether I get around to it
> any time soon.

Quite understandable, yes.  I deliberately didn't say, for the same
reasons :-).  (But if you don't have time to do it soon, can you file
it as an issue, so we don't forget?)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Improvements to "svn_opt_args_to_target_array" etc.

Posted by Julian Foad <ju...@btopenworld.com>.
kfogel@collab.net wrote:
> Julian Foad <ju...@btopenworld.com> writes:
> 
>>The doc string for "svn_opt_args_to_target_array" doesn't say that it
>>strips the "@rev" part from the first two paths if @a
>>extract_revisions is set.
>>
>>Also, that feature of it is really an ugly way of combining two
>>different functions into one; it should be split into two functions,
>>the main one (used by nearly everything) which does not handle
>>revisions, and a special one (only used by diff and merge) which
>>ensures that there are only two targets, and extracts their revisions.
>>
>>The doc string for "svn_opt_parse_path" doesn't say what it does if
>>there is more than one "@" sign.  It lists examples of input, but not
>>of the corresponding output.
> 
> I wasn't sure if you were proposing to make these improvements, but +1
> if so...

Heh!  I deliberately didn't say.  Depends whether I get around to it any time soon.

- Julian


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Improvements to "svn_opt_args_to_target_array" etc.

Posted by kf...@collab.net.
Julian Foad <ju...@btopenworld.com> writes:
> The doc string for "svn_opt_args_to_target_array" doesn't say that it
> strips the "@rev" part from the first two paths if @a
> extract_revisions is set.
> 
> Also, that feature of it is really an ugly way of combining two
> different functions into one; it should be split into two functions,
> the main one (used by nearly everything) which does not handle
> revisions, and a special one (only used by diff and merge) which
> ensures that there are only two targets, and extracts their revisions.
> 
> The doc string for "svn_opt_parse_path" doesn't say what it does if
> there is more than one "@" sign.  It lists examples of input, but not
> of the corresponding output.

I wasn't sure if you were proposing to make these improvements, but +1
if so...


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Improvements to "svn_opt_args_to_target_array" etc.

Posted by Julian Foad <ju...@btopenworld.com>.
Julian Foad wrote:
[Split "svn_opt_args_to_target_array" into a basic version ...]
> and a special one (only used by diff and merge) which ensures that there 
> are only two targets, and extracts their revisions.

Oops - not "only two targets", of course.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

[PATCH] Split and simplify svn_opt_args_to_target_array API

Posted by Julian Foad <ju...@btopenworld.com>.
Julian Foad wrote:
> The doc string for "svn_opt_args_to_target_array" doesn't say that it 
> strips the "@rev" part from the first two paths if @a extract_revisions 
> is set.

This patch improves the doc. string.

> Also, that feature of it is really an ugly way of combining two 
> different functions into one; it should be split into two functions, the 
> main one (used by nearly everything) which does not handle revisions, 
> and a special one (only used by diff and merge) which ensures that there 
> are only two targets, and extracts their revisions.

This patch splits out the basic part of the function as 
"svn_opt_args_to_target_array2", uses it nearly everywhere, and deprecates the 
original.

We shouldn't continue to use our deprecated stuff.  With this patch, the 
original is still used by "svn_cl__diff" in some cases, but that appears to be 
using it wrongly so it needs to change anyway.  I'll do that as a separate 
patch.  Here I've annotated what I think is wrong, with "###" comments:

Index: subversion/clients/cmdline/diff-cmd.c
===================================================================
--- subversion/clients/cmdline/diff-cmd.c       (revision 11796)
+++ subversion/clients/cmdline/diff-cmd.c       (working copy)
@@ -95,25 +95,23 @@ svn_cl__diff (apr_getopt_t *os,
      {
        apr_array_header_t *tmp, *tmp2;

        /* The 'svn diff --old=OLD[@OLDREV] [--new=NEW[@NEWREV]]
           [PATH...]' case matches. */

-      SVN_ERR (svn_opt_args_to_target_array (&targets, os,
-                                             opt_state->targets,
-                                             NULL,
-                                             NULL,
-                                             FALSE, pool));
+      SVN_ERR (svn_opt_args_to_target_array2 (&targets, os,
+                                              opt_state->targets, pool));

        tmp = apr_array_make (pool, 2, sizeof (const char *));
        APR_ARRAY_PUSH (tmp, const char *) = (opt_state->old_target);
        APR_ARRAY_PUSH (tmp, const char *) = (opt_state->new_target
                                              ? opt_state->new_target
                                              : APR_ARRAY_IDX (tmp, 0,
                                                               const char *));
-
+      /* ### We shouldn't attempt to extract revisions from 'os'
+       * targets as well as old_target and new_target. */
        SVN_ERR (svn_opt_args_to_target_array (&tmp2, os, tmp,
                                               &(opt_state->start_revision),
                                               &(opt_state->end_revision),
                                               TRUE, /* extract @revs */ pool));

        old_target = APR_ARRAY_IDX (tmp2, 0, const char *);
@@ -133,29 +131,26 @@ svn_cl__diff (apr_getopt_t *os,
        svn_boolean_t working_copy_present = FALSE, url_present = FALSE;

        /* The 'svn diff [-r M[:N]] [TARGET[@REV]...]' case matches. */

        /* Here each target is a pegged object. Find out the starting
           and ending paths for each target. */
-      SVN_ERR (svn_opt_args_to_target_array (&targets, os,
-                                             opt_state->targets,
-                                             NULL,
-                                             NULL,
-                                             FALSE, pool));
+      SVN_ERR (svn_opt_args_to_target_array2 (&targets, os,
+                                              opt_state->targets, pool));

        svn_opt_push_implicit_dot_target (targets, pool);

        tmp = apr_array_make (pool, 2, sizeof (const char *));
        APR_ARRAY_PUSH (tmp, const char *) = ".";
        APR_ARRAY_PUSH (tmp, const char *) = ".";

        SVN_ERR (svn_opt_args_to_target_array (&tmp2, os, tmp,
                                               &(opt_state->start_revision),
                                               &(opt_state->end_revision),
                                               TRUE, /* extract @revs */ pool));
-
+      /* ### Extract revs from first two targets only?  Must be wrong. */
        old_target = APR_ARRAY_IDX (tmp2, 0, const char *);
        new_target = APR_ARRAY_IDX (tmp2, 1, const char *);

        /* Check to see if at least one of our paths is a working copy
           path. */
        for (i = 0; i < targets->nelts; ++i)


- Julian