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 2010/06/30 13:25:33 UTC
svn commit: r959270 - in /subversion/trunk/subversion:
bindings/javahl/native/CreateJ.cpp include/private/svn_wc_private.h
libsvn_client/info.c libsvn_wc/node.c libsvn_wc/status.c libsvn_wc/wc.h
Author: rhuijben
Date: Wed Jun 30 11:25:33 2010
New Revision: 959270
URL: http://svn.apache.org/viewvc?rev=959270&view=rev
Log:
Remove another use of entries, by creating an node function that only
calculates the entry-like schedule and copied flag of a node.
* subversion/bindings/javahl/native/CreateJ.cpp
(CreateJ::Status): Update caller.
* subversion/include/private/svn_wc_private.h
(svn_wc__node_get_info_bits): Remove schedule argument.
(svn_wc__node_get_schedule): New function.
* subversion/libsvn_client/info.c
(build_info_for_entry): Retrieve schedule using svn_wc__node_get_schedule.
* subversion/libsvn_wc/node.c
(svn_wc__internal_node_get_schedule): New function.
(svn_wc__node_get_schedule): New function.
(svn_wc__node_get_info_bits): Remove unneeded argument.
* subversion/libsvn_wc/status.c
(assemble_status): Retrieve schedule via svn_wc__internal_node_get_schedule
instead of via reading the complete entry.
* subversion/libsvn_wc/wc.h
(svn_wc__internal_node_get_schedule): New function.
Modified:
subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
subversion/trunk/subversion/include/private/svn_wc_private.h
subversion/trunk/subversion/libsvn_client/info.c
subversion/trunk/subversion/libsvn_wc/node.c
subversion/trunk/subversion/libsvn_wc/status.c
subversion/trunk/subversion/libsvn_wc/wc.h
Modified: subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp?rev=959270&r1=959269&r2=959270&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp Wed Jun 30 11:25:33 2010
@@ -542,7 +542,7 @@ CreateJ::Status(svn_wc_context_t *wc_ctx
POP_AND_RETURN_NULL;
}
- if (status->versioned)
+ if (status->versioned && status->conflicted)
{
const char *conflict_new, *conflict_old, *conflict_wrk;
const char *copyfrom_url;
@@ -553,7 +553,6 @@ CreateJ::Status(svn_wc_context_t *wc_ctx
cases, which we can just ignore here as hidden nodes
are not in text or property conflict. */
svn_error_t *err = svn_wc__node_get_info_bits(NULL,
- NULL,
&conflict_old,
&conflict_new,
&conflict_wrk,
Modified: subversion/trunk/subversion/include/private/svn_wc_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_wc_private.h?rev=959270&r1=959269&r2=959270&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_wc_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_wc_private.h Wed Jun 30 11:25:33 2010
@@ -633,8 +633,7 @@ svn_wc__node_check_conflicts(svn_boolean
* @a local_abspath and @a wc_ctx are what you think they are.
*/
svn_error_t *
-svn_wc__node_get_info_bits(svn_wc_schedule_t *schedule,
- apr_time_t *text_time,
+svn_wc__node_get_info_bits(apr_time_t *text_time,
const char **conflict_old,
const char **conflict_new,
const char **conflict_wrk,
@@ -736,6 +735,21 @@ svn_wc__register_file_external(svn_wc_co
const svn_opt_revision_t *external_rev,
apr_pool_t *scratch_pool);
+/**
+ * Calculates the schedule and copied status of a node as that would
+ * have been stored in an svn_wc_entry_t instance.
+ *
+ * If not @c NULL, @a schedule and @a copied are set to their calculated
+ * values.
+ */
+svn_error_t *
+svn_wc__node_get_schedule(svn_wc_schedule_t *schedule,
+ svn_boolean_t *copied,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ apr_pool_t *scratch_pool);
+
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Modified: subversion/trunk/subversion/libsvn_client/info.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/info.c?rev=959270&r1=959269&r2=959270&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/info.c (original)
+++ subversion/trunk/subversion/libsvn_client/info.c Wed Jun 30 11:25:33 2010
@@ -154,8 +154,11 @@ build_info_for_entry(svn_info_t **info,
if (tmpinfo->depth == svn_depth_unknown)
tmpinfo->depth = svn_depth_infinity;
+ SVN_ERR(svn_wc__node_get_schedule(&tmpinfo->schedule, NULL,
+ wc_ctx, local_abspath, pool));
+
/* Some random stuffs we don't have wc-ng apis for yet */
- SVN_ERR(svn_wc__node_get_info_bits(&tmpinfo->schedule, &tmpinfo->text_time,
+ SVN_ERR(svn_wc__node_get_info_bits(&tmpinfo->text_time,
&tmpinfo->conflict_old,
&tmpinfo->conflict_new,
&tmpinfo->conflict_wrk,
Modified: subversion/trunk/subversion/libsvn_wc/node.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/node.c?rev=959270&r1=959269&r2=959270&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/node.c (original)
+++ subversion/trunk/subversion/libsvn_wc/node.c Wed Jun 30 11:25:33 2010
@@ -1216,8 +1216,174 @@ svn_wc__temp_get_keep_local(svn_boolean_
}
svn_error_t *
-svn_wc__node_get_info_bits(svn_wc_schedule_t *schedule,
- apr_time_t *text_time,
+svn_wc__internal_node_get_schedule(svn_wc_schedule_t *schedule,
+ svn_boolean_t *copied,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *scratch_pool)
+{
+ svn_wc__db_status_t status;
+ svn_boolean_t has_base;
+ const char *copyfrom_relpath;
+
+ if (schedule)
+ *schedule = svn_wc_schedule_normal;
+ if (copied)
+ *copied = FALSE;
+
+ SVN_ERR(svn_wc__db_read_info(&status, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ ©from_relpath, NULL, NULL, NULL, NULL,
+ &has_base, NULL, NULL, NULL,
+ db, local_abspath, scratch_pool, scratch_pool));
+
+ switch (status)
+ {
+ case svn_wc__db_status_not_present:
+ case svn_wc__db_status_absent:
+ case svn_wc__db_status_excluded:
+ return svn_error_createf(SVN_ERR_ENTRY_NOT_FOUND, NULL,
+ _("'%s' is not under version control"),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
+
+ case svn_wc__db_status_normal:
+ case svn_wc__db_status_incomplete:
+ case svn_wc__db_status_obstructed:
+ break;
+
+ case svn_wc__db_status_deleted:
+ case svn_wc__db_status_obstructed_delete:
+ if (schedule)
+ *schedule = svn_wc_schedule_delete;
+ break;
+
+ case svn_wc__db_status_added:
+ case svn_wc__db_status_obstructed_add:
+ {
+ const char *op_root_abspath;
+ const char *parent_abspath;
+ const char *parent_copyfrom_relpath;
+ const char *child_name;
+
+ if (schedule)
+ *schedule = svn_wc_schedule_add;
+
+ if (copyfrom_relpath != NULL)
+ {
+ status = svn_wc__db_status_copied; /* Or moved */
+ op_root_abspath = local_abspath;
+ }
+ else
+ SVN_ERR(svn_wc__db_scan_addition(&status,
+ &op_root_abspath,
+ NULL, NULL, NULL,
+ ©from_relpath,
+ NULL, NULL, NULL,
+ db, local_abspath,
+ scratch_pool, scratch_pool));
+
+ if (status == svn_wc__db_status_added)
+ break;
+
+ if (copied)
+ *copied = TRUE;
+
+ if (!schedule)
+ break;
+
+ if (has_base)
+ {
+ SVN_ERR(svn_wc__db_base_get_info(&status, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL,
+ db, local_abspath,
+ scratch_pool, scratch_pool));
+
+ if (status != svn_wc__db_status_not_present)
+ {
+ *schedule = svn_wc_schedule_replace;
+ break;
+ }
+ }
+
+ /* Determine the parent status to check if we should show the
+ schedule of a child of a copy as normal. */
+ if (strcmp(op_root_abspath, local_abspath) != 0)
+ {
+ *schedule = svn_wc_schedule_normal;
+ break; /* Part of parent copy */
+ }
+
+ /* When we used entries we didn't see just a different revision
+ as a new operational root, so we have to check if the parent
+ is from the same copy origin */
+ parent_abspath = svn_dirent_dirname(local_abspath, scratch_pool);
+
+ SVN_ERR(svn_wc__db_read_info(&status, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ &parent_copyfrom_relpath, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ db, parent_abspath,
+ scratch_pool, scratch_pool));
+
+ if (status != svn_wc__db_status_added)
+ break;
+
+ if (!parent_copyfrom_relpath)
+ {
+ SVN_ERR(svn_wc__db_scan_addition(&status, &op_root_abspath, NULL,
+ NULL, NULL,
+ &parent_copyfrom_relpath, NULL,
+ NULL, NULL,
+ db, parent_abspath,
+ scratch_pool, scratch_pool));
+
+ parent_copyfrom_relpath = svn_relpath_join(
+ parent_copyfrom_relpath,
+ svn_dirent_is_child(op_root_abspath,
+ parent_abspath,
+ NULL),
+ scratch_pool);
+ }
+
+
+ child_name = svn_relpath_is_child(parent_copyfrom_relpath,
+ copyfrom_relpath, NULL);
+
+ if (!child_name
+ || strcmp(child_name, svn_dirent_basename(local_abspath, NULL)))
+ break;
+
+ *schedule = svn_wc_schedule_normal;
+ break;
+ }
+ default:
+ SVN_ERR_MALFUNCTION();
+ }
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_wc__node_get_schedule(svn_wc_schedule_t *schedule,
+ svn_boolean_t *copied,
+ svn_wc_context_t *wc_ctx,
+ const char *local_abspath,
+ apr_pool_t *scratch_pool)
+{
+ return svn_error_return(
+ svn_wc__internal_node_get_schedule(schedule,
+ copied,
+ wc_ctx->db,
+ local_abspath,
+ scratch_pool));
+}
+
+svn_error_t *
+svn_wc__node_get_info_bits(apr_time_t *text_time,
const char **conflict_old,
const char **conflict_new,
const char **conflict_wrk,
@@ -1233,9 +1399,6 @@ svn_wc__node_get_info_bits(svn_wc_schedu
svn_node_unknown, TRUE, FALSE,
result_pool, scratch_pool));
- if (schedule)
- *schedule = entry->schedule;
-
if (text_time)
*text_time = entry->text_time;
Modified: subversion/trunk/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/status.c?rev=959270&r1=959269&r2=959270&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/status.c (original)
+++ subversion/trunk/subversion/libsvn_wc/status.c Wed Jun 30 11:25:33 2010
@@ -535,28 +535,16 @@ assemble_status(svn_wc_status3_t **statu
of medium precedence. They also override any C or M that may
be in the prop_status field at this point, although they do not
override a C text status.*/
-
- /* ### db_status, base_shadowed, and fetching base_status can
- ### fully replace entry->schedule here. */
-
if (db_status == svn_wc__db_status_added)
{
- const svn_wc_entry_t *entry;
-
- err = svn_wc__get_entry(&entry, db, local_abspath, FALSE,
- svn_node_unknown, FALSE, result_pool,
- scratch_pool);
-
- if (err && err->apr_err == SVN_ERR_NODE_UNEXPECTED_KIND)
- svn_error_clear(err);
- else
- SVN_ERR(err);
-
- copied = entry->copied;
+ svn_wc_schedule_t schedule;
+ SVN_ERR(svn_wc__internal_node_get_schedule(&schedule, &copied,
+ db, local_abspath,
+ scratch_pool));
- if (entry->schedule == svn_wc_schedule_add)
+ if (schedule == svn_wc_schedule_add)
node_status = svn_wc_status_added;
- else if (entry->schedule == svn_wc_schedule_replace)
+ else if (schedule == svn_wc_schedule_replace)
node_status = svn_wc_status_replaced;
}
}
Modified: subversion/trunk/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc.h?rev=959270&r1=959269&r2=959270&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc.h Wed Jun 30 11:25:33 2010
@@ -593,6 +593,14 @@ svn_wc__internal_is_file_external(svn_bo
const char *local_abspath,
apr_pool_t *scratch_pool);
+svn_error_t *
+svn_wc__internal_node_get_schedule(svn_wc_schedule_t *schedule,
+ svn_boolean_t *copied,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *scratch_pool);
+
+
/* Upgrade the wc sqlite database given in SDB for the wc located at
WCROOT_ABSPATH. It's current/starting format is given by START_FORMAT.
Re: svn commit: r959270 - in /subversion/trunk/subversion:
bindings/javahl/native/CreateJ.cpp include/private/svn_wc_private.h
libsvn_client/info.c libsvn_wc/node.c libsvn_wc/status.c libsvn_wc/wc.h
Posted by Greg Stein <gs...@gmail.com>.
On Wed, Jun 30, 2010 at 07:25, <rh...@apache.org> wrote:
> Author: rhuijben
> Date: Wed Jun 30 11:25:33 2010
> New Revision: 959270
>
> URL: http://svn.apache.org/viewvc?rev=959270&view=rev
> Log:
> Remove another use of entries, by creating an node function that only
> calculates the entry-like schedule and copied flag of a node.
>
> * subversion/bindings/javahl/native/CreateJ.cpp
> (CreateJ::Status): Update caller.
>
> * subversion/include/private/svn_wc_private.h
> (svn_wc__node_get_info_bits): Remove schedule argument.
> (svn_wc__node_get_schedule): New function.
>
> * subversion/libsvn_client/info.c
> (build_info_for_entry): Retrieve schedule using svn_wc__node_get_schedule.
>
> * subversion/libsvn_wc/node.c
> (svn_wc__internal_node_get_schedule): New function.
> (svn_wc__node_get_schedule): New function.
Rather than writing a long function that *might* get the schedule
correct, I think it is best to simply fetch the entry and return
entry->schedule and entry->copied. There is a ton of logic in
entries.c to get the scheduling correct. Use it.
>...
Cheers,
-g