Check-in [5a539f82dc]
Not logged in
Overview

SHA1 Hash:5a539f82dc57e0a6794def3d1cbc367c71668efd
Date: 2009-08-15 16:47:42
User: drh
Comment:Add the "circa" capability to the timeline. Check-in hyperlinks go to the "diff" page by default, rather than the "detail" page.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/info.c from [ce7fc1bbb9] to [e3bec54d02].

@@ -425,11 +425,11 @@
       }
       db_finalize(&q);
       @ </td></tr>
       @ <tr><th>Commands:</th>
       @   <td>
-      @     <a href="%s(g.zBaseURL)/vdiff/%d(rid)">diff</a>
+      @     <a href="%s(g.zBaseURL)/vdiff/%s(zShortUuid)">diff</a>
       @     | <a href="%s(g.zBaseURL)/dir?ci=%s(zShortUuid)">files</a>
       @     | <a href="%s(g.zBaseURL)/zip/%s(zProjName)-%s(zShortUuid).zip?uuid=%s(zUuid)">
       @         ZIP archive</a>
       @     | <a href="%s(g.zBaseURL)/artifact/%d(rid)">manifest</a>
       if( g.okWrite ){
@@ -672,10 +672,11 @@
   blob_reset(&from);
   blob_reset(&to);
   blob_reset(&out);
 }
 
+
 /*
 ** WEBPAGE: vdiff
 ** URL: /vdiff?name=RID
 **
 ** Show all differences for a particular check-in.
@@ -685,29 +686,44 @@
   Stmt q;
   char *zUuid;
 
   login_check_credentials();
   if( !g.okRead ){ login_needed(); return; }
-  style_header("Check-in Changes");
   login_anonymous_available();
 
   rid = name_to_rid(PD("name",""));
   if( rid==0 ){
     fossil_redirect_home();
   }
+  zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
+  style_header("Check-in [%.10s]", zUuid);
+  db_prepare(&q,
+    "SELECT datetime(mtime), "
+    "       coalesce(event.ecomment,event.comment),"
+    "       coalesce(event.euser,event.user)"
+    "  FROM event WHERE type='ci' AND objid=%d",
+    rid
+  );
+  while( db_step(&q)==SQLITE_ROW ){
+    const char *zDate = db_column_text(&q, 0);
+    const char *zUser = db_column_text(&q, 2);
+    const char *zComment = db_column_text(&q, 1);
+    @ <h2>Check-in %s(zUuid)</h2>
+    @ <p>Made by %h(zUser) on
+    link_to_date(zDate, ":");
+    @ %w(zComment). <a href="%s(g.zBaseURL)/ci/%s(zUuid)">[details]</a></p>
+    @ <hr>
+  }
+  db_finalize(&q);
   db_prepare(&q,
      "SELECT pid, fid, name"
      "  FROM mlink, filename"
      " WHERE mlink.mid=%d"
      "   AND filename.fnid=mlink.fnid"
      " ORDER BY name",
      rid
   );
-  zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
-  @ <h2>All Changes In Check-in
-  hyperlink_to_uuid(zUuid);
-  @ </h2>
   while( db_step(&q)==SQLITE_ROW ){
     int pid = db_column_int(&q,0);
     int fid = db_column_int(&q,1);
     const char *zName = db_column_text(&q,2);
     @ <p><a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a></p>
@@ -716,11 +732,10 @@
     @ </pre></blockquote>
   }
   db_finalize(&q);
   style_footer();
 }
-
 
 /*
 ** Write a description of an object to the www reply.
 **
 ** If the object is a file then mention:
@@ -851,10 +866,11 @@
     }
   }else if( linkToView ){
     @ <a href="%s(g.zBaseURL)/artifact/%d(rid)">[view]</a>
   }
 }
+
 
 /*
 ** WEBPAGE: fdiff
 **
 ** Two arguments, v1 and v2, are integers.  Show the difference between
@@ -1192,11 +1208,11 @@
     @ <p>No such object: %h(zName)</p>
     style_footer();
     return;
   }
   if( db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
-    ci_page();
+    vdiff_page();
   }else
   if( db_exists("SELECT 1 FROM tagxref JOIN tag USING(tagid)"
                 " WHERE rid=%d AND tagname LIKE 'wiki-%%'", rid) ){
     winfo_page();
   }else

Modified src/timeline.c from [146af37c0f] to [56d2a51056].

@@ -54,11 +54,11 @@
 ){
   char zShortUuid[UUID_SIZE+1];
   sprintf(zShortUuid, "%.10s", zUuid);
   if( g.okHistory ){
     @ <a onmouseover='%s(zIn)("m%d(id)")' onmouseout='%s(zOut)("m%d(id)")'
-    @    href="%s(g.zBaseURL)/ci/%s(zUuid)">[%s(zShortUuid)]</a>
+    @    href="%s(g.zBaseURL)/vdiff/%s(zUuid)">[%s(zShortUuid)]</a>
   }else{
     @ <b onmouseover='%s(zIn)("m%d(id)")' onmouseout='%s(zOut)("m%d(id)")'>
     @ [%s(zShortUuid)]</b>
   }
 }
@@ -308,10 +308,11 @@
 **
 ** Query parameters:
 **
 **    a=TIMESTAMP    after this date
 **    b=TIMESTAMP    before this date.
+**    c=TIMESTAMP    "circa" this date.
 **    n=COUNT        number of events in output
 **    p=RID          artifact RID and up to COUNT parents and ancestors
 **    d=RID          artifact RID and up to COUNT descendants
 **    t=TAGID        show only check-ins with the given tagid
 **    u=USER         only if belonging to this user
@@ -334,10 +335,11 @@
   int d_rid = atoi(PD("d","0"));     /* artifact d and its descendants */
   const char *zUser = P("u");        /* All entries by this user if not NULL */
   const char *zType = PD("y","all"); /* Type of events.  All if NULL */
   const char *zAfter = P("a");       /* Events after this time */
   const char *zBefore = P("b");      /* Events before this time */
+  const char *zCirca = P("c");       /* Events near this time */
   const char *zTagName = P("t");     /* Show events with this tag */
   HQuery url;                        /* URL for various branch links */
   int tagid;                         /* Tag ID */
 
   /* To view the timeline, must have permission to read project data.
@@ -442,10 +444,31 @@
            " ORDER BY event.mtime DESC", zBefore);
         url_add_parameter(&url, "b", zBefore);
        }else{
         zBefore = 0;
       }
+    }else if( zCirca ){
+      while( isspace(zCirca[0]) ){ zCirca++; }
+      if( zCirca[0] ){
+        double rCirca = db_double(0.0, "SELECT julianday(%Q, 'utc')", zCirca);
+        Blob sql2;
+        blob_init(&sql2, blob_str(&sql), -1);
+        blob_appendf(&sql2,
+            " AND event.mtime<=%f ORDER BY event.mtime DESC LIMIT %d",
+            rCirca, (nEntry+1)/2
+        );
+        db_multi_exec("%s", blob_str(&sql2));
+        blob_reset(&sql2);
+        blob_appendf(&sql,
+            " AND event.mtime>=%f ORDER BY event.mtime ASC",
+            rCirca
+        );
+        nEntry -= (nEntry+1)/2;
+        url_add_parameter(&url, "c", zCirca);
+      }else{
+        zCirca = 0;
+      }
     }else{
       blob_appendf(&sql, " ORDER BY event.mtime DESC");
     }
     blob_appendf(&sql, " LIMIT %d", nEntry);
     db_multi_exec("%s", blob_str(&sql));
@@ -452,11 +475,11 @@
 
     n = db_int(0, "SELECT count(*) FROM timeline");
     if( n<nEntry && zAfter ){
       cgi_redirect(url_render(&url, "a", 0, "b", 0));
     }
-    if( zAfter==0 && zBefore==0 ){
+    if( zAfter==0 && zBefore==0 && zCirca==0 ){
       blob_appendf(&desc, "%d most recent %ss", n, zEType);
     }else{
       blob_appendf(&desc, "%d %ss", n, zEType);
     }
     if( zUser ){
@@ -467,10 +490,12 @@
     }
     if( zAfter ){
       blob_appendf(&desc, " occurring on or after %h.<br>", zAfter);
     }else if( zBefore ){
       blob_appendf(&desc, " occurring on or before %h.<br>", zBefore);
+    }else if( zCirca ){
+      blob_appendf(&desc, " occurring around %h.<br>", zCirca);
     }
     if( g.okHistory ){
       if( zAfter || n==nEntry ){
         zDate = db_text(0, "SELECT min(timestamp) FROM timeline");
         timeline_submenu(&url, "Older", "b", zDate, "a");
@@ -600,10 +625,17 @@
   @     }
   @   }
   @ }
   @ </script>
   style_footer();
+}
+
+/*
+** Render the date string given as a hyperlink to a "circa" timeline.
+*/
+void link_to_date(const char *zDate, const char *zSuffix){
+  @ <a href="%s(g.zBaseURL)/timeline?c=%t(zDate)">%h(zDate)</a>%s(zSuffix)
 }
 
 /*
 ** The input query q selects various records.  Print a human-readable
 ** summary of those records.