Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch min-from-to Excluding Merge-Ins
This is equivalent to a diff from af57f63dee to 3c03634ee9
|
2025-03-09
| ||
| 19:28 | Add the "min" query parameter to /timeline. Other minor bug fixes found while working on the new feature. The priority queue implementation was rewritten. Minimum SQLite increased to 3.49.0. check-in: 4e23c2a91a user: drh tags: trunk | |
| 18:03 | Increase the minimum SQLite version to 3.49.0. Really we only need to go to 3.47.0 (due to the previous check-in on this branch) but 3.49.0 is a better choice so let's just require it. Closed-Leaf check-in: 3c03634ee9 user: drh tags: min-from-to | |
| 17:55 | Fix a bug in recursive CTE used to help implement from=,bt= which which might result in an incorrect answer. The original query was put in place prior to the "subquery-order-by-optimization" patch to SQLite ([src:/info/20240816185146|2024-08-16]) version 3.47.0. Without that optimization, the query runs slowly. Also: a comment typo fix. check-in: 29f946923e user: drh tags: min-from-to | |
|
2025-03-08
| ||
| 11:17 | In /setup_uedit, rename the locally-shadowed zCap to aCap to avoid confusion in a pending change. No functional changes. check-in: 74b149f2e2 user: stephan tags: trunk | |
|
2025-03-07
| ||
| 23:19 | Merge the latest trunk enhancements into the comment-markdown-links branch. check-in: 459499b0ea user: drh tags: comment-markdown-links | |
| 21:09 | Merge the latest trunk enhancements into the min-from-to branch. check-in: 990e287a94 user: drh tags: min-from-to | |
| 20:26 | Add the /test-title webpage. Accessible to administrators only. check-in: af57f63dee user: drh tags: trunk | |
| 20:14 | Correctly render the title of embedded Markdown documents that contain characters that are special to HTML: > " ' & < check-in: 0b24a45f49 user: drh tags: trunk | |
Changes to auto.def.
| ︙ | ︙ | |||
34 35 36 37 38 39 40 |
compile-commands=0 =>
"Check for compile_commands.json support."
}
# Update the minimum required SQLite version number here, and also
# in src/main.c near the sqlite3_libversion_number() call. Take care
# that both places agree!
| | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
compile-commands=0 =>
"Check for compile_commands.json support."
}
# Update the minimum required SQLite version number here, and also
# in src/main.c near the sqlite3_libversion_number() call. Take care
# that both places agree!
define MINIMUM_SQLITE_VERSION "3.49.0"
# This is useful for people wanting Fossil to use an external SQLite library
# to compare the one they have against the minimum required
if {[opt-bool print-minimum-sqlite-version]} {
puts [get-define MINIMUM_SQLITE_VERSION]
exit 0
}
|
| ︙ | ︙ |
Changes to src/bisect.c.
| ︙ | ︙ | |||
35 36 37 38 39 40 41 |
** Find the shortest path between bad and good.
*/
void bisect_path(void){
PathNode *p;
bisect.bad = db_lget_int("bisect-bad", 0);
bisect.good = db_lget_int("bisect-good", 0);
if( bisect.good>0 && bisect.bad==0 ){
| | | | | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
** Find the shortest path between bad and good.
*/
void bisect_path(void){
PathNode *p;
bisect.bad = db_lget_int("bisect-bad", 0);
bisect.good = db_lget_int("bisect-good", 0);
if( bisect.good>0 && bisect.bad==0 ){
path_shortest(bisect.good, bisect.good, 0, 0, 0, 0);
}else if( bisect.bad>0 && bisect.good==0 ){
path_shortest(bisect.bad, bisect.bad, 0, 0, 0, 0);
}else if( bisect.bad==0 && bisect.good==0 ){
fossil_fatal("neither \"good\" nor \"bad\" versions have been identified");
}else{
Bag skip;
int bDirect = bisect_option("direct-only");
char *zLog = db_lget("bisect-log","");
Blob log, id;
bag_init(&skip);
blob_init(&log, zLog, -1);
while( blob_token(&log, &id) ){
if( blob_str(&id)[0]=='s' ){
bag_insert(&skip, atoi(blob_str(&id)+1));
}
}
blob_reset(&log);
p = path_shortest(bisect.good, bisect.bad, bDirect, 0, &skip, 0);
bag_clear(&skip);
if( p==0 ){
char *zBad = db_text(0,"SELECT uuid FROM blob WHERE rid=%d",bisect.bad);
char *zGood = db_text(0,"SELECT uuid FROM blob WHERE rid=%d",bisect.good);
fossil_fatal("no path from good ([%S]) to bad ([%S]) or back",
zGood, zBad);
}
|
| ︙ | ︙ | |||
290 291 292 293 294 295 296 |
}
}
if( iCurrent>0 ){
bisect_log_append(&ins, ++cnt, "CURRENT", iCurrent);
}
if( bDetail && lastGood>0 && lastBad>0 ){
PathNode *p;
| | | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
}
}
if( iCurrent>0 ){
bisect_log_append(&ins, ++cnt, "CURRENT", iCurrent);
}
if( bDetail && lastGood>0 && lastBad>0 ){
PathNode *p;
p = path_shortest(lastGood, lastBad, bisect_option("direct-only"),0, 0, 0);
while( p ){
bisect_log_append(&ins, ++cnt, 0, p->rid);
p = p->u.pTo;
}
path_reset();
}
db_exec_sql(blob_sql_text(&ins));
|
| ︙ | ︙ |
Changes to src/descendants.c.
| ︙ | ︙ | |||
154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
" WHERE tagxref.rid=leaves.rid "
" AND tagxref.tagid=%d"
" AND tagxref.tagtype>0)",
TAG_CLOSED
);
}
}
/*
** Load the record ID rid and up to |N|-1 closest ancestors into
** the "ok" table. If N is zero, no limit. If ridBackTo is not zero
** then stop the search upon reaching the ancestor with rid==ridBackTo.
*/
void compute_ancestors(int rid, int N, int directOnly, int ridBackTo){
| > > > > > > > > > > > > > > > > > | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
" WHERE tagxref.rid=leaves.rid "
" AND tagxref.tagid=%d"
" AND tagxref.tagtype>0)",
TAG_CLOSED
);
}
}
/*
** If RID refers to a check-in, return the mtime of that check-in - the
** julian day number of when the check-in occurred.
*/
double mtime_of_rid(int rid, double mtime){
static Stmt q;
db_static_prepare(&q,"SELECT mtime FROM event WHERE objid=:rid");
db_bind_int(&q, ":rid", rid);
if( db_step(&q)==SQLITE_ROW ){
mtime = db_column_double(&q,0);
}
db_reset(&q);
return mtime;
}
/*
** Load the record ID rid and up to |N|-1 closest ancestors into
** the "ok" table. If N is zero, no limit. If ridBackTo is not zero
** then stop the search upon reaching the ancestor with rid==ridBackTo.
*/
void compute_ancestors(int rid, int N, int directOnly, int ridBackTo){
|
| ︙ | ︙ | |||
195 196 197 198 199 200 201 |
** (1) Primary parents
** (2) Merge parents
** (3) Cherrypick merge parents.
** (4) All ancestores of 1 and 2 but not of 3.
*/
double rLimitMtime = 0.0;
if( ridBackTo ){
| | < < | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
** (1) Primary parents
** (2) Merge parents
** (3) Cherrypick merge parents.
** (4) All ancestores of 1 and 2 but not of 3.
*/
double rLimitMtime = 0.0;
if( ridBackTo ){
rLimitMtime = mtime_of_rid(ridBackTo, 0.0);
}
db_multi_exec(
"WITH RECURSIVE\n"
" parent(pid,cid,isCP) AS (\n"
" SELECT plink.pid, plink.cid, 0 AS xisCP FROM plink\n"
" UNION ALL\n"
" SELECT parentid, childid, 1 FROM cherrypick WHERE NOT isExclude\n"
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
724 725 726 727 728 729 730 | fossil_printf_selfcheck(); fossil_limit_memory(1); /* When updating the minimum SQLite version, change the number here, ** and also MINIMUM_SQLITE_VERSION value set in ../auto.def. Take ** care that both places agree! */ | | | | | 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 |
fossil_printf_selfcheck();
fossil_limit_memory(1);
/* When updating the minimum SQLite version, change the number here,
** and also MINIMUM_SQLITE_VERSION value set in ../auto.def. Take
** care that both places agree! */
if( sqlite3_libversion_number()<3049000
|| strncmp(sqlite3_sourceid(),"2025-02-06",10)<0
){
fossil_panic("Unsuitable SQLite version %s, must be at least 3.49.0",
sqlite3_libversion());
}
sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
memset(&g, 0, sizeof(g));
g.now = time(0);
|
| ︙ | ︙ |
Changes to src/name.c.
| ︙ | ︙ | |||
229 230 231 232 233 234 235 | ** Return 0 if there are no matches. ** ** This is a tricky query to do efficiently. ** If the tag is very common (ex: "trunk") then ** we want to use the query identified below as Q1 - which searches ** the most recent EVENT table entries for the most recent with the tag. ** But if the tag is relatively scarce (anything other than "trunk", basically) | | | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
** Return 0 if there are no matches.
**
** This is a tricky query to do efficiently.
** If the tag is very common (ex: "trunk") then
** we want to use the query identified below as Q1 - which searches
** the most recent EVENT table entries for the most recent with the tag.
** But if the tag is relatively scarce (anything other than "trunk", basically)
** then we want to do the indexed search shown below as Q2.
*/
static int most_recent_event_with_tag(const char *zTag, const char *zType){
return db_int(0,
"SELECT objid FROM ("
/* Q1: Begin by looking for the tag in the 30 most recent events */
"SELECT objid"
" FROM (SELECT * FROM event ORDER BY mtime DESC LIMIT 30) AS ex"
|
| ︙ | ︙ |
Changes to src/path.c.
| ︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
**
** This file contains code used to trace paths of through the
** directed acyclic graph (DAG) of check-ins.
*/
#include "config.h"
#include "path.h"
#include <assert.h>
#if INTERFACE
/* Nodes for the paths through the DAG.
*/
struct PathNode {
int rid; /* ID for this node */
u8 fromIsParent; /* True if pFrom is the parent of rid */
u8 isPrim; /* True if primary side of common ancestor */
u8 isHidden; /* Abbreviate output in "fossil bisect ls" */
PathNode *pFrom; /* Node we came from */
union {
| > > > | | | < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > | | > > > > > | > > > > > > > > > | > > | > | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
**
** This file contains code used to trace paths of through the
** directed acyclic graph (DAG) of check-ins.
*/
#include "config.h"
#include "path.h"
#include <assert.h>
#include <math.h>
#if INTERFACE
/* Nodes for the paths through the DAG.
*/
struct PathNode {
int rid; /* ID for this node */
u8 fromIsParent; /* True if pFrom is the parent of rid */
u8 isPrim; /* True if primary side of common ancestor */
u8 isHidden; /* Abbreviate output in "fossil bisect ls" */
char *zBranch; /* Branch name for this node. Might be NULL */
double mtime; /* Date/time of this check-in */
PathNode *pFrom; /* Node we came from */
union {
double rCost; /* Cost of getting to this node from pStart */
PathNode *pTo; /* Next on path from beginning to end */
} u;
PathNode *pAll; /* List of all nodes */
};
#endif
/*
** Local variables for this module
*/
static struct {
PQueue pending; /* Nodes pending review for inclusion in the graph */
PathNode *pAll; /* All nodes */
int nStep; /* Number of steps from first to last */
int nNotHidden; /* Number of steps not counting hidden nodes */
int brCost; /* Extra cost for moving to a different branch */
int revCost; /* Extra cost for changing directions */
PathNode *pStart; /* Earliest node */
PathNode *pEnd; /* Most recent */
} path;
static int path_debug = 0; /* Flag to enable debugging */
/*
** Return the first (last) element of the computed path.
*/
PathNode *path_first(void){ return path.pStart; }
PathNode *path_last(void){ return path.pEnd; }
/*
** Return the number of steps in the computed path.
*/
int path_length(void){ return path.nStep; }
/*
** Return the number of non-hidden steps in the computed path.
*/
int path_length_not_hidden(void){ return path.nNotHidden; }
/*
** Used for debugging only.
**
** Given a RID, return the ISO date/time string and branch for the
** corresponding check-in. Memory is held locally and is overwritten
** with each call.
*/
char *path_rid_desc(int rid){
static Stmt q;
static char *zDesc = 0;
db_static_prepare(&q,
"SELECT concat(strftime('%%Y%%m%%d%%H%%M',event.mtime),'/',value)"
" FROM event, tagxref"
" WHERE event.objid=:rid"
" AND tagxref.rid=:rid"
" AND tagxref.tagid=%d"
" AND tagxref.tagtype>0",
TAG_BRANCH
);
fossil_free(zDesc);
db_bind_int(&q, ":rid", rid);
if( db_step(&q)==SQLITE_ROW ){
zDesc = fossil_strdup(db_column_text(&q,0));
}
db_reset(&q);
return zDesc ? zDesc : "???";
}
/*
** Create a new node and insert it into the path.pending queue.
*/
static PathNode *path_new_node(int rid, PathNode *pFrom, int isParent){
PathNode *p;
p = fossil_malloc( sizeof(*p) );
memset(p, 0, sizeof(*p));
p->pAll = path.pAll;
path.pAll = p;
p->rid = rid;
p->fromIsParent = isParent;
p->pFrom = pFrom;
p->u.rCost = pFrom ? pFrom->u.rCost : 0.0;
if( path.brCost ){
p->zBranch = branch_of_rid(rid);
p->mtime = mtime_of_rid(rid, 0.0);
if( pFrom ){
p->u.rCost += fabs(pFrom->mtime - p->mtime);
if( fossil_strcmp(p->zBranch, pFrom->zBranch)!=0 ){
p->u.rCost += path.brCost;
}
}
}else{
/* When brCost==0, we try to minimize the number of nodes
** along the path. The cost is just the number of nodes back
** to the start. We do not need to know the branch name nor
** the mtime */
p->u.rCost += 1.0;
}
if( path_debug ){
fossil_print("PUSH %-50s cost = %g\n", path_rid_desc(p->rid), p->u.rCost);
}
pqueuex_insert_ptr(&path.pending, (void*)p, p->u.rCost);
return p;
}
/*
** Reset memory used by the shortest path algorithm.
*/
void path_reset(void){
PathNode *p;
while( path.pAll ){
p = path.pAll;
path.pAll = p->pAll;
fossil_free(p->zBranch);
fossil_free(p);
}
pqueuex_clear(&path.pending);
memset(&path, 0, sizeof(path));
}
/*
** Construct the path from path.pStart to path.pEnd in the u.pTo fields.
*/
static void path_reverse_path(void){
|
| ︙ | ︙ | |||
126 127 128 129 130 131 132 | ** Return NULL if no path is found. */ PathNode *path_shortest( int iFrom, /* Path starts here */ int iTo, /* Path ends here */ int directOnly, /* No merge links if true */ int oneWayOnly, /* Parent->child only if true */ | | > < > > | | | | | < < | < < < < < < > | | | | | | | | | > > > > > > > > > > > | | < < | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
** Return NULL if no path is found.
*/
PathNode *path_shortest(
int iFrom, /* Path starts here */
int iTo, /* Path ends here */
int directOnly, /* No merge links if true */
int oneWayOnly, /* Parent->child only if true */
Bag *pHidden, /* Hidden nodes */
int branchCost /* Add extra cost to changing branches */
){
Stmt s;
Bag seen;
PathNode *p;
path_reset();
path.brCost = branchCost;
path.pStart = path_new_node(iFrom, 0, 0);
if( iTo==iFrom ){
path.pEnd = path.pStart;
return path.pStart;
}
if( oneWayOnly && directOnly ){
db_prepare(&s,
"SELECT cid, 1 FROM plink WHERE pid=:pid AND isprim"
);
}else if( oneWayOnly ){
db_prepare(&s,
"SELECT cid, 1 FROM plink WHERE pid=:pid "
);
}else if( directOnly ){
db_prepare(&s,
"SELECT cid, 1 FROM plink WHERE pid=:pid AND isprim "
"UNION ALL "
"SELECT pid, 0 FROM plink WHERE :back AND cid=:pid AND isprim"
);
}else{
db_prepare(&s,
"SELECT cid, 1 FROM plink WHERE pid=:pid "
"UNION ALL "
"SELECT pid, 0 FROM plink WHERE :back AND cid=:pid"
);
}
bag_init(&seen);
while( (p = pqueuex_extract_ptr(&path.pending))!=0 ){
if( path_debug ){
printf("PULL %s %g\n", path_rid_desc(p->rid), p->u.rCost);
}
if( p->rid==iTo ){
db_finalize(&s);
path.pEnd = p;
path_reverse_path();
for(p=path.pStart->u.pTo; p; p=p->u.pTo ){
if( !p->isHidden ) path.nNotHidden++;
}
return path.pStart;
}
if( bag_find(&seen, p->rid) ) continue;
bag_insert(&seen, p->rid);
db_bind_int(&s, ":pid", p->rid);
if( !oneWayOnly ) db_bind_int(&s, ":back", !p->fromIsParent);
while( db_step(&s)==SQLITE_ROW ){
int cid = db_column_int(&s, 0);
int isParent = db_column_int(&s, 1);
PathNode *pNew;
if( bag_find(&seen, cid) ) continue;
pNew = path_new_node(cid, p, isParent);
if( pHidden && bag_find(pHidden,cid) ) pNew->isHidden = 1;
}
db_reset(&s);
}
db_finalize(&s);
path_reset();
return 0;
}
/*
|
| ︙ | ︙ | |||
213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
*/
PathNode *path_next(void){
PathNode *p;
p = path.pStart;
if( p ) p = p->u.pTo;
return p;
}
/*
** Return an estimate of the number of comparisons remaining in order
** to bisect path. This is based on the log2() of path.nStep.
*/
int path_search_depth(void){
int i, j;
| > > > > > > > > > > > > | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
*/
PathNode *path_next(void){
PathNode *p;
p = path.pStart;
if( p ) p = p->u.pTo;
return p;
}
/*
** Return the branch for a path node.
**
** Storage space is managed by the path subsystem. The returned value
** is valid until the path is reset.
*/
const char *path_branch(PathNode *p){
if( p==0 ) return 0;
if( p->zBranch==0 ) p->zBranch = branch_of_rid(p->rid);
return p->zBranch;
}
/*
** Return an estimate of the number of comparisons remaining in order
** to bisect path. This is based on the log2() of path.nStep.
*/
int path_search_depth(void){
int i, j;
|
| ︙ | ︙ | |||
236 237 238 239 240 241 242 |
void path_shortest_stored_in_ancestor_table(
int origid, /* RID for check-in at start of the path */
int cid /* RID for check-in at the end of the path */
){
PathNode *pPath;
int gen = 0;
Stmt ins;
| | | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
void path_shortest_stored_in_ancestor_table(
int origid, /* RID for check-in at start of the path */
int cid /* RID for check-in at the end of the path */
){
PathNode *pPath;
int gen = 0;
Stmt ins;
pPath = path_shortest(cid, origid, 1, 0, 0, 0);
db_multi_exec(
"CREATE TEMP TABLE IF NOT EXISTS ancestor("
" rid INT UNIQUE,"
" generation INTEGER PRIMARY KEY"
");"
"DELETE FROM ancestor;"
);
|
| ︙ | ︙ | |||
259 260 261 262 263 264 265 | db_finalize(&ins); path_reset(); } /* ** COMMAND: test-shortest-path ** | | | > > > > | > > > > | > < < < < < < < < < < < < | | < > | < < < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < | 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
db_finalize(&ins);
path_reset();
}
/*
** COMMAND: test-shortest-path
**
** Usage: %fossil test-shortest-path [OPTIONS] VERSION1 VERSION2
**
** Report the shortest path between two check-ins. Options:
**
** --branch-cost N Additional cost N for changing branches
** --debug Show debugging output
** --one-way One-way forwards in time, parent->child only
** --no-merge Follow only direct parent-child paths and omit
** merge links.
*/
void shortest_path_test_cmd(void){
int iFrom;
int iTo;
PathNode *p;
int n;
int directOnly;
int oneWay;
const char *zBrCost;
db_find_and_open_repository(0,0);
directOnly = find_option("no-merge",0,0)!=0;
oneWay = find_option("one-way",0,0)!=0;
zBrCost = find_option("branch-cost",0,1);
if( find_option("debug",0,0)!=0 ) path_debug = 1;
if( g.argc!=4 ) usage("VERSION1 VERSION2");
iFrom = name_to_rid(g.argv[2]);
iTo = name_to_rid(g.argv[3]);
p = path_shortest(iFrom, iTo, directOnly, oneWay, 0,
zBrCost ? atoi(zBrCost) : 0);
if( p==0 ){
fossil_fatal("no path from %s to %s", g.argv[1], g.argv[2]);
}
for(n=1, p=path.pStart; p; p=p->u.pTo, n++){
fossil_print("%4d: %s\n", n, path_rid_desc(p->rid));
}
path_debug = 0;
}
/*
** Find the closest common ancestor of two nodes. "Closest" means the
** fewest number of arcs.
*/
int path_common_ancestor(int iMe, int iYou){
Stmt s;
PathNode *pThis;
PathNode *p;
Bag me, you;
if( iMe==iYou ) return iMe;
if( iMe==0 || iYou==0 ) return 0;
path_reset();
path.pStart = path_new_node(iMe, 0, 0);
path.pStart->isPrim = 1;
path.pEnd = path_new_node(iYou, 0, 0);
db_prepare(&s, "SELECT pid FROM plink WHERE cid=:cid");
bag_init(&me);
bag_insert(&me, iMe);
bag_init(&you);
bag_insert(&you, iYou);
while( (pThis = pqueuex_extract_ptr(&path.pending))!=0 ){
db_bind_int(&s, ":cid", pThis->rid);
while( db_step(&s)==SQLITE_ROW ){
int pid = db_column_int(&s, 0);
if( bag_find(pThis->isPrim ? &you : &me, pid) ){
/* pid is the common ancestor */
PathNode *pNext;
for(p=path.pAll; p && p->rid!=pid; p=p->pAll){}
assert( p!=0 );
pNext = p;
while( pNext ){
pNext = p->pFrom;
p->pFrom = pThis;
pThis = p;
p = pNext;
}
if( pThis==path.pStart ) path.pStart = path.pEnd;
path.pEnd = pThis;
path_reverse_path();
db_finalize(&s);
return pid;
}else if( bag_find(pThis->isPrim ? &me : &you, pid) ){
/* pid is just an alternative path to a node we've already visited */
continue;
}
p = path_new_node(pid, pThis, 0);
p->isPrim = pThis->isPrim;
bag_insert(pThis->isPrim ? &me : &you, pid);
}
db_reset(&s);
}
db_finalize(&s);
path_reset();
return 0;
}
/*
|
| ︙ | ︙ | |||
451 452 453 454 455 456 457 |
if(0==iFrom){
fossil_fatal("Invalid 'from' RID: 0");
}else if(0==iTo){
fossil_fatal("Invalid 'to' RID: 0");
}
if( iFrom==iTo ) return;
path_reset();
| | | 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
if(0==iFrom){
fossil_fatal("Invalid 'from' RID: 0");
}else if(0==iTo){
fossil_fatal("Invalid 'to' RID: 0");
}
if( iFrom==iTo ) return;
path_reset();
p = path_shortest(iFrom, iTo, 1, revOK==0, 0, 0);
if( p==0 ) return;
path_reverse_path();
db_prepare(&q1,
"SELECT pfnid, fnid FROM mlink"
" WHERE mid=:mid AND (pfnid>0 OR fid==0)"
" ORDER BY pfnid"
);
|
| ︙ | ︙ |
Changes to src/pqueue.c.
| ︙ | ︙ | |||
13 14 15 16 17 18 19 | ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This file contains code used to implement a priority queue. ** A priority queue is a list of items order by a floating point | | | > < < | > > > > > > > > | > | > > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
** drh@hwaci.com
** http://www.hwaci.com/drh/
**
*******************************************************************************
**
** This file contains code used to implement a priority queue.
** A priority queue is a list of items order by a floating point
** value. Each value can be associated with either a pointer or
** an integer. Items are inserted into the queue in an arbitrary
** order, but are returned in order of the floating point value.
**
** This implementation uses a heap of QueueElement objects. The
** root of the heap is PQueue.a[0]. Each node a[x] has two daughter
** nodes a[x*2+1] and a[x*2+2]. The mother node of a[y] is a[(y-1)/2]
** (assuming integer division rounded down). The following is always true:
**
** The value of any node is less than or equal two the values
** of both daughter nodes. (The Heap Property).
**
** A consequence of the heap property is that a[0] always contains
** the node with the smallest value.
**
** Compatibility note: Some versions of OpenSSL export a symbols
** like "pqueue_insert". This is, technically, a bug in OpenSSL.
** We work around it here by using "pqueuex_" instead of "pqueue_".
*/
#include "config.h"
#include "pqueue.h"
#include <assert.h>
#if INTERFACE
/*
** An integer can appear in the bag at most once.
** Integers must be positive.
*/
struct PQueue {
int cnt; /* Number of entries in the queue */
int sz; /* Number of slots in a[] */
struct QueueElement {
union {
int id; /* ID of the element */
void *p; /* Pointer to an object */
} u;
double value; /* Value of element. Kept in ascending order */
} *a;
};
#endif
/*
** Initialize a PQueue structure
|
| ︙ | ︙ | |||
67 68 69 70 71 72 73 74 75 76 77 78 79 |
/*
** Change the size of the queue so that it contains N slots
*/
static void pqueuex_resize(PQueue *p, int N){
p->a = fossil_realloc(p->a, sizeof(p->a[0])*N);
p->sz = N;
}
/*
** Insert element e into the queue.
*/
void pqueuex_insert(PQueue *p, int e, double v){
int i, j;
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | < | > | < > > | > | < < < < < < | | | | | > > | > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
/*
** Change the size of the queue so that it contains N slots
*/
static void pqueuex_resize(PQueue *p, int N){
p->a = fossil_realloc(p->a, sizeof(p->a[0])*N);
p->sz = N;
}
/*
** Allocate a new queue entry and return a pointer to it.
*/
static struct QueueElement *pqueuex_new_entry(PQueue *p){
if( p->cnt+1>p->sz ){
pqueuex_resize(p, p->cnt+7);
}
return &p->a[p->cnt++];
}
/*
** Element p->a[p->cnt-1] has just been inserted. Shift entries
** around so as to preserve the heap property.
*/
static void pqueuex_rebalance(PQueue *p){
int i, j;
struct QueueElement *a = p->a;
i = p->cnt-1;
while( (j = (i-1)/2)>=0 && a[j].value>a[i].value ){
struct QueueElement t = a[j];
a[j] = a[i];
a[i] = t;
i = j;
}
}
/*
** Insert element e into the queue.
*/
void pqueuex_insert(PQueue *p, int e, double v){
struct QueueElement *pE = pqueuex_new_entry(p);
pE->value = v;
pE->u.id = e;
pqueuex_rebalance(p);
}
void pqueuex_insert_ptr(PQueue *p, void *pPtr, double v){
struct QueueElement *pE = pqueuex_new_entry(p);
pE->value = v;
pE->u.p = pPtr;
pqueuex_rebalance(p);
}
/*
** Remove and discard p->a[0] element from the queue. Rearrange
** nodes to preserve the heap property.
*/
static void pqueuex_pop(PQueue *p){
int i, j;
struct QueueElement *a = p->a;
struct QueueElement tmp;
i = 0;
a[0] = a[p->cnt-1];
p->cnt--;
while( (j = i*2+1)<p->cnt ){
if( j+1<p->cnt && a[j].value > a[j+1].value ) j++;
if( a[i].value < a[j].value ) break;
tmp = a[i];
a[i] = a[j];
a[j] = tmp;
i = j;
}
}
/*
** Extract the first element from the queue (the element with
** the smallest value) and return its ID. Return 0 if the queue
** is empty.
*/
int pqueuex_extract(PQueue *p){
int e;
if( p->cnt==0 ){
return 0;
}
e = p->a[0].u.id;
pqueuex_pop(p);
return e;
}
void *pqueuex_extract_ptr(PQueue *p){
void *pPtr;
if( p->cnt==0 ){
return 0;
}
pPtr = p->a[0].u.p;
pqueuex_pop(p);
return pPtr;
}
/*
** Print the entire heap associated with the test-pqueue command.
*/
static void pqueuex_test_print(PQueue *p){
int j;
for(j=0; j<p->cnt; j++){
fossil_print("(%d) %g/%s ",j,p->a[j].value,p->a[j].u.p);
}
fossil_print("\n");
}
/*
** COMMAND: test-pqueue
**
** This command is used for testing the PQueue object. There are one
** or more arguments, each of the form:
**
** (1) NUMBER/TEXT
** (2) ^
** (3) -v
**
** Form (1) arguments add an entry to the queue with value NUMBER and
** content TEXT. Form (2) pops off the queue entry with the smallest
** value. Form (3) (the -v option) causes the heap to be displayed after
** each subsequent operation.
*/
void pqueuex_test_cmd(void){
int i;
PQueue x;
const char *zId;
int bDebug = 0;
pqueuex_init(&x);
for(i=2; i<g.argc; i++){
const char *zArg = g.argv[i];
if( strcmp(zArg,"-v")==0 ){
bDebug = 1;
}else if( strcmp(zArg, "^")==0 ){
zId = pqueuex_extract_ptr(&x);
if( zId==0 ){
fossil_print("%2d: POP NULL\n", i);
}else{
fossil_print("%2d: POP \"%s\"\n", i, zId);
}
if( bDebug) pqueuex_test_print(&x);
}else{
double r = atof(zArg);
zId = strchr(zArg,'/');
if( zId==0 ) zId = zArg;
if( zId[0]=='/' ) zId++;
pqueuex_insert_ptr(&x, (void*)zId, r);
fossil_print("%2d: INSERT \"%s\"\n", i, zId);
if( bDebug) pqueuex_test_print(&x);
}
}
while( (zId = pqueuex_extract_ptr(&x))!=0 ){
fossil_print("... POP \"%s\"\n", zId);
if( bDebug) pqueuex_test_print(&x);
}
pqueuex_clear(&x);
}
|
Changes to src/timeline.c.
| ︙ | ︙ | |||
1111 1112 1113 1114 1115 1116 1117 |
if( mtime>0.0 ){
if( pzDisplay ) *pzDisplay = fossil_strdup(zDate);
return mtime;
}
}
rid = symbolic_name_to_rid(z, "*");
if( rid ){
| | | 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 |
if( mtime>0.0 ){
if( pzDisplay ) *pzDisplay = fossil_strdup(zDate);
return mtime;
}
}
rid = symbolic_name_to_rid(z, "*");
if( rid ){
mtime = mtime_of_rid(rid, 0.0);
}else{
mtime = db_double(-1.0,
"SELECT max(event.mtime) FROM event, tag, tagxref"
" WHERE tag.tagname GLOB 'event-%q*'"
" AND tagxref.tagid=tag.tagid AND tagxref.tagtype"
" AND event.objid=tagxref.rid",
z
|
| ︙ | ︙ | |||
1406 1407 1408 1409 1410 1411 1412 |
" FROM dx, plink"
" WHERE plink.pid=dx.id"
" AND plink.mtime<=(SELECT max(event.mtime) FROM tagxref, event"
" WHERE tagxref.tagid=%d AND tagxref.tagtype>0"
" AND event.objid=tagxref.rid)"
" ORDER BY plink.mtime)"
"SELECT id FROM dx, tagxref"
| | > | 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 |
" FROM dx, plink"
" WHERE plink.pid=dx.id"
" AND plink.mtime<=(SELECT max(event.mtime) FROM tagxref, event"
" WHERE tagxref.tagid=%d AND tagxref.tagtype>0"
" AND event.objid=tagxref.rid)"
" ORDER BY plink.mtime)"
"SELECT id FROM dx, tagxref"
" WHERE tagid=%d AND tagtype>0 AND rid=id"
" ORDER BY dx.mtime LIMIT 1",
iFrom, iFrom, tagId, tagId
);
}else{
db_prepare(&q,
"WITH RECURSIVE dx(id,mtime) AS ("
" SELECT %d, event.mtime FROM event WHERE objid=%d"
" UNION"
|
| ︙ | ︙ | |||
1437 1438 1439 1440 1441 1442 1443 |
" FROM dx, plink, event"
" WHERE plink.cid=dx.id AND event.objid=plink.pid"
" AND event.mtime>=(SELECT min(event.mtime) FROM tagxref, event"
" WHERE tagxref.tagid=%d AND tagxref.tagtype>0"
" AND event.objid=tagxref.rid)"
" ORDER BY event.mtime DESC)"
"SELECT id FROM dx, tagxref"
| | > | 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 |
" FROM dx, plink, event"
" WHERE plink.cid=dx.id AND event.objid=plink.pid"
" AND event.mtime>=(SELECT min(event.mtime) FROM tagxref, event"
" WHERE tagxref.tagid=%d AND tagxref.tagtype>0"
" AND event.objid=tagxref.rid)"
" ORDER BY event.mtime DESC)"
"SELECT id FROM dx, tagxref"
" WHERE tagid=%d AND tagtype>0 AND rid=id"
" ORDER BY dx.mtime DESC LIMIT 1",
iFrom, iFrom, tagId, tagId
);
}else{
db_prepare(&q,
"WITH RECURSIVE dx(id,mtime) AS ("
" SELECT %d, event.mtime FROM event WHERE objid=%d"
" UNION"
|
| ︙ | ︙ | |||
1570 1571 1572 1573 1574 1575 1576 | ** d2=CKIN2 ... Use CKIN2 if CHECKIN is not found ** ft=DESCENDANT ... going forward to DESCENDANT ** dp=CHECKIN Same as 'd=CHECKIN&p=CHECKIN' ** dp2=CKIN2 Same as 'd2=CKIN2&p2=CKIN2' ** df=CHECKIN Same as 'd=CHECKIN&n1=all&nd'. Mnemonic: "Derived From" ** bt=CHECKIN "Back To". Show ancenstors going back to CHECKIN ** p=CX ... from CX back to time of CHECKIN | | | | 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 | ** d2=CKIN2 ... Use CKIN2 if CHECKIN is not found ** ft=DESCENDANT ... going forward to DESCENDANT ** dp=CHECKIN Same as 'd=CHECKIN&p=CHECKIN' ** dp2=CKIN2 Same as 'd2=CKIN2&p2=CKIN2' ** df=CHECKIN Same as 'd=CHECKIN&n1=all&nd'. Mnemonic: "Derived From" ** bt=CHECKIN "Back To". Show ancenstors going back to CHECKIN ** p=CX ... from CX back to time of CHECKIN ** from=CX ... path from CX back to CHECKIN ** ft=CHECKIN "Forward To": Show decendents forward to CHECKIN ** d=CX ... from CX up to the time of CHECKIN ** from=CX ... path from CX up to CHECKIN ** t=TAG Show only check-ins with the given TAG ** r=TAG Same as 't=TAG&rel'. Mnemonic: "Related" ** tl=TAGLIST Same as 't=TAGLIST&ms=brlist'. Mnemonic: "Tag List" ** rl=TAGLIST Same as 'r=TAGLIST&ms=brlist'. Mnemonic: "Related List" ** ml=TAGLIST Same as 'tl=TAGLIST&mionly'. Mnemonic: "Merge-in List" ** sl=TAGLIST "Sort List". Draw TAGLIST branches ordered left to right. ** rel Show related check-ins as well as those matching t=TAG |
| ︙ | ︙ | |||
1598 1599 1600 1601 1602 1603 1604 | ** ncp Omit cherrypick merges ** nd Do not highlight the focus check-in ** nsm Omit the submenu ** nc Omit all graph colors other than highlights ** v Show details of files changed ** vfx Show complete text of forum messages ** f=CHECKIN Family (immediate parents and children) of CHECKIN | | | | | | > | | | | | | 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 | ** ncp Omit cherrypick merges ** nd Do not highlight the focus check-in ** nsm Omit the submenu ** nc Omit all graph colors other than highlights ** v Show details of files changed ** vfx Show complete text of forum messages ** f=CHECKIN Family (immediate parents and children) of CHECKIN ** from=CHECKIN Path through common ancestor from CHECKIN... ** to=CHECKIN ... to this ** to2=CHECKIN ... backup name if to= doesn't resolve ** shortest ... pick path with least number of nodes ** rel ... also show related checkins ** min ... hide long sequences along same branch ** bt=PRIOR ... path from CHECKIN back to PRIOR ** ft=LATER ... path from CHECKIN forward to LATER ** me=CHECKIN Most direct path from CHECKIN... ** you=CHECKIN ... to this ** rel ... also show related checkins ** uf=FILE_HASH Show only check-ins that contain the given file version ** All qualifying check-ins are shown unless there is ** also an n= or n1= query parameter. ** chng=GLOBLIST Show only check-ins that involve changes to a file whose ** name matches one of the comma-separate GLOBLIST ** brbg Background color determined by branch name ** ubg Background color determined by user |
| ︙ | ︙ | |||
1694 1695 1696 1697 1698 1699 1700 |
int tmFlags = 0; /* Timeline flags */
const char *zThisTag = 0; /* Suppress links to this tag */
const char *zThisUser = 0; /* Suppress links to this user */
HQuery url; /* URL for various branch links */
int from_rid = name_to_typed_rid(P("from"),"ci"); /* from= for paths */
const char *zTo2 = 0;
int to_rid = name_choice("to","to2",&zTo2); /* to= for path timelines */
| | > | 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 |
int tmFlags = 0; /* Timeline flags */
const char *zThisTag = 0; /* Suppress links to this tag */
const char *zThisUser = 0; /* Suppress links to this user */
HQuery url; /* URL for various branch links */
int from_rid = name_to_typed_rid(P("from"),"ci"); /* from= for paths */
const char *zTo2 = 0;
int to_rid = name_choice("to","to2",&zTo2); /* to= for path timelines */
int bShort = P("shortest")!=0; /* shortest possible path */
int me_rid = name_to_typed_rid(P("me"),"ci"); /* me= for common ancestory */
int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */
int pd_rid;
const char *zDPName; /* Value of p=, d=, or dp= params */
double rBefore, rAfter, rCirca; /* Boundary times */
const char *z;
char *zOlderButton = 0; /* URL for Older button at the bottom */
char *zOlderButtonLabel = 0; /* Label for the Older Button */
char *zNewerButton = 0; /* URL for Newer button at the top */
char *zNewerButtonLabel = 0; /* Label for the Newer button */
int selectedRid = 0; /* Show a highlight on this RID */
int secondaryRid = 0; /* Show secondary highlight */
int disableY = 0; /* Disable type selector on submenu */
int advancedMenu = 0; /* Use the advanced menu design */
char *zPlural; /* Ending for plural forms */
int showCherrypicks = 1; /* True to show cherrypick merges */
int haveParameterN; /* True if n= query parameter present */
int from_to_mode = 0; /* 0: from,to. 1: from,ft 2: from,bt */
int showSql = PB("showsql"); /* True to show the SQL */
Blob allSql; /* Copy of all SQL text */
int bMin = P("min")!=0; /* True if "min" query parameter used */
login_check_credentials();
url_initialize(&url, "timeline");
cgi_query_parameters_to_url(&url);
blob_init(&allSql, 0, 0);
/* The "mionly" query parameter is like "rel", but shows merge-ins only */
|
| ︙ | ︙ | |||
2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 |
PathNode *p = 0;
const char *zFrom = 0;
const char *zTo = 0;
Blob ins;
int nNodeOnPath = 0;
int commonAncs = 0; /* Common ancestors of me_rid and you_rid. */
int earlierRid = 0, laterRid = 0;
if( from_rid && to_rid ){
if( from_to_mode==0 ){
| > > | | | | 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 |
PathNode *p = 0;
const char *zFrom = 0;
const char *zTo = 0;
Blob ins;
int nNodeOnPath = 0;
int commonAncs = 0; /* Common ancestors of me_rid and you_rid. */
int earlierRid = 0, laterRid = 0;
int cost = bShort ? 0 : 1;
int nSkip = 0;
if( from_rid && to_rid ){
if( from_to_mode==0 ){
p = path_shortest(from_rid, to_rid, 0, 0, 0, cost);
}else if( from_to_mode==1 ){
p = path_shortest(from_rid, to_rid, 0, 1, 0, cost);
earlierRid = commonAncs = from_rid;
laterRid = to_rid;
}else{
p = path_shortest(to_rid, from_rid, 0, 1, 0, cost);
earlierRid = commonAncs = to_rid;
laterRid = from_rid;
}
zFrom = P("from");
zTo = zTo2 ? zTo2 : P("to");
}else{
commonAncs = path_common_ancestor(me_rid, you_rid);
|
| ︙ | ︙ | |||
2110 2111 2112 2113 2114 2115 2116 |
db_multi_exec(
"CREATE TEMP TABLE IF NOT EXISTS pathnode(x INTEGER PRIMARY KEY);"
);
if( p ){
int cnt = 4;
blob_init(&ins, 0, 0);
blob_append_sql(&ins, "INSERT INTO pathnode(x) VALUES(%d)", p->rid);
| > > > | > > | > | < | 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 |
db_multi_exec(
"CREATE TEMP TABLE IF NOT EXISTS pathnode(x INTEGER PRIMARY KEY);"
);
if( p ){
int cnt = 4;
blob_init(&ins, 0, 0);
blob_append_sql(&ins, "INSERT INTO pathnode(x) VALUES(%d)", p->rid);
if( p->u.pTo==0 ) bMin = 0;
for(p=p->u.pTo; p; p=p->u.pTo){
if( bMin
&& p->u.pTo!=0
&& fossil_strcmp(path_branch(p->pFrom),path_branch(p))==0
&& fossil_strcmp(path_branch(p),path_branch(p->u.pTo))==0
){
nSkip++;
}else if( cnt==8 ){
blob_append_sql(&ins, ",\n (%d)", p->rid);
cnt = 0;
}else{
cnt++;
blob_append_sql(&ins, ",(%d)", p->rid);
}
}
}
path_reset();
db_multi_exec("%s", blob_str(&ins)/*safe-for-%s*/);
blob_reset(&ins);
if( related ){
db_multi_exec(
|
| ︙ | ︙ | |||
2183 2184 2185 2186 2187 2188 2189 |
db_multi_exec("%s", blob_sql_text(&sql));
if( advancedMenu ){
style_submenu_checkbox("v", "Files", (zType[0]!='a' && zType[0]!='c'),0);
}
nNodeOnPath = db_int(0, "SELECT count(*) FROM temp.pathnode");
if( nNodeOnPath==1 && from_to_mode>0 ){
blob_appendf(&desc,"Check-in ");
| | | > | 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 |
db_multi_exec("%s", blob_sql_text(&sql));
if( advancedMenu ){
style_submenu_checkbox("v", "Files", (zType[0]!='a' && zType[0]!='c'),0);
}
nNodeOnPath = db_int(0, "SELECT count(*) FROM temp.pathnode");
if( nNodeOnPath==1 && from_to_mode>0 ){
blob_appendf(&desc,"Check-in ");
}else if( bMin ){
blob_appendf(&desc, "%d of %d check-ins along the path from ",
nNodeOnPath, nNodeOnPath+nSkip);
}else{
blob_appendf(&desc, "%d check-ins going from ", nNodeOnPath);
}
if( from_rid==selectedRid ){
blob_appendf(&desc, "<span class='timelineSelected'>");
}
blob_appendf(&desc, "%z%h</a>", href("%R/info/%h", zFrom), zFrom);
|
| ︙ | ︙ | |||
2240 2241 2242 2243 2244 2245 2246 |
if( zCiName==0 ) zCiName = zUuid;
blob_append_sql(&sql, " AND event.objid IN ok");
nd = 0;
if( d_rid ){
double rStopTime = 9e99;
zFwdTo = P("ft");
if( zFwdTo ){
| | < | < | 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 |
if( zCiName==0 ) zCiName = zUuid;
blob_append_sql(&sql, " AND event.objid IN ok");
nd = 0;
if( d_rid ){
double rStopTime = 9e99;
zFwdTo = P("ft");
if( zFwdTo ){
double rStartDate = mtime_of_rid(d_rid, 0.0);
ridFwdTo = first_checkin_with_tag_after_date(zFwdTo, rStartDate);
if( ridFwdTo==0 ){
ridFwdTo = name_to_typed_rid(zBackTo,"ci");
}
if( ridFwdTo ){
if( !haveParameterN ) nEntry = 0;
rStopTime = mtime_of_rid(ridFwdTo, 9e99);
}
}
if( rStopTime<9e99 ){
rStopTime += 5.8e-6; /* Round up by 1/2 second */
}
db_multi_exec(
"WITH RECURSIVE dx(rid,mtime) AS (\n"
|
| ︙ | ︙ | |||
2278 2279 2280 2281 2282 2283 2284 |
}
if( useDividers && !selectedRid ) selectedRid = d_rid;
db_multi_exec("DELETE FROM ok");
}
if( p_rid ){
zBackTo = P("bt");
if( zBackTo ){
| | < | 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 |
}
if( useDividers && !selectedRid ) selectedRid = d_rid;
db_multi_exec("DELETE FROM ok");
}
if( p_rid ){
zBackTo = P("bt");
if( zBackTo ){
double rDateLimit = mtime_of_rid(p_rid, 0.0);
ridBackTo = last_checkin_with_tag_before_date(zBackTo, rDateLimit);
if( ridBackTo==0 ){
ridBackTo = name_to_typed_rid(zBackTo,"ci");
}
if( ridBackTo && !haveParameterN ) nEntry = 0;
}
compute_ancestors(p_rid, nEntry==0 ? 0 : nEntry+1, 0, ridBackTo);
|
| ︙ | ︙ |