subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dan...@apache.org
Subject svn commit: r937520 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_wc/status.c svn/status.c
Date Fri, 23 Apr 2010 21:05:50 GMT
Author: dannas
Date: Fri Apr 23 21:05:50 2010
New Revision: 937520

URL: http://svn.apache.org/viewvc?rev=937520&view=rev
Log:
As part of WC-NG replace calls that fetches lock information from
the entry field in svn_wc_status3_t.

We could have just used a boolean locked field and let the callbacks
fetch the needed extra fields, but since the information is cheap to
fetch we can just as well get it at once.

* subversion/include/svn_wc.h
  (svn_wc_status3_t): Add lock_token, lock_owner, lock_comment and
    lock_creation_date fields.

* subversion/libsvn_wc/status.c
  (assemble_status): Set the new lock fields in svn_wc_status3_t.
  (svn_wc_dup_status3): Copy the fields that uses strings.

* subversion/svn/status.c
  (print_status,
   svn_cl__print_status_xml): Use the new svn_wc_status3_t fields
    instead of the entry ones.

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_wc/status.c
    subversion/trunk/subversion/svn/status.c

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=937520&r1=937519&r2=937520&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Fri Apr 23 21:05:50 2010
@@ -3629,6 +3629,22 @@ typedef struct svn_wc_status3_t
   /** Date of last commit. */
   apr_time_t changed_date;
 
+  /** The locally present lock token.
+   */
+  const char *lock_token;
+
+  /** The locally present lock owner.
+   */
+  const char *lock_owner;
+
+  /** The locally present lock comment.
+   */
+  const char *lock_comment;
+
+  /** The locally present lock creation date.
+   */
+  apr_time_t lock_creation_date;
+
   /* NOTE! Please update svn_wc_dup_status3() when adding new fields here. */
 } svn_wc_status3_t;
 

Modified: subversion/trunk/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/status.c?rev=937520&r1=937519&r2=937520&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/status.c (original)
+++ subversion/trunk/subversion/libsvn_wc/status.c Fri Apr 23 21:05:50 2010
@@ -297,11 +297,11 @@ assemble_status(svn_wc_status3_t **statu
   svn_boolean_t switched_p = FALSE;
   const svn_wc_conflict_description2_t *tree_conflict;
   svn_boolean_t file_external_p = FALSE;
+  svn_wc__db_lock_t *lock;
   svn_revnum_t revision;
   svn_revnum_t changed_rev;
   const char *changed_author;
   apr_time_t changed_date;
-  svn_boolean_t base_shadowed;
 #ifdef HAVE_SYMLINK
   svn_boolean_t wc_special;
 #endif /* HAVE_SYMLINK */
@@ -389,6 +389,10 @@ assemble_status(svn_wc_status3_t **statu
       stat->ood_last_cmt_date = 0;
       stat->ood_kind = svn_node_none;
       stat->ood_last_cmt_author = NULL;
+      stat->lock_token = NULL;
+      stat->lock_owner = NULL;
+      stat->lock_comment = NULL;
+      stat->lock_creation_date = 0;
 
       *status = stat;
       return SVN_NO_ERROR;
@@ -397,8 +401,8 @@ assemble_status(svn_wc_status3_t **statu
   SVN_ERR(svn_wc__db_read_info(NULL, NULL, &revision, NULL, NULL, NULL,
                                &changed_rev, &changed_date, &changed_author,
                                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, NULL, NULL, &base_shadowed, NULL,
-                               NULL, db, local_abspath, result_pool,
+                               NULL, NULL, NULL, NULL, NULL, NULL,
+                               &lock, db, local_abspath, result_pool,
                                scratch_pool));
 
   /* Someone either deleted the administrative directory in the versioned
@@ -633,6 +637,10 @@ assemble_status(svn_wc_status3_t **statu
   stat->tree_conflict = svn_wc__cd2_to_cd(tree_conflict, result_pool);
   stat->pristine_text_status = pristine_text_status;
   stat->pristine_prop_status = pristine_prop_status;
+  stat->lock_token = lock ? lock->token : NULL;
+  stat->lock_owner = lock ? lock->owner : NULL;
+  stat->lock_comment = lock ? lock->comment : NULL;
+  stat->lock_creation_date = lock ? lock->date : 0;
 
   *status = stat;
 
@@ -2490,6 +2498,18 @@ svn_wc_dup_status3(const svn_wc_status3_
     new_stat->tree_conflict
       = svn_wc__conflict_description_dup(orig_stat->tree_conflict, pool);
 
+  if (orig_stat->lock_token)
+    new_stat->lock_token
+      = apr_pstrdup(pool, orig_stat->lock_token);
+
+  if (orig_stat->lock_owner)
+    new_stat->lock_owner
+      = apr_pstrdup(pool, orig_stat->lock_owner);
+
+  if (orig_stat->lock_comment)
+    new_stat->lock_comment
+      = apr_pstrdup(pool, orig_stat->lock_comment);
+
   /* Return the new hotness. */
   return new_stat;
 }

Modified: subversion/trunk/subversion/svn/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/status.c?rev=937520&r1=937519&r2=937520&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/status.c (original)
+++ subversion/trunk/subversion/svn/status.c Fri Apr 23 21:05:50 2010
@@ -167,9 +167,9 @@ print_status(const char *path,
         {
           if (status->repos_lock)
             {
-              if (status->entry && status->entry->lock_token)
+              if (status->lock_token)
                 {
-                  if (strcmp(status->repos_lock->token, status->entry->lock_token)
+                  if (strcmp(status->repos_lock->token, status->lock_token)
                       == 0)
                     lock_status = 'K';
                   else
@@ -178,13 +178,13 @@ print_status(const char *path,
               else
                 lock_status = 'O';
             }
-          else if (status->entry && status->entry->lock_token)
+          else if (status->lock_token)
             lock_status = 'B';
           else
             lock_status = ' ';
         }
       else
-        lock_status = (status->entry && status->entry->lock_token) ? 'K'
: ' ';
+        lock_status = (status->lock_token) ? 'K' : ' ';
 
       if (show_last_committed)
         {
@@ -245,7 +245,7 @@ print_status(const char *path,
                           status->locked ? 'L' : ' ',
                           status->copied ? '+' : ' ',
                           generate_switch_column_code(status),
-                          ((status->entry && status->entry->lock_token)
+                          ((status->lock_token)
                            ? 'K' : ' '),
                           tree_status_code,
                           path,
@@ -301,27 +301,27 @@ svn_cl__print_status_xml(const char *pat
                                pool);
     }
 
-  if (status->entry && status->entry->lock_token)
+  if (status->lock_token)
     {
       svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "lock", NULL);
 
-      svn_cl__xml_tagged_cdata(&sb, pool, "token", status->entry->lock_token);
+      svn_cl__xml_tagged_cdata(&sb, pool, "token", status->lock_token);
 
       /* If lock_owner is NULL, assume WC is corrupt. */
-      if (status->entry->lock_owner)
+      if (status->lock_owner)
         svn_cl__xml_tagged_cdata(&sb, pool, "owner",
-                                 status->entry->lock_owner);
+                                 status->lock_owner);
       else
         return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,
                                  _("'%s' has lock token, but no lock owner"),
                                  svn_dirent_local_style(path, pool));
 
       svn_cl__xml_tagged_cdata(&sb, pool, "comment",
-                               status->entry->lock_comment);
+                               status->lock_comment);
 
       svn_cl__xml_tagged_cdata(&sb, pool, "created",
                                svn_time_to_cstring
-                               (status->entry->lock_creation_date, pool));
+                               (status->lock_creation_date, pool));
 
       svn_xml_make_close_tag(&sb, pool, "lock");
     }



Mime
View raw message