You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2010/11/29 20:17:19 UTC
svn commit: r1040233 - /subversion/trunk/subversion/svn/update-cmd.c
Author: julianfoad
Date: Mon Nov 29 19:17:19 2010
New Revision: 1040233
URL: http://svn.apache.org/viewvc?rev=1040233&view=rev
Log:
* subversion/svn/update-cmd.c
(print_update_summary): Rework this function to assert on bad input
and only perform path arithmetic when we'll actually use the results.
Patch by: cmpilato
(plus I removed a now-obsolete comment that I introduced in r1039140)
Modified:
subversion/trunk/subversion/svn/update-cmd.c
Modified: subversion/trunk/subversion/svn/update-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/update-cmd.c?rev=1040233&r1=1040232&r2=1040233&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/update-cmd.c (original)
+++ subversion/trunk/subversion/svn/update-cmd.c Mon Nov 29 19:17:19 2010
@@ -63,35 +63,34 @@ print_update_summary(apr_array_header_t
for (i = 0; i < targets->nelts; i++)
{
const char *path = APR_ARRAY_IDX(targets, i, const char *);
- const char *path_local;
+ svn_revnum_t rev = SVN_INVALID_REVNUM;
svn_pool_clear(iter_pool);
- /* Convert to an absolute path if it's not already. */
- /* (It shouldn't be URL, but don't call svn_dirent_* if it is.) */
- if (! svn_path_is_url(path) && ! svn_dirent_is_absolute(path))
- SVN_ERR(svn_dirent_get_absolute(&path, path, iter_pool));
+ /* PATH shouldn't be a URL. */
+ SVN_ERR_ASSERT(! svn_path_is_url(path));
- /* Remove the current working directory prefix from PATH (if
- PATH is at or under $CWD), and convert to local style for
- display. */
- path_local = svn_dirent_skip_ancestor(path_prefix, path);
- path_local = svn_dirent_local_style(path_local, iter_pool);
-
+ /* Grab the result revision from the corresponding slot in our
+ RESULT_REVS array. */
if (i < result_revs->nelts)
- {
- svn_revnum_t rev = APR_ARRAY_IDX(result_revs, i, svn_revnum_t);
+ rev = APR_ARRAY_IDX(result_revs, i, svn_revnum_t);
+
+ /* No result rev? We must have skipped this path. At any rate,
+ nothing to report here. */
+ if (! SVN_IS_VALID_REVNUM(rev))
+ continue;
+
+ /* Convert to an absolute path if it's not already. */
+ if (! svn_dirent_is_absolute(path))
+ SVN_ERR(svn_dirent_get_absolute(&path, path, iter_pool));
+ path = svn_dirent_local_style(svn_dirent_skip_ancestor(path_prefix,
+ path), iter_pool);
- if (SVN_IS_VALID_REVNUM(rev))
- SVN_ERR(svn_cmdline_printf(iter_pool,
- _(" Updated '%s' to r%ld.\n"),
- path_local, rev));
- }
- else
- {
- /* ### Notify about targets for which there's no
- ### result_rev? Can we even get here? */
- }
+ /* Print an update summary for this target, removing the current
+ working directory prefix from PATH (if PATH is at or under
+ $CWD), and converting the path to local style for display. */
+ SVN_ERR(svn_cmdline_printf(iter_pool, _(" Updated '%s' to r%ld.\n"),
+ path, rev));
}
svn_pool_destroy(iter_pool);