Fossil SCM
Place patch aliases in the vvar (checkout) table, not config (repo).
Commit
a10f55ba3ffded6720c1e3245a0ead43a27d78efd611db78165337474a9a0190
Parent
fe74b78eb1f14e4…
1 file changed
+7
-7
+7
-7
| --- src/patch.c | ||
| +++ src/patch.c | ||
| @@ -703,16 +703,16 @@ | ||
| 703 | 703 | |
| 704 | 704 | /* |
| 705 | 705 | ** Resolves a patch-command remote system name, accounting for patch |
| 706 | 706 | ** aliases. |
| 707 | 707 | ** |
| 708 | -** If a CONFIG table entry matching name='patch-alias:$zKey' is found, | |
| 708 | +** If a VVAR 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 | 712 | static char * patch_resolve_remote(const char *zKey){ |
| 713 | - char * zAlias = db_text(0, "SELECT value FROM config " | |
| 713 | + char * zAlias = db_text(0, "SELECT value FROM vvar " | |
| 714 | 714 | "WHERE name = 'patch-alias:' || %Q", |
| 715 | 715 | zKey); |
| 716 | 716 | return zAlias ? zAlias : fossil_strdup(zKey); |
| 717 | 717 | } |
| 718 | 718 | |
| @@ -1044,11 +1044,11 @@ | ||
| 1044 | 1044 | /* alias ls|list */ |
| 1045 | 1045 | Stmt q; |
| 1046 | 1046 | int nAlias = 0; |
| 1047 | 1047 | |
| 1048 | 1048 | verify_all_options(); |
| 1049 | - db_prepare(&q, "SELECT substr(name,13), value FROM config " | |
| 1049 | + db_prepare(&q, "SELECT substr(name,13), value FROM vvar " | |
| 1050 | 1050 | "WHERE name GLOB 'patch-alias:*' ORDER BY name"); |
| 1051 | 1051 | while( SQLITE_ROW==db_step(&q) ){ |
| 1052 | 1052 | const char *zName = db_column_text(&q, 0); |
| 1053 | 1053 | const char *zVal = db_column_text(&q, 1); |
| 1054 | 1054 | ++nAlias; |
| @@ -1063,12 +1063,12 @@ | ||
| 1063 | 1063 | verify_all_options(); |
| 1064 | 1064 | if( 6!=g.argc ){ |
| 1065 | 1065 | usage("alias add localName remote"); |
| 1066 | 1066 | } |
| 1067 | 1067 | db_unprotect(PROTECT_CONFIG); |
| 1068 | - db_multi_exec("REPLACE INTO config (name, value, mtime) " | |
| 1069 | - "VALUES ('patch-alias:%q', %Q, unixepoch())", | |
| 1068 | + db_multi_exec("REPLACE INTO vvar (name, value) " | |
| 1069 | + "VALUES ('patch-alias:%q', %Q)", | |
| 1070 | 1070 | g.argv[4], g.argv[5]); |
| 1071 | 1071 | db_protect_pop(); |
| 1072 | 1072 | }else if( 0==strcmp("rm", zArg) ){ |
| 1073 | 1073 | /* alias rm */ |
| 1074 | 1074 | const int fAll = 0!=find_option("all", 0, 0); |
| @@ -1076,15 +1076,15 @@ | ||
| 1076 | 1076 | if( g.argc<5 ){ |
| 1077 | 1077 | usage("alias rm [-all] [aliasGlob [...aliasGlobN]]"); |
| 1078 | 1078 | } |
| 1079 | 1079 | db_unprotect(PROTECT_CONFIG); |
| 1080 | 1080 | if( 0!=fAll ){ |
| 1081 | - db_multi_exec("DELETE FROM config WHERE name GLOB 'patch-alias:*'"); | |
| 1081 | + db_multi_exec("DELETE FROM vvar WHERE name GLOB 'patch-alias:*'"); | |
| 1082 | 1082 | }else{ |
| 1083 | 1083 | Stmt q; |
| 1084 | 1084 | int i; |
| 1085 | - db_prepare(&q, "DELETE FROM config WHERE name " | |
| 1085 | + db_prepare(&q, "DELETE FROM vvar WHERE name " | |
| 1086 | 1086 | "GLOB 'patch-alias:' || :pattern"); |
| 1087 | 1087 | for(i = 4; i < g.argc; ++i){ |
| 1088 | 1088 | db_bind_text(&q, ":pattern", g.argv[i]); |
| 1089 | 1089 | db_step(&q); |
| 1090 | 1090 | db_reset(&q); |
| 1091 | 1091 |
| --- src/patch.c | |
| +++ src/patch.c | |
| @@ -703,16 +703,16 @@ | |
| 703 | |
| 704 | /* |
| 705 | ** Resolves a patch-command remote system name, accounting for patch |
| 706 | ** aliases. |
| 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 | |
| @@ -1044,11 +1044,11 @@ | |
| 1044 | /* alias ls|list */ |
| 1045 | Stmt q; |
| 1046 | int nAlias = 0; |
| 1047 | |
| 1048 | verify_all_options(); |
| 1049 | db_prepare(&q, "SELECT substr(name,13), value FROM config " |
| 1050 | "WHERE name GLOB 'patch-alias:*' ORDER BY name"); |
| 1051 | while( SQLITE_ROW==db_step(&q) ){ |
| 1052 | const char *zName = db_column_text(&q, 0); |
| 1053 | const char *zVal = db_column_text(&q, 1); |
| 1054 | ++nAlias; |
| @@ -1063,12 +1063,12 @@ | |
| 1063 | verify_all_options(); |
| 1064 | if( 6!=g.argc ){ |
| 1065 | usage("alias add localName remote"); |
| 1066 | } |
| 1067 | db_unprotect(PROTECT_CONFIG); |
| 1068 | db_multi_exec("REPLACE INTO config (name, value, mtime) " |
| 1069 | "VALUES ('patch-alias:%q', %Q, unixepoch())", |
| 1070 | g.argv[4], g.argv[5]); |
| 1071 | db_protect_pop(); |
| 1072 | }else if( 0==strcmp("rm", zArg) ){ |
| 1073 | /* alias rm */ |
| 1074 | const int fAll = 0!=find_option("all", 0, 0); |
| @@ -1076,15 +1076,15 @@ | |
| 1076 | if( g.argc<5 ){ |
| 1077 | usage("alias rm [-all] [aliasGlob [...aliasGlobN]]"); |
| 1078 | } |
| 1079 | db_unprotect(PROTECT_CONFIG); |
| 1080 | if( 0!=fAll ){ |
| 1081 | db_multi_exec("DELETE FROM config WHERE name GLOB 'patch-alias:*'"); |
| 1082 | }else{ |
| 1083 | Stmt q; |
| 1084 | int i; |
| 1085 | db_prepare(&q, "DELETE FROM config WHERE name " |
| 1086 | "GLOB 'patch-alias:' || :pattern"); |
| 1087 | for(i = 4; i < g.argc; ++i){ |
| 1088 | db_bind_text(&q, ":pattern", g.argv[i]); |
| 1089 | db_step(&q); |
| 1090 | db_reset(&q); |
| 1091 |
| --- src/patch.c | |
| +++ src/patch.c | |
| @@ -703,16 +703,16 @@ | |
| 703 | |
| 704 | /* |
| 705 | ** Resolves a patch-command remote system name, accounting for patch |
| 706 | ** aliases. |
| 707 | ** |
| 708 | ** If a VVAR 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 vvar " |
| 714 | "WHERE name = 'patch-alias:' || %Q", |
| 715 | zKey); |
| 716 | return zAlias ? zAlias : fossil_strdup(zKey); |
| 717 | } |
| 718 | |
| @@ -1044,11 +1044,11 @@ | |
| 1044 | /* alias ls|list */ |
| 1045 | Stmt q; |
| 1046 | int nAlias = 0; |
| 1047 | |
| 1048 | verify_all_options(); |
| 1049 | db_prepare(&q, "SELECT substr(name,13), value FROM vvar " |
| 1050 | "WHERE name GLOB 'patch-alias:*' ORDER BY name"); |
| 1051 | while( SQLITE_ROW==db_step(&q) ){ |
| 1052 | const char *zName = db_column_text(&q, 0); |
| 1053 | const char *zVal = db_column_text(&q, 1); |
| 1054 | ++nAlias; |
| @@ -1063,12 +1063,12 @@ | |
| 1063 | verify_all_options(); |
| 1064 | if( 6!=g.argc ){ |
| 1065 | usage("alias add localName remote"); |
| 1066 | } |
| 1067 | db_unprotect(PROTECT_CONFIG); |
| 1068 | db_multi_exec("REPLACE INTO vvar (name, value) " |
| 1069 | "VALUES ('patch-alias:%q', %Q)", |
| 1070 | g.argv[4], g.argv[5]); |
| 1071 | db_protect_pop(); |
| 1072 | }else if( 0==strcmp("rm", zArg) ){ |
| 1073 | /* alias rm */ |
| 1074 | const int fAll = 0!=find_option("all", 0, 0); |
| @@ -1076,15 +1076,15 @@ | |
| 1076 | if( g.argc<5 ){ |
| 1077 | usage("alias rm [-all] [aliasGlob [...aliasGlobN]]"); |
| 1078 | } |
| 1079 | db_unprotect(PROTECT_CONFIG); |
| 1080 | if( 0!=fAll ){ |
| 1081 | db_multi_exec("DELETE FROM vvar WHERE name GLOB 'patch-alias:*'"); |
| 1082 | }else{ |
| 1083 | Stmt q; |
| 1084 | int i; |
| 1085 | db_prepare(&q, "DELETE FROM vvar WHERE name " |
| 1086 | "GLOB 'patch-alias:' || :pattern"); |
| 1087 | for(i = 4; i < g.argc; ++i){ |
| 1088 | db_bind_text(&q, ":pattern", g.argv[i]); |
| 1089 | db_step(&q); |
| 1090 | db_reset(&q); |
| 1091 |