You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2011/08/16 13:59:33 UTC
svn commit: r1158217 - in /subversion/trunk/subversion: svnversion/main.c
tests/cmdline/special_tests.py tests/cmdline/svnversion_tests.py
Author: rhuijben
Date: Tue Aug 16 11:59:32 2011
New Revision: 1158217
URL: http://svn.apache.org/viewvc?rev=1158217&view=rev
Log:
Following up on r1158187, remove a similar problem in svnversion. Simplify the
code to make libsvn_wc handle the common code paths and only perform the local
stat when the working copy reports that it doesn't know the node.
* subversion/svnversion/main.c
(includes): Add private/svn_opt_private.h.
(main): Use argument canonicalization instead of just the internal style.
Call svn_wc_revision_status2() and just use its result if successful.
On not found errors stat the specified node to keep the current error
behavior.
* subversion/tests/cmdline/special_tests.py
(symlink_to_wc_svnversion): Remove XFail marker.
* subversion/tests/cmdline/svnversion_tests.py
(svnversion_test): Update expected error message.
(svnversion_with_structural_changes): Assume that calling svnversion on a
deleted file will work.
Modified:
subversion/trunk/subversion/svnversion/main.c
subversion/trunk/subversion/tests/cmdline/special_tests.py
subversion/trunk/subversion/tests/cmdline/svnversion_tests.py
Modified: subversion/trunk/subversion/svnversion/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnversion/main.c?rev=1158217&r1=1158216&r2=1158217&view=diff
==============================================================================
--- subversion/trunk/subversion/svnversion/main.c (original)
+++ subversion/trunk/subversion/svnversion/main.c Tue Aug 16 11:59:32 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/trunk/subversion/tests/cmdline/special_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/special_tests.py?rev=1158217&r1=1158216&r2=1158217&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/special_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/special_tests.py Tue Aug 16 11:59:32 2011
@@ -841,7 +841,6 @@ def symlink_to_wc_basic(sbox):
#----------------------------------------------------------------------
# Similar to #2557/#3987; see symlink_to_wc_basic().
-@XFail()
@Issue(2557,3987)
@SkipUnless(svntest.main.is_posix_os)
def symlink_to_wc_svnversion(sbox):
Modified: subversion/trunk/subversion/tests/cmdline/svnversion_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svnversion_tests.py?rev=1158217&r1=1158216&r2=1158217&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svnversion_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svnversion_tests.py Tue Aug 16 11:59:32 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" ], [])