Fossil SCM

Fix the tag propagator so that when a non-propagating tag overrides a propagating tag, the propagation is undo. Ticket [fcadf658ed282b3a2]

drh 2010-12-18 01:46 trunk
Commit 6007b2075cc8368fbee5c959b29b2234b17b2832
1 file changed +6 -7
+6 -7
--- src/tag.c
+++ src/tag.c
@@ -29,11 +29,11 @@
2929
**
3030
** If tagtype is 2 then the tag is being propagated from an
3131
** ancestor node. If tagtype is 0 it means a branch tag is
3232
** being cancelled.
3333
*/
34
-void tag_propagate(
34
+static void tag_propagate(
3535
int pid, /* Propagate the tag to children of this node */
3636
int tagid, /* Tag to propagate */
3737
int tagType, /* 2 for a propagating tag. 0 for an antitag */
3838
int origId, /* Artifact of tag, when tagType==2 */
3939
const char *zValue, /* Value of the tag. Might be NULL */
@@ -98,26 +98,26 @@
9898
db_finalize(&eventupdate);
9999
}
100100
}
101101
102102
/*
103
-** Propagate all propagatable tags in pid to its children.
103
+** Propagate all propagatable tags in pid to the children of pid.
104104
*/
105105
void tag_propagate_all(int pid){
106106
Stmt q;
107107
db_prepare(&q,
108108
"SELECT tagid, tagtype, mtime, value, origid FROM tagxref"
109
- " WHERE rid=%d"
110
- " AND (tagtype=0 OR tagtype=2)",
109
+ " WHERE rid=%d",
111110
pid
112111
);
113112
while( db_step(&q)==SQLITE_ROW ){
114113
int tagid = db_column_int(&q, 0);
115114
int tagtype = db_column_int(&q, 1);
116115
double mtime = db_column_double(&q, 2);
117116
const char *zValue = db_column_text(&q, 3);
118117
int origid = db_column_int(&q, 4);
118
+ if( tagtype==1 ) tagtype = 0;
119119
tag_propagate(pid, tagid, tagtype, origid, zValue, mtime);
120120
}
121121
db_finalize(&q);
122122
}
123123
@@ -207,13 +207,12 @@
207207
" SET mtime=julianday(%Q),"
208208
" omtime=coalesce(omtime,mtime)"
209209
" WHERE objid=%d",
210210
zValue, rid);
211211
}
212
- if( tagtype==0 || tagtype==2 ){
213
- tag_propagate(rid, tagid, tagtype, rid, zValue, mtime);
214
- }
212
+ if( tagtype==1 ) tagtype = 0;
213
+ tag_propagate(rid, tagid, tagtype, rid, zValue, mtime);
215214
return tagid;
216215
}
217216
218217
219218
/*
220219
--- src/tag.c
+++ src/tag.c
@@ -29,11 +29,11 @@
29 **
30 ** If tagtype is 2 then the tag is being propagated from an
31 ** ancestor node. If tagtype is 0 it means a branch tag is
32 ** being cancelled.
33 */
34 void tag_propagate(
35 int pid, /* Propagate the tag to children of this node */
36 int tagid, /* Tag to propagate */
37 int tagType, /* 2 for a propagating tag. 0 for an antitag */
38 int origId, /* Artifact of tag, when tagType==2 */
39 const char *zValue, /* Value of the tag. Might be NULL */
@@ -98,26 +98,26 @@
98 db_finalize(&eventupdate);
99 }
100 }
101
102 /*
103 ** Propagate all propagatable tags in pid to its children.
104 */
105 void tag_propagate_all(int pid){
106 Stmt q;
107 db_prepare(&q,
108 "SELECT tagid, tagtype, mtime, value, origid FROM tagxref"
109 " WHERE rid=%d"
110 " AND (tagtype=0 OR tagtype=2)",
111 pid
112 );
113 while( db_step(&q)==SQLITE_ROW ){
114 int tagid = db_column_int(&q, 0);
115 int tagtype = db_column_int(&q, 1);
116 double mtime = db_column_double(&q, 2);
117 const char *zValue = db_column_text(&q, 3);
118 int origid = db_column_int(&q, 4);
 
119 tag_propagate(pid, tagid, tagtype, origid, zValue, mtime);
120 }
121 db_finalize(&q);
122 }
123
@@ -207,13 +207,12 @@
207 " SET mtime=julianday(%Q),"
208 " omtime=coalesce(omtime,mtime)"
209 " WHERE objid=%d",
210 zValue, rid);
211 }
212 if( tagtype==0 || tagtype==2 ){
213 tag_propagate(rid, tagid, tagtype, rid, zValue, mtime);
214 }
215 return tagid;
216 }
217
218
219 /*
220
--- src/tag.c
+++ src/tag.c
@@ -29,11 +29,11 @@
29 **
30 ** If tagtype is 2 then the tag is being propagated from an
31 ** ancestor node. If tagtype is 0 it means a branch tag is
32 ** being cancelled.
33 */
34 static void tag_propagate(
35 int pid, /* Propagate the tag to children of this node */
36 int tagid, /* Tag to propagate */
37 int tagType, /* 2 for a propagating tag. 0 for an antitag */
38 int origId, /* Artifact of tag, when tagType==2 */
39 const char *zValue, /* Value of the tag. Might be NULL */
@@ -98,26 +98,26 @@
98 db_finalize(&eventupdate);
99 }
100 }
101
102 /*
103 ** Propagate all propagatable tags in pid to the children of pid.
104 */
105 void tag_propagate_all(int pid){
106 Stmt q;
107 db_prepare(&q,
108 "SELECT tagid, tagtype, mtime, value, origid FROM tagxref"
109 " WHERE rid=%d",
 
110 pid
111 );
112 while( db_step(&q)==SQLITE_ROW ){
113 int tagid = db_column_int(&q, 0);
114 int tagtype = db_column_int(&q, 1);
115 double mtime = db_column_double(&q, 2);
116 const char *zValue = db_column_text(&q, 3);
117 int origid = db_column_int(&q, 4);
118 if( tagtype==1 ) tagtype = 0;
119 tag_propagate(pid, tagid, tagtype, origid, zValue, mtime);
120 }
121 db_finalize(&q);
122 }
123
@@ -207,13 +207,12 @@
207 " SET mtime=julianday(%Q),"
208 " omtime=coalesce(omtime,mtime)"
209 " WHERE objid=%d",
210 zValue, rid);
211 }
212 if( tagtype==1 ) tagtype = 0;
213 tag_propagate(rid, tagid, tagtype, rid, zValue, mtime);
 
214 return tagid;
215 }
216
217
218 /*
219

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button