Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Use file_access(..., F_OK) in stead of file_access(..., 0) everywhere, in case some platforms exist where F_OK != 0. Remove a few end-of-line spaces. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
9df71fe36c00214e2602dbbd251fe2c8 |
| User & Date: | jan.nijtmans 2014-04-28 10:26:24.096 |
| Original Comment: | Use file_access(..., F_OK) in stead of file_access(zFullName, 0) everywhere, in case some platforms exist where F_OK != 0. Remove a few end-of-line spaces. |
Context
|
2014-04-28
| ||
| 11:00 | Fix function same_dline_ignore_allws(), for the case where one side of the diff was an empty line. Example where it went wrong: [/fdiff?v1=d5e0c2dc93&v2=7ee7dd0a42&sbs=1&w] check-in: 1274c97d70 user: jan.nijtmans tags: trunk | |
| 10:26 | Use file_access(..., F_OK) in stead of file_access(..., 0) everywhere, in case some platforms exist where F_OK != 0. Remove a few end-of-line spaces. check-in: 9df71fe36c user: jan.nijtmans tags: trunk | |
| 09:25 | Simplify some usage of if-statements. No change of functionality. check-in: 7458a18894 user: jan.nijtmans tags: trunk | |
Changes
Changes to src/allrepo.c.
| ︙ | ︙ | |||
153 154 155 156 157 158 159 |
int useCheckouts = 0;
int quiet = 0;
int dryRunFlag = 0;
int showFile = find_option("showfile",0,0)!=0;
int stopOnError = find_option("dontstop",0,0)==0;
int rc;
int nToDel = 0;
| | | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
int useCheckouts = 0;
int quiet = 0;
int dryRunFlag = 0;
int showFile = find_option("showfile",0,0)!=0;
int stopOnError = find_option("dontstop",0,0)==0;
int rc;
int nToDel = 0;
dryRunFlag = find_option("dry-run","n",0)!=0;
if( !dryRunFlag ){
dryRunFlag = find_option("test",0,0)!=0; /* deprecated */
}
if( g.argc<3 ){
usage("changes|clean|extras|ignore|list|ls|pull|push|rebuild|sync");
|
| ︙ | ︙ | |||
280 281 282 283 284 285 286 |
" WHERE substr(name, 1, 5)=='repo:'"
" ORDER BY 1"
);
}
db_multi_exec("CREATE TEMP TABLE todel(x TEXT)");
while( db_step(&q)==SQLITE_ROW ){
const char *zFilename = db_column_text(&q, 0);
| | | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
" WHERE substr(name, 1, 5)=='repo:'"
" ORDER BY 1"
);
}
db_multi_exec("CREATE TEMP TABLE todel(x TEXT)");
while( db_step(&q)==SQLITE_ROW ){
const char *zFilename = db_column_text(&q, 0);
if( file_access(zFilename, F_OK)
|| !file_is_canonical(zFilename)
|| (useCheckouts && file_isdir(zFilename)!=1)
){
db_multi_exec("INSERT INTO todel VALUES(%Q)", db_column_text(&q, 1));
nToDel++;
continue;
}
|
| ︙ | ︙ | |||
310 311 312 313 314 315 316 |
free(zSyscmd);
free(zQFilename);
if( stopOnError && rc ){
break;
}
}
db_finalize(&q);
| | | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
free(zSyscmd);
free(zQFilename);
if( stopOnError && rc ){
break;
}
}
db_finalize(&q);
/* If any repositories whose names appear in the ~/.fossil file could not
** be found, remove those names from the ~/.fossil file.
*/
if( nToDel>0 ){
const char *zSql = "DELETE FROM global_config WHERE name IN toDel";
if( dryRunFlag ){
fossil_print("%s\n", zSql);
}else{
db_multi_exec(zSql);
}
}
}
|
Changes to src/checkin.c.
| ︙ | ︙ | |||
84 85 86 87 88 89 90 |
zDisplayName += 2; /* no unnecessary ./ prefix */
}
}
blob_append(report, zPrefix, nPrefix);
if( isDeleted ){
blob_appendf(report, "DELETED %s\n", zDisplayName);
}else if( !file_wd_isfile_or_link(zFullName) ){
| | | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
zDisplayName += 2; /* no unnecessary ./ prefix */
}
}
blob_append(report, zPrefix, nPrefix);
if( isDeleted ){
blob_appendf(report, "DELETED %s\n", zDisplayName);
}else if( !file_wd_isfile_or_link(zFullName) ){
if( file_access(zFullName, F_OK)==0 ){
blob_appendf(report, "NOT_A_FILE %s\n", zDisplayName);
if( missingIsFatal ){
fossil_warning("not a file: %s", zDisplayName);
nErr++;
}
}else{
blob_appendf(report, "MISSING %s\n", zDisplayName);
|
| ︙ | ︙ | |||
325 326 327 328 329 330 331 |
const char *type = "";
if( verboseFlag ){
if( isNew ){
type = "ADDED ";
}else if( isDeleted ){
type = "DELETED ";
}else if( !file_wd_isfile_or_link(zFullName) ){
| | | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
const char *type = "";
if( verboseFlag ){
if( isNew ){
type = "ADDED ";
}else if( isDeleted ){
type = "DELETED ";
}else if( !file_wd_isfile_or_link(zFullName) ){
if( file_access(zFullName, F_OK)==0 ){
type = "NOT_A_FILE ";
}else{
type = "MISSING ";
}
}else if( chnged ){
if( chnged==2 ){
type = "UPDATED_BY_MERGE ";
|
| ︙ | ︙ |
Changes to src/db.c.
| ︙ | ︙ | |||
1002 1003 1004 1005 1006 1007 1008 |
zDbName = db_repository_filename();
}
if( zDbName==0 ){
db_err("unable to find the name of a repository database");
}
}
if( file_access(zDbName, R_OK) || file_size(zDbName)<1024 ){
| | | 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 |
zDbName = db_repository_filename();
}
if( zDbName==0 ){
db_err("unable to find the name of a repository database");
}
}
if( file_access(zDbName, R_OK) || file_size(zDbName)<1024 ){
if( file_access(zDbName, F_OK) ){
#ifdef FOSSIL_ENABLE_JSON
g.json.resultCode = FSL_JSON_E_DB_NOT_FOUND;
#endif
fossil_panic("repository does not exist or"
" is in an unreadable directory: %s", zDbName);
}else if( file_access(zDbName, R_OK) ){
#ifdef FOSSIL_ENABLE_JSON
|
| ︙ | ︙ | |||
1136 1137 1138 1139 1140 1141 1142 |
Blob repo;
char *zRepo;
if( g.argc!=3 ){
usage("PATHNAME");
}
file_canonical_name(g.argv[2], &repo, 0);
zRepo = blob_str(&repo);
| | | 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 |
Blob repo;
char *zRepo;
if( g.argc!=3 ){
usage("PATHNAME");
}
file_canonical_name(g.argv[2], &repo, 0);
zRepo = blob_str(&repo);
if( file_access(zRepo, F_OK) ){
fossil_fatal("no such file: %s", zRepo);
}
if( db_open_local(zRepo)==0 ){
fossil_fatal("not in a local checkout");
return;
}
db_open_or_attach(zRepo, "test_repo", 0);
|
| ︙ | ︙ | |||
2511 2512 2513 2514 2515 2516 2517 |
blob_append(&newSql, zOrigSql, j);
blob_append(&newSql, "PRIMARY KEY", -1);
zOrigSql += j+6;
j = -1;
}
}
blob_append(&newSql, zOrigSql, -1);
| | | 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 |
blob_append(&newSql, zOrigSql, j);
blob_append(&newSql, "PRIMARY KEY", -1);
zOrigSql += j+6;
j = -1;
}
}
blob_append(&newSql, zOrigSql, -1);
blob_appendf(&allSql,
"ALTER TABLE %s RENAME TO x_%s;\n"
"%s WITHOUT ROWID;\n"
"INSERT INTO %s SELECT * FROM x_%s;\n"
"DROP TABLE x_%s;\n",
zTName, zTName, blob_str(&newSql), zTName, zTName, zTName
);
fossil_print("Converting table %s of %s to WITHOUT ROWID.\n", zTName, g.argv[i]);
|
| ︙ | ︙ |
Changes to src/diffcmd.c.
| ︙ | ︙ | |||
169 170 171 172 173 174 175 |
/* Construct a temporary file to hold pFile1 based on the name of
** zFile2 */
blob_zero(&nameFile1);
do{
blob_reset(&nameFile1);
blob_appendf(&nameFile1, "%s~%d", zFile2, cnt++);
| | | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
/* Construct a temporary file to hold pFile1 based on the name of
** zFile2 */
blob_zero(&nameFile1);
do{
blob_reset(&nameFile1);
blob_appendf(&nameFile1, "%s~%d", zFile2, cnt++);
}while( file_access(blob_str(&nameFile1),F_OK)==0 );
blob_write_to_file(pFile1, blob_str(&nameFile1));
/* Construct the external diff command */
blob_zero(&cmd);
blob_appendf(&cmd, "%s ", zDiffCmd);
shell_escape(&cmd, blob_str(&nameFile1));
blob_append(&cmd, " ", 1);
|
| ︙ | ︙ | |||
383 384 385 386 387 388 389 |
int isLink = db_column_int(&q, 5);
char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
char *zToFree = zFullName;
int showDiff = 1;
if( isDeleted ){
fossil_print("DELETED %s\n", zPathname);
if( !asNewFile ){ showDiff = 0; zFullName = NULL_DEVICE; }
| | | 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
int isLink = db_column_int(&q, 5);
char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
char *zToFree = zFullName;
int showDiff = 1;
if( isDeleted ){
fossil_print("DELETED %s\n", zPathname);
if( !asNewFile ){ showDiff = 0; zFullName = NULL_DEVICE; }
}else if( file_access(zFullName, F_OK) ){
fossil_print("MISSING %s\n", zPathname);
if( !asNewFile ){ showDiff = 0; }
}else if( isNew ){
fossil_print("ADDED %s\n", zPathname);
srcid = 0;
if( !asNewFile ){ showDiff = 0; }
}else if( isChnged==3 ){
|
| ︙ | ︙ |
Changes to src/json_status.c.
| ︙ | ︙ | |||
67 68 69 70 71 72 73 | cson_object_set(oPay, "checkout", cson_object_value(tmpO)); zTmp = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid); cson_object_set(tmpO, "uuid", json_new_string(zTmp) ); free(zTmp); cson_object_set( tmpO, "tags", json_tags_for_checkin_rid(vid, 0) ); | | | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
cson_object_set(oPay, "checkout", cson_object_value(tmpO));
zTmp = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid);
cson_object_set(tmpO, "uuid", json_new_string(zTmp) );
free(zTmp);
cson_object_set( tmpO, "tags", json_tags_for_checkin_rid(vid, 0) );
/* FIXME: optimize the datetime/timestamp queries into 1 query. */
zTmp = db_text(0, "SELECT datetime(mtime) || "
"' UTC' FROM event WHERE objid=%d",
vid);
cson_object_set(tmpO, "datetime", json_new_string(zTmp));
free(zTmp);
iMtime = db_int64(0, "SELECT CAST(strftime('%%s',mtime) AS INTEGER) "
|
| ︙ | ︙ | |||
113 114 115 116 117 118 119 |
zStatus = "deleted";
}else if( isNew ){
zStatus = "new" /* maintenance reminder: MUST come
BEFORE the isChnged checks. */;
}else if( isRenamed ){
zStatus = "renamed";
}else if( !file_wd_isfile_or_link(zFullName) ){
| | | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
zStatus = "deleted";
}else if( isNew ){
zStatus = "new" /* maintenance reminder: MUST come
BEFORE the isChnged checks. */;
}else if( isRenamed ){
zStatus = "renamed";
}else if( !file_wd_isfile_or_link(zFullName) ){
if( file_access(zFullName, F_OK)==0 ){
zStatus = "notAFile";
++nErr;
}else{
zStatus = "missing";
++nErr;
}
}else if( 2==isChnged ){
|
| ︙ | ︙ | |||
135 136 137 138 139 140 141 |
}else if( 1==isChnged ){
if( file_contains_merge_marker(zFullName) ){
zStatus = "conflict";
}else{
zStatus = "edited";
}
}
| | | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
}else if( 1==isChnged ){
if( file_contains_merge_marker(zFullName) ){
zStatus = "conflict";
}else{
zStatus = "edited";
}
}
oFile = cson_new_object();
cson_array_append( aFiles, cson_object_value(oFile) );
/* optimization potential: move these keys into cson_strings
to take advantage of refcounting. */
cson_object_set( oFile, "name", json_new_string( zPathname ) );
cson_object_set( oFile, "status", json_new_string( zStatus ) );
|
| ︙ | ︙ |