Fossil

Check-in [29bc8da1]
Login

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

Overview
Comment:Added diff-command and gdiff-command to the valid settings
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:29bc8da1d925784830a363ca3d04af5810275c16
User & Date: jnc 2007-10-10 03:39:04
Context
2007-10-10
15:21
Fix the wiki editor so that it can handle wiki page names that include spaces. check-in: 9f89a8e6 user: drh tags: trunk
03:39
Added diff-command and gdiff-command to the valid settings check-in: 29bc8da1 user: jnc tags: trunk
02:49
Removed unnecessary items from WWW Configuration, also made RSS Title and Description into generic Project Name and Project Description settings, which will be used elsewhere in the web site. check-in: f3807dbd user: jnc tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/db.c.

     5      5   ** modify it under the terms of the GNU General Public
     6      6   ** License version 2 as published by the Free Software Foundation.
     7      7   **
     8      8   ** This program is distributed in the hope that it will be useful,
     9      9   ** but WITHOUT ANY WARRANTY; without even the implied warranty of
    10     10   ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    11     11   ** General Public License for more details.
    12         -** 
           12  +**
    13     13   ** You should have received a copy of the GNU General Public
    14     14   ** License along with this library; if not, write to the
    15     15   ** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    16     16   ** Boston, MA  02111-1307, USA.
    17     17   **
    18     18   ** Author contact information:
    19     19   **   drh@hwaci.com
    20     20   **   http://www.hwaci.com/drh/
    21     21   **
    22     22   *******************************************************************************
    23         -** 
           23  +**
    24     24   ** Code for interfacing to the various databases.
    25     25   **
    26     26   ** There are three separate database files that fossil interacts
    27     27   ** with:
    28     28   **
    29     29   **    (1)  The "user" database in ~/.fossil
    30     30   **
................................................................................
    97     97   }
    98     98   void db_force_rollback(void){
    99     99     if( nBegin ){
   100    100       sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0);
   101    101     }
   102    102     nBegin = 0;
   103    103   }
   104         - 
          104  +
   105    105   /*
   106    106   ** Prepare or reprepare the sqlite3 statement from the raw SQL text.
   107    107   */
   108    108   static void reprepare(Stmt *pStmt){
   109    109     sqlite3_stmt *pNew;
   110    110     if( sqlite3_prepare(g.db, blob_buffer(&pStmt->sql), -1, &pNew, 0)!=0 ){
   111    111       db_err("%s\n%s", blob_str(&pStmt->sql), sqlite3_errmsg(g.db));
................................................................................
   538    538   }
   539    539   
   540    540   /*
   541    541   ** Locate the root directory of the local repository tree.  The root
   542    542   ** directory is found by searching for a file named "FOSSIL" that contains
   543    543   ** a valid repository database.
   544    544   **
   545         -** If no valid FOSSIL file is found, we move up one level and try again.  
          545  +** If no valid FOSSIL file is found, we move up one level and try again.
   546    546   ** Once the file is found, the g.zLocalRoot variable is set to the root of
   547    547   ** the repository tree and this routine returns 1.  If no database is
   548    548   ** found, then this routine return 0.
   549    549   **
   550    550   ** This routine always opens the user database regardless of whether or
   551    551   ** not the repository database is found.  If the FOSSIL file is found,
   552    552   ** it is attached to the open database connection too.
................................................................................
   680    680   ** not server and project codes are invented for this repository.
   681    681   */
   682    682   void db_initial_setup (int makeInitialVersion, int makeServerCodes){
   683    683     char *zDate;
   684    684     const char *zUser;
   685    685     Blob hash;
   686    686     Blob manifest;
   687         -  
          687  +
   688    688     db_set("content-schema", CONTENT_SCHEMA, 0);
   689    689     db_set("aux-schema", AUX_SCHEMA, 0);
   690    690     if( makeServerCodes ){
   691    691       db_multi_exec(
   692    692         "INSERT INTO config(name,value)"
   693    693         " VALUES('server-code', lower(hex(randomblob(20))));"
   694    694         "INSERT INTO config(name,value)"
................................................................................
   892    892                   globalFlag ? "global_" : "", zName, value);
   893    893     if( globalFlag && g.repositoryOpen ){
   894    894       db_multi_exec("DELETE FROM config WHERE name=%Q", zName);
   895    895     }
   896    896     db_end_transaction(0);
   897    897   }
   898    898   char *db_lget(const char *zName, char *zDefault){
   899         -  return db_text((char*)zDefault, 
          899  +  return db_text((char*)zDefault,
   900    900                    "SELECT value FROM vvar WHERE name=%Q", zName);
   901    901   }
   902    902   void db_lset(const char *zName, const char *zValue){
   903    903     db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%Q)", zName, zValue);
   904    904   }
   905    905   int db_lget_int(const char *zName, int dflt){
   906    906     return db_int(dflt, "SELECT value FROM vvar WHERE name=%Q", zName);
................................................................................
   946    946   }
   947    947   
   948    948   /*
   949    949   ** Print the value of a setting named zName
   950    950   */
   951    951   static void print_setting(const char *zName){
   952    952     Stmt q;
   953         -  db_prepare(&q, 
          953  +  db_prepare(&q,
   954    954        "SELECT '(local)', value FROM config WHERE name=%Q"
   955    955        " UNION ALL "
   956    956        "SELECT '(global)', value FROM global_config WHERE name=%Q",
   957    957        zName, zName
   958    958     );
   959    959     if( db_step(&q)==SQLITE_ROW ){
   960    960       printf("%-20s %-8s %s\n", zName, db_column_text(&q, 0),
................................................................................
   990    990   **
   991    991   **    omitsign         When enabled, fossil will not attempt to sign any
   992    992   **                     commit with gpg. All commits will be unsigned.
   993    993   **
   994    994   **    safemerge        If enabled, when commit will cause a fork, the
   995    995   **                     commit will not abort with warning. Also update
   996    996   **                     will not be allowed if local changes exist.
          997  +**
          998  +**   diff-command      External command to run when performing a diff.
          999  +**                     If undefined, the internal text diff will be used.
         1000  +**
         1001  +**   gdiff-command     External command to run when performing a graphical
         1002  +**                     diff. If undefined, text diff will be used.
   997   1003   */
   998   1004   void setting_cmd(void){
   999   1005     static const char *azName[] = {
  1000   1006       "autosync",
  1001   1007       "clearsign",
  1002   1008       "editor",
  1003   1009       "localauth",
  1004   1010       "omitsign",
  1005   1011       "safemerge",
         1012  +    "diff-command",
         1013  +    "gdiff-command",
  1006   1014     };
  1007   1015     int i;
  1008   1016     int globalFlag = find_option("global","g",0)!=0;
  1009   1017     db_find_and_open_repository();
  1010   1018     if( g.argc==2 ){
  1011   1019       for(i=0; i<sizeof(azName)/sizeof(azName[0]); i++){
  1012   1020         print_setting(azName[i]);

Changes to src/diffcmd.c.

     5      5   ** modify it under the terms of the GNU General Public
     6      6   ** License version 2 as published by the Free Software Foundation.
     7      7   **
     8      8   ** This program is distributed in the hope that it will be useful,
     9      9   ** but WITHOUT ANY WARRANTY; without even the implied warranty of
    10     10   ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    11     11   ** General Public License for more details.
    12         -** 
           12  +**
    13     13   ** You should have received a copy of the GNU General Public
    14     14   ** License along with this library; if not, write to the
    15     15   ** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    16     16   ** Boston, MA  02111-1307, USA.
    17     17   **
    18     18   ** Author contact information:
    19     19   **   drh@hwaci.com
................................................................................
    73     73   void diff_cmd(void){
    74     74     const char *zFile, *zRevision;
    75     75     Blob cmd;
    76     76     Blob fname;
    77     77     Blob vname;
    78     78     Blob record;
    79     79     int cnt=0,internalDiff;
    80         -  
           80  +
    81     81     internalDiff = find_option("internal","i",0)!=0;
    82     82     zRevision = find_option("revision", "r", 1);
    83     83     verify_all_options();
    84         -  
           84  +
    85     85     if( g.argc<3 ){
    86     86       usage("?OPTIONS? FILE");
    87     87     }
    88     88     db_must_be_within_tree();
    89         -  
           89  +
    90     90     if( internalDiff==0 ){
    91     91       const char *zExternalCommand;
    92     92       if( strcmp(g.argv[1], "diff")==0 ){
    93     93         zExternalCommand = db_get("diff-command", 0);
    94     94       }else{
    95     95         zExternalCommand = db_get("gdiff-command", 0);
    96     96       }
................................................................................
   100    100       blob_zero(&cmd);
   101    101       blob_appendf(&cmd, "%s ", zExternalCommand);
   102    102     }
   103    103     zFile = g.argv[g.argc-1];
   104    104     if( !file_tree_name(zFile, &fname) ){
   105    105       fossil_panic("unknown file: %s", zFile);
   106    106     }
   107         -  
          107  +
   108    108     blob_zero(&vname);
   109    109     do{
   110    110       blob_reset(&vname);
   111    111       blob_appendf(&vname, "%s~%d", zFile, cnt++);
   112    112     }while( access(blob_str(&vname),0)==0 );
   113         -  
          113  +
   114    114     if( zRevision==0 ){
   115    115       int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
   116    116       if( rid==0 ){
   117    117         fossil_panic("no history for file: %b", &fname);
   118    118       }
   119    119       content_get(rid, &record);
   120    120     }else{