Fossil SCM
Fix the tag propagator so that when a non-propagating tag overrides a propagating tag, the propagation is undo. Ticket [fcadf658ed282b3a2]
Commit
6007b2075cc8368fbee5c959b29b2234b17b2832
Parent
b230721eb8c29da…
1 file changed
+6
-7
+6
-7
| --- src/tag.c | ||
| +++ src/tag.c | ||
| @@ -29,11 +29,11 @@ | ||
| 29 | 29 | ** |
| 30 | 30 | ** If tagtype is 2 then the tag is being propagated from an |
| 31 | 31 | ** ancestor node. If tagtype is 0 it means a branch tag is |
| 32 | 32 | ** being cancelled. |
| 33 | 33 | */ |
| 34 | -void tag_propagate( | |
| 34 | +static void tag_propagate( | |
| 35 | 35 | int pid, /* Propagate the tag to children of this node */ |
| 36 | 36 | int tagid, /* Tag to propagate */ |
| 37 | 37 | int tagType, /* 2 for a propagating tag. 0 for an antitag */ |
| 38 | 38 | int origId, /* Artifact of tag, when tagType==2 */ |
| 39 | 39 | const char *zValue, /* Value of the tag. Might be NULL */ |
| @@ -98,26 +98,26 @@ | ||
| 98 | 98 | db_finalize(&eventupdate); |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /* |
| 103 | -** Propagate all propagatable tags in pid to its children. | |
| 103 | +** Propagate all propagatable tags in pid to the children of pid. | |
| 104 | 104 | */ |
| 105 | 105 | void tag_propagate_all(int pid){ |
| 106 | 106 | Stmt q; |
| 107 | 107 | db_prepare(&q, |
| 108 | 108 | "SELECT tagid, tagtype, mtime, value, origid FROM tagxref" |
| 109 | - " WHERE rid=%d" | |
| 110 | - " AND (tagtype=0 OR tagtype=2)", | |
| 109 | + " WHERE rid=%d", | |
| 111 | 110 | pid |
| 112 | 111 | ); |
| 113 | 112 | while( db_step(&q)==SQLITE_ROW ){ |
| 114 | 113 | int tagid = db_column_int(&q, 0); |
| 115 | 114 | int tagtype = db_column_int(&q, 1); |
| 116 | 115 | double mtime = db_column_double(&q, 2); |
| 117 | 116 | const char *zValue = db_column_text(&q, 3); |
| 118 | 117 | int origid = db_column_int(&q, 4); |
| 118 | + if( tagtype==1 ) tagtype = 0; | |
| 119 | 119 | tag_propagate(pid, tagid, tagtype, origid, zValue, mtime); |
| 120 | 120 | } |
| 121 | 121 | db_finalize(&q); |
| 122 | 122 | } |
| 123 | 123 | |
| @@ -207,13 +207,12 @@ | ||
| 207 | 207 | " SET mtime=julianday(%Q)," |
| 208 | 208 | " omtime=coalesce(omtime,mtime)" |
| 209 | 209 | " WHERE objid=%d", |
| 210 | 210 | zValue, rid); |
| 211 | 211 | } |
| 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); | |
| 215 | 214 | return tagid; |
| 216 | 215 | } |
| 217 | 216 | |
| 218 | 217 | |
| 219 | 218 | /* |
| 220 | 219 |
| --- 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 |