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.
Commit
2e8c5da0ab17f9e8ccad4b4fb34294687bd1b54e5aeec9fdbea89ff9c76d97fb
Parent
72d07a52c36c196…
1 file changed
+4
-4
+4
-4
| --- src/patch.c | ||
| +++ src/patch.c | ||
| @@ -697,11 +697,11 @@ | ||
| 697 | 697 | " FROM patch.chng, blob WHERE blob.uuid=patch.chng.hash" |
| 698 | 698 | " ORDER BY pathname" |
| 699 | 699 | ); |
| 700 | 700 | while( db_step(&q)==SQLITE_ROW ){ |
| 701 | 701 | 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); */ | |
| 703 | 703 | const char *zName = db_column_text(&q, 1); |
| 704 | 704 | int isBin1, isBin2; |
| 705 | 705 | Blob a, b; |
| 706 | 706 | if( db_column_type(&q,3)==SQLITE_NULL ){ |
| 707 | 707 | fossil_print("DELETE %s\n", zName); |
| @@ -803,11 +803,11 @@ | ||
| 803 | 803 | void patch_cmd(void){ |
| 804 | 804 | const char *zCmd; |
| 805 | 805 | size_t n; |
| 806 | 806 | if( g.argc<3 ){ |
| 807 | 807 | patch_usage: |
| 808 | - usage("apply|create|pull|push|view"); | |
| 808 | + usage("apply|create|diff|pull|push|view"); | |
| 809 | 809 | } |
| 810 | 810 | zCmd = g.argv[2]; |
| 811 | 811 | n = strlen(zCmd); |
| 812 | 812 | if( strncmp(zCmd, "apply", n)==0 ){ |
| 813 | 813 | char *zIn; |
| @@ -847,13 +847,13 @@ | ||
| 847 | 847 | if( find_option("verbose","v",0)!=0 ) diffFlags |= DIFF_VERBOSE; |
| 848 | 848 | if( zDiffCmd ){ |
| 849 | 849 | zBinGlob = diff_get_binary_glob(); |
| 850 | 850 | fIncludeBinary = diff_include_binary_files(); |
| 851 | 851 | } |
| 852 | - zIn = patch_find_patch_filename("apply"); | |
| 853 | - db_must_be_within_tree(); | |
| 852 | + db_find_and_open_repository(0, 0); | |
| 854 | 853 | verify_all_options(); |
| 854 | + zIn = patch_find_patch_filename("apply"); | |
| 855 | 855 | patch_attach(zIn, stdin); |
| 856 | 856 | patch_diff( zDiffCmd, zBinGlob, fIncludeBinary, diffFlags); |
| 857 | 857 | fossil_free(zIn); |
| 858 | 858 | }else |
| 859 | 859 | if( strncmp(zCmd, "pull", n)==0 ){ |
| 860 | 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|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 |