Fossil SCM

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.

drh 2011-06-02 23:45 ben-testing merge
Commit a164b63a67369c4285d68efc0505f5aa18dd5397
+26 -8
--- src/db.c
+++ src/db.c
@@ -1395,26 +1395,35 @@
13951395
}
13961396
}
13971397
13981398
/*
13991399
** Get a potentially versioned setting - either from .fossil-settings/<name>
1400
+** if we have a local checkout and that file exists, or from the
1401
+** CONFIG or GLOBAL_CONFIG tables if we are running in server mode
1402
+** (without a local checkout) or if the file does not exist.
14001403
*/
14011404
char *db_get_versionable_setting(const char *zName, char *zDefault){
14021405
/* Attempt to load the versioned setting from a checked out file */
14031406
char *zVersionedSetting = 0;
14041407
int noWarn = 0;
1408
+ char *zSetting = 0;
1409
+
14051410
if( db_open_local() ){
14061411
Blob versionedPathname;
1412
+ char *zVersionedPathname;
14071413
blob_zero(&versionedPathname);
1408
- blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", g.zLocalRoot, zName);
1409
- char *zVersionedPathname = blob_str(&versionedPathname);
1414
+ blob_appendf(&versionedPathname, "%s/.fossil-settings/%s",
1415
+ g.zLocalRoot, zName);
1416
+ zVersionedPathname = blob_str(&versionedPathname);
14101417
if( file_size(zVersionedPathname)>=0 ){
1411
- /* File exists, and contains the value for this setting. Load from the file. */
1418
+ /* File exists, and contains the value for this setting. Load from
1419
+ ** the file. */
14121420
Blob setting;
14131421
blob_zero(&setting);
14141422
if( blob_read_from_file(&setting, zVersionedPathname) >= 0 ){
1415
- blob_trim(&setting); /* Avoid non-obvious problems with line endings on boolean properties */
1423
+ blob_trim(&setting); /* Avoid non-obvious problems with line endings
1424
+ ** on boolean properties */
14161425
zVersionedSetting = strdup(blob_str(&setting));
14171426
}
14181427
blob_reset(&setting);
14191428
/* See if there's a no-warn flag */
14201429
blob_append(&versionedPathname, ".no-warn", -1);
@@ -1423,15 +1432,24 @@
14231432
}
14241433
}
14251434
blob_reset(&versionedPathname);
14261435
}
14271436
/* Load the normal, non-versioned setting */
1428
- char *zSetting = db_get(zName, zDefault);
1437
+ zSetting = db_get(zName, zDefault);
14291438
/* Display a warning? */
1430
- if( zVersionedSetting!=0 && zSetting!=0 && zSetting[0]!='\0' && zSetting!=zDefault && !noWarn ){
1431
- /* There's a versioned setting, and a non-versioned setting. Tell the user about the conflict */
1432
- 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);
1439
+ if( zVersionedSetting!=0 && zSetting!=0 && zSetting[0]!='\0'
1440
+ && zSetting!=zDefault && !noWarn
1441
+ ){
1442
+ /* There's a versioned setting, and a non-versioned setting. Tell
1443
+ ** the user about the conflict */
1444
+ fossil_warning(
1445
+ "setting %s has both versioned and non-versioned values: using "
1446
+ "versioned value from file .fossil-settings/%s (to silence this "
1447
+ "warning, either create an empty file named "
1448
+ ".fossil-settings/%s.no-warn or delete the non-versioned setting "
1449
+ " with \"fossil unset %s\")", zName, zName, zName, zName
1450
+ );
14331451
}
14341452
/* Prefer the versioned setting */
14351453
return ( zVersionedSetting!=0 ) ? zVersionedSetting : zSetting;
14361454
}
14371455
int db_get_versionable_setting_boolean(const char *zName, int dflt){
14381456
--- src/db.c
+++ src/db.c
@@ -1395,26 +1395,35 @@
1395 }
1396 }
1397
1398 /*
1399 ** Get a potentially versioned setting - either from .fossil-settings/<name>
 
 
 
1400 */
1401 char *db_get_versionable_setting(const char *zName, char *zDefault){
1402 /* Attempt to load the versioned setting from a checked out file */
1403 char *zVersionedSetting = 0;
1404 int noWarn = 0;
 
 
1405 if( db_open_local() ){
1406 Blob versionedPathname;
 
1407 blob_zero(&versionedPathname);
1408 blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", g.zLocalRoot, zName);
1409 char *zVersionedPathname = blob_str(&versionedPathname);
 
1410 if( file_size(zVersionedPathname)>=0 ){
1411 /* File exists, and contains the value for this setting. Load from the file. */
 
1412 Blob setting;
1413 blob_zero(&setting);
1414 if( blob_read_from_file(&setting, zVersionedPathname) >= 0 ){
1415 blob_trim(&setting); /* Avoid non-obvious problems with line endings on boolean properties */
 
1416 zVersionedSetting = strdup(blob_str(&setting));
1417 }
1418 blob_reset(&setting);
1419 /* See if there's a no-warn flag */
1420 blob_append(&versionedPathname, ".no-warn", -1);
@@ -1423,15 +1432,24 @@
1423 }
1424 }
1425 blob_reset(&versionedPathname);
1426 }
1427 /* Load the normal, non-versioned setting */
1428 char *zSetting = db_get(zName, zDefault);
1429 /* Display a warning? */
1430 if( zVersionedSetting!=0 && zSetting!=0 && zSetting[0]!='\0' && zSetting!=zDefault && !noWarn ){
1431 /* There's a versioned setting, and a non-versioned setting. Tell the user about the conflict */
1432 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);
 
 
 
 
 
 
 
 
 
1433 }
1434 /* Prefer the versioned setting */
1435 return ( zVersionedSetting!=0 ) ? zVersionedSetting : zSetting;
1436 }
1437 int db_get_versionable_setting_boolean(const char *zName, int dflt){
1438
--- src/db.c
+++ src/db.c
@@ -1395,26 +1395,35 @@
1395 }
1396 }
1397
1398 /*
1399 ** Get a potentially versioned setting - either from .fossil-settings/<name>
1400 ** if we have a local checkout and that file exists, or from the
1401 ** CONFIG or GLOBAL_CONFIG tables if we are running in server mode
1402 ** (without a local checkout) or if the file does not exist.
1403 */
1404 char *db_get_versionable_setting(const char *zName, char *zDefault){
1405 /* Attempt to load the versioned setting from a checked out file */
1406 char *zVersionedSetting = 0;
1407 int noWarn = 0;
1408 char *zSetting = 0;
1409
1410 if( db_open_local() ){
1411 Blob versionedPathname;
1412 char *zVersionedPathname;
1413 blob_zero(&versionedPathname);
1414 blob_appendf(&versionedPathname, "%s/.fossil-settings/%s",
1415 g.zLocalRoot, zName);
1416 zVersionedPathname = blob_str(&versionedPathname);
1417 if( file_size(zVersionedPathname)>=0 ){
1418 /* File exists, and contains the value for this setting. Load from
1419 ** the file. */
1420 Blob setting;
1421 blob_zero(&setting);
1422 if( blob_read_from_file(&setting, zVersionedPathname) >= 0 ){
1423 blob_trim(&setting); /* Avoid non-obvious problems with line endings
1424 ** on boolean properties */
1425 zVersionedSetting = strdup(blob_str(&setting));
1426 }
1427 blob_reset(&setting);
1428 /* See if there's a no-warn flag */
1429 blob_append(&versionedPathname, ".no-warn", -1);
@@ -1423,15 +1432,24 @@
1432 }
1433 }
1434 blob_reset(&versionedPathname);
1435 }
1436 /* Load the normal, non-versioned setting */
1437 zSetting = db_get(zName, zDefault);
1438 /* Display a warning? */
1439 if( zVersionedSetting!=0 && zSetting!=0 && zSetting[0]!='\0'
1440 && zSetting!=zDefault && !noWarn
1441 ){
1442 /* There's a versioned setting, and a non-versioned setting. Tell
1443 ** the user about the conflict */
1444 fossil_warning(
1445 "setting %s has both versioned and non-versioned values: using "
1446 "versioned value from file .fossil-settings/%s (to silence this "
1447 "warning, either create an empty file named "
1448 ".fossil-settings/%s.no-warn or delete the non-versioned setting "
1449 " with \"fossil unset %s\")", zName, zName, zName, zName
1450 );
1451 }
1452 /* Prefer the versioned setting */
1453 return ( zVersionedSetting!=0 ) ? zVersionedSetting : zSetting;
1454 }
1455 int db_get_versionable_setting_boolean(const char *zName, int dflt){
1456
+26 -8
--- src/db.c
+++ src/db.c
@@ -1395,26 +1395,35 @@
13951395
}
13961396
}
13971397
13981398
/*
13991399
** Get a potentially versioned setting - either from .fossil-settings/<name>
1400
+** if we have a local checkout and that file exists, or from the
1401
+** CONFIG or GLOBAL_CONFIG tables if we are running in server mode
1402
+** (without a local checkout) or if the file does not exist.
14001403
*/
14011404
char *db_get_versionable_setting(const char *zName, char *zDefault){
14021405
/* Attempt to load the versioned setting from a checked out file */
14031406
char *zVersionedSetting = 0;
14041407
int noWarn = 0;
1408
+ char *zSetting = 0;
1409
+
14051410
if( db_open_local() ){
14061411
Blob versionedPathname;
1412
+ char *zVersionedPathname;
14071413
blob_zero(&versionedPathname);
1408
- blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", g.zLocalRoot, zName);
1409
- char *zVersionedPathname = blob_str(&versionedPathname);
1414
+ blob_appendf(&versionedPathname, "%s/.fossil-settings/%s",
1415
+ g.zLocalRoot, zName);
1416
+ zVersionedPathname = blob_str(&versionedPathname);
14101417
if( file_size(zVersionedPathname)>=0 ){
1411
- /* File exists, and contains the value for this setting. Load from the file. */
1418
+ /* File exists, and contains the value for this setting. Load from
1419
+ ** the file. */
14121420
Blob setting;
14131421
blob_zero(&setting);
14141422
if( blob_read_from_file(&setting, zVersionedPathname) >= 0 ){
1415
- blob_trim(&setting); /* Avoid non-obvious problems with line endings on boolean properties */
1423
+ blob_trim(&setting); /* Avoid non-obvious problems with line endings
1424
+ ** on boolean properties */
14161425
zVersionedSetting = strdup(blob_str(&setting));
14171426
}
14181427
blob_reset(&setting);
14191428
/* See if there's a no-warn flag */
14201429
blob_append(&versionedPathname, ".no-warn", -1);
@@ -1423,15 +1432,24 @@
14231432
}
14241433
}
14251434
blob_reset(&versionedPathname);
14261435
}
14271436
/* Load the normal, non-versioned setting */
1428
- char *zSetting = db_get(zName, zDefault);
1437
+ zSetting = db_get(zName, zDefault);
14291438
/* Display a warning? */
1430
- if( zVersionedSetting!=0 && zSetting!=0 && zSetting[0]!='\0' && zSetting!=zDefault && !noWarn ){
1431
- /* There's a versioned setting, and a non-versioned setting. Tell the user about the conflict */
1432
- 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);
1439
+ if( zVersionedSetting!=0 && zSetting!=0 && zSetting[0]!='\0'
1440
+ && zSetting!=zDefault && !noWarn
1441
+ ){
1442
+ /* There's a versioned setting, and a non-versioned setting. Tell
1443
+ ** the user about the conflict */
1444
+ fossil_warning(
1445
+ "setting %s has both versioned and non-versioned values: using "
1446
+ "versioned value from file .fossil-settings/%s (to silence this "
1447
+ "warning, either create an empty file named "
1448
+ ".fossil-settings/%s.no-warn or delete the non-versioned setting "
1449
+ " with \"fossil unset %s\")", zName, zName, zName, zName
1450
+ );
14331451
}
14341452
/* Prefer the versioned setting */
14351453
return ( zVersionedSetting!=0 ) ? zVersionedSetting : zSetting;
14361454
}
14371455
int db_get_versionable_setting_boolean(const char *zName, int dflt){
14381456
--- src/db.c
+++ src/db.c
@@ -1395,26 +1395,35 @@
1395 }
1396 }
1397
1398 /*
1399 ** Get a potentially versioned setting - either from .fossil-settings/<name>
 
 
 
1400 */
1401 char *db_get_versionable_setting(const char *zName, char *zDefault){
1402 /* Attempt to load the versioned setting from a checked out file */
1403 char *zVersionedSetting = 0;
1404 int noWarn = 0;
 
 
1405 if( db_open_local() ){
1406 Blob versionedPathname;
 
1407 blob_zero(&versionedPathname);
1408 blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", g.zLocalRoot, zName);
1409 char *zVersionedPathname = blob_str(&versionedPathname);
 
1410 if( file_size(zVersionedPathname)>=0 ){
1411 /* File exists, and contains the value for this setting. Load from the file. */
 
1412 Blob setting;
1413 blob_zero(&setting);
1414 if( blob_read_from_file(&setting, zVersionedPathname) >= 0 ){
1415 blob_trim(&setting); /* Avoid non-obvious problems with line endings on boolean properties */
 
1416 zVersionedSetting = strdup(blob_str(&setting));
1417 }
1418 blob_reset(&setting);
1419 /* See if there's a no-warn flag */
1420 blob_append(&versionedPathname, ".no-warn", -1);
@@ -1423,15 +1432,24 @@
1423 }
1424 }
1425 blob_reset(&versionedPathname);
1426 }
1427 /* Load the normal, non-versioned setting */
1428 char *zSetting = db_get(zName, zDefault);
1429 /* Display a warning? */
1430 if( zVersionedSetting!=0 && zSetting!=0 && zSetting[0]!='\0' && zSetting!=zDefault && !noWarn ){
1431 /* There's a versioned setting, and a non-versioned setting. Tell the user about the conflict */
1432 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);
 
 
 
 
 
 
 
 
 
1433 }
1434 /* Prefer the versioned setting */
1435 return ( zVersionedSetting!=0 ) ? zVersionedSetting : zSetting;
1436 }
1437 int db_get_versionable_setting_boolean(const char *zName, int dflt){
1438
--- src/db.c
+++ src/db.c
@@ -1395,26 +1395,35 @@
1395 }
1396 }
1397
1398 /*
1399 ** Get a potentially versioned setting - either from .fossil-settings/<name>
1400 ** if we have a local checkout and that file exists, or from the
1401 ** CONFIG or GLOBAL_CONFIG tables if we are running in server mode
1402 ** (without a local checkout) or if the file does not exist.
1403 */
1404 char *db_get_versionable_setting(const char *zName, char *zDefault){
1405 /* Attempt to load the versioned setting from a checked out file */
1406 char *zVersionedSetting = 0;
1407 int noWarn = 0;
1408 char *zSetting = 0;
1409
1410 if( db_open_local() ){
1411 Blob versionedPathname;
1412 char *zVersionedPathname;
1413 blob_zero(&versionedPathname);
1414 blob_appendf(&versionedPathname, "%s/.fossil-settings/%s",
1415 g.zLocalRoot, zName);
1416 zVersionedPathname = blob_str(&versionedPathname);
1417 if( file_size(zVersionedPathname)>=0 ){
1418 /* File exists, and contains the value for this setting. Load from
1419 ** the file. */
1420 Blob setting;
1421 blob_zero(&setting);
1422 if( blob_read_from_file(&setting, zVersionedPathname) >= 0 ){
1423 blob_trim(&setting); /* Avoid non-obvious problems with line endings
1424 ** on boolean properties */
1425 zVersionedSetting = strdup(blob_str(&setting));
1426 }
1427 blob_reset(&setting);
1428 /* See if there's a no-warn flag */
1429 blob_append(&versionedPathname, ".no-warn", -1);
@@ -1423,15 +1432,24 @@
1432 }
1433 }
1434 blob_reset(&versionedPathname);
1435 }
1436 /* Load the normal, non-versioned setting */
1437 zSetting = db_get(zName, zDefault);
1438 /* Display a warning? */
1439 if( zVersionedSetting!=0 && zSetting!=0 && zSetting[0]!='\0'
1440 && zSetting!=zDefault && !noWarn
1441 ){
1442 /* There's a versioned setting, and a non-versioned setting. Tell
1443 ** the user about the conflict */
1444 fossil_warning(
1445 "setting %s has both versioned and non-versioned values: using "
1446 "versioned value from file .fossil-settings/%s (to silence this "
1447 "warning, either create an empty file named "
1448 ".fossil-settings/%s.no-warn or delete the non-versioned setting "
1449 " with \"fossil unset %s\")", zName, zName, zName, zName
1450 );
1451 }
1452 /* Prefer the versioned setting */
1453 return ( zVersionedSetting!=0 ) ? zVersionedSetting : zSetting;
1454 }
1455 int db_get_versionable_setting_boolean(const char *zName, int dflt){
1456
+17 -7
--- src/info.c
+++ src/info.c
@@ -280,18 +280,21 @@
280280
*/
281281
static void append_file_change_line(
282282
const char *zName, /* Name of the file that has changed */
283283
const char *zOld, /* blob.uuid before change. NULL for added files */
284284
const char *zNew, /* blob.uuid after change. NULL for deletes */
285
+ const char *zOldName, /* Prior name. NULL if no name change. */
285286
int showDiff, /* Show edit diffs if true */
286287
int mperm /* EXE permission for zNew */
287288
){
288289
if( !g.okHistory ){
289290
if( zNew==0 ){
290291
@ <p>Deleted %h(zName)</p>
291292
}else if( zOld==0 ){
292293
@ <p>Added %h(zName)</p>
294
+ }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){
295
+ @ <p>Name change from %h(zOldName) to %h(zName)
293296
}else if( fossil_strcmp(zNew, zOld)==0 ){
294297
@ <p>Execute permission %s(mperm?"set":"cleared") for %h(zName)</p>
295298
}else{
296299
@ <p>Changes to %h(zName)</p>
297300
}
@@ -304,10 +307,14 @@
304307
if( zOld && zNew ){
305308
if( fossil_strcmp(zOld, zNew)!=0 ){
306309
@ <p>Modified <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
307310
@ from <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a>
308311
@ to <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)].</a>
312
+ }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){
313
+ @ <p>Name change from
314
+ @ from <a href="%s(g.zTop)/finfo?name=%T(zOldName)">%h(zOldName)</a>
315
+ @ to <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>.
309316
}else{
310317
@ <p>Execute permission %s(mperm?"set":"cleared") for
311318
@ <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
312319
}
313320
}else if( zOld ){
@@ -319,11 +326,11 @@
319326
}
320327
if( showDiff ){
321328
@ <blockquote><pre>
322329
append_diff(zOld, zNew);
323330
@ </pre></blockquote>
324
- }else if( zOld && zNew ){
331
+ }else if( zOld && zNew && fossil_strcmp(zOld,zNew)!=0 ){
325332
@ &nbsp;&nbsp;
326333
@ <a href="%s(g.zTop)/fdiff?v1=%S(zOld)&amp;v2=%S(zNew)">[diff]</a>
327334
}
328335
@ </p>
329336
}
@@ -511,13 +518,15 @@
511518
}
512519
}
513520
@ &nbsp;&nbsp;
514521
@ <a href="%s(g.zTop)/vpatch?from=%S(zParent)&to=%S(zUuid)">[patch]</a><br/>
515522
db_prepare(&q,
516
- "SELECT name, mperm,"
523
+ "SELECT name,"
524
+ " mperm,"
517525
" (SELECT uuid FROM blob WHERE rid=mlink.pid),"
518
- " (SELECT uuid FROM blob WHERE rid=mlink.fid)"
526
+ " (SELECT uuid FROM blob WHERE rid=mlink.fid),"
527
+ " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)"
519528
" FROM mlink JOIN filename ON filename.fnid=mlink.fnid"
520529
" WHERE mlink.mid=%d"
521530
" ORDER BY name",
522531
rid
523532
);
@@ -524,11 +533,12 @@
524533
while( db_step(&q)==SQLITE_ROW ){
525534
const char *zName = db_column_text(&q,0);
526535
int mperm = db_column_int(&q, 1);
527536
const char *zOld = db_column_text(&q,2);
528537
const char *zNew = db_column_text(&q,3);
529
- append_file_change_line(zName, zOld, zNew, showDiff, mperm);
538
+ const char *zOldName = db_column_text(&q, 4);
539
+ append_file_change_line(zName, zOld, zNew, zOldName, showDiff, mperm);
530540
}
531541
db_finalize(&q);
532542
}
533543
style_footer();
534544
}
@@ -715,25 +725,25 @@
715725
}else{
716726
cmp = fossil_strcmp(pFileFrom->zName, pFileTo->zName);
717727
}
718728
if( cmp<0 ){
719729
append_file_change_line(pFileFrom->zName,
720
- pFileFrom->zUuid, 0, 0, 0);
730
+ pFileFrom->zUuid, 0, 0, 0, 0);
721731
pFileFrom = manifest_file_next(pFrom, 0);
722732
}else if( cmp>0 ){
723733
append_file_change_line(pFileTo->zName,
724
- 0, pFileTo->zUuid, 0,
734
+ 0, pFileTo->zUuid, 0, 0,
725735
manifest_file_mperm(pFileTo));
726736
pFileTo = manifest_file_next(pTo, 0);
727737
}else if( fossil_strcmp(pFileFrom->zUuid, pFileTo->zUuid)==0 ){
728738
/* No changes */
729739
pFileFrom = manifest_file_next(pFrom, 0);
730740
pFileTo = manifest_file_next(pTo, 0);
731741
}else{
732742
append_file_change_line(pFileFrom->zName,
733743
pFileFrom->zUuid,
734
- pFileTo->zUuid, showDetail,
744
+ pFileTo->zUuid, 0, showDetail,
735745
manifest_file_mperm(pFileTo));
736746
pFileFrom = manifest_file_next(pFrom, 0);
737747
pFileTo = manifest_file_next(pTo, 0);
738748
}
739749
}
740750
--- src/info.c
+++ src/info.c
@@ -280,18 +280,21 @@
280 */
281 static void append_file_change_line(
282 const char *zName, /* Name of the file that has changed */
283 const char *zOld, /* blob.uuid before change. NULL for added files */
284 const char *zNew, /* blob.uuid after change. NULL for deletes */
 
285 int showDiff, /* Show edit diffs if true */
286 int mperm /* EXE permission for zNew */
287 ){
288 if( !g.okHistory ){
289 if( zNew==0 ){
290 @ <p>Deleted %h(zName)</p>
291 }else if( zOld==0 ){
292 @ <p>Added %h(zName)</p>
 
 
293 }else if( fossil_strcmp(zNew, zOld)==0 ){
294 @ <p>Execute permission %s(mperm?"set":"cleared") for %h(zName)</p>
295 }else{
296 @ <p>Changes to %h(zName)</p>
297 }
@@ -304,10 +307,14 @@
304 if( zOld && zNew ){
305 if( fossil_strcmp(zOld, zNew)!=0 ){
306 @ <p>Modified <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
307 @ from <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a>
308 @ to <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)].</a>
 
 
 
 
309 }else{
310 @ <p>Execute permission %s(mperm?"set":"cleared") for
311 @ <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
312 }
313 }else if( zOld ){
@@ -319,11 +326,11 @@
319 }
320 if( showDiff ){
321 @ <blockquote><pre>
322 append_diff(zOld, zNew);
323 @ </pre></blockquote>
324 }else if( zOld && zNew ){
325 @ &nbsp;&nbsp;
326 @ <a href="%s(g.zTop)/fdiff?v1=%S(zOld)&amp;v2=%S(zNew)">[diff]</a>
327 }
328 @ </p>
329 }
@@ -511,13 +518,15 @@
511 }
512 }
513 @ &nbsp;&nbsp;
514 @ <a href="%s(g.zTop)/vpatch?from=%S(zParent)&to=%S(zUuid)">[patch]</a><br/>
515 db_prepare(&q,
516 "SELECT name, mperm,"
 
517 " (SELECT uuid FROM blob WHERE rid=mlink.pid),"
518 " (SELECT uuid FROM blob WHERE rid=mlink.fid)"
 
519 " FROM mlink JOIN filename ON filename.fnid=mlink.fnid"
520 " WHERE mlink.mid=%d"
521 " ORDER BY name",
522 rid
523 );
@@ -524,11 +533,12 @@
524 while( db_step(&q)==SQLITE_ROW ){
525 const char *zName = db_column_text(&q,0);
526 int mperm = db_column_int(&q, 1);
527 const char *zOld = db_column_text(&q,2);
528 const char *zNew = db_column_text(&q,3);
529 append_file_change_line(zName, zOld, zNew, showDiff, mperm);
 
530 }
531 db_finalize(&q);
532 }
533 style_footer();
534 }
@@ -715,25 +725,25 @@
715 }else{
716 cmp = fossil_strcmp(pFileFrom->zName, pFileTo->zName);
717 }
718 if( cmp<0 ){
719 append_file_change_line(pFileFrom->zName,
720 pFileFrom->zUuid, 0, 0, 0);
721 pFileFrom = manifest_file_next(pFrom, 0);
722 }else if( cmp>0 ){
723 append_file_change_line(pFileTo->zName,
724 0, pFileTo->zUuid, 0,
725 manifest_file_mperm(pFileTo));
726 pFileTo = manifest_file_next(pTo, 0);
727 }else if( fossil_strcmp(pFileFrom->zUuid, pFileTo->zUuid)==0 ){
728 /* No changes */
729 pFileFrom = manifest_file_next(pFrom, 0);
730 pFileTo = manifest_file_next(pTo, 0);
731 }else{
732 append_file_change_line(pFileFrom->zName,
733 pFileFrom->zUuid,
734 pFileTo->zUuid, showDetail,
735 manifest_file_mperm(pFileTo));
736 pFileFrom = manifest_file_next(pFrom, 0);
737 pFileTo = manifest_file_next(pTo, 0);
738 }
739 }
740
--- src/info.c
+++ src/info.c
@@ -280,18 +280,21 @@
280 */
281 static void append_file_change_line(
282 const char *zName, /* Name of the file that has changed */
283 const char *zOld, /* blob.uuid before change. NULL for added files */
284 const char *zNew, /* blob.uuid after change. NULL for deletes */
285 const char *zOldName, /* Prior name. NULL if no name change. */
286 int showDiff, /* Show edit diffs if true */
287 int mperm /* EXE permission for zNew */
288 ){
289 if( !g.okHistory ){
290 if( zNew==0 ){
291 @ <p>Deleted %h(zName)</p>
292 }else if( zOld==0 ){
293 @ <p>Added %h(zName)</p>
294 }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){
295 @ <p>Name change from %h(zOldName) to %h(zName)
296 }else if( fossil_strcmp(zNew, zOld)==0 ){
297 @ <p>Execute permission %s(mperm?"set":"cleared") for %h(zName)</p>
298 }else{
299 @ <p>Changes to %h(zName)</p>
300 }
@@ -304,10 +307,14 @@
307 if( zOld && zNew ){
308 if( fossil_strcmp(zOld, zNew)!=0 ){
309 @ <p>Modified <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
310 @ from <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a>
311 @ to <a href="%s(g.zTop)/artifact/%s(zNew)">[%S(zNew)].</a>
312 }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){
313 @ <p>Name change from
314 @ from <a href="%s(g.zTop)/finfo?name=%T(zOldName)">%h(zOldName)</a>
315 @ to <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>.
316 }else{
317 @ <p>Execute permission %s(mperm?"set":"cleared") for
318 @ <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>
319 }
320 }else if( zOld ){
@@ -319,11 +326,11 @@
326 }
327 if( showDiff ){
328 @ <blockquote><pre>
329 append_diff(zOld, zNew);
330 @ </pre></blockquote>
331 }else if( zOld && zNew && fossil_strcmp(zOld,zNew)!=0 ){
332 @ &nbsp;&nbsp;
333 @ <a href="%s(g.zTop)/fdiff?v1=%S(zOld)&amp;v2=%S(zNew)">[diff]</a>
334 }
335 @ </p>
336 }
@@ -511,13 +518,15 @@
518 }
519 }
520 @ &nbsp;&nbsp;
521 @ <a href="%s(g.zTop)/vpatch?from=%S(zParent)&to=%S(zUuid)">[patch]</a><br/>
522 db_prepare(&q,
523 "SELECT name,"
524 " mperm,"
525 " (SELECT uuid FROM blob WHERE rid=mlink.pid),"
526 " (SELECT uuid FROM blob WHERE rid=mlink.fid),"
527 " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)"
528 " FROM mlink JOIN filename ON filename.fnid=mlink.fnid"
529 " WHERE mlink.mid=%d"
530 " ORDER BY name",
531 rid
532 );
@@ -524,11 +533,12 @@
533 while( db_step(&q)==SQLITE_ROW ){
534 const char *zName = db_column_text(&q,0);
535 int mperm = db_column_int(&q, 1);
536 const char *zOld = db_column_text(&q,2);
537 const char *zNew = db_column_text(&q,3);
538 const char *zOldName = db_column_text(&q, 4);
539 append_file_change_line(zName, zOld, zNew, zOldName, showDiff, mperm);
540 }
541 db_finalize(&q);
542 }
543 style_footer();
544 }
@@ -715,25 +725,25 @@
725 }else{
726 cmp = fossil_strcmp(pFileFrom->zName, pFileTo->zName);
727 }
728 if( cmp<0 ){
729 append_file_change_line(pFileFrom->zName,
730 pFileFrom->zUuid, 0, 0, 0, 0);
731 pFileFrom = manifest_file_next(pFrom, 0);
732 }else if( cmp>0 ){
733 append_file_change_line(pFileTo->zName,
734 0, pFileTo->zUuid, 0, 0,
735 manifest_file_mperm(pFileTo));
736 pFileTo = manifest_file_next(pTo, 0);
737 }else if( fossil_strcmp(pFileFrom->zUuid, pFileTo->zUuid)==0 ){
738 /* No changes */
739 pFileFrom = manifest_file_next(pFrom, 0);
740 pFileTo = manifest_file_next(pTo, 0);
741 }else{
742 append_file_change_line(pFileFrom->zName,
743 pFileFrom->zUuid,
744 pFileTo->zUuid, 0, showDetail,
745 manifest_file_mperm(pFileTo));
746 pFileFrom = manifest_file_next(pFrom, 0);
747 pFileTo = manifest_file_next(pTo, 0);
748 }
749 }
750
+1 -1
--- src/manifest.c
+++ src/manifest.c
@@ -1323,11 +1323,11 @@
13231323
if( pChildFile ){
13241324
add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0,
13251325
isPublic, manifest_file_mperm(pChildFile));
13261326
}
13271327
}
1328
- }else if( pChild->zBaseline==0 ){
1328
+ }else if( pChild->zBaseline==0 && pParent->zBaseline!=0 ){
13291329
/* Parent is a delta but pChild is a baseline. Look for files that are
13301330
** present in pParent but which are missing from pChild and mark them
13311331
** has having been deleted. */
13321332
manifest_file_rewind(pParent);
13331333
while( (pParentFile = manifest_file_next(pParent,0))!=0 ){
13341334
--- src/manifest.c
+++ src/manifest.c
@@ -1323,11 +1323,11 @@
1323 if( pChildFile ){
1324 add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0,
1325 isPublic, manifest_file_mperm(pChildFile));
1326 }
1327 }
1328 }else if( pChild->zBaseline==0 ){
1329 /* Parent is a delta but pChild is a baseline. Look for files that are
1330 ** present in pParent but which are missing from pChild and mark them
1331 ** has having been deleted. */
1332 manifest_file_rewind(pParent);
1333 while( (pParentFile = manifest_file_next(pParent,0))!=0 ){
1334
--- src/manifest.c
+++ src/manifest.c
@@ -1323,11 +1323,11 @@
1323 if( pChildFile ){
1324 add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0,
1325 isPublic, manifest_file_mperm(pChildFile));
1326 }
1327 }
1328 }else if( pChild->zBaseline==0 && pParent->zBaseline!=0 ){
1329 /* Parent is a delta but pChild is a baseline. Look for files that are
1330 ** present in pParent but which are missing from pChild and mark them
1331 ** has having been deleted. */
1332 manifest_file_rewind(pParent);
1333 while( (pParentFile = manifest_file_next(pParent,0))!=0 ){
1334
+12 -7
--- src/update.c
+++ src/update.c
@@ -463,48 +463,53 @@
463463
}
464464
465465
/*
466466
** Make sure empty directories are created
467467
*/
468
-void ensure_empty_dirs_created()
469
-{
468
+void ensure_empty_dirs_created(void){
470469
/* Make empty directories? */
471470
char *zEmptyDirs = db_get_versionable_setting("empty-dirs", 0);
472471
if( zEmptyDirs!=0 ){
472
+ char *bc;
473
+ Blob dirName;
473474
Blob dirsList;
475
+
474476
blob_zero(&dirsList);
475477
blob_init(&dirsList, zEmptyDirs, strlen(zEmptyDirs));
476478
/* Replace commas by spaces */
477
- char *bc = blob_str(&dirsList);
479
+ bc = blob_str(&dirsList);
478480
while( (*bc)!='\0' ){
479481
if( (*bc)==',' ) { *bc = ' '; }
480482
++bc;
481483
}
482484
/* Make directories */
483
- Blob dirName;
484485
blob_zero(&dirName);
485486
while( blob_token(&dirsList, &dirName) ){
486487
const char *zDir = blob_str(&dirName);
487488
/* Make full pathname of the directory */
488489
Blob path;
490
+ const char *zPath;
491
+
489492
blob_zero(&path);
490493
blob_appendf(&path, "%s/%s", g.zLocalRoot, zDir);
491
- const char *zPath = blob_str(&path);
494
+ zPath = blob_str(&path);
492495
/* Handle various cases of existence of the directory */
493496
switch( file_isdir(zPath) ){
494497
case 0: { /* doesn't exist */
495498
if( file_mkdir(zPath, 0)!=0 ) {
496
- fossil_warning("couldn't create directory %s as required by empty-dirs setting", zDir);
499
+ fossil_warning("couldn't create directory %s as "
500
+ "required by empty-dirs setting", zDir);
497501
}
498502
break;
499503
}
500504
case 1: { /* exists, and is a directory */
501505
/* do nothing - required directory exists already */
502506
break;
503507
}
504508
case 2: { /* exists, but isn't a directory */
505
- fossil_warning("file %s found, but a directory is required by empty-dirs setting", zDir);
509
+ fossil_warning("file %s found, but a directory is required "
510
+ "by empty-dirs setting", zDir);
506511
}
507512
}
508513
blob_reset(&path);
509514
}
510515
}
511516
--- src/update.c
+++ src/update.c
@@ -463,48 +463,53 @@
463 }
464
465 /*
466 ** Make sure empty directories are created
467 */
468 void ensure_empty_dirs_created()
469 {
470 /* Make empty directories? */
471 char *zEmptyDirs = db_get_versionable_setting("empty-dirs", 0);
472 if( zEmptyDirs!=0 ){
 
 
473 Blob dirsList;
 
474 blob_zero(&dirsList);
475 blob_init(&dirsList, zEmptyDirs, strlen(zEmptyDirs));
476 /* Replace commas by spaces */
477 char *bc = blob_str(&dirsList);
478 while( (*bc)!='\0' ){
479 if( (*bc)==',' ) { *bc = ' '; }
480 ++bc;
481 }
482 /* Make directories */
483 Blob dirName;
484 blob_zero(&dirName);
485 while( blob_token(&dirsList, &dirName) ){
486 const char *zDir = blob_str(&dirName);
487 /* Make full pathname of the directory */
488 Blob path;
 
 
489 blob_zero(&path);
490 blob_appendf(&path, "%s/%s", g.zLocalRoot, zDir);
491 const char *zPath = blob_str(&path);
492 /* Handle various cases of existence of the directory */
493 switch( file_isdir(zPath) ){
494 case 0: { /* doesn't exist */
495 if( file_mkdir(zPath, 0)!=0 ) {
496 fossil_warning("couldn't create directory %s as required by empty-dirs setting", zDir);
 
497 }
498 break;
499 }
500 case 1: { /* exists, and is a directory */
501 /* do nothing - required directory exists already */
502 break;
503 }
504 case 2: { /* exists, but isn't a directory */
505 fossil_warning("file %s found, but a directory is required by empty-dirs setting", zDir);
 
506 }
507 }
508 blob_reset(&path);
509 }
510 }
511
--- src/update.c
+++ src/update.c
@@ -463,48 +463,53 @@
463 }
464
465 /*
466 ** Make sure empty directories are created
467 */
468 void ensure_empty_dirs_created(void){
 
469 /* Make empty directories? */
470 char *zEmptyDirs = db_get_versionable_setting("empty-dirs", 0);
471 if( zEmptyDirs!=0 ){
472 char *bc;
473 Blob dirName;
474 Blob dirsList;
475
476 blob_zero(&dirsList);
477 blob_init(&dirsList, zEmptyDirs, strlen(zEmptyDirs));
478 /* Replace commas by spaces */
479 bc = blob_str(&dirsList);
480 while( (*bc)!='\0' ){
481 if( (*bc)==',' ) { *bc = ' '; }
482 ++bc;
483 }
484 /* Make directories */
 
485 blob_zero(&dirName);
486 while( blob_token(&dirsList, &dirName) ){
487 const char *zDir = blob_str(&dirName);
488 /* Make full pathname of the directory */
489 Blob path;
490 const char *zPath;
491
492 blob_zero(&path);
493 blob_appendf(&path, "%s/%s", g.zLocalRoot, zDir);
494 zPath = blob_str(&path);
495 /* Handle various cases of existence of the directory */
496 switch( file_isdir(zPath) ){
497 case 0: { /* doesn't exist */
498 if( file_mkdir(zPath, 0)!=0 ) {
499 fossil_warning("couldn't create directory %s as "
500 "required by empty-dirs setting", zDir);
501 }
502 break;
503 }
504 case 1: { /* exists, and is a directory */
505 /* do nothing - required directory exists already */
506 break;
507 }
508 case 2: { /* exists, but isn't a directory */
509 fossil_warning("file %s found, but a directory is required "
510 "by empty-dirs setting", zDir);
511 }
512 }
513 blob_reset(&path);
514 }
515 }
516
+12 -7
--- src/update.c
+++ src/update.c
@@ -463,48 +463,53 @@
463463
}
464464
465465
/*
466466
** Make sure empty directories are created
467467
*/
468
-void ensure_empty_dirs_created()
469
-{
468
+void ensure_empty_dirs_created(void){
470469
/* Make empty directories? */
471470
char *zEmptyDirs = db_get_versionable_setting("empty-dirs", 0);
472471
if( zEmptyDirs!=0 ){
472
+ char *bc;
473
+ Blob dirName;
473474
Blob dirsList;
475
+
474476
blob_zero(&dirsList);
475477
blob_init(&dirsList, zEmptyDirs, strlen(zEmptyDirs));
476478
/* Replace commas by spaces */
477
- char *bc = blob_str(&dirsList);
479
+ bc = blob_str(&dirsList);
478480
while( (*bc)!='\0' ){
479481
if( (*bc)==',' ) { *bc = ' '; }
480482
++bc;
481483
}
482484
/* Make directories */
483
- Blob dirName;
484485
blob_zero(&dirName);
485486
while( blob_token(&dirsList, &dirName) ){
486487
const char *zDir = blob_str(&dirName);
487488
/* Make full pathname of the directory */
488489
Blob path;
490
+ const char *zPath;
491
+
489492
blob_zero(&path);
490493
blob_appendf(&path, "%s/%s", g.zLocalRoot, zDir);
491
- const char *zPath = blob_str(&path);
494
+ zPath = blob_str(&path);
492495
/* Handle various cases of existence of the directory */
493496
switch( file_isdir(zPath) ){
494497
case 0: { /* doesn't exist */
495498
if( file_mkdir(zPath, 0)!=0 ) {
496
- fossil_warning("couldn't create directory %s as required by empty-dirs setting", zDir);
499
+ fossil_warning("couldn't create directory %s as "
500
+ "required by empty-dirs setting", zDir);
497501
}
498502
break;
499503
}
500504
case 1: { /* exists, and is a directory */
501505
/* do nothing - required directory exists already */
502506
break;
503507
}
504508
case 2: { /* exists, but isn't a directory */
505
- fossil_warning("file %s found, but a directory is required by empty-dirs setting", zDir);
509
+ fossil_warning("file %s found, but a directory is required "
510
+ "by empty-dirs setting", zDir);
506511
}
507512
}
508513
blob_reset(&path);
509514
}
510515
}
511516
--- src/update.c
+++ src/update.c
@@ -463,48 +463,53 @@
463 }
464
465 /*
466 ** Make sure empty directories are created
467 */
468 void ensure_empty_dirs_created()
469 {
470 /* Make empty directories? */
471 char *zEmptyDirs = db_get_versionable_setting("empty-dirs", 0);
472 if( zEmptyDirs!=0 ){
 
 
473 Blob dirsList;
 
474 blob_zero(&dirsList);
475 blob_init(&dirsList, zEmptyDirs, strlen(zEmptyDirs));
476 /* Replace commas by spaces */
477 char *bc = blob_str(&dirsList);
478 while( (*bc)!='\0' ){
479 if( (*bc)==',' ) { *bc = ' '; }
480 ++bc;
481 }
482 /* Make directories */
483 Blob dirName;
484 blob_zero(&dirName);
485 while( blob_token(&dirsList, &dirName) ){
486 const char *zDir = blob_str(&dirName);
487 /* Make full pathname of the directory */
488 Blob path;
 
 
489 blob_zero(&path);
490 blob_appendf(&path, "%s/%s", g.zLocalRoot, zDir);
491 const char *zPath = blob_str(&path);
492 /* Handle various cases of existence of the directory */
493 switch( file_isdir(zPath) ){
494 case 0: { /* doesn't exist */
495 if( file_mkdir(zPath, 0)!=0 ) {
496 fossil_warning("couldn't create directory %s as required by empty-dirs setting", zDir);
 
497 }
498 break;
499 }
500 case 1: { /* exists, and is a directory */
501 /* do nothing - required directory exists already */
502 break;
503 }
504 case 2: { /* exists, but isn't a directory */
505 fossil_warning("file %s found, but a directory is required by empty-dirs setting", zDir);
 
506 }
507 }
508 blob_reset(&path);
509 }
510 }
511
--- src/update.c
+++ src/update.c
@@ -463,48 +463,53 @@
463 }
464
465 /*
466 ** Make sure empty directories are created
467 */
468 void ensure_empty_dirs_created(void){
 
469 /* Make empty directories? */
470 char *zEmptyDirs = db_get_versionable_setting("empty-dirs", 0);
471 if( zEmptyDirs!=0 ){
472 char *bc;
473 Blob dirName;
474 Blob dirsList;
475
476 blob_zero(&dirsList);
477 blob_init(&dirsList, zEmptyDirs, strlen(zEmptyDirs));
478 /* Replace commas by spaces */
479 bc = blob_str(&dirsList);
480 while( (*bc)!='\0' ){
481 if( (*bc)==',' ) { *bc = ' '; }
482 ++bc;
483 }
484 /* Make directories */
 
485 blob_zero(&dirName);
486 while( blob_token(&dirsList, &dirName) ){
487 const char *zDir = blob_str(&dirName);
488 /* Make full pathname of the directory */
489 Blob path;
490 const char *zPath;
491
492 blob_zero(&path);
493 blob_appendf(&path, "%s/%s", g.zLocalRoot, zDir);
494 zPath = blob_str(&path);
495 /* Handle various cases of existence of the directory */
496 switch( file_isdir(zPath) ){
497 case 0: { /* doesn't exist */
498 if( file_mkdir(zPath, 0)!=0 ) {
499 fossil_warning("couldn't create directory %s as "
500 "required by empty-dirs setting", zDir);
501 }
502 break;
503 }
504 case 1: { /* exists, and is a directory */
505 /* do nothing - required directory exists already */
506 break;
507 }
508 case 2: { /* exists, but isn't a directory */
509 fossil_warning("file %s found, but a directory is required "
510 "by empty-dirs setting", zDir);
511 }
512 }
513 blob_reset(&path);
514 }
515 }
516

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button