@@ -143,9 +143,9 @@
/*
** Insert a tag into the database.
*/
-void tag_insert(
+int tag_insert(
const char *zTag, /* Name of the tag (w/o the "+" or "-" prefix */
int tagtype, /* 0:cancel 1:singleton 2:propagated */
const char *zValue, /* Value if the tag is really a property */
int srcId, /* Artifact that contains this tag */
@@ -171,9 +171,9 @@
rc = db_step(&s);
db_finalize(&s);
if( rc==SQLITE_ROW ){
/* Another entry that is more recent already exists. Do nothing */
- return;
+ return tagid;
}
db_prepare(&s,
"REPLACE INTO tagxref(tagid,tagtype,srcId,origid,value,mtime,rid)"
" VALUES(%d,%d,%d,%d,%Q,:mtime,%d)",
@@ -202,11 +202,16 @@
}
if( zCol ){
db_multi_exec("UPDATE event SET %s=%Q WHERE objid=%d", zCol, zValue, rid);
}
+ if( tagid==TAG_DATE ){
+ db_multi_exec("UPDATE event SET mtime=julianday(%Q) WHERE objid=%d",
+ zValue, rid);
+ }
if( tagtype==0 || tagtype==2 ){
tag_propagate(rid, tagid, tagtype, rid, zValue, mtime);
}
+ return tagid;
}
/*
@@ -239,8 +244,9 @@
rid = name_to_rid(g.argv[3]);
if( rid==0 ){
fossil_fatal("no such object: %s", g.argv[3]);
}
+ g.markPrivate = content_is_private(rid);
zValue = g.argc==5 ? g.argv[4] : 0;
db_begin_transaction();
tag_insert(zTag, tagtype, zValue, -1, 0.0, rid);
db_end_transaction(0);
@@ -273,8 +279,9 @@
fossil_fatal("%s", g.zErrMsg);
return;
}
rid = name_to_rid(blob_str(&uuid));
+ g.markPrivate = content_is_private(rid);
blob_zero(&ctrl);
#if 0
if( validate16(zTagname, strlen(zTagname)) ){