Diff
Not logged in

Differences From:

File src/timeline.c part of check-in [e63a9fd9d0] - Fixed many uninitialized variable warnings and some potential bug found via -Wall -Werror on gcc. by jnc on 2007-09-25 21:21:35. Also file src/timeline.c part of check-in [92291035fe] - Merged the compiler warning fixes into mainstream by jnc on 2007-09-25 21:28:30. [view]

To:

File src/timeline.c part of check-in [097479f99a] - Better defaults for new databases and clones. Use *CURRENT* to identify the current checkout for TTY timelines. by drh on 2007-09-26 02:00:26. [view]

@@ -396,9 +396,8 @@
 */
 void print_timeline(Stmt *q, int mxLine){
   int nLine = 0;
   char zPrevDate[20];
-  char *delims;
   const char *zCurrentUuid=0;
   Stmt currentQ;
   int rid = db_lget_int("checkout", 0);
   zPrevDate[0] = 0;
@@ -417,15 +416,11 @@
     const char *zCom = db_column_text(q, 3);
     int nChild = db_column_int(q, 4);
     int nParent = db_column_int(q, 5);
     char *zFree = 0;
-    char zUuid[UUID_SIZE+1];
-
-    if( strcmp(zCurrentUuid, zId)==0 ){
-      delims = "<>";
-    }else{
-      delims = "[]";
-    }
+    int n = 0;
+    char zPrefix[80];
+    char zUuid[UUID_SIZE+1];
 
     sprintf(zUuid, "%.10s", zId);
     if( memcmp(zDate, zPrevDate, 10) ){
       printf("=== %.10s ===\n", zDate);
@@ -433,24 +428,22 @@
       nLine++;
     }
     if( zCom==0 ) zCom = "";
     printf("%.8s ", &zDate[11]);
-    if( nChild>1 || nParent>1 ){
-      int n = 0;
-      char zPrefix[50];
-      if( nParent>1 ){
-        sqlite3_snprintf(sizeof(zPrefix), zPrefix, "*MERGE* ");
-        n = strlen(zPrefix);
-      }
-      if( nChild>1 ){
-        sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*FORK* ");
-        n = strlen(zPrefix);
-      }
-      zFree = sqlite3_mprintf("%c%.10s%c %s%s", delims[0], zUuid, delims[1],
-                              zPrefix, zCom);
-    }else{
-      zFree = sqlite3_mprintf("%c%.10s%c %s", delims[0], zUuid, delims[1], zCom);
+    zPrefix[0] = 0;
+    if( nParent>1 ){
+      sqlite3_snprintf(sizeof(zPrefix), zPrefix, "*MERGE* ");
+      n = strlen(zPrefix);
+    }
+    if( nChild>1 ){
+      sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*FORK* ");
+      n = strlen(zPrefix);
+    }
+    if( strcmp(zCurrentUuid,zId)==0 ){
+      sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*CURRENT* ");
+      n += strlen(zPrefix);
     }
+    zFree = sqlite3_mprintf("[%.10s] %s%s", zUuid, zPrefix, zCom);
     nLine += comment_print(zFree, 9, 79);
     sqlite3_free(zFree);
   }
   db_finalize(&currentQ);