Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch reparent Excluding Merge-Ins
This is equivalent to a diff from 893905c8 to 9cf12e65
2016-06-10
| ||
14:41 | Add the "fossil reparent" command and the --dryrun option on "fossil tag add" and "fossil tag cancel". ... (check-in: 96164bb2 user: drh tags: trunk) | |
14:40 | Add the --dryrun option to "reparent" and "tag add" and "tag cancel". Fix a typo in the command-line help for "reparent". ... (Closed-Leaf check-in: 9cf12e65 user: drh tags: reparent) | |
2016-05-27
| ||
21:03 | Compiler warning and coding style fixes. ... (check-in: d0374689 user: mistachkin tags: trunk) | |
2016-05-23
| ||
15:46 | Merge trunk ... (Closed-Leaf check-in: ca59c662 user: andygoth tags: andygoth-quote-apostrophe) | |
15:45 | Merge trunk ... (Closed-Leaf check-in: 83bd4f37 user: andygoth tags: andygoth-brackets-outside-link) | |
15:37 | Merge trunk ... (check-in: 1d2e7407 user: andygoth tags: reparent) | |
15:37 | Merge trunk ... (Closed-Leaf check-in: 6164dac5 user: andygoth tags: andygoth-svn-import) | |
15:34 | Rename crnl-glob to crlf-glob, retaining support for crnl-glob as a compatibility alias. Change terminology from NL to LF throughout, excepting cases where NL means newline and not line feed. Also don't change linenoise.c which is third-party code. ... (check-in: 2bc3cfeb user: andygoth tags: andygoth-crlf) | |
01:05 | Add brief documentation for compiling and using encrypted repositories. ... (check-in: 893905c8 user: drh tags: trunk) | |
2016-05-21
| ||
22:48 | Point out that clean -prompt implies -disable-undo ... (check-in: b5601dc3 user: andygoth tags: trunk) | |
Changes to src/import.c.
︙ | |||
923 924 925 926 927 928 929 | 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 | - + - | } /* ** Returns the UUID for the RID, or NULL if not found. ** The returned string is allocated via db_text() and must be ** free()d by the caller. */ |
︙ |
Changes to src/manifest.c.
︙ | |||
1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 | 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 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 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + | for(i=1; i<pChild->nParent; i++){ pmid = uuid_to_rid(pChild->azParent[i], 0); if( pmid<=0 ) continue; add_mlink(pmid, 0, mid, pChild, 0); } } } /* ** For a check-in with RID "rid" that has nParent parent check-ins given ** by the UUIDs in azParent[], create all appropriate plink and mlink table ** entries. ** ** The primary parent is the first UUID on the azParent[] list. ** ** Return the RID of the primary parent. */ static int manifest_add_checkin_linkages( int rid, /* The RID of the check-in */ Manifest *p, /* Manifest for this check-in */ int nParent, /* Number of parents for this check-in */ char **azParent /* UUIDs for each parent */ ){ int i; int parentid = 0; char zBaseId[30]; /* Baseline manifest RID for deltas. "NULL" otherwise */ Stmt q; if( p->zBaseline ){ sqlite3_snprintf(sizeof(zBaseId), zBaseId, "%d", uuid_to_rid(p->zBaseline,1)); }else{ sqlite3_snprintf(sizeof(zBaseId), zBaseId, "NULL"); } for(i=0; i<nParent; i++){ int pid = uuid_to_rid(azParent[i], 1); db_multi_exec( "INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime, baseid)" "VALUES(%d, %d, %d, %.17g, %s)", pid, rid, i==0, p->rDate, zBaseId/*safe-for-%s*/); if( i==0 ) parentid = pid; } add_mlink(parentid, 0, rid, p, 1); if( nParent>1 ){ /* Change MLINK.PID from 0 to -1 for files that are added by merge. */ db_multi_exec( "UPDATE mlink SET pid=-1" " WHERE mid=%d" " AND pid=0" " AND fnid IN " " (SELECT fnid FROM mlink WHERE mid=%d GROUP BY fnid" " HAVING count(*)<%d)", rid, rid, nParent ); } db_prepare(&q, "SELECT cid, isprim FROM plink WHERE pid=%d", rid); while( db_step(&q)==SQLITE_ROW ){ int cid = db_column_int(&q, 0); int isprim = db_column_int(&q, 1); add_mlink(rid, p, cid, 0, isprim); } db_finalize(&q); if( nParent==0 ){ /* For root files (files without parents) add mlink entries ** showing all content as new. */ int isPublic = !content_is_private(rid); for(i=0; i<p->nFile; i++){ add_one_mlink(0, 0, rid, p->aFile[i].zUuid, p->aFile[i].zName, 0, isPublic, 1, manifest_file_mperm(&p->aFile[i])); } } return parentid; } /* ** There exists a "parent" tag against checkin rid that has value zValue. ** If value is well-formed (meaning that is is a list of UUIDs), then use ** zValue to reparent check-in rid. */ void manifest_reparent_checkin(int rid, const char *zValue){ int nParent; char *zCopy = 0; char **azParent = 0; Manifest *p = 0; int i; int n = (int)strlen(zValue); nParent = (n+1)/(UUID_SIZE+1); if( nParent*(UUID_SIZE+1) - 1 !=n ) return; if( nParent<1 ) return; zCopy = fossil_strdup(zValue); azParent = fossil_malloc( sizeof(azParent[0])*nParent ); for(i=0; i<nParent; i++){ azParent[i] = &zCopy[i*(UUID_SIZE+1)]; if( i<nParent-1 && azParent[i][UUID_SIZE]!=' ' ) break; azParent[i][UUID_SIZE] = 0; if( !validate16(azParent[i],UUID_SIZE) ) break; } if( i==nParent && !db_exists("SELECT 1 FROM plink WHERE cid=%d AND pid=%d", rid, uuid_to_rid(azParent[0],0)) ){ p = manifest_get(rid, CFTYPE_MANIFEST, 0); } if( p!=0 ){ db_multi_exec( "DELETE FROM plink WHERE cid=%d;" "DELETE FROM mlink WHERE mid=%d;", rid, rid ); manifest_add_checkin_linkages(rid,p,nParent,azParent); } manifest_destroy(p); fossil_free(azParent); fossil_free(zCopy); } /* ** Setup to do multiple manifest_crosslink() calls. ** ** This routine creates TEMP tables for holding information for |
︙ | |||
1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 | 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 | + + + + + + + + + + + | assert( manifest_crosslink_busy==1 ); if( permitHooks ){ rc = xfer_run_common_script(); if( rc==TH_OK ){ zScript = xfer_ticket_code(); } } db_prepare(&q, "SELECT rid, value FROM tagxref" " WHERE tagid=%d AND tagtype=1", TAG_PARENT ); while( db_step(&q)==SQLITE_ROW ){ int rid = db_column_int(&q,0); const char *zValue = db_column_text(&q,1); manifest_reparent_checkin(rid, zValue); } db_finalize(&q); db_prepare(&q, "SELECT uuid FROM pending_tkt"); while( db_step(&q)==SQLITE_ROW ){ const char *zUuid = db_column_text(&q, 0); ticket_rebuild_entry(zUuid); if( permitHooks && rc==TH_OK ){ rc = xfer_run_script(zScript, zUuid, 0); } |
︙ | |||
1835 1836 1837 1838 1839 1840 1841 | 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 | - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | if( p->type==CFTYPE_MANIFEST ){ if( permitHooks ){ zScript = xfer_commit_code(); zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); } if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){ char *zCom; |
︙ |
Changes to src/tag.c.
︙ | |||
146 147 148 149 150 151 152 153 154 155 156 157 158 159 | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | + + + | id = db_last_insert_rowid(); } return id; } /* ** Insert a tag into the database. ** ** Also translate zTag into a tagid and return the tagid. (In other words ** if zTag is "bgcolor" then return TAG_BGCOLOR.) */ int tag_insert( const char *zTag, /* Name of the tag (w/o the "+" or "-" prefix */ int tagtype, /* 0:cancel 1:singleton 2:propagated */ const char *zValue, /* Value if the tag is really a property */ int srcId, /* Artifact that contains this tag */ double mtime, /* Timestamp. Use default if <=0.0 */ |
︙ | |||
226 227 228 229 230 231 232 233 234 235 236 237 238 239 | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | + + + | if( tagid==TAG_DATE ){ db_multi_exec("UPDATE event " " SET mtime=julianday(%Q)," " omtime=coalesce(omtime,mtime)" " WHERE objid=%d", zValue, rid); } if( tagid==TAG_PARENT && tagtype==1 ){ manifest_reparent_checkin(rid, zValue); } if( tagtype==1 ) tagtype = 0; tag_propagate(rid, tagid, tagtype, rid, zValue, mtime); return tagid; } /* |
︙ | |||
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | + + + + + + + + + + + + + + + + + + | g.markPrivate = content_is_private(rid); zValue = g.argc==5 ? g.argv[4] : 0; db_begin_transaction(); tag_insert(zTag, tagtype, zValue, -1, 0.0, rid); db_end_transaction(0); } /* ** OR this value into the tagtype argument to tag_add_artifact to ** cause the tag to be displayed on standard output rather than be ** inserted. Used for --dryrun options and debugging. */ #if INTERFACE #define TAG_ADD_DRYRUN 0x04 #endif /* ** Add a control record to the repository that either creates ** or cancels a tag. ** ** tagtype should normally be 0, 1, or 2. But if the TAG_ADD_DRYRUN bit ** is also set, then simply print the text of the tag on standard output ** (for testing purposes) rather than create the tag. */ void tag_add_artifact( const char *zPrefix, /* Prefix to prepend to tag name */ const char *zTagname, /* The tag to add or cancel */ const char *zObjName, /* Name of object attached to */ const char *zValue, /* Value for the tag. Might be NULL */ int tagtype, /* 0:cancel 1:singleton 2:propagated */ const char *zDateOvrd, /* Override date string */ const char *zUserOvrd /* Override user name */ ){ int rid; int nrid; char *zDate; Blob uuid; Blob ctrl; Blob cksum; static const char zTagtype[] = { '-', '+', '*' }; int dryRun = 0; if( tagtype & TAG_ADD_DRYRUN ){ tagtype &= ~TAG_ADD_DRYRUN; dryRun = 1; } assert( tagtype>=0 && tagtype<=2 ); user_select(); blob_zero(&uuid); blob_append(&uuid, zObjName, -1); if( name_to_uuid(&uuid, 9, "*") ){ fossil_fatal("%s", g.zErrMsg); return; |
︙ | |||
325 326 327 328 329 330 331 | 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 | + + + + - - + + + - - - - + + + + + + - + + | blob_appendf(&ctrl, " %F\n", zValue); }else{ blob_appendf(&ctrl, "\n"); } blob_appendf(&ctrl, "U %F\n", zUserOvrd ? zUserOvrd : login_name()); md5sum_blob(&ctrl, &cksum); blob_appendf(&ctrl, "Z %b\n", &cksum); if( dryRun ){ fossil_print("%s", blob_str(&ctrl)); blob_reset(&ctrl); }else{ |
︙ | |||
414 415 416 417 418 419 420 421 422 423 | 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 | + + - + - + + + - + - + | n = strlen(g.argv[2]); if( n==0 ){ goto tag_cmd_usage; } if( strncmp(g.argv[2],"add",n)==0 ){ char *zValue; int dryRun = 0; const char *zDateOvrd = find_option("date-override",0,1); const char *zUserOvrd = find_option("user-override",0,1); if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; if( g.argc!=5 && g.argc!=6 ){ |
︙ | |||
544 545 546 547 548 549 550 551 552 553 554 555 556 557 | 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | /* Cleanup */ return; tag_cmd_usage: usage("add|cancel|find|list ..."); } /* ** COMMAND: reparent* ** ** Usage: %fossil reparent [OPTIONS] CHECK-IN PARENT .... ** ** Create a "parent" tag that causes CHECK-IN to be interpreted as a ** child of PARENT. If multiple PARENTs are listed, then the first is ** the primary parent and others are merge ancestors. ** ** This is an experts-only command. It is used to patch up a repository ** that has been damaged by a shun or that has been pieced together from ** two or more separate repositories. You should never need to reparent ** during normal operations. ** ** Reparenting is accomplished by adding a parent tag. So to undo the ** reparenting operation, simply delete the tag. ** ** --test Make database entries but do not add the tag artifact. ** So the reparent operation will be undone by the next ** "fossil rebuild" command. ** --dryrun | -n Print the tag that would have been created but do not ** actually change the database in any way. */ void reparent_cmd(void){ int bTest = find_option("test","",0)!=0; int rid; int i; Blob value; char *zUuid; int dryRun = 0; if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; db_find_and_open_repository(0, 0); verify_all_options(); if( g.argc<4 ){ usage("reparent [OPTIONS] PARENT ..."); } rid = name_to_typed_rid(g.argv[2], "ci"); blob_init(&value, 0, 0); for(i=3; i<g.argc; i++){ int pid = name_to_typed_rid(g.argv[i], "ci"); if( i>3 ) blob_append(&value, " ", 1); zUuid = rid_to_uuid(pid); blob_append(&value, zUuid, UUID_SIZE); fossil_free(zUuid); } if( bTest && !dryRun ){ tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid); }else{ zUuid = rid_to_uuid(rid); tag_add_artifact("","parent",zUuid,blob_str(&value),1|dryRun,0,0); } } /* ** WEBPAGE: taglist ** ** List all non-propagating symbolic tags. */ void taglist_page(void){ |
︙ |