558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
|
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
|
+
+
|
**
** Make REF the new default URL, replacing the prior default.
** REF may be a URL or a NAME from a prior "add".
*/
void remote_url_cmd(void){
char *zUrl, *zArg;
int nArg;
int showPw;
db_find_and_open_repository(0, 0);
showPw = find_option("show-passwords",0,0)!=0;
/* We should be done with options.. */
verify_all_options();
/* 2021-10-25: A note about data structures.
**
** The remote URLs are stored in the CONFIG table. The URL is stored
|
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
|
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
|
-
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
|
db_multi_exec("DELETE FROM config WHERE name glob 'sync-pw:*'");
db_multi_exec("DELETE FROM config WHERE name = 'last-sync-pw'");
db_protect_pop();
db_commit_transaction();
return;
}
if( strncmp(zArg, "config-data", nArg)==0 ){
/* Undocumented command: "fossil remote config-data"
/* Undocumented command: "fossil remote config-data [-show-passwords]"
**
** Show the CONFIG table entries that relate to remembering remote URLs
*/
Stmt q;
int n;
sqlite3_create_function(g.db, "unobscure", 1, SQLITE_UTF8, &g.db,
db_obscure, 0, 0);
n = db_int(13,
"SELECT max(length(name))"
" FROM config"
" WHERE name GLOB 'sync-*:*'"
" OR name GLOB 'last-sync-*'"
" OR name GLOB 'parent-project-*'"
);
db_prepare(&q,
"SELECT name,"
" CASE WHEN name LIKE '%%sync-pw%%' OR name='parent-project-pw'"
" THEN printf('%%.*c',length(value),'*') ELSE value END"
" FROM config"
" WHERE name GLOB 'sync-*:*'"
" OR name GLOB 'last-sync-*'"
" OR name GLOB 'parent-project-*'"
" ORDER BY name LIKE '%%sync-pw%%' OR name='parent-project-pw', name"
"SELECT name,"
" CASE WHEN name NOT LIKE '%%sync-pw%%' AND name<>'parent-project-pw'"
" THEN value"
" WHEN %d THEN unobscure(value)"
" ELSE printf('%%.*c',length(value)/2-1,'*') END"
" FROM config"
" WHERE name GLOB 'sync-*:*'"
" OR name GLOB 'last-sync-*'"
" OR name GLOB 'parent-project-*'"
" ORDER BY name LIKE '%%sync-pw%%' OR name='parent-project-pw', name",
showPw
);
while( db_step(&q)==SQLITE_ROW ){
fossil_print("%-*s %s\n",
n, db_column_text(&q,0),
db_column_text(&q,1)
);
}
|