Fossil

Check-in [4e683ef0]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add the ability to modify global settings (such as the proxy setting) even when there are no repositories defined.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4e683ef07b04f5f27ab860c8737fb8b92975ac54
User & Date: drh 2008-05-05 17:24:38.000
Context
2008-05-05
17:30
Honor the http_proxy environment variable as another source for the URL of the HTTP proxy if the "proxy" setting is undefined or is "off". ... (check-in: 387cbeda user: drh tags: trunk)
17:24
Add the ability to modify global settings (such as the proxy setting) even when there are no repositories defined. ... (check-in: 4e683ef0 user: drh tags: trunk)
2008-05-01
22:49
Enable proxy support using the "fossil setting proxy" command. This check-in is made using a proxy. ... (check-in: 676fdd08 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/branch.c.
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
**    %fossil branch list
**
**        List all branches
**
*/
void branch_cmd(void){
  int n;
  db_find_and_open_repository();
  if( g.argc<3 ){
    usage("new|list ...");
  }
  n = strlen(g.argv[2]);
  if( n>=2 && strncmp(g.argv[2],"new",n)==0 ){
    branch_new();
  }else if( n>=2 && strncmp(g.argv[2],"list",n)==0 ){







|







174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
**    %fossil branch list
**
**        List all branches
**
*/
void branch_cmd(void){
  int n;
  db_find_and_open_repository(1);
  if( g.argc<3 ){
    usage("new|list ...");
  }
  n = strlen(g.argv[2]);
  if( n>=2 && strncmp(g.argv[2],"new",n)==0 ){
    branch_new();
  }else if( n>=2 && strncmp(g.argv[2],"list",n)==0 ){
Changes to src/construct.c.
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
void deconstruct_cmd(void){
  const char* zDestination;
  Blob zOut;
  Stmt q;
  if( (g.argc != 3) && (g.argc != 5) ){
    usage ("?-R|--repository REPOSITORY? DESTINATION");
  }
  db_find_and_open_repository ();
  zDestination = g.argv[g.argc-1];
  if( !file_isdir (zDestination) ){
    fossil_panic("not a directory: %s", zDestination);
  }
  /* Iterate over all blobs in the repository, retrieve their
   * contents, and write them to a file with a name based on their
   * uuid. Note: Non-writable destination causes bail-out in the first







|







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
void deconstruct_cmd(void){
  const char* zDestination;
  Blob zOut;
  Stmt q;
  if( (g.argc != 3) && (g.argc != 5) ){
    usage ("?-R|--repository REPOSITORY? DESTINATION");
  }
  db_find_and_open_repository(1);
  zDestination = g.argv[g.argc-1];
  if( !file_isdir (zDestination) ){
    fossil_panic("not a directory: %s", zDestination);
  }
  /* Iterate over all blobs in the repository, retrieve their
   * contents, and write them to a file with a name based on their
   * uuid. Note: Non-writable destination causes bail-out in the first
Changes to src/db.c.
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
/*
** Try to find the repository and open it.  Use the -R or --repository
** option to locate the repository.  If no such option is available, then
** use the repository of the open checkout if there is one.
**
** Error out if the repository cannot be opened.
*/
void db_find_and_open_repository(void){
  const char *zRep = find_option("repository", "R", 1);
  if( zRep==0 ){
    if( db_open_local()==0 ){
      goto rep_not_found;
    }
    zRep = db_lget("repository", 0);
    if( zRep==0 ){
      goto rep_not_found;
    }
  }
  db_open_repository(zRep);
  if( g.repositoryOpen ){
    return;
  }
rep_not_found:

  fossil_fatal("use --repository or -R to specific the repository database");

}

/*
** Open the local database.  If unable, exit with an error.
*/
void db_must_be_within_tree(void){
  if( db_open_local()==0 ){







|















>
|
>







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
/*
** Try to find the repository and open it.  Use the -R or --repository
** option to locate the repository.  If no such option is available, then
** use the repository of the open checkout if there is one.
**
** Error out if the repository cannot be opened.
*/
void db_find_and_open_repository(int errIfNotFound){
  const char *zRep = find_option("repository", "R", 1);
  if( zRep==0 ){
    if( db_open_local()==0 ){
      goto rep_not_found;
    }
    zRep = db_lget("repository", 0);
    if( zRep==0 ){
      goto rep_not_found;
    }
  }
  db_open_repository(zRep);
  if( g.repositoryOpen ){
    return;
  }
rep_not_found:
  if( errIfNotFound ){
    fossil_fatal("use --repository or -R to specific the repository database");
  }
}

/*
** Open the local database.  If unable, exit with an error.
*/
void db_must_be_within_tree(void){
  if( db_open_local()==0 ){
1034
1035
1036
1037
1038
1039
1040

1041
1042
1043
1044
1045
1046






1047
1048
1049
1050
1051
1052
1053
}

/*
** Print the value of a setting named zName
*/
static void print_setting(const char *zName){
  Stmt q;

  db_prepare(&q,
     "SELECT '(local)', value FROM config WHERE name=%Q"
     " UNION ALL "
     "SELECT '(global)', value FROM global_config WHERE name=%Q",
     zName, zName
  );






  if( db_step(&q)==SQLITE_ROW ){
    printf("%-20s %-8s %s\n", zName, db_column_text(&q, 0),
        db_column_text(&q, 1));
  }else{
    printf("%-20s\n", zName);
  }
  db_finalize(&q);







>
|
|
|
|
|
|
>
>
>
>
>
>







1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
}

/*
** Print the value of a setting named zName
*/
static void print_setting(const char *zName){
  Stmt q;
  if( g.repositoryOpen ){
    db_prepare(&q,
       "SELECT '(local)', value FROM config WHERE name=%Q"
       " UNION ALL "
       "SELECT '(global)', value FROM global_config WHERE name=%Q",
       zName, zName
    );
  }else{
    db_prepare(&q,
      "SELECT '(global)', value FROM global_config WHERE name=%Q",
      zName
    );
  }
  if( db_step(&q)==SQLITE_ROW ){
    printf("%-20s %-8s %s\n", zName, db_column_text(&q, 0),
        db_column_text(&q, 1));
  }else{
    printf("%-20s\n", zName);
  }
  db_finalize(&q);
1096
1097
1098
1099
1100
1101
1102
1103




1104
1105
1106
1107
1108
1109
1110
    "omitsign",
    "proxy",
    "diff-command",
    "gdiff-command",
  };
  int i;
  int globalFlag = find_option("global","g",0)!=0;
  db_find_and_open_repository();




  if( g.argc==2 ){
    for(i=0; i<sizeof(azName)/sizeof(azName[0]); i++){
      print_setting(azName[i]);
    }
  }else if( g.argc==3 || g.argc==4 ){
    const char *zName = g.argv[2];
    int n = strlen(zName);







|
>
>
>
>







1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
    "omitsign",
    "proxy",
    "diff-command",
    "gdiff-command",
  };
  int i;
  int globalFlag = find_option("global","g",0)!=0;
  db_find_and_open_repository(0);
  if( !g.repositoryOpen ){
    db_open_config();
    globalFlag = 1;
  }
  if( g.argc==2 ){
    for(i=0; i<sizeof(azName)/sizeof(azName[0]); i++){
      print_setting(azName[i]);
    }
  }else if( g.argc==3 || g.argc==4 ){
    const char *zName = g.argv[2];
    int n = strlen(zName);
Changes to src/sync.c.
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
** This routine processes the command-line argument for push, pull,
** and sync.  If a command-line argument is given, that is the URL
** of a server to sync against.  If no argument is given, use the
** most recently synced URL.  Remember the current URL for next time.
*/
static void process_sync_args(void){
  const char *zUrl = 0;
  db_find_and_open_repository();
  if( g.argc==2 ){
    zUrl = db_get("last-sync-url", 0);
  }else if( g.argc==3 ){
    zUrl = g.argv[2];
  }
  if( zUrl==0 ){
    usage("URL");







|







69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
** This routine processes the command-line argument for push, pull,
** and sync.  If a command-line argument is given, that is the URL
** of a server to sync against.  If no argument is given, use the
** most recently synced URL.  Remember the current URL for next time.
*/
static void process_sync_args(void){
  const char *zUrl = 0;
  db_find_and_open_repository(1);
  if( g.argc==2 ){
    zUrl = db_get("last-sync-url", 0);
  }else if( g.argc==3 ){
    zUrl = g.argv[2];
  }
  if( zUrl==0 ){
    usage("URL");
Changes to src/tag.c.
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
**     %fossil tag list ?UUID?
**
**         List all tags, or if UUID is supplied, list
**         all tags and their values for UUID.
*/
void tag_cmd(void){
  int n;
  db_find_and_open_repository();
  if( g.argc<3 ){
    goto tag_cmd_usage;
  }
  n = strlen(g.argv[2]);
  if( n==0 ){
    goto tag_cmd_usage;
  }







|







327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
**     %fossil tag list ?UUID?
**
**         List all tags, or if UUID is supplied, list
**         all tags and their values for UUID.
*/
void tag_cmd(void){
  int n;
  db_find_and_open_repository(1);
  if( g.argc<3 ){
    goto tag_cmd_usage;
  }
  n = strlen(g.argv[2]);
  if( n==0 ){
    goto tag_cmd_usage;
  }
Changes to src/th.c.
2667
2668
2669
2670
2671
2672
2673
2674
  *pp = (void *)iPtr;
  return TH_OK;

error_out:
  Th_ErrorMessage(interp, "expected pointer, got: \"", z, n);
  return TH_ERROR;
}








<
2667
2668
2669
2670
2671
2672
2673

  *pp = (void *)iPtr;
  return TH_OK;

error_out:
  Th_ErrorMessage(interp, "expected pointer, got: \"", z, n);
  return TH_ERROR;
}

Changes to src/timeline.c.
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
  const char *zCount;
  char *zOrigin;
  char *zDate;
  char *zSQL;
  int objid = 0;
  Blob uuid;
  int mode = 1 ;       /* 1: before  2:after  3:children  4:parents */
  db_find_and_open_repository();
  zCount = find_option("n","count",1);
  if( zCount ){
    n = atoi(zCount);
  }else{
    n = 20;
  }
  if( g.argc==4 ){







|







586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
  const char *zCount;
  char *zOrigin;
  char *zDate;
  char *zSQL;
  int objid = 0;
  Blob uuid;
  int mode = 1 ;       /* 1: before  2:after  3:children  4:parents */
  db_find_and_open_repository(1);
  zCount = find_option("n","count",1);
  if( zCount ){
    n = atoi(zCount);
  }else{
    n = 20;
  }
  if( g.argc==4 ){
Changes to src/user.c.
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
**
**    %fossil user password USERNAME
**
**        Change the web access password for a user.
*/
void user_cmd(void){
  int n;
  db_find_and_open_repository();
  if( g.argc<3 ){
    usage("capabilities|default|list|new|password ...");
  }
  n = strlen(g.argv[2]);
  if( n>=2 && strncmp(g.argv[2],"new",n)==0 ){
    Blob passwd, login, contact;








|







175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
**
**    %fossil user password USERNAME
**
**        Change the web access password for a user.
*/
void user_cmd(void){
  int n;
  db_find_and_open_repository(1);
  if( g.argc<3 ){
    usage("capabilities|default|list|new|password ...");
  }
  n = strlen(g.argv[2]);
  if( n>=2 && strncmp(g.argv[2],"new",n)==0 ){
    Blob passwd, login, contact;