Check-in [432d4391b9]
Not logged in
Overview

SHA1 Hash:432d4391b9b64e3cc556832db60d5c51fc24e98b
Date: 2009-01-21 13:50:11
User: drh
Comment:Fix a bug in the "leaves" page when the repository is empty. Begin adding support for the ability to erase tags.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/descendants.c from [4af89fd5e9] to [97b96f70b0].

@@ -76,10 +76,11 @@
   bag_init(&seen);
   bag_init(&pending);
   if( iBase<=0 ){
     iBase = db_int(0, "SELECT objid FROM event WHERE type='ci'"
                       " ORDER BY mtime LIMIT 1");
+    if( iBase==0 ) return;
   }
   bag_insert(&pending, iBase);
   db_prepare(&q, "SELECT cid FROM plink WHERE pid=:rid");
   db_prepare(&isBr,
      "SELECT 1 FROM tagxref WHERE rid=:rid AND tagid=%d AND tagtype=1",

Modified src/manifest.c from [41e697c405] to [6584f80fc0].

@@ -501,11 +501,11 @@
           zUuid = 0;
         }else{
           goto manifest_syntax_error;
         }
         defossilize(zName);
-        if( zName[0]!='-' && zName[0]!='+' && zName[0]!='*' ){
+        if( zName[0]!='-' && zName[0]!='+' && zName[0]!='*' && zName[0]!='0' ){
           goto manifest_syntax_error;
         }
         if( validate16(&zName[1], strlen(&zName[1])) ){
           /* Do not allow tags whose names look like UUIDs */
           goto manifest_syntax_error;
@@ -948,13 +948,14 @@
       }else{
         tid = rid;
       }
       if( tid ){
         switch( m.aTag[i].zName[0] ){
-          case '+':  type = 1; break;
-          case '*':  type = 2; break;
-          case '-':  type = 0; break;
+          case '+':  type = 1;  break;
+          case '*':  type = 2;  break;
+          case '-':  type = 0;  break;
+          case '0':  type = -1; break;
           default:
             fossil_fatal("unknown tag type in manifest: %s", m.aTag);
             return 0;
         }
         tag_insert(&m.aTag[i].zName[1], type, m.aTag[i].zValue,

Modified src/tag.c from [4bfb6b9490] to [2e6da967ad].

@@ -142,11 +142,11 @@
 /*
 ** Insert a tag into the database.
 */
 void tag_insert(
   const char *zTag,        /* Name of the tag (w/o the "+" or "-" prefix */
-  int tagtype,             /* 0:cancel  1:singleton  2:propagated */
+  int tagtype,             /* 0:cancel  1:singleton  2:propagated -1:erase */
   const char *zValue,      /* Value if the tag is really a property */
   int srcId,               /* Artifact that contains this tag */
   double mtime,            /* Timestamp.  Use default if <=0.0 */
   int rid                  /* Artifact to which the tag is to attached */
 ){
@@ -167,12 +167,16 @@
   );
   db_bind_double(&s, ":mtime", mtime);
   rc = db_step(&s);
   db_finalize(&s);
   if( rc==SQLITE_ROW ){
-    /* Another entry this is more recent already exists.  Do nothing */
+    /* Another entry that is more recent already exists.  Do nothing */
+    return;
+  }
+  if( tagtype<0 ){
     return;
+    /* TBD: erase tags */
   }
   db_prepare(&s,
     "REPLACE INTO tagxref(tagid,tagtype,srcId,value,mtime,rid)"
     " VALUES(%d,%d,%d,%Q,:mtime,%d)",
     tagid, tagtype, srcId, zValue, rid