You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Blair Zajac <bl...@orcaware.com> on 2002/02/20 06:34:45 UTC

Re: svn commit: rev 1329 - trunk/subversion/svnadmin trunk/subversion/tests/clients/cmdline

cmpilato@tigris.org wrote:
> 
> Author: cmpilato
> Date: 2002-02-20 03:36 GMT
> New Revision: 1329
> 
> Modified:
>    trunk/subversion/svnadmin/main.c
>    trunk/subversion/tests/clients/cmdline/svnadmin_tests.py
> Log:
> Now, you can do:
> 
>    svnadmin lstxns REPOS_PATH | xargs svnadmin rmtxns REPOS_PATH
> 
> to quickly blow away all outstanding transactions.  Fun, yes?  Before,
> this would have taken forever, and you would have had to parse out a
> bunch of useless tree information.
> 
> * subversion/svnadmin/main.c
> 
>   (main): Only print extra transaction metadata if "long" is passed as
>   the second command-line argument to `lstxns'.
> 
[snip]

> -     "   lstxns    REPOS_PATH\n"
> -     "      Print all txns and their trees.\n"
> +     "   lstxns    REPOS_PATH [long]\n"
> +     "      Print all txn names and, if \"long\" is specified, their\n"
> +     "      metadata and trees.\n"

Shouldn't we have that as a --long option instead?  It's odd to have a
command modifier after the target of the command.

Best,
Blair

-- 
Blair Zajac <bl...@orcaware.com>
Web and OS performance plots - http://www.orcaware.com/orca/

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

Re: svn commit: rev 1329 - trunk/subversion/svnadmin trunk/subversion/tests/clients/cmdline

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Blair Zajac <bl...@orcaware.com> writes:
> > > The other solution is for me to create a diff for review and then
> > > have me check it in.
> > 
> > Quite true. Is that a formal request for commit privs? :-)
> 
> I believe that is a formal request :)

:-)

Okay, the current committers will look back over the patches of yours
that have been applied, and discuss.  There's no high hurdle to be
passed here, just a matter of having sufficient data and no one
raising any red flags, really.  Back to you soon.

-K

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

Re: svn commit: rev 1329 - trunk/subversion/svnadmin trunk/subversion/tests/clients/cmdline

Posted by Blair Zajac <bl...@orcaware.com>.
Greg Stein wrote:
> 
> On Wed, Feb 20, 2002 at 08:57:17PM -0800, Blair Zajac wrote:
> >...
> > I'm working on a patch to leverage the same code used in svn.
> 
> Cool. A long time ago, when I first wrote svnadmin/main.c, I put a comment
> in there about leveraging the cmdline client option handling. Dunno if it is
> still there, but glad to see it happening, finally.

The code is still there.


> 
> If you really want then, then with some appropriate command line magic, you
> could generate an XML patch. I don't think anybody tests that stuff
> regularly, but SVN *does* have the capability to produce an XML-based patch
> that includes copies/moves, property changes, etc.

I looked around but didn't see the obvious option to get a diff in
XML.  How does one do this?


> > The other solution is for me to create a diff for review and then
> > have me check it in.
> 
> Quite true. Is that a formal request for commit privs? :-)

I believe that is a formal request :)

Best,
Blair

-- 
Blair Zajac <bl...@orcaware.com>
Web and OS performance plots - http://www.orcaware.com/orca/

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

Re: svn commit: rev 1329 - trunk/subversion/svnadmin trunk/subversion/tests/clients/cmdline

Posted by Greg Stein <gs...@lyra.org>.
On Wed, Feb 20, 2002 at 08:57:17PM -0800, Blair Zajac wrote:
>...
> I'm working on a patch to leverage the same code used in svn.

Cool. A long time ago, when I first wrote svnadmin/main.c, I put a comment
in there about leveraging the cmdline client option handling. Dunno if it is
still there, but glad to see it happening, finally.

> I'm doing some refactoring of code from cl.h into svn_getopt.h.  It
> would be handy if svn could do diffs that include file copies and
> renames,

It wouldn't be a "diff" then, would it? :-)

If you really want then, then with some appropriate command line magic, you
could generate an XML patch. I don't think anybody tests that stuff
regularly, but SVN *does* have the capability to produce an XML-based patch
that includes copies/moves, property changes, etc.

> much like what arch does.  Otherwise it's harder to send
> a patch in and keep the history.

As Karl said, a little addendum to the patch would be fine.

> The other solution is for me to create a diff for review and then
> have me check it in.

Quite true. Is that a formal request for commit privs? :-)

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

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

Re: svn commit: rev 1329 - trunk/subversion/svnadmin trunk/subversion/tests/clients/cmdline

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Blair Zajac <bl...@orcaware.com> writes:
> I was going to put svn_getopt.c into ./subversion/libsvn_subr.  Is this
> the appropriate place for it?

I think so, yeah.

-K

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

Re: svn commit: rev 1329 - trunk/subversion/svnadmin trunk/subversion/tests/clients/cmdline

Posted by Blair Zajac <bl...@orcaware.com>.
Daniel Berlin wrote:
> If you haven't accomplished pulling out the independent pieces, let me
> know, I did it this morning in class.
> This includes modifying them to take a table of commands (rather than
> hardcoding some global name in), making valid_options non-fixed-size,
> etc.

I've started but haven't finished.

> 
> They are all named svn_cl_<whatever>, like svn_cl_print_command_info.
> 
> Here's a test program and the output (the header file is misnamed
> getopt_new.h right now).
> 
[snip]
> 
> If you've already taken care of splitting the stuff, disregard this
> message.
> --Dan

Send me your mods and I'll use them for the patch.

Best,
Blair

-- 
Blair Zajac <bl...@orcaware.com>
Web and OS performance plots - http://www.orcaware.com/orca/

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

Re: svn commit: rev 1329 - trunk/subversion/svnadmin trunk/subversion/tests/clients/cmdline

Posted by Daniel Berlin <da...@dberlin.org>.
On Thu, 21 Feb 2002, Blair Zajac wrote:

> Karl Fogel wrote:
> > 
> > Blair Zajac <bl...@orcaware.com> writes:
> > > I'm doing some refactoring of code from cl.h into svn_getopt.h.  It
> > > would be handy if svn could do diffs that include file copies and
> > > renames, much like what arch does.  Otherwise it's harder to send
> > > a patch in and keep the history.
> > 
> > For now, you can just accompany the patch with human-readable
> > instructions about renames (agree that better support would be good,
> > and someday we'll have it).  Your patch sounds interesting, want to
> > say more?
> 
> As Greg mentioned, just to pull those program independent pieces that
> do getopt processing in cl.h and clients/cmdline/main.c out and create
> two new files, svn_getopt.h and svn_getopt.c.  svnadmin/main.c's
> currently uses a large switch to decide what to do.  However, cmdline/main.c
> supports a function call interface, so I'll break out the switch case
> statements into separate functions.

If you haven't accomplished pulling out the independent pieces, let me 
know, I did it this morning in class.
This includes modifying them to take a table of commands (rather than 
hardcoding some global name in), making valid_options non-fixed-size,
etc.


They are all named svn_cl_<whatever>, like svn_cl_print_command_info.


Here's a test program and the output (the header file is misnamed 
getopt_new.h right now).

#include "getopt_new.h"
#include "svn_pools.h"
int main(void)
{
        int valid_opts[] = {'l',0};
        apr_getopt_option_t opttable[] = {
                { "long", 'l', 0, "Long option"},
                { "short", 's', 0, "Short option"}
        };
        svn_cl_cmd_t commands[] = {
                { "test", {"testalias1", 0}, "test help", valid_opts},
                0};
        apr_initialize();
        {
                apr_pool_t *pool = svn_pool_create(NULL);
                char *string;
                const svn_cl_cmd_t *cmd = commands;
                svn_cl_format_option(&string, &opttable[0], TRUE, pool);
                printf("%s\n", string);
                svn_cl_format_option(&string, &opttable[1], TRUE, pool);
                printf("%s\n", string);
                printf("%d\n", svn_cl_subcmd_has_option(&commands[0], 
'l'));
                printf("%d\n", svn_cl_subcmd_has_option(&commands[0], 
's'));
                svn_cl_print_command_info (&cmd, &commands[0], opttable, 
TRUE, pool, stdout);
        }
        apr_terminate();
}

output:
-l [--long]:   Long option
-s [--short]:   Short option
1
0
test (testalias1): test help
Valid options:
  -l [--long]:   Long option



If you've already taken care of splitting the stuff, disregard this 
message.
--Dan 


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

Re: svn commit: rev 1329 - trunk/subversion/svnadmin trunk/subversion/tests/clients/cmdline

Posted by Blair Zajac <bl...@orcaware.com>.
Karl Fogel wrote:
> 
> Blair Zajac <bl...@orcaware.com> writes:
> > I'm doing some refactoring of code from cl.h into svn_getopt.h.  It
> > would be handy if svn could do diffs that include file copies and
> > renames, much like what arch does.  Otherwise it's harder to send
> > a patch in and keep the history.
> 
> For now, you can just accompany the patch with human-readable
> instructions about renames (agree that better support would be good,
> and someday we'll have it).  Your patch sounds interesting, want to
> say more?

As Greg mentioned, just to pull those program independent pieces that
do getopt processing in cl.h and clients/cmdline/main.c out and create
two new files, svn_getopt.h and svn_getopt.c.  svnadmin/main.c's
currently uses a large switch to decide what to do.  However, cmdline/main.c
supports a function call interface, so I'll break out the switch case
statements into separate functions.

The only problem I see is that table (array of structs) that contains
the function pointers to call takes a svn_cl__opt_state_t, which is
specific to cmdline/main.c and won't work with svnadmin/main.c.  I'll
change this to a void * pointer and the functions can cast those back.

I was going to put svn_getopt.c into ./subversion/libsvn_subr.  Is this
the appropriate place for it?

Blair

-- 
Blair Zajac <bl...@orcaware.com>
Web and OS performance plots - http://www.orcaware.com/orca/

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

Re: svn commit: rev 1329 - trunk/subversion/svnadmin trunk/subversion/tests/clients/cmdline

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Blair Zajac <bl...@orcaware.com> writes:
> I'm doing some refactoring of code from cl.h into svn_getopt.h.  It
> would be handy if svn could do diffs that include file copies and
> renames, much like what arch does.  Otherwise it's harder to send
> a patch in and keep the history.

For now, you can just accompany the patch with human-readable
instructions about renames (agree that better support would be good,
and someday we'll have it).  Your patch sounds interesting, want to
say more?

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

Re: svn commit: rev 1329 - trunk/subversion/svnadmin trunk/subversion/tests/clients/cmdline

Posted by Blair Zajac <bl...@orcaware.com>.
Karl Fogel wrote:
> 
> Daniel Berlin <da...@dberlin.org> writes:
> > Okay, I must be missing something.
> >
> > Why can we be using apr_getopt_long here?  It looks like it would
> > take about 10 minutes.
> 
> There's no reason (except time), patch welcome.

I'm working on a patch to leverage the same code used in svn.

I'm doing some refactoring of code from cl.h into svn_getopt.h.  It
would be handy if svn could do diffs that include file copies and
renames, much like what arch does.  Otherwise it's harder to send
a patch in and keep the history.

The other solution is for me to create a diff for review and then
have me check it in.

Blair

-- 
Blair Zajac <bl...@orcaware.com>
Web and OS performance plots - http://www.orcaware.com/orca/

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

Re: svn commit: rev 1329 - trunk/subversion/svnadmin trunk/subversion/tests/clients/cmdline

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Daniel Berlin <da...@dberlin.org> writes:
> Okay, I must be missing something.
> 
> Why can we be using apr_getopt_long here?  It looks like it would
> take about 10 minutes.

There's no reason (except time), patch welcome.

-K

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

Re: svn commit: rev 1329 - trunk/subversion/svnadmin trunk/subversion/tests/clients/cmdline

Posted by Daniel Berlin <da...@dberlin.org>.
On Tue, 19 Feb 2002, Blair Zajac wrote:

> cmpilato@collab.net wrote:
> > > > -     "   lstxns    REPOS_PATH\n"
> > > > -     "      Print all txns and their trees.\n"
> > > > +     "   lstxns    REPOS_PATH [long]\n"
> > > > +     "      Print all txn names and, if \"long\" is specified, their\n"
> > > > +     "      metadata and trees.\n"
> > >
> > > Shouldn't we have that as a --long option instead?  It's odd to have a
> > > command modifier after the target of the command.
> > 
> > Nah.  Svnadmin currently has no actual option parsing.  I'd hate to
> > add that code for this one little case.
> 
> I don't like going down this road though, as its not clean and may lead to
> futher command line option oddities.
> 
> Here's a small hack for this.  It's not a full blown command line parser,
> but we can add later.
Okay, I must be missing something.

Why can we be using apr_getopt_long here?
It looks like it would take about 10 minutes.

> 
> Best,
> Blair
> 
> 


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

Re: svn commit: rev 1329 - trunk/subversion/svnadmin trunk/subversion/tests/clients/cmdline

Posted by Blair Zajac <bl...@orcaware.com>.
cmpilato@collab.net wrote:
> > > -     "   lstxns    REPOS_PATH\n"
> > > -     "      Print all txns and their trees.\n"
> > > +     "   lstxns    REPOS_PATH [long]\n"
> > > +     "      Print all txn names and, if \"long\" is specified, their\n"
> > > +     "      metadata and trees.\n"
> >
> > Shouldn't we have that as a --long option instead?  It's odd to have a
> > command modifier after the target of the command.
> 
> Nah.  Svnadmin currently has no actual option parsing.  I'd hate to
> add that code for this one little case.

I don't like going down this road though, as its not clean and may lead to
futher command line option oddities.

Here's a small hack for this.  It's not a full blown command line parser,
but we can add later.

Best,
Blair

-- 
Blair Zajac <bl...@orcaware.com>
Web and OS performance plots - http://www.orcaware.com/orca/




Index: ./subversion/svnadmin/main.c
===================================================================
--- ./subversion/svnadmin/main.c
+++ ./subversion/svnadmin/main.c	Tue Feb 19 23:19:40 2002
@@ -137,8 +137,8 @@
      "      If just LOWER_REV is given, that revision tree is printed.\n"
      "      If two revisions are given, that range is printed, inclusive.\n"
      "\n"
-     "   lstxns    REPOS_PATH [long]\n"
-     "      Print all txn names and, if \"long\" is specified, their\n"
+     "   lstxns    [--long] REPOS_PATH\n"
+     "      Print all txn names and, if \"--long\" is specified, their\n"
      "      metadata and trees.\n"
      "\n"
 #if 0 
@@ -303,15 +303,25 @@
         char *txn_name;
         svn_boolean_t show_extra = FALSE;
 
-        if (argc >= 4) 
+        /* Check for the --long command line option. */
+        if (strcmp(argv[2], "--long") == 0)
           {
-            if (strcmp (argv[3], "long"))
+            if (argc != 4)
               {
                 usage (argv[0], 1);
                 return EXIT_FAILURE;
               }
+
+            /* If --long is being used, path currently points to it,
+               so move path to the next string for the repository. */
+            path = argv[3];
             show_extra = TRUE;
           }
+        else if (argc != 3)
+          {
+            usage (argv[0], 1);
+            return EXIT_FAILURE;
+          }
 
         INT_ERR (svn_repos_open (&repos, path, pool));
         fs = svn_repos_fs (repos);
Index: ./subversion/tests/clients/cmdline/svnadmin_tests.py
===================================================================
--- ./subversion/tests/clients/cmdline/svnadmin_tests.py
+++ ./subversion/tests/clients/cmdline/svnadmin_tests.py	Tue Feb 19 23:29:20 2002
@@ -78,8 +78,8 @@
     rm = re.compile("^Revision\s+(.+)")
   else:
     output_lines, errput_lines = svntest.main.run_svnadmin("lstxns",
-                                                           repo_dir,
-                                                           "long")
+                                                           "--long",
+                                                           repo_dir)
     rm = re.compile("^Txn\s+(.+):")
 
   for line in output_lines:

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

Re: svn commit: rev 1329 - trunk/subversion/svnadmin trunk/subversion/tests/clients/cmdline

Posted by Lele Gaifax <le...@seldati.it>.
>>>>> On 20 Feb 2002 00:40:38 -0600, cmpilato@collab.net said:

    c> Blair Zajac <bl...@orcaware.com> writes:
    >> [snip]
    >> 
    >> Shouldn't we have that as a --long option instead?  It's odd to
    >> have a command modifier after the target of the command.

    c> Nah.  Svnadmin currently has no actual option parsing.  I'd
    c> hate to add that code for this one little case.

Well, wouldn't it be a better choice to test for "--long" anyway, even
if just to avoid surprise in the syntax? Once svnadmin get its own
option parser, the `--long' will nicely fit.

bye, lele.
-- 
nickname: Lele Gaifax	| Quando vivro' di quello che ho pensato ieri
real: Emanuele Gaifas	| comincero' ad aver paura di chi mi copia.
email: lele@seldati.it	|		-- Fortunato Depero, 1929.


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

Re: svn commit: rev 1329 - trunk/subversion/svnadmin trunk/subversion/tests/clients/cmdline

Posted by cm...@collab.net.
Blair Zajac <bl...@orcaware.com> writes:

> [snip]
> 
> > -     "   lstxns    REPOS_PATH\n"
> > -     "      Print all txns and their trees.\n"
> > +     "   lstxns    REPOS_PATH [long]\n"
> > +     "      Print all txn names and, if \"long\" is specified, their\n"
> > +     "      metadata and trees.\n"
> 
> Shouldn't we have that as a --long option instead?  It's odd to have a
> command modifier after the target of the command.

Nah.  Svnadmin currently has no actual option parsing.  I'd hate to
add that code for this one little case.

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