505
506
507
508
509
510
511
512
513
514
515
516
517
518
|
** entry in the repository that is associated with the remote URL store.
** Passwords are obscured in the output.
**
** > fossil remote delete NAME
**
** Delete a named URL previously created by the "add" subcommand.
**
** > fossil remote list|ls
**
** Show all remote repository URLs.
**
** > fossil remote off
**
** Forget the default URL. This disables autosync.
|
>
>
>
>
>
>
>
>
|
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
|
** entry in the repository that is associated with the remote URL store.
** Passwords are obscured in the output.
**
** > fossil remote delete NAME
**
** Delete a named URL previously created by the "add" subcommand.
**
** > fossil remote hyperlink ?FILENAME? ?LINENUM? ?LINENUM?
**
** Print a URL that will access the current checkout on the remote
** repository. Or if the FILENAME argument is included, print the
** URL to access that particular file within the current checkout.
** If one or two linenumber arguments are provided after the filename,
** then the URL is for the line or range of lines specified.
**
** > fossil remote list|ls
**
** Show all remote repository URLs.
**
** > fossil remote off
**
** Forget the default URL. This disables autosync.
|
530
531
532
533
534
535
536
537
538
539
540
541
542
543
|
**
** > fossil remote scrub
**
** Forget any saved passwords for remote repositories, but continue
** to remember the URLs themselves. You will be prompted for the
** password the next time it is needed.
**
** > fossil remote REF
**
** 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;
|
>
>
>
>
>
>
>
>
>
|
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
|
**
** > fossil remote scrub
**
** Forget any saved passwords for remote repositories, but continue
** to remember the URLs themselves. You will be prompted for the
** password the next time it is needed.
**
** > fossil remote ui ?FILENAME? ?LINENUM? ?LINENUM?
**
** Bring up a web browser pointing at the remote repository, and
** specifically to the page that describes the current checkout
** on that remote repository. Or if FILENAME and/or LINENUM arguments
** are provided, to the specific file and range of lines. This
** command is similar to "fossil remote hyperlink" except that instead
** of printing the URL, it passes the URL off to the web browser.
**
** > fossil remote REF
**
** 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;
|
649
650
651
652
653
654
655
656
657
658
659
660
661
662
|
db_begin_write();
db_unprotect(PROTECT_CONFIG);
db_multi_exec("DELETE FROM config WHERE name glob 'sync-url:%q'", zName);
db_multi_exec("DELETE FROM config WHERE name glob 'sync-pw:%q'", zName);
db_protect_pop();
db_commit_transaction();
return;
}
if( strncmp(zArg, "scrub", nArg)==0 ){
if( g.argc!=3 ) usage("scrub");
db_begin_write();
db_unprotect(PROTECT_CONFIG);
db_multi_exec("DELETE FROM config WHERE name glob 'sync-pw:*'");
db_multi_exec("DELETE FROM config WHERE name = 'last-sync-pw'");
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
|
db_begin_write();
db_unprotect(PROTECT_CONFIG);
db_multi_exec("DELETE FROM config WHERE name glob 'sync-url:%q'", zName);
db_multi_exec("DELETE FROM config WHERE name glob 'sync-pw:%q'", zName);
db_protect_pop();
db_commit_transaction();
return;
}
if( strncmp(zArg, "hyperlink", nArg)==0
|| (nArg==2 && strcmp(zArg, "ui")==0)
){
char *zBase;
char *zUuid;
Blob fname;
Blob url;
char *zSubCmd = g.argv[2][0]=='u' ? "ui" : "hyperlink";
if( !db_table_exists("localdb","vvar") ){
fossil_fatal("the \"remote %s\" command only works from "
"within an open check-out", zSubCmd);
}
zUrl = db_get("last-sync-url", 0);
if( zUrl==0 ){
zUrl = "http://localhost:8080/";
}
url_parse(zUrl, 0);
if( g.url.isFile ){
url_parse("http://localhost:8080/", 0);
}
zBase = url_nouser(&g.url);
blob_init(&url, 0, 0);
if( g.argc==3 ){
blob_appendf(&url, "%s/info/%!S\n",
zBase,
db_text("???",
"SELECT uuid FROM blob, vvar"
" WHERE blob.rid=0+vvar.value"
" AND vvar.name='checkout';"
));
}else{
blob_init(&fname, 0, 0);
file_tree_name(g.argv[3], &fname, 0, 1);
zUuid = db_text(0,
"SELECT uuid FROM files_of_checkin"
" WHERE checkinID=(SELECT value FROM vvar WHERE name='checkout')"
" AND filename=%Q",
blob_str(&fname)
);
if( zUuid==0 ){
fossil_fatal("not a managed file: \"%s\"", g.argv[3]);
}
blob_appendf(&url, "%s/info/%S",zBase,zUuid);
if( g.argc>4 ){
int ln1 = atoi(g.argv[4]);
if( ln1<=0 || sqlite3_strglob("*[^0-9]*",g.argv[4])==0 ){
fossil_fatal("\"%s\" is not a valid line number", g.argv[4]);
}
if( g.argc>5 ){
int ln2 = atoi(g.argv[5]);
if( ln2==0 || sqlite3_strglob("*[^0-9]*",g.argv[5])==0 ){
fossil_fatal("\"%s\" is not a valid line number", g.argv[5]);
}
if( ln2<=ln1 ){
fossil_fatal("second line number should be greater than the first");
}
blob_appendf(&url,"?ln=%d,%d", ln1, ln2);
}else{
blob_appendf(&url,"?ln=%d", ln1);
}
}
if( g.argc>6 ){
usage(mprintf("%s ?FILENAME? ?LINENUMBER? ?LINENUMBER?", zSubCmd));
}
}
if( g.argv[2][0]=='u' ){
char *zCmd;
zCmd = mprintf("%s %!$ &", fossil_web_browser(), blob_str(&url));
fossil_system(zCmd);
}else{
fossil_print("%s\n", blob_str(&url));
}
return;
}
if( strncmp(zArg, "scrub", nArg)==0 ){
if( g.argc!=3 ) usage("scrub");
db_begin_write();
db_unprotect(PROTECT_CONFIG);
db_multi_exec("DELETE FROM config WHERE name glob 'sync-pw:*'");
db_multi_exec("DELETE FROM config WHERE name = 'last-sync-pw'");
|
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
|
db_unset("last-sync-pw", 0);
url_parse(g.argv[2], URL_REMEMBER|URL_PROMPT_PW|
URL_USE_CONFIG|URL_ASK_REMEMBER_PW);
url_remember();
return;
}
fossil_fatal("unknown command \"%s\" - should be a URL or one of: "
"add delete list off", zArg);
}
/*
** COMMAND: backup*
**
** Usage: %fossil backup ?OPTIONS? FILE|DIRECTORY
**
|
|
|
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
|
db_unset("last-sync-pw", 0);
url_parse(g.argv[2], URL_REMEMBER|URL_PROMPT_PW|
URL_USE_CONFIG|URL_ASK_REMEMBER_PW);
url_remember();
return;
}
fossil_fatal("unknown command \"%s\" - should be a URL or one of: "
"add delete hyperlink list off scrub", zArg);
}
/*
** COMMAND: backup*
**
** Usage: %fossil backup ?OPTIONS? FILE|DIRECTORY
**
|