Fossil SCM

Added diff-command and gdiff-command to the valid settings

jnc 2007-10-10 03:39 trunk
Commit 29bc8da1d925784830a363ca3d04af5810275c16
2 files changed +15 -7 +6 -6
+15 -7
--- src/db.c
+++ src/db.c
@@ -7,11 +7,11 @@
77
**
88
** This program is distributed in the hope that it will be useful,
99
** but WITHOUT ANY WARRANTY; without even the implied warranty of
1010
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1111
** General Public License for more details.
12
-**
12
+**
1313
** You should have received a copy of the GNU General Public
1414
** License along with this library; if not, write to the
1515
** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1616
** Boston, MA 02111-1307, USA.
1717
**
@@ -18,11 +18,11 @@
1818
** Author contact information:
1919
** [email protected]
2020
** http://www.hwaci.com/drh/
2121
**
2222
*******************************************************************************
23
-**
23
+**
2424
** Code for interfacing to the various databases.
2525
**
2626
** There are three separate database files that fossil interacts
2727
** with:
2828
**
@@ -99,11 +99,11 @@
9999
if( nBegin ){
100100
sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0);
101101
}
102102
nBegin = 0;
103103
}
104
-
104
+
105105
/*
106106
** Prepare or reprepare the sqlite3 statement from the raw SQL text.
107107
*/
108108
static void reprepare(Stmt *pStmt){
109109
sqlite3_stmt *pNew;
@@ -540,11 +540,11 @@
540540
/*
541541
** Locate the root directory of the local repository tree. The root
542542
** directory is found by searching for a file named "FOSSIL" that contains
543543
** a valid repository database.
544544
**
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.
546546
** Once the file is found, the g.zLocalRoot variable is set to the root of
547547
** the repository tree and this routine returns 1. If no database is
548548
** found, then this routine return 0.
549549
**
550550
** This routine always opens the user database regardless of whether or
@@ -682,11 +682,11 @@
682682
void db_initial_setup (int makeInitialVersion, int makeServerCodes){
683683
char *zDate;
684684
const char *zUser;
685685
Blob hash;
686686
Blob manifest;
687
-
687
+
688688
db_set("content-schema", CONTENT_SCHEMA, 0);
689689
db_set("aux-schema", AUX_SCHEMA, 0);
690690
if( makeServerCodes ){
691691
db_multi_exec(
692692
"INSERT INTO config(name,value)"
@@ -894,11 +894,11 @@
894894
db_multi_exec("DELETE FROM config WHERE name=%Q", zName);
895895
}
896896
db_end_transaction(0);
897897
}
898898
char *db_lget(const char *zName, char *zDefault){
899
- return db_text((char*)zDefault,
899
+ return db_text((char*)zDefault,
900900
"SELECT value FROM vvar WHERE name=%Q", zName);
901901
}
902902
void db_lset(const char *zName, const char *zValue){
903903
db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%Q)", zName, zValue);
904904
}
@@ -948,11 +948,11 @@
948948
/*
949949
** Print the value of a setting named zName
950950
*/
951951
static void print_setting(const char *zName){
952952
Stmt q;
953
- db_prepare(&q,
953
+ db_prepare(&q,
954954
"SELECT '(local)', value FROM config WHERE name=%Q"
955955
" UNION ALL "
956956
"SELECT '(global)', value FROM global_config WHERE name=%Q",
957957
zName, zName
958958
);
@@ -992,19 +992,27 @@
992992
** commit with gpg. All commits will be unsigned.
993993
**
994994
** safemerge If enabled, when commit will cause a fork, the
995995
** commit will not abort with warning. Also update
996996
** 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.
9971003
*/
9981004
void setting_cmd(void){
9991005
static const char *azName[] = {
10001006
"autosync",
10011007
"clearsign",
10021008
"editor",
10031009
"localauth",
10041010
"omitsign",
10051011
"safemerge",
1012
+ "diff-command",
1013
+ "gdiff-command",
10061014
};
10071015
int i;
10081016
int globalFlag = find_option("global","g",0)!=0;
10091017
db_find_and_open_repository();
10101018
if( g.argc==2 ){
10111019
--- src/db.c
+++ src/db.c
@@ -7,11 +7,11 @@
7 **
8 ** This program is distributed in the hope that it will be useful,
9 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 ** General Public License for more details.
12 **
13 ** You should have received a copy of the GNU General Public
14 ** License along with this library; if not, write to the
15 ** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 ** Boston, MA 02111-1307, USA.
17 **
@@ -18,11 +18,11 @@
18 ** Author contact information:
19 ** [email protected]
20 ** http://www.hwaci.com/drh/
21 **
22 *******************************************************************************
23 **
24 ** Code for interfacing to the various databases.
25 **
26 ** There are three separate database files that fossil interacts
27 ** with:
28 **
@@ -99,11 +99,11 @@
99 if( nBegin ){
100 sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0);
101 }
102 nBegin = 0;
103 }
104
105 /*
106 ** Prepare or reprepare the sqlite3 statement from the raw SQL text.
107 */
108 static void reprepare(Stmt *pStmt){
109 sqlite3_stmt *pNew;
@@ -540,11 +540,11 @@
540 /*
541 ** Locate the root directory of the local repository tree. The root
542 ** directory is found by searching for a file named "FOSSIL" that contains
543 ** a valid repository database.
544 **
545 ** If no valid FOSSIL file is found, we move up one level and try again.
546 ** Once the file is found, the g.zLocalRoot variable is set to the root of
547 ** the repository tree and this routine returns 1. If no database is
548 ** found, then this routine return 0.
549 **
550 ** This routine always opens the user database regardless of whether or
@@ -682,11 +682,11 @@
682 void db_initial_setup (int makeInitialVersion, int makeServerCodes){
683 char *zDate;
684 const char *zUser;
685 Blob hash;
686 Blob manifest;
687
688 db_set("content-schema", CONTENT_SCHEMA, 0);
689 db_set("aux-schema", AUX_SCHEMA, 0);
690 if( makeServerCodes ){
691 db_multi_exec(
692 "INSERT INTO config(name,value)"
@@ -894,11 +894,11 @@
894 db_multi_exec("DELETE FROM config WHERE name=%Q", zName);
895 }
896 db_end_transaction(0);
897 }
898 char *db_lget(const char *zName, char *zDefault){
899 return db_text((char*)zDefault,
900 "SELECT value FROM vvar WHERE name=%Q", zName);
901 }
902 void db_lset(const char *zName, const char *zValue){
903 db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%Q)", zName, zValue);
904 }
@@ -948,11 +948,11 @@
948 /*
949 ** Print the value of a setting named zName
950 */
951 static void print_setting(const char *zName){
952 Stmt q;
953 db_prepare(&q,
954 "SELECT '(local)', value FROM config WHERE name=%Q"
955 " UNION ALL "
956 "SELECT '(global)', value FROM global_config WHERE name=%Q",
957 zName, zName
958 );
@@ -992,19 +992,27 @@
992 ** commit with gpg. All commits will be unsigned.
993 **
994 ** safemerge If enabled, when commit will cause a fork, the
995 ** commit will not abort with warning. Also update
996 ** will not be allowed if local changes exist.
 
 
 
 
 
 
997 */
998 void setting_cmd(void){
999 static const char *azName[] = {
1000 "autosync",
1001 "clearsign",
1002 "editor",
1003 "localauth",
1004 "omitsign",
1005 "safemerge",
 
 
1006 };
1007 int i;
1008 int globalFlag = find_option("global","g",0)!=0;
1009 db_find_and_open_repository();
1010 if( g.argc==2 ){
1011
--- src/db.c
+++ src/db.c
@@ -7,11 +7,11 @@
7 **
8 ** This program is distributed in the hope that it will be useful,
9 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 ** General Public License for more details.
12 **
13 ** You should have received a copy of the GNU General Public
14 ** License along with this library; if not, write to the
15 ** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 ** Boston, MA 02111-1307, USA.
17 **
@@ -18,11 +18,11 @@
18 ** Author contact information:
19 ** [email protected]
20 ** http://www.hwaci.com/drh/
21 **
22 *******************************************************************************
23 **
24 ** Code for interfacing to the various databases.
25 **
26 ** There are three separate database files that fossil interacts
27 ** with:
28 **
@@ -99,11 +99,11 @@
99 if( nBegin ){
100 sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0);
101 }
102 nBegin = 0;
103 }
104
105 /*
106 ** Prepare or reprepare the sqlite3 statement from the raw SQL text.
107 */
108 static void reprepare(Stmt *pStmt){
109 sqlite3_stmt *pNew;
@@ -540,11 +540,11 @@
540 /*
541 ** Locate the root directory of the local repository tree. The root
542 ** directory is found by searching for a file named "FOSSIL" that contains
543 ** a valid repository database.
544 **
545 ** If no valid FOSSIL file is found, we move up one level and try again.
546 ** Once the file is found, the g.zLocalRoot variable is set to the root of
547 ** the repository tree and this routine returns 1. If no database is
548 ** found, then this routine return 0.
549 **
550 ** This routine always opens the user database regardless of whether or
@@ -682,11 +682,11 @@
682 void db_initial_setup (int makeInitialVersion, int makeServerCodes){
683 char *zDate;
684 const char *zUser;
685 Blob hash;
686 Blob manifest;
687
688 db_set("content-schema", CONTENT_SCHEMA, 0);
689 db_set("aux-schema", AUX_SCHEMA, 0);
690 if( makeServerCodes ){
691 db_multi_exec(
692 "INSERT INTO config(name,value)"
@@ -894,11 +894,11 @@
894 db_multi_exec("DELETE FROM config WHERE name=%Q", zName);
895 }
896 db_end_transaction(0);
897 }
898 char *db_lget(const char *zName, char *zDefault){
899 return db_text((char*)zDefault,
900 "SELECT value FROM vvar WHERE name=%Q", zName);
901 }
902 void db_lset(const char *zName, const char *zValue){
903 db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%Q)", zName, zValue);
904 }
@@ -948,11 +948,11 @@
948 /*
949 ** Print the value of a setting named zName
950 */
951 static void print_setting(const char *zName){
952 Stmt q;
953 db_prepare(&q,
954 "SELECT '(local)', value FROM config WHERE name=%Q"
955 " UNION ALL "
956 "SELECT '(global)', value FROM global_config WHERE name=%Q",
957 zName, zName
958 );
@@ -992,19 +992,27 @@
992 ** commit with gpg. All commits will be unsigned.
993 **
994 ** safemerge If enabled, when commit will cause a fork, the
995 ** commit will not abort with warning. Also update
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.
1003 */
1004 void setting_cmd(void){
1005 static const char *azName[] = {
1006 "autosync",
1007 "clearsign",
1008 "editor",
1009 "localauth",
1010 "omitsign",
1011 "safemerge",
1012 "diff-command",
1013 "gdiff-command",
1014 };
1015 int i;
1016 int globalFlag = find_option("global","g",0)!=0;
1017 db_find_and_open_repository();
1018 if( g.argc==2 ){
1019
+6 -6
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -7,11 +7,11 @@
77
**
88
** This program is distributed in the hope that it will be useful,
99
** but WITHOUT ANY WARRANTY; without even the implied warranty of
1010
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1111
** General Public License for more details.
12
-**
12
+**
1313
** You should have received a copy of the GNU General Public
1414
** License along with this library; if not, write to the
1515
** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1616
** Boston, MA 02111-1307, USA.
1717
**
@@ -75,20 +75,20 @@
7575
Blob cmd;
7676
Blob fname;
7777
Blob vname;
7878
Blob record;
7979
int cnt=0,internalDiff;
80
-
80
+
8181
internalDiff = find_option("internal","i",0)!=0;
8282
zRevision = find_option("revision", "r", 1);
8383
verify_all_options();
84
-
84
+
8585
if( g.argc<3 ){
8686
usage("?OPTIONS? FILE");
8787
}
8888
db_must_be_within_tree();
89
-
89
+
9090
if( internalDiff==0 ){
9191
const char *zExternalCommand;
9292
if( strcmp(g.argv[1], "diff")==0 ){
9393
zExternalCommand = db_get("diff-command", 0);
9494
}else{
@@ -102,17 +102,17 @@
102102
}
103103
zFile = g.argv[g.argc-1];
104104
if( !file_tree_name(zFile, &fname) ){
105105
fossil_panic("unknown file: %s", zFile);
106106
}
107
-
107
+
108108
blob_zero(&vname);
109109
do{
110110
blob_reset(&vname);
111111
blob_appendf(&vname, "%s~%d", zFile, cnt++);
112112
}while( access(blob_str(&vname),0)==0 );
113
-
113
+
114114
if( zRevision==0 ){
115115
int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
116116
if( rid==0 ){
117117
fossil_panic("no history for file: %b", &fname);
118118
}
119119
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -7,11 +7,11 @@
7 **
8 ** This program is distributed in the hope that it will be useful,
9 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 ** General Public License for more details.
12 **
13 ** You should have received a copy of the GNU General Public
14 ** License along with this library; if not, write to the
15 ** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 ** Boston, MA 02111-1307, USA.
17 **
@@ -75,20 +75,20 @@
75 Blob cmd;
76 Blob fname;
77 Blob vname;
78 Blob record;
79 int cnt=0,internalDiff;
80
81 internalDiff = find_option("internal","i",0)!=0;
82 zRevision = find_option("revision", "r", 1);
83 verify_all_options();
84
85 if( g.argc<3 ){
86 usage("?OPTIONS? FILE");
87 }
88 db_must_be_within_tree();
89
90 if( internalDiff==0 ){
91 const char *zExternalCommand;
92 if( strcmp(g.argv[1], "diff")==0 ){
93 zExternalCommand = db_get("diff-command", 0);
94 }else{
@@ -102,17 +102,17 @@
102 }
103 zFile = g.argv[g.argc-1];
104 if( !file_tree_name(zFile, &fname) ){
105 fossil_panic("unknown file: %s", zFile);
106 }
107
108 blob_zero(&vname);
109 do{
110 blob_reset(&vname);
111 blob_appendf(&vname, "%s~%d", zFile, cnt++);
112 }while( access(blob_str(&vname),0)==0 );
113
114 if( zRevision==0 ){
115 int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
116 if( rid==0 ){
117 fossil_panic("no history for file: %b", &fname);
118 }
119
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -7,11 +7,11 @@
7 **
8 ** This program is distributed in the hope that it will be useful,
9 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 ** General Public License for more details.
12 **
13 ** You should have received a copy of the GNU General Public
14 ** License along with this library; if not, write to the
15 ** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 ** Boston, MA 02111-1307, USA.
17 **
@@ -75,20 +75,20 @@
75 Blob cmd;
76 Blob fname;
77 Blob vname;
78 Blob record;
79 int cnt=0,internalDiff;
80
81 internalDiff = find_option("internal","i",0)!=0;
82 zRevision = find_option("revision", "r", 1);
83 verify_all_options();
84
85 if( g.argc<3 ){
86 usage("?OPTIONS? FILE");
87 }
88 db_must_be_within_tree();
89
90 if( internalDiff==0 ){
91 const char *zExternalCommand;
92 if( strcmp(g.argv[1], "diff")==0 ){
93 zExternalCommand = db_get("diff-command", 0);
94 }else{
@@ -102,17 +102,17 @@
102 }
103 zFile = g.argv[g.argc-1];
104 if( !file_tree_name(zFile, &fname) ){
105 fossil_panic("unknown file: %s", zFile);
106 }
107
108 blob_zero(&vname);
109 do{
110 blob_reset(&vname);
111 blob_appendf(&vname, "%s~%d", zFile, cnt++);
112 }while( access(blob_str(&vname),0)==0 );
113
114 if( zRevision==0 ){
115 int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
116 if( rid==0 ){
117 fossil_panic("no history for file: %b", &fname);
118 }
119

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button