[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Subversion InstantPlayground patch

From: Gabriela Gibson <gabriela.gibson_at_gmail.com>
Date: Tue, 16 Apr 2013 17:54:37 +0100

Here is a little dev toy for casual submitters and people who just
want to have a quick play with the svn source, or perhaps use svn as a
framework to explore one of the API's that svn uses.

The patch sets up a new option for the svn diff command called
'InstantPlayground' and puts a function called
InstantPlaygroundFunction into subversion/libsvn_client/diff.c
together with all the parameters needed for playing with the svn
diff code.

It also demonstrates how to set up a command line option, so
people who want something different should easily be able to use
this as a guide, even if the patch eventually goes 'out of date'.

It's not meant for committing, but I thought that other people
might find this little tool as useful as I do, so here it is :)

To use it, apply the patch, then open diff.c and find the
InstantPlaygroundFunction, where your code will go.

[[[

This is a demonstration patch that shows how to add a new sub command
to the svn command line structure for the diff command.

This is aimed at casual submitters or anyone who wants a quick
'ready-to-play' set-up to explore svn or to use svn as a framework
to to play with the API's svn uses.

To call your code from the command line, do:

   svn diff --InstantPlayground="your input here"

* subversion/include/svn_client.h (svn_client_diff6):
   Add the InstantPlayground char* parameter that contains the input
   string to the parameter list.

* subversion/libsvn_client/deprecated.c
   (svn_client_diff5): Add the InstantPlayground char* parameter to
   the call this deprecated function makes to svn_client_diff6.

   (InstantPlaygroundFunction): Your code goes here. The parameter
   'diff_cmd_baton' contains everything that would be normally passed
   into the svn diff domain.

* subversion/libsvn_client/diff.c (diff_cmd_baton):
   Define the char* InstantPlayground variable within the
   diff_cmd_baton structure.

   (svn_client_diff6): Add the InstantPlayground char* parameter that
   contains the input string to the parameter list, assign it to
   diff_cmd_baton and reroute the call to the InstantPlaygroundFunction
   instead of do_diff).

* subversion/svn/cl.h (svn_cl__opt_state_t):
   Add the char* InstantPlayground field to the diff command structure
   contained within the svn diff command options.

* subversion/svn/diff-cmd.c
   (svn_cl__diff): Call svnclient_diff6 with the new parameter char *
   InstantPlayground added.

* subversion/svn/svn.c
   (svn_cl__longopt_t): Define the opt_InstantPlayground parameter to the
   long options list that do not have a short option.

   (svn_cl__options): This is the main list of svn command line options
   and we're adding the opt_InstantPlayground as a sub option to the
   diff group within.

   (svn_cl__cmd_table): Add opt_InstantPlayground to the list of diff
   sub options that can be called.

   (sub_main): Assign the input string passed on the command line to the
   opt_InstantPlayground variable.

]]]

Received on 2013-04-16 18:55:06 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.