Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E1F387B22 for ; Tue, 15 Nov 2011 21:15:24 +0000 (UTC) Received: (qmail 4485 invoked by uid 500); 15 Nov 2011 21:15:24 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 4457 invoked by uid 500); 15 Nov 2011 21:15:24 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 4450 invoked by uid 99); 15 Nov 2011 21:15:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Nov 2011 21:15:24 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Nov 2011 21:15:21 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 119682388860 for ; Tue, 15 Nov 2011 21:15:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1202425 - in /subversion/trunk/subversion/svn: cl.h status-cmd.c status.c Date: Tue, 15 Nov 2011 21:14:59 -0000 To: commits@subversion.apache.org From: cmpilato@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111115211500.119682388860@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cmpilato Date: Tue Nov 15 21:14:59 2011 New Revision: 1202425 URL: http://svn.apache.org/viewvc?rev=1202425&view=rev Log: Ensure that all paths printed from 'svn status' are relative-ized. Prior to this change, modified items in external working copies were printed as absolute paths. * subversion/svn/cl.h (svn_cl__print_status, svn_cl__print_status_xml): Add 'cwd_abspath' parameter. * subversion/svn/status-cmd.c (struct status_baton): Add 'cwd_abspath' member. (print_status_normal_or_xml): Update calls to svn_cl__print_status_xml() and svn_cl__print_status(). (svn_cl__status): Populate new 'cwd_abspath' baton member. * subversion/svn/status.c (print_status, svn_cl__print_status_xml): Add 'cwd_abspath' member, used to transform the status path and moved-to/moved-from paths into something relative to the current working directory. (svn_cl__print_status): Update call to print_status(). Modified: subversion/trunk/subversion/svn/cl.h subversion/trunk/subversion/svn/status-cmd.c subversion/trunk/subversion/svn/status.c Modified: subversion/trunk/subversion/svn/cl.h URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=1202425&r1=1202424&r2=1202425&view=diff ============================================================================== --- subversion/trunk/subversion/svn/cl.h (original) +++ subversion/trunk/subversion/svn/cl.h Tue Nov 15 21:14:59 2011 @@ -393,9 +393,14 @@ svn_cl__time_cstring_to_human_cstring(co Increment *TEXT_CONFLICTS, *PROP_CONFLICTS, or *TREE_CONFLICTS if a conflict was encountered. - */ + + Use CWD_ABSPATH -- the absolute path of the current working + directory -- to shorten PATH into something relative to that + directory as necessary. +*/ svn_error_t * -svn_cl__print_status(const char *path, +svn_cl__print_status(const char *cwd_abspath, + const char *path, const svn_client_status_t *status, svn_boolean_t detailed, svn_boolean_t show_last_committed, @@ -409,9 +414,15 @@ svn_cl__print_status(const char *path, /* Print STATUS for PATH in XML to stdout. Use POOL for temporary - allocations. */ + allocations. + + Use CWD_ABSPATH -- the absolute path of the current working + directory -- to shorten PATH into something relative to that + directory as necessary. + */ svn_error_t * -svn_cl__print_status_xml(const char *path, +svn_cl__print_status_xml(const char *cwd_abspath, + const char *path, const svn_client_status_t *status, svn_client_ctx_t *ctx, apr_pool_t *pool); Modified: subversion/trunk/subversion/svn/status-cmd.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/status-cmd.c?rev=1202425&r1=1202424&r2=1202425&view=diff ============================================================================== --- subversion/trunk/subversion/svn/status-cmd.c (original) +++ subversion/trunk/subversion/svn/status-cmd.c Tue Nov 15 21:14:59 2011 @@ -50,6 +50,7 @@ struct status_baton { /* These fields all correspond to the ones in the svn_cl__print_status() interface. */ + const char *cwd_abspath; svn_boolean_t detailed; svn_boolean_t show_last_committed; svn_boolean_t skip_unrecognized; @@ -149,9 +150,11 @@ print_status_normal_or_xml(void *baton, struct status_baton *sb = baton; if (sb->xml_mode) - return svn_cl__print_status_xml(path, status, sb->ctx, pool); + return svn_cl__print_status_xml(sb->cwd_abspath, path, status, + sb->ctx, pool); else - return svn_cl__print_status(path, status, sb->detailed, + return svn_cl__print_status(sb->cwd_abspath, path, status, + sb->detailed, sb->show_last_committed, sb->skip_unrecognized, sb->repos_locks, @@ -298,6 +301,7 @@ svn_cl__status(apr_getopt_t *os, "mode")); } + SVN_ERR(svn_dirent_get_absolute(&(sb.cwd_abspath), "", scratch_pool)); sb.detailed = (opt_state->verbose || opt_state->update); sb.show_last_committed = opt_state->verbose; sb.skip_unrecognized = opt_state->quiet; Modified: subversion/trunk/subversion/svn/status.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/status.c?rev=1202425&r1=1202424&r2=1202425&view=diff ============================================================================== --- subversion/trunk/subversion/svn/status.c (original) +++ subversion/trunk/subversion/svn/status.c Tue Nov 15 21:14:59 2011 @@ -187,7 +187,7 @@ make_relpath(const char *relative_to_pat /* Print STATUS and PATH in a format determined by DETAILED and SHOW_LAST_COMMITTED. */ static svn_error_t * -print_status(const char *path, +print_status(const char *cwd_abspath, const char *path, svn_boolean_t detailed, svn_boolean_t show_last_committed, svn_boolean_t repos_locks, @@ -205,6 +205,8 @@ print_status(const char *path, const char *moved_from_line = ""; const char *moved_to_line = ""; + path = make_relpath(cwd_abspath, path, pool, pool); + /* For historic reasons svn ignores the property status for added nodes, even if these nodes were copied and have local property changes. @@ -277,13 +279,12 @@ print_status(const char *path, * move info for in 'svn status'. See also comments in svn_wc_status3_t. */ if (status->moved_from_abspath || status->moved_to_abspath) { - const char *cwd; const char *relpath; - SVN_ERR(svn_dirent_get_absolute(&cwd, "", pool)); if (status->moved_from_abspath) { - relpath = make_relpath(cwd, status->moved_from_abspath, pool, pool); + relpath = make_relpath(cwd_abspath, status->moved_from_abspath, + pool, pool); relpath = svn_dirent_local_style(relpath, pool); moved_from_line = apr_pstrcat(pool, "\n > ", apr_psprintf(pool, _("moved from %s"), @@ -293,7 +294,8 @@ print_status(const char *path, if (status->moved_to_abspath) { - relpath = make_relpath(cwd, status->moved_to_abspath, pool, pool); + relpath = make_relpath(cwd_abspath, status->moved_to_abspath, + pool, pool); relpath = svn_dirent_local_style(relpath, pool); moved_to_line = apr_pstrcat(pool, "\n > ", apr_psprintf(pool, _("moved to %s"), @@ -419,7 +421,8 @@ print_status(const char *path, svn_error_t * -svn_cl__print_status_xml(const char *path, +svn_cl__print_status_xml(const char *cwd_abspath, + const char *path, const svn_client_status_t *status, svn_client_ctx_t *ctx, apr_pool_t *pool) @@ -436,6 +439,8 @@ svn_cl__print_status_xml(const char *pat SVN_ERR(svn_wc_conflicted_p3(NULL, NULL, &tree_conflicted, ctx->wc_ctx, local_abspath, pool)); + path = make_relpath(cwd_abspath, path, pool, pool); + svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "entry", "path", svn_dirent_local_style(path, pool), NULL); @@ -464,18 +469,19 @@ svn_cl__print_status_xml(const char *pat "true"); if (status->moved_from_abspath || status->moved_to_abspath) { - const char *cwd; const char *relpath; - SVN_ERR(svn_dirent_get_absolute(&cwd, "", pool)); + if (status->moved_from_abspath) { - relpath = make_relpath(cwd, status->moved_from_abspath, pool, pool); + relpath = make_relpath(cwd_abspath, status->moved_from_abspath, + pool, pool); relpath = svn_dirent_local_style(relpath, pool); apr_hash_set(att_hash, "moved-from", APR_HASH_KEY_STRING, relpath); } if (status->moved_to_abspath) { - relpath = make_relpath(cwd, status->moved_to_abspath, pool, pool); + relpath = make_relpath(cwd_abspath, status->moved_to_abspath, + pool, pool); relpath = svn_dirent_local_style(relpath, pool); apr_hash_set(att_hash, "moved-to", APR_HASH_KEY_STRING, relpath); } @@ -519,7 +525,8 @@ svn_cl__print_status_xml(const char *pat /* Called by status-cmd.c */ svn_error_t * -svn_cl__print_status(const char *path, +svn_cl__print_status(const char *cwd_abspath, + const char *path, const svn_client_status_t *status, svn_boolean_t detailed, svn_boolean_t show_last_committed, @@ -540,7 +547,7 @@ svn_cl__print_status(const char *path, && status->repos_node_status == svn_wc_status_none)) return SVN_NO_ERROR; - return print_status(svn_dirent_local_style(path, pool), + return print_status(cwd_abspath, svn_dirent_local_style(path, pool), detailed, show_last_committed, repos_locks, status, text_conflicts, prop_conflicts, tree_conflicts, ctx, pool);