Fossil SCM
Improvements to "fossil patch alias" help, including putting that subcommand in alphabetical order with the rest. Enhance the patch_resolve_remote() subroutine so that it avoids a full-table scan of CONFIG.
Commit
e74de63bf7078261a1b0f9332dc855d948d6035e019b451810a8ce750b517924
Parent
49c35c8caa8bd86…
1 file changed
+16
-24
+16
-24
| --- src/patch.c | ||
| +++ src/patch.c | ||
| @@ -707,14 +707,14 @@ | ||
| 707 | 707 | ** |
| 708 | 708 | ** If a CONFIG table entry matching name='patch-alias:$zKey' is found, |
| 709 | 709 | ** the corresponding value is returned, else a fossil_strdup() of zKey |
| 710 | 710 | ** is returned. |
| 711 | 711 | */ |
| 712 | -static char * patch_resolve_remote(const char *zKey){ | |
| 713 | - char * zAlias = db_text(0, "SELECT value FROM config " | |
| 714 | - "WHERE name = 'patch-alias:' || %Q", | |
| 715 | - zKey); | |
| 712 | +static char *patch_resolve_remote(const char *zKey){ | |
| 713 | + char *zAlias = db_text(0, "SELECT value FROM config " | |
| 714 | + "WHERE name = 'patch-alias:%q'", | |
| 715 | + zKey); | |
| 716 | 716 | return zAlias ? zAlias : fossil_strdup(zKey); |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | /* |
| 720 | 720 | ** Create a FILE* that will execute the remote side of a push or pull |
| @@ -930,10 +930,22 @@ | ||
| 930 | 930 | ** This command is used to create, view, and apply Fossil binary patches. |
| 931 | 931 | ** A Fossil binary patch is a single (binary) file that captures all of the |
| 932 | 932 | ** uncommitted changes of a check-out. Use Fossil binary patches to transfer |
| 933 | 933 | ** proposed or incomplete changes between machines for testing or analysis. |
| 934 | 934 | ** |
| 935 | +** > fossil patch alias add|rm|ls|list ?ARGS? | |
| 936 | +** | |
| 937 | +** Manage remote-name aliases, which act as short-form | |
| 938 | +** equivalents to REMOTE-CHECKOUT strings. Aliases are local to | |
| 939 | +** a given repository and do not sync. Subcommands: | |
| 940 | +** | |
| 941 | +** ... add ALIAS REMOTE-CHECKOUT Add ALIAS as an alias | |
| 942 | +** for REMOTE-CHECKOUT. | |
| 943 | +** ... ls|list List all local aliases. | |
| 944 | +** ... rm ALIAS [ALIAS...] Remove named aliases | |
| 945 | +** ... rm --all Remove all aliases | |
| 946 | +** | |
| 935 | 947 | ** > fossil patch create [DIRECTORY] PATCHFILE |
| 936 | 948 | ** |
| 937 | 949 | ** Create a new binary patch in PATCHFILE that captures all uncommitted |
| 938 | 950 | ** changes in the check-out at DIRECTORY, or the current directory if |
| 939 | 951 | ** DIRECTORY is omitted. If PATCHFILE is "-" then the binary patch |
| @@ -1004,30 +1016,10 @@ | ||
| 1004 | 1016 | ** View a summary of the changes in the binary patch in PATCHFILE. |
| 1005 | 1017 | ** Use "fossil patch diff" for detailed patch content. |
| 1006 | 1018 | ** |
| 1007 | 1019 | ** -v|--verbose Show extra detail about the patch |
| 1008 | 1020 | ** |
| 1009 | -** > fossil patch alias add|rm|ls|list ?ARGS? | |
| 1010 | -** | |
| 1011 | -** Manage remote-name aliases, which act as short-form | |
| 1012 | -** equivalents to REMOTE-CHECKOUT strings. Aliases are local to | |
| 1013 | -** a given repository and do not sync. | |
| 1014 | -** | |
| 1015 | -** Subcommands: | |
| 1016 | -** | |
| 1017 | -** > add local-name REMOTE-CHECKOUT | |
| 1018 | -** | |
| 1019 | -** Add local-name as an alias for REMOTE-CHECKOUT. | |
| 1020 | -** | |
| 1021 | -** > ls|list | |
| 1022 | -** | |
| 1023 | -** List all local aliases. | |
| 1024 | -** | |
| 1025 | -** > rm [-all]| local-name [...local-nameN] | |
| 1026 | -** | |
| 1027 | -** Remove all aliases which match the given GLOB patterns, or | |
| 1028 | -** all aliases if -all is specified. | |
| 1029 | 1021 | */ |
| 1030 | 1022 | void patch_cmd(void){ |
| 1031 | 1023 | const char *zCmd; |
| 1032 | 1024 | size_t n; |
| 1033 | 1025 | if( g.argc<3 ){ |
| 1034 | 1026 |
| --- src/patch.c | |
| +++ src/patch.c | |
| @@ -707,14 +707,14 @@ | |
| 707 | ** |
| 708 | ** If a CONFIG table entry matching name='patch-alias:$zKey' is found, |
| 709 | ** the corresponding value is returned, else a fossil_strdup() of zKey |
| 710 | ** is returned. |
| 711 | */ |
| 712 | static char * patch_resolve_remote(const char *zKey){ |
| 713 | char * zAlias = db_text(0, "SELECT value FROM config " |
| 714 | "WHERE name = 'patch-alias:' || %Q", |
| 715 | zKey); |
| 716 | return zAlias ? zAlias : fossil_strdup(zKey); |
| 717 | } |
| 718 | |
| 719 | /* |
| 720 | ** Create a FILE* that will execute the remote side of a push or pull |
| @@ -930,10 +930,22 @@ | |
| 930 | ** This command is used to create, view, and apply Fossil binary patches. |
| 931 | ** A Fossil binary patch is a single (binary) file that captures all of the |
| 932 | ** uncommitted changes of a check-out. Use Fossil binary patches to transfer |
| 933 | ** proposed or incomplete changes between machines for testing or analysis. |
| 934 | ** |
| 935 | ** > fossil patch create [DIRECTORY] PATCHFILE |
| 936 | ** |
| 937 | ** Create a new binary patch in PATCHFILE that captures all uncommitted |
| 938 | ** changes in the check-out at DIRECTORY, or the current directory if |
| 939 | ** DIRECTORY is omitted. If PATCHFILE is "-" then the binary patch |
| @@ -1004,30 +1016,10 @@ | |
| 1004 | ** View a summary of the changes in the binary patch in PATCHFILE. |
| 1005 | ** Use "fossil patch diff" for detailed patch content. |
| 1006 | ** |
| 1007 | ** -v|--verbose Show extra detail about the patch |
| 1008 | ** |
| 1009 | ** > fossil patch alias add|rm|ls|list ?ARGS? |
| 1010 | ** |
| 1011 | ** Manage remote-name aliases, which act as short-form |
| 1012 | ** equivalents to REMOTE-CHECKOUT strings. Aliases are local to |
| 1013 | ** a given repository and do not sync. |
| 1014 | ** |
| 1015 | ** Subcommands: |
| 1016 | ** |
| 1017 | ** > add local-name REMOTE-CHECKOUT |
| 1018 | ** |
| 1019 | ** Add local-name as an alias for REMOTE-CHECKOUT. |
| 1020 | ** |
| 1021 | ** > ls|list |
| 1022 | ** |
| 1023 | ** List all local aliases. |
| 1024 | ** |
| 1025 | ** > rm [-all]| local-name [...local-nameN] |
| 1026 | ** |
| 1027 | ** Remove all aliases which match the given GLOB patterns, or |
| 1028 | ** all aliases if -all is specified. |
| 1029 | */ |
| 1030 | void patch_cmd(void){ |
| 1031 | const char *zCmd; |
| 1032 | size_t n; |
| 1033 | if( g.argc<3 ){ |
| 1034 |
| --- src/patch.c | |
| +++ src/patch.c | |
| @@ -707,14 +707,14 @@ | |
| 707 | ** |
| 708 | ** If a CONFIG table entry matching name='patch-alias:$zKey' is found, |
| 709 | ** the corresponding value is returned, else a fossil_strdup() of zKey |
| 710 | ** is returned. |
| 711 | */ |
| 712 | static char *patch_resolve_remote(const char *zKey){ |
| 713 | char *zAlias = db_text(0, "SELECT value FROM config " |
| 714 | "WHERE name = 'patch-alias:%q'", |
| 715 | zKey); |
| 716 | return zAlias ? zAlias : fossil_strdup(zKey); |
| 717 | } |
| 718 | |
| 719 | /* |
| 720 | ** Create a FILE* that will execute the remote side of a push or pull |
| @@ -930,10 +930,22 @@ | |
| 930 | ** This command is used to create, view, and apply Fossil binary patches. |
| 931 | ** A Fossil binary patch is a single (binary) file that captures all of the |
| 932 | ** uncommitted changes of a check-out. Use Fossil binary patches to transfer |
| 933 | ** proposed or incomplete changes between machines for testing or analysis. |
| 934 | ** |
| 935 | ** > fossil patch alias add|rm|ls|list ?ARGS? |
| 936 | ** |
| 937 | ** Manage remote-name aliases, which act as short-form |
| 938 | ** equivalents to REMOTE-CHECKOUT strings. Aliases are local to |
| 939 | ** a given repository and do not sync. Subcommands: |
| 940 | ** |
| 941 | ** ... add ALIAS REMOTE-CHECKOUT Add ALIAS as an alias |
| 942 | ** for REMOTE-CHECKOUT. |
| 943 | ** ... ls|list List all local aliases. |
| 944 | ** ... rm ALIAS [ALIAS...] Remove named aliases |
| 945 | ** ... rm --all Remove all aliases |
| 946 | ** |
| 947 | ** > fossil patch create [DIRECTORY] PATCHFILE |
| 948 | ** |
| 949 | ** Create a new binary patch in PATCHFILE that captures all uncommitted |
| 950 | ** changes in the check-out at DIRECTORY, or the current directory if |
| 951 | ** DIRECTORY is omitted. If PATCHFILE is "-" then the binary patch |
| @@ -1004,30 +1016,10 @@ | |
| 1016 | ** View a summary of the changes in the binary patch in PATCHFILE. |
| 1017 | ** Use "fossil patch diff" for detailed patch content. |
| 1018 | ** |
| 1019 | ** -v|--verbose Show extra detail about the patch |
| 1020 | ** |
| 1021 | */ |
| 1022 | void patch_cmd(void){ |
| 1023 | const char *zCmd; |
| 1024 | size_t n; |
| 1025 | if( g.argc<3 ){ |
| 1026 |