You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by pb...@apache.org on 2011/08/17 20:25:09 UTC
svn commit: r1158860 [2/2] - in /subversion/branches/issue-3975: ./
subversion/bindings/ctypes-python/test/ subversion/bindings/javahl/native/
subversion/bindings/javahl/src/org/apache/subversion/javahl/
subversion/bindings/javahl/src/org/tigris/subver...
Modified: subversion/branches/issue-3975/subversion/svn/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/svn/status.c?rev=1158860&r1=1158859&r2=1158860&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/svn/status.c (original)
+++ subversion/branches/issue-3975/subversion/svn/status.c Wed Aug 17 18:25:07 2011
@@ -148,11 +148,22 @@ make_relpath(const char *relative_to_pat
/* An example:
* relative_to_path = /a/b/c
* target_path = /a/x/y/z
- * result = ../../x/y/z */
+ * result = ../../x/y/z
+ *
+ * Another example (Windows specific):
+ * relative_to_path = F:/wc
+ * target_path = C:/wc
+ * result = C:/wc
+ */
/* Skip the common ancestor of both paths, here '/a'. */
la = svn_dirent_get_longest_ancestor(relative_to_path, target_path,
scratch_pool);
+ if (*la == '\0')
+ {
+ /* Nothing in common: E.g. C:/ vs F:/ on Windows */
+ return apr_pstrdup(result_pool, target_path);
+ }
relative_to_path = svn_dirent_skip_ancestor(la, relative_to_path);
target_path = svn_dirent_skip_ancestor(la, target_path);
@@ -261,6 +272,10 @@ print_status(const char *path,
(*prop_conflicts)++;
}
+ /* Note that moved-from and moved-to information is only available in STATUS
+ * for (op-)roots of a move. Those are exactly the nodes we want to show
+ * move info for in 'svn status'. See also comments in svn_wc_status3_t. */
+
if (status->moved_from_abspath)
{
const char *cwd;
@@ -268,26 +283,23 @@ print_status(const char *path,
SVN_ERR(svn_dirent_get_absolute(&cwd, "", pool));
relpath = make_relpath(cwd, status->moved_from_abspath, pool, pool);
relpath = svn_dirent_local_style(relpath, pool);
- moved_from_line = apr_psprintf(pool,
- "\n > moved from %s",
- relpath);
+ moved_from_line = apr_pstrcat(pool, "\n > ",
+ apr_psprintf(pool, _("moved from %s"),
+ relpath),
+ (char *)NULL);
}
- /* Only print an extra moved-to line for the op-root of a move-away.
- * As each and every child node of a deleted tree is printed in status
- * output, each of them would be "duplicated" with a moved-to line. */
- if (status->moved_to_abspath
- && status->moved_to_op_root_abspath
- && 0 == strcmp(status->moved_to_op_root_abspath,
- status->moved_to_abspath))
+ if (status->moved_to_abspath)
{
const char *cwd;
const char *relpath;
SVN_ERR(svn_dirent_get_absolute(&cwd, "", pool));
relpath = make_relpath(cwd, status->moved_to_abspath, pool, pool);
relpath = svn_dirent_local_style(relpath, pool);
- moved_to_line = apr_psprintf(pool, "\n > moved to %s",
- relpath);
+ moved_to_line = apr_pstrcat(pool, "\n > ",
+ apr_psprintf(pool, _("moved to %s"),
+ relpath),
+ (char *)NULL);
}
if (detailed)
Modified: subversion/branches/issue-3975/subversion/svnversion/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/svnversion/main.c?rev=1158860&r1=1158859&r2=1158860&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/svnversion/main.c (original)
+++ subversion/branches/issue-3975/subversion/svnversion/main.c Wed Aug 17 18:25:07 2011
@@ -27,6 +27,8 @@
#include "svn_opt.h"
#include "svn_version.h"
+#include "private/svn_opt_private.h"
+
#include "svn_private_config.h"
#define SVNVERSION_OPT_VERSION SVN_OPT_FIRST_LONGOPT_ID
@@ -122,12 +124,10 @@ main(int argc, const char *argv[])
const char *local_abspath;
apr_allocator_t *allocator;
apr_pool_t *pool;
- int wc_format;
svn_wc_revision_status_t *res;
svn_boolean_t no_newline = FALSE, committed = FALSE;
svn_error_t *err;
apr_getopt_t *os;
- svn_node_kind_t kind;
svn_wc_context_t *wc_ctx;
svn_boolean_t quiet = FALSE;
svn_boolean_t is_version = FALSE;
@@ -224,86 +224,61 @@ main(int argc, const char *argv[])
return EXIT_FAILURE;
}
- SVN_INT_ERR(svn_utf_cstring_to_utf8
- (&wc_path, (os->ind < argc) ? os->argv[os->ind] : ".",
- pool));
- wc_path = svn_dirent_internal_style(wc_path, pool);
+ SVN_INT_ERR(svn_utf_cstring_to_utf8(&wc_path,
+ (os->ind < argc) ? os->argv[os->ind]
+ : ".",
+ pool));
+
+ SVN_INT_ERR(svn_opt__arg_canonicalize_path(&wc_path, wc_path, pool));
SVN_INT_ERR(svn_dirent_get_absolute(&local_abspath, wc_path, pool));
SVN_INT_ERR(svn_wc_context_create(&wc_ctx, NULL, pool, pool));
if (os->ind+1 < argc)
- SVN_INT_ERR(svn_utf_cstring_to_utf8
- (&trail_url, os->argv[os->ind+1], pool));
+ SVN_INT_ERR(svn_utf_cstring_to_utf8(&trail_url, os->argv[os->ind+1],
+ pool));
else
trail_url = NULL;
- SVN_INT_ERR(svn_io_check_path(wc_path, &kind, pool));
- if (kind == svn_node_dir)
- {
- SVN_INT_ERR(svn_wc_check_wc2(&wc_format, wc_ctx, local_abspath, pool));
- if (wc_format == 0)
- {
- SVN_INT_ERR(svn_cmdline_printf(pool, _("Unversioned directory%s"),
- no_newline ? "" : "\n"));
- svn_pool_destroy(pool);
- return EXIT_SUCCESS;
- }
- SVN_INT_ERR(svn_wc_revision_status2(&res, wc_ctx, local_abspath,
- trail_url, committed, NULL, NULL,
- pool, pool));
- }
- else if (kind == svn_node_file)
+ err = svn_wc_revision_status2(&res, wc_ctx, local_abspath, trail_url,
+ committed, NULL, NULL, pool, pool);
+
+ if (err && (err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND
+ || err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY))
{
- SVN_INT_ERR(svn_wc_check_wc2(&wc_format, wc_ctx,
- svn_dirent_dirname(local_abspath, pool),
- pool));
+ svn_node_kind_t kind;
+ svn_boolean_t special;
- /* Unversioned file in unversioned directory */
- if (wc_format == 0)
+ svn_error_clear(err);
+
+ SVN_INT_ERR(svn_io_check_special_path(local_abspath, &kind, &special,
+ pool));
+
+ if (special)
+ SVN_INT_ERR(svn_cmdline_printf(pool, _("Unversioned symlink%s"),
+ no_newline ? "" : "\n"));
+ else if (kind == svn_node_dir)
+ SVN_INT_ERR(svn_cmdline_printf(pool, _("Unversioned directory%s"),
+ no_newline ? "" : "\n"));
+ else if (kind == svn_node_file)
+ SVN_INT_ERR(svn_cmdline_printf(pool, _("Unversioned file%s"),
+ no_newline ? "" : "\n"));
+ else
{
- SVN_INT_ERR(svn_cmdline_printf(pool, _("Unversioned file%s"),
- no_newline ? "" : "\n"));
+ SVN_INT_ERR(svn_cmdline_fprintf(stderr, pool,
+ kind == svn_node_none
+ ? _("'%s' doesn't exist\n")
+ : _("'%s' is of unknown type\n"),
+ svn_dirent_local_style(local_abspath,
+ pool)));
svn_pool_destroy(pool);
- return EXIT_SUCCESS;
- }
-
- err = svn_wc_revision_status2(&res, wc_ctx, local_abspath,
- trail_url, committed, NULL, NULL,
- pool, pool);
-
- if (err)
- {
- /* Unversioned file in versioned directory */
- if (err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
- {
- svn_error_clear(err);
- SVN_INT_ERR(svn_cmdline_printf(pool, _("Unversioned file%s"),
- no_newline ? "" : "\n"));
- svn_pool_destroy(pool);
- return EXIT_SUCCESS;
- }
- else
- SVN_INT_ERR(err);
+ return EXIT_FAILURE;
}
-
- }
- else if (kind == svn_node_none)
- {
- svn_error_clear(svn_cmdline_fprintf(stderr, pool,
- _("'%s' doesn't exist\n"),
- svn_dirent_local_style(wc_path, pool)));
svn_pool_destroy(pool);
- return EXIT_FAILURE;
- }
- else
- {
- svn_error_clear(svn_cmdline_fprintf(stderr, pool,
- _("'%s' is of unknown type\n"),
- svn_dirent_local_style(wc_path, pool)));
- svn_pool_destroy(pool);
- return EXIT_FAILURE;
+ return EXIT_SUCCESS;
}
+ SVN_INT_ERR(err);
+
if (! SVN_IS_VALID_REVNUM(res->min_rev))
{
/* Local uncommitted modifications, no revision info was found. */
Modified: subversion/branches/issue-3975/subversion/tests/cmdline/depth_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/tests/cmdline/depth_tests.py?rev=1158860&r1=1158859&r2=1158860&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/tests/cmdline/depth_tests.py (original)
+++ subversion/branches/issue-3975/subversion/tests/cmdline/depth_tests.py Wed Aug 17 18:25:07 2011
@@ -2229,10 +2229,6 @@ def excluded_path_misc_operation(sbox):
svntest.actions.run_and_verify_svn(None, expected_output, [],
'revert', '--depth=infinity', L_path)
- # Get rid of A/L.
- svntest.actions.run_and_verify_svn(None, None, [],
- 'rm', '--force', L_path)
-
# copy A/B to A/L and then cp A/L to A/M, excluded entry should be
# copied both times
expected_output = ['A '+L_path+'\n']
Modified: subversion/branches/issue-3975/subversion/tests/cmdline/merge_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/tests/cmdline/merge_tests.py?rev=1158860&r1=1158859&r2=1158860&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/tests/cmdline/merge_tests.py (original)
+++ subversion/branches/issue-3975/subversion/tests/cmdline/merge_tests.py Wed Aug 17 18:25:07 2011
@@ -7482,7 +7482,6 @@ def merge_away_subtrees_noninheritable_r
#
# First revert all local changes and remove A_COPY/C/nu from disk.
svntest.actions.run_and_verify_svn(None, None, [], 'revert', '-R', wc_dir)
- os.remove(os.path.join(wc_dir, "A_COPY", "nu"))
# Make a text change to A_COPY_2/mu in r11 and then merge that
# change to A/mu in r12. This will create mergeinfo of '/A_COPY_2/mu:11'
@@ -16973,6 +16972,78 @@ def reverse_merge_adds_subtree(sbox):
None, None, None, None,
None, 1, False)
+#----------------------------------------------------------------------
+# A test for issue #3989 'merge which deletes file with native eol-style
+# raises spurious tree conflict'.
+@Issue(3989)
+@SkipUnless(server_has_mergeinfo)
+def merged_deletion_causes_tree_conflict(sbox):
+ "merged deletion causes spurious tree conflict"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ A_path = os.path.join(wc_dir, 'A')
+ psi_path = os.path.join(wc_dir, 'A', 'D', 'H', 'psi')
+ H_branch_path = os.path.join(wc_dir, 'branch', 'D', 'H')
+
+ # r2 - Set svn:eol-style native on A/D/H/psi
+ svntest.actions.run_and_verify_svn(None, None, [], 'ps', 'svn:eol-style',
+ 'native', psi_path)
+ svntest.actions.run_and_verify_svn(None, None, [], 'ci', '-m',
+ 'Set eol-style native on a path',
+ wc_dir)
+
+ # r3 - Branch ^/A to ^/branch
+ svntest.actions.run_and_verify_svn(None, None, [], 'copy',
+ sbox.repo_url + '/A',
+ sbox.repo_url + '/branch',
+ '-m', 'Copy ^/A to ^/branch')
+ svntest.actions.run_and_verify_svn(None, None, [], 'up', wc_dir)
+
+ # r4 - Delete A/D/H/psi
+ svntest.actions.run_and_verify_svn(None, None, [], 'delete', psi_path)
+ svntest.actions.run_and_verify_svn(None, None, [], 'ci', '-m',
+ 'Delete a a path with native eol-style',
+ wc_dir)
+
+ # Sync merge ^/A/D/H to branch/D/H.
+ #
+ # branch/D/H/psi is, ignoring differences caused by svn:eol-style, identical
+ # to ^/A/D/H/psi when the latter was deleted, so the deletion should merge
+ # cleanly.
+ svntest.actions.run_and_verify_svn(None, None, [], 'up', wc_dir)
+ expected_output = wc.State(H_branch_path, {
+ 'psi' : Item(status='D '),
+ })
+ expected_mergeinfo_output = wc.State(H_branch_path, {
+ '' : Item(status=' U'),
+ })
+ expected_elision_output = wc.State(H_branch_path, {})
+ expected_status = wc.State(H_branch_path, {
+ '' : Item(status=' M'),
+ 'chi' : Item(status=' '),
+ 'psi' : Item(status='D '),
+ 'omega' : Item(status=' '),
+ })
+ expected_status.tweak(wc_rev=4)
+ expected_disk = wc.State('', {
+ '' : Item(props={SVN_PROP_MERGEINFO : '/A/D/H:3-4'}),
+ 'chi' : Item("This is the file 'chi'.\n"),
+ 'omega' : Item("This is the file 'omega'.\n"),
+ })
+ expected_skip = wc.State('.', { })
+ svntest.actions.run_and_verify_merge(H_branch_path, None, None,
+ sbox.repo_url + '/A/D/H', None,
+ expected_output,
+ expected_mergeinfo_output,
+ expected_elision_output,
+ expected_disk,
+ expected_status,
+ expected_skip,
+ None, None, None, None,
+ None, 1, False)
+
########################################################################
# Run the tests
@@ -17099,6 +17170,7 @@ test_list = [ None,
foreign_repos_prop_conflict,
merge_adds_subtree_with_mergeinfo,
reverse_merge_adds_subtree,
+ merged_deletion_causes_tree_conflict,
]
if __name__ == '__main__':
Modified: subversion/branches/issue-3975/subversion/tests/cmdline/revert_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/tests/cmdline/revert_tests.py?rev=1158860&r1=1158859&r2=1158860&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/tests/cmdline/revert_tests.py (original)
+++ subversion/branches/issue-3975/subversion/tests/cmdline/revert_tests.py Wed Aug 17 18:25:07 2011
@@ -890,13 +890,7 @@ def status_of_missing_dir_after_revert_r
svntest.actions.run_and_verify_svn(None, expected_output, [], "revert", "-R",
G_path)
-
- # Revert leaves these added nodes as unversioned
- expected_output = svntest.verify.UnorderedOutput(
- ["? " + os.path.join(G_path, "pi") + "\n",
- "? " + os.path.join(G_path, "rho") + "\n",
- "? " + os.path.join(G_path, "tau") + "\n"])
- svntest.actions.run_and_verify_svn(None, expected_output, [],
+ svntest.actions.run_and_verify_svn(None, [], [],
"status", wc_dir)
svntest.main.safe_rmtree(G_path)
@@ -1464,8 +1458,6 @@ def revert_tree_conflicts_with_replaceme
# Remove a few unversioned files that revert left behind.
os.remove(wc('A/B/E/loc_beta'))
- os.remove(wc('A/D/G/rho'))
- os.remove(wc('A/D/G/tau'))
os.remove(wc('A/D/H/loc_psi'))
# The update operation should have put all incoming items in place.
Modified: subversion/branches/issue-3975/subversion/tests/cmdline/special_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/tests/cmdline/special_tests.py?rev=1158860&r1=1158859&r2=1158860&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/tests/cmdline/special_tests.py (original)
+++ subversion/branches/issue-3975/subversion/tests/cmdline/special_tests.py Wed Aug 17 18:25:07 2011
@@ -800,6 +800,67 @@ def merge_foreign_symlink(sbox):
# 'A/zeta' : Item(status='A ', wc_rev='-', props={'svn:special': '*'}),
# })
+#----------------------------------------------------------------------
+# See also symlink_to_wc_svnversion().
+@Issue(2557,3987)
+@SkipUnless(svntest.main.is_posix_os)
+def symlink_to_wc_basic(sbox):
+ "operate on symlink to wc"
+
+ sbox.build(read_only = True)
+ wc_dir = sbox.wc_dir
+
+ # Create a symlink
+ symlink_path = sbox.add_wc_path('2')
+ assert not os.path.islink(symlink_path)
+ os.symlink(os.path.basename(wc_dir), symlink_path) ### implementation detail
+ symlink_basename = os.path.basename(symlink_path)
+
+ # Some basic tests
+ wc_uuid = svntest.actions.get_wc_uuid(wc_dir)
+ expected_info = [{
+ 'Path' : re.escape(os.path.join(symlink_path)),
+ 'Working Copy Root Path' : re.escape(os.path.abspath(symlink_path)),
+ 'Repository Root' : sbox.repo_url,
+ 'Repository UUID' : wc_uuid,
+ 'Revision' : '1',
+ 'Node Kind' : 'directory',
+ 'Schedule' : 'normal',
+ }, {
+ 'Name' : 'iota',
+ 'Path' : re.escape(os.path.join(symlink_path, 'iota')),
+ 'Working Copy Root Path' : re.escape(os.path.abspath(symlink_path)),
+ 'Repository Root' : sbox.repo_url,
+ 'Repository UUID' : wc_uuid,
+ 'Revision' : '1',
+ 'Node Kind' : 'file',
+ 'Schedule' : 'normal',
+ }]
+ svntest.actions.run_and_verify_info(expected_info,
+ symlink_path, symlink_path + '/iota')
+
+#----------------------------------------------------------------------
+# Similar to #2557/#3987; see symlink_to_wc_basic().
+@Issue(2557,3987)
+@SkipUnless(svntest.main.is_posix_os)
+def symlink_to_wc_svnversion(sbox):
+ "svnversion on symlink to wc"
+
+ sbox.build(read_only = True)
+ wc_dir = sbox.wc_dir
+
+ # Create a symlink
+ symlink_path = sbox.add_wc_path('2')
+ assert not os.path.islink(symlink_path)
+ os.symlink(os.path.basename(wc_dir), symlink_path) ### implementation detail
+ symlink_basename = os.path.basename(symlink_path)
+
+ # Some basic tests
+ svntest.actions.run_and_verify_svnversion("Unmodified symlink to wc",
+ symlink_path, sbox.repo_url,
+ [ "1\n" ], [])
+
+
########################################################################
# Run the tests
@@ -824,6 +885,8 @@ test_list = [ None,
unrelated_changed_special_status,
symlink_destination_change,
merge_foreign_symlink,
+ symlink_to_wc_basic,
+ symlink_to_wc_svnversion,
]
if __name__ == '__main__':
Modified: subversion/branches/issue-3975/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/tests/cmdline/svntest/main.py?rev=1158860&r1=1158859&r2=1158860&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/branches/issue-3975/subversion/tests/cmdline/svntest/main.py Wed Aug 17 18:25:07 2011
@@ -705,11 +705,16 @@ def chmod_tree(path, mode, mask):
# For clearing away working copies
def safe_rmtree(dirname, retry=0):
- "Remove the tree at DIRNAME, making it writable first"
+ """Remove the tree at DIRNAME, making it writable first.
+ If DIRNAME is a symlink, only remove the symlink, not its target."""
def rmtree(dirname):
chmod_tree(dirname, 0666, 0666)
shutil.rmtree(dirname)
+ if os.path.islink(dirname):
+ os.unlink(dirname)
+ return
+
if not os.path.exists(dirname):
return
Modified: subversion/branches/issue-3975/subversion/tests/cmdline/svnversion_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/subversion/tests/cmdline/svnversion_tests.py?rev=1158860&r1=1158859&r2=1158860&view=diff
==============================================================================
--- subversion/branches/issue-3975/subversion/tests/cmdline/svnversion_tests.py (original)
+++ subversion/branches/issue-3975/subversion/tests/cmdline/svnversion_tests.py Wed Aug 17 18:25:07 2011
@@ -147,7 +147,8 @@ def svnversion_test(sbox):
X_path = os.path.join(wc_dir, 'Q', 'X')
svntest.actions.run_and_verify_svnversion("Nonexistent file or directory",
X_path, repo_url,
- None, [ "'%s' doesn't exist\n" % X_path ])
+ None, [ "'%s' doesn't exist\n"
+ % os.path.abspath(X_path) ])
# Perform a sparse checkout of under the existing WC, and confirm that
# svnversion detects it as a "partial" WC.
@@ -287,9 +288,8 @@ def svnversion_with_structural_changes(s
svntest.actions.run_and_verify_svnversion("Deleted file",
sbox.ospath('iota'),
repo_url + '/iota',
+ ["1M\n"],
[],
- [ "'%s' doesn't exist\n" % \
- sbox.ospath('iota')],
)
svntest.actions.run_and_verify_svnversion("Deleted file", wc_dir, repo_url,
[ "1:2M\n" ], [])
Modified: subversion/branches/issue-3975/tools/dev/benchmarks/suite1/run
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3975/tools/dev/benchmarks/suite1/run?rev=1158860&r1=1158859&r2=1158860&view=diff
==============================================================================
--- subversion/branches/issue-3975/tools/dev/benchmarks/suite1/run (original)
+++ subversion/branches/issue-3975/tools/dev/benchmarks/suite1/run Wed Aug 17 18:25:07 2011
@@ -48,8 +48,8 @@ batch(){
echo "---------------------------------------------------------------------"
echo
echo "Results for dir levels: $levels spread: $spread"
- "$benchmark" "--svn=$SVN_A" run "${pre}$SVN_A_NAME" $levels $spread $N #>/dev/null
- "$benchmark" "--svn=$SVN_B" run "${pre}$SVN_B_NAME" $levels $spread $N #>/dev/null
+ "$benchmark" "--svn=$SVN_A" run "${pre}$SVN_A_NAME" $levels $spread $N >/dev/null
+ "$benchmark" "--svn=$SVN_B" run "${pre}$SVN_B_NAME" $levels $spread $N >/dev/null
"$benchmark" compare "${pre}$SVN_A_NAME" "${pre}$SVN_B_NAME"
}