git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 02/13] Add skeleton SVN client and Makefile

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jul 7, 2010, 16:25 UTC
Message-ID
<20100707162516.GA1529@burratino>
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?
Show 10 quoted lines
> +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?

[...]
Show 10 quoted lines
> +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. :)
Show 6 quoted lines
> +
> +	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.
Show 8 quoted lines
> +	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.

Show 17 quoted lines
> +
> +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
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 4 of 31 in “[GSoC update] git-remote-svn: Week 10”
  1. Ramkumar RamachandraJul 7, 2010
  2. 01/13 Add LICENSERamkumar Ramachandra, Jul 7, 2010
  3. 02/13 Add skeleton SVN client and MakefileRamkumar Ramachandra, Jul 7, 2010
  4. Jonathan NiederJul 7, 2010
  5. Ramkumar RamachandraJul 7, 2010
  6. Jonathan NiederJul 7, 2010
  7. Ramkumar RamachandraJul 7, 2010
  8. Daniel ShahafJul 7, 2010
  9. 03/13 Add debug editor from Subversion trunkRamkumar Ramachandra, Jul 7, 2010
  10. Jonathan NiederJul 7, 2010
  11. 04/13 Add skeleton dump editorRamkumar Ramachandra, Jul 7, 2010
  12. Jonathan NiederJul 7, 2010
  13. Ramkumar RamachandraJul 8, 2010
  14. 05/13 Drive the debug editorRamkumar Ramachandra, Jul 7, 2010
  15. Jonathan NiederJul 7, 2010
  16. Ramkumar RamachandraJul 7, 2010
  17. Jonathan NiederJul 7, 2010
  18. Ramkumar RamachandraJul 8, 2010
  19. 06/13 Dump the revprops at the start of every revisionRamkumar Ramachandra, Jul 7, 2010
  20. Jonathan NiederJul 7, 2010
  21. Ramkumar RamachandraJul 21, 2010
  22. Julian FoadJul 26, 2010
  23. Ramkumar RamachandraJul 26, 2010
  24. 07/13 Implement open_root and close_editRamkumar Ramachandra, Jul 7, 2010
  25. 08/13 Implement dump_nodeRamkumar Ramachandra, Jul 7, 2010
  26. 09/13 Implement directory-related functionsRamkumar Ramachandra, Jul 7, 2010
  27. 10/13 Implement file-related functionsRamkumar Ramachandra, Jul 7, 2010
  28. 11/13 Implement apply_textdeltaRamkumar Ramachandra, Jul 7, 2010
  29. 12/13 Implement close_fileRamkumar Ramachandra, Jul 7, 2010
  30. 13/13 Add a validation scriptRamkumar Ramachandra, Jul 7, 2010
  31. Ramkumar RamachandraJul 7, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.