Fossil

Diff
Login

Differences From Artifact [79e9e0ceda]:

To Artifact [2d2f919945]:


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
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(void){
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");
    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
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
  );
    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
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();
  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);