Author: philip
Date: Fri Sep 30 16:51:52 2011
New Revision: 1177732
URL: http://svn.apache.org/viewvc?rev=1177732&view=rev
Log:
Fix issues 4025 and 4026, handling incomplete working nodes. Any such
nodes are now returned as status=added by read_info, and scan_addition
can be used to determine the incomplete status. Extend the per-dir
status structure to avoid additional scan_addition calls in status.
* subversion/libsvn_wc/wc_db.c
(convert_to_working_status): Convert incomplete to added.
(read_children_info): Set incomplete flag.
(scan_addition_txn): Allow and return incomplete status.
* subversion/libsvn_wc/wc_db.h
(svn_wc__db_read_info, svn_wc__db__scan_addition): Tweak documentation.
(struct svn_wc__db_info_t): Add incomplete flag.
* subversion/libsvn_wc/status.c
(read_info): Set incomplete flag.
(assemble_status): Check incomplete flag.
* subversion/tests/cmdline/authz_tests.py
(wc_wc_copy_revert): Extend.
Modified:
subversion/trunk/subversion/libsvn_wc/status.c
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/libsvn_wc/wc_db.h
subversion/trunk/subversion/tests/cmdline/authz_tests.py
Modified: subversion/trunk/subversion/libsvn_wc/status.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/status.c?rev=1177732&r1=1177731&r2=1177732&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/status.c (original)
+++ subversion/trunk/subversion/libsvn_wc/status.c Fri Sep 30 16:51:52 2011
@@ -338,13 +338,16 @@ read_info(const struct svn_wc__db_info_t
if (mtb->status == svn_wc__db_status_added)
{
const char *moved_from_abspath = NULL;
- SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, NULL, NULL, NULL,
+ svn_wc__db_status_t status;
+
+ SVN_ERR(svn_wc__db_scan_addition(&status, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
&moved_from_abspath,
NULL,
db, local_abspath,
result_pool, scratch_pool));
mtb->moved_here = (moved_from_abspath != NULL);
+ mtb->incomplete = (status == svn_wc__db_status_incomplete);
}
mtb->has_checksum = (checksum != NULL);
@@ -505,7 +508,7 @@ assemble_status(svn_wc_status3_t **statu
* obstructions, we have to look at the on-disk status in DIRENT. */
if (info->kind == svn_wc__db_kind_dir)
{
- if (info->status == svn_wc__db_status_incomplete)
+ if (info->status == svn_wc__db_status_incomplete || info->incomplete)
{
/* Highest precedence. */
node_status = svn_wc_status_incomplete;
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1177732&r1=1177731&r2=1177732&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Sep 30 16:51:52 2011
@@ -6108,11 +6108,7 @@ convert_to_working_status(svn_wc__db_sta
|| work_status == svn_wc__db_status_incomplete
|| work_status == svn_wc__db_status_excluded);
- if (work_status == svn_wc__db_status_incomplete)
- {
- *working_status = svn_wc__db_status_incomplete;
- }
- else if (work_status == svn_wc__db_status_excluded)
+ if (work_status == svn_wc__db_status_excluded)
{
*working_status = svn_wc__db_status_excluded;
}
@@ -6127,7 +6123,7 @@ convert_to_working_status(svn_wc__db_sta
*working_status = svn_wc__db_status_deleted;
}
- else /* normal */
+ else /* normal or incomplete */
{
/* The caller should scan upwards to detect whether this
addition has occurred because of a simple addition,
@@ -7068,6 +7064,8 @@ read_children_info(void *baton,
child->status = svn_sqlite__column_token(stmt, 3, presence_map);
if (op_depth != 0)
{
+ if (child->status == svn_wc__db_status_incomplete)
+ child->incomplete = TRUE;
err = convert_to_working_status(&child->status, child->status);
if (err)
SVN_ERR(svn_error_compose_create(err,
svn_sqlite__reset(stmt)));
@@ -9463,7 +9461,9 @@ scan_addition_txn(void *baton,
presence = svn_sqlite__column_token(stmt, 1, presence_map);
/* The starting node should exist normally. */
- if (presence != svn_wc__db_status_normal)
+ op_depth = svn_sqlite__column_int64(stmt, 0);
+ if (op_depth == 0 || (presence != svn_wc__db_status_normal
+ && presence != svn_wc__db_status_incomplete))
/* reset the statement as part of the error generation process */
return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS,
svn_sqlite__reset(stmt),
@@ -9477,11 +9477,15 @@ scan_addition_txn(void *baton,
/* Provide the default status; we'll override as appropriate. */
if (sab->status)
- *sab->status = svn_wc__db_status_added;
+ {
+ if (presence == svn_wc__db_status_normal)
+ *sab->status = svn_wc__db_status_added;
+ else
+ *sab->status = svn_wc__db_status_incomplete;
+ }
/* Calculate the op root local path components */
- op_depth = svn_sqlite__column_int64(stmt, 0);
op_root_relpath = local_relpath;
for (i = (int)relpath_depth(local_relpath); i > op_depth; --i)
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1177732&r1=1177731&r2=1177732&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Fri Sep 30 16:51:52 2011
@@ -1710,8 +1710,8 @@ svn_wc__db_op_set_tree_conflict(svn_wc__
node's revision.
svn_wc__db_status_incomplete
- The BASE or WORKING node is incomplete due to an interrupted
- operation.
+ The BASE is incomplete due to an interrupted operation. An
+ incomplete WORKING node will be svn_wc__db_status_added.
If REVISION is requested, it will be set to the revision of the
unmodified (BASE) node, or to SVN_INVALID_REVNUM if any structural
@@ -1868,6 +1868,7 @@ struct svn_wc__db_info_t {
svn_boolean_t locked; /* WC directory lock */
svn_wc__db_lock_t *lock; /* Repository file lock */
+ svn_boolean_t incomplete; /* TRUE if a working node is incomplete */
const char *moved_to_abspath; /* Only on op-roots. See svn_wc_status3_t. */
svn_boolean_t moved_here; /* On both op-roots and children. */
@@ -2441,6 +2442,8 @@ svn_wc__db_scan_base_repos(const char **
ancestor unshadowed BASE node. ORIGINAL_* will indicate the source
of the copy.
+ svn_wc__db_status_incomplete -- this NODE is copied but incomplete.
+
svn_wc__db_status_moved_here -- this NODE arrived as a result of a move.
The root of the moved nodes will be stored in OP_ROOT_ABSPATH.
Similar to the copied state, its parent may be a WORKING node or a
Modified: subversion/trunk/subversion/tests/cmdline/authz_tests.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/authz_tests.py?rev=1177732&r1=1177731&r2=1177732&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/authz_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/authz_tests.py Fri Sep 30
16:51:52 2011
@@ -1002,6 +1002,7 @@ def multiple_matches(sbox):
'-m', 'second copy',
root_url, root_url + '/second')
+@Issues(4025,4026)
@Skip(svntest.main.is_ra_type_file)
def wc_wc_copy_revert(sbox):
"wc-to-wc-copy with absent nodes and then revert"
@@ -1044,8 +1045,28 @@ def wc_wc_copy_revert(sbox):
svntest.actions.run_and_verify_svn(None, expected_output, [],
'st', '--verbose', sbox.ospath('A2'))
+
+ # Issue 4025, info SEGV on incomplete working node
+ svntest.actions.run_and_verify_svn(None, None,
+ 'svn: E145000: .*unrecognized node kind',
+ 'info', sbox.ospath('A2/B/E'))
+
+ # Issue 4026, copy assertion on incomplete working node
+ svntest.actions.run_and_verify_svn(None, None,
+ 'svn: E145001: cannot handle node kind',
+ 'cp', sbox.ospath('A2/B'), sbox.ospath('B3'))
+
+ expected_output = svntest.verify.ExpectedOutput(
+ ['A + - 1 jrandom ' + sbox.ospath('B3') + '\n',
+ '! - ? ? ' + sbox.ospath('B3/E') + '\n',
+ ])
+ expected_output.match_all = False
+ svntest.actions.run_and_verify_svn(None, expected_output, [],
+ 'st', '--verbose', sbox.ospath('B3'))
+
svntest.actions.run_and_verify_svn(None, None, [],
- 'revert', '--recursive',
sbox.ospath('A2'))
+ 'revert', '--recursive',
+ sbox.ospath('A2'), sbox.ospath('B3'))
expected_status = svntest.actions.get_virginal_state(sbox.wc_dir, 1)
expected_status.remove('A/B/E', 'A/B/E/alpha', 'A/B/E/beta')