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/07/08 16:27:22 UTC

svn commit: r961784 - in /subversion/trunk/subversion/libsvn_wc: wc-queries.sql wc_db.c wc_db.h workqueue.c

Author: rhuijben
Date: Thu Jul  8 14:27:22 2010
New Revision: 961784

URL: http://svn.apache.org/viewvc?rev=961784&view=rev
Log:
Prepare the wc-db layer for fixing issue #3676: Committing a tree copy
updates the last modified revision of all descendants.

This is a long way from fixing the real issue, but at least we can now
save a different changed_revision that is different from the commit
revision. The information needed to know when to keep the changed
revision is already lost in this phase, so we have to make it survive
more of the commit process

* subversion/libsvn_wc/workqueue.c
  (log_do_committed): Update caller.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_global_commit): Use separate new_ and changed_
    arguments to make the difference visible.

* subversion/libsvn_wc/wc_db.c
  (commit_baton): Add changed_rev and rename some fields.
  (commit_node): Update offsets and save changed_rev.
  (svn_wc__db_global_commit): Put new values in baton.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_APPLY_CHANGES_TO_BASE): Allow installing a new revision
    and changed_rev.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h
    subversion/trunk/subversion/libsvn_wc/workqueue.c

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=961784&r1=961783&r2=961784&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Thu Jul  8 14:27:22 2010
@@ -400,7 +400,7 @@ INSERT OR REPLACE INTO BASE_NODE (
   changed_author, properties, repos_id, repos_relpath, checksum, changed_date,
   depth, symlink_target, dav_cache)
 /* NOTE: ?6 is duplicated because we insert the same value in two columns.  */
-VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15);
+VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16);
 
 -- STMT_INSERT_WORKING_NODE_FROM_BASE_NODE
 INSERT INTO WORKING_NODE (

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=961784&r1=961783&r2=961784&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Jul  8 14:27:22 2010
@@ -5353,9 +5353,10 @@ struct commit_baton {
   svn_wc__db_pdh_t *pdh;
   const char *local_relpath;
 
-  svn_revnum_t new_revision;
-  apr_time_t new_date;
-  const char *new_author;
+  apr_int64_t new_revision;
+  apr_int64_t changed_rev;
+  apr_time_t changed_date;
+  const char *changed_author;
   const svn_checksum_t *new_checksum;
   const apr_array_header_t *new_children;
   apr_hash_t *new_dav_cache;
@@ -5485,29 +5486,30 @@ commit_node(void *baton, svn_sqlite__db_
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, cb->pdh->wcroot->sdb,
                                     STMT_APPLY_CHANGES_TO_BASE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "issttisb",
+  SVN_ERR(svn_sqlite__bindf(stmt, "issttiisb",
                             cb->pdh->wcroot->wc_id, cb->local_relpath,
                             parent_relpath,
                             presence_map, new_presence,
                             kind_map, new_kind,
-                            (apr_int64_t)cb->new_revision,
-                            cb->new_author,
+                            cb->new_revision,
+                            cb->changed_rev,
+                            cb->changed_author,
                             prop_blob.data, prop_blob.len));
 
   /* ### for now, always set the repos_id/relpath. we should make these
      ### null whenever possible. but that also means we'd have to check
      ### on whether this node is switched, so the values would need to
      ### remain unchanged.  */
-  SVN_ERR(svn_sqlite__bind_int64(stmt, 9, cb->repos_id));
-  SVN_ERR(svn_sqlite__bind_text(stmt, 10, cb->repos_relpath));
+  SVN_ERR(svn_sqlite__bind_int64(stmt, 10, cb->repos_id));
+  SVN_ERR(svn_sqlite__bind_text(stmt, 11, cb->repos_relpath));
 
-  SVN_ERR(svn_sqlite__bind_checksum(stmt, 11, cb->new_checksum,
+  SVN_ERR(svn_sqlite__bind_checksum(stmt, 12, cb->new_checksum,
                                     scratch_pool));
-  if (cb->new_date > 0)
-    SVN_ERR(svn_sqlite__bind_int64(stmt, 12, cb->new_date));
-  SVN_ERR(svn_sqlite__bind_text(stmt, 13, new_depth_str));
-  /* ### 14. target.  */
-  SVN_ERR(svn_sqlite__bind_properties(stmt, 15, cb->new_dav_cache,
+  if (cb->changed_date > 0)
+    SVN_ERR(svn_sqlite__bind_int64(stmt, 13, cb->changed_date));
+  SVN_ERR(svn_sqlite__bind_text(stmt, 14, new_depth_str));
+  /* ### 15. target.  */
+  SVN_ERR(svn_sqlite__bind_properties(stmt, 16, cb->new_dav_cache,
                                       scratch_pool));
 
   SVN_ERR(svn_sqlite__step_done(stmt));
@@ -5654,8 +5656,9 @@ svn_error_t *
 svn_wc__db_global_commit(svn_wc__db_t *db,
                          const char *local_abspath,
                          svn_revnum_t new_revision,
-                         apr_time_t new_date,
-                         const char *new_author,
+                         svn_revnum_t changed_revision,
+                         apr_time_t changed_date,
+                         const char *changed_author,
                          const svn_checksum_t *new_checksum,
                          const apr_array_header_t *new_children,
                          apr_hash_t *new_dav_cache,
@@ -5681,8 +5684,10 @@ svn_wc__db_global_commit(svn_wc__db_t *d
   cb.local_relpath = local_relpath;
 
   cb.new_revision = new_revision;
-  cb.new_date = new_date;
-  cb.new_author = new_author;
+
+  cb.changed_rev = new_revision; 
+  cb.changed_date = changed_date;
+  cb.changed_author = changed_author;
   cb.new_checksum = new_checksum;
   cb.new_children = new_children;
   cb.new_dav_cache = new_dav_cache;

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=961784&r1=961783&r2=961784&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Thu Jul  8 14:27:22 2010
@@ -1727,10 +1727,14 @@ svn_wc__db_global_relocate(svn_wc__db_t 
    the commit. It will become the BASE node's 'revnum' and 'changed_rev'
    values in the BASE_NODE table.
 
-   NEW_DATE is the (server-side) date of the new revision. It may be 0 if
+   CHANGED_REVISION is the the new 'last changed' revision. If the node is
+   modified its value is equivalent to NEW_REVISION, but in case of a
+   decendant of a copy/move it can be an older revision.
+
+   CHANGED_DATE is the (server-side) date of CHANGED_REVISION. It may be 0 if
    the revprop is missing on the revision.
 
-   NEW_AUTHOR is the (server-side) author of the new revision. It may be
+   CHANGED_AUTHOR is the (server-side) author of CHANGED_REVISION. It may be
    NULL if the revprop is missing on the revision.
 
    One or both of NEW_CHECKSUM and NEW_CHILDREN should be NULL. For new:
@@ -1744,8 +1748,9 @@ svn_error_t *
 svn_wc__db_global_commit(svn_wc__db_t *db,
                          const char *local_abspath,
                          svn_revnum_t new_revision,
-                         apr_time_t new_date,
-                         const char *new_author,
+                         svn_revnum_t changed_revision,
+                         apr_time_t changed_date,
+                         const char *changed_author,
                          const svn_checksum_t *new_checksum,
                          const apr_array_header_t *new_children,
                          apr_hash_t *new_dav_cache,

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=961784&r1=961783&r2=961784&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Thu Jul  8 14:27:22 2010
@@ -1295,6 +1295,7 @@ log_do_committed(svn_wc__db_t *db,
       apr_time_t last_mod_time;
 
       SVN_ERR(svn_wc__db_global_commit(db, local_abspath,
+                                       new_revision,
                                        new_revision, new_date, new_author,
                                        new_checksum,
                                        NULL /* new_children */,
@@ -1379,6 +1380,7 @@ log_do_committed(svn_wc__db_t *db,
   /* It's not a file, so it's a directory. */
 
   SVN_ERR(svn_wc__db_global_commit(db, local_abspath,
+                                   new_revision,
                                    new_revision, new_date, new_author,
                                    NULL /* new_checksum */,
                                    NULL /* new_children */,



Re: svn commit: r961784 - in /subversion/trunk/subversion/libsvn_wc: wc-queries.sql wc_db.c wc_db.h workqueue.c

Posted by Greg Stein <gs...@gmail.com>.
On Thu, Jul 8, 2010 at 10:27,  <rh...@apache.org> wrote:
>...
> +++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Thu Jul  8 14:27:22 2010
> @@ -400,7 +400,7 @@ INSERT OR REPLACE INTO BASE_NODE (
>   changed_author, properties, repos_id, repos_relpath, checksum, changed_date,
>   depth, symlink_target, dav_cache)
>  /* NOTE: ?6 is duplicated because we insert the same value in two columns.  */
> -VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15);
> +VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16);

A little awareness would be nice. You know... like that comment JUST
ABOVE the line you changed?

>...
> +++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Jul  8 14:27:22 2010
> @@ -5353,9 +5353,10 @@ struct commit_baton {
>   svn_wc__db_pdh_t *pdh;
>   const char *local_relpath;
>
> -  svn_revnum_t new_revision;
> -  apr_time_t new_date;
> -  const char *new_author;
> +  apr_int64_t new_revision;
> +  apr_int64_t changed_rev;

What? You mean svn_revnum_t.

Don't change the structure. Keep it semantics. The only point where it
needs to be an apr_int64_t is when you bind it. Change the semantics
*there*. Shoot... maybe we'll add an "r" code at some point to bind
revnums.

Using the wrong type for a given semantic... leads to problems.

>...
> @@ -5485,29 +5486,30 @@ commit_node(void *baton, svn_sqlite__db_
>
>   SVN_ERR(svn_sqlite__get_statement(&stmt, cb->pdh->wcroot->sdb,
>                                     STMT_APPLY_CHANGES_TO_BASE));
> -  SVN_ERR(svn_sqlite__bindf(stmt, "issttisb",
> +  SVN_ERR(svn_sqlite__bindf(stmt, "issttiisb",
>                             cb->pdh->wcroot->wc_id, cb->local_relpath,
>                             parent_relpath,
>                             presence_map, new_presence,
>                             kind_map, new_kind,
> -                            (apr_int64_t)cb->new_revision,
> -                            cb->new_author,
> +                            cb->new_revision,
> +                            cb->changed_rev,

Keep the cast.

>...

Cheers,
-g