Check-in [2db88ec639]
Not logged in
Overview

SHA1 Hash:2db88ec63945e2947b9220601d14e628aa0a8eec
Date: 2007-09-25 01:02:25
User: jnc
Comment:Timeline and Leaves on TTY now marks with *...* (vs ...) you current working revision
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/timeline.c from [34894e4584] to [d7ec196da1].

@@ -395,20 +395,38 @@
 **    5.  Number of parents
 */
 void print_timeline(Stmt *q, int mxLine){
   int nLine = 0;
   char zPrevDate[20];
+  char *delims;
+  const char *zCurrentUuid;
+  Stmt currentQ;
+  int rid = db_lget_int("checkout", 0);
   zPrevDate[0] = 0;
+
+  db_prepare(&currentQ,
+    "SELECT uuid"
+    "  FROM blob WHERE rid=%d", rid
+  );
+  if( db_step(&currentQ)==SQLITE_ROW ){
+    zCurrentUuid = db_column_text(&currentQ, 0);
+  }
 
   while( db_step(q)==SQLITE_ROW && nLine<=mxLine ){
     const char *zId = db_column_text(q, 1);
     const char *zDate = db_column_text(q, 2);
     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 = "[]";
+    }
 
     sprintf(zUuid, "%.10s", zId);
     if( memcmp(zDate, zPrevDate, 10) ){
       printf("=== %.10s ===\n", zDate);
       memcpy(zPrevDate, zDate, 10);
@@ -425,17 +443,19 @@
       }
       if( nChild>1 ){
         sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*FORK* ");
         n = strlen(zPrefix);
       }
-      zFree = sqlite3_mprintf("[%.10s] %s%s", zUuid, zPrefix, zCom);
+      zFree = sqlite3_mprintf("%c%.10s%c %s%s", delims[0], zUuid, delims[1],
+                              zPrefix, zCom);
     }else{
-      zFree = sqlite3_mprintf("[%.10s] %s", zUuid, zCom);
+      zFree = sqlite3_mprintf("%c%.10s%c %s", delims[0], zUuid, delims[1], zCom);
     }
     nLine += comment_print(zFree, 9, 79);
     sqlite3_free(zFree);
   }
+  db_finalize(&currentQ);
 }
 
 /*
 ** Return a pointer to a static string that forms the basis for
 ** a timeline query for display on a TTY.