Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Do a better job of merging branches that contain lots of file renames. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
0b93b0f958b0d70a1f352fca4c53ab75 |
User & Date: | drh 2011-09-02 16:19:17.525 |
References
2011-10-12
| ||
16:24 | • Ticket [30b28cf3] Merge to the checkout (on update) fails, if with renames status still Open with 2 other changes ... (artifact: fc7230ad user: viriketo) | |
16:23 | • Ticket [74413366] Bad behaviour merging with renames status still Open with 1 other change ... (artifact: b45e022d user: viriketo) | |
16:23 | • Ticket [554f44ee] Interbranch interference with merges and renames status still Open with 1 other change ... (artifact: f7ae3361 user: viriketo) | |
Context
2011-09-04
| ||
01:28 | Update the built-in SQLite to the latest 3.7.8-alpha version that contains the improved merge-sort logic. ... (check-in: 0cf54160 user: drh tags: trunk) | |
2011-09-02
| ||
16:19 | Do a better job of merging branches that contain lots of file renames. ... (check-in: 0b93b0f9 user: drh tags: trunk) | |
13:54 | Fix a missing \n on the trace output of the previous check-in. Also fix a redundancy in the computation of symbolic links. ... (check-in: 59717678 user: drh tags: trunk) | |
Changes
Changes to src/bisect.c.
︙ | ︙ | |||
40 41 42 43 44 45 46 | if( bisect.bad==0 ){ fossil_fatal("no \"bad\" version has been identified"); } bisect.good = db_lget_int("bisect-good", 0); if( bisect.good==0 ){ fossil_fatal("no \"good\" version has been identified"); } | | | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | if( bisect.bad==0 ){ fossil_fatal("no \"bad\" version has been identified"); } bisect.good = db_lget_int("bisect-good", 0); if( bisect.good==0 ){ fossil_fatal("no \"good\" version has been identified"); } p = path_shortest(bisect.good, bisect.bad, bisect_option("direct-only"), 0); 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); } } |
︙ | ︙ |
Changes to src/merge.c.
︙ | ︙ | |||
194 195 196 197 198 199 200 | " FROM vfile WHERE vid=%d", vid ); /* ** Compute name changes from P->V */ | | | | | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | " FROM vfile WHERE vid=%d", vid ); /* ** Compute name changes from P->V */ find_filename_changes(pid, vid, 0, &nChng, &aChng, debugFlag ? "P->V" : 0); if( nChng ){ for(i=0; i<nChng; i++){ char *z; z = db_text(0, "SELECT name FROM filename WHERE fnid=%d", aChng[i*2]); db_multi_exec( "UPDATE fv SET fnp=%Q, fnm=%Q" " WHERE fn=(SELECT name FROM filename WHERE fnid=%d)", z, z, aChng[i*2+1] ); free(z); } fossil_free(aChng); db_multi_exec("UPDATE fv SET fnm=fnp WHERE fnp!=fn"); } |
︙ | ︙ | |||
224 225 226 227 228 229 230 | " WHERE vid=%d AND pathname NOT IN (SELECT fnp FROM fv)", pid ); /* ** Compute name changes from P->M */ | | | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | " WHERE vid=%d AND pathname NOT IN (SELECT fnp FROM fv)", pid ); /* ** Compute name changes from P->M */ find_filename_changes(pid, mid, 0, &nChng, &aChng, debugFlag ? "P->M" : 0); if( nChng ){ if( nChng>4 ) db_multi_exec("CREATE INDEX fv_fnp ON fv(fnp)"); for(i=0; i<nChng; i++){ db_multi_exec( "UPDATE fv SET fnm=(SELECT name FROM filename WHERE fnid=%d)" " WHERE fnp=(SELECT name FROM filename WHERE fnid=%d)", aChng[i*2+1], aChng[i*2] |
︙ | ︙ |
Changes to src/path.c.
︙ | ︙ | |||
114 115 116 117 118 119 120 | ** ** Return a pointer to the beginning of the path (the iFrom node). ** Elements of the path can be traversed by following the PathNode.u.pTo ** pointer chain. ** ** Return NULL if no path is found. */ | | > > > > > > > > > | | 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 | ** ** Return a pointer to the beginning of the path (the iFrom node). ** Elements of the path can be traversed by following the PathNode.u.pTo ** pointer chain. ** ** 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 */ ){ Stmt s; PathNode *pPrev; PathNode *p; path_reset(); path.pStart = path_new_node(iFrom, 0, 0); if( iTo==iFrom ){ path.pEnd = path.pStart; return path.pStart; } 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 cid=:pid AND isprim" ); }else{ db_prepare(&s, |
︙ | ︙ | |||
191 192 193 194 195 196 197 198 199 200 201 202 203 | */ void shortest_path_test_cmd(void){ int iFrom; int iTo; PathNode *p; int n; int directOnly; db_find_and_open_repository(0,0); directOnly = find_option("no-merge",0,0)!=0; if( g.argc!=4 ) usage("VERSION1 VERSION2"); iFrom = name_to_rid(g.argv[2]); iTo = name_to_rid(g.argv[3]); | > > | | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | */ void shortest_path_test_cmd(void){ int iFrom; int iTo; PathNode *p; int n; int directOnly; int oneWay; db_find_and_open_repository(0,0); directOnly = find_option("no-merge",0,0)!=0; oneWay = find_option("one-way",0,0)!=0; 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); 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++){ char *z; z = db_text(0, "SELECT substr(uuid,1,12) || ' ' || datetime(mtime)" |
︙ | ︙ | |||
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | ** This routine really has nothing to do with path. It is located ** in this path.c module in order to leverage some of the path ** infrastructure. */ void find_filename_changes( int iFrom, /* Ancestor check-in */ int iTo, /* Recent check-in */ int *pnChng, /* Number of name changes along the path */ int **aiChng, /* Name changes */ const char *zDebug /* Generate trace output if no NULL */ ){ PathNode *p; /* For looping over path from iFrom to iTo */ NameChange *pAll = 0; /* List of all name changes seen so far */ NameChange *pChng; /* For looping through the name change list */ int nChng = 0; /* Number of files whose names have changed */ int *aChng; /* Two integers per name change */ int i; /* Loop counter */ Stmt q1; /* Query of name changes */ *pnChng = 0; *aiChng = 0; if( iFrom==iTo ) return; path_reset(); | > | | > > < | | < > > | > > > > | | | | | > > < | > > > > > | > > > > | | 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 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 | ** This routine really has nothing to do with path. It is located ** in this path.c module in order to leverage some of the path ** infrastructure. */ void find_filename_changes( int iFrom, /* Ancestor check-in */ int iTo, /* Recent check-in */ int revOk, /* Ok to move backwards (child->parent) if true */ int *pnChng, /* Number of name changes along the path */ int **aiChng, /* Name changes */ const char *zDebug /* Generate trace output if no NULL */ ){ PathNode *p; /* For looping over path from iFrom to iTo */ NameChange *pAll = 0; /* List of all name changes seen so far */ NameChange *pChng; /* For looping through the name change list */ int nChng = 0; /* Number of files whose names have changed */ int *aChng; /* Two integers per name change */ int i; /* Loop counter */ Stmt q1; /* Query of name changes */ *pnChng = 0; *aiChng = 0; if( iFrom==iTo ) return; path_reset(); p = path_shortest(iFrom, iTo, 1, revOk==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" ); for(p=path.pStart; p; p=p->u.pTo){ int fnid, pfnid; if( !p->fromIsParent && (p->u.pTo==0 || p->u.pTo->fromIsParent) ){ /* Skip nodes where the parent is not on the path */ continue; } db_bind_int(&q1, ":mid", p->rid); while( db_step(&q1)==SQLITE_ROW ){ fnid = db_column_int(&q1, 1); pfnid = db_column_int(&q1, 0); if( pfnid==0 ){ pfnid = fnid; fnid = 0; } if( !p->fromIsParent ){ int t = fnid; fnid = pfnid; pfnid = t; } if( zDebug ){ fossil_print("%s at %d%s %.10z: %d[%z] -> %d[%z]\n", zDebug, p->rid, p->fromIsParent ? ">" : "<", db_text(0, "SELECT uuid FROM blob WHERE rid=%d", p->rid), pfnid, db_text(0, "SELECT name FROM filename WHERE fnid=%d", pfnid), fnid, db_text(0, "SELECT name FROM filename WHERE fnid=%d", fnid)); } for(pChng=pAll; pChng; pChng=pChng->pNext){ if( pChng->curName==pfnid ){ pChng->newName = fnid; break; } } if( pChng==0 && fnid>0 ){ pChng = fossil_malloc( sizeof(*pChng) ); pChng->pNext = pAll; pAll = pChng; pChng->origName = pfnid; pChng->curName = pfnid; pChng->newName = fnid; nChng++; } } for(pChng=pAll; pChng; pChng=pChng->pNext){ pChng->curName = pChng->newName; } db_reset(&q1); } db_finalize(&q1); if( nChng ){ aChng = *aiChng = fossil_malloc( nChng*2*sizeof(int) ); for(pChng=pAll, i=0; pChng; pChng=pChng->pNext){ if( pChng->newName==0 ) continue; if( pChng->origName==0 ) continue; if( pChng->newName==pChng->origName ) continue; aChng[i] = pChng->origName; aChng[i+1] = pChng->newName; if( zDebug ){ fossil_print("%s summary %d[%z] -> %d[%z]\n", zDebug, aChng[i], db_text(0, "SELECT name FROM filename WHERE fnid=%d", aChng[i]), aChng[i+1], db_text(0, "SELECT name FROM filename WHERE fnid=%d", aChng[i+1])); } i += 2; } *pnChng = i/2; while( pAll ){ pChng = pAll; pAll = pAll->pNext; fossil_free(pChng); } } } /* ** COMMAND: test-name-changes ** ** Usage: %fossil test-name-changes [--debug] VERSION1 VERSION2 ** ** Show all filename changes that occur going from VERSION1 to VERSION2 */ void test_name_change(void){ int iFrom; int iTo; int *aChng; int nChng; int i; const char *zDebug = 0; int revOk = 0; db_find_and_open_repository(0,0); zDebug = find_option("debug",0,0)!=0 ? "debug" : 0; revOk = find_option("bidirectional",0,0)!=0; if( g.argc<4 ) usage("VERSION1 VERSION2"); while( g.argc>=4 ){ iFrom = name_to_rid(g.argv[2]); iTo = name_to_rid(g.argv[3]); find_filename_changes(iFrom, iTo, revOk, &nChng, &aChng, zDebug); fossil_print("------ Changes for (%d) %s -> (%d) %s\n", iFrom, g.argv[2], iTo, g.argv[3]); for(i=0; i<nChng; i++){ char *zFrom, *zTo; zFrom = db_text(0, "SELECT name FROM filename WHERE fnid=%d", aChng[i*2]); zTo = db_text(0, "SELECT name FROM filename WHERE fnid=%d", aChng[i*2+1]); |
︙ | ︙ |
Changes to src/timeline.c.
︙ | ︙ | |||
400 401 402 403 404 405 406 | int inUl = 0; if( !fchngQueryInit ){ db_prepare(&fchngQuery, "SELECT (pid==0) AS isnew," " (fid==0) AS isdel," " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name," " (SELECT uuid FROM blob WHERE rid=fid)," | | > | > < > > > > > > | > | 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 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | int inUl = 0; if( !fchngQueryInit ){ db_prepare(&fchngQuery, "SELECT (pid==0) AS isnew," " (fid==0) AS isdel," " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name," " (SELECT uuid FROM blob WHERE rid=fid)," " (SELECT uuid FROM blob WHERE rid=pid)," " (SELECT name FROM filename WHERE fnid=mlink.pfnid) AS oldnm" " FROM mlink" " WHERE mid=:mid AND (pid!=fid OR pfnid>0)" " ORDER BY 3 /*sort*/" ); fchngQueryInit = 1; } db_bind_int(&fchngQuery, ":mid", rid); while( db_step(&fchngQuery)==SQLITE_ROW ){ const char *zFilename = db_column_text(&fchngQuery, 2); int isNew = db_column_int(&fchngQuery, 0); int isDel = db_column_int(&fchngQuery, 1); const char *zOldName = db_column_text(&fchngQuery, 5); const char *zOld = db_column_text(&fchngQuery, 4); const char *zNew = db_column_text(&fchngQuery, 3); if( !inUl ){ @ <ul class="filelist"> inUl = 1; } if( isNew ){ @ <li> %h(zFilename) (new file) @ <a href="%s(g.zTop)/artifact/%S(zNew)" target="diffwindow">[view] }else if( isDel ){ @ <li> %h(zFilename) (deleted)</li> }else if( fossil_strcmp(zOld,zNew)==0 && zOldName!=0 ){ @ <li> %h(zOldName) → %h(zFilename) @ <a href="%s(g.zTop)/artifact/%S(zNew)" target="diffwindow">[view] }else{ if( zOldName!=0 ){ @ <li> %h(zOldName) → %h(zFilename) }else{ @ <li> %h(zFilename) } @ <a href="%s(g.zTop)/fdiff?v1=%S(zOld)&v2=%S(zNew)" @ target="diffwindow">[diff]</a></li> } } db_reset(&fchngQuery); if( inUl ){ @ </ul> |
︙ | ︙ | |||
926 927 928 929 930 931 932 | /* If from= and to= are present, display all nodes on a path connecting ** the two */ PathNode *p = 0; const char *zFrom = 0; const char *zTo = 0; if( from_rid && to_rid ){ | | | 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 | /* If from= and to= are present, display all nodes on a path connecting ** the two */ PathNode *p = 0; const char *zFrom = 0; const char *zTo = 0; if( from_rid && to_rid ){ p = path_shortest(from_rid, to_rid, noMerge, 0); zFrom = P("from"); zTo = P("to"); }else{ if( path_common_ancestor(me_rid, you_rid) ){ p = path_first(); } zFrom = P("me"); |
︙ | ︙ |
Changes to src/update.c.
︙ | ︙ | |||
221 222 223 224 225 226 227 | " FROM vfile WHERE vid=%d", vid ); /* Compute file name changes on V->T. Record name changes in files that ** have changed locally. */ | | | 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | " FROM vfile WHERE vid=%d", vid ); /* Compute file name changes on V->T. Record name changes in files that ** have changed locally. */ find_filename_changes(vid, tid, 1, &nChng, &aChng, debugFlag ? "V->T": 0); if( nChng ){ for(i=0; i<nChng; i++){ db_multi_exec( "UPDATE fv" " SET fnt=(SELECT name FROM filename WHERE fnid=%d)" " WHERE fn=(SELECT name FROM filename WHERE fnid=%d) AND chnged", aChng[i*2+1], aChng[i*2] |
︙ | ︙ |
Changes to test/release-checklist.wiki.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | Verify that there are no errors. <li><p> Click on each of the links in in the [./graph-test-1.wiki] document and verify that all graphs are rendered correctly. <li><p> Compile for all of the following platforms: <ol type="a"> <li> Linux x86 <li> Linux x86_64 <li> Mac x86 <li> Mac x86_64 | > > > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | Verify that there are no errors. <li><p> Click on each of the links in in the [./graph-test-1.wiki] document and verify that all graphs are rendered correctly. <li><p> Verify correct name-change tracking behavior (no net changes) for: <blockquote><b> fossil test-name-changes --debug b120bc8b262ac 374920b20944b </b></blockquote> <li><p> Compile for all of the following platforms: <ol type="a"> <li> Linux x86 <li> Linux x86_64 <li> Mac x86 <li> Mac x86_64 |
︙ | ︙ |