Check-in [ac03d43348]
Not logged in
Overview

SHA1 Hash:ac03d433483d337b47fb5115e970b760e21f6b26
Date: 2009-08-21 16:25:30
User: drh
Edited Comment:Add the ability to edit check-in dates using control artifacts. Useful if a user does a check-in when their system clock is set incorrectly thus causing an incorrect timestamp to appear on the check-in artifact. You must run "fossil all rebuild" after upgrading to this or any later version of fossil from a prior version.
Original Comment:Add the ability to edit check-in dates using control artifacts. Useful if a user does a check-in when their system clock is set incorrectly thus causing an incorrect timestamp to appear on the check-in artifact.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/info.c from [e3bec54d02] to [4d0388b1d8].

@@ -1241,14 +1241,16 @@
 **     *  The check-in comment
 **     *  The background color.
 */
 void ci_edit_page(void){
   int rid;
-  const char *zComment;
-  const char *zNewComment;
-  const char *zUser;
-  const char *zNewUser;
+  const char *zComment;         /* Current comment on the check-in */
+  const char *zNewComment;      /* Revised check-in comment */
+  const char *zUser;            /* Current user for the check-in */
+  const char *zNewUser;         /* Revised user */
+  const char *zDate;            /* Current date of the check-in */
+  const char *zNewDate;         /* Revised check-in date */
   const char *zColor;
   const char *zNewColor;
   const char *zNewTagFlag;
   const char *zNewTag;
   const char *zNewBrFlag;
@@ -1291,10 +1293,14 @@
   zNewComment = PD("c",zComment);
   zUser = db_text(0, "SELECT coalesce(euser,user)"
                      "  FROM event WHERE objid=%d", rid);
   if( zUser==0 ) fossil_redirect_home();
   zNewUser = PD("u",zUser);
+  zDate = db_text(0, "SELECT datetime(mtime)"
+                     "  FROM event WHERE objid=%d", rid);
+  if( zDate==0 ) fossil_redirect_home();
+  zNewDate = PD("dt",zDate);
   zColor = db_text("", "SELECT bgcolor"
                         "  FROM event WHERE objid=%d", rid);
   zNewColor = PD("clr",zColor);
   fPropagateColor = P("pclr")!=0;
   zNewTagFlag = P("newtag") ? " checked" : "";
@@ -1325,10 +1331,14 @@
       db_multi_exec("REPLACE INTO newtags VALUES('bgcolor','-',NULL)");
     }
     if( strcmp(zComment,zNewComment)!=0 ){
       db_multi_exec("REPLACE INTO newtags VALUES('comment','+',%Q)",
                     zNewComment);
+    }
+    if( strcmp(zDate,zNewDate)!=0 ){
+      db_multi_exec("REPLACE INTO newtags VALUES('date','+',%Q)",
+                    zNewDate);
     }
     if( strcmp(zUser,zNewUser)!=0 ){
       db_multi_exec("REPLACE INTO newtags VALUES('user','+',%Q)", zNewUser);
     }
     db_prepare(&q,
@@ -1444,10 +1454,15 @@
   @ </td></tr>
 
   @ <tr><td align="right" valign="top"><b>Comment:</b></td>
   @ <td valign="top">
   @ <textarea name="c" rows="10" cols="80">%h(zNewComment)</textarea>
+  @ </td></tr>
+
+  @ <tr><td align="right" valign="top"><b>Check-in Time:</b></td>
+  @ <td valign="top">
+  @   <input type="text" name="dt" size="20" value="%h(zNewDate)">
   @ </td></tr>
 
   @ <tr><td align="right" valign="top"><b>Background Color:</b></td>
   @ <td valign="top">
   @ <table border=0 cellpadding=0 cellspacing=1>

Modified src/manifest.c from [a82cc38cad] to [065d6850c3].

@@ -915,16 +915,22 @@
         add_mlink(rid, &m, cid, 0);
       }
       db_finalize(&q);
       db_multi_exec(
         "REPLACE INTO event(type,mtime,objid,user,comment,"
-        "                  bgcolor,euser,ecomment)"
-        "VALUES('ci',%.17g,%d,%Q,%Q,"
-        " (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype>0),"
+                           "bgcolor,euser,ecomment)"
+        "VALUES('ci',"
+        "  coalesce("
+        "    (SELECT julianday(value) FROM tagxref WHERE tagid=%d AND rid=%d),"
+        "    %.17g"
+        "  ),"
+        "  %d,%Q,%Q,"
+        "  (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype>0),"
         "  (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d),"
         "  (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d));",
-        m.rDate, rid, m.zUser, m.zComment,
+        TAG_DATE, rid, m.rDate,
+        rid, m.zUser, m.zComment,
         TAG_BGCOLOR, rid,
         TAG_USER, rid,
         TAG_COMMENT, rid
       );
     }

Modified src/schema.c from [216bff41ba] to [db3fd09f7a].

@@ -276,15 +276,16 @@
 @   tagname TEXT UNIQUE              -- Tag name.
 @ );
 @ INSERT INTO tag VALUES(1, 'bgcolor');         -- TAG_BGCOLOR
 @ INSERT INTO tag VALUES(2, 'comment');         -- TAG_COMMENT
 @ INSERT INTO tag VALUES(3, 'user');            -- TAG_USER
-@ INSERT INTO tag VALUES(4, 'hidden');          -- TAG_HIDDEN
-@ INSERT INTO tag VALUES(5, 'private');         -- TAG_PRIVATE
-@ INSERT INTO tag VALUES(6, 'cluster');         -- TAG_CLUSTER
-@ INSERT INTO tag VALUES(7, 'branch');          -- TAG_BRANCH
-@ INSERT INTO tag VALUES(8, 'closed');          -- TAG_CLOSED
+@ INSERT INTO tag VALUES(4, 'date');            -- TAG_DATE
+@ INSERT INTO tag VALUES(5, 'hidden');          -- TAG_HIDDEN
+@ INSERT INTO tag VALUES(6, 'private');         -- TAG_PRIVATE
+@ INSERT INTO tag VALUES(7, 'cluster');         -- TAG_CLUSTER
+@ INSERT INTO tag VALUES(8, 'branch');          -- TAG_BRANCH
+@ INSERT INTO tag VALUES(9, 'closed');          -- TAG_CLOSED
 @
 @ -- Assignments of tags to baselines.  Note that we allow tags to
 @ -- have values assigned to them.  So we are not really dealing with
 @ -- tags here.  These are really properties.  But we are going to
 @ -- keep calling them tags because in many cases the value is ignored.
@@ -330,18 +331,19 @@
 */
 #if INTERFACE
 # define TAG_BGCOLOR    1     /* Set the background color for display */
 # define TAG_COMMENT    2     /* The check-in comment */
 # define TAG_USER       3     /* User who made a checking */
-# define TAG_HIDDEN     4     /* Do not display or sync */
-# define TAG_PRIVATE    5     /* Display but do not sync */
-# define TAG_CLUSTER    6     /* A cluster */
-# define TAG_BRANCH     7     /* Value is name of the current branch */
-# define TAG_CLOSED     8     /* Do not display this check-in as a leaf */
+# define TAG_DATE       4     /* The date of a check-in */
+# define TAG_HIDDEN     5     /* Do not display or sync */
+# define TAG_PRIVATE    6     /* Display but do not sync */
+# define TAG_CLUSTER    7     /* A cluster */
+# define TAG_BRANCH     8     /* Value is name of the current branch */
+# define TAG_CLOSED     9     /* Do not display this check-in as a leaf */
 #endif
 #if EXPORT_INTERFACE
-# define MAX_INT_TAG    8     /* The largest pre-assigned tag id */
+# define MAX_INT_TAG    9     /* The largest pre-assigned tag id */
 #endif
 
 /*
 ** The schema for the locate FOSSIL database file found at the root
 ** of very check-out.  This database contains the complete state of

Modified src/tag.c from [3c286a5a05] to [48169c968e].

@@ -200,10 +200,14 @@
       break;
     }
   }
   if( zCol ){
     db_multi_exec("UPDATE event SET %s=%Q WHERE objid=%d", zCol, zValue, rid);
+  }
+  if( tagid==TAG_DATE ){
+    db_multi_exec("UPDATE event SET mtime=julianday(%Q) WHERE objid=%d",
+                  zValue, rid);
   }
   if( tagtype==0 || tagtype==2 ){
     tag_propagate(rid, tagid, tagtype, rid, zValue, mtime);
   }
 }