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 0209C17789 for ; Tue, 17 Feb 2015 18:29:25 +0000 (UTC) Received: (qmail 51025 invoked by uid 500); 17 Feb 2015 18:29:02 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 50997 invoked by uid 500); 17 Feb 2015 18:29:02 -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 50987 invoked by uid 99); 17 Feb 2015 18:29:02 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Feb 2015 18:29:02 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 8D254AC006E for ; Tue, 17 Feb 2015 18:29:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1660462 - /subversion/branches/svn-info-detail/subversion/svn/info-cmd.c Date: Tue, 17 Feb 2015 18:29:02 -0000 To: commits@subversion.apache.org From: brane@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150217182902.8D254AC006E@hades.apache.org> Author: brane Date: Tue Feb 17 18:29:02 2015 New Revision: 1660462 URL: http://svn.apache.org/r1660462 Log: On the svn-info-detail branch: Abstract some common code. * subversion/svn/info-cmd.c (relative_url): New; constructs a relative URL. (print_info_xml, print_info): Call relative_url instead of maintaining the same logic in two places. Modified: subversion/branches/svn-info-detail/subversion/svn/info-cmd.c Modified: subversion/branches/svn-info-detail/subversion/svn/info-cmd.c URL: http://svn.apache.org/viewvc/subversion/branches/svn-info-detail/subversion/svn/info-cmd.c?rev=1660462&r1=1660461&r2=1660462&view=diff ============================================================================== --- subversion/branches/svn-info-detail/subversion/svn/info-cmd.c (original) +++ subversion/branches/svn-info-detail/subversion/svn/info-cmd.c Tue Feb 17 18:29:02 2015 @@ -76,6 +76,18 @@ schedule_str(svn_wc_schedule_t schedule) } } +/* Return a relative URL from information in INFO using POOL for + temporary allocation. */ +static const char* +relative_url(const svn_client_info2_t *info, apr_pool_t *pool) +{ + return apr_pstrcat(pool, "^/", + svn_path_uri_encode( + svn_uri_skip_ancestor(info->repos_root_URL, + info->URL, pool), + pool), SVN_VA_NULL); +} + /* A callback of type svn_client_info_receiver2_t. Prints svn info in xml mode to standard out */ @@ -109,13 +121,7 @@ print_info_xml(void *baton, { /* " xx " */ svn_cl__xml_tagged_cdata(&sb, pool, "relative-url", - apr_pstrcat(pool, "^/", - svn_path_uri_encode( - svn_uri_skip_ancestor( - info->repos_root_URL, - info->URL, pool), - pool), - SVN_VA_NULL)); + relative_url(info, pool)); } if (info->repos_root_URL || info->repos_UUID) @@ -285,11 +291,8 @@ print_info(void *baton, SVN_ERR(svn_cmdline_printf(pool, _("URL: %s\n"), info->URL)); if (info->URL && info->repos_root_URL) - SVN_ERR(svn_cmdline_printf(pool, _("Relative URL: ^/%s\n"), - svn_path_uri_encode( - svn_uri_skip_ancestor(info->repos_root_URL, - info->URL, pool), - pool))); + SVN_ERR(svn_cmdline_printf(pool, _("Relative URL: %s\n"), + relative_url(info, pool))); if (info->repos_root_URL) SVN_ERR(svn_cmdline_printf(pool, _("Repository Root: %s\n"),