git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
	David Michael Barr <david.barr@cordelta.com>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	avarb@gmail.com, Daniel Shahaf <d.s@daniel.shahaf.name>,
	Bert Huijben <rhuijben@collab.net>,
	Junio C Hamano <gitster@pobox.com>,
	Eric Wong <normalperson@yhbt.net>,
	dev@subversion.apache.org
Subject: Re: [PATCH 02/13] Add skeleton SVN client and Makefile
Date: Wed, 7 Jul 2010 11:25:16 -0500	[thread overview]
Message-ID: <20100707162516.GA1529@burratino> (raw)
In-Reply-To: <1278461693-3828-3-git-send-email-artagnon@gmail.com>

Ramkumar Ramachandra wrote:

> Add a basic SVN command-line client along with a Makefile that does
> just enough to establish a connection with the ASF subversion server;

Thanks for splitting this out.

Let’s see what’s needed to set up a connection:

> +++ b/Makefile
> @@ -0,0 +1,8 @@
> +svndumpr: *.c *.h
> +	$(CC) -Wall -Werror -DAPR_POOL_DEBUG -ggdb3 -O0 -o $@ svndumpr.c -lsvn_client-1 -I. -I/usr/include/subversion-1 -I/usr/include/apr-1.0

Links against libsvnclient-1.  Good.

I assume the details of the Makefile are not important, since it is
probably going to be revamped in the style of the svn build system
anyway.

> +++ b/svndumpr.c
> @@ -0,0 +1,68 @@
[...]
> +svn_error_t *populate_context()
[...]
> +svn_error_t *open_connection(const char *url)
[...]
> +svn_error_t *replay_range(svn_revnum_t start_revision, svn_revnum_t end_revision)

Why not static?

> +svn_error_t *populate_context()
> +{
> +	const char *http_library;
> +	
> +	SVN_ERR(svn_config_get_config(&(ctx->config), NULL, pool));
> +	
> +	http_library = getenv("SVN_HTTP_LIBRARY");
> +	if (http_library)
> +		svn_config_set(apr_hash_get(ctx->config, "servers", APR_HASH_KEY_STRING),
> +		               "global", "http-library", http_library);

I tried googling for this SVN_HTTP_LIBRARY setting, but no
useful hints.  I take it that this overrides the [global] http-library
setting from ~/.subversion/servers?  Do other commands honor this
environment variable or just svndumpr?

[...]
> +svn_error_t *open_connection(const char *url)
> +{
> +	SVN_ERR(svn_config_ensure (NULL, pool));
> +	SVN_ERR(svn_client_create_context (&ctx, pool));
> +	SVN_ERR(svn_ra_initialize(pool));
> +
> +#if defined(WIN32) || defined(__CYGWIN__)
> +	if (getenv("SVN_ASP_DOT_NET_HACK"))
> +		SVN_ERR(svn_wc_set_adm_dir("_svn", pool));
> +#endif

I guess it’s water under the bridge now (from 5 years ago), but why do
clients have to do this themselves?  It would not be so difficult for
libsvnclient to automatically set the admin dir according to whether
SVN_ASP_DOT_NET_HACK is set or not, or at least to provide a single
function to call and do so.

But that is not the topic for the moment.  I am tempted to suggest
checking SVN_ASP_DOT_NET_HACK unconditionally (i.e., on Unix, too),
just so the function is easier to scan.  Or there could be a separate
set_appropriate_adm_dir function in svndumpr.c:

	#if defined(WIN32) || ...
	static svn_error_t *set_appropriate_adm_dir(...)
	{
		if (getenv...
		...
	}
	#else
	static svn_error_t *set_appropriate_adm_dir(...
	{
		return SVN_NO_ERROR;
	}
	#endif

Feel free to ignore me here. :)

> +
> +	SVN_ERR(populate_context());
> +	SVN_ERR(svn_cmdline_create_auth_baton(&(ctx->auth_baton), TRUE,
> +					      NULL, NULL, NULL, FALSE,
> +					      FALSE, NULL, NULL, NULL,
> +					      pool));

Maybe comments would help, for the boolean arguments.

> +	SVN_ERR(svn_client_open_ra_session(&session, url, ctx, pool));
> +	return SVN_NO_ERROR;
> +}
> +
> +svn_error_t *replay_range(svn_revnum_t start_revision, svn_revnum_t end_revision)
> +{
> +	return SVN_NO_ERROR;
> +}

Might be more self-explanatory without this function, but that
is just nitpicking.

> +
> +int main()
> +{
> +	const char url[] = "http://svn.apache.org/repos/asf";
> +	svn_revnum_t start_revision = 1, end_revision = 500;
> +	if (svn_cmdline_init ("svndumpr", stderr) != EXIT_SUCCESS)
> +		return 1;
> +
> +	pool = svn_pool_create(NULL);
> +
> +	SVN_INT_ERR(open_connection(url));
> +	SVN_INT_ERR(replay_range(start_revision, end_revision));
> +
> +	svn_pool_destroy(pool);
> +	
> +	return 0;
> +}

So: this is an expensive no-op.

Thanks for the pleasant reading.

Jonathan

  reply	other threads:[~2010-07-07 16:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-07  0:14 [GSoC update] git-remote-svn: Week 10 Ramkumar Ramachandra
2010-07-07  0:14 ` [PATCH 01/13] Add LICENSE Ramkumar Ramachandra
2010-07-07  0:14 ` [PATCH 02/13] Add skeleton SVN client and Makefile Ramkumar Ramachandra
2010-07-07 16:25   ` Jonathan Nieder [this message]
2010-07-07 17:09     ` Ramkumar Ramachandra
2010-07-07 19:30       ` Jonathan Nieder
2010-07-07 20:47         ` Ramkumar Ramachandra
2010-07-07 17:51     ` Daniel Shahaf
2010-07-07  0:14 ` [PATCH 03/13] Add debug editor from Subversion trunk Ramkumar Ramachandra
2010-07-07 17:55   ` Jonathan Nieder
2010-07-07  0:14 ` [PATCH 04/13] Add skeleton dump editor Ramkumar Ramachandra
2010-07-07 18:16   ` Jonathan Nieder
2010-07-08  6:17     ` Ramkumar Ramachandra
2010-07-07  0:14 ` [PATCH 05/13] Drive the debug editor Ramkumar Ramachandra
2010-07-07 18:26   ` Jonathan Nieder
2010-07-07 19:08     ` Ramkumar Ramachandra
2010-07-07 19:53       ` Jonathan Nieder
2010-07-08  6:04         ` Ramkumar Ramachandra
2010-07-07  0:14 ` [PATCH 06/13] Dump the revprops at the start of every revision Ramkumar Ramachandra
2010-07-07 19:04   ` Jonathan Nieder
2010-07-21 18:55     ` Ramkumar Ramachandra
2010-07-26 14:03       ` Julian Foad
2010-07-26 17:53         ` Ramkumar Ramachandra
2010-07-07  0:14 ` [PATCH 07/13] Implement open_root and close_edit Ramkumar Ramachandra
2010-07-07  0:14 ` [PATCH 08/13] Implement dump_node Ramkumar Ramachandra
2010-07-07  0:14 ` [PATCH 09/13] Implement directory-related functions Ramkumar Ramachandra
2010-07-07  0:14 ` [PATCH 10/13] Implement file-related functions Ramkumar Ramachandra
2010-07-07  0:14 ` [PATCH 11/13] Implement apply_textdelta Ramkumar Ramachandra
2010-07-07  0:14 ` [PATCH 12/13] Implement close_file Ramkumar Ramachandra
2010-07-07  0:14 ` [PATCH 13/13] Add a validation script Ramkumar Ramachandra
2010-07-07 20:24 ` [GSoC update] git-remote-svn: Week 10 Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100707162516.GA1529@burratino \
    --to=jrnieder@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=avarb@gmail.com \
    --cc=d.s@daniel.shahaf.name \
    --cc=david.barr@cordelta.com \
    --cc=dev@subversion.apache.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=normalperson@yhbt.net \
    --cc=rhuijben@collab.net \
    --cc=srabbelier@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).