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

Re: svnversion on a file

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2006-08-06 00:33:22 CEST

"David Glasser" <glasser@mit.edu> writes:

> - SVN_INT_ERR(svn_wc_check_wc(wc_path, &wc_format, pool));
> + /* As we can only call svn_wc_check_wc on directories, if we were
> + passed a file on the command-line, use its parent directory there
> + instead. (We still find the original file's revision later.) */
> + SVN_INT_ERR(svn_io_check_path(wc_path, &kind, pool));
> + if (kind == svn_node_file)
> + {
> + wc_check_path = svn_path_dirname(wc_path, pool);
> + }
> + else
> + {
> + wc_check_path = wc_path;
> + }
> +
> + SVN_INT_ERR(svn_wc_check_wc(wc_check_path, &wc_format, pool));
> if (! wc_format)
> {
> - svn_node_kind_t kind;
> - SVN_INT_ERR(svn_io_check_path(wc_path, &kind, pool));
> + SVN_INT_ERR(svn_io_check_path(wc_check_path, &kind, pool));
> if (kind == svn_node_dir)
> {
> SVN_INT_ERR(svn_cmdline_printf(pool, _("exported%s"),

The general rule for wc code is to avoid doing checks before an
operation and simply to do the operation and handle any error. In
this case svn_wc_revision_status uses svn_wc_adm_open_anchor so it
should handle versioned files. Can you avoid all the
svn_io_check_path and svn_wc_check_wc calls and simply call
svn_wc_revision_status, perhaps checking the error return if
necessary?

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Aug 6 00:33:45 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.