You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2010/11/04 17:02:16 UTC
svn commit: r1031052 - in /subversion/trunk/subversion: include/svn_client.h
include/svn_wc.h libsvn_client/info.c libsvn_wc/update_editor.c
svn/info-cmd.c svn/schema/info.rnc tests/cmdline/info_tests.py
Author: cmpilato
Date: Thu Nov 4 16:02:16 2010
New Revision: 1031052
URL: http://svn.apache.org/viewvc?rev=1031052&view=rev
Log:
Fix issue #3355 ("make svn info show the associated working copy root
of a path").
* subversion/include/svn_client.h
(svn_info_t): Add 'wcroot_abspath' member.
* subversion/libsvn_client/info.c
(svn_info_dup): Dup the new 'wcroot_abspath', too.
* subversion/include/svn_wc.h,
* subversion/libsvn_wc/update_editor.c
(svn_wc_get_wc_root): New function.
(build_info_for_entry, build_info_for_unversioned): Populate the new
'wcroot_abspath' svn_info_t member.
* subversion/svn/info-cmd.c
(print_info, print_info_xml): Output the 'wcroot_abspath' svn_info_t
information, too.
* subversion/svn/schema/info.rnc
(wc-info): Add 'wcroot-abspath' member.
* subversion/tests/cmdline/info_tests.py
(info_wcroot_abspaths): New test.
(test_list): Add reference to new test.
Modified:
subversion/trunk/subversion/include/svn_client.h
subversion/trunk/subversion/include/svn_wc.h
subversion/trunk/subversion/libsvn_client/info.c
subversion/trunk/subversion/libsvn_wc/update_editor.c
subversion/trunk/subversion/svn/info-cmd.c
subversion/trunk/subversion/svn/schema/info.rnc
subversion/trunk/subversion/tests/cmdline/info_tests.py
Modified: subversion/trunk/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1031052&r1=1031051&r2=1031052&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Thu Nov 4 16:02:16 2010
@@ -5125,6 +5125,12 @@ typedef struct svn_info_t
*/
svn_wc_conflict_description_t *tree_conflict;
+ /**
+ * The local absolute path of the working copy root.
+ * @since New in 1.7.
+ */
+ const char *wcroot_abspath;
+
/** @} */
} svn_info_t;
Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1031052&r1=1031051&r2=1031052&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Thu Nov 4 16:02:16 2010
@@ -5102,7 +5102,7 @@ svn_wc_crawl_revisions(const char *path,
apr_pool_t *pool);
-/* Updates. */
+/* Working copy roots. */
/** Set @a *wc_root to @c TRUE if @a local_abspath represents a "working copy
* root", @c FALSE otherwise. Here, @a local_abspath is a "working copy root"
@@ -5138,6 +5138,21 @@ svn_wc_is_wc_root(svn_boolean_t *wc_root
svn_wc_adm_access_t *adm_access,
apr_pool_t *pool);
+/**
+ * Set @a *wcroot_abspath to the local abspath of the root of the
+ * working copy in which @a local_abspath resides.
+ *
+ * @since New in 1.7.
+ */
+svn_error_t *
+svn_wc_get_wc_root(const char **wcroot_abspath,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ apr_pool_t *scratch_pool,
+ apr_pool_t *result_pool);
+
+
+/* Updates. */
/** Conditionally split @a path into an @a anchor and @a target for the
* purpose of updating and committing.
Modified: subversion/trunk/subversion/libsvn_client/info.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/info.c?rev=1031052&r1=1031051&r2=1031052&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/info.c (original)
+++ subversion/trunk/subversion/libsvn_client/info.c Thu Nov 4 16:02:16 2010
@@ -167,6 +167,9 @@ build_info_for_entry(svn_info_t **info,
SVN_ERR(svn_wc__node_get_schedule(&tmpinfo->schedule, NULL,
wc_ctx, local_abspath, pool));
+ SVN_ERR(svn_wc_get_wc_root(&tmpinfo->wcroot_abspath, wc_ctx,
+ local_abspath, pool, pool));
+
/* Some random stuffs we don't have wc-ng apis for yet */
SVN_ERR(svn_wc__node_get_info_bits(&tmpinfo->text_time,
&tmpinfo->conflict_old,
@@ -692,6 +695,8 @@ svn_info_dup(const svn_info_t *info, apr
dupinfo->conflict_wrk = apr_pstrdup(pool, info->conflict_wrk);
if (info->prejfile)
dupinfo->prejfile = apr_pstrdup(pool, info->prejfile);
+ if (info->wcroot_abspath)
+ dupinfo->wcroot_abspath = apr_pstrdup(pool, info->wcroot_abspath);
return dupinfo;
}
Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1031052&r1=1031051&r2=1031052&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Thu Nov 4 16:02:16 2010
@@ -5468,6 +5468,18 @@ svn_wc__strictly_is_wc_root(svn_boolean_
svn_error_t *
+svn_wc_get_wc_root(const char **wcroot_abspath,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ apr_pool_t *scratch_pool,
+ apr_pool_t *result_pool)
+{
+ return svn_wc__db_get_wcroot(wcroot_abspath, wc_ctx->db,
+ local_abspath, scratch_pool, result_pool);
+}
+
+
+svn_error_t *
svn_wc_get_actual_target2(const char **anchor,
const char **target,
svn_wc_context_t *wc_ctx,
Modified: subversion/trunk/subversion/svn/info-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/info-cmd.c?rev=1031052&r1=1031051&r2=1031052&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/info-cmd.c (original)
+++ subversion/trunk/subversion/svn/info-cmd.c Thu Nov 4 16:02:16 2010
@@ -126,6 +126,11 @@ print_info_xml(void *baton,
/* "<wc-info>" */
svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "wc-info", NULL);
+ /* "<wcroot-abspath> xx </wcroot-abspath>" */
+ if (info->wcroot_abspath)
+ svn_cl__xml_tagged_cdata(&sb, pool, "wcroot-abspath",
+ info->wcroot_abspath);
+
/* "<schedule> xx </schedule>" */
svn_cl__xml_tagged_cdata(&sb, pool, "schedule",
schedule_str(info->schedule));
@@ -256,6 +261,11 @@ print_info(void *baton,
SVN_ERR(svn_cmdline_printf(pool, _("Name: %s\n"),
svn_dirent_basename(target, pool)));
+ if (info->wcroot_abspath)
+ SVN_ERR(svn_cmdline_printf(pool, _("Working Copy Root Path: %s\n"),
+ svn_dirent_local_style(info->wcroot_abspath,
+ pool)));
+
if (info->URL)
SVN_ERR(svn_cmdline_printf(pool, _("URL: %s\n"), info->URL));
Modified: subversion/trunk/subversion/svn/schema/info.rnc
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/schema/info.rnc?rev=1031052&r1=1031051&r2=1031052&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/schema/info.rnc (original)
+++ subversion/trunk/subversion/svn/schema/info.rnc Thu Nov 4 16:02:16 2010
@@ -53,6 +53,7 @@ uuid = element uuid { uuid.type }
## Info in the working copy entry.
wc-info =
element wc-info {
+ wcroot-abspath?,
schedule?,
changelist?,
copy-from-url?,
Modified: subversion/trunk/subversion/tests/cmdline/info_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/info_tests.py?rev=1031052&r1=1031051&r2=1031052&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/info_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/info_tests.py Thu Nov 4 16:02:16 2010
@@ -285,6 +285,39 @@ def info_on_mkdir(sbox):
('depth', {}, 'infinity'),
('schedule', {}, 'add')])
+def info_wcroot_abspaths(sbox):
+ """wc root paths in 'svn info' output"""
+
+ def check_wcroot_paths(lines, wcroot_abspath):
+ "check that paths found on input lines beginning 'Path: ' are as expected"
+ path = None
+ target = None
+ for line in lines:
+ if line.startswith('Path: '):
+ target = line[6:].rstrip()
+ if line.startswith('Working Copy Root Path: '):
+ path = line[24:].rstrip()
+ if target is not None and path is not None:
+ break
+
+ if target is None:
+ target = "(UNKNOWN)"
+
+ if path is None:
+ print "No WC root path for '%s'" % (target)
+ raise svntest.Failure
+
+ if path != wcroot_abspath:
+ print("For target '%s'..." % (target))
+ print(" Reported WC root path: %s" % (path))
+ print(" Expected WC root path: %s" % (wcroot_abspath))
+ raise svntest.Failure
+
+ sbox.build(read_only=True)
+ exit_code, output, errput = svntest.main.run_svn(None, 'info', '-R', sbox.wc_dir)
+ check_wcroot_paths(output, os.path.abspath(sbox.wc_dir))
+
+
########################################################################
# Run the tests
@@ -293,6 +326,7 @@ test_list = [ None,
info_with_tree_conflicts,
info_on_added_file,
info_on_mkdir,
+ info_wcroot_abspaths,
]
if __name__ == '__main__':