Fossil SCM
Include first-generation simple cherrypicks among in ancestor graphs on the timeline.
Commit
5a23a724aef1f5027a912122288cef22cb80c7e4418af1f5a3b325a3f2b7ce2a
Parent
13dfcdd9576baa4…
1 file changed
+40
-15
+40
-15
| --- src/descendants.c | ||
| +++ src/descendants.c | ||
| @@ -167,25 +167,50 @@ | ||
| 167 | 167 | if( !N ){ |
| 168 | 168 | N = -1; |
| 169 | 169 | }else if( N<0 ){ |
| 170 | 170 | N = -N; |
| 171 | 171 | } |
| 172 | - db_multi_exec( | |
| 173 | - "WITH RECURSIVE " | |
| 174 | - " ancestor(rid, mtime) AS (" | |
| 175 | - " SELECT %d, mtime FROM event WHERE objid=%d " | |
| 176 | - " UNION " | |
| 177 | - " SELECT plink.pid, event.mtime" | |
| 178 | - " FROM ancestor, plink, event" | |
| 179 | - " WHERE plink.cid=ancestor.rid" | |
| 180 | - " AND event.objid=plink.pid %s" | |
| 181 | - " ORDER BY mtime DESC LIMIT %d" | |
| 182 | - " )" | |
| 183 | - "INSERT INTO ok" | |
| 184 | - " SELECT rid FROM ancestor;", | |
| 185 | - rid, rid, directOnly ? "AND plink.isPrim" : "", N | |
| 186 | - ); | |
| 172 | + if( directOnly ){ | |
| 173 | + db_multi_exec( | |
| 174 | + "WITH RECURSIVE " | |
| 175 | + " ancestor(rid, mtime) AS (" | |
| 176 | + " SELECT %d, mtime FROM event WHERE objid=%d " | |
| 177 | + " UNION " | |
| 178 | + " SELECT plink.pid, event.mtime" | |
| 179 | + " FROM ancestor, plink, event" | |
| 180 | + " WHERE plink.cid=ancestor.rid" | |
| 181 | + " AND event.objid=plink.pid" | |
| 182 | + " AND plink.isPrim" | |
| 183 | + " ORDER BY mtime DESC LIMIT %d" | |
| 184 | + " )" | |
| 185 | + "INSERT INTO ok" | |
| 186 | + " SELECT rid FROM ancestor;", | |
| 187 | + rid, rid, N | |
| 188 | + ); | |
| 189 | + }else{ | |
| 190 | + db_multi_exec( | |
| 191 | + "WITH RECURSIVE " | |
| 192 | + " parent(pid,cid,isCP) AS (" | |
| 193 | + " SELECT plink.pid, plink.cid, 0 AS xisCP FROM plink" | |
| 194 | + " UNION ALL" | |
| 195 | + " SELECT parentid, childid, 1 FROM cherrypick WHERE NOT isExclude" | |
| 196 | + " )," | |
| 197 | + " ancestor(rid, mtime, isCP) AS (" | |
| 198 | + " SELECT %d, mtime, 0 FROM event WHERE objid=%d " | |
| 199 | + " UNION " | |
| 200 | + " SELECT parent.pid, event.mtime, parent.isCP" | |
| 201 | + " FROM ancestor, parent, event" | |
| 202 | + " WHERE parent.cid=ancestor.rid" | |
| 203 | + " AND event.objid=parent.pid" | |
| 204 | + " AND NOT ancestor.isCP" | |
| 205 | + " ORDER BY mtime DESC LIMIT %d" | |
| 206 | + " )" | |
| 207 | + "INSERT INTO ok" | |
| 208 | + " SELECT rid FROM ancestor;", | |
| 209 | + rid, rid, N | |
| 210 | + ); | |
| 211 | + } | |
| 187 | 212 | } |
| 188 | 213 | |
| 189 | 214 | /* |
| 190 | 215 | ** Compute the youngest ancestor of record ID rid that is a member of |
| 191 | 216 | ** branch zBranch. |
| 192 | 217 |
| --- src/descendants.c | |
| +++ src/descendants.c | |
| @@ -167,25 +167,50 @@ | |
| 167 | if( !N ){ |
| 168 | N = -1; |
| 169 | }else if( N<0 ){ |
| 170 | N = -N; |
| 171 | } |
| 172 | db_multi_exec( |
| 173 | "WITH RECURSIVE " |
| 174 | " ancestor(rid, mtime) AS (" |
| 175 | " SELECT %d, mtime FROM event WHERE objid=%d " |
| 176 | " UNION " |
| 177 | " SELECT plink.pid, event.mtime" |
| 178 | " FROM ancestor, plink, event" |
| 179 | " WHERE plink.cid=ancestor.rid" |
| 180 | " AND event.objid=plink.pid %s" |
| 181 | " ORDER BY mtime DESC LIMIT %d" |
| 182 | " )" |
| 183 | "INSERT INTO ok" |
| 184 | " SELECT rid FROM ancestor;", |
| 185 | rid, rid, directOnly ? "AND plink.isPrim" : "", N |
| 186 | ); |
| 187 | } |
| 188 | |
| 189 | /* |
| 190 | ** Compute the youngest ancestor of record ID rid that is a member of |
| 191 | ** branch zBranch. |
| 192 |
| --- src/descendants.c | |
| +++ src/descendants.c | |
| @@ -167,25 +167,50 @@ | |
| 167 | if( !N ){ |
| 168 | N = -1; |
| 169 | }else if( N<0 ){ |
| 170 | N = -N; |
| 171 | } |
| 172 | if( directOnly ){ |
| 173 | db_multi_exec( |
| 174 | "WITH RECURSIVE " |
| 175 | " ancestor(rid, mtime) AS (" |
| 176 | " SELECT %d, mtime FROM event WHERE objid=%d " |
| 177 | " UNION " |
| 178 | " SELECT plink.pid, event.mtime" |
| 179 | " FROM ancestor, plink, event" |
| 180 | " WHERE plink.cid=ancestor.rid" |
| 181 | " AND event.objid=plink.pid" |
| 182 | " AND plink.isPrim" |
| 183 | " ORDER BY mtime DESC LIMIT %d" |
| 184 | " )" |
| 185 | "INSERT INTO ok" |
| 186 | " SELECT rid FROM ancestor;", |
| 187 | rid, rid, N |
| 188 | ); |
| 189 | }else{ |
| 190 | db_multi_exec( |
| 191 | "WITH RECURSIVE " |
| 192 | " parent(pid,cid,isCP) AS (" |
| 193 | " SELECT plink.pid, plink.cid, 0 AS xisCP FROM plink" |
| 194 | " UNION ALL" |
| 195 | " SELECT parentid, childid, 1 FROM cherrypick WHERE NOT isExclude" |
| 196 | " )," |
| 197 | " ancestor(rid, mtime, isCP) AS (" |
| 198 | " SELECT %d, mtime, 0 FROM event WHERE objid=%d " |
| 199 | " UNION " |
| 200 | " SELECT parent.pid, event.mtime, parent.isCP" |
| 201 | " FROM ancestor, parent, event" |
| 202 | " WHERE parent.cid=ancestor.rid" |
| 203 | " AND event.objid=parent.pid" |
| 204 | " AND NOT ancestor.isCP" |
| 205 | " ORDER BY mtime DESC LIMIT %d" |
| 206 | " )" |
| 207 | "INSERT INTO ok" |
| 208 | " SELECT rid FROM ancestor;", |
| 209 | rid, rid, N |
| 210 | ); |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | /* |
| 215 | ** Compute the youngest ancestor of record ID rid that is a member of |
| 216 | ** branch zBranch. |
| 217 |