Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Merge versionable settings and empty-dirs setting from versionable-settings branch |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | ben-testing |
| Files: | files | file ages | folders |
| SHA1: |
30ebed190319313eb4c45ea10b102238 |
| User & Date: | ben 2011-06-02 19:38:18.693 |
Context
|
2011-06-02
| ||
| 23:45 | Minor code clean-ups: (1) shorten lines to less than 80 characters (2) remove C99-isms, especially intermixed code and declarations. Also merge in the moved file display fix from the trunk. check-in: a164b63a67 user: drh tags: ben-testing | |
| 19:38 | Merge versionable settings and empty-dirs setting from versionable-settings branch check-in: 30ebed1903 user: ben tags: ben-testing | |
| 19:31 | Merge SSL client certificate support from ben-security branch check-in: 397f434a4d user: ben tags: ben-testing | |
|
2011-05-28
| ||
| 15:40 | Tidy up and fix implementation of empty-dirs setting. Closed-Leaf check-in: 529237a3c1 user: ben tags: versionable-settings | |
Changes
Changes to src/add.c.
| ︙ | ︙ | |||
58 59 60 61 62 63 64 |
static const char *azManifest[] = {
"manifest",
"manifest.uuid",
};
if( N>=0 && N<count(azName) ) return azName[N];
if( N>=count(azName) && N<count(azName)+count(azManifest)
| | | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
static const char *azManifest[] = {
"manifest",
"manifest.uuid",
};
if( N>=0 && N<count(azName) ) return azName[N];
if( N>=count(azName) && N<count(azName)+count(azManifest)
&& db_get_versionable_setting_boolean("manifest",0) ){
return azManifest[N-count(azName)];
}
return 0;
}
/*
** Return a list of all reserved filenames as an SQL list.
|
| ︙ | ︙ | |||
183 184 185 186 187 188 189 |
const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */
Glob *pIgnore; /* Ignore everything matching this glob pattern */
zIgnoreFlag = find_option("ignore",0,1);
includeDotFiles = find_option("dotfiles",0,0)!=0;
db_must_be_within_tree();
if( zIgnoreFlag==0 ){
| | | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */
Glob *pIgnore; /* Ignore everything matching this glob pattern */
zIgnoreFlag = find_option("ignore",0,1);
includeDotFiles = find_option("dotfiles",0,0)!=0;
db_must_be_within_tree();
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get_versionable_setting("ignore-glob", 0);
}
vid = db_lget_int("checkout",0);
if( vid==0 ){
fossil_panic("no checkout to add to");
}
db_begin_transaction();
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
|
| ︙ | ︙ | |||
335 336 337 338 339 340 341 |
int vid;
int nAdd = 0;
int nDelete = 0;
Glob *pIgnore;
db_must_be_within_tree();
if( zIgnoreFlag==0 ){
| | | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
int vid;
int nAdd = 0;
int nDelete = 0;
Glob *pIgnore;
db_must_be_within_tree();
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get_versionable_setting("ignore-glob", 0);
}
vid = db_lget_int("checkout",0);
if( vid==0 ){
fossil_panic("no checkout to add to");
}
db_begin_transaction();
|
| ︙ | ︙ |
Changes to src/checkin.c.
| ︙ | ︙ | |||
222 223 224 225 226 227 228 |
int n;
const char *zIgnoreFlag = find_option("ignore",0,1);
int allFlag = find_option("dotfiles",0,0)!=0;
int outputManifest;
Glob *pIgnore;
db_must_be_within_tree();
| | | | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
int n;
const char *zIgnoreFlag = find_option("ignore",0,1);
int allFlag = find_option("dotfiles",0,0)!=0;
int outputManifest;
Glob *pIgnore;
db_must_be_within_tree();
outputManifest = db_get_versionable_setting_boolean("manifest",0);
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
n = strlen(g.zLocalRoot);
blob_init(&path, g.zLocalRoot, n-1);
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get_versionable_setting("ignore-glob", 0);
}
pIgnore = glob_create(zIgnoreFlag);
vfile_scan(&path, blob_size(&path), allFlag, pIgnore);
glob_free(pIgnore);
db_prepare(&q,
"SELECT x FROM sfile"
" WHERE x NOT IN (%s)"
|
| ︙ | ︙ | |||
281 282 283 284 285 286 287 |
Glob *pIgnore;
allFlag = find_option("force","f",0)!=0;
dotfilesFlag = find_option("dotfiles",0,0)!=0;
zIgnoreFlag = find_option("ignore",0,1);
db_must_be_within_tree();
if( zIgnoreFlag==0 ){
| | | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
Glob *pIgnore;
allFlag = find_option("force","f",0)!=0;
dotfilesFlag = find_option("dotfiles",0,0)!=0;
zIgnoreFlag = find_option("ignore",0,1);
db_must_be_within_tree();
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get_versionable_setting("ignore-glob", 0);
}
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
n = strlen(g.zLocalRoot);
blob_init(&path, g.zLocalRoot, n-1);
pIgnore = glob_create(zIgnoreFlag);
vfile_scan(&path, blob_size(&path), dotfilesFlag, pIgnore);
glob_free(pIgnore);
|
| ︙ | ︙ | |||
829 830 831 832 833 834 835 |
}
zDateOvrd = find_option("date-override",0,1);
zUserOvrd = find_option("user-override",0,1);
db_must_be_within_tree();
noSign = db_get_boolean("omitsign", 0)|noSign;
if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
useCksum = db_get_boolean("repo-cksum", 1);
| | | 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 |
}
zDateOvrd = find_option("date-override",0,1);
zUserOvrd = find_option("user-override",0,1);
db_must_be_within_tree();
noSign = db_get_boolean("omitsign", 0)|noSign;
if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
useCksum = db_get_boolean("repo-cksum", 1);
outputManifest = db_get_versionable_setting_boolean("manifest", 0);
verify_all_options();
/* So that older versions of Fossil (that do not understand delta-
** manifest) can continue to use this repository, do not create a new
** delta-manifest unless this repository already contains one or more
** delta-manifets, or unless the delta-manifest is explicitly requested
** by the --delta option.
|
| ︙ | ︙ | |||
970 971 972 973 974 975 976 |
/* Step 1: Insert records for all modified files into the blob
** table. If there were arguments passed to this command, only
** the identified fils are inserted (if they have been modified).
*/
db_prepare(&q,
"SELECT id, %Q || pathname, mrid, %s FROM vfile "
"WHERE chnged==1 AND NOT deleted AND file_is_selected(id)",
| | | 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 |
/* Step 1: Insert records for all modified files into the blob
** table. If there were arguments passed to this command, only
** the identified fils are inserted (if they have been modified).
*/
db_prepare(&q,
"SELECT id, %Q || pathname, mrid, %s FROM vfile "
"WHERE chnged==1 AND NOT deleted AND file_is_selected(id)",
g.zLocalRoot, glob_expr("pathname", db_get_versionable_setting("crnl-glob",""))
);
while( db_step(&q)==SQLITE_ROW ){
int id, rid;
const char *zFullname;
Blob content;
int crnlOk;
|
| ︙ | ︙ |
Changes to src/checkout.c.
| ︙ | ︙ | |||
139 140 141 142 143 144 145 |
** the text of the manifest and the artifact ID of the manifest.
*/
void manifest_to_disk(int vid){
char *zManFile;
Blob manifest;
Blob hash;
| | | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
** the text of the manifest and the artifact ID of the manifest.
*/
void manifest_to_disk(int vid){
char *zManFile;
Blob manifest;
Blob hash;
if( db_get_versionable_setting_boolean("manifest",0) ){
blob_zero(&manifest);
content_get(vid, &manifest);
zManFile = mprintf("%smanifest", g.zLocalRoot);
blob_write_to_file(&manifest, zManFile);
free(zManFile);
blob_zero(&hash);
sha1sum_blob(&manifest, &hash);
|
| ︙ | ︙ | |||
240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
}
db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid);
if( !keepFlag ){
vfile_to_disk(vid, 0, 1, promptFlag);
}
checkout_set_all_exe(vid);
manifest_to_disk(vid);
db_lset_int("checkout", vid);
undo_reset();
db_multi_exec("DELETE FROM vmerge");
if( !keepFlag && db_get_boolean("repo-cksum",1) ){
vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b);
vfile_aggregate_checksum_disk(vid, &cksum2);
if( blob_compare(&cksum1, &cksum2) ){
| > | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
}
db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid);
if( !keepFlag ){
vfile_to_disk(vid, 0, 1, promptFlag);
}
checkout_set_all_exe(vid);
manifest_to_disk(vid);
ensure_empty_dirs_created();
db_lset_int("checkout", vid);
undo_reset();
db_multi_exec("DELETE FROM vmerge");
if( !keepFlag && db_get_boolean("repo-cksum",1) ){
vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b);
vfile_aggregate_checksum_disk(vid, &cksum2);
if( blob_compare(&cksum1, &cksum2) ){
|
| ︙ | ︙ |
Changes to src/configure.c.
| ︙ | ︙ | |||
79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
{ "logo-mimetype", CONFIGSET_SKIN },
{ "logo-image", CONFIGSET_SKIN },
{ "project-name", CONFIGSET_PROJ },
{ "project-description", CONFIGSET_PROJ },
{ "manifest", CONFIGSET_PROJ },
{ "ignore-glob", CONFIGSET_PROJ },
{ "crnl-glob", CONFIGSET_PROJ },
{ "index-page", CONFIGSET_SKIN },
{ "timeline-block-markup", CONFIGSET_SKIN },
{ "timeline-max-comment", CONFIGSET_SKIN },
{ "ticket-table", CONFIGSET_TKT },
{ "ticket-common", CONFIGSET_TKT },
{ "ticket-newpage", CONFIGSET_TKT },
{ "ticket-viewpage", CONFIGSET_TKT },
| > | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
{ "logo-mimetype", CONFIGSET_SKIN },
{ "logo-image", CONFIGSET_SKIN },
{ "project-name", CONFIGSET_PROJ },
{ "project-description", CONFIGSET_PROJ },
{ "manifest", CONFIGSET_PROJ },
{ "ignore-glob", CONFIGSET_PROJ },
{ "crnl-glob", CONFIGSET_PROJ },
{ "empty-dirs", CONFIGSET_PROJ },
{ "index-page", CONFIGSET_SKIN },
{ "timeline-block-markup", CONFIGSET_SKIN },
{ "timeline-max-comment", CONFIGSET_SKIN },
{ "ticket-table", CONFIGSET_TKT },
{ "ticket-common", CONFIGSET_TKT },
{ "ticket-newpage", CONFIGSET_TKT },
{ "ticket-viewpage", CONFIGSET_TKT },
|
| ︙ | ︙ |
Changes to src/db.c.
| ︙ | ︙ | |||
1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 |
void db_swap_connections(void){
if( !g.useAttach ){
sqlite3 *dbTemp = g.db;
g.db = g.dbConfig;
g.dbConfig = dbTemp;
}
}
/*
** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the
** repository and local databases.
*/
char *db_get(const char *zName, char *zDefault){
char *z = 0;
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 |
void db_swap_connections(void){
if( !g.useAttach ){
sqlite3 *dbTemp = g.db;
g.db = g.dbConfig;
g.dbConfig = dbTemp;
}
}
/*
** Get a potentially versioned setting - either from .fossil-settings/<name>
*/
char *db_get_versionable_setting(const char *zName, char *zDefault){
/* Attempt to load the versioned setting from a checked out file */
char *zVersionedSetting = 0;
int noWarn = 0;
if( db_open_local() ){
Blob versionedPathname;
blob_zero(&versionedPathname);
blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", g.zLocalRoot, zName);
char *zVersionedPathname = blob_str(&versionedPathname);
if( file_size(zVersionedPathname)>=0 ){
/* File exists, and contains the value for this setting. Load from the file. */
Blob setting;
blob_zero(&setting);
if( blob_read_from_file(&setting, zVersionedPathname) >= 0 ){
blob_trim(&setting); /* Avoid non-obvious problems with line endings on boolean properties */
zVersionedSetting = strdup(blob_str(&setting));
}
blob_reset(&setting);
/* See if there's a no-warn flag */
blob_append(&versionedPathname, ".no-warn", -1);
if( file_size(blob_str(&versionedPathname))>=0 ){
noWarn = 1;
}
}
blob_reset(&versionedPathname);
}
/* Load the normal, non-versioned setting */
char *zSetting = db_get(zName, zDefault);
/* Display a warning? */
if( zVersionedSetting!=0 && zSetting!=0 && zSetting[0]!='\0' && zSetting!=zDefault && !noWarn ){
/* There's a versioned setting, and a non-versioned setting. Tell the user about the conflict */
fossil_warning("Setting %s has both versioned and non-versioned values: using versioned value from file .fossil-settings/%s (To silence this warning, either create an empty file named .fossil-settings/%s.no-warn or delete the non-versioned setting with \"fossil unset %s\")", zName, zName, zName, zName);
}
/* Prefer the versioned setting */
return ( zVersionedSetting!=0 ) ? zVersionedSetting : zSetting;
}
int db_get_versionable_setting_boolean(const char *zName, int dflt){
char *zVal = db_get_versionable_setting(zName, dflt ? "on" : "off");
if( is_truth(zVal) ) return 1;
if( is_false(zVal) ) return 0;
return dflt;
}
/*
** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the
** repository and local databases.
*/
char *db_get(const char *zName, char *zDefault){
char *z = 0;
|
| ︙ | ︙ | |||
1594 1595 1596 1597 1598 1599 1600 |
info_cmd();
}
}
/*
** Print the value of a setting named zName
*/
| | | | | | > > > > > > > > > > | | | | | | | | | | | | | | | > | | | | | | | | | | | | | | > > > > | | | | | > > > > > | | | | | 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 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 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 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 |
info_cmd();
}
}
/*
** Print the value of a setting named zName
*/
static void print_setting(const struct stControlSettings *ctrlSetting, int localOpen){
Stmt q;
if( g.repositoryOpen ){
db_prepare(&q,
"SELECT '(local)', value FROM config WHERE name=%Q"
" UNION ALL "
"SELECT '(global)', value FROM global_config WHERE name=%Q",
ctrlSetting->name, ctrlSetting->name
);
}else{
db_prepare(&q,
"SELECT '(global)', value FROM global_config WHERE name=%Q",
ctrlSetting->name
);
}
if( db_step(&q)==SQLITE_ROW ){
fossil_print("%-20s %-8s %s\n", ctrlSetting->name, db_column_text(&q, 0),
db_column_text(&q, 1));
}else{
fossil_print("%-20s\n", ctrlSetting->name);
}
if( ctrlSetting->versionable && localOpen ){
/* Check to see if this is overridden by a versionable settings file */
Blob versionedPathname;
blob_zero(&versionedPathname);
blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", g.zLocalRoot, ctrlSetting->name);
if( file_size(blob_str(&versionedPathname))>=0 ){
fossil_print(" (overridden by contents of file .fossil-settings/%s)\n", ctrlSetting->name);
}
}
db_finalize(&q);
}
/*
** define all settings, which can be controlled via the set/unset
** command. var is the name of the internal configuration name for db_(un)set.
** If var is 0, the settings name is used.
** width is the length for the edit field on the behavior page, 0
** is used for on/off checkboxes.
** The behaviour page doesn't use a special layout. It lists all
** set-commands and displays the 'set'-help as info.
*/
#if INTERFACE
struct stControlSettings {
char const *name; /* Name of the setting */
char const *var; /* Internal variable name used by db_set() */
int width; /* Width of display. 0 for boolean values */
int versionable; /* Is this setting versionable? */
char const *def; /* Default value */
};
#endif /* INTERFACE */
struct stControlSettings const ctrlSettings[] = {
{ "access-log", 0, 0, 0, "off" },
{ "auto-captcha", "autocaptcha", 0, 0, "on" },
{ "auto-shun", 0, 0, 0, "on" },
{ "autosync", 0, 0, 0, "on" },
{ "binary-glob", 0, 32, 1, "" },
{ "clearsign", 0, 0, 0, "off" },
{ "crnl-glob", 0, 16, 1, "" },
{ "default-perms", 0, 16, 0, "u" },
{ "diff-command", 0, 16, 0, "" },
{ "dont-push", 0, 0, 0, "off" },
{ "editor", 0, 16, 0, "" },
{ "gdiff-command", 0, 16, 0, "gdiff" },
{ "gmerge-command",0, 40, 0, "" },
{ "https-login", 0, 0, 0, "off" },
{ "ignore-glob", 0, 40, 1, "" },
{ "empty-dirs", 0, 40, 1, "" },
{ "http-port", 0, 16, 0, "8080" },
{ "localauth", 0, 0, 0, "off" },
{ "main-branch", 0, 40, 0, "trunk" },
{ "manifest", 0, 0, 1, "off" },
{ "max-upload", 0, 25, 0, "250000" },
{ "mtime-changes", 0, 0, 0, "on" },
{ "pgp-command", 0, 32, 0, "gpg --clearsign -o " },
{ "proxy", 0, 32, 0, "off" },
{ "repo-cksum", 0, 0, 0, "on" },
{ "self-register", 0, 0, 0, "off" },
{ "ssl-identity", 0, 40, 0, "" },
{ "ssh-command", 0, 32, 0, "" },
{ "web-browser", 0, 32, 0, "" },
{ 0,0,0,0,0 }
};
/*
** COMMAND: settings
** COMMAND: unset
**
** %fossil settings ?PROPERTY? ?VALUE? ?-global?
** %fossil unset PROPERTY ?-global?
**
** The "settings" command with no arguments lists all properties and their
** values. With just a property name it shows the value of that property.
** With a value argument it changes the property for the current repository.
**
** Settings marked as versionable are overridden by the contents of the
** file named .fossil-settings/PROPERTY in the checked out files, if that
** file exists.
**
** The "unset" command clears a property setting.
**
**
** auto-captcha If enabled, the Login page provides a button to
** fill in the captcha password. Default: on
**
** auto-shun If enabled, automatically pull the shunning list
** from a server to which the client autosyncs.
** Default: on
**
** autosync If enabled, automatically pull prior to commit
** or update and automatically push after commit or
** tag or branch creation. If the value is "pullonly"
** then only pull operations occur automatically.
** Default: on
**
** binary-glob The VALUE is a comma or newline-separated list of
** (versionable) GLOB patterns that should be treated as binary files
** for merging purposes. Example: *.xml
**
** clearsign When enabled, fossil will attempt to sign all commits
** with gpg. When disabled (the default), commits will
** be unsigned. Default: off
**
** crnl-glob A comma or newline-separated list of GLOB patterns for
** (versionable) text files in which it is ok to have CR+NL line endings.
** Set to "*" to disable CR+NL checking.
**
** default-perms Permissions given automatically to new users. For more
** information on permissions see Users page in Server
** Administration of the HTTP UI. Default: u.
**
** diff-command External command to run when performing a diff.
** If undefined, the internal text diff will be used.
**
** dont-push Prevent this repository from pushing from client to
** server. Useful when setting up a private branch.
**
** empty-dirs A comma or newline-separated list of pathnames. On
** (versionable) update and checkout commands, if no file or directory
** exists with that name, an empty directory will be
** created.
**
** editor Text editor command used for check-in comments.
**
** gdiff-command External command to run when performing a graphical
** diff. If undefined, text diff will be used.
**
** gmerge-command A graphical merge conflict resolver command operating
** on four files.
** Ex: kdiff3 "%baseline" "%original" "%merge" -o "%output"
** Ex: xxdiff "%original" "%baseline" "%merge" -M "%output"
** Ex: meld "%baseline" "%original" "%merge" "%output"
**
** http-port The TCP/IP port number to use by the "server"
** and "ui" commands. Default: 8080
**
** https-login Send login creditials using HTTPS instead of HTTP
** even if the login page request came via HTTP.
**
** ignore-glob The VALUE is a comma or newline-separated list of GLOB
** (versionable) patterns specifying files that the "extra" command will
** ignore. Example: *.o,*.obj,*.exe
**
** localauth If enabled, require that HTTP connections from
** 127.0.0.1 be authenticated by password. If
** false, all HTTP requests from localhost have
** unrestricted access to the repository.
**
** main-branch The primary branch for the project. Default: trunk
**
** manifest If enabled, automatically create files "manifest" and
** (versionable) "manifest.uuid" in every checkout. The SQLite and
** Fossil repositories both require this. Default: off.
**
** max-upload A limit on the size of uplink HTTP requests. The
** default is 250000 bytes.
**
** mtime-changes Use file modification times (mtimes) to detect when
** files have been modified. (Default "on".)
|
| ︙ | ︙ | |||
1803 1804 1805 1806 1807 1808 1809 1810 |
if( !g.repositoryOpen ){
globalFlag = 1;
}
if( unsetFlag && g.argc!=3 ){
usage("PROPERTY ?-global?");
}
if( g.argc==2 ){
for(i=0; ctrlSettings[i].name; i++){
| > | | 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 |
if( !g.repositoryOpen ){
globalFlag = 1;
}
if( unsetFlag && g.argc!=3 ){
usage("PROPERTY ?-global?");
}
if( g.argc==2 ){
int openLocal = db_open_local();
for(i=0; ctrlSettings[i].name; i++){
print_setting(&ctrlSettings[i], openLocal);
}
}else if( g.argc==3 || g.argc==4 ){
const char *zName = g.argv[2];
int isManifest;
int n = strlen(zName);
for(i=0; ctrlSettings[i].name; i++){
if( strncmp(ctrlSettings[i].name, zName, n)==0 ) break;
|
| ︙ | ︙ | |||
1826 1827 1828 1829 1830 1831 1832 |
}
if( unsetFlag ){
db_unset(ctrlSettings[i].name, globalFlag);
}else if( g.argc==4 ){
db_set(ctrlSettings[i].name, g.argv[3], globalFlag);
}else{
isManifest = 0;
| | | 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 |
}
if( unsetFlag ){
db_unset(ctrlSettings[i].name, globalFlag);
}else if( g.argc==4 ){
db_set(ctrlSettings[i].name, g.argv[3], globalFlag);
}else{
isManifest = 0;
print_setting(&ctrlSettings[i], db_open_local());
}
if( isManifest ){
manifest_to_disk(db_lget_int("checkout", 0));
}
}else{
usage("?PROPERTY? ?VALUE?");
}
|
| ︙ | ︙ |
Changes to src/glob.c.
| ︙ | ︙ | |||
108 109 110 111 112 113 114 |
if( zPatternList==0 || zPatternList[0]==0 ) return 0;
nList = strlen(zPatternList);
p = fossil_malloc( sizeof(*p) + nList+1 );
memset(p, 0, sizeof(*p));
z = (char*)&p[1];
memcpy(z, zPatternList, nList+1);
while( z[0] ){
| | | | | | 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 |
if( zPatternList==0 || zPatternList[0]==0 ) return 0;
nList = strlen(zPatternList);
p = fossil_malloc( sizeof(*p) + nList+1 );
memset(p, 0, sizeof(*p));
z = (char*)&p[1];
memcpy(z, zPatternList, nList+1);
while( z[0] ){
while( z[0]==',' || z[0]==' ' || z[0]=='\n' || z[0]=='\r' ) z++; /* Skip leading spaces and newlines */
if( z[0]=='\'' || z[0]=='"' ){
delimiter = z[0];
z++;
}else{
delimiter = ',';
}
if( z[0]==0 ) break;
p->azPattern = fossil_realloc(p->azPattern, (p->nPattern+1)*sizeof(char*) );
p->azPattern[p->nPattern++] = z;
for(i=0; z[i] && z[i]!=delimiter && z[i]!='\n' && z[i]!='\r'; i++){}
if( delimiter==',' ){
/* Remove trailing spaces / newlines on a comma-delimited pattern */
for(j=i; j>1 && (z[j-1]==' ' || z[j-1]=='\n' || z[j-1]=='\r'); j--){}
if( j<i ) z[j] = 0;
}
if( z[i]==0 ) break;
z[i] = 0;
z += i+1;
}
return p;
|
| ︙ | ︙ |
Changes to src/merge.c.
| ︙ | ︙ | |||
89 90 91 92 93 94 95 |
zBinGlob = find_option("binary",0,1);
nochangeFlag = find_option("nochange","n",0)!=0;
zPivot = find_option("baseline",0,1);
if( g.argc!=3 ){
usage("VERSION");
}
db_must_be_within_tree();
| | | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
zBinGlob = find_option("binary",0,1);
nochangeFlag = find_option("nochange","n",0)!=0;
zPivot = find_option("baseline",0,1);
if( g.argc!=3 ){
usage("VERSION");
}
db_must_be_within_tree();
if( zBinGlob==0 ) zBinGlob = db_get_versionable_setting("binary-glob",0);
vid = db_lget_int("checkout", 0);
if( vid==0 ){
fossil_fatal("nothing is checked out");
}
mid = name_to_typed_rid(g.argv[2], "ci");
if( mid==0 || !is_a_version(mid) ){
fossil_fatal("not a version: %s", g.argv[2]);
|
| ︙ | ︙ |
Changes to src/setup.c.
| ︙ | ︙ | |||
1060 1061 1062 1063 1064 1065 1066 |
@ <table border="0"><tr><td valign="top">
login_insert_csrf_secret();
for(pSet=ctrlSettings; pSet->name!=0; pSet++){
if( pSet->width==0 ){
onoff_attribute(pSet->name, pSet->name,
pSet->var!=0 ? pSet->var : pSet->name,
is_truth(pSet->def));
| > > > | > > > > | > > | 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 |
@ <table border="0"><tr><td valign="top">
login_insert_csrf_secret();
for(pSet=ctrlSettings; pSet->name!=0; pSet++){
if( pSet->width==0 ){
onoff_attribute(pSet->name, pSet->name,
pSet->var!=0 ? pSet->var : pSet->name,
is_truth(pSet->def));
if( pSet->versionable ){
@ (v)<br />
} else {
@ <br />
}
}
}
@ </td><td style="width: 30;"></td><td valign="top">
for(pSet=ctrlSettings; pSet->name!=0; pSet++){
if( pSet->width!=0 ){
entry_attribute(pSet->name, /*pSet->width*/ 40, pSet->name,
pSet->var!=0 ? pSet->var : pSet->name,
(char*)pSet->def);
if( pSet->versionable ){
@ (v)<br />
} else {
@ <br />
}
}
}
@ </td></tr></table>
@ <p><input type="submit" name="submit" value="Apply Changes" /></p>
@ </div></form>
@ <p>Settings marked with (v) are 'versionable' and will be overridden by the contents of files named <tt>.fossil-settings/PROPERTY</tt>.</p>
@ <hr /><p>
@ These settings work in the same way, as the <kbd>set</kbd> commandline:<br />
@ </p><pre>%s(zHelp_setting_cmd)</pre>
db_end_transaction(0);
style_footer();
}
|
| ︙ | ︙ |
Changes to src/tar.c.
| ︙ | ︙ | |||
213 214 215 216 217 218 219 |
blob_appendf(&filename, "%s/", zDir);
}
nPrefix = blob_size(&filename);
pManifest = manifest_get(rid, CFTYPE_MANIFEST);
if( pManifest ){
mTime = (pManifest->rDate - 2440587.5)*86400.0;
| | | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
blob_appendf(&filename, "%s/", zDir);
}
nPrefix = blob_size(&filename);
pManifest = manifest_get(rid, CFTYPE_MANIFEST);
if( pManifest ){
mTime = (pManifest->rDate - 2440587.5)*86400.0;
if( db_get_versionable_setting_boolean("manifest", 0) ){
blob_append(&filename, "manifest", -1);
zName = blob_str(&filename);
tar_add_file(zName, &mfile, 0, mTime);
sha1sum_blob(&mfile, &hash);
blob_reset(&mfile);
blob_append(&hash, "\n", 1);
blob_resize(&filename, nPrefix);
|
| ︙ | ︙ |
Changes to src/update.c.
| ︙ | ︙ | |||
113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
if( vid==0 ){
fossil_fatal("cannot find current version");
}
if( !nochangeFlag && db_exists("SELECT 1 FROM vmerge") ){
fossil_fatal("cannot update an uncommitted merge");
}
if( !nochangeFlag && !internalUpdate ) autosync(AUTOSYNC_PULL);
if( internalUpdate ){
tid = internalUpdate;
}else if( g.argc>=3 ){
if( fossil_strcmp(g.argv[2], "current")==0 ){
/* If VERSION is "current", then use the same algorithm to find the
** target as if VERSION were omitted. */
| > > > | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
if( vid==0 ){
fossil_fatal("cannot find current version");
}
if( !nochangeFlag && db_exists("SELECT 1 FROM vmerge") ){
fossil_fatal("cannot update an uncommitted merge");
}
if( !nochangeFlag && !internalUpdate ) autosync(AUTOSYNC_PULL);
/* Create any empty directories now, as well as after the update, so changes in settings are reflected now */
ensure_empty_dirs_created();
if( internalUpdate ){
tid = internalUpdate;
}else if( g.argc>=3 ){
if( fossil_strcmp(g.argv[2], "current")==0 ){
/* If VERSION is "current", then use the same algorithm to find the
** target as if VERSION were omitted. */
|
| ︙ | ︙ | |||
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 |
/*
** Clean up the mid and pid VFILE entries. Then commit the changes.
*/
if( nochangeFlag ){
db_end_transaction(1); /* With --nochange, rollback changes */
}else{
if( g.argc<=3 ){
/* All files updated. Shift the current checkout to the target. */
db_multi_exec("DELETE FROM vfile WHERE vid!=%d", tid);
checkout_set_all_exe(vid);
manifest_to_disk(tid);
db_lset_int("checkout", tid);
}else{
/* A subset of files have been checked out. Keep the current
** checkout unchanged. */
db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid);
}
if( !internalUpdate ) undo_finish();
db_end_transaction(0);
}
}
/*
** Get the contents of a file within the checking "revision". If
** revision==NULL then get the file content for the current checkout.
*/
int historical_version_of_file(
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 |
/*
** Clean up the mid and pid VFILE entries. Then commit the changes.
*/
if( nochangeFlag ){
db_end_transaction(1); /* With --nochange, rollback changes */
}else{
ensure_empty_dirs_created();
if( g.argc<=3 ){
/* All files updated. Shift the current checkout to the target. */
db_multi_exec("DELETE FROM vfile WHERE vid!=%d", tid);
checkout_set_all_exe(vid);
manifest_to_disk(tid);
db_lset_int("checkout", tid);
}else{
/* A subset of files have been checked out. Keep the current
** checkout unchanged. */
db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid);
}
if( !internalUpdate ) undo_finish();
db_end_transaction(0);
}
}
/*
** Make sure empty directories are created
*/
void ensure_empty_dirs_created()
{
/* Make empty directories? */
char *zEmptyDirs = db_get_versionable_setting("empty-dirs", 0);
if( zEmptyDirs!=0 ){
Blob dirsList;
blob_zero(&dirsList);
blob_init(&dirsList, zEmptyDirs, strlen(zEmptyDirs));
/* Replace commas by spaces */
char *bc = blob_str(&dirsList);
while( (*bc)!='\0' ){
if( (*bc)==',' ) { *bc = ' '; }
++bc;
}
/* Make directories */
Blob dirName;
blob_zero(&dirName);
while( blob_token(&dirsList, &dirName) ){
const char *zDir = blob_str(&dirName);
/* Make full pathname of the directory */
Blob path;
blob_zero(&path);
blob_appendf(&path, "%s/%s", g.zLocalRoot, zDir);
const char *zPath = blob_str(&path);
/* Handle various cases of existence of the directory */
switch( file_isdir(zPath) ){
case 0: { /* doesn't exist */
if( file_mkdir(zPath, 0)!=0 ) {
fossil_warning("couldn't create directory %s as required by empty-dirs setting", zDir);
}
break;
}
case 1: { /* exists, and is a directory */
/* do nothing - required directory exists already */
break;
}
case 2: { /* exists, but isn't a directory */
fossil_warning("file %s found, but a directory is required by empty-dirs setting", zDir);
}
}
blob_reset(&path);
}
}
}
/*
** Get the contents of a file within the checking "revision". If
** revision==NULL then get the file content for the current checkout.
*/
int historical_version_of_file(
|
| ︙ | ︙ |
Changes to src/zip.c.
| ︙ | ︙ | |||
335 336 337 338 339 340 341 |
}
nPrefix = blob_size(&filename);
pManifest = manifest_get(rid, CFTYPE_MANIFEST);
if( pManifest ){
char *zName;
zip_set_timedate(pManifest->rDate);
| | | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
}
nPrefix = blob_size(&filename);
pManifest = manifest_get(rid, CFTYPE_MANIFEST);
if( pManifest ){
char *zName;
zip_set_timedate(pManifest->rDate);
if( db_get_versionable_setting_boolean("manifest", 0) ){
blob_append(&filename, "manifest", -1);
zName = blob_str(&filename);
zip_add_folders(zName);
zip_add_file(zName, &mfile, 0);
sha1sum_blob(&mfile, &hash);
blob_reset(&mfile);
blob_append(&hash, "\n", 1);
|
| ︙ | ︙ |