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

Facing problem in developing simple locking function in subversion

From: hanchiou.gooi <hanchiou.gooi_at_sireslabs.com>
Date: 2006-09-04 10:50:13 CEST

Hi guys,

  I face the problems in writing a simple c programme to lock a file using svn_client_lock function, I just blindly try and error based on some subversion book to implement one, but it seem that I not successful in do so, perhaps someone here can guide in using subversion API to develop my custom basic svn client. I attach my source code for it.

#include <unistd.h>

#include <svn_client.h>
#include <svn_config.h>
#include <svn_pools.h>
#include <svn_cmdline.h>

/* Define some global structs */
svn_client_ctx_t* context;
svn_opt_revision_t revision;

/* Define some path strings */
const char* baseURL = "http://svn.mydomain.com/testrepos/";
const char* tagsDir = "tags/";
const char* trunkDir = "trunk";
const char* tagname;
char* destURL;

/* The base string for tags */
const char* logBase = "Created new tag: ";

/* Creates the commit log for the tagging */
svn_error_t* getCommitLog(const char** log_msg, const char** tmp_file,
                          apr_array_header_t* commit_items,
                          void* baton, apr_pool_t* pool)
   /* Fill the commit log */
   *log_msg = apr_psprintf(pool, "%s%s", logBase, tagname);

   return SVN_NO_ERROR;

svn_error_t* initializeContext(apr_pool_t* pool)
   /* Create a new context */
   SVN_ERR(svn_client_create_context(&context, pool));

   /* Get the configuration data structure for the context */
   SVN_ERR(svn_config_get_config(&(context->config), NULL, pool));

   /* Set the callback function for setting the commit log */
   context->log_msg_func = getCommitLog;
   context->log_msg_baton = NULL;

   return SVN_NO_ERROR;

void Show_Version()
  printf("Subversion Version: %s\n", SVN_VERSION);
  printf("Subversion Version: %s\n", SVN_VER_NUMBER);

/* Main */
int main(int argc, char **argv)
  printf("Message: Initialize..\n");
  apr_pool_t* pool;
  svn_cmdline_init("svnlock", stderr);
  pool = svn_pool_create(NULL);
  apr_array_header_t *targets = apr_array_make (pool, 10, sizeof (int));
  printf("Debug here\n");
  char *message = "test";

  return 0;


Gooi Han Chiou

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Sep 7 22:20:32 2006

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.