| | @@ -1646,10 +1646,12 @@ |
| 1646 | 1646 | } |
| 1647 | 1647 | } |
| 1648 | 1648 | g.zRepositoryName = mprintf("%s", zDbName); |
| 1649 | 1649 | db_open_or_attach(g.zRepositoryName, "repository"); |
| 1650 | 1650 | g.repositoryOpen = 1; |
| 1651 | + sqlite3_file_control(g.db, "repository", SQLITE_FCNTL_DATA_VERSION, |
| 1652 | + &g.iRepoDataVers); |
| 1651 | 1653 | /* Cache "allow-symlinks" option, because we'll need it on every stat call */ |
| 1652 | 1654 | g.allowSymlinks = db_get_boolean("allow-symlinks", |
| 1653 | 1655 | db_allow_symlinks_by_default()); |
| 1654 | 1656 | g.zAuxSchema = db_get("aux-schema",""); |
| 1655 | 1657 | g.eHashPolicy = db_get_int("hash-policy",-1); |
| | @@ -1661,10 +1663,25 @@ |
| 1661 | 1663 | /* Make a change to the CHECK constraint on the BLOB table for |
| 1662 | 1664 | ** version 2.0 and later. |
| 1663 | 1665 | */ |
| 1664 | 1666 | rebuild_schema_update_2_0(); /* Do the Fossil-2.0 schema updates */ |
| 1665 | 1667 | } |
| 1668 | + |
| 1669 | +/* |
| 1670 | +** Return true if there have been any changes to the repository |
| 1671 | +** database since it was opened. |
| 1672 | +** |
| 1673 | +** Changes to "config" and "localdb" and "temp" do not count. |
| 1674 | +** This routine only returns true if there have been changes |
| 1675 | +** to "repository". |
| 1676 | +*/ |
| 1677 | +int db_repository_has_changed(void){ |
| 1678 | + unsigned int v; |
| 1679 | + if( !g.repositoryOpen ) return 0; |
| 1680 | + sqlite3_file_control(g.db, "repository", SQLITE_FCNTL_DATA_VERSION, &v); |
| 1681 | + return g.iRepoDataVers != v; |
| 1682 | +} |
| 1666 | 1683 | |
| 1667 | 1684 | /* |
| 1668 | 1685 | ** Flags for the db_find_and_open_repository() function. |
| 1669 | 1686 | */ |
| 1670 | 1687 | #if INTERFACE |
| 1671 | 1688 | |