You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/04/11 00:08:38 UTC

svn commit: r932796 - /subversion/trunk/subversion/libsvn_wc/wc_db.h

Author: stsp
Date: Sat Apr 10 22:08:37 2010
New Revision: 932796

URL: http://svn.apache.org/viewvc?rev=932796&view=rev
Log:
Add sketchy declarations of functions wrting data to the new conflict store.
Review and comments welcome.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_read_conflict_victims, svn_wc__db_read_conflicts): Add a
   comment saying that these functions will probably be removed eventually.
  (svn_wc__db_record_conflicting_update_op,
   svn_wc__db_record_conflicting_switch_op,
   svn_wc__db_record_conflicting_merge_op,
   svn_wc__db_record_conflicting_patch_op,
   svn_wc__db_record_text_conflict, svn_wc__db_record_prop_conflict,
   svn_wc__db_record_tree_conflict, svn_wc__db_record_reject_conflict,
   svn_wc__db_record_obstruction_conflict): Declare.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db.h

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=932796&r1=932795&r2=932796&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Sat Apr 10 22:08:37 2010
@@ -1368,6 +1368,7 @@ svn_wc__db_read_children(const apr_array
 
    Allocate *VICTIMS in RESULT_POOL and do temporary allocations in
    SCRATCH_POOL */
+/* ### This function will probably be removed. */
 svn_error_t *
 svn_wc__db_read_conflict_victims(const apr_array_header_t **victims,
                                  svn_wc__db_t *db,
@@ -1384,6 +1385,7 @@ svn_wc__db_read_conflict_victims(const a
    SCRATCH_POOL */
 /* ### Currently there can be just one property conflict recorded
        per victim */
+/*  ### This function will probably be removed. */
 svn_error_t *
 svn_wc__db_read_conflicts(const apr_array_header_t **conflicts,
                           svn_wc__db_t *db,
@@ -1392,6 +1394,207 @@ svn_wc__db_read_conflicts(const apr_arra
                           apr_pool_t *scratch_pool);
 
 
+/* Record an update as conflicting operation on LOCAL_ABSPATH in DB.
+ *
+ * BASE_REVISION is the revision the node was at before the update.
+ * TARGET_REVISION is the revision being updated to.
+ *
+ * This function may return an error (### which one?) if recording
+ * an update operation conflicts with the current status of the node
+ * (e.g. if the node is already conflicted due to a previous operation,
+ * additional conflicting operations currently cannot be recorded).
+ *
+ * Do temporary allocations in SCRATCH_POOL. */
+svn_error_t *
+svn_wc__db_record_conflicting_update_op(svn_wc__db_t *db,
+                                        const char *local_abspath,
+                                        svn_revnum_t base_revision,
+                                        svn_revnum_t target_revision,
+                                        apr_pool_t *scratch_pool);
+
+/* Record a switch as conflicting operation on LOCAL_ABSPATH in DB.
+ *
+ * BASE_REVISION is the revision the node was at before the switch.
+ * TARGET_REVISION is the revision being switched to.
+ * REPOS_RELPATH is the path being switched to, relative to the
+ * repository root.
+ *
+ * This function may return an error (### which one?) if recording
+ * a switch operation conflicts with the current status of the node
+ * (e.g. if the node is already conflicted due to a previous operation,
+ * additional conflicting operations currently cannot be recorded).
+ *
+ * Do temporary allocations in SCRATCH_POOL. */
+svn_error_t *
+svn_wc__db_record_conflicting_switch_op(svn_wc__db_t *db,
+                                        const char *local_abspath,
+                                        svn_revnum_t base_revision,
+                                        svn_revnum_t target_revision,
+                                        const char *repos_relpath,
+                                        apr_pool_t *scratch_pool);
+
+/* Record a merge as conflicting operation on LOCAL_ABSPATH in DB.
+ *
+ * REPOS_UUID is the UUID of the repository accessed via REPOS_URL.
+ *
+ * LEFT_REPOS_RELPATH and RIGHT_REPOS_RELPATH paths to the merge-left
+ * and merge-right merge sources, relative to REPOS_URL
+ *
+ * LEFT_REVISION is the merge-left revision.
+ * RIGHT_REVISION is the merge-right revision.
+ *
+ * This function may return an error (### which one?) if recording
+ * an update operation conflicts with the current status of the node
+ * (e.g. if the node is already conflicted due to a previous operation,
+ * additional conflicting operations currently cannot be recorded).
+ *
+ * Do temporary allocations in SCRATCH_POOL. */
+svn_error_t *
+svn_wc__db_record_conflicting_merge_op(svn_wc__db_t *db,
+                                       const char *local_abspath,
+                                       const char *repos_uuid,
+                                       const char *repos_url,
+                                       svn_revnum_t left_revision,
+                                       const char *left_repos_relpath,
+                                       svn_revnum_t right_revision,
+                                       const char *right_repos_relpath,
+                                       apr_pool_t *scratch_pool);
+
+/* Record patch as conflicting operation on LOCAL_ABSPATH in DB.
+ *
+ * PATCH_SOURCE_LABEL is a string identifying the patch source in
+ * some way, for display purposes. It is usually the absolute path
+ * to the patch file, or a token such as "<stdin>" if the patch source
+ * is not a file.
+ *
+ * Do temporary allocations in SCRATCH_POOL. */
+svn_error_t *
+svn_wc__db_record_conflicting_patch_op(svn_wc__db_t *db,
+                                       const char *local_abspath,
+                                       const char *patch_source_label,
+                                       apr_pool_t *scratch_pool);
+
+/* Record a text conflict on LOCAL_ABSPATH in DB.
+ *
+ * All checksums passed should be suitable for retreiving conflicted
+ * versions of the file from the pristine store.
+ *
+ * ORIGINAL_CHECKSUM is the checksum of the BASE version of the conflicted
+ * file (without local modifications).
+ * MINE_CHECKSUM is the checksum of the WORKING version of the conflicted
+ * file as of the time the conflicting operation was run (i.e. including
+ * local modifications).
+ * INCOMING_CHECKSUM is the checksum of the incoming file causing the
+ * conflict. ### is this needed for update? what about merge?
+ *
+ * It is an error (### which one?) if no conflicting operation has been
+ * recorded on LOCAL_ABSPATH before calling this function.
+ * It is an error (### which one?) if the node already has a text conflict
+ * recorded.
+ *
+ * Do temporary allocations in SCRATCH_POOL. */
+svn_error_t *
+svn_wc__db_record_text_conflict(svn_wc__db_t *db,
+                                const char *local_abspath,
+                                svn_checksum_t *original_checksum,
+                                svn_checksum_t *mine_checksum,
+                                svn_checksum_t *incoming_checksum,
+                                apr_pool_t *scratch_pool);
+
+/* Record a property conflict on LOCAL_ABSPATH in DB.
+ *
+ * PROP_NAME is the name of the conflicted property.
+ *
+ * ORIGINAL_VALUE is a stream of the property's value at the BASE revision.
+ * MINE_VALUE is a stream of the property's value in WORKING (BASE + local
+ * modifications).  INCOMING_VALUE is a stream of the incoming property
+ * value brought in by the operation. ### Is this enough? What about merge?
+ *
+ * It is an error (### which one?) if no conflicting operation has been
+ * recorded on LOCAL_ABSPATH before calling this function.
+ * It is an error (### which one?) if the node already has a propery
+ * conflict recorded for PROP_NAME.
+ *
+ * Do temporary allocations in SCRATCH_POOL. */
+svn_error_t *
+svn_wc__db_record_prop_conflict(svn_wc__db_t *db,
+                                const char *local_abspath,
+                                const char *prop_name,
+                                svn_stream_t *original_value,
+                                svn_stream_t *mine_value,
+                                svn_stream_t *incoming_value,
+                                apr_pool_t *scratch_pool);
+
+/* Record a tree conflict on LOCAL_ABSPATH in DB.
+ *
+ * LOCAL_CHANGE is the local tree change made to the node.
+ * ORIGINAL_LOCAL_KIND is the kind of the local node in BASE.
+ * If ORIGINAL_LOCAL_KIND is svn_node_file, ORIGINAL_CHECKSUM is the checksum
+ * for the BASE of the file, for retrieval from the pristine store.
+ *
+ * MINE_LOCAL_KIND is the kind of the local node in WORKING at the
+ * time the conflict was flagged.
+ * If MINE_LOCAL_KIND is svn_node_file, ORIGINAL_CHECKSUM is the checksum
+ * of the WORKING version of the file at the time the conflict was flagged,
+ * for retrieval from the pristine store.
+ *
+ * INCOMING_KIND is the kind of the incoming node.
+ * If INCOMING_KIND is svn_node_file, INCOMING_CHECKSUM is the checksum
+ * of the INCOMING version of the file, for retrieval from the pristine store.
+ *
+ * It is an error (### which one?) if no conflicting operation has been
+ * recorded on LOCAL_ABSPATH before calling this function.
+ * It is an error (### which one?) if the node already has a tree conflict
+ * recorded.
+ *
+ * Do temporary allocations in SCRATCH_POOL. */
+svn_error_t *
+svn_wc__db_record_tree_conflict(svn_wc__db_t *db,
+                                const char *local_abspath,
+                                svn_wc_conflict_reason_t local_change,
+                                svn_node_kind_t original_local_kind,
+                                svn_checksum_t *original_checksum,
+                                svn_node_kind_t mine_local_kind,
+                                svn_checksum_t *mine_checksum,
+                                svn_wc_conflict_action_t incoming_change,
+                                svn_node_kind_t incoming_kind,
+                                svn_checksum_t *incoming_checksum,
+                                apr_pool_t *scratch_pool);
+
+/* Record a reject conflict on LOCAL_ABSPATH in DB.
+ *
+ * HUNK_ORIGINAL_OFFSET, HUNK_ORIGINAL_LENGTH, HUNK_MODIFIED_OFFSET,
+ * and HUNK_MODIFIED_LENGTH is hunk-header data identifying the hunk
+ * which was rejected.
+ *
+ * REJECT_DIFF_CHECKSUM is the checksum of the text of the rejected
+ * diff, for retrieval from the pristine store.
+ *
+ * It is an error (### which one?) if no conflicting operation has been
+ * recorded on LOCAL_ABSPATH before calling this function.
+ * It is an error (### which one?) if the node already has a reject conflict
+ * recorded for this hunk.
+ *
+ * Do temporary allocations in SCRATCH_POOL. */
+svn_error_t *
+svn_wc__db_record_reject_conflict(svn_wc__db_t *db,
+                                  const char *local_abspath,
+                                  svn_linenum_t hunk_original_offset,
+                                  svn_linenum_t hunk_original_length,
+                                  svn_linenum_t hunk_modified_offset,
+                                  svn_linenum_t hunk_modified_length,
+                                  svn_checksum_t *reject_diff_checksum,
+                                  apr_pool_t *scratch_pool);
+
+/* Record a obstruction conflict on LOCAL_ABSPATH in DB.
+ *
+ * Do temporary allocations in SCRATCH_POOL. */
+svn_error_t *
+svn_wc__db_record_obstruction_conflict(svn_wc__db_t *db,
+                                       const char *local_abspath,
+                                       apr_pool_t *scratch_pool);
+
+
 /* Return the kind of the node in DB at LOCAL_ABSPATH. The WORKING tree will
    be examined first, then the BASE tree. If the node is not present in either
    tree and ALLOW_MISSING is TRUE, then svn_wc__db_kind_unknown is returned.



Re: svn commit: r932796 - /subversion/trunk/subversion/libsvn_wc/wc_db.h

Posted by Stefan Sperling <st...@elego.de>.
On Sat, Apr 10, 2010 at 08:41:31PM -0400, Greg Stein wrote:
> On Sat, Apr 10, 2010 at 18:08,  <st...@apache.org> wrote:
> > Author: stsp
> > Date: Sat Apr 10 22:08:37 2010
> > New Revision: 932796
> >
> > URL: http://svn.apache.org/viewvc?rev=932796&view=rev
> > Log:
> > Add sketchy declarations of functions wrting data to the new conflict store.
> > Review and comments welcome.
> 
> Upon reflection, this approach will cause atomicity problems. The
> ideal situation is to add/replace a node with all of its metadata
> (including conflict data!) in one atomic transation.
> 
> If you look at svn_wc__db_base_add_*(), they have a parameter named
> CONFLICT, which can be inserted during the transaction which
> adds/replaces the node data itself.
> 
> What I would like to suggest is a "conflict builder" set of APIs that
> constructs the svn_skel_t. The operation would be something like this:
> 
> svn_skel_t *conflict = svn_wc__builder_create(result_pool);
> 
> /* conflict == (()), representing (OPERATION) and OPERATION=() */
> 
> SVN_ERR(svn_wc__builder_set_update_op(conflict, base_revision,
> target_revision, result_pool, scratch_pool));
> SVN_ERR(svn_wc__builder_add_text_conflict(conflict, ...));
> SVN_ERR(svn_wc__builder_add_prop_conflict(conflict, ...));
> ...
> SVN_ERR(svn_wc__db_base_add_file(..., conflict, ...));
> 
> 
> I don't think we need anything fancier than an svn_skel_t for the
> representation. The builder_set_*_op would just replace the OPERATION
> subskel with the appropriate data. The build_add_* functions would
> append new conflict subskels to the main skel. When everything is
> ready, the main skel is passed into wc_db fully-formed and ready for
> insertion into the database.
> 
> Whatcha think?

I like it.

Thanks,
Stefan

Re: svn commit: r932796 - /subversion/trunk/subversion/libsvn_wc/wc_db.h

Posted by Greg Stein <gs...@gmail.com>.
On Sat, Apr 10, 2010 at 18:08,  <st...@apache.org> wrote:
> Author: stsp
> Date: Sat Apr 10 22:08:37 2010
> New Revision: 932796
>
> URL: http://svn.apache.org/viewvc?rev=932796&view=rev
> Log:
> Add sketchy declarations of functions wrting data to the new conflict store.
> Review and comments welcome.

Upon reflection, this approach will cause atomicity problems. The
ideal situation is to add/replace a node with all of its metadata
(including conflict data!) in one atomic transation.

If you look at svn_wc__db_base_add_*(), they have a parameter named
CONFLICT, which can be inserted during the transaction which
adds/replaces the node data itself.

What I would like to suggest is a "conflict builder" set of APIs that
constructs the svn_skel_t. The operation would be something like this:

svn_skel_t *conflict = svn_wc__builder_create(result_pool);

/* conflict == (()), representing (OPERATION) and OPERATION=() */

SVN_ERR(svn_wc__builder_set_update_op(conflict, base_revision,
target_revision, result_pool, scratch_pool));
SVN_ERR(svn_wc__builder_add_text_conflict(conflict, ...));
SVN_ERR(svn_wc__builder_add_prop_conflict(conflict, ...));
...
SVN_ERR(svn_wc__db_base_add_file(..., conflict, ...));


I don't think we need anything fancier than an svn_skel_t for the
representation. The builder_set_*_op would just replace the OPERATION
subskel with the appropriate data. The build_add_* functions would
append new conflict subskels to the main skel. When everything is
ready, the main skel is passed into wc_db fully-formed and ready for
insertion into the database.

Whatcha think?

Cheers,
-g