Fossil SCM

In the "fossil patch" command, miscellaneous code clean-up. Do not require an option check-out to run "fossil patch diff", though a -R REPO option is required if not in an open check-out. No error is given if the repository and the patch do not match - that needs to be fixed.

drh 2021-06-23 18:43 trunk
Commit 2e8c5da0ab17f9e8ccad4b4fb34294687bd1b54e5aeec9fdbea89ff9c76d97fb
1 file changed +4 -4
+4 -4
--- src/patch.c
+++ src/patch.c
@@ -697,11 +697,11 @@
697697
" FROM patch.chng, blob WHERE blob.uuid=patch.chng.hash"
698698
" ORDER BY pathname"
699699
);
700700
while( db_step(&q)==SQLITE_ROW ){
701701
int rid = db_column_int(&q, 0);
702
-// const char *zOrig = db_column_text(&q, 2);
702
+ /* const char *zOrig = db_column_text(&q, 2); */
703703
const char *zName = db_column_text(&q, 1);
704704
int isBin1, isBin2;
705705
Blob a, b;
706706
if( db_column_type(&q,3)==SQLITE_NULL ){
707707
fossil_print("DELETE %s\n", zName);
@@ -803,11 +803,11 @@
803803
void patch_cmd(void){
804804
const char *zCmd;
805805
size_t n;
806806
if( g.argc<3 ){
807807
patch_usage:
808
- usage("apply|create|pull|push|view");
808
+ usage("apply|create|diff|pull|push|view");
809809
}
810810
zCmd = g.argv[2];
811811
n = strlen(zCmd);
812812
if( strncmp(zCmd, "apply", n)==0 ){
813813
char *zIn;
@@ -847,13 +847,13 @@
847847
if( find_option("verbose","v",0)!=0 ) diffFlags |= DIFF_VERBOSE;
848848
if( zDiffCmd ){
849849
zBinGlob = diff_get_binary_glob();
850850
fIncludeBinary = diff_include_binary_files();
851851
}
852
- zIn = patch_find_patch_filename("apply");
853
- db_must_be_within_tree();
852
+ db_find_and_open_repository(0, 0);
854853
verify_all_options();
854
+ zIn = patch_find_patch_filename("apply");
855855
patch_attach(zIn, stdin);
856856
patch_diff( zDiffCmd, zBinGlob, fIncludeBinary, diffFlags);
857857
fossil_free(zIn);
858858
}else
859859
if( strncmp(zCmd, "pull", n)==0 ){
860860
--- src/patch.c
+++ src/patch.c
@@ -697,11 +697,11 @@
697 " FROM patch.chng, blob WHERE blob.uuid=patch.chng.hash"
698 " ORDER BY pathname"
699 );
700 while( db_step(&q)==SQLITE_ROW ){
701 int rid = db_column_int(&q, 0);
702 // const char *zOrig = db_column_text(&q, 2);
703 const char *zName = db_column_text(&q, 1);
704 int isBin1, isBin2;
705 Blob a, b;
706 if( db_column_type(&q,3)==SQLITE_NULL ){
707 fossil_print("DELETE %s\n", zName);
@@ -803,11 +803,11 @@
803 void patch_cmd(void){
804 const char *zCmd;
805 size_t n;
806 if( g.argc<3 ){
807 patch_usage:
808 usage("apply|create|pull|push|view");
809 }
810 zCmd = g.argv[2];
811 n = strlen(zCmd);
812 if( strncmp(zCmd, "apply", n)==0 ){
813 char *zIn;
@@ -847,13 +847,13 @@
847 if( find_option("verbose","v",0)!=0 ) diffFlags |= DIFF_VERBOSE;
848 if( zDiffCmd ){
849 zBinGlob = diff_get_binary_glob();
850 fIncludeBinary = diff_include_binary_files();
851 }
852 zIn = patch_find_patch_filename("apply");
853 db_must_be_within_tree();
854 verify_all_options();
 
855 patch_attach(zIn, stdin);
856 patch_diff( zDiffCmd, zBinGlob, fIncludeBinary, diffFlags);
857 fossil_free(zIn);
858 }else
859 if( strncmp(zCmd, "pull", n)==0 ){
860
--- src/patch.c
+++ src/patch.c
@@ -697,11 +697,11 @@
697 " FROM patch.chng, blob WHERE blob.uuid=patch.chng.hash"
698 " ORDER BY pathname"
699 );
700 while( db_step(&q)==SQLITE_ROW ){
701 int rid = db_column_int(&q, 0);
702 /* const char *zOrig = db_column_text(&q, 2); */
703 const char *zName = db_column_text(&q, 1);
704 int isBin1, isBin2;
705 Blob a, b;
706 if( db_column_type(&q,3)==SQLITE_NULL ){
707 fossil_print("DELETE %s\n", zName);
@@ -803,11 +803,11 @@
803 void patch_cmd(void){
804 const char *zCmd;
805 size_t n;
806 if( g.argc<3 ){
807 patch_usage:
808 usage("apply|create|diff|pull|push|view");
809 }
810 zCmd = g.argv[2];
811 n = strlen(zCmd);
812 if( strncmp(zCmd, "apply", n)==0 ){
813 char *zIn;
@@ -847,13 +847,13 @@
847 if( find_option("verbose","v",0)!=0 ) diffFlags |= DIFF_VERBOSE;
848 if( zDiffCmd ){
849 zBinGlob = diff_get_binary_glob();
850 fIncludeBinary = diff_include_binary_files();
851 }
852 db_find_and_open_repository(0, 0);
 
853 verify_all_options();
854 zIn = patch_find_patch_filename("apply");
855 patch_attach(zIn, stdin);
856 patch_diff( zDiffCmd, zBinGlob, fIncludeBinary, diffFlags);
857 fossil_free(zIn);
858 }else
859 if( strncmp(zCmd, "pull", n)==0 ){
860

Keyboard Shortcuts

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