Diff
Not logged in

Differences From:

File src/timeline.c part of check-in [d42adc11c8] - Put the divider marks around the base check-in on ancestor and descendent timelines. by drh on 2009-08-29 22:54:18. [view]

To:

File src/timeline.c part of check-in [df3e34c2e8] - Changes to the event mechanism to abbreviate a sequence of edits to the same ticket. Updates through this check-in require a "rebuild". by drh on 2009-09-14 15:14:32. [view]

@@ -133,8 +133,9 @@
 */
 #if INTERFACE
 #define TIMELINE_ARTID    0x0001  /* Show artifact IDs on non-check-in lines */
 #define TIMELINE_LEAFONLY 0x0002  /* Show "Leaf", but not "Merge", "Fork" etc */
+#define TIMELINE_BRIEF    0x0004  /* Combine adjacent elements of same object */
 #endif
 
 /*
 ** Output a timeline in the web format given a query.  The query
@@ -148,10 +149,12 @@
 **    5.  Number of non-merge children
 **    6.  Number of parents
 **    7.  True if is a leaf
 **    8.  background color
-**    9.  type ("ci", "w")
+**    9.  type ("ci", "w", "t")
 **   10.  list of symbolic tags.
+**   11.  tagid for ticket or wiki
+**   12.  Short comment to user for repeated tickets and wiki
 */
 void www_print_timeline(
   Stmt *pQuery,          /* Query to implement the timeline */
   int tmFlags,           /* Flags controlling display behavior */
@@ -161,8 +164,10 @@
   int mxWikiLen;
   Blob comment;
   char zPrevDate[20];
   zPrevDate[0] = 0;
+  int prevTagid = 0;
+  int suppressCnt = 0;
 
   mxWikiLen = db_get_int("timeline-max-comment", 0);
   if( db_get_boolean("timeline-block-markup", 0) ){
     wikiFlags = WIKI_INLINE;
@@ -186,8 +191,27 @@
     const char *zDate = db_column_text(pQuery, 2);
     const char *zType = db_column_text(pQuery, 9);
     const char *zUser = db_column_text(pQuery, 4);
     const char *zTagList = db_column_text(pQuery, 10);
+    int tagid = db_column_int(pQuery, 11);
+    int commentColumn = 3;    /* Column containing comment text */
+    if( tagid ){
+      if( tagid==prevTagid ){
+        if( tmFlags & TIMELINE_BRIEF ){
+          suppressCnt++;
+          continue;
+        }else{
+          commentColumn = 12;
+        }
+      }
+    }
+    prevTagid = tagid;
+    if( suppressCnt ){
+      @ <tr><td><td><td>
+      @ ... preceded by %d(suppressCnt) other
+      @ similar event%s(suppressCnt>1?"s":"").</tr>
+      suppressCnt = 0;
+    }
     if( strcmp(zType,"div")==0 ){
       @ <tr><td colspan=3><hr></td></tr>
       continue;
     }
@@ -240,9 +264,9 @@
       }
     }else if( (tmFlags & TIMELINE_ARTID)!=0 ){
       hyperlink_to_uuid(zUuid);
     }
-    db_column_blob(pQuery, 3, &comment);
+    db_column_blob(pQuery, commentColumn, &comment);
     if( mxWikiLen>0 && blob_size(&comment)>mxWikiLen ){
       Blob truncated;
       blob_zero(&truncated);
       blob_append(&truncated, blob_buffer(&comment), mxWikiLen);
@@ -281,9 +305,11 @@
     @   nparent INTEGER,
     @   isleaf BOOLEAN,
     @   bgcolor TEXT,
     @   etype TEXT,
-    @   taglist TEXT
+    @   taglist TEXT,
+    @   tagid INTEGER,
+    @   short TEXT
     @ )
   ;
   db_multi_exec(zSql);
 }
@@ -312,9 +338,11 @@
     @   bgcolor,
     @   event.type,
     @   (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref
     @     WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
-    @       AND tagxref.rid=blob.rid AND tagxref.tagtype>0)
+    @       AND tagxref.rid=blob.rid AND tagxref.tagtype>0),
+    @   tagid,
+    @   brief
     @  FROM event JOIN blob
     @ WHERE blob.rid=event.objid
   ;
   if( zBase==0 ){
@@ -394,8 +422,9 @@
   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 */
+  int tmFlags;                       /* Timeline flags */
 
   /* To view the timeline, must have permission to read project data.
   */
   login_check_credentials();
@@ -403,8 +432,13 @@
   if( zTagName ){
     tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'", zTagName);
   }else{
     tagid = 0;
+  }
+  if( zType[0]=='a' ){
+    tmFlags = TIMELINE_BRIEF;
+  }else{
+    tmFlags = 0;
   }
 
   style_header("Timeline");
   login_anonymous_available();
@@ -598,9 +632,9 @@
   blob_zero(&sql);
   db_prepare(&q, "SELECT * FROM timeline ORDER BY timestamp DESC");
   @ <h2>%b(&desc)</h2>
   blob_reset(&desc);
-  www_print_timeline(&q, 0, 0);
+  www_print_timeline(&q, tmFlags, 0);
   db_finalize(&q);
 
   @ <script>
   @ var parentof = new Object();