Fossil SCM

Add [/help?cmd=forks|fossil forks], for finding all forks.

jan.nijtmans 2015-04-16 08:18 trunk
Commit e1ee31a95416d98f3ea427705e1efb614ab11de2
+1 -1
--- src/db.c
+++ src/db.c
@@ -1646,11 +1646,11 @@
16461646
verify_all_options();
16471647
16481648
if( g.argc!=3 ){
16491649
usage("REPOSITORY-NAME");
16501650
}
1651
-
1651
+
16521652
if( -1 != file_size(g.argv[2]) ){
16531653
fossil_fatal("file already exists: %s", g.argv[2]);
16541654
}
16551655
16561656
db_create_repository(g.argv[2]);
16571657
--- src/db.c
+++ src/db.c
@@ -1646,11 +1646,11 @@
1646 verify_all_options();
1647
1648 if( g.argc!=3 ){
1649 usage("REPOSITORY-NAME");
1650 }
1651
1652 if( -1 != file_size(g.argv[2]) ){
1653 fossil_fatal("file already exists: %s", g.argv[2]);
1654 }
1655
1656 db_create_repository(g.argv[2]);
1657
--- src/db.c
+++ src/db.c
@@ -1646,11 +1646,11 @@
1646 verify_all_options();
1647
1648 if( g.argc!=3 ){
1649 usage("REPOSITORY-NAME");
1650 }
1651
1652 if( -1 != file_size(g.argv[2]) ){
1653 fossil_fatal("file already exists: %s", g.argv[2]);
1654 }
1655
1656 db_create_repository(g.argv[2]);
1657
+19 -15
--- src/descendants.c
+++ src/descendants.c
@@ -340,14 +340,15 @@
340340
db_finalize(&q);
341341
}
342342
343343
/*
344344
** COMMAND: leaves*
345
+** COMMAND: forks*
345346
**
346
-** Usage: %fossil leaves ?OPTIONS?
347
+** Usage: %fossil leaves|forks ?OPTIONS?
347348
**
348
-** Find leaves of all branches. By default show only open leaves.
349
+** Find leaves/forks of all branches. By default show only open leaves.
349350
** The -a|--all flag causes all leaves (closed and open) to be shown.
350351
** The -c|--closed flag shows only closed leaves.
351352
**
352353
** The --recompute flag causes the content of the "leaf" table in the
353354
** repository database to be recomputed.
@@ -368,10 +369,11 @@
368369
Blob sql;
369370
int showAll = find_option("all", "a", 0)!=0;
370371
int showClosed = find_option("closed", "c", 0)!=0;
371372
int recomputeFlag = find_option("recompute",0,0)!=0;
372373
int byBranch = find_option("bybranch",0,0)!=0;
374
+ int showForks = g.argv[1][0]=='f';
373375
const char *zWidth = find_option("width","W",1);
374376
char *zLastBr = 0;
375377
int n, width;
376378
char zLineNo[10];
377379
@@ -382,21 +384,21 @@
382384
}
383385
}else{
384386
width = -1;
385387
}
386388
db_find_and_open_repository(0,0);
387
-
389
+
388390
/* We should be done with options.. */
389391
verify_all_options();
390392
391393
if( recomputeFlag ) leaf_rebuild();
392394
blob_zero(&sql);
393395
blob_append(&sql, timeline_query_for_tty(), -1);
394396
blob_append_sql(&sql, " AND blob.rid IN leaf");
395397
if( showClosed ){
396398
blob_append_sql(&sql," AND %z", leaf_is_closed_sql("blob.rid"));
397
- }else if( !showAll ){
399
+ }else if( !showAll || showForks ){
398400
blob_append_sql(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid"));
399401
}
400402
if( byBranch ){
401403
db_prepare(&q, "%s ORDER BY nullif(branch,'trunk') COLLATE nocase,"
402404
" event.mtime DESC",
@@ -411,21 +413,23 @@
411413
const char *zDate = db_column_text(&q, 2);
412414
const char *zCom = db_column_text(&q, 3);
413415
const char *zBr = db_column_text(&q, 7);
414416
char *z;
415417
416
- if( byBranch && fossil_strcmp(zBr, zLastBr)!=0 ){
417
- fossil_print("*** %s ***\n", zBr);
418
- fossil_free(zLastBr);
419
- zLastBr = fossil_strdup(zBr);
420
- }
421
- n++;
422
- sqlite3_snprintf(sizeof(zLineNo), zLineNo, "(%d)", n);
423
- fossil_print("%6s ", zLineNo);
424
- z = mprintf("%s [%S] %s", zDate, zId, zCom);
425
- comment_print(z, zCom, 7, width, g.comFmtFlags);
426
- fossil_free(z);
418
+ if( !showForks || fossil_find_nearest_fork(db_column_int(&q, 0)) ){
419
+ if( byBranch && fossil_strcmp(zBr, zLastBr)!=0 ){
420
+ fossil_print("*** %s ***\n", zBr);
421
+ fossil_free(zLastBr);
422
+ zLastBr = fossil_strdup(zBr);
423
+ }
424
+ n++;
425
+ sqlite3_snprintf(sizeof(zLineNo), zLineNo, "(%d)", n);
426
+ fossil_print("%6s ", zLineNo);
427
+ z = mprintf("%s [%S] %s", zDate, zId, zCom);
428
+ comment_print(z, zCom, 7, width, g.comFmtFlags);
429
+ fossil_free(z);
430
+ }
427431
}
428432
fossil_free(zLastBr);
429433
db_finalize(&q);
430434
}
431435
432436
--- src/descendants.c
+++ src/descendants.c
@@ -340,14 +340,15 @@
340 db_finalize(&q);
341 }
342
343 /*
344 ** COMMAND: leaves*
 
345 **
346 ** Usage: %fossil leaves ?OPTIONS?
347 **
348 ** Find leaves of all branches. By default show only open leaves.
349 ** The -a|--all flag causes all leaves (closed and open) to be shown.
350 ** The -c|--closed flag shows only closed leaves.
351 **
352 ** The --recompute flag causes the content of the "leaf" table in the
353 ** repository database to be recomputed.
@@ -368,10 +369,11 @@
368 Blob sql;
369 int showAll = find_option("all", "a", 0)!=0;
370 int showClosed = find_option("closed", "c", 0)!=0;
371 int recomputeFlag = find_option("recompute",0,0)!=0;
372 int byBranch = find_option("bybranch",0,0)!=0;
 
373 const char *zWidth = find_option("width","W",1);
374 char *zLastBr = 0;
375 int n, width;
376 char zLineNo[10];
377
@@ -382,21 +384,21 @@
382 }
383 }else{
384 width = -1;
385 }
386 db_find_and_open_repository(0,0);
387
388 /* We should be done with options.. */
389 verify_all_options();
390
391 if( recomputeFlag ) leaf_rebuild();
392 blob_zero(&sql);
393 blob_append(&sql, timeline_query_for_tty(), -1);
394 blob_append_sql(&sql, " AND blob.rid IN leaf");
395 if( showClosed ){
396 blob_append_sql(&sql," AND %z", leaf_is_closed_sql("blob.rid"));
397 }else if( !showAll ){
398 blob_append_sql(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid"));
399 }
400 if( byBranch ){
401 db_prepare(&q, "%s ORDER BY nullif(branch,'trunk') COLLATE nocase,"
402 " event.mtime DESC",
@@ -411,21 +413,23 @@
411 const char *zDate = db_column_text(&q, 2);
412 const char *zCom = db_column_text(&q, 3);
413 const char *zBr = db_column_text(&q, 7);
414 char *z;
415
416 if( byBranch && fossil_strcmp(zBr, zLastBr)!=0 ){
417 fossil_print("*** %s ***\n", zBr);
418 fossil_free(zLastBr);
419 zLastBr = fossil_strdup(zBr);
420 }
421 n++;
422 sqlite3_snprintf(sizeof(zLineNo), zLineNo, "(%d)", n);
423 fossil_print("%6s ", zLineNo);
424 z = mprintf("%s [%S] %s", zDate, zId, zCom);
425 comment_print(z, zCom, 7, width, g.comFmtFlags);
426 fossil_free(z);
 
 
427 }
428 fossil_free(zLastBr);
429 db_finalize(&q);
430 }
431
432
--- src/descendants.c
+++ src/descendants.c
@@ -340,14 +340,15 @@
340 db_finalize(&q);
341 }
342
343 /*
344 ** COMMAND: leaves*
345 ** COMMAND: forks*
346 **
347 ** Usage: %fossil leaves|forks ?OPTIONS?
348 **
349 ** Find leaves/forks of all branches. By default show only open leaves.
350 ** The -a|--all flag causes all leaves (closed and open) to be shown.
351 ** The -c|--closed flag shows only closed leaves.
352 **
353 ** The --recompute flag causes the content of the "leaf" table in the
354 ** repository database to be recomputed.
@@ -368,10 +369,11 @@
369 Blob sql;
370 int showAll = find_option("all", "a", 0)!=0;
371 int showClosed = find_option("closed", "c", 0)!=0;
372 int recomputeFlag = find_option("recompute",0,0)!=0;
373 int byBranch = find_option("bybranch",0,0)!=0;
374 int showForks = g.argv[1][0]=='f';
375 const char *zWidth = find_option("width","W",1);
376 char *zLastBr = 0;
377 int n, width;
378 char zLineNo[10];
379
@@ -382,21 +384,21 @@
384 }
385 }else{
386 width = -1;
387 }
388 db_find_and_open_repository(0,0);
389
390 /* We should be done with options.. */
391 verify_all_options();
392
393 if( recomputeFlag ) leaf_rebuild();
394 blob_zero(&sql);
395 blob_append(&sql, timeline_query_for_tty(), -1);
396 blob_append_sql(&sql, " AND blob.rid IN leaf");
397 if( showClosed ){
398 blob_append_sql(&sql," AND %z", leaf_is_closed_sql("blob.rid"));
399 }else if( !showAll || showForks ){
400 blob_append_sql(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid"));
401 }
402 if( byBranch ){
403 db_prepare(&q, "%s ORDER BY nullif(branch,'trunk') COLLATE nocase,"
404 " event.mtime DESC",
@@ -411,21 +413,23 @@
413 const char *zDate = db_column_text(&q, 2);
414 const char *zCom = db_column_text(&q, 3);
415 const char *zBr = db_column_text(&q, 7);
416 char *z;
417
418 if( !showForks || fossil_find_nearest_fork(db_column_int(&q, 0)) ){
419 if( byBranch && fossil_strcmp(zBr, zLastBr)!=0 ){
420 fossil_print("*** %s ***\n", zBr);
421 fossil_free(zLastBr);
422 zLastBr = fossil_strdup(zBr);
423 }
424 n++;
425 sqlite3_snprintf(sizeof(zLineNo), zLineNo, "(%d)", n);
426 fossil_print("%6s ", zLineNo);
427 z = mprintf("%s [%S] %s", zDate, zId, zCom);
428 comment_print(z, zCom, 7, width, g.comFmtFlags);
429 fossil_free(z);
430 }
431 }
432 fossil_free(zLastBr);
433 db_finalize(&q);
434 }
435
436
--- www/changes.wiki
+++ www/changes.wiki
@@ -11,10 +11,11 @@
1111
or HTML.
1212
* Formally translate TH1 to Tcl return codes and vice-versa, where
1313
necessary, in the Tcl integration subsystem.
1414
* Better fork detection on [/help?cmd=import|fossil update],
1515
[/help?cmd=import|fossil status] and related commands.
16
+ * Add [/help?cmd=forks|fossil forks], for finding all forks.
1617
1718
<h2>Changes for Version 1.32 (2015-03-14)</h2>
1819
* When creating a new repository using [/help?cmd=init|fossil init], ensure
1920
that the new repository is fully compatible with historical versions of
2021
Fossil by having a valid manifest as RID 1.
2122
--- www/changes.wiki
+++ www/changes.wiki
@@ -11,10 +11,11 @@
11 or HTML.
12 * Formally translate TH1 to Tcl return codes and vice-versa, where
13 necessary, in the Tcl integration subsystem.
14 * Better fork detection on [/help?cmd=import|fossil update],
15 [/help?cmd=import|fossil status] and related commands.
 
16
17 <h2>Changes for Version 1.32 (2015-03-14)</h2>
18 * When creating a new repository using [/help?cmd=init|fossil init], ensure
19 that the new repository is fully compatible with historical versions of
20 Fossil by having a valid manifest as RID 1.
21
--- www/changes.wiki
+++ www/changes.wiki
@@ -11,10 +11,11 @@
11 or HTML.
12 * Formally translate TH1 to Tcl return codes and vice-versa, where
13 necessary, in the Tcl integration subsystem.
14 * Better fork detection on [/help?cmd=import|fossil update],
15 [/help?cmd=import|fossil status] and related commands.
16 * Add [/help?cmd=forks|fossil forks], for finding all forks.
17
18 <h2>Changes for Version 1.32 (2015-03-14)</h2>
19 * When creating a new repository using [/help?cmd=init|fossil init], ensure
20 that the new repository is fully compatible with historical versions of
21 Fossil by having a valid manifest as RID 1.
22

Keyboard Shortcuts

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