Fossil SCM

Add the "repack" command as an alias for "rebuild --compress-only".

drh 2023-02-09 20:09 trunk
Commit dd6a88da09adf9dcdafdcda01385f039db054a2b276956c030e6b473c53ae836
--- src/allrepo.c
+++ src/allrepo.c
@@ -108,10 +108,12 @@
108108
**
109109
** rebuild Rebuild on all repositories. The command line options
110110
** supported by the rebuild command itself, if any are
111111
** present, are passed along verbatim. The --force and
112112
** --randomize options are not supported.
113
+**
114
+** repack Look for extra compression in all repositories.
113115
**
114116
** sync Run a "sync" on all repositories. Only the --verbose
115117
** and --unversioned and --share-links options are supported.
116118
**
117119
** set Run the "setting" or "set" commands on all
@@ -301,10 +303,12 @@
301303
}else if( fossil_strcmp(g.argv[3],"config-data")==0 ){
302304
zCmd = "remote config-data -R";
303305
}else{
304306
usage("remote ?config-data|list|ls?");
305307
}
308
+ }else if( fossil_strcmp(zCmd, "repack")==0 ){
309
+ zCmd = "repack";
306310
}else if( fossil_strcmp(zCmd, "setting")==0 ){
307311
zCmd = "setting -R";
308312
collect_argv(&extra, 3);
309313
}else if( fossil_strcmp(zCmd, "unset")==0 ){
310314
zCmd = "unset -R";
311315
--- src/allrepo.c
+++ src/allrepo.c
@@ -108,10 +108,12 @@
108 **
109 ** rebuild Rebuild on all repositories. The command line options
110 ** supported by the rebuild command itself, if any are
111 ** present, are passed along verbatim. The --force and
112 ** --randomize options are not supported.
 
 
113 **
114 ** sync Run a "sync" on all repositories. Only the --verbose
115 ** and --unversioned and --share-links options are supported.
116 **
117 ** set Run the "setting" or "set" commands on all
@@ -301,10 +303,12 @@
301 }else if( fossil_strcmp(g.argv[3],"config-data")==0 ){
302 zCmd = "remote config-data -R";
303 }else{
304 usage("remote ?config-data|list|ls?");
305 }
 
 
306 }else if( fossil_strcmp(zCmd, "setting")==0 ){
307 zCmd = "setting -R";
308 collect_argv(&extra, 3);
309 }else if( fossil_strcmp(zCmd, "unset")==0 ){
310 zCmd = "unset -R";
311
--- src/allrepo.c
+++ src/allrepo.c
@@ -108,10 +108,12 @@
108 **
109 ** rebuild Rebuild on all repositories. The command line options
110 ** supported by the rebuild command itself, if any are
111 ** present, are passed along verbatim. The --force and
112 ** --randomize options are not supported.
113 **
114 ** repack Look for extra compression in all repositories.
115 **
116 ** sync Run a "sync" on all repositories. Only the --verbose
117 ** and --unversioned and --share-links options are supported.
118 **
119 ** set Run the "setting" or "set" commands on all
@@ -301,10 +303,12 @@
303 }else if( fossil_strcmp(g.argv[3],"config-data")==0 ){
304 zCmd = "remote config-data -R";
305 }else{
306 usage("remote ?config-data|list|ls?");
307 }
308 }else if( fossil_strcmp(zCmd, "repack")==0 ){
309 zCmd = "repack";
310 }else if( fossil_strcmp(zCmd, "setting")==0 ){
311 zCmd = "setting -R";
312 collect_argv(&extra, 3);
313 }else if( fossil_strcmp(zCmd, "unset")==0 ){
314 zCmd = "unset -R";
315
+4 -2
--- src/clone.c
+++ src/clone.c
@@ -283,14 +283,16 @@
283283
if( !noCompress ){
284284
int nDelta = 0;
285285
i64 nByte;
286286
fossil_print("Extra delta compression... "); fflush(stdout);
287287
nByte = extra_deltification(&nDelta);
288
- if( nDelta ){
288
+ if( nDelta==1 ){
289
+ fossil_print("1 delta saves %,lld bytes\n", nByte);
290
+ }else if( nDelta>1 ){
289291
fossil_print("%d deltas save %,lld bytes\n", nDelta, nByte);
290292
}else{
291
- fossil_print("no extra compression found\n");
293
+ fossil_print("none found\n");
292294
}
293295
}
294296
db_end_transaction(0);
295297
fossil_print("Vacuuming the database... "); fflush(stdout);
296298
if( db_int(0, "PRAGMA page_count")>1000
297299
--- src/clone.c
+++ src/clone.c
@@ -283,14 +283,16 @@
283 if( !noCompress ){
284 int nDelta = 0;
285 i64 nByte;
286 fossil_print("Extra delta compression... "); fflush(stdout);
287 nByte = extra_deltification(&nDelta);
288 if( nDelta ){
 
 
289 fossil_print("%d deltas save %,lld bytes\n", nDelta, nByte);
290 }else{
291 fossil_print("no extra compression found\n");
292 }
293 }
294 db_end_transaction(0);
295 fossil_print("Vacuuming the database... "); fflush(stdout);
296 if( db_int(0, "PRAGMA page_count")>1000
297
--- src/clone.c
+++ src/clone.c
@@ -283,14 +283,16 @@
283 if( !noCompress ){
284 int nDelta = 0;
285 i64 nByte;
286 fossil_print("Extra delta compression... "); fflush(stdout);
287 nByte = extra_deltification(&nDelta);
288 if( nDelta==1 ){
289 fossil_print("1 delta saves %,lld bytes\n", nByte);
290 }else if( nDelta>1 ){
291 fossil_print("%d deltas save %,lld bytes\n", nDelta, nByte);
292 }else{
293 fossil_print("none found\n");
294 }
295 }
296 db_end_transaction(0);
297 fossil_print("Vacuuming the database... "); fflush(stdout);
298 if( db_int(0, "PRAGMA page_count")>1000
299
+38 -2
--- src/rebuild.c
+++ src/rebuild.c
@@ -591,10 +591,42 @@
591591
"DROP TABLE private_ckin;", TAG_PRIVATE
592592
);
593593
fix_private_blob_dependencies(0);
594594
}
595595
596
+/*
597
+** COMMAND: repack
598
+**
599
+** Usage: %fossil repack ?REPOSITORY?
600
+**
601
+** Perform extra delta-compression to try to minimize the size of the
602
+** repository. This command is simply a short-hand for:
603
+**
604
+** fossil rebuild --compress-only
605
+**
606
+** The name for this command is stolen from the "git repack" command that
607
+** does approximately the same thing in Git.
608
+*/
609
+void repack_command(void){
610
+ char *azNewArgv[5];
611
+ char **azOldArgv = g.argv;
612
+ verify_all_options();
613
+ if( g.argc!=2 && g.argc!=3 ){
614
+ usage("?REPOSITORY-FILENAME?");
615
+ }
616
+ azNewArgv[0] = g.argv[0];
617
+ azNewArgv[1] = "rebuild";
618
+ azNewArgv[2] = "--compress-only";
619
+ azNewArgv[3] = g.argv[2];
620
+ azNewArgv[4] = 0;
621
+ g.argc++;
622
+ g.argv = azNewArgv;
623
+ rebuild_database();
624
+ g.argc--;
625
+ g.argv = azOldArgv;
626
+}
627
+
596628
597629
/*
598630
** COMMAND: rebuild
599631
**
600632
** Usage: %fossil rebuild ?REPOSITORY? ?OPTIONS?
@@ -707,14 +739,18 @@
707739
i64 nByte = 0;
708740
int nDelta = 0;
709741
fossil_print("Extra delta compression... "); fflush(stdout);
710742
nByte = extra_deltification(&nDelta);
711743
if( nDelta>0 ){
712
- fossil_print("%d new deltas save %,lld bytes", nDelta, nByte);
744
+ if( nDelta==1 ){
745
+ fossil_print("1 new delta saves %,lld bytes", nByte);
746
+ }else{
747
+ fossil_print("%d new deltas save %,lld bytes", nDelta, nByte);
748
+ }
713749
runVacuum = 1;
714750
}else{
715
- fossil_print("no additional compression found");
751
+ fossil_print("none found");
716752
}
717753
fflush(stdout);
718754
}
719755
if( omitVerify ) verify_cancel();
720756
db_end_transaction(0);
721757
--- src/rebuild.c
+++ src/rebuild.c
@@ -591,10 +591,42 @@
591 "DROP TABLE private_ckin;", TAG_PRIVATE
592 );
593 fix_private_blob_dependencies(0);
594 }
595
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
596
597 /*
598 ** COMMAND: rebuild
599 **
600 ** Usage: %fossil rebuild ?REPOSITORY? ?OPTIONS?
@@ -707,14 +739,18 @@
707 i64 nByte = 0;
708 int nDelta = 0;
709 fossil_print("Extra delta compression... "); fflush(stdout);
710 nByte = extra_deltification(&nDelta);
711 if( nDelta>0 ){
712 fossil_print("%d new deltas save %,lld bytes", nDelta, nByte);
 
 
 
 
713 runVacuum = 1;
714 }else{
715 fossil_print("no additional compression found");
716 }
717 fflush(stdout);
718 }
719 if( omitVerify ) verify_cancel();
720 db_end_transaction(0);
721
--- src/rebuild.c
+++ src/rebuild.c
@@ -591,10 +591,42 @@
591 "DROP TABLE private_ckin;", TAG_PRIVATE
592 );
593 fix_private_blob_dependencies(0);
594 }
595
596 /*
597 ** COMMAND: repack
598 **
599 ** Usage: %fossil repack ?REPOSITORY?
600 **
601 ** Perform extra delta-compression to try to minimize the size of the
602 ** repository. This command is simply a short-hand for:
603 **
604 ** fossil rebuild --compress-only
605 **
606 ** The name for this command is stolen from the "git repack" command that
607 ** does approximately the same thing in Git.
608 */
609 void repack_command(void){
610 char *azNewArgv[5];
611 char **azOldArgv = g.argv;
612 verify_all_options();
613 if( g.argc!=2 && g.argc!=3 ){
614 usage("?REPOSITORY-FILENAME?");
615 }
616 azNewArgv[0] = g.argv[0];
617 azNewArgv[1] = "rebuild";
618 azNewArgv[2] = "--compress-only";
619 azNewArgv[3] = g.argv[2];
620 azNewArgv[4] = 0;
621 g.argc++;
622 g.argv = azNewArgv;
623 rebuild_database();
624 g.argc--;
625 g.argv = azOldArgv;
626 }
627
628
629 /*
630 ** COMMAND: rebuild
631 **
632 ** Usage: %fossil rebuild ?REPOSITORY? ?OPTIONS?
@@ -707,14 +739,18 @@
739 i64 nByte = 0;
740 int nDelta = 0;
741 fossil_print("Extra delta compression... "); fflush(stdout);
742 nByte = extra_deltification(&nDelta);
743 if( nDelta>0 ){
744 if( nDelta==1 ){
745 fossil_print("1 new delta saves %,lld bytes", nByte);
746 }else{
747 fossil_print("%d new deltas save %,lld bytes", nDelta, nByte);
748 }
749 runVacuum = 1;
750 }else{
751 fossil_print("none found");
752 }
753 fflush(stdout);
754 }
755 if( omitVerify ) verify_cancel();
756 db_end_transaction(0);
757

Keyboard Shortcuts

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