Check-in [913608a5a6]
Not logged in
Overview

SHA1 Hash:913608a5a6848d575a1abd75540274d1a2d8f83b
Date: 2007-09-25 03:14:30
User: drh
Comment:Fix some problems with tag propagation. More problems remain.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/manifest.c from [ad3136f660] to [743c23b52e].

@@ -515,10 +515,11 @@
 */
 int manifest_crosslink(int rid, Blob *pContent){
   int i;
   Manifest m;
   Stmt q;
+  int parentid = 0;
 
   if( manifest_parse(&m, pContent)==0 ){
     return 0;
   }
   db_begin_transaction();
@@ -528,10 +529,11 @@
         int pid = uuid_to_rid(m.azParent[i], 1);
         db_multi_exec("INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime)"
                       "VALUES(%d, %d, %d, %.17g)", pid, rid, i==0, m.rDate);
         if( i==0 ){
           add_mlink(pid, 0, rid, &m);
+          parentid = pid;
         }
       }
       db_prepare(&q, "SELECT cid FROM plink WHERE pid=%d AND isprim", rid);
       while( db_step(&q)==SQLITE_ROW ){
         int cid = db_column_int(&q, 0);
@@ -564,11 +566,18 @@
         case '*':  type = 2; break;
         case '-':  type = 0; break;
       }
       tag_insert(&m.aTag[i].zName[1], type, m.aTag[i].zValue,
                  rid, m.rDate, tid);
+      if( tid!=rid ){
+        tag_propagate_all(tid);
+      }
+    }
+    if( parentid ){
+      tag_propagate_all(parentid);
     }
+    tag_propagate_all(rid);
   }
   db_end_transaction(0);
   manifest_clear(&m);
   return 1;
 }