> -----Original Message-----
> From: neels_at_apache.org [mailto:neels_at_apache.org]
> Sent: zondag 11 september 2011 0:25
> To: commits_at_subversion.apache.org
> Subject: svn commit: r1167616 - in /subversion/trunk/subversion:
> include/svn_wc.h libsvn_client/status.c libsvn_wc/status.c libsvn_wc/wc-
> queries.sql libsvn_wc/wc_db.c libsvn_wc/wc_db.h
>
> Author: neels
> Date: Sat Sep 10 22:24:36 2011
> New Revision: 1167616
>
> URL: http://svn.apache.org/viewvc?rev=1167616&view=rev
> Log:
> Fix 'status' of file externals "resurrecting" a deleted file at the same path.
> See issue #4017.
>
> During read_children_info(), fetch the FILE_EXTERNAL column from the
> NODES
> table (op_depth 0) and feed thru svn_wc__db_info_t --> svn_wc_status3_t
> -->
> svn_client_status_t. (Add to the first two, already exists in the latter.)
>
> Note: the FILE_EXTERNAL field once existed in svn_wc_status3_t and was
> removed
> in r955755. By now, the FILE_EXTERNAL flag can be obtained much cheaper
> by
> read_children_info() than by calling svn_wc__read_external_info()
> over&over.
>
> * subversion/include/svn_wc.h
> (svn_wc_status3_t):
> Add FILE_EXTERNAL. It's a bool, no need to change svn_wc_dup_status3().
>
> * subversion/libsvn_client/status.c
> (svn_client__create_status): Use the svn_wc_status3_t.FILE_EXTERNAL
> flag.
>
> * subversion/libsvn_wc/status.c
> (read_info): Explicitly get file external status (direct targets only).
> (assemble_status): Pass thru the new FILE_EXTERNAL flag.
>
> * subversion/libsvn_wc/wc_db.c
> (read_children_info): Return FILE_EXTERNAL flags, get from op_depth=0
> rows.
>
> * subversion/libsvn_wc/wc_db.h
> (svn_wc__db_info_t): Add FILE_EXTERNAL.
>
> * subversion/libsvn_wc/wc-queries.sql
> (STMT_SELECT_NODE_CHILDREN_INFO): Also select FILE_EXTERNAL
> column.
>
> Modified:
> subversion/trunk/subversion/include/svn_wc.h
> subversion/trunk/subversion/libsvn_client/status.c
> subversion/trunk/subversion/libsvn_wc/status.c
> subversion/trunk/subversion/libsvn_wc/wc-queries.sql
> subversion/trunk/subversion/libsvn_wc/wc_db.c
> subversion/trunk/subversion/libsvn_wc/wc_db.h
>
> Modified: subversion/trunk/subversion/include/svn_wc.h
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc
> .h?rev=1167616&r1=1167615&r2=1167616&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/subversion/include/svn_wc.h (original)
> +++ subversion/trunk/subversion/include/svn_wc.h Sat Sep 10 22:24:36 2011
> @@ -3667,6 +3667,10 @@ typedef struct svn_wc_status3_t
> * @since New in 1.8. */
> const char *moved_to_abspath;
>
> + /* TRUE iff the item is a file brought in by an svn:externals definition.
> + * @since New in 1.8. */
> + svn_boolean_t file_external;
> +
> /* NOTE! Please update svn_wc_dup_status3() when adding new fields
> here. */
> } svn_wc_status3_t;
>
>
> Modified: subversion/trunk/subversion/libsvn_client/status.c
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/st
> atus.c?rev=1167616&r1=1167615&r2=1167616&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/subversion/libsvn_client/status.c (original)
> +++ subversion/trunk/subversion/libsvn_client/status.c Sat Sep 10 22:24:36
> 2011
> @@ -620,27 +620,12 @@ svn_client__create_status(svn_client_sta
> (*cst)->repos_relpath = status->repos_relpath;
>
> (*cst)->switched = status->switched;
> - (*cst)->file_external = FALSE;
>
> - if (/* Old style file-externals */
> - (status->versioned
> - && status->switched
> - && status->kind == svn_node_file))
> + (*cst)->file_external = status->file_external;
> + if (status->file_external)
> {
> - svn_node_kind_t external_kind;
> -
> - SVN_ERR(svn_wc__read_external_info(&external_kind, NULL, NULL,
> NULL,
> - NULL, wc_ctx,
> - local_abspath /* wri_abspath */,
> - local_abspath, TRUE,
> - scratch_pool, scratch_pool));
> -
> - if (external_kind == svn_node_file)
> - {
> - (*cst)->file_external = TRUE;
> - (*cst)->switched = FALSE;
> - (*cst)->node_status = (*cst)->text_status;
> - }
> + (*cst)->switched = FALSE;
> + (*cst)->node_status = (*cst)->text_status;
> }
>
> (*cst)->lock = status->lock;
>
> Modified: subversion/trunk/subversion/libsvn_wc/status.c
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/stat
> us.c?rev=1167616&r1=1167615&r2=1167616&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/subversion/libsvn_wc/status.c (original)
> +++ subversion/trunk/subversion/libsvn_wc/status.c Sat Sep 10 22:24:36
> 2011
> @@ -266,14 +266,24 @@ read_info(const struct svn_wc__db_info_t
> happy... (It might be completely unrelated, but...) */
> if (mtb->have_base
> && (mtb->status == svn_wc__db_status_added
> - || mtb->status == svn_wc__db_status_deleted))
> + || mtb->status == svn_wc__db_status_deleted
> + || mtb->kind == svn_wc__db_kind_file))
> {
> + svn_boolean_t update_root;
> + svn_wc__db_lock_t **lock_arg = NULL;
> +
> + if (mtb->status == svn_wc__db_status_added
> + || mtb->status == svn_wc__db_status_deleted)
> + lock_arg = &mtb->lock;
> +
> SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, NULL, NULL, NULL,
> NULL,
> NULL, NULL, NULL, NULL, NULL, NULL,
> - &mtb->lock, NULL, NULL,
> + lock_arg, NULL, &update_root,
> db, local_abspath,
> result_pool, scratch_pool));
>
> + mtb->file_external = (update_root && mtb->kind ==
> svn_wc__db_kind_file);
> +
> if (mtb->status == svn_wc__db_status_deleted)
> {
> const char *moved_to_abspath;
> @@ -772,6 +782,8 @@ assemble_status(svn_wc_status3_t **statu
> stat->moved_from_abspath = moved_from_abspath;
> stat->moved_to_abspath = info->moved_to_abspath;
>
> + stat->file_external = info->file_external;
> +
> *status = stat;
>
> return SVN_NO_ERROR;
>
> Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-
> queries.sql?rev=1167616&r1=1167615&r2=1167616&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
> +++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Sat Sep 10
> 22:24:36 2011
> @@ -127,7 +127,7 @@ WHERE wc_id = ?1 AND local_relpath = ?2
> SELECT op_depth, nodes.repos_id, nodes.repos_path, presence, kind,
> revision,
> checksum, translated_size, changed_revision, changed_date,
> changed_author,
> depth, symlink_target, last_mod_time, properties, lock_token,
> lock_owner,
> - lock_comment, lock_date, local_relpath, moved_here, moved_to
> + lock_comment, lock_date, local_relpath, moved_here, moved_to,
> file_external
> FROM nodes
> LEFT OUTER JOIN lock ON nodes.repos_id = lock.repos_id
> AND nodes.repos_path = lock.repos_relpath
>
> Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_
> db.c?rev=1167616&r1=1167615&r2=1167616&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
> +++ subversion/trunk/subversion/libsvn_wc/wc_db.c Sat Sep 10 22:24:36
> 2011
> @@ -7174,6 +7174,10 @@ read_children_info(void *baton,
> if (moved_to_relpath)
> child_item->info.moved_to_abspath =
> svn_dirent_join(wcroot->abspath, moved_to_relpath, result_pool);
> +
> + /* FILE_EXTERNAL flag only on op_depth 0. */
> + child_item->info.file_external = svn_sqlite__column_boolean(stmt,
> + 22);
File external is not a boolean. It is NULL vs not-null.
(It is a Boolean for new working copies, but it wasn't in intermediate formats where it contains a skel). The column checks that check for it as Boolean use 'file_external IS NULL' in the query.
The rest looks ok.
Bert
> }
> else
> {
>
> Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_
> db.h?rev=1167616&r1=1167615&r2=1167616&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
> +++ subversion/trunk/subversion/libsvn_wc/wc_db.h Sat Sep 10 22:24:36
> 2011
> @@ -1871,6 +1871,8 @@ struct svn_wc__db_info_t {
>
> 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. */
> +
> + svn_boolean_t file_external;
> };
>
> /* Return in *NODES a hash mapping name->struct svn_wc__db_info_t for
>
Received on 2011-09-11 14:12:31 CEST