Fossil SCM

merge trunk

jan.nijtmans 2014-03-13 21:06 UTC win32-longpath merge
Commit d88d1bc0f69b4bbaaba5f29968605a79dc3090e7
78 files changed +2 -2 +12 -12 +1 -1 +11 -11 +30 +18 -1 +2 -2 +7 -38 +1 -2 +11 -5 +1 -2 +8 -15 +3 -3 +51 +70 -7 +77 -60 +107 -58 +94 -32 +10 -10 +68 -5 +92 -9 +117 -91 +1 -1 +3 -3 +1 +14 +6 -3 +14 -2 +59 -22 +14 +7 -2 +1 -1 +9 -9 +27 -6 +45 -15 +7 -7 +2505 -1860 +2505 -1860 +5 -4 +9 -4 +1 +8 -3 +5 +1 -1 +1 +1 -1 +24 -24 +31 -31 +11 -13 +19 -13 +23 -3 +12 -12 +85 -56 +2 -1 +6 -5 +5 +5 +1 +1 +3 -28 +3 -28 +59 -55 +59 -55 +48 +2 -2 +2 -2 +1 -1 +1 -1 +1 -1 +11 -5 +16 -1 +18 -3 +66 -20 +1 +33 -24 +21 -21 +1 -1 +67
+2 -2
--- BUILD.txt
+++ BUILD.txt
@@ -22,11 +22,11 @@
2222
2323
cd win; nmake /f Makefile.msc
2424
2525
If you have trouble, or you want to do something fancy, just look at
2626
Makefile.classic. There are 6 configuration options that are all well
27
-commented. Instead of editing the Makefile.classic, consider copying
27
+commented. Instead of editing the Makefile.classic, consider copying
2828
Makefile.classic to an alternative name such as "GNUMakefile",
2929
"BSDMakefile", or "makefile" and editing the copy.
3030
3131
3232
BUILDING OUTSIDE THE SOURCE TREE
@@ -61,11 +61,11 @@
6161
Do not edit src/main.mk directly. Update src/makemake.tcl and
6262
then rerun it.
6363
6464
* The *.h header files are automatically generated using a program
6565
called "makeheaders". Source code to the makeheaders program is
66
- found in src/makeheaders.c. Documentation is found in
66
+ found in src/makeheaders.c. Documentation is found in
6767
src/makeheaders.html.
6868
6969
* Most *.c source files are preprocessed using a program called
7070
"translate". The sources to translate are found in src/translate.c.
7171
A header comment in src/translate.c explains in detail what it does.
7272
--- BUILD.txt
+++ BUILD.txt
@@ -22,11 +22,11 @@
22
23 cd win; nmake /f Makefile.msc
24
25 If you have trouble, or you want to do something fancy, just look at
26 Makefile.classic. There are 6 configuration options that are all well
27 commented. Instead of editing the Makefile.classic, consider copying
28 Makefile.classic to an alternative name such as "GNUMakefile",
29 "BSDMakefile", or "makefile" and editing the copy.
30
31
32 BUILDING OUTSIDE THE SOURCE TREE
@@ -61,11 +61,11 @@
61 Do not edit src/main.mk directly. Update src/makemake.tcl and
62 then rerun it.
63
64 * The *.h header files are automatically generated using a program
65 called "makeheaders". Source code to the makeheaders program is
66 found in src/makeheaders.c. Documentation is found in
67 src/makeheaders.html.
68
69 * Most *.c source files are preprocessed using a program called
70 "translate". The sources to translate are found in src/translate.c.
71 A header comment in src/translate.c explains in detail what it does.
72
--- BUILD.txt
+++ BUILD.txt
@@ -22,11 +22,11 @@
22
23 cd win; nmake /f Makefile.msc
24
25 If you have trouble, or you want to do something fancy, just look at
26 Makefile.classic. There are 6 configuration options that are all well
27 commented. Instead of editing the Makefile.classic, consider copying
28 Makefile.classic to an alternative name such as "GNUMakefile",
29 "BSDMakefile", or "makefile" and editing the copy.
30
31
32 BUILDING OUTSIDE THE SOURCE TREE
@@ -61,11 +61,11 @@
61 Do not edit src/main.mk directly. Update src/makemake.tcl and
62 then rerun it.
63
64 * The *.h header files are automatically generated using a program
65 called "makeheaders". Source code to the makeheaders program is
66 found in src/makeheaders.c. Documentation is found in
67 src/makeheaders.html.
68
69 * Most *.c source files are preprocessed using a program called
70 "translate". The sources to translate are found in src/translate.c.
71 A header comment in src/translate.c explains in detail what it does.
72
+12 -12
--- COPYRIGHT-BSD2.txt
+++ COPYRIGHT-BSD2.txt
@@ -1,31 +1,31 @@
11
Copyright 2007 D. Richard Hipp. All rights reserved.
22
3
-Redistribution and use in source and binary forms, with or
4
-without modification, are permitted provided that the
3
+Redistribution and use in source and binary forms, with or
4
+without modification, are permitted provided that the
55
following conditions are met:
66
77
1. Redistributions of source code must retain the above
8
- copyright notice, this list of conditions and the
8
+ copyright notice, this list of conditions and the
99
following disclaimer.
1010
1111
2. Redistributions in binary form must reproduce the above
1212
copyright notice, this list of conditions and the
1313
following disclaimer in the documentation and/or other
1414
materials provided with the distribution.
1515
16
-THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
17
-OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16
+THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
17
+OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1818
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
19
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
2020
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
21
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
2323
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
2626
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727
28
-The views and conclusions contained in the software and documentation
29
-are those of the authors and contributors and should not be interpreted
28
+The views and conclusions contained in the software and documentation
29
+are those of the authors and contributors and should not be interpreted
3030
as representing official policies, either expressed or implied, of anybody
3131
else.
3232
--- COPYRIGHT-BSD2.txt
+++ COPYRIGHT-BSD2.txt
@@ -1,31 +1,31 @@
1 Copyright 2007 D. Richard Hipp. All rights reserved.
2
3 Redistribution and use in source and binary forms, with or
4 without modification, are permitted provided that the
5 following conditions are met:
6
7 1. Redistributions of source code must retain the above
8 copyright notice, this list of conditions and the
9 following disclaimer.
10
11 2. Redistributions in binary form must reproduce the above
12 copyright notice, this list of conditions and the
13 following disclaimer in the documentation and/or other
14 materials provided with the distribution.
15
16 THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
17 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
20 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 The views and conclusions contained in the software and documentation
29 are those of the authors and contributors and should not be interpreted
30 as representing official policies, either expressed or implied, of anybody
31 else.
32
--- COPYRIGHT-BSD2.txt
+++ COPYRIGHT-BSD2.txt
@@ -1,31 +1,31 @@
1 Copyright 2007 D. Richard Hipp. All rights reserved.
2
3 Redistribution and use in source and binary forms, with or
4 without modification, are permitted provided that the
5 following conditions are met:
6
7 1. Redistributions of source code must retain the above
8 copyright notice, this list of conditions and the
9 following disclaimer.
10
11 2. Redistributions in binary form must reproduce the above
12 copyright notice, this list of conditions and the
13 following disclaimer in the documentation and/or other
14 materials provided with the distribution.
15
16 THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
17 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
20 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 The views and conclusions contained in the software and documentation
29 are those of the authors and contributors and should not be interpreted
30 as representing official policies, either expressed or implied, of anybody
31 else.
32
--- Makefile.Cygwin.in
+++ Makefile.Cygwin.in
@@ -36,11 +36,11 @@
3636
# care about testing the end result, this can be blank.
3737
#
3838
TCLSH = tclsh
3939
4040
LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
41
-TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H
41
+TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H -DFOSSIL_OMIT_LOAD_AVERAGE
4242
INSTALLDIR =$(DESTDIR)@prefix@/bin
4343
USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@
4444
FOSSIL_ENABLE_TCL = @FOSSIL_ENABLE_TCL@
4545
FOSSIL_ENABLE_TCL_STUBS = @FOSSIL_ENABLE_TCL_STUBS@
4646
FOSSIL_ENABLE_TCL_PRIVATE_STUBS = @FOSSIL_ENABLE_TCL_PRIVATE_STUBS@
4747
--- Makefile.Cygwin.in
+++ Makefile.Cygwin.in
@@ -36,11 +36,11 @@
36 # care about testing the end result, this can be blank.
37 #
38 TCLSH = tclsh
39
40 LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
41 TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H
42 INSTALLDIR =$(DESTDIR)@prefix@/bin
43 USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@
44 FOSSIL_ENABLE_TCL = @FOSSIL_ENABLE_TCL@
45 FOSSIL_ENABLE_TCL_STUBS = @FOSSIL_ENABLE_TCL_STUBS@
46 FOSSIL_ENABLE_TCL_PRIVATE_STUBS = @FOSSIL_ENABLE_TCL_PRIVATE_STUBS@
47
--- Makefile.Cygwin.in
+++ Makefile.Cygwin.in
@@ -36,11 +36,11 @@
36 # care about testing the end result, this can be blank.
37 #
38 TCLSH = tclsh
39
40 LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
41 TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H -DFOSSIL_OMIT_LOAD_AVERAGE
42 INSTALLDIR =$(DESTDIR)@prefix@/bin
43 USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@
44 FOSSIL_ENABLE_TCL = @FOSSIL_ENABLE_TCL@
45 FOSSIL_ENABLE_TCL_STUBS = @FOSSIL_ENABLE_TCL_STUBS@
46 FOSSIL_ENABLE_TCL_PRIVATE_STUBS = @FOSSIL_ENABLE_TCL_PRIVATE_STUBS@
47
+11 -11
--- auto.def
+++ auto.def
@@ -89,21 +89,10 @@
8989
if {[opt-bool static]} {
9090
# XXX: This will not work on all systems.
9191
define-append EXTRA_LDFLAGS -static
9292
}
9393
94
-# Check for zlib, using the given location if specified
95
-set zlibpath [opt-val with-zlib]
96
-if {$zlibpath ne ""} {
97
- cc-with [list -cflags "-I$zlibpath -L$zlibpath"]
98
- define-append EXTRA_CFLAGS -I$zlibpath
99
- define-append EXTRA_LDFLAGS -L$zlibpath
100
-}
101
-if {![cc-check-includes zlib.h] || ![cc-check-function-in-lib inflateEnd z]} {
102
- user-error "zlib not found please install it or specify the location with --with-zlib"
103
-}
104
-
10594
set tclpath [opt-val with-tcl]
10695
if {$tclpath ne ""} {
10796
set tclprivatestubs [opt-bool with-tcl-private-stubs]
10897
# Note parse-tclconfig-sh is in autosetup/local.tcl
10998
if {$tclpath eq "1"} {
@@ -226,10 +215,21 @@
226215
}
227216
} else {
228217
user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support"
229218
}
230219
}
220
+
221
+# Check for zlib, using the given location if specified
222
+set zlibpath [opt-val with-zlib]
223
+if {$zlibpath ne ""} {
224
+ cc-with [list -cflags "-I$zlibpath -L$zlibpath"]
225
+ define-append EXTRA_CFLAGS -I$zlibpath
226
+ define-append EXTRA_LDFLAGS -L$zlibpath
227
+}
228
+if {![cc-check-includes zlib.h] || ![cc-check-function-in-lib inflateEnd z]} {
229
+ user-error "zlib not found please install it or specify the location with --with-zlib"
230
+}
231231
232232
if {[opt-bool lineedit]} {
233233
# Need readline-compatible line editing
234234
cc-with {-includes stdio.h} {
235235
if {[cc-check-includes readline/readline.h] && [cc-check-function-in-lib readline readline]} {
236236
--- auto.def
+++ auto.def
@@ -89,21 +89,10 @@
89 if {[opt-bool static]} {
90 # XXX: This will not work on all systems.
91 define-append EXTRA_LDFLAGS -static
92 }
93
94 # Check for zlib, using the given location if specified
95 set zlibpath [opt-val with-zlib]
96 if {$zlibpath ne ""} {
97 cc-with [list -cflags "-I$zlibpath -L$zlibpath"]
98 define-append EXTRA_CFLAGS -I$zlibpath
99 define-append EXTRA_LDFLAGS -L$zlibpath
100 }
101 if {![cc-check-includes zlib.h] || ![cc-check-function-in-lib inflateEnd z]} {
102 user-error "zlib not found please install it or specify the location with --with-zlib"
103 }
104
105 set tclpath [opt-val with-tcl]
106 if {$tclpath ne ""} {
107 set tclprivatestubs [opt-bool with-tcl-private-stubs]
108 # Note parse-tclconfig-sh is in autosetup/local.tcl
109 if {$tclpath eq "1"} {
@@ -226,10 +215,21 @@
226 }
227 } else {
228 user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support"
229 }
230 }
 
 
 
 
 
 
 
 
 
 
 
231
232 if {[opt-bool lineedit]} {
233 # Need readline-compatible line editing
234 cc-with {-includes stdio.h} {
235 if {[cc-check-includes readline/readline.h] && [cc-check-function-in-lib readline readline]} {
236
--- auto.def
+++ auto.def
@@ -89,21 +89,10 @@
89 if {[opt-bool static]} {
90 # XXX: This will not work on all systems.
91 define-append EXTRA_LDFLAGS -static
92 }
93
 
 
 
 
 
 
 
 
 
 
 
94 set tclpath [opt-val with-tcl]
95 if {$tclpath ne ""} {
96 set tclprivatestubs [opt-bool with-tcl-private-stubs]
97 # Note parse-tclconfig-sh is in autosetup/local.tcl
98 if {$tclpath eq "1"} {
@@ -226,10 +215,21 @@
215 }
216 } else {
217 user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support"
218 }
219 }
220
221 # Check for zlib, using the given location if specified
222 set zlibpath [opt-val with-zlib]
223 if {$zlibpath ne ""} {
224 cc-with [list -cflags "-I$zlibpath -L$zlibpath"]
225 define-append EXTRA_CFLAGS -I$zlibpath
226 define-append EXTRA_LDFLAGS -L$zlibpath
227 }
228 if {![cc-check-includes zlib.h] || ![cc-check-function-in-lib inflateEnd z]} {
229 user-error "zlib not found please install it or specify the location with --with-zlib"
230 }
231
232 if {[opt-bool lineedit]} {
233 # Need readline-compatible line editing
234 cc-with {-includes stdio.h} {
235 if {[cc-check-includes readline/readline.h] && [cc-check-function-in-lib readline readline]} {
236
+30
--- src/add.c
+++ src/add.c
@@ -221,19 +221,24 @@
221221
** The --ignore and --clean options are comma-separate lists of glob patterns
222222
** for files to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore
223223
** option does not appear on the command line then the "ignore-glob" setting
224224
** is used. If the --clean option does not appear on the command line then
225225
** the "clean-glob" setting is used.
226
+**
227
+** If files are attempted to be added explicitly on the command line which
228
+** match "ignore-glob", a confirmation is asked first. This can be prevented
229
+** using the -f|--force option.
226230
**
227231
** The --case-sensitive option determines whether or not filenames should
228232
** be treated case sensitive or not. If the option is not given, the default
229233
** depends on the global setting, or the operating system default, if not set.
230234
**
231235
** Options:
232236
**
233237
** --case-sensitive <BOOL> override case-sensitive setting
234238
** --dotfiles include files beginning with a dot (".")
239
+** -f|--force Add files without prompting
235240
** --ignore <CSG> ignore files matching patterns from the
236241
** comma separated list of glob patterns.
237242
** --clean <CSG> also ignore files matching patterns from
238243
** the comma separated list of glob patterns.
239244
**
@@ -245,13 +250,15 @@
245250
int nRoot; /* Full path characters in g.zLocalRoot */
246251
const char *zCleanFlag; /* The --clean option or clean-glob setting */
247252
const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */
248253
Glob *pIgnore, *pClean; /* Ignore everything matching the glob patterns */
249254
unsigned scanFlags = 0; /* Flags passed to vfile_scan() */
255
+ int forceFlag;
250256
251257
zCleanFlag = find_option("clean",0,1);
252258
zIgnoreFlag = find_option("ignore",0,1);
259
+ forceFlag = find_option("force","f",0)!=0;
253260
if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
254261
capture_case_sensitive_option();
255262
db_must_be_within_tree();
256263
if( zCleanFlag==0 ){
257264
zCleanFlag = db_get("clean-glob", 0);
@@ -287,10 +294,25 @@
287294
fossil_warning("not found: %s", zName);
288295
}else if( file_access(zName, R_OK) ){
289296
fossil_fatal("cannot open %s", zName);
290297
}else{
291298
char *zTreeName = &zName[nRoot];
299
+ if( !forceFlag && glob_match(pIgnore, zTreeName) ){
300
+ Blob ans;
301
+ char cReply;
302
+ char *prompt = mprintf("file \"%s\" matches \"ignore-glob\". "
303
+ "Add it (a=all/y/N)? ", zTreeName);
304
+ prompt_user(prompt, &ans);
305
+ cReply = blob_str(&ans)[0];
306
+ blob_reset(&ans);
307
+ if( cReply=='a' || cReply=='A' ){
308
+ forceFlag = 1;
309
+ }else if( cReply!='y' && cReply!='Y' ){
310
+ blob_reset(&fullName);
311
+ continue;
312
+ }
313
+ }
292314
db_multi_exec(
293315
"INSERT OR IGNORE INTO sfile(x) VALUES(%Q)",
294316
zTreeName
295317
);
296318
}
@@ -670,5 +692,13 @@
670692
mv_one_file(vid, zFrom, zTo);
671693
}
672694
db_finalize(&q);
673695
db_end_transaction(0);
674696
}
697
+
698
+/*
699
+** Function for stash_apply to be able to restore a file and indicate
700
+** newly ADDED state.
701
+*/
702
+int stash_add_files_in_sfile(int vid){
703
+ return add_files_in_sfile(vid);
704
+}
675705
--- src/add.c
+++ src/add.c
@@ -221,19 +221,24 @@
221 ** The --ignore and --clean options are comma-separate lists of glob patterns
222 ** for files to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore
223 ** option does not appear on the command line then the "ignore-glob" setting
224 ** is used. If the --clean option does not appear on the command line then
225 ** the "clean-glob" setting is used.
 
 
 
 
226 **
227 ** The --case-sensitive option determines whether or not filenames should
228 ** be treated case sensitive or not. If the option is not given, the default
229 ** depends on the global setting, or the operating system default, if not set.
230 **
231 ** Options:
232 **
233 ** --case-sensitive <BOOL> override case-sensitive setting
234 ** --dotfiles include files beginning with a dot (".")
 
235 ** --ignore <CSG> ignore files matching patterns from the
236 ** comma separated list of glob patterns.
237 ** --clean <CSG> also ignore files matching patterns from
238 ** the comma separated list of glob patterns.
239 **
@@ -245,13 +250,15 @@
245 int nRoot; /* Full path characters in g.zLocalRoot */
246 const char *zCleanFlag; /* The --clean option or clean-glob setting */
247 const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */
248 Glob *pIgnore, *pClean; /* Ignore everything matching the glob patterns */
249 unsigned scanFlags = 0; /* Flags passed to vfile_scan() */
 
250
251 zCleanFlag = find_option("clean",0,1);
252 zIgnoreFlag = find_option("ignore",0,1);
 
253 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
254 capture_case_sensitive_option();
255 db_must_be_within_tree();
256 if( zCleanFlag==0 ){
257 zCleanFlag = db_get("clean-glob", 0);
@@ -287,10 +294,25 @@
287 fossil_warning("not found: %s", zName);
288 }else if( file_access(zName, R_OK) ){
289 fossil_fatal("cannot open %s", zName);
290 }else{
291 char *zTreeName = &zName[nRoot];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292 db_multi_exec(
293 "INSERT OR IGNORE INTO sfile(x) VALUES(%Q)",
294 zTreeName
295 );
296 }
@@ -670,5 +692,13 @@
670 mv_one_file(vid, zFrom, zTo);
671 }
672 db_finalize(&q);
673 db_end_transaction(0);
674 }
 
 
 
 
 
 
 
 
675
--- src/add.c
+++ src/add.c
@@ -221,19 +221,24 @@
221 ** The --ignore and --clean options are comma-separate lists of glob patterns
222 ** for files to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore
223 ** option does not appear on the command line then the "ignore-glob" setting
224 ** is used. If the --clean option does not appear on the command line then
225 ** the "clean-glob" setting is used.
226 **
227 ** If files are attempted to be added explicitly on the command line which
228 ** match "ignore-glob", a confirmation is asked first. This can be prevented
229 ** using the -f|--force option.
230 **
231 ** The --case-sensitive option determines whether or not filenames should
232 ** be treated case sensitive or not. If the option is not given, the default
233 ** depends on the global setting, or the operating system default, if not set.
234 **
235 ** Options:
236 **
237 ** --case-sensitive <BOOL> override case-sensitive setting
238 ** --dotfiles include files beginning with a dot (".")
239 ** -f|--force Add files without prompting
240 ** --ignore <CSG> ignore files matching patterns from the
241 ** comma separated list of glob patterns.
242 ** --clean <CSG> also ignore files matching patterns from
243 ** the comma separated list of glob patterns.
244 **
@@ -245,13 +250,15 @@
250 int nRoot; /* Full path characters in g.zLocalRoot */
251 const char *zCleanFlag; /* The --clean option or clean-glob setting */
252 const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */
253 Glob *pIgnore, *pClean; /* Ignore everything matching the glob patterns */
254 unsigned scanFlags = 0; /* Flags passed to vfile_scan() */
255 int forceFlag;
256
257 zCleanFlag = find_option("clean",0,1);
258 zIgnoreFlag = find_option("ignore",0,1);
259 forceFlag = find_option("force","f",0)!=0;
260 if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL;
261 capture_case_sensitive_option();
262 db_must_be_within_tree();
263 if( zCleanFlag==0 ){
264 zCleanFlag = db_get("clean-glob", 0);
@@ -287,10 +294,25 @@
294 fossil_warning("not found: %s", zName);
295 }else if( file_access(zName, R_OK) ){
296 fossil_fatal("cannot open %s", zName);
297 }else{
298 char *zTreeName = &zName[nRoot];
299 if( !forceFlag && glob_match(pIgnore, zTreeName) ){
300 Blob ans;
301 char cReply;
302 char *prompt = mprintf("file \"%s\" matches \"ignore-glob\". "
303 "Add it (a=all/y/N)? ", zTreeName);
304 prompt_user(prompt, &ans);
305 cReply = blob_str(&ans)[0];
306 blob_reset(&ans);
307 if( cReply=='a' || cReply=='A' ){
308 forceFlag = 1;
309 }else if( cReply!='y' && cReply!='Y' ){
310 blob_reset(&fullName);
311 continue;
312 }
313 }
314 db_multi_exec(
315 "INSERT OR IGNORE INTO sfile(x) VALUES(%Q)",
316 zTreeName
317 );
318 }
@@ -670,5 +692,13 @@
692 mv_one_file(vid, zFrom, zTo);
693 }
694 db_finalize(&q);
695 db_end_transaction(0);
696 }
697
698 /*
699 ** Function for stash_apply to be able to restore a file and indicate
700 ** newly ADDED state.
701 */
702 int stash_add_files_in_sfile(int vid){
703 return add_files_in_sfile(vid);
704 }
705
+18 -1
--- src/allrepo.c
+++ src/allrepo.c
@@ -65,10 +65,16 @@
6565
}else{
6666
blob_appendf(pExtra, " --%s \"\"", zArg);
6767
}
6868
}
6969
}
70
+static void collect_argv(Blob *pExtra, int iStart){
71
+ int i;
72
+ for(i=iStart; i<g.argc; i++){
73
+ blob_appendf(pExtra, " %s", g.argv[i]);
74
+ }
75
+}
7076
7177
7278
/*
7379
** COMMAND: all
7480
**
@@ -118,10 +124,15 @@
118124
** present, are passed along verbatim. The --force and
119125
** --randomize options are not supported.
120126
**
121127
** sync Run a "sync" on all repositories. Only the --verbose
122128
** option is supported.
129
+**
130
+** setting Run the "setting", "set", or "unset" commands on all
131
+** set repositories. These command are particularly useful in
132
+** unset conjunection with the "max-loadavg" setting which cannot
133
+** otherwise be set globally.
123134
**
124135
** Repositories are automatically added to the set of known repositories
125136
** when one of the following commands are run against the repository:
126137
** clone, info, pull, push, or sync. Even previously ignored repositories
127138
** are added back to the list of repositories by these commands.
@@ -155,11 +166,11 @@
155166
}
156167
n = strlen(g.argv[2]);
157168
db_open_config(1);
158169
blob_zero(&extra);
159170
zCmd = g.argv[2];
160
- if( g.zLogin ) blob_appendf(&extra, " -U %s", g.zLogin);
171
+ if( !login_is_nobody() ) blob_appendf(&extra, " -U %s", g.zLogin);
161172
if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){
162173
zCmd = "list";
163174
useCheckouts = find_option("ckout","c",0)!=0;
164175
}else if( strncmp(zCmd, "clean", n)==0 ){
165176
zCmd = "clean --chdir";
@@ -201,10 +212,16 @@
201212
collect_argument(&extra, "vacuum",0);
202213
collect_argument(&extra, "deanalyze",0);
203214
collect_argument(&extra, "analyze",0);
204215
collect_argument(&extra, "wal",0);
205216
collect_argument(&extra, "stats",0);
217
+ }else if( strncmp(zCmd, "setting", n)==0 ){
218
+ zCmd = "setting -R";
219
+ collect_argv(&extra, 3);
220
+ }else if( strncmp(zCmd, "unset", n)==0 ){
221
+ zCmd = "unset -R";
222
+ collect_argv(&extra, 3);
206223
}else if( strncmp(zCmd, "sync", n)==0 ){
207224
zCmd = "sync -autourl -R";
208225
collect_argument(&extra, "verbose","v");
209226
}else if( strncmp(zCmd, "test-integrity", n)==0 ){
210227
collect_argument(&extra, "parse", 0);
211228
--- src/allrepo.c
+++ src/allrepo.c
@@ -65,10 +65,16 @@
65 }else{
66 blob_appendf(pExtra, " --%s \"\"", zArg);
67 }
68 }
69 }
 
 
 
 
 
 
70
71
72 /*
73 ** COMMAND: all
74 **
@@ -118,10 +124,15 @@
118 ** present, are passed along verbatim. The --force and
119 ** --randomize options are not supported.
120 **
121 ** sync Run a "sync" on all repositories. Only the --verbose
122 ** option is supported.
 
 
 
 
 
123 **
124 ** Repositories are automatically added to the set of known repositories
125 ** when one of the following commands are run against the repository:
126 ** clone, info, pull, push, or sync. Even previously ignored repositories
127 ** are added back to the list of repositories by these commands.
@@ -155,11 +166,11 @@
155 }
156 n = strlen(g.argv[2]);
157 db_open_config(1);
158 blob_zero(&extra);
159 zCmd = g.argv[2];
160 if( g.zLogin ) blob_appendf(&extra, " -U %s", g.zLogin);
161 if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){
162 zCmd = "list";
163 useCheckouts = find_option("ckout","c",0)!=0;
164 }else if( strncmp(zCmd, "clean", n)==0 ){
165 zCmd = "clean --chdir";
@@ -201,10 +212,16 @@
201 collect_argument(&extra, "vacuum",0);
202 collect_argument(&extra, "deanalyze",0);
203 collect_argument(&extra, "analyze",0);
204 collect_argument(&extra, "wal",0);
205 collect_argument(&extra, "stats",0);
 
 
 
 
 
 
206 }else if( strncmp(zCmd, "sync", n)==0 ){
207 zCmd = "sync -autourl -R";
208 collect_argument(&extra, "verbose","v");
209 }else if( strncmp(zCmd, "test-integrity", n)==0 ){
210 collect_argument(&extra, "parse", 0);
211
--- src/allrepo.c
+++ src/allrepo.c
@@ -65,10 +65,16 @@
65 }else{
66 blob_appendf(pExtra, " --%s \"\"", zArg);
67 }
68 }
69 }
70 static void collect_argv(Blob *pExtra, int iStart){
71 int i;
72 for(i=iStart; i<g.argc; i++){
73 blob_appendf(pExtra, " %s", g.argv[i]);
74 }
75 }
76
77
78 /*
79 ** COMMAND: all
80 **
@@ -118,10 +124,15 @@
124 ** present, are passed along verbatim. The --force and
125 ** --randomize options are not supported.
126 **
127 ** sync Run a "sync" on all repositories. Only the --verbose
128 ** option is supported.
129 **
130 ** setting Run the "setting", "set", or "unset" commands on all
131 ** set repositories. These command are particularly useful in
132 ** unset conjunection with the "max-loadavg" setting which cannot
133 ** otherwise be set globally.
134 **
135 ** Repositories are automatically added to the set of known repositories
136 ** when one of the following commands are run against the repository:
137 ** clone, info, pull, push, or sync. Even previously ignored repositories
138 ** are added back to the list of repositories by these commands.
@@ -155,11 +166,11 @@
166 }
167 n = strlen(g.argv[2]);
168 db_open_config(1);
169 blob_zero(&extra);
170 zCmd = g.argv[2];
171 if( !login_is_nobody() ) blob_appendf(&extra, " -U %s", g.zLogin);
172 if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){
173 zCmd = "list";
174 useCheckouts = find_option("ckout","c",0)!=0;
175 }else if( strncmp(zCmd, "clean", n)==0 ){
176 zCmd = "clean --chdir";
@@ -201,10 +212,16 @@
212 collect_argument(&extra, "vacuum",0);
213 collect_argument(&extra, "deanalyze",0);
214 collect_argument(&extra, "analyze",0);
215 collect_argument(&extra, "wal",0);
216 collect_argument(&extra, "stats",0);
217 }else if( strncmp(zCmd, "setting", n)==0 ){
218 zCmd = "setting -R";
219 collect_argv(&extra, 3);
220 }else if( strncmp(zCmd, "unset", n)==0 ){
221 zCmd = "unset -R";
222 collect_argv(&extra, 3);
223 }else if( strncmp(zCmd, "sync", n)==0 ){
224 zCmd = "sync -autourl -R";
225 collect_argument(&extra, "verbose","v");
226 }else if( strncmp(zCmd, "test-integrity", n)==0 ){
227 collect_argument(&extra, "parse", 0);
228
+2 -2
--- src/attach.c
+++ src/attach.c
@@ -309,11 +309,11 @@
309309
if( n>0 ){
310310
blob_appendf(&manifest, "C %#F\n", n, zComment);
311311
}
312312
zDate = date_in_standard_format("now");
313313
blob_appendf(&manifest, "D %s\n", zDate);
314
- blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody");
314
+ blob_appendf(&manifest, "U %F\n", login_name());
315315
md5sum_blob(&manifest, &cksum);
316316
blob_appendf(&manifest, "Z %b\n", &cksum);
317317
attach_put(&manifest, rid, needModerator);
318318
assert( blob_is_reset(&manifest) );
319319
db_end_transaction(0);
@@ -427,11 +427,11 @@
427427
zFile += n;
428428
if( zFile[0]==0 ) zFile = "unknown";
429429
blob_appendf(&manifest, "A %F %F\n", zFile, zTarget);
430430
zDate = date_in_standard_format("now");
431431
blob_appendf(&manifest, "D %s\n", zDate);
432
- blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody");
432
+ blob_appendf(&manifest, "U %F\n", login_name());
433433
md5sum_blob(&manifest, &cksum);
434434
blob_appendf(&manifest, "Z %b\n", &cksum);
435435
rid = content_put(&manifest);
436436
manifest_crosslink(rid, &manifest, MC_NONE);
437437
db_end_transaction(0);
438438
--- src/attach.c
+++ src/attach.c
@@ -309,11 +309,11 @@
309 if( n>0 ){
310 blob_appendf(&manifest, "C %#F\n", n, zComment);
311 }
312 zDate = date_in_standard_format("now");
313 blob_appendf(&manifest, "D %s\n", zDate);
314 blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody");
315 md5sum_blob(&manifest, &cksum);
316 blob_appendf(&manifest, "Z %b\n", &cksum);
317 attach_put(&manifest, rid, needModerator);
318 assert( blob_is_reset(&manifest) );
319 db_end_transaction(0);
@@ -427,11 +427,11 @@
427 zFile += n;
428 if( zFile[0]==0 ) zFile = "unknown";
429 blob_appendf(&manifest, "A %F %F\n", zFile, zTarget);
430 zDate = date_in_standard_format("now");
431 blob_appendf(&manifest, "D %s\n", zDate);
432 blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody");
433 md5sum_blob(&manifest, &cksum);
434 blob_appendf(&manifest, "Z %b\n", &cksum);
435 rid = content_put(&manifest);
436 manifest_crosslink(rid, &manifest, MC_NONE);
437 db_end_transaction(0);
438
--- src/attach.c
+++ src/attach.c
@@ -309,11 +309,11 @@
309 if( n>0 ){
310 blob_appendf(&manifest, "C %#F\n", n, zComment);
311 }
312 zDate = date_in_standard_format("now");
313 blob_appendf(&manifest, "D %s\n", zDate);
314 blob_appendf(&manifest, "U %F\n", login_name());
315 md5sum_blob(&manifest, &cksum);
316 blob_appendf(&manifest, "Z %b\n", &cksum);
317 attach_put(&manifest, rid, needModerator);
318 assert( blob_is_reset(&manifest) );
319 db_end_transaction(0);
@@ -427,11 +427,11 @@
427 zFile += n;
428 if( zFile[0]==0 ) zFile = "unknown";
429 blob_appendf(&manifest, "A %F %F\n", zFile, zTarget);
430 zDate = date_in_standard_format("now");
431 blob_appendf(&manifest, "D %s\n", zDate);
432 blob_appendf(&manifest, "U %F\n", login_name());
433 md5sum_blob(&manifest, &cksum);
434 blob_appendf(&manifest, "Z %b\n", &cksum);
435 rid = content_put(&manifest);
436 manifest_crosslink(rid, &manifest, MC_NONE);
437 db_end_transaction(0);
438
+7 -38
--- src/blob.c
+++ src/blob.c
@@ -786,48 +786,17 @@
786786
return nWrote;
787787
}
788788
#endif
789789
fwrite(blob_buffer(pBlob), 1, nWrote, stdout);
790790
}else{
791
- int i, nName;
792
- char *zName, zBuf[1000];
793
-
794
- nName = strlen(zFilename);
795
- if( nName>=sizeof(zBuf) ){
796
- zName = mprintf("%s", zFilename);
797
- }else{
798
- zName = zBuf;
799
- memcpy(zName, zFilename, nName+1);
800
- }
801
- nName = file_simplify_name(zName, nName, 0);
802
- for(i=1; i<nName; i++){
803
- if( zName[i]=='/' ){
804
- zName[i] = 0;
805
-#if defined(_WIN32) || defined(__CYGWIN__)
806
- /*
807
- ** On Windows, local path looks like: C:/develop/project/file.txt
808
- ** The if stops us from trying to create a directory of a drive letter
809
- ** C: in this example.
810
- */
811
- if( !(i==2 && zName[1]==':') ){
812
-#endif
813
- if( file_mkdir(zName, 1) && file_isdir(zName)!=1 ){
814
- fossil_fatal_recursive("unable to create directory %s", zName);
815
- return 0;
816
- }
817
-#if defined(_WIN32) || defined(__CYGWIN__)
818
- }
819
-#endif
820
- zName[i] = '/';
821
- }
822
- }
823
- out = fossil_fopen(zName, "wb");
824
- if( out==0 ){
825
- fossil_fatal_recursive("unable to open file \"%s\" for writing", zName);
826
- return 0;
827
- }
828
- if( zName!=zBuf ) free(zName);
791
+ file_mkfolder(zFilename, 1);
792
+ out = fossil_fopen(zFilename, "wb");
793
+ if( out==0 ){
794
+ fossil_fatal_recursive("unable to open file \"%s\" for writing",
795
+ zFilename);
796
+ return 0;
797
+ }
829798
blob_is_init(pBlob);
830799
nWrote = fwrite(blob_buffer(pBlob), 1, blob_size(pBlob), out);
831800
fclose(out);
832801
if( nWrote!=blob_size(pBlob) ){
833802
fossil_fatal_recursive("short write: %d of %d bytes to %s", nWrote,
834803
--- src/blob.c
+++ src/blob.c
@@ -786,48 +786,17 @@
786 return nWrote;
787 }
788 #endif
789 fwrite(blob_buffer(pBlob), 1, nWrote, stdout);
790 }else{
791 int i, nName;
792 char *zName, zBuf[1000];
793
794 nName = strlen(zFilename);
795 if( nName>=sizeof(zBuf) ){
796 zName = mprintf("%s", zFilename);
797 }else{
798 zName = zBuf;
799 memcpy(zName, zFilename, nName+1);
800 }
801 nName = file_simplify_name(zName, nName, 0);
802 for(i=1; i<nName; i++){
803 if( zName[i]=='/' ){
804 zName[i] = 0;
805 #if defined(_WIN32) || defined(__CYGWIN__)
806 /*
807 ** On Windows, local path looks like: C:/develop/project/file.txt
808 ** The if stops us from trying to create a directory of a drive letter
809 ** C: in this example.
810 */
811 if( !(i==2 && zName[1]==':') ){
812 #endif
813 if( file_mkdir(zName, 1) && file_isdir(zName)!=1 ){
814 fossil_fatal_recursive("unable to create directory %s", zName);
815 return 0;
816 }
817 #if defined(_WIN32) || defined(__CYGWIN__)
818 }
819 #endif
820 zName[i] = '/';
821 }
822 }
823 out = fossil_fopen(zName, "wb");
824 if( out==0 ){
825 fossil_fatal_recursive("unable to open file \"%s\" for writing", zName);
826 return 0;
827 }
828 if( zName!=zBuf ) free(zName);
829 blob_is_init(pBlob);
830 nWrote = fwrite(blob_buffer(pBlob), 1, blob_size(pBlob), out);
831 fclose(out);
832 if( nWrote!=blob_size(pBlob) ){
833 fossil_fatal_recursive("short write: %d of %d bytes to %s", nWrote,
834
--- src/blob.c
+++ src/blob.c
@@ -786,48 +786,17 @@
786 return nWrote;
787 }
788 #endif
789 fwrite(blob_buffer(pBlob), 1, nWrote, stdout);
790 }else{
791 file_mkfolder(zFilename, 1);
792 out = fossil_fopen(zFilename, "wb");
793 if( out==0 ){
794 fossil_fatal_recursive("unable to open file \"%s\" for writing",
795 zFilename);
796 return 0;
797 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
798 blob_is_init(pBlob);
799 nWrote = fwrite(blob_buffer(pBlob), 1, blob_size(pBlob), out);
800 fclose(out);
801 if( nWrote!=blob_size(pBlob) ){
802 fossil_fatal_recursive("short write: %d of %d bytes to %s", nWrote,
803
+1 -2
--- src/branch.c
+++ src/branch.c
@@ -134,17 +134,16 @@
134134
const char *zTag = db_column_text(&q, 0);
135135
blob_appendf(&branch, "T -%F *\n", zTag);
136136
}
137137
db_finalize(&q);
138138
139
- blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
139
+ blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : login_name());
140140
md5sum_blob(&branch, &mcksum);
141141
blob_appendf(&branch, "Z %b\n", &mcksum);
142142
if( !noSign && clearsign(&branch, &branch) ){
143143
Blob ans;
144144
char cReply;
145
- blob_zero(&ans);
146145
prompt_user("unable to sign manifest. continue (y/N)? ", &ans);
147146
cReply = blob_str(&ans)[0];
148147
if( cReply!='y' && cReply!='Y'){
149148
db_end_transaction(1);
150149
fossil_exit(1);
151150
--- src/branch.c
+++ src/branch.c
@@ -134,17 +134,16 @@
134 const char *zTag = db_column_text(&q, 0);
135 blob_appendf(&branch, "T -%F *\n", zTag);
136 }
137 db_finalize(&q);
138
139 blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
140 md5sum_blob(&branch, &mcksum);
141 blob_appendf(&branch, "Z %b\n", &mcksum);
142 if( !noSign && clearsign(&branch, &branch) ){
143 Blob ans;
144 char cReply;
145 blob_zero(&ans);
146 prompt_user("unable to sign manifest. continue (y/N)? ", &ans);
147 cReply = blob_str(&ans)[0];
148 if( cReply!='y' && cReply!='Y'){
149 db_end_transaction(1);
150 fossil_exit(1);
151
--- src/branch.c
+++ src/branch.c
@@ -134,17 +134,16 @@
134 const char *zTag = db_column_text(&q, 0);
135 blob_appendf(&branch, "T -%F *\n", zTag);
136 }
137 db_finalize(&q);
138
139 blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : login_name());
140 md5sum_blob(&branch, &mcksum);
141 blob_appendf(&branch, "Z %b\n", &mcksum);
142 if( !noSign && clearsign(&branch, &branch) ){
143 Blob ans;
144 char cReply;
 
145 prompt_user("unable to sign manifest. continue (y/N)? ", &ans);
146 cReply = blob_str(&ans)[0];
147 if( cReply!='y' && cReply!='Y'){
148 db_end_transaction(1);
149 fossil_exit(1);
150
+11 -5
--- src/browse.c
+++ src/browse.c
@@ -732,20 +732,22 @@
732732
733733
/*
734734
** Look at all file containing in the version "vid". Construct a
735735
** temporary table named "fileage" that contains the file-id for each
736736
** files, the pathname, the check-in where the file was added, and the
737
-** mtime on that checkin.
737
+** mtime on that checkin. If zGlob and *zGlob then only files matching
738
+** the given glob are computed.
738739
*/
739
-int compute_fileage(int vid){
740
+int compute_fileage(int vid, char const * zGlob){
740741
Manifest *pManifest;
741742
ManifestFile *pFile;
742743
int nFile = 0;
743744
double vmtime;
744745
Stmt ins;
745746
Stmt q1, q2, q3;
746747
Stmt upd;
748
+ if(zGlob && !*zGlob) zGlob = NULL;
747749
db_multi_exec(
748750
/*"DROP TABLE IF EXISTS temp.fileage;"*/
749751
"CREATE TEMP TABLE fileage("
750752
" fid INTEGER,"
751753
" mid INTEGER,"
@@ -760,10 +762,11 @@
760762
db_prepare(&ins,
761763
"INSERT INTO temp.fileage(fid, pathname)"
762764
" SELECT rid, :path FROM blob WHERE uuid=:uuid"
763765
);
764766
while( (pFile = manifest_file_next(pManifest, 0))!=0 ){
767
+ if(zGlob && !strglob(zGlob, pFile->zName)) continue;
765768
db_bind_text(&ins, ":uuid", pFile->zUuid);
766769
db_bind_text(&ins, ":path", pFile->zName);
767770
db_step(&ins);
768771
db_reset(&ins);
769772
nFile++;
@@ -807,20 +810,22 @@
807810
808811
/*
809812
** WEBPAGE: fileage
810813
**
811814
** Parameters:
812
-** name=VERSION
815
+** name=VERSION Selects the checkin version (default=tip).
816
+** glob=STRING Only shows files matching this glob pattern
817
+** (e.g. *.c or *.txt).
813818
*/
814819
void fileage_page(void){
815820
int rid;
816821
const char *zName;
817822
char *zBaseTime;
823
+ char const * zGlob;
818824
Stmt q;
819825
double baseTime;
820826
int lastMid = -1;
821
-
822827
login_check_credentials();
823828
if( !g.perm.Read ){ login_needed(); return; }
824829
zName = P("name");
825830
if( zName==0 ) zName = "tip";
826831
rid = symbolic_name_to_rid(zName, "ci");
@@ -827,11 +832,12 @@
827832
if( rid==0 ){
828833
fossil_fatal("not a valid check-in: %s", zName);
829834
}
830835
style_submenu_element("Tree-View", "Tree-View", "%R/tree?ci=%T", zName);
831836
style_header("File Ages", zName);
832
- compute_fileage(rid);
837
+ zGlob = P("glob");
838
+ compute_fileage(rid,zGlob);
833839
baseTime = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid);
834840
zBaseTime = db_text("","SELECT datetime(%.20g%s)", baseTime, timeline_utc());
835841
@ <h2>File Ages For Check-in
836842
@ %z(href("%R/info?name=%T",zName))%h(zName)</a></h2>
837843
@
838844
--- src/browse.c
+++ src/browse.c
@@ -732,20 +732,22 @@
732
733 /*
734 ** Look at all file containing in the version "vid". Construct a
735 ** temporary table named "fileage" that contains the file-id for each
736 ** files, the pathname, the check-in where the file was added, and the
737 ** mtime on that checkin.
 
738 */
739 int compute_fileage(int vid){
740 Manifest *pManifest;
741 ManifestFile *pFile;
742 int nFile = 0;
743 double vmtime;
744 Stmt ins;
745 Stmt q1, q2, q3;
746 Stmt upd;
 
747 db_multi_exec(
748 /*"DROP TABLE IF EXISTS temp.fileage;"*/
749 "CREATE TEMP TABLE fileage("
750 " fid INTEGER,"
751 " mid INTEGER,"
@@ -760,10 +762,11 @@
760 db_prepare(&ins,
761 "INSERT INTO temp.fileage(fid, pathname)"
762 " SELECT rid, :path FROM blob WHERE uuid=:uuid"
763 );
764 while( (pFile = manifest_file_next(pManifest, 0))!=0 ){
 
765 db_bind_text(&ins, ":uuid", pFile->zUuid);
766 db_bind_text(&ins, ":path", pFile->zName);
767 db_step(&ins);
768 db_reset(&ins);
769 nFile++;
@@ -807,20 +810,22 @@
807
808 /*
809 ** WEBPAGE: fileage
810 **
811 ** Parameters:
812 ** name=VERSION
 
 
813 */
814 void fileage_page(void){
815 int rid;
816 const char *zName;
817 char *zBaseTime;
 
818 Stmt q;
819 double baseTime;
820 int lastMid = -1;
821
822 login_check_credentials();
823 if( !g.perm.Read ){ login_needed(); return; }
824 zName = P("name");
825 if( zName==0 ) zName = "tip";
826 rid = symbolic_name_to_rid(zName, "ci");
@@ -827,11 +832,12 @@
827 if( rid==0 ){
828 fossil_fatal("not a valid check-in: %s", zName);
829 }
830 style_submenu_element("Tree-View", "Tree-View", "%R/tree?ci=%T", zName);
831 style_header("File Ages", zName);
832 compute_fileage(rid);
 
833 baseTime = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid);
834 zBaseTime = db_text("","SELECT datetime(%.20g%s)", baseTime, timeline_utc());
835 @ <h2>File Ages For Check-in
836 @ %z(href("%R/info?name=%T",zName))%h(zName)</a></h2>
837 @
838
--- src/browse.c
+++ src/browse.c
@@ -732,20 +732,22 @@
732
733 /*
734 ** Look at all file containing in the version "vid". Construct a
735 ** temporary table named "fileage" that contains the file-id for each
736 ** files, the pathname, the check-in where the file was added, and the
737 ** mtime on that checkin. If zGlob and *zGlob then only files matching
738 ** the given glob are computed.
739 */
740 int compute_fileage(int vid, char const * zGlob){
741 Manifest *pManifest;
742 ManifestFile *pFile;
743 int nFile = 0;
744 double vmtime;
745 Stmt ins;
746 Stmt q1, q2, q3;
747 Stmt upd;
748 if(zGlob && !*zGlob) zGlob = NULL;
749 db_multi_exec(
750 /*"DROP TABLE IF EXISTS temp.fileage;"*/
751 "CREATE TEMP TABLE fileage("
752 " fid INTEGER,"
753 " mid INTEGER,"
@@ -760,10 +762,11 @@
762 db_prepare(&ins,
763 "INSERT INTO temp.fileage(fid, pathname)"
764 " SELECT rid, :path FROM blob WHERE uuid=:uuid"
765 );
766 while( (pFile = manifest_file_next(pManifest, 0))!=0 ){
767 if(zGlob && !strglob(zGlob, pFile->zName)) continue;
768 db_bind_text(&ins, ":uuid", pFile->zUuid);
769 db_bind_text(&ins, ":path", pFile->zName);
770 db_step(&ins);
771 db_reset(&ins);
772 nFile++;
@@ -807,20 +810,22 @@
810
811 /*
812 ** WEBPAGE: fileage
813 **
814 ** Parameters:
815 ** name=VERSION Selects the checkin version (default=tip).
816 ** glob=STRING Only shows files matching this glob pattern
817 ** (e.g. *.c or *.txt).
818 */
819 void fileage_page(void){
820 int rid;
821 const char *zName;
822 char *zBaseTime;
823 char const * zGlob;
824 Stmt q;
825 double baseTime;
826 int lastMid = -1;
 
827 login_check_credentials();
828 if( !g.perm.Read ){ login_needed(); return; }
829 zName = P("name");
830 if( zName==0 ) zName = "tip";
831 rid = symbolic_name_to_rid(zName, "ci");
@@ -827,11 +832,12 @@
832 if( rid==0 ){
833 fossil_fatal("not a valid check-in: %s", zName);
834 }
835 style_submenu_element("Tree-View", "Tree-View", "%R/tree?ci=%T", zName);
836 style_header("File Ages", zName);
837 zGlob = P("glob");
838 compute_fileage(rid,zGlob);
839 baseTime = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid);
840 zBaseTime = db_text("","SELECT datetime(%.20g%s)", baseTime, timeline_utc());
841 @ <h2>File Ages For Check-in
842 @ %z(href("%R/info?name=%T",zName))%h(zName)</a></h2>
843 @
844
+1 -2
--- src/captcha.c
+++ src/captcha.c
@@ -482,12 +482,11 @@
482482
** are user "nobody") and if the "require-captcha" setting is true. The
483483
** "require-captcha" setting is controlled on the Admin/Access page. It
484484
** defaults to true.
485485
*/
486486
int captcha_needed(void){
487
- if( g.zLogin!=0 ) return 0;
488
- return db_get_boolean("require-captcha", 1);
487
+ return login_is_nobody() && db_get_boolean("require-captcha", 1);
489488
}
490489
491490
/*
492491
** If a captcha is required but the correct captcha code is not supplied
493492
** in the query parameters, then return false (0).
494493
--- src/captcha.c
+++ src/captcha.c
@@ -482,12 +482,11 @@
482 ** are user "nobody") and if the "require-captcha" setting is true. The
483 ** "require-captcha" setting is controlled on the Admin/Access page. It
484 ** defaults to true.
485 */
486 int captcha_needed(void){
487 if( g.zLogin!=0 ) return 0;
488 return db_get_boolean("require-captcha", 1);
489 }
490
491 /*
492 ** If a captcha is required but the correct captcha code is not supplied
493 ** in the query parameters, then return false (0).
494
--- src/captcha.c
+++ src/captcha.c
@@ -482,12 +482,11 @@
482 ** are user "nobody") and if the "require-captcha" setting is true. The
483 ** "require-captcha" setting is controlled on the Admin/Access page. It
484 ** defaults to true.
485 */
486 int captcha_needed(void){
487 return login_is_nobody() && db_get_boolean("require-captcha", 1);
 
488 }
489
490 /*
491 ** If a captcha is required but the correct captcha code is not supplied
492 ** in the query parameters, then return false (0).
493
+8 -15
--- src/checkin.c
+++ src/checkin.c
@@ -600,11 +600,10 @@
600600
if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
601601
Blob ans;
602602
char cReply;
603603
char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ",
604604
zName+nRoot);
605
- blob_zero(&ans);
606605
prompt_user(prompt, &ans);
607606
cReply = blob_str(&ans)[0];
608607
if( cReply=='a' || cReply=='A' ){
609608
allFileFlag = 1;
610609
}else if( cReply!='y' && cReply!='Y' ){
@@ -642,11 +641,10 @@
642641
if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
643642
Blob ans;
644643
char cReply;
645644
char *prompt = mprintf("Remove empty directory \"%s\" (a=all/y/N)? ",
646645
zName+nRoot);
647
- blob_zero(&ans);
648646
prompt_user(prompt, &ans);
649647
cReply = blob_str(&ans)[0];
650648
if( cReply=='a' || cReply=='A' ){
651649
allDirFlag = 1;
652650
}else if( cReply!='y' && cReply!='Y' ){
@@ -803,11 +801,11 @@
803801
blob_append(&prompt,
804802
"\n"
805803
"# Enter commit message for this check-in. Lines beginning with # are ignored.\n"
806804
"#\n", -1
807805
);
808
- blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin);
806
+ blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : login_name());
809807
if( p->zBranch && p->zBranch[0] ){
810808
blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch);
811809
}else{
812810
char *zTags = info_tags_of_checkin(parent_rid, 1);
813811
if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags);
@@ -965,11 +963,11 @@
965963
int verifyDate; /* Verify that child is younger */
966964
int closeFlag; /* Close the branch being committed */
967965
int integrateFlag; /* Close merged-in branches */
968966
Blob *pCksum; /* Repository checksum. May be 0 */
969967
const char *zDateOvrd; /* Date override. If 0 then use 'now' */
970
- const char *zUserOvrd; /* User override. If 0 then use g.zLogin */
968
+ const char *zUserOvrd; /* User override. If 0 then use login_name() */
971969
const char *zBranch; /* Branch name. May be 0 */
972970
const char *zColor; /* One-time background color. May be 0 */
973971
const char *zBrClr; /* Persistent branch color. May be 0 */
974972
const char **azTag; /* Tags to apply to this check-in */
975973
};
@@ -1191,11 +1189,11 @@
11911189
const char *zBrTag = db_column_text(&q, 0);
11921190
blob_appendf(pOut, "T -%F *\n", zBrTag);
11931191
}
11941192
db_finalize(&q);
11951193
}
1196
- blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin);
1194
+ blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : login_name());
11971195
md5sum_blob(pOut, &mcksum);
11981196
blob_appendf(pOut, "Z %b\n", &mcksum);
11991197
if( pnFBcard ) *pnFBcard = nFBcard;
12001198
}
12011199
@@ -1288,11 +1286,10 @@
12881286
}
12891287
zWarning = "Unicode";
12901288
zDisable = "\"encoding-glob\" setting";
12911289
}
12921290
file_relative_name(zFilename, &fname, 0);
1293
- blob_zero(&ans);
12941291
zMsg = mprintf(
12951292
"%s contains %s. Use --no-warnings or the %s to disable this warning.\n"
12961293
"Commit anyhow (a=all/%sy/N)? ",
12971294
blob_str(&fname), zWarning, zDisable, zConvert);
12981295
prompt_user(zMsg, &ans);
@@ -1520,20 +1517,21 @@
15201517
forceBaseline = 1;
15211518
}
15221519
15231520
/* Get the ID of the parent manifest artifact */
15241521
vid = db_lget_int("checkout", 0);
1525
- if( content_is_private(vid) ){
1522
+ if( vid==0 ){
1523
+ useCksum = 1;
1524
+ }else if( content_is_private(vid) ){
15261525
g.markPrivate = 1;
15271526
}
15281527
15291528
/*
15301529
** Autosync if autosync is enabled and this is not a private check-in.
15311530
*/
15321531
if( !g.markPrivate ){
15331532
if( autosync(SYNC_PULL) ){
1534
- blob_zero(&ans);
15351533
prompt_user("continue in spite of sync failure (y/N)? ", &ans);
15361534
cReply = blob_str(&ans)[0];
15371535
if( cReply!='y' && cReply!='Y' ){
15381536
fossil_exit(1);
15391537
}
@@ -1542,11 +1540,10 @@
15421540
15431541
/* Require confirmation to continue with the check-in if there is
15441542
** clock skew
15451543
*/
15461544
if( g.clockSkewSeen ){
1547
- blob_zero(&ans);
15481545
prompt_user("continue in spite of time skew (y/N)? ", &ans);
15491546
cReply = blob_str(&ans)[0];
15501547
if( cReply!='y' && cReply!='Y' ){
15511548
fossil_exit(1);
15521549
}
@@ -1561,14 +1558,13 @@
15611558
** array is allocated to contain the "id" field from the vfile table
15621559
** for each file to be committed. Or, if aCommitFile is NULL, all files
15631560
** should be committed.
15641561
*/
15651562
if( select_commit_files() ){
1566
- blob_zero(&ans);
15671563
prompt_user("continue (y/N)? ", &ans);
15681564
cReply = blob_str(&ans)[0];
1569
- if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
1565
+ if( cReply!='y' && cReply!='Y' ) fossil_exit(1);
15701566
}
15711567
isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2");
15721568
if( g.aCommitFile && isAMerge ){
15731569
fossil_fatal("cannot do a partial commit of a merge");
15741570
}
@@ -1662,20 +1658,18 @@
16621658
blob_zero(&comment);
16631659
}else{
16641660
char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
16651661
prepare_commit_comment(&comment, zInit, &sCiInfo, vid);
16661662
if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){
1667
- blob_zero(&ans);
16681663
prompt_user("unchanged check-in comment. continue (y/N)? ", &ans);
16691664
cReply = blob_str(&ans)[0];
1670
- if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
1665
+ if( cReply!='y' && cReply!='Y' ) fossil_exit(1);
16711666
}
16721667
free(zInit);
16731668
}
16741669
if( blob_size(&comment)==0 ){
16751670
if( !dryRunFlag ){
1676
- blob_zero(&ans);
16771671
prompt_user("empty check-in comment. continue (y/N)? ", &ans);
16781672
cReply = blob_str(&ans)[0];
16791673
if( cReply!='y' && cReply!='Y' ){
16801674
fossil_exit(1);
16811675
}
@@ -1804,11 +1798,10 @@
18041798
}else if( forceDelta ){
18051799
fossil_fatal("unable to find a baseline-manifest for the delta");
18061800
}
18071801
}
18081802
if( !noSign && !g.markPrivate && clearsign(&manifest, &manifest) ){
1809
- blob_zero(&ans);
18101803
prompt_user("unable to sign manifest. continue (y/N)? ", &ans);
18111804
cReply = blob_str(&ans)[0];
18121805
if( cReply!='y' && cReply!='Y' ){
18131806
fossil_exit(1);
18141807
}
18151808
--- src/checkin.c
+++ src/checkin.c
@@ -600,11 +600,10 @@
600 if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
601 Blob ans;
602 char cReply;
603 char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ",
604 zName+nRoot);
605 blob_zero(&ans);
606 prompt_user(prompt, &ans);
607 cReply = blob_str(&ans)[0];
608 if( cReply=='a' || cReply=='A' ){
609 allFileFlag = 1;
610 }else if( cReply!='y' && cReply!='Y' ){
@@ -642,11 +641,10 @@
642 if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
643 Blob ans;
644 char cReply;
645 char *prompt = mprintf("Remove empty directory \"%s\" (a=all/y/N)? ",
646 zName+nRoot);
647 blob_zero(&ans);
648 prompt_user(prompt, &ans);
649 cReply = blob_str(&ans)[0];
650 if( cReply=='a' || cReply=='A' ){
651 allDirFlag = 1;
652 }else if( cReply!='y' && cReply!='Y' ){
@@ -803,11 +801,11 @@
803 blob_append(&prompt,
804 "\n"
805 "# Enter commit message for this check-in. Lines beginning with # are ignored.\n"
806 "#\n", -1
807 );
808 blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin);
809 if( p->zBranch && p->zBranch[0] ){
810 blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch);
811 }else{
812 char *zTags = info_tags_of_checkin(parent_rid, 1);
813 if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags);
@@ -965,11 +963,11 @@
965 int verifyDate; /* Verify that child is younger */
966 int closeFlag; /* Close the branch being committed */
967 int integrateFlag; /* Close merged-in branches */
968 Blob *pCksum; /* Repository checksum. May be 0 */
969 const char *zDateOvrd; /* Date override. If 0 then use 'now' */
970 const char *zUserOvrd; /* User override. If 0 then use g.zLogin */
971 const char *zBranch; /* Branch name. May be 0 */
972 const char *zColor; /* One-time background color. May be 0 */
973 const char *zBrClr; /* Persistent branch color. May be 0 */
974 const char **azTag; /* Tags to apply to this check-in */
975 };
@@ -1191,11 +1189,11 @@
1191 const char *zBrTag = db_column_text(&q, 0);
1192 blob_appendf(pOut, "T -%F *\n", zBrTag);
1193 }
1194 db_finalize(&q);
1195 }
1196 blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin);
1197 md5sum_blob(pOut, &mcksum);
1198 blob_appendf(pOut, "Z %b\n", &mcksum);
1199 if( pnFBcard ) *pnFBcard = nFBcard;
1200 }
1201
@@ -1288,11 +1286,10 @@
1288 }
1289 zWarning = "Unicode";
1290 zDisable = "\"encoding-glob\" setting";
1291 }
1292 file_relative_name(zFilename, &fname, 0);
1293 blob_zero(&ans);
1294 zMsg = mprintf(
1295 "%s contains %s. Use --no-warnings or the %s to disable this warning.\n"
1296 "Commit anyhow (a=all/%sy/N)? ",
1297 blob_str(&fname), zWarning, zDisable, zConvert);
1298 prompt_user(zMsg, &ans);
@@ -1520,20 +1517,21 @@
1520 forceBaseline = 1;
1521 }
1522
1523 /* Get the ID of the parent manifest artifact */
1524 vid = db_lget_int("checkout", 0);
1525 if( content_is_private(vid) ){
 
 
1526 g.markPrivate = 1;
1527 }
1528
1529 /*
1530 ** Autosync if autosync is enabled and this is not a private check-in.
1531 */
1532 if( !g.markPrivate ){
1533 if( autosync(SYNC_PULL) ){
1534 blob_zero(&ans);
1535 prompt_user("continue in spite of sync failure (y/N)? ", &ans);
1536 cReply = blob_str(&ans)[0];
1537 if( cReply!='y' && cReply!='Y' ){
1538 fossil_exit(1);
1539 }
@@ -1542,11 +1540,10 @@
1542
1543 /* Require confirmation to continue with the check-in if there is
1544 ** clock skew
1545 */
1546 if( g.clockSkewSeen ){
1547 blob_zero(&ans);
1548 prompt_user("continue in spite of time skew (y/N)? ", &ans);
1549 cReply = blob_str(&ans)[0];
1550 if( cReply!='y' && cReply!='Y' ){
1551 fossil_exit(1);
1552 }
@@ -1561,14 +1558,13 @@
1561 ** array is allocated to contain the "id" field from the vfile table
1562 ** for each file to be committed. Or, if aCommitFile is NULL, all files
1563 ** should be committed.
1564 */
1565 if( select_commit_files() ){
1566 blob_zero(&ans);
1567 prompt_user("continue (y/N)? ", &ans);
1568 cReply = blob_str(&ans)[0];
1569 if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
1570 }
1571 isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2");
1572 if( g.aCommitFile && isAMerge ){
1573 fossil_fatal("cannot do a partial commit of a merge");
1574 }
@@ -1662,20 +1658,18 @@
1662 blob_zero(&comment);
1663 }else{
1664 char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
1665 prepare_commit_comment(&comment, zInit, &sCiInfo, vid);
1666 if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){
1667 blob_zero(&ans);
1668 prompt_user("unchanged check-in comment. continue (y/N)? ", &ans);
1669 cReply = blob_str(&ans)[0];
1670 if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
1671 }
1672 free(zInit);
1673 }
1674 if( blob_size(&comment)==0 ){
1675 if( !dryRunFlag ){
1676 blob_zero(&ans);
1677 prompt_user("empty check-in comment. continue (y/N)? ", &ans);
1678 cReply = blob_str(&ans)[0];
1679 if( cReply!='y' && cReply!='Y' ){
1680 fossil_exit(1);
1681 }
@@ -1804,11 +1798,10 @@
1804 }else if( forceDelta ){
1805 fossil_fatal("unable to find a baseline-manifest for the delta");
1806 }
1807 }
1808 if( !noSign && !g.markPrivate && clearsign(&manifest, &manifest) ){
1809 blob_zero(&ans);
1810 prompt_user("unable to sign manifest. continue (y/N)? ", &ans);
1811 cReply = blob_str(&ans)[0];
1812 if( cReply!='y' && cReply!='Y' ){
1813 fossil_exit(1);
1814 }
1815
--- src/checkin.c
+++ src/checkin.c
@@ -600,11 +600,10 @@
600 if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
601 Blob ans;
602 char cReply;
603 char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ",
604 zName+nRoot);
 
605 prompt_user(prompt, &ans);
606 cReply = blob_str(&ans)[0];
607 if( cReply=='a' || cReply=='A' ){
608 allFileFlag = 1;
609 }else if( cReply!='y' && cReply!='Y' ){
@@ -642,11 +641,10 @@
641 if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
642 Blob ans;
643 char cReply;
644 char *prompt = mprintf("Remove empty directory \"%s\" (a=all/y/N)? ",
645 zName+nRoot);
 
646 prompt_user(prompt, &ans);
647 cReply = blob_str(&ans)[0];
648 if( cReply=='a' || cReply=='A' ){
649 allDirFlag = 1;
650 }else if( cReply!='y' && cReply!='Y' ){
@@ -803,11 +801,11 @@
801 blob_append(&prompt,
802 "\n"
803 "# Enter commit message for this check-in. Lines beginning with # are ignored.\n"
804 "#\n", -1
805 );
806 blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : login_name());
807 if( p->zBranch && p->zBranch[0] ){
808 blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch);
809 }else{
810 char *zTags = info_tags_of_checkin(parent_rid, 1);
811 if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags);
@@ -965,11 +963,11 @@
963 int verifyDate; /* Verify that child is younger */
964 int closeFlag; /* Close the branch being committed */
965 int integrateFlag; /* Close merged-in branches */
966 Blob *pCksum; /* Repository checksum. May be 0 */
967 const char *zDateOvrd; /* Date override. If 0 then use 'now' */
968 const char *zUserOvrd; /* User override. If 0 then use login_name() */
969 const char *zBranch; /* Branch name. May be 0 */
970 const char *zColor; /* One-time background color. May be 0 */
971 const char *zBrClr; /* Persistent branch color. May be 0 */
972 const char **azTag; /* Tags to apply to this check-in */
973 };
@@ -1191,11 +1189,11 @@
1189 const char *zBrTag = db_column_text(&q, 0);
1190 blob_appendf(pOut, "T -%F *\n", zBrTag);
1191 }
1192 db_finalize(&q);
1193 }
1194 blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : login_name());
1195 md5sum_blob(pOut, &mcksum);
1196 blob_appendf(pOut, "Z %b\n", &mcksum);
1197 if( pnFBcard ) *pnFBcard = nFBcard;
1198 }
1199
@@ -1288,11 +1286,10 @@
1286 }
1287 zWarning = "Unicode";
1288 zDisable = "\"encoding-glob\" setting";
1289 }
1290 file_relative_name(zFilename, &fname, 0);
 
1291 zMsg = mprintf(
1292 "%s contains %s. Use --no-warnings or the %s to disable this warning.\n"
1293 "Commit anyhow (a=all/%sy/N)? ",
1294 blob_str(&fname), zWarning, zDisable, zConvert);
1295 prompt_user(zMsg, &ans);
@@ -1520,20 +1517,21 @@
1517 forceBaseline = 1;
1518 }
1519
1520 /* Get the ID of the parent manifest artifact */
1521 vid = db_lget_int("checkout", 0);
1522 if( vid==0 ){
1523 useCksum = 1;
1524 }else if( content_is_private(vid) ){
1525 g.markPrivate = 1;
1526 }
1527
1528 /*
1529 ** Autosync if autosync is enabled and this is not a private check-in.
1530 */
1531 if( !g.markPrivate ){
1532 if( autosync(SYNC_PULL) ){
 
1533 prompt_user("continue in spite of sync failure (y/N)? ", &ans);
1534 cReply = blob_str(&ans)[0];
1535 if( cReply!='y' && cReply!='Y' ){
1536 fossil_exit(1);
1537 }
@@ -1542,11 +1540,10 @@
1540
1541 /* Require confirmation to continue with the check-in if there is
1542 ** clock skew
1543 */
1544 if( g.clockSkewSeen ){
 
1545 prompt_user("continue in spite of time skew (y/N)? ", &ans);
1546 cReply = blob_str(&ans)[0];
1547 if( cReply!='y' && cReply!='Y' ){
1548 fossil_exit(1);
1549 }
@@ -1561,14 +1558,13 @@
1558 ** array is allocated to contain the "id" field from the vfile table
1559 ** for each file to be committed. Or, if aCommitFile is NULL, all files
1560 ** should be committed.
1561 */
1562 if( select_commit_files() ){
 
1563 prompt_user("continue (y/N)? ", &ans);
1564 cReply = blob_str(&ans)[0];
1565 if( cReply!='y' && cReply!='Y' ) fossil_exit(1);
1566 }
1567 isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2");
1568 if( g.aCommitFile && isAMerge ){
1569 fossil_fatal("cannot do a partial commit of a merge");
1570 }
@@ -1662,20 +1658,18 @@
1658 blob_zero(&comment);
1659 }else{
1660 char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
1661 prepare_commit_comment(&comment, zInit, &sCiInfo, vid);
1662 if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){
 
1663 prompt_user("unchanged check-in comment. continue (y/N)? ", &ans);
1664 cReply = blob_str(&ans)[0];
1665 if( cReply!='y' && cReply!='Y' ) fossil_exit(1);
1666 }
1667 free(zInit);
1668 }
1669 if( blob_size(&comment)==0 ){
1670 if( !dryRunFlag ){
 
1671 prompt_user("empty check-in comment. continue (y/N)? ", &ans);
1672 cReply = blob_str(&ans)[0];
1673 if( cReply!='y' && cReply!='Y' ){
1674 fossil_exit(1);
1675 }
@@ -1804,11 +1798,10 @@
1798 }else if( forceDelta ){
1799 fossil_fatal("unable to find a baseline-manifest for the delta");
1800 }
1801 }
1802 if( !noSign && !g.markPrivate && clearsign(&manifest, &manifest) ){
 
1803 prompt_user("unable to sign manifest. continue (y/N)? ", &ans);
1804 cReply = blob_str(&ans)[0];
1805 if( cReply!='y' && cReply!='Y' ){
1806 fossil_exit(1);
1807 }
1808
+3 -3
--- src/checkout.c
+++ src/checkout.c
@@ -157,11 +157,11 @@
157157
zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
158158
file_delete(zManFile);
159159
free(zManFile);
160160
}
161161
}
162
-
162
+
163163
}
164164
165165
/*
166166
** COMMAND: checkout*
167167
** COMMAND: co*
@@ -175,11 +175,11 @@
175175
** leaves files on disk unchanged, except the manifest and manifest.uuid
176176
** files.
177177
**
178178
** The --latest flag can be used in place of VERSION to checkout the
179179
** latest version in the repository.
180
-**
180
+**
181181
** Options:
182182
** --force Ignore edited files in the current checkout
183183
** --keep Only update the manifest and manifest.uuid files
184184
**
185185
** See also: update
@@ -190,11 +190,11 @@
190190
int latestFlag; /* Checkout the latest version */
191191
char *zVers; /* Version to checkout */
192192
int promptFlag; /* True to prompt before overwriting */
193193
int vid, prior;
194194
Blob cksum1, cksum1b, cksum2;
195
-
195
+
196196
db_must_be_within_tree();
197197
db_begin_transaction();
198198
forceFlag = find_option("force","f",0)!=0;
199199
keepFlag = find_option("keep",0,0)!=0;
200200
latestFlag = find_option("latest",0,0)!=0;
201201
--- src/checkout.c
+++ src/checkout.c
@@ -157,11 +157,11 @@
157 zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
158 file_delete(zManFile);
159 free(zManFile);
160 }
161 }
162
163 }
164
165 /*
166 ** COMMAND: checkout*
167 ** COMMAND: co*
@@ -175,11 +175,11 @@
175 ** leaves files on disk unchanged, except the manifest and manifest.uuid
176 ** files.
177 **
178 ** The --latest flag can be used in place of VERSION to checkout the
179 ** latest version in the repository.
180 **
181 ** Options:
182 ** --force Ignore edited files in the current checkout
183 ** --keep Only update the manifest and manifest.uuid files
184 **
185 ** See also: update
@@ -190,11 +190,11 @@
190 int latestFlag; /* Checkout the latest version */
191 char *zVers; /* Version to checkout */
192 int promptFlag; /* True to prompt before overwriting */
193 int vid, prior;
194 Blob cksum1, cksum1b, cksum2;
195
196 db_must_be_within_tree();
197 db_begin_transaction();
198 forceFlag = find_option("force","f",0)!=0;
199 keepFlag = find_option("keep",0,0)!=0;
200 latestFlag = find_option("latest",0,0)!=0;
201
--- src/checkout.c
+++ src/checkout.c
@@ -157,11 +157,11 @@
157 zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
158 file_delete(zManFile);
159 free(zManFile);
160 }
161 }
162
163 }
164
165 /*
166 ** COMMAND: checkout*
167 ** COMMAND: co*
@@ -175,11 +175,11 @@
175 ** leaves files on disk unchanged, except the manifest and manifest.uuid
176 ** files.
177 **
178 ** The --latest flag can be used in place of VERSION to checkout the
179 ** latest version in the repository.
180 **
181 ** Options:
182 ** --force Ignore edited files in the current checkout
183 ** --keep Only update the manifest and manifest.uuid files
184 **
185 ** See also: update
@@ -190,11 +190,11 @@
190 int latestFlag; /* Checkout the latest version */
191 char *zVers; /* Version to checkout */
192 int promptFlag; /* True to prompt before overwriting */
193 int vid, prior;
194 Blob cksum1, cksum1b, cksum2;
195
196 db_must_be_within_tree();
197 db_begin_transaction();
198 forceFlag = find_option("force","f",0)!=0;
199 keepFlag = find_option("keep",0,0)!=0;
200 latestFlag = find_option("latest",0,0)!=0;
201
+51
--- src/clone.c
+++ src/clone.c
@@ -109,22 +109,25 @@
109109
** --admin-user|-A USERNAME Make USERNAME the administrator
110110
** --once Don't save url.
111111
** --private Also clone private branches
112112
** --ssl-identity=filename Use the SSL identity if requested by the server
113113
** --ssh-command|-c 'command' Use this SSH command
114
+** --httpauth|-B 'user:pass' Add HTTP Basic Authorization to requests
114115
**
115116
** See also: init
116117
*/
117118
void clone_cmd(void){
118119
char *zPassword;
119120
const char *zDefaultUser; /* Optional name of the default user */
121
+ const char *zHttpAuth; /* HTTP Authorization user:pass information */
120122
int nErr = 0;
121123
int bPrivate = 0; /* Also clone private branches */
122124
int urlFlags = URL_PROMPT_PW | URL_REMEMBER;
123125
124126
if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE;
125127
if( find_option("once",0,0)!=0) urlFlags &= ~URL_REMEMBER;
128
+ zHttpAuth = find_option("httpauth","B",1);
126129
zDefaultUser = find_option("admin-user","A",1);
127130
clone_ssh_find_options();
128131
url_proxy_options();
129132
if( g.argc < 4 ){
130133
usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY");
@@ -159,10 +162,11 @@
159162
db_initial_setup(0, 0, zDefaultUser, 0);
160163
user_select();
161164
db_set("content-schema", CONTENT_SCHEMA, 0);
162165
db_set("aux-schema", AUX_SCHEMA, 0);
163166
db_set("rebuilt", get_version(), 0);
167
+ remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]);
164168
url_remember();
165169
if( g.zSSLIdentity!=0 ){
166170
/* If the --ssl-identity option was specified, store it as a setting */
167171
Blob fn;
168172
blob_zero(&fn);
@@ -195,10 +199,57 @@
195199
fossil_print("project-id: %s\n", db_get("project-code", 0));
196200
zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
197201
fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword);
198202
db_end_transaction(0);
199203
}
204
+
205
+/*
206
+** If user chooses to use HTTP Authentication over unencrypted HTTP,
207
+** remember decision. Otherwise, if the URL is being changed and no
208
+** preference has been indicated, err on the safe side and revert the
209
+** decision. Set the global preference if the URL is not being changed.
210
+*/
211
+void remember_or_get_http_auth(
212
+ const char *zHttpAuth, /* Credentials in the form "user:password" */
213
+ int fRemember, /* True to remember credentials for later reuse */
214
+ const char *zUrl /* URL for which these credentials apply */
215
+){
216
+ char *zKey = mprintf("http-auth:%s", g.urlCanonical);
217
+ if( zHttpAuth && zHttpAuth[0] ){
218
+ g.zHttpAuth = mprintf("%s", zHttpAuth);
219
+ }
220
+ if( fRemember ){
221
+ if( g.zHttpAuth && g.zHttpAuth[0] ){
222
+ set_httpauth(g.zHttpAuth);
223
+ }else if( zUrl && zUrl[0] ){
224
+ db_unset(zKey, 0);
225
+ }else{
226
+ g.zHttpAuth = get_httpauth();
227
+ }
228
+ }else if( g.zHttpAuth==0 && zUrl==0 ){
229
+ g.zHttpAuth = get_httpauth();
230
+ }
231
+ free(zKey);
232
+}
233
+
234
+/*
235
+** Get the HTTP Authorization preference from db.
236
+*/
237
+char *get_httpauth(void){
238
+ char *zKey = mprintf("http-auth:%s", g.urlCanonical);
239
+ return unobscure(db_get(zKey, 0));
240
+ free(zKey);
241
+}
242
+
243
+/*
244
+** Set the HTTP Authorization preference in db.
245
+*/
246
+void set_httpauth(const char *zHttpAuth){
247
+ char *zKey = mprintf("http-auth:%s", g.urlCanonical);
248
+ db_set(zKey, obscure(zHttpAuth), 0);
249
+ free(zKey);
250
+}
200251
201252
/*
202253
** Look for SSH clone command line options and setup in globals.
203254
*/
204255
void clone_ssh_find_options(void){
205256
--- src/clone.c
+++ src/clone.c
@@ -109,22 +109,25 @@
109 ** --admin-user|-A USERNAME Make USERNAME the administrator
110 ** --once Don't save url.
111 ** --private Also clone private branches
112 ** --ssl-identity=filename Use the SSL identity if requested by the server
113 ** --ssh-command|-c 'command' Use this SSH command
 
114 **
115 ** See also: init
116 */
117 void clone_cmd(void){
118 char *zPassword;
119 const char *zDefaultUser; /* Optional name of the default user */
 
120 int nErr = 0;
121 int bPrivate = 0; /* Also clone private branches */
122 int urlFlags = URL_PROMPT_PW | URL_REMEMBER;
123
124 if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE;
125 if( find_option("once",0,0)!=0) urlFlags &= ~URL_REMEMBER;
 
126 zDefaultUser = find_option("admin-user","A",1);
127 clone_ssh_find_options();
128 url_proxy_options();
129 if( g.argc < 4 ){
130 usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY");
@@ -159,10 +162,11 @@
159 db_initial_setup(0, 0, zDefaultUser, 0);
160 user_select();
161 db_set("content-schema", CONTENT_SCHEMA, 0);
162 db_set("aux-schema", AUX_SCHEMA, 0);
163 db_set("rebuilt", get_version(), 0);
 
164 url_remember();
165 if( g.zSSLIdentity!=0 ){
166 /* If the --ssl-identity option was specified, store it as a setting */
167 Blob fn;
168 blob_zero(&fn);
@@ -195,10 +199,57 @@
195 fossil_print("project-id: %s\n", db_get("project-code", 0));
196 zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
197 fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword);
198 db_end_transaction(0);
199 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
201 /*
202 ** Look for SSH clone command line options and setup in globals.
203 */
204 void clone_ssh_find_options(void){
205
--- src/clone.c
+++ src/clone.c
@@ -109,22 +109,25 @@
109 ** --admin-user|-A USERNAME Make USERNAME the administrator
110 ** --once Don't save url.
111 ** --private Also clone private branches
112 ** --ssl-identity=filename Use the SSL identity if requested by the server
113 ** --ssh-command|-c 'command' Use this SSH command
114 ** --httpauth|-B 'user:pass' Add HTTP Basic Authorization to requests
115 **
116 ** See also: init
117 */
118 void clone_cmd(void){
119 char *zPassword;
120 const char *zDefaultUser; /* Optional name of the default user */
121 const char *zHttpAuth; /* HTTP Authorization user:pass information */
122 int nErr = 0;
123 int bPrivate = 0; /* Also clone private branches */
124 int urlFlags = URL_PROMPT_PW | URL_REMEMBER;
125
126 if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE;
127 if( find_option("once",0,0)!=0) urlFlags &= ~URL_REMEMBER;
128 zHttpAuth = find_option("httpauth","B",1);
129 zDefaultUser = find_option("admin-user","A",1);
130 clone_ssh_find_options();
131 url_proxy_options();
132 if( g.argc < 4 ){
133 usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY");
@@ -159,10 +162,11 @@
162 db_initial_setup(0, 0, zDefaultUser, 0);
163 user_select();
164 db_set("content-schema", CONTENT_SCHEMA, 0);
165 db_set("aux-schema", AUX_SCHEMA, 0);
166 db_set("rebuilt", get_version(), 0);
167 remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]);
168 url_remember();
169 if( g.zSSLIdentity!=0 ){
170 /* If the --ssl-identity option was specified, store it as a setting */
171 Blob fn;
172 blob_zero(&fn);
@@ -195,10 +199,57 @@
199 fossil_print("project-id: %s\n", db_get("project-code", 0));
200 zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
201 fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword);
202 db_end_transaction(0);
203 }
204
205 /*
206 ** If user chooses to use HTTP Authentication over unencrypted HTTP,
207 ** remember decision. Otherwise, if the URL is being changed and no
208 ** preference has been indicated, err on the safe side and revert the
209 ** decision. Set the global preference if the URL is not being changed.
210 */
211 void remember_or_get_http_auth(
212 const char *zHttpAuth, /* Credentials in the form "user:password" */
213 int fRemember, /* True to remember credentials for later reuse */
214 const char *zUrl /* URL for which these credentials apply */
215 ){
216 char *zKey = mprintf("http-auth:%s", g.urlCanonical);
217 if( zHttpAuth && zHttpAuth[0] ){
218 g.zHttpAuth = mprintf("%s", zHttpAuth);
219 }
220 if( fRemember ){
221 if( g.zHttpAuth && g.zHttpAuth[0] ){
222 set_httpauth(g.zHttpAuth);
223 }else if( zUrl && zUrl[0] ){
224 db_unset(zKey, 0);
225 }else{
226 g.zHttpAuth = get_httpauth();
227 }
228 }else if( g.zHttpAuth==0 && zUrl==0 ){
229 g.zHttpAuth = get_httpauth();
230 }
231 free(zKey);
232 }
233
234 /*
235 ** Get the HTTP Authorization preference from db.
236 */
237 char *get_httpauth(void){
238 char *zKey = mprintf("http-auth:%s", g.urlCanonical);
239 return unobscure(db_get(zKey, 0));
240 free(zKey);
241 }
242
243 /*
244 ** Set the HTTP Authorization preference in db.
245 */
246 void set_httpauth(const char *zHttpAuth){
247 char *zKey = mprintf("http-auth:%s", g.urlCanonical);
248 db_set(zKey, obscure(zHttpAuth), 0);
249 free(zKey);
250 }
251
252 /*
253 ** Look for SSH clone command line options and setup in globals.
254 */
255 void clone_ssh_find_options(void){
256
+70 -7
--- src/config.h
+++ src/config.h
@@ -62,30 +62,93 @@
6262
# include <sys/types.h>
6363
# include <signal.h>
6464
# include <pwd.h>
6565
#endif
6666
67
+/*
68
+** Utility macro to wrap an argument with double quotes.
69
+*/
70
+#if !defined(COMPILER_STRINGIFY)
71
+# define COMPILER_STRINGIFY(x) COMPILER_STRINGIFY1(x)
72
+# define COMPILER_STRINGIFY1(x) #x
73
+#endif
74
+
6775
/*
6876
** Define the compiler variant, used to compile the project
6977
*/
7078
#if !defined(COMPILER_NAME)
7179
# if defined(__DMC__)
72
-# define COMPILER_NAME "dmc"
80
+# if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
81
+# define COMPILER_NAME "dmc-" COMPILER_VERSION
82
+# else
83
+# define COMPILER_NAME "dmc"
84
+# endif
7385
# elif defined(__POCC__)
7486
# if defined(_M_X64)
75
-# define COMPILER_NAME "pellesc64"
87
+# if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
88
+# define COMPILER_NAME "pellesc64-" COMPILER_VERSION
89
+# else
90
+# define COMPILER_NAME "pellesc64"
91
+# endif
7692
# else
77
-# define COMPILER_NAME "pellesc32"
93
+# if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
94
+# define COMPILER_NAME "pellesc32-" COMPILER_VERSION
95
+# else
96
+# define COMPILER_NAME "pellesc32"
97
+# endif
7898
# endif
7999
# elif defined(_MSC_VER)
80
-# define COMPILER_NAME "msc"
100
+# if !defined(COMPILER_VERSION)
101
+# define COMPILER_VERSION COMPILER_STRINGIFY(_MSC_VER)
102
+# endif
103
+# if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
104
+# define COMPILER_NAME "msc-" COMPILER_VERSION
105
+# else
106
+# define COMPILER_NAME "msc"
107
+# endif
81108
# elif defined(__MINGW32__)
82
-# define COMPILER_NAME "mingw32"
109
+# if !defined(COMPILER_VERSION)
110
+# if defined(__MINGW_VERSION)
111
+# if defined(__GNUC__)
112
+# if defined(__VERSION__)
113
+# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW_VERSION) "-gcc-" __VERSION__
114
+# else
115
+# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW_VERSION) "-gcc"
116
+# endif
117
+# else
118
+# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW_VERSION)
119
+# endif
120
+# elif defined(__MINGW32_VERSION)
121
+# if defined(__GNUC__)
122
+# if defined(__VERSION__)
123
+# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc-" __VERSION__
124
+# else
125
+# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc"
126
+# endif
127
+# else
128
+# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION)
129
+# endif
130
+# endif
131
+# endif
132
+# if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
133
+# define COMPILER_NAME "mingw32-" COMPILER_VERSION
134
+# else
135
+# define COMPILER_NAME "mingw32"
136
+# endif
83137
# elif defined(_WIN32)
84138
# define COMPILER_NAME "win32"
85139
# elif defined(__GNUC__)
86
-# define COMPILER_NAME "gcc-" __VERSION__
140
+# if !defined(COMPILER_VERSION)
141
+# if defined(__VERSION__)
142
+# define COMPILER_VERSION __VERSION__
143
+# endif
144
+# endif
145
+# if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
146
+# define COMPILER_NAME "gcc-" COMPILER_VERSION
147
+# else
148
+# define COMPILER_NAME "gcc"
149
+# endif
87150
# else
88151
# define COMPILER_NAME "unknown"
89152
# endif
90153
#endif
91154
@@ -123,11 +186,11 @@
123186
** The following macros are used to cast pointers to integers and
124187
** integers to pointers. The way you do this varies from one compiler
125188
** to the next, so we have developed the following set of #if statements
126189
** to generate appropriate macros for a wide range of compilers.
127190
**
128
-** The correct "ANSI" way to do this is to use the intptr_t type.
191
+** The correct "ANSI" way to do this is to use the intptr_t type.
129192
** Unfortunately, that typedef is not available on all compilers, or
130193
** if it is available, it requires an #include of specific headers
131194
** that vary from one machine to the next.
132195
*/
133196
#if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */
134197
--- src/config.h
+++ src/config.h
@@ -62,30 +62,93 @@
62 # include <sys/types.h>
63 # include <signal.h>
64 # include <pwd.h>
65 #endif
66
 
 
 
 
 
 
 
 
67 /*
68 ** Define the compiler variant, used to compile the project
69 */
70 #if !defined(COMPILER_NAME)
71 # if defined(__DMC__)
72 # define COMPILER_NAME "dmc"
 
 
 
 
73 # elif defined(__POCC__)
74 # if defined(_M_X64)
75 # define COMPILER_NAME "pellesc64"
 
 
 
 
76 # else
77 # define COMPILER_NAME "pellesc32"
 
 
 
 
78 # endif
79 # elif defined(_MSC_VER)
80 # define COMPILER_NAME "msc"
 
 
 
 
 
 
 
81 # elif defined(__MINGW32__)
82 # define COMPILER_NAME "mingw32"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83 # elif defined(_WIN32)
84 # define COMPILER_NAME "win32"
85 # elif defined(__GNUC__)
86 # define COMPILER_NAME "gcc-" __VERSION__
 
 
 
 
 
 
 
 
 
87 # else
88 # define COMPILER_NAME "unknown"
89 # endif
90 #endif
91
@@ -123,11 +186,11 @@
123 ** The following macros are used to cast pointers to integers and
124 ** integers to pointers. The way you do this varies from one compiler
125 ** to the next, so we have developed the following set of #if statements
126 ** to generate appropriate macros for a wide range of compilers.
127 **
128 ** The correct "ANSI" way to do this is to use the intptr_t type.
129 ** Unfortunately, that typedef is not available on all compilers, or
130 ** if it is available, it requires an #include of specific headers
131 ** that vary from one machine to the next.
132 */
133 #if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */
134
--- src/config.h
+++ src/config.h
@@ -62,30 +62,93 @@
62 # include <sys/types.h>
63 # include <signal.h>
64 # include <pwd.h>
65 #endif
66
67 /*
68 ** Utility macro to wrap an argument with double quotes.
69 */
70 #if !defined(COMPILER_STRINGIFY)
71 # define COMPILER_STRINGIFY(x) COMPILER_STRINGIFY1(x)
72 # define COMPILER_STRINGIFY1(x) #x
73 #endif
74
75 /*
76 ** Define the compiler variant, used to compile the project
77 */
78 #if !defined(COMPILER_NAME)
79 # if defined(__DMC__)
80 # if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
81 # define COMPILER_NAME "dmc-" COMPILER_VERSION
82 # else
83 # define COMPILER_NAME "dmc"
84 # endif
85 # elif defined(__POCC__)
86 # if defined(_M_X64)
87 # if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
88 # define COMPILER_NAME "pellesc64-" COMPILER_VERSION
89 # else
90 # define COMPILER_NAME "pellesc64"
91 # endif
92 # else
93 # if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
94 # define COMPILER_NAME "pellesc32-" COMPILER_VERSION
95 # else
96 # define COMPILER_NAME "pellesc32"
97 # endif
98 # endif
99 # elif defined(_MSC_VER)
100 # if !defined(COMPILER_VERSION)
101 # define COMPILER_VERSION COMPILER_STRINGIFY(_MSC_VER)
102 # endif
103 # if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
104 # define COMPILER_NAME "msc-" COMPILER_VERSION
105 # else
106 # define COMPILER_NAME "msc"
107 # endif
108 # elif defined(__MINGW32__)
109 # if !defined(COMPILER_VERSION)
110 # if defined(__MINGW_VERSION)
111 # if defined(__GNUC__)
112 # if defined(__VERSION__)
113 # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW_VERSION) "-gcc-" __VERSION__
114 # else
115 # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW_VERSION) "-gcc"
116 # endif
117 # else
118 # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW_VERSION)
119 # endif
120 # elif defined(__MINGW32_VERSION)
121 # if defined(__GNUC__)
122 # if defined(__VERSION__)
123 # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc-" __VERSION__
124 # else
125 # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc"
126 # endif
127 # else
128 # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION)
129 # endif
130 # endif
131 # endif
132 # if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
133 # define COMPILER_NAME "mingw32-" COMPILER_VERSION
134 # else
135 # define COMPILER_NAME "mingw32"
136 # endif
137 # elif defined(_WIN32)
138 # define COMPILER_NAME "win32"
139 # elif defined(__GNUC__)
140 # if !defined(COMPILER_VERSION)
141 # if defined(__VERSION__)
142 # define COMPILER_VERSION __VERSION__
143 # endif
144 # endif
145 # if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION)
146 # define COMPILER_NAME "gcc-" COMPILER_VERSION
147 # else
148 # define COMPILER_NAME "gcc"
149 # endif
150 # else
151 # define COMPILER_NAME "unknown"
152 # endif
153 #endif
154
@@ -123,11 +186,11 @@
186 ** The following macros are used to cast pointers to integers and
187 ** integers to pointers. The way you do this varies from one compiler
188 ** to the next, so we have developed the following set of #if statements
189 ** to generate appropriate macros for a wide range of compilers.
190 **
191 ** The correct "ANSI" way to do this is to use the intptr_t type.
192 ** Unfortunately, that typedef is not available on all compilers, or
193 ** if it is available, it requires an #include of specific headers
194 ** that vary from one machine to the next.
195 */
196 #if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */
197
+77 -60
--- src/db.c
+++ src/db.c
@@ -715,11 +715,11 @@
715715
*/
716716
LOCAL sqlite3 *db_open(const char *zDbName){
717717
int rc;
718718
sqlite3 *db;
719719
720
-#if defined(__CYGWIN__)
720
+#if defined(__CYGWIN__) && !defined(USE_SYSTEM_SQLITE)
721721
zDbName = fossil_utf8_to_filename(zDbName);
722722
#endif
723723
if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName);
724724
rc = sqlite3_open_v2(
725725
zDbName, &db,
@@ -1989,23 +1989,28 @@
19891989
** If VERSION is specified then that version is checked out. Otherwise
19901990
** the latest version is checked out. No files other than "manifest"
19911991
** and "manifest.uuid" are modified if the --keep option is present.
19921992
**
19931993
** Options:
1994
+** --empty Initialize checkout as being empty, but still connected
1995
+** with the local repository. If you commit this checkout,
1996
+** it will become a new "initial" commit in the repository.
19941997
** --keep Only modify the manifest and manifest.uuid files
19951998
** --nested Allow opening a repository inside an opened checkout
19961999
**
19972000
** See also: close
19982001
*/
19992002
void cmd_open(void){
2003
+ int emptyFlag;
20002004
int keepFlag;
20012005
int allowNested;
20022006
char **oldArgv;
20032007
int oldArgc;
20042008
static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0 };
20052009
20062010
url_proxy_options();
2011
+ emptyFlag = find_option("empty",0,0)!=0;
20072012
keepFlag = find_option("keep",0,0)!=0;
20082013
allowNested = find_option("nested",0,0)!=0;
20092014
if( g.argc!=3 && g.argc!=4 ){
20102015
usage("REPOSITORY-FILENAME ?VERSION?");
20112016
}
@@ -2030,22 +2035,24 @@
20302035
db_lset_int("checkout", 0);
20312036
oldArgv = g.argv;
20322037
oldArgc = g.argc;
20332038
azNewArgv[0] = g.argv[0];
20342039
g.argv = azNewArgv;
2035
- g.argc = 3;
2036
- if( oldArgc==4 ){
2037
- azNewArgv[g.argc-1] = oldArgv[3];
2038
- }else if( !db_exists("SELECT 1 FROM event WHERE type='ci'") ){
2039
- azNewArgv[g.argc-1] = "--latest";
2040
- }else{
2041
- azNewArgv[g.argc-1] = db_get("main-branch", "trunk");
2042
- }
2043
- if( keepFlag ){
2044
- azNewArgv[g.argc++] = "--keep";
2045
- }
2046
- checkout_cmd();
2040
+ if( !emptyFlag){
2041
+ g.argc = 3;
2042
+ if( oldArgc==4 ){
2043
+ azNewArgv[g.argc-1] = oldArgv[3];
2044
+ }else if( !db_exists("SELECT 1 FROM event WHERE type='ci'") ){
2045
+ azNewArgv[g.argc-1] = "--latest";
2046
+ }else{
2047
+ azNewArgv[g.argc-1] = db_get("main-branch", "trunk");
2048
+ }
2049
+ if( keepFlag ){
2050
+ azNewArgv[g.argc++] = "--keep";
2051
+ }
2052
+ checkout_cmd();
2053
+ }
20472054
g.argc = 2;
20482055
info_cmd();
20492056
}
20502057
20512058
/*
@@ -2101,66 +2108,69 @@
21012108
*/
21022109
#if INTERFACE
21032110
struct stControlSettings {
21042111
char const *name; /* Name of the setting */
21052112
char const *var; /* Internal variable name used by db_set() */
2106
- int width; /* Width of display. 0 for boolean values */
2113
+ int width; /* Width of display. 0 for boolean values. */
21072114
int versionable; /* Is this setting versionable? */
2115
+ int forceTextArea; /* Force using a text area for display? */
21082116
char const *def; /* Default value */
21092117
};
21102118
#endif /* INTERFACE */
21112119
struct stControlSettings const ctrlSettings[] = {
2112
- { "access-log", 0, 0, 0, "off" },
2113
- { "allow-symlinks",0, 0, 1, "off" },
2114
- { "auto-captcha", "autocaptcha", 0, 0, "on" },
2115
- { "auto-hyperlink",0, 0, 0, "on", },
2116
- { "auto-shun", 0, 0, 0, "on" },
2117
- { "autosync", 0, 0, 0, "on" },
2118
- { "binary-glob", 0, 40, 1, "" },
2119
- { "clearsign", 0, 0, 0, "off" },
2120
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || defined(__APPLE__)
2121
- { "case-sensitive",0, 0, 0, "off" },
2120
+ { "access-log", 0, 0, 0, 0, "off" },
2121
+ { "allow-symlinks", 0, 0, 1, 0, "off" },
2122
+ { "auto-captcha", "autocaptcha", 0, 0, 0, "on" },
2123
+ { "auto-hyperlink", 0, 0, 0, 0, "on", },
2124
+ { "auto-shun", 0, 0, 0, 0, "on" },
2125
+ { "autosync", 0, 0, 0, 0, "on" },
2126
+ { "binary-glob", 0, 40, 1, 0, "" },
2127
+ { "clearsign", 0, 0, 0, 0, "off" },
2128
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || \
2129
+ defined(__APPLE__)
2130
+ { "case-sensitive", 0, 0, 0, 0, "off" },
21222131
#else
2123
- { "case-sensitive",0, 0, 0, "on" },
2132
+ { "case-sensitive", 0, 0, 0, 0, "on" },
21242133
#endif
2125
- { "clean-glob", 0, 40, 1, "" },
2126
- { "crnl-glob", 0, 40, 1, "" },
2127
- { "default-perms", 0, 16, 0, "u" },
2128
- { "diff-binary", 0, 0, 0, "on" },
2129
- { "diff-command", 0, 40, 0, "" },
2130
- { "dont-push", 0, 0, 0, "off" },
2131
- { "editor", 0, 32, 0, "" },
2132
- { "empty-dirs", 0, 40, 1, "" },
2133
- { "encoding-glob", 0, 40, 1, "" },
2134
- { "gdiff-command", 0, 40, 0, "gdiff" },
2135
- { "gmerge-command",0, 40, 0, "" },
2136
- { "http-port", 0, 16, 0, "8080" },
2137
- { "https-login", 0, 0, 0, "off" },
2138
- { "ignore-glob", 0, 40, 1, "" },
2139
- { "keep-glob", 0, 40, 1, "" },
2140
- { "localauth", 0, 0, 0, "off" },
2141
- { "main-branch", 0, 40, 0, "trunk" },
2142
- { "manifest", 0, 0, 1, "off" },
2143
- { "max-upload", 0, 25, 0, "250000" },
2144
- { "mtime-changes", 0, 0, 0, "on" },
2145
- { "pgp-command", 0, 40, 0, "gpg --clearsign -o " },
2146
- { "proxy", 0, 32, 0, "off" },
2147
- { "relative-paths",0, 0, 0, "on" },
2148
- { "repo-cksum", 0, 0, 0, "on" },
2149
- { "self-register", 0, 0, 0, "off" },
2150
- { "ssh-command", 0, 40, 0, "" },
2151
- { "ssl-ca-location",0, 40, 0, "" },
2152
- { "ssl-identity", 0, 40, 0, "" },
2134
+ { "clean-glob", 0, 40, 1, 0, "" },
2135
+ { "crnl-glob", 0, 40, 1, 0, "" },
2136
+ { "default-perms", 0, 16, 0, 0, "u" },
2137
+ { "diff-binary", 0, 0, 0, 0, "on" },
2138
+ { "diff-command", 0, 40, 0, 0, "" },
2139
+ { "dont-push", 0, 0, 0, 0, "off" },
2140
+ { "editor", 0, 32, 0, 0, "" },
2141
+ { "empty-dirs", 0, 40, 1, 0, "" },
2142
+ { "encoding-glob", 0, 40, 1, 0, "" },
2143
+ { "gdiff-command", 0, 40, 0, 0, "gdiff" },
2144
+ { "gmerge-command", 0, 40, 0, 0, "" },
2145
+ { "http-port", 0, 16, 0, 0, "8080" },
2146
+ { "https-login", 0, 0, 0, 0, "off" },
2147
+ { "ignore-glob", 0, 40, 1, 0, "" },
2148
+ { "keep-glob", 0, 40, 1, 0, "" },
2149
+ { "localauth", 0, 0, 0, 0, "off" },
2150
+ { "main-branch", 0, 40, 0, 0, "trunk" },
2151
+ { "manifest", 0, 0, 1, 0, "off" },
2152
+ { "max-loadavg", 0, 25, 0, 0, "0.0" },
2153
+ { "max-upload", 0, 25, 0, 0, "250000" },
2154
+ { "mtime-changes", 0, 0, 0, 0, "on" },
2155
+ { "pgp-command", 0, 40, 0, 0, "gpg --clearsign -o " },
2156
+ { "proxy", 0, 32, 0, 0, "off" },
2157
+ { "relative-paths", 0, 0, 0, 0, "on" },
2158
+ { "repo-cksum", 0, 0, 0, 0, "on" },
2159
+ { "self-register", 0, 0, 0, 0, "off" },
2160
+ { "ssh-command", 0, 40, 0, 0, "" },
2161
+ { "ssl-ca-location", 0, 40, 0, 0, "" },
2162
+ { "ssl-identity", 0, 40, 0, 0, "" },
21532163
#ifdef FOSSIL_ENABLE_TCL
2154
- { "tcl", 0, 0, 0, "off" },
2155
- { "tcl-setup", 0, 40, 0, "" },
2164
+ { "tcl", 0, 0, 0, 0, "off" },
2165
+ { "tcl-setup", 0, 40, 0, 1, "" },
21562166
#endif
2157
- { "th1-setup", 0, 40, 0, "" },
2158
- { "th1-uri-regexp",0, 40, 0, "" },
2159
- { "web-browser", 0, 32, 0, "" },
2160
- { "white-foreground", 0, 0, 0, "off" },
2161
- { 0,0,0,0,0 }
2167
+ { "th1-setup", 0, 40, 0, 1, "" },
2168
+ { "th1-uri-regexp", 0, 40, 0, 0, "" },
2169
+ { "web-browser", 0, 32, 0, 0, "" },
2170
+ { "white-foreground", 0, 0, 0, 0, "off" },
2171
+ { 0,0,0,0,0,0 }
21622172
};
21632173
21642174
/*
21652175
** COMMAND: settings
21662176
** COMMAND: unset*
@@ -2287,10 +2297,17 @@
22872297
** main-branch The primary branch for the project. Default: trunk
22882298
**
22892299
** manifest If enabled, automatically create files "manifest" and
22902300
** (versionable) "manifest.uuid" in every checkout. The SQLite and
22912301
** Fossil repositories both require this. Default: off.
2302
+**
2303
+** max-loadavg Some CPU-intensive web pages (ex: /zip, /tarball, /blame)
2304
+** are disallowed if the system load average goes above this
2305
+** value. "0.0" means no limit. This only works on unix.
2306
+** Only local settings of this value make a difference since
2307
+** when running as a web-server, Fossil does not open the
2308
+** global configuration database.
22922309
**
22932310
** max-upload A limit on the size of uplink HTTP requests. The
22942311
** default is 250000 bytes.
22952312
**
22962313
** mtime-changes Use file modification times (mtimes) to detect when
22972314
--- src/db.c
+++ src/db.c
@@ -715,11 +715,11 @@
715 */
716 LOCAL sqlite3 *db_open(const char *zDbName){
717 int rc;
718 sqlite3 *db;
719
720 #if defined(__CYGWIN__)
721 zDbName = fossil_utf8_to_filename(zDbName);
722 #endif
723 if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName);
724 rc = sqlite3_open_v2(
725 zDbName, &db,
@@ -1989,23 +1989,28 @@
1989 ** If VERSION is specified then that version is checked out. Otherwise
1990 ** the latest version is checked out. No files other than "manifest"
1991 ** and "manifest.uuid" are modified if the --keep option is present.
1992 **
1993 ** Options:
 
 
 
1994 ** --keep Only modify the manifest and manifest.uuid files
1995 ** --nested Allow opening a repository inside an opened checkout
1996 **
1997 ** See also: close
1998 */
1999 void cmd_open(void){
 
2000 int keepFlag;
2001 int allowNested;
2002 char **oldArgv;
2003 int oldArgc;
2004 static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0 };
2005
2006 url_proxy_options();
 
2007 keepFlag = find_option("keep",0,0)!=0;
2008 allowNested = find_option("nested",0,0)!=0;
2009 if( g.argc!=3 && g.argc!=4 ){
2010 usage("REPOSITORY-FILENAME ?VERSION?");
2011 }
@@ -2030,22 +2035,24 @@
2030 db_lset_int("checkout", 0);
2031 oldArgv = g.argv;
2032 oldArgc = g.argc;
2033 azNewArgv[0] = g.argv[0];
2034 g.argv = azNewArgv;
2035 g.argc = 3;
2036 if( oldArgc==4 ){
2037 azNewArgv[g.argc-1] = oldArgv[3];
2038 }else if( !db_exists("SELECT 1 FROM event WHERE type='ci'") ){
2039 azNewArgv[g.argc-1] = "--latest";
2040 }else{
2041 azNewArgv[g.argc-1] = db_get("main-branch", "trunk");
2042 }
2043 if( keepFlag ){
2044 azNewArgv[g.argc++] = "--keep";
2045 }
2046 checkout_cmd();
 
 
2047 g.argc = 2;
2048 info_cmd();
2049 }
2050
2051 /*
@@ -2101,66 +2108,69 @@
2101 */
2102 #if INTERFACE
2103 struct stControlSettings {
2104 char const *name; /* Name of the setting */
2105 char const *var; /* Internal variable name used by db_set() */
2106 int width; /* Width of display. 0 for boolean values */
2107 int versionable; /* Is this setting versionable? */
 
2108 char const *def; /* Default value */
2109 };
2110 #endif /* INTERFACE */
2111 struct stControlSettings const ctrlSettings[] = {
2112 { "access-log", 0, 0, 0, "off" },
2113 { "allow-symlinks",0, 0, 1, "off" },
2114 { "auto-captcha", "autocaptcha", 0, 0, "on" },
2115 { "auto-hyperlink",0, 0, 0, "on", },
2116 { "auto-shun", 0, 0, 0, "on" },
2117 { "autosync", 0, 0, 0, "on" },
2118 { "binary-glob", 0, 40, 1, "" },
2119 { "clearsign", 0, 0, 0, "off" },
2120 #if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || defined(__APPLE__)
2121 { "case-sensitive",0, 0, 0, "off" },
 
2122 #else
2123 { "case-sensitive",0, 0, 0, "on" },
2124 #endif
2125 { "clean-glob", 0, 40, 1, "" },
2126 { "crnl-glob", 0, 40, 1, "" },
2127 { "default-perms", 0, 16, 0, "u" },
2128 { "diff-binary", 0, 0, 0, "on" },
2129 { "diff-command", 0, 40, 0, "" },
2130 { "dont-push", 0, 0, 0, "off" },
2131 { "editor", 0, 32, 0, "" },
2132 { "empty-dirs", 0, 40, 1, "" },
2133 { "encoding-glob", 0, 40, 1, "" },
2134 { "gdiff-command", 0, 40, 0, "gdiff" },
2135 { "gmerge-command",0, 40, 0, "" },
2136 { "http-port", 0, 16, 0, "8080" },
2137 { "https-login", 0, 0, 0, "off" },
2138 { "ignore-glob", 0, 40, 1, "" },
2139 { "keep-glob", 0, 40, 1, "" },
2140 { "localauth", 0, 0, 0, "off" },
2141 { "main-branch", 0, 40, 0, "trunk" },
2142 { "manifest", 0, 0, 1, "off" },
2143 { "max-upload", 0, 25, 0, "250000" },
2144 { "mtime-changes", 0, 0, 0, "on" },
2145 { "pgp-command", 0, 40, 0, "gpg --clearsign -o " },
2146 { "proxy", 0, 32, 0, "off" },
2147 { "relative-paths",0, 0, 0, "on" },
2148 { "repo-cksum", 0, 0, 0, "on" },
2149 { "self-register", 0, 0, 0, "off" },
2150 { "ssh-command", 0, 40, 0, "" },
2151 { "ssl-ca-location",0, 40, 0, "" },
2152 { "ssl-identity", 0, 40, 0, "" },
 
2153 #ifdef FOSSIL_ENABLE_TCL
2154 { "tcl", 0, 0, 0, "off" },
2155 { "tcl-setup", 0, 40, 0, "" },
2156 #endif
2157 { "th1-setup", 0, 40, 0, "" },
2158 { "th1-uri-regexp",0, 40, 0, "" },
2159 { "web-browser", 0, 32, 0, "" },
2160 { "white-foreground", 0, 0, 0, "off" },
2161 { 0,0,0,0,0 }
2162 };
2163
2164 /*
2165 ** COMMAND: settings
2166 ** COMMAND: unset*
@@ -2287,10 +2297,17 @@
2287 ** main-branch The primary branch for the project. Default: trunk
2288 **
2289 ** manifest If enabled, automatically create files "manifest" and
2290 ** (versionable) "manifest.uuid" in every checkout. The SQLite and
2291 ** Fossil repositories both require this. Default: off.
 
 
 
 
 
 
 
2292 **
2293 ** max-upload A limit on the size of uplink HTTP requests. The
2294 ** default is 250000 bytes.
2295 **
2296 ** mtime-changes Use file modification times (mtimes) to detect when
2297
--- src/db.c
+++ src/db.c
@@ -715,11 +715,11 @@
715 */
716 LOCAL sqlite3 *db_open(const char *zDbName){
717 int rc;
718 sqlite3 *db;
719
720 #if defined(__CYGWIN__) && !defined(USE_SYSTEM_SQLITE)
721 zDbName = fossil_utf8_to_filename(zDbName);
722 #endif
723 if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName);
724 rc = sqlite3_open_v2(
725 zDbName, &db,
@@ -1989,23 +1989,28 @@
1989 ** If VERSION is specified then that version is checked out. Otherwise
1990 ** the latest version is checked out. No files other than "manifest"
1991 ** and "manifest.uuid" are modified if the --keep option is present.
1992 **
1993 ** Options:
1994 ** --empty Initialize checkout as being empty, but still connected
1995 ** with the local repository. If you commit this checkout,
1996 ** it will become a new "initial" commit in the repository.
1997 ** --keep Only modify the manifest and manifest.uuid files
1998 ** --nested Allow opening a repository inside an opened checkout
1999 **
2000 ** See also: close
2001 */
2002 void cmd_open(void){
2003 int emptyFlag;
2004 int keepFlag;
2005 int allowNested;
2006 char **oldArgv;
2007 int oldArgc;
2008 static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0 };
2009
2010 url_proxy_options();
2011 emptyFlag = find_option("empty",0,0)!=0;
2012 keepFlag = find_option("keep",0,0)!=0;
2013 allowNested = find_option("nested",0,0)!=0;
2014 if( g.argc!=3 && g.argc!=4 ){
2015 usage("REPOSITORY-FILENAME ?VERSION?");
2016 }
@@ -2030,22 +2035,24 @@
2035 db_lset_int("checkout", 0);
2036 oldArgv = g.argv;
2037 oldArgc = g.argc;
2038 azNewArgv[0] = g.argv[0];
2039 g.argv = azNewArgv;
2040 if( !emptyFlag){
2041 g.argc = 3;
2042 if( oldArgc==4 ){
2043 azNewArgv[g.argc-1] = oldArgv[3];
2044 }else if( !db_exists("SELECT 1 FROM event WHERE type='ci'") ){
2045 azNewArgv[g.argc-1] = "--latest";
2046 }else{
2047 azNewArgv[g.argc-1] = db_get("main-branch", "trunk");
2048 }
2049 if( keepFlag ){
2050 azNewArgv[g.argc++] = "--keep";
2051 }
2052 checkout_cmd();
2053 }
2054 g.argc = 2;
2055 info_cmd();
2056 }
2057
2058 /*
@@ -2101,66 +2108,69 @@
2108 */
2109 #if INTERFACE
2110 struct stControlSettings {
2111 char const *name; /* Name of the setting */
2112 char const *var; /* Internal variable name used by db_set() */
2113 int width; /* Width of display. 0 for boolean values. */
2114 int versionable; /* Is this setting versionable? */
2115 int forceTextArea; /* Force using a text area for display? */
2116 char const *def; /* Default value */
2117 };
2118 #endif /* INTERFACE */
2119 struct stControlSettings const ctrlSettings[] = {
2120 { "access-log", 0, 0, 0, 0, "off" },
2121 { "allow-symlinks", 0, 0, 1, 0, "off" },
2122 { "auto-captcha", "autocaptcha", 0, 0, 0, "on" },
2123 { "auto-hyperlink", 0, 0, 0, 0, "on", },
2124 { "auto-shun", 0, 0, 0, 0, "on" },
2125 { "autosync", 0, 0, 0, 0, "on" },
2126 { "binary-glob", 0, 40, 1, 0, "" },
2127 { "clearsign", 0, 0, 0, 0, "off" },
2128 #if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || \
2129 defined(__APPLE__)
2130 { "case-sensitive", 0, 0, 0, 0, "off" },
2131 #else
2132 { "case-sensitive", 0, 0, 0, 0, "on" },
2133 #endif
2134 { "clean-glob", 0, 40, 1, 0, "" },
2135 { "crnl-glob", 0, 40, 1, 0, "" },
2136 { "default-perms", 0, 16, 0, 0, "u" },
2137 { "diff-binary", 0, 0, 0, 0, "on" },
2138 { "diff-command", 0, 40, 0, 0, "" },
2139 { "dont-push", 0, 0, 0, 0, "off" },
2140 { "editor", 0, 32, 0, 0, "" },
2141 { "empty-dirs", 0, 40, 1, 0, "" },
2142 { "encoding-glob", 0, 40, 1, 0, "" },
2143 { "gdiff-command", 0, 40, 0, 0, "gdiff" },
2144 { "gmerge-command", 0, 40, 0, 0, "" },
2145 { "http-port", 0, 16, 0, 0, "8080" },
2146 { "https-login", 0, 0, 0, 0, "off" },
2147 { "ignore-glob", 0, 40, 1, 0, "" },
2148 { "keep-glob", 0, 40, 1, 0, "" },
2149 { "localauth", 0, 0, 0, 0, "off" },
2150 { "main-branch", 0, 40, 0, 0, "trunk" },
2151 { "manifest", 0, 0, 1, 0, "off" },
2152 { "max-loadavg", 0, 25, 0, 0, "0.0" },
2153 { "max-upload", 0, 25, 0, 0, "250000" },
2154 { "mtime-changes", 0, 0, 0, 0, "on" },
2155 { "pgp-command", 0, 40, 0, 0, "gpg --clearsign -o " },
2156 { "proxy", 0, 32, 0, 0, "off" },
2157 { "relative-paths", 0, 0, 0, 0, "on" },
2158 { "repo-cksum", 0, 0, 0, 0, "on" },
2159 { "self-register", 0, 0, 0, 0, "off" },
2160 { "ssh-command", 0, 40, 0, 0, "" },
2161 { "ssl-ca-location", 0, 40, 0, 0, "" },
2162 { "ssl-identity", 0, 40, 0, 0, "" },
2163 #ifdef FOSSIL_ENABLE_TCL
2164 { "tcl", 0, 0, 0, 0, "off" },
2165 { "tcl-setup", 0, 40, 0, 1, "" },
2166 #endif
2167 { "th1-setup", 0, 40, 0, 1, "" },
2168 { "th1-uri-regexp", 0, 40, 0, 0, "" },
2169 { "web-browser", 0, 32, 0, 0, "" },
2170 { "white-foreground", 0, 0, 0, 0, "off" },
2171 { 0,0,0,0,0,0 }
2172 };
2173
2174 /*
2175 ** COMMAND: settings
2176 ** COMMAND: unset*
@@ -2287,10 +2297,17 @@
2297 ** main-branch The primary branch for the project. Default: trunk
2298 **
2299 ** manifest If enabled, automatically create files "manifest" and
2300 ** (versionable) "manifest.uuid" in every checkout. The SQLite and
2301 ** Fossil repositories both require this. Default: off.
2302 **
2303 ** max-loadavg Some CPU-intensive web pages (ex: /zip, /tarball, /blame)
2304 ** are disallowed if the system load average goes above this
2305 ** value. "0.0" means no limit. This only works on unix.
2306 ** Only local settings of this value make a difference since
2307 ** when running as a web-server, Fossil does not open the
2308 ** global configuration database.
2309 **
2310 ** max-upload A limit on the size of uplink HTTP requests. The
2311 ** default is 250000 bytes.
2312 **
2313 ** mtime-changes Use file modification times (mtimes) to detect when
2314
+107 -58
--- src/diff.c
+++ src/diff.c
@@ -29,17 +29,17 @@
2929
** of the diff output.
3030
*/
3131
#define DIFF_CONTEXT_MASK ((u64)0x0000ffff) /* Lines of context. Default if 0 */
3232
#define DIFF_WIDTH_MASK ((u64)0x00ff0000) /* side-by-side column width */
3333
#define DIFF_IGNORE_EOLWS ((u64)0x01000000) /* Ignore end-of-line whitespace */
34
-#define DIFF_SIDEBYSIDE ((u64)0x02000000) /* Generate a side-by-side diff */
35
-#define DIFF_VERBOSE ((u64)0x04000000) /* Missing shown as empty files */
36
-#define DIFF_BRIEF ((u64)0x08000000) /* Show filenames only */
34
+#define DIFF_IGNORE_ALLWS ((u64)0x03000000) /* Ignore all whitespace */
35
+#define DIFF_SIDEBYSIDE ((u64)0x04000000) /* Generate a side-by-side diff */
36
+#define DIFF_VERBOSE ((u64)0x08000000) /* Missing shown as empty files */
3737
#define DIFF_INLINE ((u64)0x00000000) /* Inline (not side-by-side) diff */
38
-#define DIFF_HTML ((u64)0x10000000) /* Render for HTML */
39
-#define DIFF_LINENO ((u64)0x20000000) /* Show line numbers */
40
-#define DIFF_WS_WARNING ((u64)0x40000000) /* Warn about whitespace */
38
+#define DIFF_BRIEF ((u64)0x10000000) /* Show filenames only */
39
+#define DIFF_HTML ((u64)0x20000000) /* Render for HTML */
40
+#define DIFF_LINENO ((u64)0x40000000) /* Show line numbers */
4141
#define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */
4242
#define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */
4343
#define DIFF_CONTEXT_EX (((u64)0x04)<<32) /* Use context even if zero */
4444
#define DIFF_NOTTOOBIG (((u64)0x08)<<32) /* Only display if not too big */
4545
@@ -54,10 +54,13 @@
5454
"cannot compute difference between symlink and regular file\n"
5555
5656
#define DIFF_TOO_MANY_CHANGES \
5757
"more than 10,000 changes\n"
5858
59
+#define DIFF_WHITESPACE_ONLY \
60
+ "whitespace changes only\n"
61
+
5962
/*
6063
** Maximum length of a line in a text file, in bytes. (2**13 = 8192 bytes)
6164
*/
6265
#define LENGTH_MASK_SZ 13
6366
#define LENGTH_MASK ((1<<LENGTH_MASK_SZ)-1)
@@ -73,10 +76,12 @@
7376
*/
7477
typedef struct DLine DLine;
7578
struct DLine {
7679
const char *z; /* The text of the line */
7780
unsigned int h; /* Hash of the line */
81
+ unsigned short indent; /* Indent of the line. Only !=0 with -w/-Z option */
82
+ unsigned short n; /* number of bytes */
7883
unsigned int iNext; /* 1+(Index of next line with same the same hash) */
7984
8085
/* an array of DLine elements serves two purposes. The fields
8186
** above are one per line of input text. But each entry is also
8287
** a bucket in a hash table, as follows: */
@@ -125,12 +130,12 @@
125130
** too long.
126131
**
127132
** Profiling show that in most cases this routine consumes the bulk of
128133
** the CPU time on a diff.
129134
*/
130
-static DLine *break_into_lines(const char *z, int n, int *pnLine, int ignoreWS){
131
- int nLine, i, j, k, x;
135
+static DLine *break_into_lines(const char *z, int n, int *pnLine, u64 diffFlags){
136
+ int nLine, i, j, k, s, x;
132137
unsigned int h, h2;
133138
DLine *a;
134139
135140
/* Count the number of lines. Allocate space to hold
136141
** the returned array.
@@ -158,18 +163,25 @@
158163
return a;
159164
}
160165
161166
/* Fill in the array */
162167
for(i=0; i<nLine; i++){
163
- a[i].z = z;
164168
for(j=0; z[j] && z[j]!='\n'; j++){}
165
- k = j;
166
- while( ignoreWS && k>0 && fossil_isspace(z[k-1]) ){ k--; }
167
- for(h=0, x=0; x<=k; x++){
169
+ a[i].z = z;
170
+ a[i].n = k = j;
171
+ s = 0;
172
+ if( diffFlags & DIFF_IGNORE_EOLWS ){
173
+ while( k>0 && fossil_isspace(z[k-1]) ){ k--; }
174
+ }
175
+ if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
176
+ while( s<k && fossil_isspace(z[s]) ){ s++; }
177
+ }
178
+ a[i].indent = s;
179
+ for(h=0, x=s; x<k; x++){
168180
h = h ^ (h<<2) ^ z[x];
169181
}
170
- a[i].h = h = (h<<LENGTH_MASK_SZ) | k;;
182
+ a[i].h = h = (h<<LENGTH_MASK_SZ) | (k-s);
171183
h2 = h % nLine;
172184
a[i].iNext = a[h2].iHash;
173185
a[h2].iHash = i+1;
174186
z += j+1;
175187
}
@@ -181,11 +193,12 @@
181193
182194
/*
183195
** Return true if two DLine elements are identical.
184196
*/
185197
static int same_dline(DLine *pA, DLine *pB){
186
- return pA->h==pB->h && memcmp(pA->z,pB->z,pA->h & LENGTH_MASK)==0;
198
+ return pA->h==pB->h && memcmp(pA->z+pA->indent,pB->z+pB->indent,
199
+ pA->h & LENGTH_MASK)==0;
187200
}
188201
189202
/*
190203
** Return true if the regular expression *pRe matches any of the
191204
** N dlines
@@ -221,16 +234,16 @@
221234
}else if( cPrefix=='+' ){
222235
blob_append(pOut, "<span class=\"diffadd\">", -1);
223236
}else if( cPrefix=='-' ){
224237
blob_append(pOut, "<span class=\"diffrm\">", -1);
225238
}
226
- htmlize_to_blob(pOut, pLine->z, (pLine->h & LENGTH_MASK));
239
+ htmlize_to_blob(pOut, pLine->z, pLine->n);
227240
if( cPrefix!=' ' ){
228241
blob_append(pOut, "</span>", -1);
229242
}
230243
}else{
231
- blob_append(pOut, pLine->z, pLine->h & LENGTH_MASK);
244
+ blob_append(pOut, pLine->z, pLine->n);
232245
}
233246
blob_append(pOut, "\n", 1);
234247
}
235248
236249
/*
@@ -402,11 +415,11 @@
402415
b += m;
403416
if( i<nr-1 ){
404417
m = R[r+i*3+3];
405418
for(j=0; j<m; j++){
406419
if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html);
407
- appendDiffLine(pOut, ' ', &B[b+j], html, 0);
420
+ appendDiffLine(pOut, ' ', &A[a+j], html, 0);
408421
}
409422
b += m;
410423
a += m;
411424
}
412425
}
@@ -415,11 +428,11 @@
415428
assert( nr==i );
416429
m = R[r+nr*3];
417430
if( m>nContext ) m = nContext;
418431
for(j=0; j<m; j++){
419432
if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html);
420
- appendDiffLine(pOut, ' ', &B[b+j], html, 0);
433
+ appendDiffLine(pOut, ' ', &A[a+j], html, 0);
421434
}
422435
}
423436
}
424437
425438
/*
@@ -476,11 +489,11 @@
476489
** This comment contains multibyte unicode characters (ü, Æ, ð) in order
477490
** to test the ability of the diff code to handle such characters.
478491
*/
479492
static void sbsWriteText(SbsLine *p, DLine *pLine, int col){
480493
Blob *pCol = p->apCols[col];
481
- int n = pLine->h & LENGTH_MASK;
494
+ int n = pLine->n;
482495
int i; /* Number of input characters consumed */
483496
int k; /* Cursor position */
484497
int needEndSpan = 0;
485498
const char *zIn = pLine->z;
486499
int w = p->width;
@@ -1305,11 +1318,11 @@
13051318
sbsWriteMarker(&s, " ", "");
13061319
sbsWriteLineno(&s, b+j, SBS_LNB);
13071320
sbsWriteText(&s, &B[b+j], SBS_TXTB);
13081321
}
13091322
}
1310
-
1323
+
13111324
if( s.escHtml && blob_size(s.apCols[SBS_LNA])>0 ){
13121325
blob_append(pOut, "<table class=\"sbsdiffcols\"><tr>\n", -1);
13131326
for(i=SBS_LNA; i<=SBS_TXTB; i++){
13141327
sbsWriteColumn(pOut, s.apCols[i], i);
13151328
blob_reset(s.apCols[i]);
@@ -1753,28 +1766,28 @@
17531766
Blob *pB_Blob, /* TO file */
17541767
Blob *pOut, /* Write diff here if not NULL */
17551768
ReCompiled *pRe, /* Only output changes where this Regexp matches */
17561769
u64 diffFlags /* DIFF_* flags defined above */
17571770
){
1758
- int ignoreEolWs; /* Ignore whitespace at the end of lines */
1771
+ int ignoreWs; /* Ignore whitespace */
17591772
DContext c;
17601773
17611774
if( diffFlags & DIFF_INVERT ){
17621775
Blob *pTemp = pA_Blob;
17631776
pA_Blob = pB_Blob;
17641777
pB_Blob = pTemp;
17651778
}
1766
- ignoreEolWs = (diffFlags & DIFF_IGNORE_EOLWS)!=0;
1779
+ ignoreWs = (diffFlags & DIFF_IGNORE_ALLWS)!=0;
17671780
blob_to_utf8_no_bom(pA_Blob, 0);
17681781
blob_to_utf8_no_bom(pB_Blob, 0);
17691782
17701783
/* Prepare the input files */
17711784
memset(&c, 0, sizeof(c));
17721785
c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob),
1773
- &c.nFrom, ignoreEolWs);
1786
+ &c.nFrom, diffFlags);
17741787
c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob),
1775
- &c.nTo, ignoreEolWs);
1788
+ &c.nTo, diffFlags);
17761789
if( c.aFrom==0 || c.aTo==0 ){
17771790
fossil_free(c.aFrom);
17781791
fossil_free(c.aTo);
17791792
if( pOut ){
17801793
diff_errmsg(pOut, DIFF_CANNOT_COMPUTE_BINARY, diffFlags);
@@ -1782,20 +1795,27 @@
17821795
return 0;
17831796
}
17841797
17851798
/* Compute the difference */
17861799
diff_all(&c);
1800
+ if( ignoreWs && c.nEdit==6 && c.aEdit[1]==0 && c.aEdit[2]==0 ){
1801
+ fossil_free(c.aFrom);
1802
+ fossil_free(c.aTo);
1803
+ fossil_free(c.aEdit);
1804
+ if( pOut ) diff_errmsg(pOut, DIFF_WHITESPACE_ONLY, diffFlags);
1805
+ return 0;
1806
+ }
17871807
if( (diffFlags & DIFF_NOTTOOBIG)!=0 ){
17881808
int i, m, n;
17891809
int *a = c.aEdit;
17901810
int mx = c.nEdit;
17911811
for(i=m=n=0; i<mx; i+=3){ m += a[i]; n += a[i+1]+a[i+2]; }
17921812
if( n>10000 ){
17931813
fossil_free(c.aFrom);
17941814
fossil_free(c.aTo);
17951815
fossil_free(c.aEdit);
1796
- diff_errmsg(pOut, DIFF_TOO_MANY_CHANGES, diffFlags);
1816
+ if( pOut ) diff_errmsg(pOut, DIFF_TOO_MANY_CHANGES, diffFlags);
17971817
return 0;
17981818
}
17991819
}
18001820
if( (diffFlags & DIFF_NOOPT)==0 ){
18011821
diff_optimize(&c);
@@ -1824,19 +1844,21 @@
18241844
18251845
/*
18261846
** Process diff-related command-line options and return an appropriate
18271847
** "diffFlags" integer.
18281848
**
1829
-** --brief Show filenames only DIFF_BRIEF
1830
-** --context|-c N N lines of context. DIFF_CONTEXT_MASK
1831
-** --html Format for HTML DIFF_HTML
1832
-** --invert Invert the diff DIFF_INVERT
1833
-** --linenum|-n Show line numbers DIFF_LINENO
1834
-** --noopt Disable optimization DIFF_NOOPT
1835
-** --side-by-side|-y Side-by-side diff. DIFF_SIDEBYSIDE
1836
-** --unified Unified diff. ~DIFF_SIDEBYSIDE
1837
-** --width|-W N N character lines. DIFF_WIDTH_MASK
1849
+** --brief Show filenames only DIFF_BRIEF
1850
+** -c|--context N N lines of context. DIFF_CONTEXT_MASK
1851
+** --html Format for HTML DIFF_HTML
1852
+** --invert Invert the diff DIFF_INVERT
1853
+** -n|--linenum Show line numbers DIFF_LINENO
1854
+** --noopt Disable optimization DIFF_NOOPT
1855
+** --unified Unified diff. ~DIFF_SIDEBYSIDE
1856
+** -w|--ignore-all-space Ignore all whitespaces DIFF_IGNORE_ALLWS
1857
+** --width|-W N N character lines. DIFF_WIDTH_MASK
1858
+** -y|--side-by-side Side-by-side diff. DIFF_SIDEBYSIDE
1859
+** -Z|--ignore-trailing-space Ignore eol-whitespaces DIFF_IGNORE_EOLWS
18381860
*/
18391861
u64 diff_options(void){
18401862
u64 diffFlags = 0;
18411863
const char *z;
18421864
int f;
@@ -1850,10 +1872,12 @@
18501872
f *= DIFF_CONTEXT_MASK+1;
18511873
if( f > DIFF_WIDTH_MASK ) f = DIFF_CONTEXT_MASK;
18521874
diffFlags |= f;
18531875
}
18541876
if( find_option("html",0,0)!=0 ) diffFlags |= DIFF_HTML;
1877
+ if( find_option("ignore-trailing-space","Z",0)!=0 ) diffFlags |= DIFF_IGNORE_EOLWS;
1878
+ if( find_option("ignore-all-space","w",0)!=0 ) diffFlags |= DIFF_IGNORE_ALLWS;
18551879
if( find_option("linenum","n",0)!=0 ) diffFlags |= DIFF_LINENO;
18561880
if( find_option("noopt",0,0)!=0 ) diffFlags |= DIFF_NOOPT;
18571881
if( find_option("invert",0,0)!=0 ) diffFlags |= DIFF_INVERT;
18581882
if( find_option("brief",0,0)!=0 ) diffFlags |= DIFF_BRIEF;
18591883
return diffFlags;
@@ -1952,22 +1976,23 @@
19521976
/*
19531977
** Initialize the annotation process by specifying the file that is
19541978
** to be annotated. The annotator takes control of the input Blob and
19551979
** will release it when it is finished with it.
19561980
*/
1957
-static int annotation_start(Annotator *p, Blob *pInput){
1981
+static int annotation_start(Annotator *p, Blob *pInput, u64 diffFlags){
19581982
int i;
19591983
19601984
memset(p, 0, sizeof(*p));
1961
- p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo,1);
1985
+ p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo,
1986
+ diffFlags);
19621987
if( p->c.aTo==0 ){
19631988
return 1;
19641989
}
19651990
p->aOrig = fossil_malloc( sizeof(p->aOrig[0])*p->c.nTo );
19661991
for(i=0; i<p->c.nTo; i++){
19671992
p->aOrig[i].z = p->c.aTo[i].z;
1968
- p->aOrig[i].n = p->c.aTo[i].h & LENGTH_MASK;
1993
+ p->aOrig[i].n = p->c.aTo[i].n;
19691994
p->aOrig[i].iVers = -1;
19701995
}
19711996
p->nOrig = p->c.nTo;
19721997
return 0;
19731998
}
@@ -1977,17 +2002,17 @@
19772002
** being annotated. Do another step of the annotation. Return true
19782003
** if additional annotation is required. zPName is the tag to insert
19792004
** on each line of the file being annotated that was contributed by
19802005
** pParent. Memory to hold zPName is leaked.
19812006
*/
1982
-static int annotation_step(Annotator *p, Blob *pParent, int iVers){
2007
+static int annotation_step(Annotator *p, Blob *pParent, int iVers, u64 diffFlags){
19832008
int i, j;
19842009
int lnTo;
19852010
19862011
/* Prepare the parent file to be diffed */
19872012
p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent),
1988
- &p->c.nFrom, 1);
2013
+ &p->c.nFrom, diffFlags);
19892014
if( p->c.aFrom==0 ){
19902015
return 1;
19912016
}
19922017
19932018
/* Compute the differences going from pParent to the file being
@@ -2020,13 +2045,13 @@
20202045
/* Return no errors */
20212046
return 0;
20222047
}
20232048
20242049
2025
-/* Annotation flags */
2026
-#define ANN_FILE_VERS 0x01 /* Show file vers rather than commit vers */
2027
-#define ANN_FILE_ANCEST 0x02 /* Prefer check-ins in the ANCESTOR table */
2050
+/* Annotation flags (any DIFF flag can be used as Annotation flag as well) */
2051
+#define ANN_FILE_VERS (((u64)0x20)<<32) /* Show file vers rather than commit vers */
2052
+#define ANN_FILE_ANCEST (((u64)0x40)<<32) /* Prefer check-ins in the ANCESTOR table */
20282053
20292054
/*
20302055
** Compute a complete annotation on a file. The file is identified
20312056
** by its filename number (filename.fnid) and the baseline in which
20322057
** it was checked in (mlink.mid).
@@ -2034,11 +2059,11 @@
20342059
static void annotate_file(
20352060
Annotator *p, /* The annotator */
20362061
int fnid, /* The name of the file to be annotated */
20372062
int mid, /* Use the version of the file in this check-in */
20382063
int iLimit, /* Limit the number of levels if greater than zero */
2039
- int annFlags /* Flags to alter the annotation */
2064
+ u64 annFlags /* Flags to alter the annotation */
20402065
){
20412066
Blob toAnnotate; /* Text of the final (mid) version of the file */
20422067
Blob step; /* Text of previous revision */
20432068
int rid; /* Artifact ID of the file being annotated */
20442069
Stmt q; /* Query returning all ancestor versions */
@@ -2052,11 +2077,12 @@
20522077
}
20532078
if( !content_get(rid, &toAnnotate) ){
20542079
fossil_fatal("unable to retrieve content of artifact #%d", rid);
20552080
}
20562081
if( iLimit<=0 ) iLimit = 1000000000;
2057
- annotation_start(p, &toAnnotate);
2082
+ blob_to_utf8_no_bom(&toAnnotate, 0);
2083
+ annotation_start(p, &toAnnotate, annFlags);
20582084
db_begin_transaction();
20592085
db_multi_exec(
20602086
"CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);"
20612087
"DELETE FROM vseen;"
20622088
);
@@ -2086,11 +2112,12 @@
20862112
p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1));
20872113
p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2));
20882114
p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3));
20892115
if( p->nVers ){
20902116
content_get(rid, &step);
2091
- annotation_step(p, &step, p->nVers-1);
2117
+ blob_to_utf8_no_bom(&step, 0);
2118
+ annotation_step(p, &step, p->nVers-1, annFlags);
20922119
blob_reset(&step);
20932120
}
20942121
p->nVers++;
20952122
db_bind_int(&ins, ":rid", rid);
20962123
db_step(&ins);
@@ -2126,10 +2153,11 @@
21262153
}
21272154
21282155
/*
21292156
** WEBPAGE: annotate
21302157
** WEBPAGE: blame
2158
+** WEBPAGE: praise
21312159
**
21322160
** Query parameters:
21332161
**
21342162
** checkin=ID The manifest ID at which to start the annotation
21352163
** filename=FILENAME The filename.
@@ -2140,31 +2168,35 @@
21402168
void annotation_page(void){
21412169
int mid;
21422170
int fnid;
21432171
int i;
21442172
int iLimit; /* Depth limit */
2145
- int annFlags = ANN_FILE_ANCEST;
2173
+ u64 annFlags = ANN_FILE_ANCEST;
21462174
int showLog = 0; /* True to display the log */
2175
+ int ignoreWs = 0; /* Ignore whitespace */
21472176
const char *zFilename; /* Name of file to annotate */
21482177
const char *zCI; /* The check-in containing zFilename */
21492178
Annotator ann;
21502179
HQuery url;
21512180
struct AnnVers *p;
21522181
unsigned clr1, clr2, clr;
2153
- int bBlame = g.zPath[0]=='b';/* True for BLAME output. False for ANNOTATE. */
2182
+ int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */
21542183
21552184
/* Gather query parameters */
21562185
showLog = atoi(PD("log","1"));
21572186
login_check_credentials();
21582187
if( !g.perm.Read ){ login_needed(); return; }
21592188
if( exclude_spiders("annotate") ) return;
2189
+ load_control();
21602190
mid = name_to_typed_rid(PD("checkin","0"),"ci");
21612191
zFilename = P("filename");
21622192
fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
21632193
if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
21642194
iLimit = atoi(PD("limit","20"));
21652195
if( P("filevers") ) annFlags |= ANN_FILE_VERS;
2196
+ ignoreWs = P("w")!=0;
2197
+ if( ignoreWs ) annFlags |= DIFF_IGNORE_ALLWS;
21662198
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
21672199
fossil_redirect_home();
21682200
}
21692201
21702202
/* compute the annotation */
@@ -2172,17 +2204,29 @@
21722204
annotate_file(&ann, fnid, mid, iLimit, annFlags);
21732205
zCI = ann.aVers[0].zMUuid;
21742206
21752207
/* generate the web page */
21762208
style_header("Annotation For %h", zFilename);
2177
- url_initialize(&url, "annotate");
2209
+ if( bBlame ){
2210
+ url_initialize(&url, "blame");
2211
+ }else{
2212
+ url_initialize(&url, "annotate");
2213
+ }
21782214
url_add_parameter(&url, "checkin", P("checkin"));
21792215
url_add_parameter(&url, "filename", zFilename);
21802216
if( iLimit!=20 ){
21812217
url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit));
21822218
}
21832219
url_add_parameter(&url, "log", showLog ? "1" : "0");
2220
+ if( ignoreWs ){
2221
+ url_add_parameter(&url, "w", "");
2222
+ style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes",
2223
+ "%s", url_render(&url, "w", 0, 0, 0));
2224
+ }else{
2225
+ style_submenu_element("Ignore Whitespace", "Ignore Whitespace",
2226
+ "%s", url_render(&url, "w", "", 0, 0));
2227
+ }
21842228
if( showLog ){
21852229
style_submenu_element("Hide Log", "Hide Log",
21862230
"%s", url_render(&url, "log", "0", 0, 0));
21872231
}else{
21882232
style_submenu_element("Show Log", "Show Log",
@@ -2208,11 +2252,11 @@
22082252
clr2 = 0xb5e0ff; /* Older changes: blue (cold) */
22092253
}
22102254
for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
22112255
clr = gradient_color(clr1, clr2, ann.nVers-1, i);
22122256
ann.aVers[i].zBgColor = mprintf("#%06x", clr);
2213
- }
2257
+ }
22142258
22152259
if( showLog ){
22162260
char *zLink = href("%R/finfo?name=%t&ci=%S",zFilename,zCI);
22172261
@ <h2>Ancestors of %z(zLink)%h(zFilename)</a> analyzed:</h2>
22182262
@ <ol>
@@ -2238,11 +2282,11 @@
22382282
}
22392283
@ </ol>
22402284
@ <hr>
22412285
}
22422286
if( !ann.bLimit ){
2243
- @ <h2>Origin for each line in
2287
+ @ <h2>Origin for each line in
22442288
@ %z(href("%R/finfo?name=%h&ci=%S", zFilename, zCI))%h(zFilename)</a>
22452289
@ from check-in %z(href("%R/info/%S",zCI))%S(zCI)</a>:</h2>
22462290
iLimit = ann.nVers+10;
22472291
}else{
22482292
@ <h2>Lines added by the %d(iLimit) most recent ancestors of
@@ -2291,22 +2335,25 @@
22912335
}
22922336
22932337
/*
22942338
** COMMAND: annotate
22952339
** COMMAND: blame
2340
+** COMMAND: praise
22962341
**
2297
-** %fossil (annotate|blame) ?OPTIONS? FILENAME
2342
+** %fossil (annotate|blame|praise) ?OPTIONS? FILENAME
22982343
**
22992344
** Output the text of a file with markings to show when each line of
23002345
** the file was last modified. The "annotate" command shows line numbers
2301
-** and omits the username. The "blame" command shows the user who made each
2302
-** checkin and omits the line number.
2346
+** and omits the username. The "blame" and "praise" commands show the user
2347
+** who made each checkin and omits the line number.
23032348
**
23042349
** Options:
2305
-** --filevers Show file version numbers rather than check-in versions
2306
-** -l|--log List all versions analyzed
2307
-** -n|--limit N Only look backwards in time by N versions
2350
+** --filevers Show file version numbers rather than check-in versions
2351
+** -l|--log List all versions analyzed
2352
+** -n|--limit N Only look backwards in time by N versions
2353
+** -Z|--ignore-trailing-space Ignore eol-whitespaces
2354
+** -w|--ignore-all-space Ignore all whitespaces
23082355
**
23092356
** See also: info, finfo, timeline
23102357
*/
23112358
void annotate_cmd(void){
23122359
int fnid; /* Filename ID */
@@ -2319,18 +2366,20 @@
23192366
int i; /* Loop counter */
23202367
const char *zLimit; /* The value to the -n|--limit option */
23212368
int iLimit; /* How far back in time to look */
23222369
int showLog; /* True to show the log */
23232370
int fileVers; /* Show file version instead of check-in versions */
2324
- int annFlags = 0; /* Flags to control annotation properties */
2371
+ u64 annFlags = 0; /* Flags to control annotation properties */
23252372
int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */
23262373
2327
- bBlame = g.argv[1][0]=='b';
2374
+ bBlame = g.argv[1][0]!='a';
23282375
zLimit = find_option("limit","n",1);
23292376
if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1";
23302377
iLimit = atoi(zLimit);
23312378
showLog = find_option("log","l",0)!=0;
2379
+ if( find_option("ignore-trailing-space","Z",0)!=0 ) annFlags |= DIFF_IGNORE_EOLWS;
2380
+ if( find_option("ignore-all-space","w",0)!=0 ) annFlags |= DIFF_IGNORE_ALLWS;
23322381
fileVers = find_option("filevers",0,0)!=0;
23332382
db_must_be_within_tree();
23342383
if( g.argc<3 ) {
23352384
usage("FILENAME");
23362385
}
23372386
--- src/diff.c
+++ src/diff.c
@@ -29,17 +29,17 @@
29 ** of the diff output.
30 */
31 #define DIFF_CONTEXT_MASK ((u64)0x0000ffff) /* Lines of context. Default if 0 */
32 #define DIFF_WIDTH_MASK ((u64)0x00ff0000) /* side-by-side column width */
33 #define DIFF_IGNORE_EOLWS ((u64)0x01000000) /* Ignore end-of-line whitespace */
34 #define DIFF_SIDEBYSIDE ((u64)0x02000000) /* Generate a side-by-side diff */
35 #define DIFF_VERBOSE ((u64)0x04000000) /* Missing shown as empty files */
36 #define DIFF_BRIEF ((u64)0x08000000) /* Show filenames only */
37 #define DIFF_INLINE ((u64)0x00000000) /* Inline (not side-by-side) diff */
38 #define DIFF_HTML ((u64)0x10000000) /* Render for HTML */
39 #define DIFF_LINENO ((u64)0x20000000) /* Show line numbers */
40 #define DIFF_WS_WARNING ((u64)0x40000000) /* Warn about whitespace */
41 #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */
42 #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */
43 #define DIFF_CONTEXT_EX (((u64)0x04)<<32) /* Use context even if zero */
44 #define DIFF_NOTTOOBIG (((u64)0x08)<<32) /* Only display if not too big */
45
@@ -54,10 +54,13 @@
54 "cannot compute difference between symlink and regular file\n"
55
56 #define DIFF_TOO_MANY_CHANGES \
57 "more than 10,000 changes\n"
58
 
 
 
59 /*
60 ** Maximum length of a line in a text file, in bytes. (2**13 = 8192 bytes)
61 */
62 #define LENGTH_MASK_SZ 13
63 #define LENGTH_MASK ((1<<LENGTH_MASK_SZ)-1)
@@ -73,10 +76,12 @@
73 */
74 typedef struct DLine DLine;
75 struct DLine {
76 const char *z; /* The text of the line */
77 unsigned int h; /* Hash of the line */
 
 
78 unsigned int iNext; /* 1+(Index of next line with same the same hash) */
79
80 /* an array of DLine elements serves two purposes. The fields
81 ** above are one per line of input text. But each entry is also
82 ** a bucket in a hash table, as follows: */
@@ -125,12 +130,12 @@
125 ** too long.
126 **
127 ** Profiling show that in most cases this routine consumes the bulk of
128 ** the CPU time on a diff.
129 */
130 static DLine *break_into_lines(const char *z, int n, int *pnLine, int ignoreWS){
131 int nLine, i, j, k, x;
132 unsigned int h, h2;
133 DLine *a;
134
135 /* Count the number of lines. Allocate space to hold
136 ** the returned array.
@@ -158,18 +163,25 @@
158 return a;
159 }
160
161 /* Fill in the array */
162 for(i=0; i<nLine; i++){
163 a[i].z = z;
164 for(j=0; z[j] && z[j]!='\n'; j++){}
165 k = j;
166 while( ignoreWS && k>0 && fossil_isspace(z[k-1]) ){ k--; }
167 for(h=0, x=0; x<=k; x++){
 
 
 
 
 
 
 
 
168 h = h ^ (h<<2) ^ z[x];
169 }
170 a[i].h = h = (h<<LENGTH_MASK_SZ) | k;;
171 h2 = h % nLine;
172 a[i].iNext = a[h2].iHash;
173 a[h2].iHash = i+1;
174 z += j+1;
175 }
@@ -181,11 +193,12 @@
181
182 /*
183 ** Return true if two DLine elements are identical.
184 */
185 static int same_dline(DLine *pA, DLine *pB){
186 return pA->h==pB->h && memcmp(pA->z,pB->z,pA->h & LENGTH_MASK)==0;
 
187 }
188
189 /*
190 ** Return true if the regular expression *pRe matches any of the
191 ** N dlines
@@ -221,16 +234,16 @@
221 }else if( cPrefix=='+' ){
222 blob_append(pOut, "<span class=\"diffadd\">", -1);
223 }else if( cPrefix=='-' ){
224 blob_append(pOut, "<span class=\"diffrm\">", -1);
225 }
226 htmlize_to_blob(pOut, pLine->z, (pLine->h & LENGTH_MASK));
227 if( cPrefix!=' ' ){
228 blob_append(pOut, "</span>", -1);
229 }
230 }else{
231 blob_append(pOut, pLine->z, pLine->h & LENGTH_MASK);
232 }
233 blob_append(pOut, "\n", 1);
234 }
235
236 /*
@@ -402,11 +415,11 @@
402 b += m;
403 if( i<nr-1 ){
404 m = R[r+i*3+3];
405 for(j=0; j<m; j++){
406 if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html);
407 appendDiffLine(pOut, ' ', &B[b+j], html, 0);
408 }
409 b += m;
410 a += m;
411 }
412 }
@@ -415,11 +428,11 @@
415 assert( nr==i );
416 m = R[r+nr*3];
417 if( m>nContext ) m = nContext;
418 for(j=0; j<m; j++){
419 if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html);
420 appendDiffLine(pOut, ' ', &B[b+j], html, 0);
421 }
422 }
423 }
424
425 /*
@@ -476,11 +489,11 @@
476 ** This comment contains multibyte unicode characters (ü, Æ, ð) in order
477 ** to test the ability of the diff code to handle such characters.
478 */
479 static void sbsWriteText(SbsLine *p, DLine *pLine, int col){
480 Blob *pCol = p->apCols[col];
481 int n = pLine->h & LENGTH_MASK;
482 int i; /* Number of input characters consumed */
483 int k; /* Cursor position */
484 int needEndSpan = 0;
485 const char *zIn = pLine->z;
486 int w = p->width;
@@ -1305,11 +1318,11 @@
1305 sbsWriteMarker(&s, " ", "");
1306 sbsWriteLineno(&s, b+j, SBS_LNB);
1307 sbsWriteText(&s, &B[b+j], SBS_TXTB);
1308 }
1309 }
1310
1311 if( s.escHtml && blob_size(s.apCols[SBS_LNA])>0 ){
1312 blob_append(pOut, "<table class=\"sbsdiffcols\"><tr>\n", -1);
1313 for(i=SBS_LNA; i<=SBS_TXTB; i++){
1314 sbsWriteColumn(pOut, s.apCols[i], i);
1315 blob_reset(s.apCols[i]);
@@ -1753,28 +1766,28 @@
1753 Blob *pB_Blob, /* TO file */
1754 Blob *pOut, /* Write diff here if not NULL */
1755 ReCompiled *pRe, /* Only output changes where this Regexp matches */
1756 u64 diffFlags /* DIFF_* flags defined above */
1757 ){
1758 int ignoreEolWs; /* Ignore whitespace at the end of lines */
1759 DContext c;
1760
1761 if( diffFlags & DIFF_INVERT ){
1762 Blob *pTemp = pA_Blob;
1763 pA_Blob = pB_Blob;
1764 pB_Blob = pTemp;
1765 }
1766 ignoreEolWs = (diffFlags & DIFF_IGNORE_EOLWS)!=0;
1767 blob_to_utf8_no_bom(pA_Blob, 0);
1768 blob_to_utf8_no_bom(pB_Blob, 0);
1769
1770 /* Prepare the input files */
1771 memset(&c, 0, sizeof(c));
1772 c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob),
1773 &c.nFrom, ignoreEolWs);
1774 c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob),
1775 &c.nTo, ignoreEolWs);
1776 if( c.aFrom==0 || c.aTo==0 ){
1777 fossil_free(c.aFrom);
1778 fossil_free(c.aTo);
1779 if( pOut ){
1780 diff_errmsg(pOut, DIFF_CANNOT_COMPUTE_BINARY, diffFlags);
@@ -1782,20 +1795,27 @@
1782 return 0;
1783 }
1784
1785 /* Compute the difference */
1786 diff_all(&c);
 
 
 
 
 
 
 
1787 if( (diffFlags & DIFF_NOTTOOBIG)!=0 ){
1788 int i, m, n;
1789 int *a = c.aEdit;
1790 int mx = c.nEdit;
1791 for(i=m=n=0; i<mx; i+=3){ m += a[i]; n += a[i+1]+a[i+2]; }
1792 if( n>10000 ){
1793 fossil_free(c.aFrom);
1794 fossil_free(c.aTo);
1795 fossil_free(c.aEdit);
1796 diff_errmsg(pOut, DIFF_TOO_MANY_CHANGES, diffFlags);
1797 return 0;
1798 }
1799 }
1800 if( (diffFlags & DIFF_NOOPT)==0 ){
1801 diff_optimize(&c);
@@ -1824,19 +1844,21 @@
1824
1825 /*
1826 ** Process diff-related command-line options and return an appropriate
1827 ** "diffFlags" integer.
1828 **
1829 ** --brief Show filenames only DIFF_BRIEF
1830 ** --context|-c N N lines of context. DIFF_CONTEXT_MASK
1831 ** --html Format for HTML DIFF_HTML
1832 ** --invert Invert the diff DIFF_INVERT
1833 ** --linenum|-n Show line numbers DIFF_LINENO
1834 ** --noopt Disable optimization DIFF_NOOPT
1835 ** --side-by-side|-y Side-by-side diff. DIFF_SIDEBYSIDE
1836 ** --unified Unified diff. ~DIFF_SIDEBYSIDE
1837 ** --width|-W N N character lines. DIFF_WIDTH_MASK
 
 
1838 */
1839 u64 diff_options(void){
1840 u64 diffFlags = 0;
1841 const char *z;
1842 int f;
@@ -1850,10 +1872,12 @@
1850 f *= DIFF_CONTEXT_MASK+1;
1851 if( f > DIFF_WIDTH_MASK ) f = DIFF_CONTEXT_MASK;
1852 diffFlags |= f;
1853 }
1854 if( find_option("html",0,0)!=0 ) diffFlags |= DIFF_HTML;
 
 
1855 if( find_option("linenum","n",0)!=0 ) diffFlags |= DIFF_LINENO;
1856 if( find_option("noopt",0,0)!=0 ) diffFlags |= DIFF_NOOPT;
1857 if( find_option("invert",0,0)!=0 ) diffFlags |= DIFF_INVERT;
1858 if( find_option("brief",0,0)!=0 ) diffFlags |= DIFF_BRIEF;
1859 return diffFlags;
@@ -1952,22 +1976,23 @@
1952 /*
1953 ** Initialize the annotation process by specifying the file that is
1954 ** to be annotated. The annotator takes control of the input Blob and
1955 ** will release it when it is finished with it.
1956 */
1957 static int annotation_start(Annotator *p, Blob *pInput){
1958 int i;
1959
1960 memset(p, 0, sizeof(*p));
1961 p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo,1);
 
1962 if( p->c.aTo==0 ){
1963 return 1;
1964 }
1965 p->aOrig = fossil_malloc( sizeof(p->aOrig[0])*p->c.nTo );
1966 for(i=0; i<p->c.nTo; i++){
1967 p->aOrig[i].z = p->c.aTo[i].z;
1968 p->aOrig[i].n = p->c.aTo[i].h & LENGTH_MASK;
1969 p->aOrig[i].iVers = -1;
1970 }
1971 p->nOrig = p->c.nTo;
1972 return 0;
1973 }
@@ -1977,17 +2002,17 @@
1977 ** being annotated. Do another step of the annotation. Return true
1978 ** if additional annotation is required. zPName is the tag to insert
1979 ** on each line of the file being annotated that was contributed by
1980 ** pParent. Memory to hold zPName is leaked.
1981 */
1982 static int annotation_step(Annotator *p, Blob *pParent, int iVers){
1983 int i, j;
1984 int lnTo;
1985
1986 /* Prepare the parent file to be diffed */
1987 p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent),
1988 &p->c.nFrom, 1);
1989 if( p->c.aFrom==0 ){
1990 return 1;
1991 }
1992
1993 /* Compute the differences going from pParent to the file being
@@ -2020,13 +2045,13 @@
2020 /* Return no errors */
2021 return 0;
2022 }
2023
2024
2025 /* Annotation flags */
2026 #define ANN_FILE_VERS 0x01 /* Show file vers rather than commit vers */
2027 #define ANN_FILE_ANCEST 0x02 /* Prefer check-ins in the ANCESTOR table */
2028
2029 /*
2030 ** Compute a complete annotation on a file. The file is identified
2031 ** by its filename number (filename.fnid) and the baseline in which
2032 ** it was checked in (mlink.mid).
@@ -2034,11 +2059,11 @@
2034 static void annotate_file(
2035 Annotator *p, /* The annotator */
2036 int fnid, /* The name of the file to be annotated */
2037 int mid, /* Use the version of the file in this check-in */
2038 int iLimit, /* Limit the number of levels if greater than zero */
2039 int annFlags /* Flags to alter the annotation */
2040 ){
2041 Blob toAnnotate; /* Text of the final (mid) version of the file */
2042 Blob step; /* Text of previous revision */
2043 int rid; /* Artifact ID of the file being annotated */
2044 Stmt q; /* Query returning all ancestor versions */
@@ -2052,11 +2077,12 @@
2052 }
2053 if( !content_get(rid, &toAnnotate) ){
2054 fossil_fatal("unable to retrieve content of artifact #%d", rid);
2055 }
2056 if( iLimit<=0 ) iLimit = 1000000000;
2057 annotation_start(p, &toAnnotate);
 
2058 db_begin_transaction();
2059 db_multi_exec(
2060 "CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);"
2061 "DELETE FROM vseen;"
2062 );
@@ -2086,11 +2112,12 @@
2086 p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1));
2087 p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2));
2088 p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3));
2089 if( p->nVers ){
2090 content_get(rid, &step);
2091 annotation_step(p, &step, p->nVers-1);
 
2092 blob_reset(&step);
2093 }
2094 p->nVers++;
2095 db_bind_int(&ins, ":rid", rid);
2096 db_step(&ins);
@@ -2126,10 +2153,11 @@
2126 }
2127
2128 /*
2129 ** WEBPAGE: annotate
2130 ** WEBPAGE: blame
 
2131 **
2132 ** Query parameters:
2133 **
2134 ** checkin=ID The manifest ID at which to start the annotation
2135 ** filename=FILENAME The filename.
@@ -2140,31 +2168,35 @@
2140 void annotation_page(void){
2141 int mid;
2142 int fnid;
2143 int i;
2144 int iLimit; /* Depth limit */
2145 int annFlags = ANN_FILE_ANCEST;
2146 int showLog = 0; /* True to display the log */
 
2147 const char *zFilename; /* Name of file to annotate */
2148 const char *zCI; /* The check-in containing zFilename */
2149 Annotator ann;
2150 HQuery url;
2151 struct AnnVers *p;
2152 unsigned clr1, clr2, clr;
2153 int bBlame = g.zPath[0]=='b';/* True for BLAME output. False for ANNOTATE. */
2154
2155 /* Gather query parameters */
2156 showLog = atoi(PD("log","1"));
2157 login_check_credentials();
2158 if( !g.perm.Read ){ login_needed(); return; }
2159 if( exclude_spiders("annotate") ) return;
 
2160 mid = name_to_typed_rid(PD("checkin","0"),"ci");
2161 zFilename = P("filename");
2162 fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
2163 if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
2164 iLimit = atoi(PD("limit","20"));
2165 if( P("filevers") ) annFlags |= ANN_FILE_VERS;
 
 
2166 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
2167 fossil_redirect_home();
2168 }
2169
2170 /* compute the annotation */
@@ -2172,17 +2204,29 @@
2172 annotate_file(&ann, fnid, mid, iLimit, annFlags);
2173 zCI = ann.aVers[0].zMUuid;
2174
2175 /* generate the web page */
2176 style_header("Annotation For %h", zFilename);
2177 url_initialize(&url, "annotate");
 
 
 
 
2178 url_add_parameter(&url, "checkin", P("checkin"));
2179 url_add_parameter(&url, "filename", zFilename);
2180 if( iLimit!=20 ){
2181 url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit));
2182 }
2183 url_add_parameter(&url, "log", showLog ? "1" : "0");
 
 
 
 
 
 
 
 
2184 if( showLog ){
2185 style_submenu_element("Hide Log", "Hide Log",
2186 "%s", url_render(&url, "log", "0", 0, 0));
2187 }else{
2188 style_submenu_element("Show Log", "Show Log",
@@ -2208,11 +2252,11 @@
2208 clr2 = 0xb5e0ff; /* Older changes: blue (cold) */
2209 }
2210 for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
2211 clr = gradient_color(clr1, clr2, ann.nVers-1, i);
2212 ann.aVers[i].zBgColor = mprintf("#%06x", clr);
2213 }
2214
2215 if( showLog ){
2216 char *zLink = href("%R/finfo?name=%t&ci=%S",zFilename,zCI);
2217 @ <h2>Ancestors of %z(zLink)%h(zFilename)</a> analyzed:</h2>
2218 @ <ol>
@@ -2238,11 +2282,11 @@
2238 }
2239 @ </ol>
2240 @ <hr>
2241 }
2242 if( !ann.bLimit ){
2243 @ <h2>Origin for each line in
2244 @ %z(href("%R/finfo?name=%h&ci=%S", zFilename, zCI))%h(zFilename)</a>
2245 @ from check-in %z(href("%R/info/%S",zCI))%S(zCI)</a>:</h2>
2246 iLimit = ann.nVers+10;
2247 }else{
2248 @ <h2>Lines added by the %d(iLimit) most recent ancestors of
@@ -2291,22 +2335,25 @@
2291 }
2292
2293 /*
2294 ** COMMAND: annotate
2295 ** COMMAND: blame
 
2296 **
2297 ** %fossil (annotate|blame) ?OPTIONS? FILENAME
2298 **
2299 ** Output the text of a file with markings to show when each line of
2300 ** the file was last modified. The "annotate" command shows line numbers
2301 ** and omits the username. The "blame" command shows the user who made each
2302 ** checkin and omits the line number.
2303 **
2304 ** Options:
2305 ** --filevers Show file version numbers rather than check-in versions
2306 ** -l|--log List all versions analyzed
2307 ** -n|--limit N Only look backwards in time by N versions
 
 
2308 **
2309 ** See also: info, finfo, timeline
2310 */
2311 void annotate_cmd(void){
2312 int fnid; /* Filename ID */
@@ -2319,18 +2366,20 @@
2319 int i; /* Loop counter */
2320 const char *zLimit; /* The value to the -n|--limit option */
2321 int iLimit; /* How far back in time to look */
2322 int showLog; /* True to show the log */
2323 int fileVers; /* Show file version instead of check-in versions */
2324 int annFlags = 0; /* Flags to control annotation properties */
2325 int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */
2326
2327 bBlame = g.argv[1][0]=='b';
2328 zLimit = find_option("limit","n",1);
2329 if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1";
2330 iLimit = atoi(zLimit);
2331 showLog = find_option("log","l",0)!=0;
 
 
2332 fileVers = find_option("filevers",0,0)!=0;
2333 db_must_be_within_tree();
2334 if( g.argc<3 ) {
2335 usage("FILENAME");
2336 }
2337
--- src/diff.c
+++ src/diff.c
@@ -29,17 +29,17 @@
29 ** of the diff output.
30 */
31 #define DIFF_CONTEXT_MASK ((u64)0x0000ffff) /* Lines of context. Default if 0 */
32 #define DIFF_WIDTH_MASK ((u64)0x00ff0000) /* side-by-side column width */
33 #define DIFF_IGNORE_EOLWS ((u64)0x01000000) /* Ignore end-of-line whitespace */
34 #define DIFF_IGNORE_ALLWS ((u64)0x03000000) /* Ignore all whitespace */
35 #define DIFF_SIDEBYSIDE ((u64)0x04000000) /* Generate a side-by-side diff */
36 #define DIFF_VERBOSE ((u64)0x08000000) /* Missing shown as empty files */
37 #define DIFF_INLINE ((u64)0x00000000) /* Inline (not side-by-side) diff */
38 #define DIFF_BRIEF ((u64)0x10000000) /* Show filenames only */
39 #define DIFF_HTML ((u64)0x20000000) /* Render for HTML */
40 #define DIFF_LINENO ((u64)0x40000000) /* Show line numbers */
41 #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */
42 #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */
43 #define DIFF_CONTEXT_EX (((u64)0x04)<<32) /* Use context even if zero */
44 #define DIFF_NOTTOOBIG (((u64)0x08)<<32) /* Only display if not too big */
45
@@ -54,10 +54,13 @@
54 "cannot compute difference between symlink and regular file\n"
55
56 #define DIFF_TOO_MANY_CHANGES \
57 "more than 10,000 changes\n"
58
59 #define DIFF_WHITESPACE_ONLY \
60 "whitespace changes only\n"
61
62 /*
63 ** Maximum length of a line in a text file, in bytes. (2**13 = 8192 bytes)
64 */
65 #define LENGTH_MASK_SZ 13
66 #define LENGTH_MASK ((1<<LENGTH_MASK_SZ)-1)
@@ -73,10 +76,12 @@
76 */
77 typedef struct DLine DLine;
78 struct DLine {
79 const char *z; /* The text of the line */
80 unsigned int h; /* Hash of the line */
81 unsigned short indent; /* Indent of the line. Only !=0 with -w/-Z option */
82 unsigned short n; /* number of bytes */
83 unsigned int iNext; /* 1+(Index of next line with same the same hash) */
84
85 /* an array of DLine elements serves two purposes. The fields
86 ** above are one per line of input text. But each entry is also
87 ** a bucket in a hash table, as follows: */
@@ -125,12 +130,12 @@
130 ** too long.
131 **
132 ** Profiling show that in most cases this routine consumes the bulk of
133 ** the CPU time on a diff.
134 */
135 static DLine *break_into_lines(const char *z, int n, int *pnLine, u64 diffFlags){
136 int nLine, i, j, k, s, x;
137 unsigned int h, h2;
138 DLine *a;
139
140 /* Count the number of lines. Allocate space to hold
141 ** the returned array.
@@ -158,18 +163,25 @@
163 return a;
164 }
165
166 /* Fill in the array */
167 for(i=0; i<nLine; i++){
 
168 for(j=0; z[j] && z[j]!='\n'; j++){}
169 a[i].z = z;
170 a[i].n = k = j;
171 s = 0;
172 if( diffFlags & DIFF_IGNORE_EOLWS ){
173 while( k>0 && fossil_isspace(z[k-1]) ){ k--; }
174 }
175 if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
176 while( s<k && fossil_isspace(z[s]) ){ s++; }
177 }
178 a[i].indent = s;
179 for(h=0, x=s; x<k; x++){
180 h = h ^ (h<<2) ^ z[x];
181 }
182 a[i].h = h = (h<<LENGTH_MASK_SZ) | (k-s);
183 h2 = h % nLine;
184 a[i].iNext = a[h2].iHash;
185 a[h2].iHash = i+1;
186 z += j+1;
187 }
@@ -181,11 +193,12 @@
193
194 /*
195 ** Return true if two DLine elements are identical.
196 */
197 static int same_dline(DLine *pA, DLine *pB){
198 return pA->h==pB->h && memcmp(pA->z+pA->indent,pB->z+pB->indent,
199 pA->h & LENGTH_MASK)==0;
200 }
201
202 /*
203 ** Return true if the regular expression *pRe matches any of the
204 ** N dlines
@@ -221,16 +234,16 @@
234 }else if( cPrefix=='+' ){
235 blob_append(pOut, "<span class=\"diffadd\">", -1);
236 }else if( cPrefix=='-' ){
237 blob_append(pOut, "<span class=\"diffrm\">", -1);
238 }
239 htmlize_to_blob(pOut, pLine->z, pLine->n);
240 if( cPrefix!=' ' ){
241 blob_append(pOut, "</span>", -1);
242 }
243 }else{
244 blob_append(pOut, pLine->z, pLine->n);
245 }
246 blob_append(pOut, "\n", 1);
247 }
248
249 /*
@@ -402,11 +415,11 @@
415 b += m;
416 if( i<nr-1 ){
417 m = R[r+i*3+3];
418 for(j=0; j<m; j++){
419 if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html);
420 appendDiffLine(pOut, ' ', &A[a+j], html, 0);
421 }
422 b += m;
423 a += m;
424 }
425 }
@@ -415,11 +428,11 @@
428 assert( nr==i );
429 m = R[r+nr*3];
430 if( m>nContext ) m = nContext;
431 for(j=0; j<m; j++){
432 if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html);
433 appendDiffLine(pOut, ' ', &A[a+j], html, 0);
434 }
435 }
436 }
437
438 /*
@@ -476,11 +489,11 @@
489 ** This comment contains multibyte unicode characters (ü, Æ, ð) in order
490 ** to test the ability of the diff code to handle such characters.
491 */
492 static void sbsWriteText(SbsLine *p, DLine *pLine, int col){
493 Blob *pCol = p->apCols[col];
494 int n = pLine->n;
495 int i; /* Number of input characters consumed */
496 int k; /* Cursor position */
497 int needEndSpan = 0;
498 const char *zIn = pLine->z;
499 int w = p->width;
@@ -1305,11 +1318,11 @@
1318 sbsWriteMarker(&s, " ", "");
1319 sbsWriteLineno(&s, b+j, SBS_LNB);
1320 sbsWriteText(&s, &B[b+j], SBS_TXTB);
1321 }
1322 }
1323
1324 if( s.escHtml && blob_size(s.apCols[SBS_LNA])>0 ){
1325 blob_append(pOut, "<table class=\"sbsdiffcols\"><tr>\n", -1);
1326 for(i=SBS_LNA; i<=SBS_TXTB; i++){
1327 sbsWriteColumn(pOut, s.apCols[i], i);
1328 blob_reset(s.apCols[i]);
@@ -1753,28 +1766,28 @@
1766 Blob *pB_Blob, /* TO file */
1767 Blob *pOut, /* Write diff here if not NULL */
1768 ReCompiled *pRe, /* Only output changes where this Regexp matches */
1769 u64 diffFlags /* DIFF_* flags defined above */
1770 ){
1771 int ignoreWs; /* Ignore whitespace */
1772 DContext c;
1773
1774 if( diffFlags & DIFF_INVERT ){
1775 Blob *pTemp = pA_Blob;
1776 pA_Blob = pB_Blob;
1777 pB_Blob = pTemp;
1778 }
1779 ignoreWs = (diffFlags & DIFF_IGNORE_ALLWS)!=0;
1780 blob_to_utf8_no_bom(pA_Blob, 0);
1781 blob_to_utf8_no_bom(pB_Blob, 0);
1782
1783 /* Prepare the input files */
1784 memset(&c, 0, sizeof(c));
1785 c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob),
1786 &c.nFrom, diffFlags);
1787 c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob),
1788 &c.nTo, diffFlags);
1789 if( c.aFrom==0 || c.aTo==0 ){
1790 fossil_free(c.aFrom);
1791 fossil_free(c.aTo);
1792 if( pOut ){
1793 diff_errmsg(pOut, DIFF_CANNOT_COMPUTE_BINARY, diffFlags);
@@ -1782,20 +1795,27 @@
1795 return 0;
1796 }
1797
1798 /* Compute the difference */
1799 diff_all(&c);
1800 if( ignoreWs && c.nEdit==6 && c.aEdit[1]==0 && c.aEdit[2]==0 ){
1801 fossil_free(c.aFrom);
1802 fossil_free(c.aTo);
1803 fossil_free(c.aEdit);
1804 if( pOut ) diff_errmsg(pOut, DIFF_WHITESPACE_ONLY, diffFlags);
1805 return 0;
1806 }
1807 if( (diffFlags & DIFF_NOTTOOBIG)!=0 ){
1808 int i, m, n;
1809 int *a = c.aEdit;
1810 int mx = c.nEdit;
1811 for(i=m=n=0; i<mx; i+=3){ m += a[i]; n += a[i+1]+a[i+2]; }
1812 if( n>10000 ){
1813 fossil_free(c.aFrom);
1814 fossil_free(c.aTo);
1815 fossil_free(c.aEdit);
1816 if( pOut ) diff_errmsg(pOut, DIFF_TOO_MANY_CHANGES, diffFlags);
1817 return 0;
1818 }
1819 }
1820 if( (diffFlags & DIFF_NOOPT)==0 ){
1821 diff_optimize(&c);
@@ -1824,19 +1844,21 @@
1844
1845 /*
1846 ** Process diff-related command-line options and return an appropriate
1847 ** "diffFlags" integer.
1848 **
1849 ** --brief Show filenames only DIFF_BRIEF
1850 ** -c|--context N N lines of context. DIFF_CONTEXT_MASK
1851 ** --html Format for HTML DIFF_HTML
1852 ** --invert Invert the diff DIFF_INVERT
1853 ** -n|--linenum Show line numbers DIFF_LINENO
1854 ** --noopt Disable optimization DIFF_NOOPT
1855 ** --unified Unified diff. ~DIFF_SIDEBYSIDE
1856 ** -w|--ignore-all-space Ignore all whitespaces DIFF_IGNORE_ALLWS
1857 ** --width|-W N N character lines. DIFF_WIDTH_MASK
1858 ** -y|--side-by-side Side-by-side diff. DIFF_SIDEBYSIDE
1859 ** -Z|--ignore-trailing-space Ignore eol-whitespaces DIFF_IGNORE_EOLWS
1860 */
1861 u64 diff_options(void){
1862 u64 diffFlags = 0;
1863 const char *z;
1864 int f;
@@ -1850,10 +1872,12 @@
1872 f *= DIFF_CONTEXT_MASK+1;
1873 if( f > DIFF_WIDTH_MASK ) f = DIFF_CONTEXT_MASK;
1874 diffFlags |= f;
1875 }
1876 if( find_option("html",0,0)!=0 ) diffFlags |= DIFF_HTML;
1877 if( find_option("ignore-trailing-space","Z",0)!=0 ) diffFlags |= DIFF_IGNORE_EOLWS;
1878 if( find_option("ignore-all-space","w",0)!=0 ) diffFlags |= DIFF_IGNORE_ALLWS;
1879 if( find_option("linenum","n",0)!=0 ) diffFlags |= DIFF_LINENO;
1880 if( find_option("noopt",0,0)!=0 ) diffFlags |= DIFF_NOOPT;
1881 if( find_option("invert",0,0)!=0 ) diffFlags |= DIFF_INVERT;
1882 if( find_option("brief",0,0)!=0 ) diffFlags |= DIFF_BRIEF;
1883 return diffFlags;
@@ -1952,22 +1976,23 @@
1976 /*
1977 ** Initialize the annotation process by specifying the file that is
1978 ** to be annotated. The annotator takes control of the input Blob and
1979 ** will release it when it is finished with it.
1980 */
1981 static int annotation_start(Annotator *p, Blob *pInput, u64 diffFlags){
1982 int i;
1983
1984 memset(p, 0, sizeof(*p));
1985 p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo,
1986 diffFlags);
1987 if( p->c.aTo==0 ){
1988 return 1;
1989 }
1990 p->aOrig = fossil_malloc( sizeof(p->aOrig[0])*p->c.nTo );
1991 for(i=0; i<p->c.nTo; i++){
1992 p->aOrig[i].z = p->c.aTo[i].z;
1993 p->aOrig[i].n = p->c.aTo[i].n;
1994 p->aOrig[i].iVers = -1;
1995 }
1996 p->nOrig = p->c.nTo;
1997 return 0;
1998 }
@@ -1977,17 +2002,17 @@
2002 ** being annotated. Do another step of the annotation. Return true
2003 ** if additional annotation is required. zPName is the tag to insert
2004 ** on each line of the file being annotated that was contributed by
2005 ** pParent. Memory to hold zPName is leaked.
2006 */
2007 static int annotation_step(Annotator *p, Blob *pParent, int iVers, u64 diffFlags){
2008 int i, j;
2009 int lnTo;
2010
2011 /* Prepare the parent file to be diffed */
2012 p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent),
2013 &p->c.nFrom, diffFlags);
2014 if( p->c.aFrom==0 ){
2015 return 1;
2016 }
2017
2018 /* Compute the differences going from pParent to the file being
@@ -2020,13 +2045,13 @@
2045 /* Return no errors */
2046 return 0;
2047 }
2048
2049
2050 /* Annotation flags (any DIFF flag can be used as Annotation flag as well) */
2051 #define ANN_FILE_VERS (((u64)0x20)<<32) /* Show file vers rather than commit vers */
2052 #define ANN_FILE_ANCEST (((u64)0x40)<<32) /* Prefer check-ins in the ANCESTOR table */
2053
2054 /*
2055 ** Compute a complete annotation on a file. The file is identified
2056 ** by its filename number (filename.fnid) and the baseline in which
2057 ** it was checked in (mlink.mid).
@@ -2034,11 +2059,11 @@
2059 static void annotate_file(
2060 Annotator *p, /* The annotator */
2061 int fnid, /* The name of the file to be annotated */
2062 int mid, /* Use the version of the file in this check-in */
2063 int iLimit, /* Limit the number of levels if greater than zero */
2064 u64 annFlags /* Flags to alter the annotation */
2065 ){
2066 Blob toAnnotate; /* Text of the final (mid) version of the file */
2067 Blob step; /* Text of previous revision */
2068 int rid; /* Artifact ID of the file being annotated */
2069 Stmt q; /* Query returning all ancestor versions */
@@ -2052,11 +2077,12 @@
2077 }
2078 if( !content_get(rid, &toAnnotate) ){
2079 fossil_fatal("unable to retrieve content of artifact #%d", rid);
2080 }
2081 if( iLimit<=0 ) iLimit = 1000000000;
2082 blob_to_utf8_no_bom(&toAnnotate, 0);
2083 annotation_start(p, &toAnnotate, annFlags);
2084 db_begin_transaction();
2085 db_multi_exec(
2086 "CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);"
2087 "DELETE FROM vseen;"
2088 );
@@ -2086,11 +2112,12 @@
2112 p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1));
2113 p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2));
2114 p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3));
2115 if( p->nVers ){
2116 content_get(rid, &step);
2117 blob_to_utf8_no_bom(&step, 0);
2118 annotation_step(p, &step, p->nVers-1, annFlags);
2119 blob_reset(&step);
2120 }
2121 p->nVers++;
2122 db_bind_int(&ins, ":rid", rid);
2123 db_step(&ins);
@@ -2126,10 +2153,11 @@
2153 }
2154
2155 /*
2156 ** WEBPAGE: annotate
2157 ** WEBPAGE: blame
2158 ** WEBPAGE: praise
2159 **
2160 ** Query parameters:
2161 **
2162 ** checkin=ID The manifest ID at which to start the annotation
2163 ** filename=FILENAME The filename.
@@ -2140,31 +2168,35 @@
2168 void annotation_page(void){
2169 int mid;
2170 int fnid;
2171 int i;
2172 int iLimit; /* Depth limit */
2173 u64 annFlags = ANN_FILE_ANCEST;
2174 int showLog = 0; /* True to display the log */
2175 int ignoreWs = 0; /* Ignore whitespace */
2176 const char *zFilename; /* Name of file to annotate */
2177 const char *zCI; /* The check-in containing zFilename */
2178 Annotator ann;
2179 HQuery url;
2180 struct AnnVers *p;
2181 unsigned clr1, clr2, clr;
2182 int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */
2183
2184 /* Gather query parameters */
2185 showLog = atoi(PD("log","1"));
2186 login_check_credentials();
2187 if( !g.perm.Read ){ login_needed(); return; }
2188 if( exclude_spiders("annotate") ) return;
2189 load_control();
2190 mid = name_to_typed_rid(PD("checkin","0"),"ci");
2191 zFilename = P("filename");
2192 fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
2193 if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
2194 iLimit = atoi(PD("limit","20"));
2195 if( P("filevers") ) annFlags |= ANN_FILE_VERS;
2196 ignoreWs = P("w")!=0;
2197 if( ignoreWs ) annFlags |= DIFF_IGNORE_ALLWS;
2198 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
2199 fossil_redirect_home();
2200 }
2201
2202 /* compute the annotation */
@@ -2172,17 +2204,29 @@
2204 annotate_file(&ann, fnid, mid, iLimit, annFlags);
2205 zCI = ann.aVers[0].zMUuid;
2206
2207 /* generate the web page */
2208 style_header("Annotation For %h", zFilename);
2209 if( bBlame ){
2210 url_initialize(&url, "blame");
2211 }else{
2212 url_initialize(&url, "annotate");
2213 }
2214 url_add_parameter(&url, "checkin", P("checkin"));
2215 url_add_parameter(&url, "filename", zFilename);
2216 if( iLimit!=20 ){
2217 url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit));
2218 }
2219 url_add_parameter(&url, "log", showLog ? "1" : "0");
2220 if( ignoreWs ){
2221 url_add_parameter(&url, "w", "");
2222 style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes",
2223 "%s", url_render(&url, "w", 0, 0, 0));
2224 }else{
2225 style_submenu_element("Ignore Whitespace", "Ignore Whitespace",
2226 "%s", url_render(&url, "w", "", 0, 0));
2227 }
2228 if( showLog ){
2229 style_submenu_element("Hide Log", "Hide Log",
2230 "%s", url_render(&url, "log", "0", 0, 0));
2231 }else{
2232 style_submenu_element("Show Log", "Show Log",
@@ -2208,11 +2252,11 @@
2252 clr2 = 0xb5e0ff; /* Older changes: blue (cold) */
2253 }
2254 for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
2255 clr = gradient_color(clr1, clr2, ann.nVers-1, i);
2256 ann.aVers[i].zBgColor = mprintf("#%06x", clr);
2257 }
2258
2259 if( showLog ){
2260 char *zLink = href("%R/finfo?name=%t&ci=%S",zFilename,zCI);
2261 @ <h2>Ancestors of %z(zLink)%h(zFilename)</a> analyzed:</h2>
2262 @ <ol>
@@ -2238,11 +2282,11 @@
2282 }
2283 @ </ol>
2284 @ <hr>
2285 }
2286 if( !ann.bLimit ){
2287 @ <h2>Origin for each line in
2288 @ %z(href("%R/finfo?name=%h&ci=%S", zFilename, zCI))%h(zFilename)</a>
2289 @ from check-in %z(href("%R/info/%S",zCI))%S(zCI)</a>:</h2>
2290 iLimit = ann.nVers+10;
2291 }else{
2292 @ <h2>Lines added by the %d(iLimit) most recent ancestors of
@@ -2291,22 +2335,25 @@
2335 }
2336
2337 /*
2338 ** COMMAND: annotate
2339 ** COMMAND: blame
2340 ** COMMAND: praise
2341 **
2342 ** %fossil (annotate|blame|praise) ?OPTIONS? FILENAME
2343 **
2344 ** Output the text of a file with markings to show when each line of
2345 ** the file was last modified. The "annotate" command shows line numbers
2346 ** and omits the username. The "blame" and "praise" commands show the user
2347 ** who made each checkin and omits the line number.
2348 **
2349 ** Options:
2350 ** --filevers Show file version numbers rather than check-in versions
2351 ** -l|--log List all versions analyzed
2352 ** -n|--limit N Only look backwards in time by N versions
2353 ** -Z|--ignore-trailing-space Ignore eol-whitespaces
2354 ** -w|--ignore-all-space Ignore all whitespaces
2355 **
2356 ** See also: info, finfo, timeline
2357 */
2358 void annotate_cmd(void){
2359 int fnid; /* Filename ID */
@@ -2319,18 +2366,20 @@
2366 int i; /* Loop counter */
2367 const char *zLimit; /* The value to the -n|--limit option */
2368 int iLimit; /* How far back in time to look */
2369 int showLog; /* True to show the log */
2370 int fileVers; /* Show file version instead of check-in versions */
2371 u64 annFlags = 0; /* Flags to control annotation properties */
2372 int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */
2373
2374 bBlame = g.argv[1][0]!='a';
2375 zLimit = find_option("limit","n",1);
2376 if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1";
2377 iLimit = atoi(zLimit);
2378 showLog = find_option("log","l",0)!=0;
2379 if( find_option("ignore-trailing-space","Z",0)!=0 ) annFlags |= DIFF_IGNORE_EOLWS;
2380 if( find_option("ignore-all-space","w",0)!=0 ) annFlags |= DIFF_IGNORE_ALLWS;
2381 fileVers = find_option("filevers",0,0)!=0;
2382 db_must_be_within_tree();
2383 if( g.argc<3 ) {
2384 usage("FILENAME");
2385 }
2386
+94 -32
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -49,15 +49,25 @@
4949
if( diffFlags & DIFF_BRIEF ){
5050
/* no-op */
5151
}else if( diffFlags & DIFF_SIDEBYSIDE ){
5252
int w = diff_width(diffFlags);
5353
int n1 = strlen(zLeft);
54
+ int n2 = strlen(zRight);
5455
int x;
55
- if( n1>w*2 ) n1 = w*2;
56
- x = w*2+17 - (n1+2);
57
- z = mprintf("%.*c %.*s %.*c\n",
58
- x/2, '=', n1, zLeft, (x+1)/2, '=');
56
+ if( n1==n2 && fossil_strcmp(zLeft,zRight)==0 ){
57
+ if( n1>w*2 ) n1 = w*2;
58
+ x = w*2+17 - (n1+2);
59
+ z = mprintf("%.*c %.*s %.*c\n",
60
+ x/2, '=', n1, zLeft, (x+1)/2, '=');
61
+ }else{
62
+ if( w<20 ) w = 20;
63
+ if( n1>w-10 ) n1 = w - 10;
64
+ if( n2>w-10 ) n2 = w - 10;
65
+ z = mprintf("%.*c %.*s %.*c versus %.*c %.*s %.*c\n",
66
+ (w-n1+10)/2, '=', n1, zLeft, (w-n1+1)/2, '=',
67
+ (w-n2)/2, '=', n2, zRight, (w-n2+1)/2, '=');
68
+ }
5969
}else{
6070
z = mprintf("--- %s\n+++ %s\n", zLeft, zRight);
6171
}
6272
fossil_print("%s", z);
6373
fossil_free(z);
@@ -598,10 +608,11 @@
598608
}
599609
600610
/* A Tcl/Tk script used to render diff output.
601611
*/
602612
static const char zDiffScript[] =
613
+@ set prog {
603614
@ package require Tk
604615
@
605616
@ array set CFG {
606617
@ TITLE {Fossil Diff}
607618
@ LN_COL_BG #dddddd
@@ -617,10 +628,11 @@
617628
@ HR_PAD_TOP 4
618629
@ HR_PAD_BTM 8
619630
@ FN_BG #444444
620631
@ FN_FG #ffffff
621632
@ FN_PAD 5
633
+@ ERR_FG #ee0000
622634
@ PADX 5
623635
@ WIDTH 80
624636
@ HEIGHT 45
625637
@ LB_HEIGHT 25
626638
@ }
@@ -641,43 +653,65 @@
641653
@
642654
@ proc colType {c} {
643655
@ regexp {[a-z]+} $c type
644656
@ return $type
645657
@ }
658
+@
659
+@ proc getLine {difftxt N iivar} {
660
+@ upvar $iivar ii
661
+@ if {$ii>=$N} {return -1}
662
+@ set x [lindex $difftxt $ii]
663
+@ incr ii
664
+@ return $x
665
+@ }
646666
@
647667
@ proc readDiffs {fossilcmd} {
648
-@ set in [open $fossilcmd r]
649
-@ fconfigure $in -encoding utf-8
668
+@ global difftxt
669
+@ if {![info exists difftxt]} {
670
+@ set in [open $fossilcmd r]
671
+@ fconfigure $in -encoding utf-8
672
+@ set difftxt [split [read $in] \n]
673
+@ close $in
674
+@ }
675
+@ set N [llength $difftxt]
676
+@ set ii 0
650677
@ set nDiffs 0
651678
@ array set widths {txt 0 ln 0 mkr 0}
652
-@ while {[gets $in line] != -1} {
653
-@ if {![regexp {^=+\s+(.*?)\s+=+$} $line all fn]} {
679
+@ while {[set line [getLine $difftxt $N ii]] != -1} {
680
+@ set fn2 {}
681
+@ if {![regexp {^=+ (.*?) =+ versus =+ (.*?) =+$} $line all fn fn2]
682
+@ && ![regexp {^=+ (.*?) =+$} $line all fn]
683
+@ } {
654684
@ continue
655685
@ }
656
-@ if {[string compare -length 6 [gets $in] "<table"]} {
686
+@ set errMsg ""
687
+@ set line [getLine $difftxt $N ii]
688
+@ if {[string compare -length 6 $line "<table"]
689
+@ && ![regexp {<p[^>]*>(.+)} $line - errMsg]} {
657690
@ continue
658691
@ }
659692
@ incr nDiffs
660693
@ set idx [expr {$nDiffs > 1 ? [.txtA index end] : "1.0"}]
661694
@ .wfiles.lb insert end $fn
662695
@
663696
@ foreach c [cols] {
664
-@ while {[gets $in] ne "<pre>"} continue
665
-@
666697
@ if {$nDiffs > 1} {
667698
@ $c insert end \n -
668699
@ }
669700
@ if {[colType $c] eq "txt"} {
670701
@ $c insert end $fn\n fn
702
+@ if {$fn2!=""} {set fn $fn2}
671703
@ } else {
672704
@ $c insert end \n fn
673705
@ }
674706
@ $c insert end \n -
675707
@
708
+@ if {$errMsg ne ""} continue
709
+@ while {[getLine $difftxt $N ii] ne "<pre>"} continue
676710
@ set type [colType $c]
677711
@ set str {}
678
-@ while {[set line [gets $in]] ne "</pre>"} {
712
+@ while {[set line [getLine $difftxt $N ii]] ne "</pre>"} {
679713
@ set len [string length [dehtml $line]]
680714
@ if {$len > $widths($type)} {
681715
@ set widths($type) $len
682716
@ }
683717
@ append str $line\n
@@ -693,12 +727,16 @@
693727
@ } else {
694728
@ $c insert end [dehtml $pre] -
695729
@ }
696730
@ }
697731
@ }
732
+@
733
+@ if {$errMsg ne ""} {
734
+@ foreach c {.txtA .txtB} {$c insert end [string trim $errMsg] err}
735
+@ foreach c [cols] {$c insert end \n -}
736
+@ }
698737
@ }
699
-@ close $in
700738
@
701739
@ foreach c [cols] {
702740
@ set type [colType $c]
703741
@ if {$type ne "txt"} {
704742
@ $c config -width $widths($type)
@@ -797,12 +835,12 @@
797835
@ bind . <q> exit
798836
@ bind . <Destroy> {after 0 exit}
799837
@ bind . <Tab> {cycleDiffs; break}
800838
@ bind . <<PrevWindow>> {cycleDiffs 1; break}
801839
@ bind . <Return> {
802
-@ event generate .files <1>
803
-@ event generate .files <ButtonRelease-1>
840
+@ event generate .bb.files <1>
841
+@ event generate .bb.files <ButtonRelease-1>
804842
@ break
805843
@ }
806844
@ foreach {key axis args} {
807845
@ Up y {scroll -5 units}
808846
@ Down y {scroll 5 units}
@@ -815,21 +853,22 @@
815853
@ } {
816854
@ bind . <$key> "scroll-$axis $args; break"
817855
@ bind . <Shift-$key> continue
818856
@ }
819857
@
820
-@ ::ttk::menubutton .files -text "Files"
858
+@ frame .bb
859
+@ ::ttk::menubutton .bb.files -text "Files"
821860
@ toplevel .wfiles
822861
@ wm withdraw .wfiles
823862
@ update idletasks
824863
@ wm transient .wfiles .
825864
@ wm overrideredirect .wfiles 1
826865
@ listbox .wfiles.lb -width 0 -height $CFG(LB_HEIGHT) -activestyle none \
827866
@ -yscroll {.wfiles.sb set}
828867
@ ::ttk::scrollbar .wfiles.sb -command {.wfiles.lb yview}
829868
@ grid .wfiles.lb .wfiles.sb -sticky ns
830
-@ bind .files <1> {
869
+@ bind .bb.files <1> {
831870
@ set x [winfo rootx %W]
832871
@ set y [expr {[winfo rooty %W]+[winfo height %W]}]
833872
@ wm geometry .wfiles +$x+$y
834873
@ wm deiconify .wfiles
835874
@ focus .wfiles.lb
@@ -864,10 +903,11 @@
864903
@ $txt tag config $tag -background $CFG([string toupper $tag]_BG)
865904
@ $txt tag lower $tag
866905
@ }
867906
@ $txt tag config fn -background $CFG(FN_BG) -foreground $CFG(FN_FG) \
868907
@ -justify center
908
+@ $txt tag config err -foreground $CFG(ERR_FG)
869909
@ }
870910
@ text .mkr
871911
@
872912
@ foreach c [cols] {
873913
@ set keyPrefix [string toupper [colType $c]]_COL_
@@ -890,22 +930,42 @@
890930
@ tk_messageBox -type ok -title $CFG(TITLE) -message "No changes"
891931
@ exit
892932
@ }
893933
@ update idletasks
894934
@
935
+@ proc saveDiff {} {
936
+@ set fn [tk_getSaveFile]
937
+@ set out [open $fn wb]
938
+@ puts $out "#!/usr/bin/tclsh\n#\n# Run this script using 'tclsh' or 'wish'"
939
+@ puts $out "# to see the graphical diff.\n#"
940
+@ puts $out "set fossilcmd {}"
941
+@ puts $out "set prog [list $::prog]"
942
+@ puts $out "set difftxt \173"
943
+@ foreach e $::difftxt {puts $out [list $e]}
944
+@ puts $out "\175"
945
+@ puts $out "eval \$prog"
946
+@ close $out
947
+@ }
948
+@ ::ttk::button .bb.quit -text {Quit} -command exit
949
+@ ::ttk::button .bb.save -text {Save As...} -command saveDiff
950
+@ pack .bb.quit -side left
951
+@ if {$fossilcmd!=""} {pack .bb.save -side left}
952
+@ pack .bb.files -side left
895953
@ grid rowconfigure . 1 -weight 1
896954
@ grid columnconfigure . 1 -weight 1
897955
@ grid columnconfigure . 4 -weight 1
898
-@ grid .files -row 0 -columnspan 6
956
+@ grid .bb -row 0 -columnspan 6
899957
@ eval grid [cols] -row 1 -sticky nsew
900958
@ grid .sby -row 1 -column 5 -sticky ns
901959
@ grid .sbxA -row 2 -columnspan 2 -sticky ew
902960
@ grid .spacer -row 2 -column 2
903961
@ grid .sbxB -row 2 -column 3 -columnspan 2 -sticky ew
904962
@
905963
@ .spacer config -height [winfo height .sbxA]
906964
@ wm deiconify .
965
+@ }
966
+@ eval $prog
907967
;
908968
909969
/*
910970
** Show diff output in a Tcl/Tk window, in response to the --tk option
911971
** to the diff command.
@@ -1029,23 +1089,26 @@
10291089
** The "--binary" option causes files matching the glob PATTERN to be treated
10301090
** as binary when considering if they should be used with external diff program.
10311091
** This option overrides the "binary-glob" setting.
10321092
**
10331093
** Options:
1034
-** --binary PATTERN Treat files that match the glob PATTERN as binary
1035
-** --branch BRANCH Show diff of all changes on BRANCH
1036
-** --brief Show filenames only
1037
-** --context|-c N Use N lines of context
1038
-** --diff-binary BOOL Include binary files when using external commands
1039
-** --from|-r VERSION select VERSION as source for the diff
1040
-** --internal|-i use internal diff logic
1041
-** --side-by-side|-y side-by-side diff
1042
-** --tk Launch a Tcl/Tk GUI for display
1043
-** --to VERSION select VERSION as target for the diff
1044
-** --unified unified diff
1045
-** -v|--verbose output complete text of added or deleted files
1046
-** -W|--width Width of lines in side-by-side diff
1094
+** --binary PATTERN Treat files that match the glob PATTERN as binary
1095
+** --branch BRANCH Show diff of all changes on BRANCH
1096
+** --brief Show filenames only
1097
+** --context|-c N Use N lines of context
1098
+** --diff-binary BOOL Include binary files when using external commands
1099
+** --from|-r VERSION select VERSION as source for the diff
1100
+** --internal|-i use internal diff logic
1101
+** --side-by-side|-y side-by-side diff
1102
+** --tk Launch a Tcl/Tk GUI for display
1103
+** --to VERSION select VERSION as target for the diff
1104
+** --unified unified diff
1105
+** -v|--verbose output complete text of added or deleted files
1106
+** -w|--ignore-all-space Ignore changes to start-of-line and end-of-line
1107
+** whitespace
1108
+** -W|--width Width of lines in side-by-side diff
1109
+** -Z|--ignore-trailing-space Ignore changes to end-of-line whitespace
10471110
*/
10481111
void diff_cmd(void){
10491112
int isGDiff; /* True for gdiff. False for normal diff */
10501113
int isInternDiff; /* True for internal diff */
10511114
int verboseFlag; /* True if -v or --verbose flag is used */
@@ -1071,11 +1134,10 @@
10711134
verboseFlag = find_option("verbose","v",0)!=0;
10721135
if( !verboseFlag ){
10731136
verboseFlag = find_option("new-file","N",0)!=0; /* deprecated */
10741137
}
10751138
if( verboseFlag ) diffFlags |= DIFF_VERBOSE;
1076
-
10771139
if( zBranch ){
10781140
if( zTo || zFrom ){
10791141
fossil_fatal("cannot use --from or --to with --branch");
10801142
}
10811143
zTo = zBranch;
10821144
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -49,15 +49,25 @@
49 if( diffFlags & DIFF_BRIEF ){
50 /* no-op */
51 }else if( diffFlags & DIFF_SIDEBYSIDE ){
52 int w = diff_width(diffFlags);
53 int n1 = strlen(zLeft);
 
54 int x;
55 if( n1>w*2 ) n1 = w*2;
56 x = w*2+17 - (n1+2);
57 z = mprintf("%.*c %.*s %.*c\n",
58 x/2, '=', n1, zLeft, (x+1)/2, '=');
 
 
 
 
 
 
 
 
 
59 }else{
60 z = mprintf("--- %s\n+++ %s\n", zLeft, zRight);
61 }
62 fossil_print("%s", z);
63 fossil_free(z);
@@ -598,10 +608,11 @@
598 }
599
600 /* A Tcl/Tk script used to render diff output.
601 */
602 static const char zDiffScript[] =
 
603 @ package require Tk
604 @
605 @ array set CFG {
606 @ TITLE {Fossil Diff}
607 @ LN_COL_BG #dddddd
@@ -617,10 +628,11 @@
617 @ HR_PAD_TOP 4
618 @ HR_PAD_BTM 8
619 @ FN_BG #444444
620 @ FN_FG #ffffff
621 @ FN_PAD 5
 
622 @ PADX 5
623 @ WIDTH 80
624 @ HEIGHT 45
625 @ LB_HEIGHT 25
626 @ }
@@ -641,43 +653,65 @@
641 @
642 @ proc colType {c} {
643 @ regexp {[a-z]+} $c type
644 @ return $type
645 @ }
 
 
 
 
 
 
 
 
646 @
647 @ proc readDiffs {fossilcmd} {
648 @ set in [open $fossilcmd r]
649 @ fconfigure $in -encoding utf-8
 
 
 
 
 
 
 
650 @ set nDiffs 0
651 @ array set widths {txt 0 ln 0 mkr 0}
652 @ while {[gets $in line] != -1} {
653 @ if {![regexp {^=+\s+(.*?)\s+=+$} $line all fn]} {
 
 
 
654 @ continue
655 @ }
656 @ if {[string compare -length 6 [gets $in] "<table"]} {
 
 
 
657 @ continue
658 @ }
659 @ incr nDiffs
660 @ set idx [expr {$nDiffs > 1 ? [.txtA index end] : "1.0"}]
661 @ .wfiles.lb insert end $fn
662 @
663 @ foreach c [cols] {
664 @ while {[gets $in] ne "<pre>"} continue
665 @
666 @ if {$nDiffs > 1} {
667 @ $c insert end \n -
668 @ }
669 @ if {[colType $c] eq "txt"} {
670 @ $c insert end $fn\n fn
 
671 @ } else {
672 @ $c insert end \n fn
673 @ }
674 @ $c insert end \n -
675 @
 
 
676 @ set type [colType $c]
677 @ set str {}
678 @ while {[set line [gets $in]] ne "</pre>"} {
679 @ set len [string length [dehtml $line]]
680 @ if {$len > $widths($type)} {
681 @ set widths($type) $len
682 @ }
683 @ append str $line\n
@@ -693,12 +727,16 @@
693 @ } else {
694 @ $c insert end [dehtml $pre] -
695 @ }
696 @ }
697 @ }
 
 
 
 
 
698 @ }
699 @ close $in
700 @
701 @ foreach c [cols] {
702 @ set type [colType $c]
703 @ if {$type ne "txt"} {
704 @ $c config -width $widths($type)
@@ -797,12 +835,12 @@
797 @ bind . <q> exit
798 @ bind . <Destroy> {after 0 exit}
799 @ bind . <Tab> {cycleDiffs; break}
800 @ bind . <<PrevWindow>> {cycleDiffs 1; break}
801 @ bind . <Return> {
802 @ event generate .files <1>
803 @ event generate .files <ButtonRelease-1>
804 @ break
805 @ }
806 @ foreach {key axis args} {
807 @ Up y {scroll -5 units}
808 @ Down y {scroll 5 units}
@@ -815,21 +853,22 @@
815 @ } {
816 @ bind . <$key> "scroll-$axis $args; break"
817 @ bind . <Shift-$key> continue
818 @ }
819 @
820 @ ::ttk::menubutton .files -text "Files"
 
821 @ toplevel .wfiles
822 @ wm withdraw .wfiles
823 @ update idletasks
824 @ wm transient .wfiles .
825 @ wm overrideredirect .wfiles 1
826 @ listbox .wfiles.lb -width 0 -height $CFG(LB_HEIGHT) -activestyle none \
827 @ -yscroll {.wfiles.sb set}
828 @ ::ttk::scrollbar .wfiles.sb -command {.wfiles.lb yview}
829 @ grid .wfiles.lb .wfiles.sb -sticky ns
830 @ bind .files <1> {
831 @ set x [winfo rootx %W]
832 @ set y [expr {[winfo rooty %W]+[winfo height %W]}]
833 @ wm geometry .wfiles +$x+$y
834 @ wm deiconify .wfiles
835 @ focus .wfiles.lb
@@ -864,10 +903,11 @@
864 @ $txt tag config $tag -background $CFG([string toupper $tag]_BG)
865 @ $txt tag lower $tag
866 @ }
867 @ $txt tag config fn -background $CFG(FN_BG) -foreground $CFG(FN_FG) \
868 @ -justify center
 
869 @ }
870 @ text .mkr
871 @
872 @ foreach c [cols] {
873 @ set keyPrefix [string toupper [colType $c]]_COL_
@@ -890,22 +930,42 @@
890 @ tk_messageBox -type ok -title $CFG(TITLE) -message "No changes"
891 @ exit
892 @ }
893 @ update idletasks
894 @
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
895 @ grid rowconfigure . 1 -weight 1
896 @ grid columnconfigure . 1 -weight 1
897 @ grid columnconfigure . 4 -weight 1
898 @ grid .files -row 0 -columnspan 6
899 @ eval grid [cols] -row 1 -sticky nsew
900 @ grid .sby -row 1 -column 5 -sticky ns
901 @ grid .sbxA -row 2 -columnspan 2 -sticky ew
902 @ grid .spacer -row 2 -column 2
903 @ grid .sbxB -row 2 -column 3 -columnspan 2 -sticky ew
904 @
905 @ .spacer config -height [winfo height .sbxA]
906 @ wm deiconify .
 
 
907 ;
908
909 /*
910 ** Show diff output in a Tcl/Tk window, in response to the --tk option
911 ** to the diff command.
@@ -1029,23 +1089,26 @@
1029 ** The "--binary" option causes files matching the glob PATTERN to be treated
1030 ** as binary when considering if they should be used with external diff program.
1031 ** This option overrides the "binary-glob" setting.
1032 **
1033 ** Options:
1034 ** --binary PATTERN Treat files that match the glob PATTERN as binary
1035 ** --branch BRANCH Show diff of all changes on BRANCH
1036 ** --brief Show filenames only
1037 ** --context|-c N Use N lines of context
1038 ** --diff-binary BOOL Include binary files when using external commands
1039 ** --from|-r VERSION select VERSION as source for the diff
1040 ** --internal|-i use internal diff logic
1041 ** --side-by-side|-y side-by-side diff
1042 ** --tk Launch a Tcl/Tk GUI for display
1043 ** --to VERSION select VERSION as target for the diff
1044 ** --unified unified diff
1045 ** -v|--verbose output complete text of added or deleted files
1046 ** -W|--width Width of lines in side-by-side diff
 
 
 
1047 */
1048 void diff_cmd(void){
1049 int isGDiff; /* True for gdiff. False for normal diff */
1050 int isInternDiff; /* True for internal diff */
1051 int verboseFlag; /* True if -v or --verbose flag is used */
@@ -1071,11 +1134,10 @@
1071 verboseFlag = find_option("verbose","v",0)!=0;
1072 if( !verboseFlag ){
1073 verboseFlag = find_option("new-file","N",0)!=0; /* deprecated */
1074 }
1075 if( verboseFlag ) diffFlags |= DIFF_VERBOSE;
1076
1077 if( zBranch ){
1078 if( zTo || zFrom ){
1079 fossil_fatal("cannot use --from or --to with --branch");
1080 }
1081 zTo = zBranch;
1082
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -49,15 +49,25 @@
49 if( diffFlags & DIFF_BRIEF ){
50 /* no-op */
51 }else if( diffFlags & DIFF_SIDEBYSIDE ){
52 int w = diff_width(diffFlags);
53 int n1 = strlen(zLeft);
54 int n2 = strlen(zRight);
55 int x;
56 if( n1==n2 && fossil_strcmp(zLeft,zRight)==0 ){
57 if( n1>w*2 ) n1 = w*2;
58 x = w*2+17 - (n1+2);
59 z = mprintf("%.*c %.*s %.*c\n",
60 x/2, '=', n1, zLeft, (x+1)/2, '=');
61 }else{
62 if( w<20 ) w = 20;
63 if( n1>w-10 ) n1 = w - 10;
64 if( n2>w-10 ) n2 = w - 10;
65 z = mprintf("%.*c %.*s %.*c versus %.*c %.*s %.*c\n",
66 (w-n1+10)/2, '=', n1, zLeft, (w-n1+1)/2, '=',
67 (w-n2)/2, '=', n2, zRight, (w-n2+1)/2, '=');
68 }
69 }else{
70 z = mprintf("--- %s\n+++ %s\n", zLeft, zRight);
71 }
72 fossil_print("%s", z);
73 fossil_free(z);
@@ -598,10 +608,11 @@
608 }
609
610 /* A Tcl/Tk script used to render diff output.
611 */
612 static const char zDiffScript[] =
613 @ set prog {
614 @ package require Tk
615 @
616 @ array set CFG {
617 @ TITLE {Fossil Diff}
618 @ LN_COL_BG #dddddd
@@ -617,10 +628,11 @@
628 @ HR_PAD_TOP 4
629 @ HR_PAD_BTM 8
630 @ FN_BG #444444
631 @ FN_FG #ffffff
632 @ FN_PAD 5
633 @ ERR_FG #ee0000
634 @ PADX 5
635 @ WIDTH 80
636 @ HEIGHT 45
637 @ LB_HEIGHT 25
638 @ }
@@ -641,43 +653,65 @@
653 @
654 @ proc colType {c} {
655 @ regexp {[a-z]+} $c type
656 @ return $type
657 @ }
658 @
659 @ proc getLine {difftxt N iivar} {
660 @ upvar $iivar ii
661 @ if {$ii>=$N} {return -1}
662 @ set x [lindex $difftxt $ii]
663 @ incr ii
664 @ return $x
665 @ }
666 @
667 @ proc readDiffs {fossilcmd} {
668 @ global difftxt
669 @ if {![info exists difftxt]} {
670 @ set in [open $fossilcmd r]
671 @ fconfigure $in -encoding utf-8
672 @ set difftxt [split [read $in] \n]
673 @ close $in
674 @ }
675 @ set N [llength $difftxt]
676 @ set ii 0
677 @ set nDiffs 0
678 @ array set widths {txt 0 ln 0 mkr 0}
679 @ while {[set line [getLine $difftxt $N ii]] != -1} {
680 @ set fn2 {}
681 @ if {![regexp {^=+ (.*?) =+ versus =+ (.*?) =+$} $line all fn fn2]
682 @ && ![regexp {^=+ (.*?) =+$} $line all fn]
683 @ } {
684 @ continue
685 @ }
686 @ set errMsg ""
687 @ set line [getLine $difftxt $N ii]
688 @ if {[string compare -length 6 $line "<table"]
689 @ && ![regexp {<p[^>]*>(.+)} $line - errMsg]} {
690 @ continue
691 @ }
692 @ incr nDiffs
693 @ set idx [expr {$nDiffs > 1 ? [.txtA index end] : "1.0"}]
694 @ .wfiles.lb insert end $fn
695 @
696 @ foreach c [cols] {
 
 
697 @ if {$nDiffs > 1} {
698 @ $c insert end \n -
699 @ }
700 @ if {[colType $c] eq "txt"} {
701 @ $c insert end $fn\n fn
702 @ if {$fn2!=""} {set fn $fn2}
703 @ } else {
704 @ $c insert end \n fn
705 @ }
706 @ $c insert end \n -
707 @
708 @ if {$errMsg ne ""} continue
709 @ while {[getLine $difftxt $N ii] ne "<pre>"} continue
710 @ set type [colType $c]
711 @ set str {}
712 @ while {[set line [getLine $difftxt $N ii]] ne "</pre>"} {
713 @ set len [string length [dehtml $line]]
714 @ if {$len > $widths($type)} {
715 @ set widths($type) $len
716 @ }
717 @ append str $line\n
@@ -693,12 +727,16 @@
727 @ } else {
728 @ $c insert end [dehtml $pre] -
729 @ }
730 @ }
731 @ }
732 @
733 @ if {$errMsg ne ""} {
734 @ foreach c {.txtA .txtB} {$c insert end [string trim $errMsg] err}
735 @ foreach c [cols] {$c insert end \n -}
736 @ }
737 @ }
 
738 @
739 @ foreach c [cols] {
740 @ set type [colType $c]
741 @ if {$type ne "txt"} {
742 @ $c config -width $widths($type)
@@ -797,12 +835,12 @@
835 @ bind . <q> exit
836 @ bind . <Destroy> {after 0 exit}
837 @ bind . <Tab> {cycleDiffs; break}
838 @ bind . <<PrevWindow>> {cycleDiffs 1; break}
839 @ bind . <Return> {
840 @ event generate .bb.files <1>
841 @ event generate .bb.files <ButtonRelease-1>
842 @ break
843 @ }
844 @ foreach {key axis args} {
845 @ Up y {scroll -5 units}
846 @ Down y {scroll 5 units}
@@ -815,21 +853,22 @@
853 @ } {
854 @ bind . <$key> "scroll-$axis $args; break"
855 @ bind . <Shift-$key> continue
856 @ }
857 @
858 @ frame .bb
859 @ ::ttk::menubutton .bb.files -text "Files"
860 @ toplevel .wfiles
861 @ wm withdraw .wfiles
862 @ update idletasks
863 @ wm transient .wfiles .
864 @ wm overrideredirect .wfiles 1
865 @ listbox .wfiles.lb -width 0 -height $CFG(LB_HEIGHT) -activestyle none \
866 @ -yscroll {.wfiles.sb set}
867 @ ::ttk::scrollbar .wfiles.sb -command {.wfiles.lb yview}
868 @ grid .wfiles.lb .wfiles.sb -sticky ns
869 @ bind .bb.files <1> {
870 @ set x [winfo rootx %W]
871 @ set y [expr {[winfo rooty %W]+[winfo height %W]}]
872 @ wm geometry .wfiles +$x+$y
873 @ wm deiconify .wfiles
874 @ focus .wfiles.lb
@@ -864,10 +903,11 @@
903 @ $txt tag config $tag -background $CFG([string toupper $tag]_BG)
904 @ $txt tag lower $tag
905 @ }
906 @ $txt tag config fn -background $CFG(FN_BG) -foreground $CFG(FN_FG) \
907 @ -justify center
908 @ $txt tag config err -foreground $CFG(ERR_FG)
909 @ }
910 @ text .mkr
911 @
912 @ foreach c [cols] {
913 @ set keyPrefix [string toupper [colType $c]]_COL_
@@ -890,22 +930,42 @@
930 @ tk_messageBox -type ok -title $CFG(TITLE) -message "No changes"
931 @ exit
932 @ }
933 @ update idletasks
934 @
935 @ proc saveDiff {} {
936 @ set fn [tk_getSaveFile]
937 @ set out [open $fn wb]
938 @ puts $out "#!/usr/bin/tclsh\n#\n# Run this script using 'tclsh' or 'wish'"
939 @ puts $out "# to see the graphical diff.\n#"
940 @ puts $out "set fossilcmd {}"
941 @ puts $out "set prog [list $::prog]"
942 @ puts $out "set difftxt \173"
943 @ foreach e $::difftxt {puts $out [list $e]}
944 @ puts $out "\175"
945 @ puts $out "eval \$prog"
946 @ close $out
947 @ }
948 @ ::ttk::button .bb.quit -text {Quit} -command exit
949 @ ::ttk::button .bb.save -text {Save As...} -command saveDiff
950 @ pack .bb.quit -side left
951 @ if {$fossilcmd!=""} {pack .bb.save -side left}
952 @ pack .bb.files -side left
953 @ grid rowconfigure . 1 -weight 1
954 @ grid columnconfigure . 1 -weight 1
955 @ grid columnconfigure . 4 -weight 1
956 @ grid .bb -row 0 -columnspan 6
957 @ eval grid [cols] -row 1 -sticky nsew
958 @ grid .sby -row 1 -column 5 -sticky ns
959 @ grid .sbxA -row 2 -columnspan 2 -sticky ew
960 @ grid .spacer -row 2 -column 2
961 @ grid .sbxB -row 2 -column 3 -columnspan 2 -sticky ew
962 @
963 @ .spacer config -height [winfo height .sbxA]
964 @ wm deiconify .
965 @ }
966 @ eval $prog
967 ;
968
969 /*
970 ** Show diff output in a Tcl/Tk window, in response to the --tk option
971 ** to the diff command.
@@ -1029,23 +1089,26 @@
1089 ** The "--binary" option causes files matching the glob PATTERN to be treated
1090 ** as binary when considering if they should be used with external diff program.
1091 ** This option overrides the "binary-glob" setting.
1092 **
1093 ** Options:
1094 ** --binary PATTERN Treat files that match the glob PATTERN as binary
1095 ** --branch BRANCH Show diff of all changes on BRANCH
1096 ** --brief Show filenames only
1097 ** --context|-c N Use N lines of context
1098 ** --diff-binary BOOL Include binary files when using external commands
1099 ** --from|-r VERSION select VERSION as source for the diff
1100 ** --internal|-i use internal diff logic
1101 ** --side-by-side|-y side-by-side diff
1102 ** --tk Launch a Tcl/Tk GUI for display
1103 ** --to VERSION select VERSION as target for the diff
1104 ** --unified unified diff
1105 ** -v|--verbose output complete text of added or deleted files
1106 ** -w|--ignore-all-space Ignore changes to start-of-line and end-of-line
1107 ** whitespace
1108 ** -W|--width Width of lines in side-by-side diff
1109 ** -Z|--ignore-trailing-space Ignore changes to end-of-line whitespace
1110 */
1111 void diff_cmd(void){
1112 int isGDiff; /* True for gdiff. False for normal diff */
1113 int isInternDiff; /* True for internal diff */
1114 int verboseFlag; /* True if -v or --verbose flag is used */
@@ -1071,11 +1134,10 @@
1134 verboseFlag = find_option("verbose","v",0)!=0;
1135 if( !verboseFlag ){
1136 verboseFlag = find_option("new-file","N",0)!=0; /* deprecated */
1137 }
1138 if( verboseFlag ) diffFlags |= DIFF_VERBOSE;
 
1139 if( zBranch ){
1140 if( zTo || zFrom ){
1141 fossil_fatal("cannot use --from or --to with --branch");
1142 }
1143 zTo = zBranch;
1144
+10 -10
--- src/event.c
+++ src/event.c
@@ -185,11 +185,11 @@
185185
blob_init(&comment, pEvent->zComment, -1);
186186
wiki_convert(&comment, 0, WIKI_INLINE);
187187
blob_reset(&comment);
188188
@ </div>
189189
@ </blockquote><hr />
190
- }
190
+ }
191191
192192
wiki_convert(&tail, 0, 0);
193193
style_footer();
194194
manifest_destroy(pEvent);
195195
}
@@ -227,11 +227,11 @@
227227
fossil_redirect_home();
228228
return;
229229
}
230230
}
231231
zTag = mprintf("event-%s", zEventId);
232
- rid = db_int(0,
232
+ rid = db_int(0,
233233
"SELECT rid FROM tagxref"
234234
" WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
235235
" ORDER BY mtime DESC", zTag
236236
);
237237
free(zTag);
@@ -312,11 +312,11 @@
312312
Stmt q;
313313
char *zBlob;
314314
315315
/* Load the tags string into a blob */
316316
blob_zero(&tags);
317
- blob_append(&tags, zTags, -1);
317
+ blob_append(&tags, zTags, -1);
318318
319319
/* Collapse all sequences of whitespace and "," characters into
320320
** a single space character */
321321
zBlob = blob_str(&tags);
322322
for(i=j=0; zBlob[i]; i++, j++){
@@ -341,13 +341,13 @@
341341
db_prepare(&q, "SELECT x FROM newtags ORDER BY x");
342342
while( db_step(&q)==SQLITE_ROW ){
343343
blob_appendf(&event, "T +sym-%F *\n", db_column_text(&q, 0));
344344
}
345345
db_finalize(&q);
346
- }
347
- if( g.zLogin ){
348
- blob_appendf(&event, "U %F\n", g.zLogin);
346
+ }
347
+ if( !login_is_nobody() ){
348
+ blob_appendf(&event, "U %F\n", login_name());
349349
}
350350
blob_appendf(&event, "W %d\n%s\n", strlen(zBody), zBody);
351351
md5sum_blob(&event, &cksum);
352352
blob_appendf(&event, "Z %b\n", &cksum);
353353
blob_reset(&cksum);
@@ -411,27 +411,27 @@
411411
@ <input type="text" name="t" size="25" value="%h(zETime)" />
412412
@ </td></tr>
413413
414414
@ <tr><th align="right" valign="top">Timeline&nbsp;Comment:</th>
415415
@ <td valign="top">
416
- @ <textarea name="c" class="eventedit" cols="80"
416
+ @ <textarea name="c" class="eventedit" cols="80"
417417
@ rows="3" wrap="virtual">%h(zComment)</textarea>
418418
@ </td></tr>
419419
420420
@ <tr><th align="right" valign="top">Background&nbsp;Color:</th>
421421
@ <td valign="top">
422422
render_color_chooser(0, zClr, 0, "clr", "cclr");
423423
@ </td></tr>
424
-
424
+
425425
@ <tr><th align="right" valign="top">Tags:</th>
426426
@ <td valign="top">
427427
@ <input type="text" name="g" size="40" value="%h(zTags)" />
428428
@ </td></tr>
429
-
429
+
430430
@ <tr><th align="right" valign="top">Page&nbsp;Content:</th>
431431
@ <td valign="top">
432
- @ <textarea name="w" class="eventedit" cols="80"
432
+ @ <textarea name="w" class="eventedit" cols="80"
433433
@ rows="%d(n)" wrap="virtual">%h(zBody)</textarea>
434434
@ </td></tr>
435435
436436
@ <tr><td colspan="2">
437437
@ <input type="submit" name="preview" value="Preview Your Changes" />
438438
--- src/event.c
+++ src/event.c
@@ -185,11 +185,11 @@
185 blob_init(&comment, pEvent->zComment, -1);
186 wiki_convert(&comment, 0, WIKI_INLINE);
187 blob_reset(&comment);
188 @ </div>
189 @ </blockquote><hr />
190 }
191
192 wiki_convert(&tail, 0, 0);
193 style_footer();
194 manifest_destroy(pEvent);
195 }
@@ -227,11 +227,11 @@
227 fossil_redirect_home();
228 return;
229 }
230 }
231 zTag = mprintf("event-%s", zEventId);
232 rid = db_int(0,
233 "SELECT rid FROM tagxref"
234 " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
235 " ORDER BY mtime DESC", zTag
236 );
237 free(zTag);
@@ -312,11 +312,11 @@
312 Stmt q;
313 char *zBlob;
314
315 /* Load the tags string into a blob */
316 blob_zero(&tags);
317 blob_append(&tags, zTags, -1);
318
319 /* Collapse all sequences of whitespace and "," characters into
320 ** a single space character */
321 zBlob = blob_str(&tags);
322 for(i=j=0; zBlob[i]; i++, j++){
@@ -341,13 +341,13 @@
341 db_prepare(&q, "SELECT x FROM newtags ORDER BY x");
342 while( db_step(&q)==SQLITE_ROW ){
343 blob_appendf(&event, "T +sym-%F *\n", db_column_text(&q, 0));
344 }
345 db_finalize(&q);
346 }
347 if( g.zLogin ){
348 blob_appendf(&event, "U %F\n", g.zLogin);
349 }
350 blob_appendf(&event, "W %d\n%s\n", strlen(zBody), zBody);
351 md5sum_blob(&event, &cksum);
352 blob_appendf(&event, "Z %b\n", &cksum);
353 blob_reset(&cksum);
@@ -411,27 +411,27 @@
411 @ <input type="text" name="t" size="25" value="%h(zETime)" />
412 @ </td></tr>
413
414 @ <tr><th align="right" valign="top">Timeline&nbsp;Comment:</th>
415 @ <td valign="top">
416 @ <textarea name="c" class="eventedit" cols="80"
417 @ rows="3" wrap="virtual">%h(zComment)</textarea>
418 @ </td></tr>
419
420 @ <tr><th align="right" valign="top">Background&nbsp;Color:</th>
421 @ <td valign="top">
422 render_color_chooser(0, zClr, 0, "clr", "cclr");
423 @ </td></tr>
424
425 @ <tr><th align="right" valign="top">Tags:</th>
426 @ <td valign="top">
427 @ <input type="text" name="g" size="40" value="%h(zTags)" />
428 @ </td></tr>
429
430 @ <tr><th align="right" valign="top">Page&nbsp;Content:</th>
431 @ <td valign="top">
432 @ <textarea name="w" class="eventedit" cols="80"
433 @ rows="%d(n)" wrap="virtual">%h(zBody)</textarea>
434 @ </td></tr>
435
436 @ <tr><td colspan="2">
437 @ <input type="submit" name="preview" value="Preview Your Changes" />
438
--- src/event.c
+++ src/event.c
@@ -185,11 +185,11 @@
185 blob_init(&comment, pEvent->zComment, -1);
186 wiki_convert(&comment, 0, WIKI_INLINE);
187 blob_reset(&comment);
188 @ </div>
189 @ </blockquote><hr />
190 }
191
192 wiki_convert(&tail, 0, 0);
193 style_footer();
194 manifest_destroy(pEvent);
195 }
@@ -227,11 +227,11 @@
227 fossil_redirect_home();
228 return;
229 }
230 }
231 zTag = mprintf("event-%s", zEventId);
232 rid = db_int(0,
233 "SELECT rid FROM tagxref"
234 " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)"
235 " ORDER BY mtime DESC", zTag
236 );
237 free(zTag);
@@ -312,11 +312,11 @@
312 Stmt q;
313 char *zBlob;
314
315 /* Load the tags string into a blob */
316 blob_zero(&tags);
317 blob_append(&tags, zTags, -1);
318
319 /* Collapse all sequences of whitespace and "," characters into
320 ** a single space character */
321 zBlob = blob_str(&tags);
322 for(i=j=0; zBlob[i]; i++, j++){
@@ -341,13 +341,13 @@
341 db_prepare(&q, "SELECT x FROM newtags ORDER BY x");
342 while( db_step(&q)==SQLITE_ROW ){
343 blob_appendf(&event, "T +sym-%F *\n", db_column_text(&q, 0));
344 }
345 db_finalize(&q);
346 }
347 if( !login_is_nobody() ){
348 blob_appendf(&event, "U %F\n", login_name());
349 }
350 blob_appendf(&event, "W %d\n%s\n", strlen(zBody), zBody);
351 md5sum_blob(&event, &cksum);
352 blob_appendf(&event, "Z %b\n", &cksum);
353 blob_reset(&cksum);
@@ -411,27 +411,27 @@
411 @ <input type="text" name="t" size="25" value="%h(zETime)" />
412 @ </td></tr>
413
414 @ <tr><th align="right" valign="top">Timeline&nbsp;Comment:</th>
415 @ <td valign="top">
416 @ <textarea name="c" class="eventedit" cols="80"
417 @ rows="3" wrap="virtual">%h(zComment)</textarea>
418 @ </td></tr>
419
420 @ <tr><th align="right" valign="top">Background&nbsp;Color:</th>
421 @ <td valign="top">
422 render_color_chooser(0, zClr, 0, "clr", "cclr");
423 @ </td></tr>
424
425 @ <tr><th align="right" valign="top">Tags:</th>
426 @ <td valign="top">
427 @ <input type="text" name="g" size="40" value="%h(zTags)" />
428 @ </td></tr>
429
430 @ <tr><th align="right" valign="top">Page&nbsp;Content:</th>
431 @ <td valign="top">
432 @ <textarea name="w" class="eventedit" cols="80"
433 @ rows="%d(n)" wrap="virtual">%h(zBody)</textarea>
434 @ </td></tr>
435
436 @ <tr><td colspan="2">
437 @ <input type="submit" name="preview" value="Preview Your Changes" />
438
+68 -5
--- src/file.c
+++ src/file.c
@@ -393,18 +393,35 @@
393393
FILE *in, *out;
394394
int got;
395395
char zBuf[8192];
396396
in = fossil_fopen(zFrom, "rb");
397397
if( in==0 ) fossil_fatal("cannot open \"%s\" for reading", zFrom);
398
+ file_mkfolder(zTo, 0);
398399
out = fossil_fopen(zTo, "wb");
399400
if( out==0 ) fossil_fatal("cannot open \"%s\" for writing", zTo);
400401
while( (got=fread(zBuf, 1, sizeof(zBuf), in))>0 ){
401402
fwrite(zBuf, 1, got, out);
402403
}
403404
fclose(in);
404405
fclose(out);
405406
}
407
+
408
+/*
409
+** COMMAND: test-file-copy
410
+**
411
+** Usage: %fossil test-file-copy SOURCE DESTINATION
412
+**
413
+** Make a copy of the file at SOURCE into a new name DESTINATION. Any
414
+** directories in the path leading up to DESTINATION that do not already
415
+** exist are created automatically.
416
+*/
417
+void test_file_copy(void){
418
+ if( g.argc!=4 ){
419
+ fossil_fatal("Usage: %s test-file-copy SOURCE DESTINATION", g.argv[0]);
420
+ }
421
+ file_copy(g.argv[2], g.argv[3]);
422
+}
406423
407424
/*
408425
** Set or clear the execute bit on a file. Return true if a change
409426
** occurred and false if this routine is a no-op.
410427
*/
@@ -516,10 +533,45 @@
516533
fossil_filename_free(zMbcs);
517534
return rc;
518535
}
519536
return 0;
520537
}
538
+
539
+/*
540
+** Create the tree of directories in which zFilename belongs, if that sequence
541
+** of directories does not already exist.
542
+*/
543
+void file_mkfolder(const char *zFilename, int forceFlag){
544
+ int i, nName;
545
+ char *zName;
546
+
547
+ nName = strlen(zFilename);
548
+ zName = mprintf("%s", zFilename);
549
+ nName = file_simplify_name(zName, nName, 0);
550
+ for(i=1; i<nName; i++){
551
+ if( zName[i]=='/' ){
552
+ zName[i] = 0;
553
+#if defined(_WIN32) || defined(__CYGWIN__)
554
+ /*
555
+ ** On Windows, local path looks like: C:/develop/project/file.txt
556
+ ** The if stops us from trying to create a directory of a drive letter
557
+ ** C: in this example.
558
+ */
559
+ if( !(i==2 && zName[1]==':') ){
560
+#endif
561
+ if( file_mkdir(zName, forceFlag) && file_isdir(zName)!=1 ){
562
+ fossil_fatal_recursive("unable to create directory %s", zName);
563
+ return;
564
+ }
565
+#if defined(_WIN32) || defined(__CYGWIN__)
566
+ }
567
+#endif
568
+ zName[i] = '/';
569
+ }
570
+ }
571
+ free(zName);
572
+}
521573
522574
/*
523575
** Removes the directory named in the argument, if it exists. The directory
524576
** must be empty and cannot be the current directory or the root directory.
525577
**
@@ -644,10 +696,11 @@
644696
}
645697
646698
/*
647699
** Simplify a filename by
648700
**
701
+** * Remove extended path prefix on windows and cygwin
649702
** * Convert all \ into / on windows and cygwin
650703
** * removing any trailing and duplicate /
651704
** * removing /./
652705
** * removing /A/../
653706
**
@@ -654,17 +707,27 @@
654707
** Changes are made in-place. Return the new name length.
655708
** If the slash parameter is non-zero, the trailing slash, if any,
656709
** is retained.
657710
*/
658711
int file_simplify_name(char *z, int n, int slash){
659
- int i, j;
712
+ int i = 1, j;
660713
if( n<0 ) n = strlen(z);
661714
662
- /* On windows and cygwin convert all \ characters to / */
715
+ /* On windows and cygwin convert all \ characters to /
716
+ * and remove extended path prefix if present */
663717
#if defined(_WIN32) || defined(__CYGWIN__)
664
- for(i=0; i<n; i++){
665
- if( z[i]=='\\' ) z[i] = '/';
718
+ for(j=0; j<n; j++){
719
+ if( z[j]=='\\' ) z[j] = '/';
720
+ }
721
+ if( n>3 && !memcmp(z, "//?/", 4) ){
722
+ if( fossil_strnicmp(z+4,"UNC", 3) ){
723
+ i += 4;
724
+ z[0] = z[4];
725
+ }else{
726
+ i += 6;
727
+ z[0] = '/';
728
+ }
666729
}
667730
#endif
668731
669732
/* Removing trailing "/" characters */
670733
if( !slash ){
@@ -671,11 +734,11 @@
671734
while( n>1 && z[n-1]=='/' ){ n--; }
672735
}
673736
674737
/* Remove duplicate '/' characters. Except, two // at the beginning
675738
** of a pathname is allowed since this is important on windows. */
676
- for(i=j=1; i<n; i++){
739
+ for(j=1; i<n; i++){
677740
z[j++] = z[i];
678741
while( z[i]=='/' && i<n-1 && z[i+1]=='/' ) i++;
679742
}
680743
n = j;
681744
682745
--- src/file.c
+++ src/file.c
@@ -393,18 +393,35 @@
393 FILE *in, *out;
394 int got;
395 char zBuf[8192];
396 in = fossil_fopen(zFrom, "rb");
397 if( in==0 ) fossil_fatal("cannot open \"%s\" for reading", zFrom);
 
398 out = fossil_fopen(zTo, "wb");
399 if( out==0 ) fossil_fatal("cannot open \"%s\" for writing", zTo);
400 while( (got=fread(zBuf, 1, sizeof(zBuf), in))>0 ){
401 fwrite(zBuf, 1, got, out);
402 }
403 fclose(in);
404 fclose(out);
405 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
406
407 /*
408 ** Set or clear the execute bit on a file. Return true if a change
409 ** occurred and false if this routine is a no-op.
410 */
@@ -516,10 +533,45 @@
516 fossil_filename_free(zMbcs);
517 return rc;
518 }
519 return 0;
520 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
521
522 /*
523 ** Removes the directory named in the argument, if it exists. The directory
524 ** must be empty and cannot be the current directory or the root directory.
525 **
@@ -644,10 +696,11 @@
644 }
645
646 /*
647 ** Simplify a filename by
648 **
 
649 ** * Convert all \ into / on windows and cygwin
650 ** * removing any trailing and duplicate /
651 ** * removing /./
652 ** * removing /A/../
653 **
@@ -654,17 +707,27 @@
654 ** Changes are made in-place. Return the new name length.
655 ** If the slash parameter is non-zero, the trailing slash, if any,
656 ** is retained.
657 */
658 int file_simplify_name(char *z, int n, int slash){
659 int i, j;
660 if( n<0 ) n = strlen(z);
661
662 /* On windows and cygwin convert all \ characters to / */
 
663 #if defined(_WIN32) || defined(__CYGWIN__)
664 for(i=0; i<n; i++){
665 if( z[i]=='\\' ) z[i] = '/';
 
 
 
 
 
 
 
 
 
666 }
667 #endif
668
669 /* Removing trailing "/" characters */
670 if( !slash ){
@@ -671,11 +734,11 @@
671 while( n>1 && z[n-1]=='/' ){ n--; }
672 }
673
674 /* Remove duplicate '/' characters. Except, two // at the beginning
675 ** of a pathname is allowed since this is important on windows. */
676 for(i=j=1; i<n; i++){
677 z[j++] = z[i];
678 while( z[i]=='/' && i<n-1 && z[i+1]=='/' ) i++;
679 }
680 n = j;
681
682
--- src/file.c
+++ src/file.c
@@ -393,18 +393,35 @@
393 FILE *in, *out;
394 int got;
395 char zBuf[8192];
396 in = fossil_fopen(zFrom, "rb");
397 if( in==0 ) fossil_fatal("cannot open \"%s\" for reading", zFrom);
398 file_mkfolder(zTo, 0);
399 out = fossil_fopen(zTo, "wb");
400 if( out==0 ) fossil_fatal("cannot open \"%s\" for writing", zTo);
401 while( (got=fread(zBuf, 1, sizeof(zBuf), in))>0 ){
402 fwrite(zBuf, 1, got, out);
403 }
404 fclose(in);
405 fclose(out);
406 }
407
408 /*
409 ** COMMAND: test-file-copy
410 **
411 ** Usage: %fossil test-file-copy SOURCE DESTINATION
412 **
413 ** Make a copy of the file at SOURCE into a new name DESTINATION. Any
414 ** directories in the path leading up to DESTINATION that do not already
415 ** exist are created automatically.
416 */
417 void test_file_copy(void){
418 if( g.argc!=4 ){
419 fossil_fatal("Usage: %s test-file-copy SOURCE DESTINATION", g.argv[0]);
420 }
421 file_copy(g.argv[2], g.argv[3]);
422 }
423
424 /*
425 ** Set or clear the execute bit on a file. Return true if a change
426 ** occurred and false if this routine is a no-op.
427 */
@@ -516,10 +533,45 @@
533 fossil_filename_free(zMbcs);
534 return rc;
535 }
536 return 0;
537 }
538
539 /*
540 ** Create the tree of directories in which zFilename belongs, if that sequence
541 ** of directories does not already exist.
542 */
543 void file_mkfolder(const char *zFilename, int forceFlag){
544 int i, nName;
545 char *zName;
546
547 nName = strlen(zFilename);
548 zName = mprintf("%s", zFilename);
549 nName = file_simplify_name(zName, nName, 0);
550 for(i=1; i<nName; i++){
551 if( zName[i]=='/' ){
552 zName[i] = 0;
553 #if defined(_WIN32) || defined(__CYGWIN__)
554 /*
555 ** On Windows, local path looks like: C:/develop/project/file.txt
556 ** The if stops us from trying to create a directory of a drive letter
557 ** C: in this example.
558 */
559 if( !(i==2 && zName[1]==':') ){
560 #endif
561 if( file_mkdir(zName, forceFlag) && file_isdir(zName)!=1 ){
562 fossil_fatal_recursive("unable to create directory %s", zName);
563 return;
564 }
565 #if defined(_WIN32) || defined(__CYGWIN__)
566 }
567 #endif
568 zName[i] = '/';
569 }
570 }
571 free(zName);
572 }
573
574 /*
575 ** Removes the directory named in the argument, if it exists. The directory
576 ** must be empty and cannot be the current directory or the root directory.
577 **
@@ -644,10 +696,11 @@
696 }
697
698 /*
699 ** Simplify a filename by
700 **
701 ** * Remove extended path prefix on windows and cygwin
702 ** * Convert all \ into / on windows and cygwin
703 ** * removing any trailing and duplicate /
704 ** * removing /./
705 ** * removing /A/../
706 **
@@ -654,17 +707,27 @@
707 ** Changes are made in-place. Return the new name length.
708 ** If the slash parameter is non-zero, the trailing slash, if any,
709 ** is retained.
710 */
711 int file_simplify_name(char *z, int n, int slash){
712 int i = 1, j;
713 if( n<0 ) n = strlen(z);
714
715 /* On windows and cygwin convert all \ characters to /
716 * and remove extended path prefix if present */
717 #if defined(_WIN32) || defined(__CYGWIN__)
718 for(j=0; j<n; j++){
719 if( z[j]=='\\' ) z[j] = '/';
720 }
721 if( n>3 && !memcmp(z, "//?/", 4) ){
722 if( fossil_strnicmp(z+4,"UNC", 3) ){
723 i += 4;
724 z[0] = z[4];
725 }else{
726 i += 6;
727 z[0] = '/';
728 }
729 }
730 #endif
731
732 /* Removing trailing "/" characters */
733 if( !slash ){
@@ -671,11 +734,11 @@
734 while( n>1 && z[n-1]=='/' ){ n--; }
735 }
736
737 /* Remove duplicate '/' characters. Except, two // at the beginning
738 ** of a pathname is allowed since this is important on windows. */
739 for(j=1; i<n; i++){
740 z[j++] = z[i];
741 while( z[i]=='/' && i<n-1 && z[i+1]=='/' ) i++;
742 }
743 n = j;
744
745
+92 -9
--- src/http.c
+++ src/http.c
@@ -19,10 +19,26 @@
1919
*/
2020
#include "config.h"
2121
#include "http.h"
2222
#include <assert.h>
2323
24
+#ifdef _WIN32
25
+#include <io.h>
26
+#ifndef isatty
27
+#define isatty(d) _isatty(d)
28
+#endif
29
+#ifndef fileno
30
+#define fileno(s) _fileno(s)
31
+#endif
32
+#endif
33
+
34
+/* Maximum number of HTTP Authorization attempts */
35
+#define MAX_HTTP_AUTH 2
36
+
37
+/* Keep track of HTTP Basic Authorization failures */
38
+static int fSeenHttpAuth = 0;
39
+
2440
/*
2541
** Construct the "login" card with the client credentials.
2642
**
2743
** login LOGIN NONCE SIGNATURE
2844
**
@@ -62,16 +78,10 @@
6278
/* Password failure while doing a sync from the command-line interface */
6379
url_prompt_for_password();
6480
zPw = g.urlPasswd;
6581
}
6682
67
- /* If the first character of the password is "#", then that character is
68
- ** not really part of the password - it is an indicator that we should
69
- ** use Basic Authentication. So skip that character.
70
- */
71
- if( zPw && zPw[0]=='#' ) zPw++;
72
-
7383
/* The login card wants the SHA1 hash of the password, so convert the
7484
** password to its SHA1 hash it it isn't already a SHA1 hash.
7585
*/
7686
/* fossil_print("\nzPw=[%s]\n", zPw); // TESTING ONLY */
7787
if( zPw && zPw[0] ) zPw = sha1_shared_secret(zPw, zLogin, 0);
@@ -102,16 +112,15 @@
102112
}
103113
blob_appendf(pHdr, "POST %s%sxfer/xfer HTTP/1.0\r\n", g.urlPath, zSep);
104114
if( g.urlProxyAuth ){
105115
blob_appendf(pHdr, "Proxy-Authorization: %s\r\n", g.urlProxyAuth);
106116
}
107
- if( g.urlPasswd && g.urlUser && g.urlPasswd[0]=='#' ){
108
- char *zCredentials = mprintf("%s:%s", g.urlUser, &g.urlPasswd[1]);
117
+ if( g.zHttpAuth && g.zHttpAuth[0] ){
118
+ const char *zCredentials = g.zHttpAuth;
109119
char *zEncoded = encode64(zCredentials, -1);
110120
blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded);
111121
fossil_free(zEncoded);
112
- fossil_free(zCredentials);
113122
}
114123
blob_appendf(pHdr, "Host: %s\r\n", g.urlHostname);
115124
blob_appendf(pHdr, "User-Agent: %s\r\n", get_user_agent());
116125
if( g.urlIsSsh ) blob_appendf(pHdr, "X-Fossil-Transport: SSH\r\n");
117126
if( g.fHttpTrace ){
@@ -119,10 +128,71 @@
119128
}else{
120129
blob_appendf(pHdr, "Content-Type: application/x-fossil\r\n");
121130
}
122131
blob_appendf(pHdr, "Content-Length: %d\r\n\r\n", blob_size(pPayload));
123132
}
133
+
134
+/*
135
+** Use Fossil credentials for HTTP Basic Authorization prompt
136
+*/
137
+static int use_fossil_creds_for_httpauth_prompt(void){
138
+ Blob x;
139
+ char c;
140
+ prompt_user("Use Fossil username and password (y/N)? ", &x);
141
+ c = blob_str(&x)[0];
142
+ blob_reset(&x);
143
+ return ( c=='y' || c=='Y' );
144
+}
145
+
146
+/*
147
+** Prompt to save HTTP Basic Authorization information
148
+*/
149
+static int save_httpauth_prompt(void){
150
+ Blob x;
151
+ char c;
152
+ if( (g.urlFlags & URL_REMEMBER)==0 ) return;
153
+ prompt_user("Remember Basic Authorization credentials (Y/n)? ", &x);
154
+ c = blob_str(&x)[0];
155
+ blob_reset(&x);
156
+ return ( c!='n' && c!='N' );
157
+}
158
+
159
+/*
160
+** Get the HTTP Basic Authorization credentials from the user
161
+** when 401 is received.
162
+*/
163
+char *prompt_for_httpauth_creds(void){
164
+ Blob x;
165
+ char *zUser;
166
+ char *zPw;
167
+ char *zPrompt;
168
+ char *zHttpAuth = 0;
169
+ if( !isatty(fileno(stdin)) ) return 0;
170
+ zPrompt = mprintf("\n%s authorization required by\n%s\n",
171
+ g.urlIsHttps==1 ? "Encrypted HTTPS" : "Unencrypted HTTP", g.urlCanonical);
172
+ fossil_print(zPrompt);
173
+ free(zPrompt);
174
+ if ( g.urlUser && g.urlPasswd && use_fossil_creds_for_httpauth_prompt() ){
175
+ zHttpAuth = mprintf("%s:%s", g.urlUser, g.urlPasswd);
176
+ }else{
177
+ prompt_user("Basic Authorization user: ", &x);
178
+ zUser = mprintf("%b", &x);
179
+ zPrompt = mprintf("HTTP password for %b: ", &x);
180
+ blob_reset(&x);
181
+ prompt_for_password(zPrompt, &x, 1);
182
+ zPw = mprintf("%b", &x);
183
+ zHttpAuth = mprintf("%s:%s", zUser, zPw);
184
+ free(zUser);
185
+ free(zPw);
186
+ free(zPrompt);
187
+ blob_reset(&x);
188
+ }
189
+ if( save_httpauth_prompt() ){
190
+ set_httpauth(zHttpAuth);
191
+ }
192
+ return zHttpAuth;
193
+}
124194
125195
/*
126196
** Sign the content in pSend, compress it, and send it to the server
127197
** via HTTP or HTTPS. Get a reply, uncompress the reply, and store the reply
128198
** in pRecv. pRecv is assumed to be uninitialized when
@@ -205,10 +275,20 @@
205275
iLength = -1;
206276
while( (zLine = transport_receive_line(GLOBAL_URL()))!=0 && zLine[0]!=0 ){
207277
/* printf("[%s]\n", zLine); fflush(stdout); */
208278
if( fossil_strnicmp(zLine, "http/1.", 7)==0 ){
209279
if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err;
280
+ if( rc==401 ){
281
+ if( fSeenHttpAuth++ < MAX_HTTP_AUTH ){
282
+ if( g.zHttpAuth ){
283
+ if( g.zHttpAuth ) free(g.zHttpAuth);
284
+ }
285
+ g.zHttpAuth = prompt_for_httpauth_creds();
286
+ transport_close(GLOBAL_URL());
287
+ return http_exchange(pSend, pReply, useLogin, maxRedirect);
288
+ }
289
+ }
210290
if( rc!=200 && rc!=302 ){
211291
int ii;
212292
for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
213293
while( zLine[ii]==' ' ) ii++;
214294
fossil_warning("server says: %s", &zLine[ii]);
@@ -254,10 +334,13 @@
254334
j -= 4;
255335
zLine[j] = 0;
256336
}
257337
fossil_print("redirect to %s\n", &zLine[i]);
258338
url_parse(&zLine[i], 0);
339
+ fSeenHttpAuth = 0;
340
+ if( g.zHttpAuth ) free(g.zHttpAuth);
341
+ g.zHttpAuth = get_httpauth();
259342
transport_close(GLOBAL_URL());
260343
return http_exchange(pSend, pReply, useLogin, maxRedirect);
261344
}else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){
262345
if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){
263346
isCompressed = 0;
264347
--- src/http.c
+++ src/http.c
@@ -19,10 +19,26 @@
19 */
20 #include "config.h"
21 #include "http.h"
22 #include <assert.h>
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24 /*
25 ** Construct the "login" card with the client credentials.
26 **
27 ** login LOGIN NONCE SIGNATURE
28 **
@@ -62,16 +78,10 @@
62 /* Password failure while doing a sync from the command-line interface */
63 url_prompt_for_password();
64 zPw = g.urlPasswd;
65 }
66
67 /* If the first character of the password is "#", then that character is
68 ** not really part of the password - it is an indicator that we should
69 ** use Basic Authentication. So skip that character.
70 */
71 if( zPw && zPw[0]=='#' ) zPw++;
72
73 /* The login card wants the SHA1 hash of the password, so convert the
74 ** password to its SHA1 hash it it isn't already a SHA1 hash.
75 */
76 /* fossil_print("\nzPw=[%s]\n", zPw); // TESTING ONLY */
77 if( zPw && zPw[0] ) zPw = sha1_shared_secret(zPw, zLogin, 0);
@@ -102,16 +112,15 @@
102 }
103 blob_appendf(pHdr, "POST %s%sxfer/xfer HTTP/1.0\r\n", g.urlPath, zSep);
104 if( g.urlProxyAuth ){
105 blob_appendf(pHdr, "Proxy-Authorization: %s\r\n", g.urlProxyAuth);
106 }
107 if( g.urlPasswd && g.urlUser && g.urlPasswd[0]=='#' ){
108 char *zCredentials = mprintf("%s:%s", g.urlUser, &g.urlPasswd[1]);
109 char *zEncoded = encode64(zCredentials, -1);
110 blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded);
111 fossil_free(zEncoded);
112 fossil_free(zCredentials);
113 }
114 blob_appendf(pHdr, "Host: %s\r\n", g.urlHostname);
115 blob_appendf(pHdr, "User-Agent: %s\r\n", get_user_agent());
116 if( g.urlIsSsh ) blob_appendf(pHdr, "X-Fossil-Transport: SSH\r\n");
117 if( g.fHttpTrace ){
@@ -119,10 +128,71 @@
119 }else{
120 blob_appendf(pHdr, "Content-Type: application/x-fossil\r\n");
121 }
122 blob_appendf(pHdr, "Content-Length: %d\r\n\r\n", blob_size(pPayload));
123 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
125 /*
126 ** Sign the content in pSend, compress it, and send it to the server
127 ** via HTTP or HTTPS. Get a reply, uncompress the reply, and store the reply
128 ** in pRecv. pRecv is assumed to be uninitialized when
@@ -205,10 +275,20 @@
205 iLength = -1;
206 while( (zLine = transport_receive_line(GLOBAL_URL()))!=0 && zLine[0]!=0 ){
207 /* printf("[%s]\n", zLine); fflush(stdout); */
208 if( fossil_strnicmp(zLine, "http/1.", 7)==0 ){
209 if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err;
 
 
 
 
 
 
 
 
 
 
210 if( rc!=200 && rc!=302 ){
211 int ii;
212 for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
213 while( zLine[ii]==' ' ) ii++;
214 fossil_warning("server says: %s", &zLine[ii]);
@@ -254,10 +334,13 @@
254 j -= 4;
255 zLine[j] = 0;
256 }
257 fossil_print("redirect to %s\n", &zLine[i]);
258 url_parse(&zLine[i], 0);
 
 
 
259 transport_close(GLOBAL_URL());
260 return http_exchange(pSend, pReply, useLogin, maxRedirect);
261 }else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){
262 if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){
263 isCompressed = 0;
264
--- src/http.c
+++ src/http.c
@@ -19,10 +19,26 @@
19 */
20 #include "config.h"
21 #include "http.h"
22 #include <assert.h>
23
24 #ifdef _WIN32
25 #include <io.h>
26 #ifndef isatty
27 #define isatty(d) _isatty(d)
28 #endif
29 #ifndef fileno
30 #define fileno(s) _fileno(s)
31 #endif
32 #endif
33
34 /* Maximum number of HTTP Authorization attempts */
35 #define MAX_HTTP_AUTH 2
36
37 /* Keep track of HTTP Basic Authorization failures */
38 static int fSeenHttpAuth = 0;
39
40 /*
41 ** Construct the "login" card with the client credentials.
42 **
43 ** login LOGIN NONCE SIGNATURE
44 **
@@ -62,16 +78,10 @@
78 /* Password failure while doing a sync from the command-line interface */
79 url_prompt_for_password();
80 zPw = g.urlPasswd;
81 }
82
 
 
 
 
 
 
83 /* The login card wants the SHA1 hash of the password, so convert the
84 ** password to its SHA1 hash it it isn't already a SHA1 hash.
85 */
86 /* fossil_print("\nzPw=[%s]\n", zPw); // TESTING ONLY */
87 if( zPw && zPw[0] ) zPw = sha1_shared_secret(zPw, zLogin, 0);
@@ -102,16 +112,15 @@
112 }
113 blob_appendf(pHdr, "POST %s%sxfer/xfer HTTP/1.0\r\n", g.urlPath, zSep);
114 if( g.urlProxyAuth ){
115 blob_appendf(pHdr, "Proxy-Authorization: %s\r\n", g.urlProxyAuth);
116 }
117 if( g.zHttpAuth && g.zHttpAuth[0] ){
118 const char *zCredentials = g.zHttpAuth;
119 char *zEncoded = encode64(zCredentials, -1);
120 blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded);
121 fossil_free(zEncoded);
 
122 }
123 blob_appendf(pHdr, "Host: %s\r\n", g.urlHostname);
124 blob_appendf(pHdr, "User-Agent: %s\r\n", get_user_agent());
125 if( g.urlIsSsh ) blob_appendf(pHdr, "X-Fossil-Transport: SSH\r\n");
126 if( g.fHttpTrace ){
@@ -119,10 +128,71 @@
128 }else{
129 blob_appendf(pHdr, "Content-Type: application/x-fossil\r\n");
130 }
131 blob_appendf(pHdr, "Content-Length: %d\r\n\r\n", blob_size(pPayload));
132 }
133
134 /*
135 ** Use Fossil credentials for HTTP Basic Authorization prompt
136 */
137 static int use_fossil_creds_for_httpauth_prompt(void){
138 Blob x;
139 char c;
140 prompt_user("Use Fossil username and password (y/N)? ", &x);
141 c = blob_str(&x)[0];
142 blob_reset(&x);
143 return ( c=='y' || c=='Y' );
144 }
145
146 /*
147 ** Prompt to save HTTP Basic Authorization information
148 */
149 static int save_httpauth_prompt(void){
150 Blob x;
151 char c;
152 if( (g.urlFlags & URL_REMEMBER)==0 ) return;
153 prompt_user("Remember Basic Authorization credentials (Y/n)? ", &x);
154 c = blob_str(&x)[0];
155 blob_reset(&x);
156 return ( c!='n' && c!='N' );
157 }
158
159 /*
160 ** Get the HTTP Basic Authorization credentials from the user
161 ** when 401 is received.
162 */
163 char *prompt_for_httpauth_creds(void){
164 Blob x;
165 char *zUser;
166 char *zPw;
167 char *zPrompt;
168 char *zHttpAuth = 0;
169 if( !isatty(fileno(stdin)) ) return 0;
170 zPrompt = mprintf("\n%s authorization required by\n%s\n",
171 g.urlIsHttps==1 ? "Encrypted HTTPS" : "Unencrypted HTTP", g.urlCanonical);
172 fossil_print(zPrompt);
173 free(zPrompt);
174 if ( g.urlUser && g.urlPasswd && use_fossil_creds_for_httpauth_prompt() ){
175 zHttpAuth = mprintf("%s:%s", g.urlUser, g.urlPasswd);
176 }else{
177 prompt_user("Basic Authorization user: ", &x);
178 zUser = mprintf("%b", &x);
179 zPrompt = mprintf("HTTP password for %b: ", &x);
180 blob_reset(&x);
181 prompt_for_password(zPrompt, &x, 1);
182 zPw = mprintf("%b", &x);
183 zHttpAuth = mprintf("%s:%s", zUser, zPw);
184 free(zUser);
185 free(zPw);
186 free(zPrompt);
187 blob_reset(&x);
188 }
189 if( save_httpauth_prompt() ){
190 set_httpauth(zHttpAuth);
191 }
192 return zHttpAuth;
193 }
194
195 /*
196 ** Sign the content in pSend, compress it, and send it to the server
197 ** via HTTP or HTTPS. Get a reply, uncompress the reply, and store the reply
198 ** in pRecv. pRecv is assumed to be uninitialized when
@@ -205,10 +275,20 @@
275 iLength = -1;
276 while( (zLine = transport_receive_line(GLOBAL_URL()))!=0 && zLine[0]!=0 ){
277 /* printf("[%s]\n", zLine); fflush(stdout); */
278 if( fossil_strnicmp(zLine, "http/1.", 7)==0 ){
279 if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err;
280 if( rc==401 ){
281 if( fSeenHttpAuth++ < MAX_HTTP_AUTH ){
282 if( g.zHttpAuth ){
283 if( g.zHttpAuth ) free(g.zHttpAuth);
284 }
285 g.zHttpAuth = prompt_for_httpauth_creds();
286 transport_close(GLOBAL_URL());
287 return http_exchange(pSend, pReply, useLogin, maxRedirect);
288 }
289 }
290 if( rc!=200 && rc!=302 ){
291 int ii;
292 for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){}
293 while( zLine[ii]==' ' ) ii++;
294 fossil_warning("server says: %s", &zLine[ii]);
@@ -254,10 +334,13 @@
334 j -= 4;
335 zLine[j] = 0;
336 }
337 fossil_print("redirect to %s\n", &zLine[i]);
338 url_parse(&zLine[i], 0);
339 fSeenHttpAuth = 0;
340 if( g.zHttpAuth ) free(g.zHttpAuth);
341 g.zHttpAuth = get_httpauth();
342 transport_close(GLOBAL_URL());
343 return http_exchange(pSend, pReply, useLogin, maxRedirect);
344 }else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){
345 if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){
346 isCompressed = 0;
347
+117 -91
--- src/info.c
+++ src/info.c
@@ -449,20 +449,23 @@
449449
if( verboseFlag==0 ){
450450
diffFlags = 0; /* Zero means do not show any diff */
451451
}else{
452452
int x;
453453
if( sideBySide ){
454
- diffFlags = DIFF_SIDEBYSIDE | DIFF_IGNORE_EOLWS;
454
+ diffFlags = DIFF_SIDEBYSIDE;
455455
456456
/* "dw" query parameter determines width of each column */
457457
x = atoi(PD("dw","80"))*(DIFF_CONTEXT_MASK+1);
458458
if( x<0 || x>DIFF_WIDTH_MASK ) x = DIFF_WIDTH_MASK;
459459
diffFlags += x;
460460
}else{
461
- diffFlags = DIFF_INLINE | DIFF_IGNORE_EOLWS;
461
+ diffFlags = DIFF_INLINE;
462462
}
463463
464
+ if( P("w") ){
465
+ diffFlags |= DIFF_IGNORE_ALLWS;
466
+ }
464467
/* "dc" query parameter determines lines of context */
465468
x = atoi(PD("dc","7"));
466469
if( x<0 || x>DIFF_CONTEXT_MASK ) x = DIFF_CONTEXT_MASK;
467470
diffFlags += x;
468471
@@ -469,11 +472,10 @@
469472
/* The "noopt" parameter disables diff optimization */
470473
if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT;
471474
}
472475
return diffFlags;
473476
}
474
-
475477
476478
/*
477479
** WEBPAGE: vinfo
478480
** WEBPAGE: ci
479481
** URL: /ci?name=RID|ARTIFACTID
@@ -498,10 +500,13 @@
498500
const char *zName; /* Name of the checkin to be displayed */
499501
const char *zUuid; /* UUID of zName */
500502
const char *zParent; /* UUID of the parent checkin (if any) */
501503
const char *zRe; /* regex parameter */
502504
ReCompiled *pRe = 0; /* regex */
505
+ const char *zW; /* URL param for ignoring whitespace */
506
+ const char *zPage = "vinfo"; /* Page that shows diffs */
507
+ const char *zPageHide = "ci"; /* Page that hides diffs */
503508
504509
login_check_credentials();
505510
if( !g.perm.Read ){ login_needed(); return; }
506511
zName = P("name");
507512
rid = name_to_rid_www("name");
@@ -663,79 +668,74 @@
663668
style_header("Check-in Information");
664669
login_anonymous_available();
665670
}
666671
db_finalize(&q1);
667672
showTags(rid, "");
668
- if( zParent ){
669
- @ <div class="section">Changes</div>
670
- @ <div class="sectionmenu">
671
- verboseFlag = g.zPath[0]!='c';
672
- if( db_get_boolean("show-version-diffs", 0)==0 ){
673
- verboseFlag = !verboseFlag;
674
- if( verboseFlag ){
675
- @ %z(xhref("class='button'","%R/vinfo/%T",zName))
676
- @ hide&nbsp;diffs</a>
677
- if( sideBySide ){
678
- @ %z(xhref("class='button'","%R/ci/%T?sbs=0",zName))
679
- @ unified&nbsp;diffs</a>
680
- }else{
681
- @ %z(xhref("class='button'","%R/ci/%T?sbs=1",zName))
682
- @ side-by-side&nbsp;diffs</a>
683
- }
684
- }else{
685
- @ %z(xhref("class='button'","%R/ci/%T?sbs=0",zName))
686
- @ show&nbsp;unified&nbsp;diffs</a>
687
- @ %z(xhref("class='button'","%R/ci/%T?sbs=1",zName))
688
- @ show&nbsp;side-by-side&nbsp;diffs</a>
689
- }
690
- }else{
691
- if( verboseFlag ){
692
- @ %z(xhref("class='button'","%R/ci/%T",zName))hide&nbsp;diffs</a>
693
- if( sideBySide ){
694
- @ %z(xhref("class='button'","%R/info/%T?sbs=0",zName))
695
- @ unified&nbsp;diffs</a>
696
- }else{
697
- @ %z(xhref("class='button'","%R/info/%T?sbs=1",zName))
698
- @ side-by-side&nbsp;diffs</a>
699
- }
700
- }else{
701
- @ %z(xhref("class='button'","%R/vinfo/%T?sbs=0",zName))
702
- @ show&nbsp;unified&nbsp;diffs</a>
703
- @ %z(xhref("class='button'","%R/vinfo/%T?sbs=1",zName))
704
- @ show&nbsp;side-by-side&nbsp;diffs</a>
705
- }
706
- }
673
+ @ <div class="section">Changes</div>
674
+ @ <div class="sectionmenu">
675
+ verboseFlag = g.zPath[0]!='c';
676
+ if( db_get_boolean("show-version-diffs", 0)==0 ){
677
+ verboseFlag = !verboseFlag;
678
+ zPage = "ci";
679
+ zPageHide = "vinfo";
680
+ }
681
+ diffFlags = construct_diff_flags(verboseFlag, sideBySide);
682
+ zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
683
+ if( verboseFlag ){
684
+ @ %z(xhref("class='button'","%R/%s/%T",zPageHide,zName))
685
+ @ Hide&nbsp;Diffs</a>
686
+ if( sideBySide ){
687
+ @ %z(xhref("class='button'","%R/%s/%T?sbs=0%s",zPage,zName,zW))
688
+ @ Unified&nbsp;Diffs</a>
689
+ }else{
690
+ @ %z(xhref("class='button'","%R/%s/%T?sbs=1%s",zPage,zName,zW))
691
+ @ Side-by-Side&nbsp;Diffs</a>
692
+ }
693
+ if( *zW ){
694
+ @ %z(xhref("class='button'","%R/%s/%T?sbs=%d",zPage,zName,sideBySide))
695
+ @ Show&nbsp;Whitespace&nbsp;Changes</a>
696
+ }else{
697
+ @ %z(xhref("class='button'","%R/%s/%T?sbs=%d&w",zPage,zName,sideBySide))
698
+ @ Ignore&nbsp;Whitespace</a>
699
+ }
700
+ }else{
701
+ @ %z(xhref("class='button'","%R/%s/%T?sbs=0",zPage,zName))
702
+ @ Show&nbsp;Unified&nbsp;Diffs</a>
703
+ @ %z(xhref("class='button'","%R/%s/%T?sbs=1",zPage,zName))
704
+ @ Show&nbsp;Side-by-Side&nbsp;Diffs</a>
705
+ }
706
+ if( zParent ){
707707
@ %z(xhref("class='button'","%R/vpatch?from=%S&to=%S",zParent,zUuid))
708
- @ patch</a></div>
709
- if( pRe ){
710
- @ <p><b>Only differences that match regular expression "%h(zRe)"
711
- @ are shown.</b></p>
712
- }
713
- db_prepare(&q3,
714
- "SELECT name,"
715
- " mperm,"
716
- " (SELECT uuid FROM blob WHERE rid=mlink.pid),"
717
- " (SELECT uuid FROM blob WHERE rid=mlink.fid),"
718
- " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)"
719
- " FROM mlink JOIN filename ON filename.fnid=mlink.fnid"
720
- " WHERE mlink.mid=%d"
721
- " AND (mlink.fid>0"
722
- " OR mlink.fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=%d))"
723
- " ORDER BY name /*sort*/",
724
- rid, rid
725
- );
726
- diffFlags = construct_diff_flags(verboseFlag, sideBySide);
727
- while( db_step(&q3)==SQLITE_ROW ){
728
- const char *zName = db_column_text(&q3,0);
729
- int mperm = db_column_int(&q3, 1);
730
- const char *zOld = db_column_text(&q3,2);
731
- const char *zNew = db_column_text(&q3,3);
732
- const char *zOldName = db_column_text(&q3, 4);
733
- append_file_change_line(zName, zOld, zNew, zOldName, diffFlags,pRe,mperm);
734
- }
735
- db_finalize(&q3);
736
- }
708
+ @ Patch</a>
709
+ }
710
+ @</div>
711
+ if( pRe ){
712
+ @ <p><b>Only differences that match regular expression "%h(zRe)"
713
+ @ are shown.</b></p>
714
+ }
715
+ db_prepare(&q3,
716
+ "SELECT name,"
717
+ " mperm,"
718
+ " (SELECT uuid FROM blob WHERE rid=mlink.pid),"
719
+ " (SELECT uuid FROM blob WHERE rid=mlink.fid),"
720
+ " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)"
721
+ " FROM mlink JOIN filename ON filename.fnid=mlink.fnid"
722
+ " WHERE mlink.mid=%d"
723
+ " AND (mlink.fid>0"
724
+ " OR mlink.fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=%d))"
725
+ " ORDER BY name /*sort*/",
726
+ rid, rid
727
+ );
728
+ while( db_step(&q3)==SQLITE_ROW ){
729
+ const char *zName = db_column_text(&q3,0);
730
+ int mperm = db_column_int(&q3, 1);
731
+ const char *zOld = db_column_text(&q3,2);
732
+ const char *zNew = db_column_text(&q3,3);
733
+ const char *zOldName = db_column_text(&q3, 4);
734
+ append_file_change_line(zName, zOld, zNew, zOldName, diffFlags,pRe,mperm);
735
+ }
736
+ db_finalize(&q3);
737737
append_diff_javascript(sideBySide);
738738
style_footer();
739739
}
740740
741741
/*
@@ -954,10 +954,11 @@
954954
ManifestFile *pFileFrom, *pFileTo;
955955
const char *zBranch;
956956
const char *zFrom;
957957
const char *zTo;
958958
const char *zRe;
959
+ const char *zW;
959960
const char *zVerbose;
960961
const char *zGlob;
961962
ReCompiled *pRe = 0;
962963
login_check_credentials();
963964
if( !g.perm.Read ){ login_needed(); return; }
@@ -987,39 +988,54 @@
987988
zFrom = P("from");
988989
zTo = P("to");
989990
if(zGlob && !*zGlob){
990991
zGlob = NULL;
991992
}
993
+ diffFlags = construct_diff_flags(verboseFlag, sideBySide);
994
+ zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
992995
if( sideBySide || verboseFlag ){
993996
style_submenu_element("Hide Diff", "hidediff",
994
- "%R/vdiff?from=%T&to=%T&sbs=0%s%T",
997
+ "%R/vdiff?from=%T&to=%T&sbs=0%s%T%s",
995998
zFrom, zTo,
996
- zGlob ? "&glob=" : "", zGlob ? zGlob : "");
999
+ zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW);
9971000
}
9981001
if( !sideBySide ){
999
- style_submenu_element("Side-by-side Diff", "sbsdiff",
1000
- "%R/vdiff?from=%T&to=%T&sbs=1%s%T",
1002
+ style_submenu_element("Side-by-Side Diff", "sbsdiff",
1003
+ "%R/vdiff?from=%T&to=%T&sbs=1%s%T%s",
10011004
zFrom, zTo,
1002
- zGlob ? "&glob=" : "", zGlob ? zGlob : "");
1005
+ zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW);
10031006
}
10041007
if( sideBySide || !verboseFlag ) {
10051008
style_submenu_element("Unified Diff", "udiff",
1006
- "%R/vdiff?from=%T&to=%T&sbs=0&v%s%T",
1009
+ "%R/vdiff?from=%T&to=%T&sbs=0&v%s%T%s",
10071010
zFrom, zTo,
1008
- zGlob ? "&glob=" : "", zGlob ? zGlob : "");
1011
+ zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW);
10091012
}
10101013
style_submenu_element("Invert", "invert",
1011
- "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T", zTo, zFrom,
1014
+ "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T%s", zTo, zFrom,
10121015
sideBySide, (verboseFlag && !sideBySide)?"&v":"",
1013
- zGlob ? "&glob=" : "", zGlob ? zGlob : "");
1016
+ zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW);
10141017
if( zGlob ){
10151018
style_submenu_element("Clear glob", "clearglob",
1016
- "%R/vdiff?from=%T&to=%T&sbs=%d%s", zFrom, zTo,
1017
- sideBySide, (verboseFlag && !sideBySide)?"&v":"");
1019
+ "%R/vdiff?from=%T&to=%T&sbs=%d%s%s", zFrom, zTo,
1020
+ sideBySide, (verboseFlag && !sideBySide)?"&v":"", zW);
10181021
}else{
10191022
style_submenu_element("Patch", "patch",
1020
- "%R/vpatch?from=%T&to=%T", zFrom, zTo);
1023
+ "%R/vpatch?from=%T&to=%T%s", zFrom, zTo, zW);
1024
+ }
1025
+ if( sideBySide || verboseFlag ){
1026
+ if( *zW ){
1027
+ style_submenu_element("Show Whitespace Differences", "whitespace",
1028
+ "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T", zFrom, zTo,
1029
+ sideBySide, (verboseFlag && !sideBySide)?"&v":"",
1030
+ zGlob ? "&glob=" : "", zGlob ? zGlob : "");
1031
+ }else{
1032
+ style_submenu_element("Ignore Whitespace", "ignorews",
1033
+ "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T&w", zFrom, zTo,
1034
+ sideBySide, (verboseFlag && !sideBySide)?"&v":"",
1035
+ zGlob ? "&glob=" : "", zGlob ? zGlob : "");
1036
+ }
10211037
}
10221038
style_header("Check-in Differences");
10231039
@ <h2>Difference From:</h2><blockquote>
10241040
checkin_description(ridFrom);
10251041
@ </blockquote><h2>To:</h2><blockquote>
@@ -1036,11 +1052,10 @@
10361052
10371053
manifest_file_rewind(pFrom);
10381054
pFileFrom = manifest_file_next(pFrom, 0);
10391055
manifest_file_rewind(pTo);
10401056
pFileTo = manifest_file_next(pTo, 0);
1041
- diffFlags = construct_diff_flags(verboseFlag, sideBySide);
10421057
while( pFileFrom || pFileTo ){
10431058
int cmp;
10441059
if( pFileFrom==0 ){
10451060
cmp = +1;
10461061
}else if( pFileTo==0 ){
@@ -1337,10 +1352,11 @@
13371352
int isPatch;
13381353
int sideBySide;
13391354
char *zV1;
13401355
char *zV2;
13411356
const char *zRe;
1357
+ const char *zW; /* URL param for ignoring whitespace */
13421358
ReCompiled *pRe = 0;
13431359
u64 diffFlags;
13441360
13451361
login_check_credentials();
13461362
if( !g.perm.Read ){ login_needed(); return; }
@@ -1367,20 +1383,30 @@
13671383
zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
13681384
zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
13691385
diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML;
13701386
13711387
style_header("Diff");
1388
+ zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
1389
+ if( *zW ){
1390
+ style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes",
1391
+ "%s/fdiff?v1=%T&v2=%T&sbs=%d",
1392
+ g.zTop, P("v1"), P("v2"), sideBySide);
1393
+ }else{
1394
+ style_submenu_element("Ignore Whitespace", "Ignore Whitespace",
1395
+ "%s/fdiff?v1=%T&v2=%T&sbs=%d&w",
1396
+ g.zTop, P("v1"), P("v2"), sideBySide);
1397
+ }
13721398
style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch",
13731399
g.zTop, P("v1"), P("v2"));
13741400
if( !sideBySide ){
1375
- style_submenu_element("Side-by-side Diff", "sbsdiff",
1376
- "%s/fdiff?v1=%T&v2=%T&sbs=1",
1377
- g.zTop, P("v1"), P("v2"));
1401
+ style_submenu_element("Side-by-Side Diff", "sbsdiff",
1402
+ "%s/fdiff?v1=%T&v2=%T&sbs=1%s",
1403
+ g.zTop, P("v1"), P("v2"), zW);
13781404
}else{
13791405
style_submenu_element("Unified Diff", "udiff",
1380
- "%s/fdiff?v1=%T&v2=%T&sbs=0",
1381
- g.zTop, P("v1"), P("v2"));
1406
+ "%s/fdiff?v1=%T&v2=%T&sbs=0%s",
1407
+ g.zTop, P("v1"), P("v2"), zW);
13821408
}
13831409
13841410
if( P("smhdr")!=0 ){
13851411
@ <h2>Differences From Artifact
13861412
@ %z(href("%R/artifact/%S",zV1))[%S(zV1)]</a> To
@@ -1418,11 +1444,11 @@
14181444
rid = name_to_rid_www("name");
14191445
login_check_credentials();
14201446
if( !g.perm.Read ){ login_needed(); return; }
14211447
if( rid==0 ) fossil_redirect_home();
14221448
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1423
- if( fossil_strcmp(P("name"), zUuid)==0 ){
1449
+ if( fossil_strcmp(P("name"), zUuid)==0 && login_is_nobody() ){
14241450
g.isConst = 1;
14251451
}
14261452
free(zUuid);
14271453
zMime = P("m");
14281454
if( zMime==0 ){
@@ -2237,11 +2263,11 @@
22372263
}
22382264
db_finalize(&q);
22392265
if( nChng>0 ){
22402266
int nrid;
22412267
Blob cksum;
2242
- blob_appendf(&ctrl, "U %F\n", g.zLogin);
2268
+ blob_appendf(&ctrl, "U %F\n", login_name());
22432269
md5sum_blob(&ctrl, &cksum);
22442270
blob_appendf(&ctrl, "Z %b\n", &cksum);
22452271
db_begin_transaction();
22462272
g.markPrivate = content_is_private(rid);
22472273
nrid = content_put(&ctrl);
22482274
--- src/info.c
+++ src/info.c
@@ -449,20 +449,23 @@
449 if( verboseFlag==0 ){
450 diffFlags = 0; /* Zero means do not show any diff */
451 }else{
452 int x;
453 if( sideBySide ){
454 diffFlags = DIFF_SIDEBYSIDE | DIFF_IGNORE_EOLWS;
455
456 /* "dw" query parameter determines width of each column */
457 x = atoi(PD("dw","80"))*(DIFF_CONTEXT_MASK+1);
458 if( x<0 || x>DIFF_WIDTH_MASK ) x = DIFF_WIDTH_MASK;
459 diffFlags += x;
460 }else{
461 diffFlags = DIFF_INLINE | DIFF_IGNORE_EOLWS;
462 }
463
 
 
 
464 /* "dc" query parameter determines lines of context */
465 x = atoi(PD("dc","7"));
466 if( x<0 || x>DIFF_CONTEXT_MASK ) x = DIFF_CONTEXT_MASK;
467 diffFlags += x;
468
@@ -469,11 +472,10 @@
469 /* The "noopt" parameter disables diff optimization */
470 if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT;
471 }
472 return diffFlags;
473 }
474
475
476 /*
477 ** WEBPAGE: vinfo
478 ** WEBPAGE: ci
479 ** URL: /ci?name=RID|ARTIFACTID
@@ -498,10 +500,13 @@
498 const char *zName; /* Name of the checkin to be displayed */
499 const char *zUuid; /* UUID of zName */
500 const char *zParent; /* UUID of the parent checkin (if any) */
501 const char *zRe; /* regex parameter */
502 ReCompiled *pRe = 0; /* regex */
 
 
 
503
504 login_check_credentials();
505 if( !g.perm.Read ){ login_needed(); return; }
506 zName = P("name");
507 rid = name_to_rid_www("name");
@@ -663,79 +668,74 @@
663 style_header("Check-in Information");
664 login_anonymous_available();
665 }
666 db_finalize(&q1);
667 showTags(rid, "");
668 if( zParent ){
669 @ <div class="section">Changes</div>
670 @ <div class="sectionmenu">
671 verboseFlag = g.zPath[0]!='c';
672 if( db_get_boolean("show-version-diffs", 0)==0 ){
673 verboseFlag = !verboseFlag;
674 if( verboseFlag ){
675 @ %z(xhref("class='button'","%R/vinfo/%T",zName))
676 @ hide&nbsp;diffs</a>
677 if( sideBySide ){
678 @ %z(xhref("class='button'","%R/ci/%T?sbs=0",zName))
679 @ unified&nbsp;diffs</a>
680 }else{
681 @ %z(xhref("class='button'","%R/ci/%T?sbs=1",zName))
682 @ side-by-side&nbsp;diffs</a>
683 }
684 }else{
685 @ %z(xhref("class='button'","%R/ci/%T?sbs=0",zName))
686 @ show&nbsp;unified&nbsp;diffs</a>
687 @ %z(xhref("class='button'","%R/ci/%T?sbs=1",zName))
688 @ show&nbsp;side-by-side&nbsp;diffs</a>
689 }
690 }else{
691 if( verboseFlag ){
692 @ %z(xhref("class='button'","%R/ci/%T",zName))hide&nbsp;diffs</a>
693 if( sideBySide ){
694 @ %z(xhref("class='button'","%R/info/%T?sbs=0",zName))
695 @ unified&nbsp;diffs</a>
696 }else{
697 @ %z(xhref("class='button'","%R/info/%T?sbs=1",zName))
698 @ side-by-side&nbsp;diffs</a>
699 }
700 }else{
701 @ %z(xhref("class='button'","%R/vinfo/%T?sbs=0",zName))
702 @ show&nbsp;unified&nbsp;diffs</a>
703 @ %z(xhref("class='button'","%R/vinfo/%T?sbs=1",zName))
704 @ show&nbsp;side-by-side&nbsp;diffs</a>
705 }
706 }
707 @ %z(xhref("class='button'","%R/vpatch?from=%S&to=%S",zParent,zUuid))
708 @ patch</a></div>
709 if( pRe ){
710 @ <p><b>Only differences that match regular expression "%h(zRe)"
711 @ are shown.</b></p>
712 }
713 db_prepare(&q3,
714 "SELECT name,"
715 " mperm,"
716 " (SELECT uuid FROM blob WHERE rid=mlink.pid),"
717 " (SELECT uuid FROM blob WHERE rid=mlink.fid),"
718 " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)"
719 " FROM mlink JOIN filename ON filename.fnid=mlink.fnid"
720 " WHERE mlink.mid=%d"
721 " AND (mlink.fid>0"
722 " OR mlink.fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=%d))"
723 " ORDER BY name /*sort*/",
724 rid, rid
725 );
726 diffFlags = construct_diff_flags(verboseFlag, sideBySide);
727 while( db_step(&q3)==SQLITE_ROW ){
728 const char *zName = db_column_text(&q3,0);
729 int mperm = db_column_int(&q3, 1);
730 const char *zOld = db_column_text(&q3,2);
731 const char *zNew = db_column_text(&q3,3);
732 const char *zOldName = db_column_text(&q3, 4);
733 append_file_change_line(zName, zOld, zNew, zOldName, diffFlags,pRe,mperm);
734 }
735 db_finalize(&q3);
736 }
737 append_diff_javascript(sideBySide);
738 style_footer();
739 }
740
741 /*
@@ -954,10 +954,11 @@
954 ManifestFile *pFileFrom, *pFileTo;
955 const char *zBranch;
956 const char *zFrom;
957 const char *zTo;
958 const char *zRe;
 
959 const char *zVerbose;
960 const char *zGlob;
961 ReCompiled *pRe = 0;
962 login_check_credentials();
963 if( !g.perm.Read ){ login_needed(); return; }
@@ -987,39 +988,54 @@
987 zFrom = P("from");
988 zTo = P("to");
989 if(zGlob && !*zGlob){
990 zGlob = NULL;
991 }
 
 
992 if( sideBySide || verboseFlag ){
993 style_submenu_element("Hide Diff", "hidediff",
994 "%R/vdiff?from=%T&to=%T&sbs=0%s%T",
995 zFrom, zTo,
996 zGlob ? "&glob=" : "", zGlob ? zGlob : "");
997 }
998 if( !sideBySide ){
999 style_submenu_element("Side-by-side Diff", "sbsdiff",
1000 "%R/vdiff?from=%T&to=%T&sbs=1%s%T",
1001 zFrom, zTo,
1002 zGlob ? "&glob=" : "", zGlob ? zGlob : "");
1003 }
1004 if( sideBySide || !verboseFlag ) {
1005 style_submenu_element("Unified Diff", "udiff",
1006 "%R/vdiff?from=%T&to=%T&sbs=0&v%s%T",
1007 zFrom, zTo,
1008 zGlob ? "&glob=" : "", zGlob ? zGlob : "");
1009 }
1010 style_submenu_element("Invert", "invert",
1011 "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T", zTo, zFrom,
1012 sideBySide, (verboseFlag && !sideBySide)?"&v":"",
1013 zGlob ? "&glob=" : "", zGlob ? zGlob : "");
1014 if( zGlob ){
1015 style_submenu_element("Clear glob", "clearglob",
1016 "%R/vdiff?from=%T&to=%T&sbs=%d%s", zFrom, zTo,
1017 sideBySide, (verboseFlag && !sideBySide)?"&v":"");
1018 }else{
1019 style_submenu_element("Patch", "patch",
1020 "%R/vpatch?from=%T&to=%T", zFrom, zTo);
 
 
 
 
 
 
 
 
 
 
 
 
 
1021 }
1022 style_header("Check-in Differences");
1023 @ <h2>Difference From:</h2><blockquote>
1024 checkin_description(ridFrom);
1025 @ </blockquote><h2>To:</h2><blockquote>
@@ -1036,11 +1052,10 @@
1036
1037 manifest_file_rewind(pFrom);
1038 pFileFrom = manifest_file_next(pFrom, 0);
1039 manifest_file_rewind(pTo);
1040 pFileTo = manifest_file_next(pTo, 0);
1041 diffFlags = construct_diff_flags(verboseFlag, sideBySide);
1042 while( pFileFrom || pFileTo ){
1043 int cmp;
1044 if( pFileFrom==0 ){
1045 cmp = +1;
1046 }else if( pFileTo==0 ){
@@ -1337,10 +1352,11 @@
1337 int isPatch;
1338 int sideBySide;
1339 char *zV1;
1340 char *zV2;
1341 const char *zRe;
 
1342 ReCompiled *pRe = 0;
1343 u64 diffFlags;
1344
1345 login_check_credentials();
1346 if( !g.perm.Read ){ login_needed(); return; }
@@ -1367,20 +1383,30 @@
1367 zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
1368 zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
1369 diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML;
1370
1371 style_header("Diff");
 
 
 
 
 
 
 
 
 
 
1372 style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch",
1373 g.zTop, P("v1"), P("v2"));
1374 if( !sideBySide ){
1375 style_submenu_element("Side-by-side Diff", "sbsdiff",
1376 "%s/fdiff?v1=%T&v2=%T&sbs=1",
1377 g.zTop, P("v1"), P("v2"));
1378 }else{
1379 style_submenu_element("Unified Diff", "udiff",
1380 "%s/fdiff?v1=%T&v2=%T&sbs=0",
1381 g.zTop, P("v1"), P("v2"));
1382 }
1383
1384 if( P("smhdr")!=0 ){
1385 @ <h2>Differences From Artifact
1386 @ %z(href("%R/artifact/%S",zV1))[%S(zV1)]</a> To
@@ -1418,11 +1444,11 @@
1418 rid = name_to_rid_www("name");
1419 login_check_credentials();
1420 if( !g.perm.Read ){ login_needed(); return; }
1421 if( rid==0 ) fossil_redirect_home();
1422 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1423 if( fossil_strcmp(P("name"), zUuid)==0 ){
1424 g.isConst = 1;
1425 }
1426 free(zUuid);
1427 zMime = P("m");
1428 if( zMime==0 ){
@@ -2237,11 +2263,11 @@
2237 }
2238 db_finalize(&q);
2239 if( nChng>0 ){
2240 int nrid;
2241 Blob cksum;
2242 blob_appendf(&ctrl, "U %F\n", g.zLogin);
2243 md5sum_blob(&ctrl, &cksum);
2244 blob_appendf(&ctrl, "Z %b\n", &cksum);
2245 db_begin_transaction();
2246 g.markPrivate = content_is_private(rid);
2247 nrid = content_put(&ctrl);
2248
--- src/info.c
+++ src/info.c
@@ -449,20 +449,23 @@
449 if( verboseFlag==0 ){
450 diffFlags = 0; /* Zero means do not show any diff */
451 }else{
452 int x;
453 if( sideBySide ){
454 diffFlags = DIFF_SIDEBYSIDE;
455
456 /* "dw" query parameter determines width of each column */
457 x = atoi(PD("dw","80"))*(DIFF_CONTEXT_MASK+1);
458 if( x<0 || x>DIFF_WIDTH_MASK ) x = DIFF_WIDTH_MASK;
459 diffFlags += x;
460 }else{
461 diffFlags = DIFF_INLINE;
462 }
463
464 if( P("w") ){
465 diffFlags |= DIFF_IGNORE_ALLWS;
466 }
467 /* "dc" query parameter determines lines of context */
468 x = atoi(PD("dc","7"));
469 if( x<0 || x>DIFF_CONTEXT_MASK ) x = DIFF_CONTEXT_MASK;
470 diffFlags += x;
471
@@ -469,11 +472,10 @@
472 /* The "noopt" parameter disables diff optimization */
473 if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT;
474 }
475 return diffFlags;
476 }
 
477
478 /*
479 ** WEBPAGE: vinfo
480 ** WEBPAGE: ci
481 ** URL: /ci?name=RID|ARTIFACTID
@@ -498,10 +500,13 @@
500 const char *zName; /* Name of the checkin to be displayed */
501 const char *zUuid; /* UUID of zName */
502 const char *zParent; /* UUID of the parent checkin (if any) */
503 const char *zRe; /* regex parameter */
504 ReCompiled *pRe = 0; /* regex */
505 const char *zW; /* URL param for ignoring whitespace */
506 const char *zPage = "vinfo"; /* Page that shows diffs */
507 const char *zPageHide = "ci"; /* Page that hides diffs */
508
509 login_check_credentials();
510 if( !g.perm.Read ){ login_needed(); return; }
511 zName = P("name");
512 rid = name_to_rid_www("name");
@@ -663,79 +668,74 @@
668 style_header("Check-in Information");
669 login_anonymous_available();
670 }
671 db_finalize(&q1);
672 showTags(rid, "");
673 @ <div class="section">Changes</div>
674 @ <div class="sectionmenu">
675 verboseFlag = g.zPath[0]!='c';
676 if( db_get_boolean("show-version-diffs", 0)==0 ){
677 verboseFlag = !verboseFlag;
678 zPage = "ci";
679 zPageHide = "vinfo";
680 }
681 diffFlags = construct_diff_flags(verboseFlag, sideBySide);
682 zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
683 if( verboseFlag ){
684 @ %z(xhref("class='button'","%R/%s/%T",zPageHide,zName))
685 @ Hide&nbsp;Diffs</a>
686 if( sideBySide ){
687 @ %z(xhref("class='button'","%R/%s/%T?sbs=0%s",zPage,zName,zW))
688 @ Unified&nbsp;Diffs</a>
689 }else{
690 @ %z(xhref("class='button'","%R/%s/%T?sbs=1%s",zPage,zName,zW))
691 @ Side-by-Side&nbsp;Diffs</a>
692 }
693 if( *zW ){
694 @ %z(xhref("class='button'","%R/%s/%T?sbs=%d",zPage,zName,sideBySide))
695 @ Show&nbsp;Whitespace&nbsp;Changes</a>
696 }else{
697 @ %z(xhref("class='button'","%R/%s/%T?sbs=%d&w",zPage,zName,sideBySide))
698 @ Ignore&nbsp;Whitespace</a>
699 }
700 }else{
701 @ %z(xhref("class='button'","%R/%s/%T?sbs=0",zPage,zName))
702 @ Show&nbsp;Unified&nbsp;Diffs</a>
703 @ %z(xhref("class='button'","%R/%s/%T?sbs=1",zPage,zName))
704 @ Show&nbsp;Side-by-Side&nbsp;Diffs</a>
705 }
706 if( zParent ){
 
 
 
 
 
707 @ %z(xhref("class='button'","%R/vpatch?from=%S&to=%S",zParent,zUuid))
708 @ Patch</a>
709 }
710 @</div>
711 if( pRe ){
712 @ <p><b>Only differences that match regular expression "%h(zRe)"
713 @ are shown.</b></p>
714 }
715 db_prepare(&q3,
716 "SELECT name,"
717 " mperm,"
718 " (SELECT uuid FROM blob WHERE rid=mlink.pid),"
719 " (SELECT uuid FROM blob WHERE rid=mlink.fid),"
720 " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)"
721 " FROM mlink JOIN filename ON filename.fnid=mlink.fnid"
722 " WHERE mlink.mid=%d"
723 " AND (mlink.fid>0"
724 " OR mlink.fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=%d))"
725 " ORDER BY name /*sort*/",
726 rid, rid
727 );
728 while( db_step(&q3)==SQLITE_ROW ){
729 const char *zName = db_column_text(&q3,0);
730 int mperm = db_column_int(&q3, 1);
731 const char *zOld = db_column_text(&q3,2);
732 const char *zNew = db_column_text(&q3,3);
733 const char *zOldName = db_column_text(&q3, 4);
734 append_file_change_line(zName, zOld, zNew, zOldName, diffFlags,pRe,mperm);
735 }
736 db_finalize(&q3);
737 append_diff_javascript(sideBySide);
738 style_footer();
739 }
740
741 /*
@@ -954,10 +954,11 @@
954 ManifestFile *pFileFrom, *pFileTo;
955 const char *zBranch;
956 const char *zFrom;
957 const char *zTo;
958 const char *zRe;
959 const char *zW;
960 const char *zVerbose;
961 const char *zGlob;
962 ReCompiled *pRe = 0;
963 login_check_credentials();
964 if( !g.perm.Read ){ login_needed(); return; }
@@ -987,39 +988,54 @@
988 zFrom = P("from");
989 zTo = P("to");
990 if(zGlob && !*zGlob){
991 zGlob = NULL;
992 }
993 diffFlags = construct_diff_flags(verboseFlag, sideBySide);
994 zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
995 if( sideBySide || verboseFlag ){
996 style_submenu_element("Hide Diff", "hidediff",
997 "%R/vdiff?from=%T&to=%T&sbs=0%s%T%s",
998 zFrom, zTo,
999 zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW);
1000 }
1001 if( !sideBySide ){
1002 style_submenu_element("Side-by-Side Diff", "sbsdiff",
1003 "%R/vdiff?from=%T&to=%T&sbs=1%s%T%s",
1004 zFrom, zTo,
1005 zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW);
1006 }
1007 if( sideBySide || !verboseFlag ) {
1008 style_submenu_element("Unified Diff", "udiff",
1009 "%R/vdiff?from=%T&to=%T&sbs=0&v%s%T%s",
1010 zFrom, zTo,
1011 zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW);
1012 }
1013 style_submenu_element("Invert", "invert",
1014 "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T%s", zTo, zFrom,
1015 sideBySide, (verboseFlag && !sideBySide)?"&v":"",
1016 zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW);
1017 if( zGlob ){
1018 style_submenu_element("Clear glob", "clearglob",
1019 "%R/vdiff?from=%T&to=%T&sbs=%d%s%s", zFrom, zTo,
1020 sideBySide, (verboseFlag && !sideBySide)?"&v":"", zW);
1021 }else{
1022 style_submenu_element("Patch", "patch",
1023 "%R/vpatch?from=%T&to=%T%s", zFrom, zTo, zW);
1024 }
1025 if( sideBySide || verboseFlag ){
1026 if( *zW ){
1027 style_submenu_element("Show Whitespace Differences", "whitespace",
1028 "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T", zFrom, zTo,
1029 sideBySide, (verboseFlag && !sideBySide)?"&v":"",
1030 zGlob ? "&glob=" : "", zGlob ? zGlob : "");
1031 }else{
1032 style_submenu_element("Ignore Whitespace", "ignorews",
1033 "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T&w", zFrom, zTo,
1034 sideBySide, (verboseFlag && !sideBySide)?"&v":"",
1035 zGlob ? "&glob=" : "", zGlob ? zGlob : "");
1036 }
1037 }
1038 style_header("Check-in Differences");
1039 @ <h2>Difference From:</h2><blockquote>
1040 checkin_description(ridFrom);
1041 @ </blockquote><h2>To:</h2><blockquote>
@@ -1036,11 +1052,10 @@
1052
1053 manifest_file_rewind(pFrom);
1054 pFileFrom = manifest_file_next(pFrom, 0);
1055 manifest_file_rewind(pTo);
1056 pFileTo = manifest_file_next(pTo, 0);
 
1057 while( pFileFrom || pFileTo ){
1058 int cmp;
1059 if( pFileFrom==0 ){
1060 cmp = +1;
1061 }else if( pFileTo==0 ){
@@ -1337,10 +1352,11 @@
1352 int isPatch;
1353 int sideBySide;
1354 char *zV1;
1355 char *zV2;
1356 const char *zRe;
1357 const char *zW; /* URL param for ignoring whitespace */
1358 ReCompiled *pRe = 0;
1359 u64 diffFlags;
1360
1361 login_check_credentials();
1362 if( !g.perm.Read ){ login_needed(); return; }
@@ -1367,20 +1383,30 @@
1383 zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
1384 zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
1385 diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML;
1386
1387 style_header("Diff");
1388 zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
1389 if( *zW ){
1390 style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes",
1391 "%s/fdiff?v1=%T&v2=%T&sbs=%d",
1392 g.zTop, P("v1"), P("v2"), sideBySide);
1393 }else{
1394 style_submenu_element("Ignore Whitespace", "Ignore Whitespace",
1395 "%s/fdiff?v1=%T&v2=%T&sbs=%d&w",
1396 g.zTop, P("v1"), P("v2"), sideBySide);
1397 }
1398 style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch",
1399 g.zTop, P("v1"), P("v2"));
1400 if( !sideBySide ){
1401 style_submenu_element("Side-by-Side Diff", "sbsdiff",
1402 "%s/fdiff?v1=%T&v2=%T&sbs=1%s",
1403 g.zTop, P("v1"), P("v2"), zW);
1404 }else{
1405 style_submenu_element("Unified Diff", "udiff",
1406 "%s/fdiff?v1=%T&v2=%T&sbs=0%s",
1407 g.zTop, P("v1"), P("v2"), zW);
1408 }
1409
1410 if( P("smhdr")!=0 ){
1411 @ <h2>Differences From Artifact
1412 @ %z(href("%R/artifact/%S",zV1))[%S(zV1)]</a> To
@@ -1418,11 +1444,11 @@
1444 rid = name_to_rid_www("name");
1445 login_check_credentials();
1446 if( !g.perm.Read ){ login_needed(); return; }
1447 if( rid==0 ) fossil_redirect_home();
1448 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1449 if( fossil_strcmp(P("name"), zUuid)==0 && login_is_nobody() ){
1450 g.isConst = 1;
1451 }
1452 free(zUuid);
1453 zMime = P("m");
1454 if( zMime==0 ){
@@ -2237,11 +2263,11 @@
2263 }
2264 db_finalize(&q);
2265 if( nChng>0 ){
2266 int nrid;
2267 Blob cksum;
2268 blob_appendf(&ctrl, "U %F\n", login_name());
2269 md5sum_blob(&ctrl, &cksum);
2270 blob_appendf(&ctrl, "Z %b\n", &cksum);
2271 db_begin_transaction();
2272 g.markPrivate = content_is_private(rid);
2273 nrid = content_put(&ctrl);
2274
+1 -1
--- src/json.c
+++ src/json.c
@@ -30,12 +30,12 @@
3030
** dispatch to a JSON-mode-specific command/page handler with the type fossil_json_f().
3131
** See the API docs for that typedef (below) for the semantics of the callbacks.
3232
**
3333
**
3434
*/
35
-#include "config.h"
3635
#include "VERSION.h"
36
+#include "config.h"
3737
#include "json.h"
3838
#include <assert.h>
3939
#include <time.h>
4040
4141
#if INTERFACE
4242
--- src/json.c
+++ src/json.c
@@ -30,12 +30,12 @@
30 ** dispatch to a JSON-mode-specific command/page handler with the type fossil_json_f().
31 ** See the API docs for that typedef (below) for the semantics of the callbacks.
32 **
33 **
34 */
35 #include "config.h"
36 #include "VERSION.h"
 
37 #include "json.h"
38 #include <assert.h>
39 #include <time.h>
40
41 #if INTERFACE
42
--- src/json.c
+++ src/json.c
@@ -30,12 +30,12 @@
30 ** dispatch to a JSON-mode-specific command/page handler with the type fossil_json_f().
31 ** See the API docs for that typedef (below) for the semantics of the callbacks.
32 **
33 **
34 */
 
35 #include "VERSION.h"
36 #include "config.h"
37 #include "json.h"
38 #include <assert.h>
39 #include <time.h>
40
41 #if INTERFACE
42
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -66,11 +66,11 @@
6666
/*
6767
** Create a temporary table suitable for storing timeline data.
6868
*/
6969
static void json_timeline_temp_table(void){
7070
/* Field order MUST match that from json_timeline_query()!!! */
71
- static const char zSql[] =
71
+ static const char zSql[] =
7272
@ CREATE TEMP TABLE IF NOT EXISTS json_timeline(
7373
@ sortId INTEGER PRIMARY KEY,
7474
@ rid INTEGER,
7575
@ uuid TEXT,
7676
@ mtime INTEGER,
@@ -109,11 +109,11 @@
109109
@ (SELECT group_concat(substr(tagname,5), ',') FROM tag, tagxref
110110
@ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
111111
@ AND tagxref.rid=blob.rid AND tagxref.tagtype>0) as tags,
112112
@ tagid as tagId,
113113
@ brief as brief
114
- @ FROM event JOIN blob
114
+ @ FROM event JOIN blob
115115
@ WHERE blob.rid=event.objid
116116
;
117117
return zBaseSql;
118118
}
119119
@@ -316,11 +316,11 @@
316316
*/
317317
cson_value * json_get_changed_files(int rid, int flags){
318318
cson_value * rowsV = NULL;
319319
cson_array * rows = NULL;
320320
Stmt q = empty_Stmt;
321
- db_prepare(&q,
321
+ db_prepare(&q,
322322
"SELECT (pid==0) AS isnew,"
323323
" (fid==0) AS isdel,"
324324
" (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name,"
325325
" blob.uuid as uuid,"
326326
" (SELECT uuid FROM blob WHERE rid=pid) as parent,"
327327
328328
ADDED src/loadctrl.c
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -66,11 +66,11 @@
66 /*
67 ** Create a temporary table suitable for storing timeline data.
68 */
69 static void json_timeline_temp_table(void){
70 /* Field order MUST match that from json_timeline_query()!!! */
71 static const char zSql[] =
72 @ CREATE TEMP TABLE IF NOT EXISTS json_timeline(
73 @ sortId INTEGER PRIMARY KEY,
74 @ rid INTEGER,
75 @ uuid TEXT,
76 @ mtime INTEGER,
@@ -109,11 +109,11 @@
109 @ (SELECT group_concat(substr(tagname,5), ',') FROM tag, tagxref
110 @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
111 @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0) as tags,
112 @ tagid as tagId,
113 @ brief as brief
114 @ FROM event JOIN blob
115 @ WHERE blob.rid=event.objid
116 ;
117 return zBaseSql;
118 }
119
@@ -316,11 +316,11 @@
316 */
317 cson_value * json_get_changed_files(int rid, int flags){
318 cson_value * rowsV = NULL;
319 cson_array * rows = NULL;
320 Stmt q = empty_Stmt;
321 db_prepare(&q,
322 "SELECT (pid==0) AS isnew,"
323 " (fid==0) AS isdel,"
324 " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name,"
325 " blob.uuid as uuid,"
326 " (SELECT uuid FROM blob WHERE rid=pid) as parent,"
327
328 DDED src/loadctrl.c
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -66,11 +66,11 @@
66 /*
67 ** Create a temporary table suitable for storing timeline data.
68 */
69 static void json_timeline_temp_table(void){
70 /* Field order MUST match that from json_timeline_query()!!! */
71 static const char zSql[] =
72 @ CREATE TEMP TABLE IF NOT EXISTS json_timeline(
73 @ sortId INTEGER PRIMARY KEY,
74 @ rid INTEGER,
75 @ uuid TEXT,
76 @ mtime INTEGER,
@@ -109,11 +109,11 @@
109 @ (SELECT group_concat(substr(tagname,5), ',') FROM tag, tagxref
110 @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid
111 @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0) as tags,
112 @ tagid as tagId,
113 @ brief as brief
114 @ FROM event JOIN blob
115 @ WHERE blob.rid=event.objid
116 ;
117 return zBaseSql;
118 }
119
@@ -316,11 +316,11 @@
316 */
317 cson_value * json_get_changed_files(int rid, int flags){
318 cson_value * rowsV = NULL;
319 cson_array * rows = NULL;
320 Stmt q = empty_Stmt;
321 db_prepare(&q,
322 "SELECT (pid==0) AS isnew,"
323 " (fid==0) AS isdel,"
324 " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name,"
325 " blob.uuid as uuid,"
326 " (SELECT uuid FROM blob WHERE rid=pid) as parent,"
327
328 DDED src/loadctrl.c
--- a/src/loadctrl.c
+++ b/src/loadctrl.c
@@ -0,0 +1 @@
1
+header(test_loadavgooter(loadavg_test"0"
--- a/src/loadctrl.c
+++ b/src/loadctrl.c
@@ -0,0 +1 @@
 
--- a/src/loadctrl.c
+++ b/src/loadctrl.c
@@ -0,0 +1 @@
1 header(test_loadavgooter(loadavg_test"0"
+14
--- src/login.c
+++ src/login.c
@@ -1142,10 +1142,24 @@
11421142
/* Set the capabilities */
11431143
login_set_capabilities(zCap, 0);
11441144
login_anon_once = 1;
11451145
login_set_anon_nobody_capabilities();
11461146
}
1147
+
1148
+/*
1149
+** Return true if the user is "nobody"
1150
+*/
1151
+int login_is_nobody(void){
1152
+ return g.zLogin==0 || g.zLogin[0]==0 || fossil_strcmp(g.zLogin,"nobody")==0;
1153
+}
1154
+
1155
+/*
1156
+** Return the login name. If no login name is specified, return "nobody".
1157
+*/
1158
+const char *login_name(void){
1159
+ return (g.zLogin && g.zLogin[0]) ? g.zLogin : "nobody";
1160
+}
11471161
11481162
/*
11491163
** Call this routine when the credential check fails. It causes
11501164
** a redirect to the "login" page.
11511165
*/
11521166
--- src/login.c
+++ src/login.c
@@ -1142,10 +1142,24 @@
1142 /* Set the capabilities */
1143 login_set_capabilities(zCap, 0);
1144 login_anon_once = 1;
1145 login_set_anon_nobody_capabilities();
1146 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1147
1148 /*
1149 ** Call this routine when the credential check fails. It causes
1150 ** a redirect to the "login" page.
1151 */
1152
--- src/login.c
+++ src/login.c
@@ -1142,10 +1142,24 @@
1142 /* Set the capabilities */
1143 login_set_capabilities(zCap, 0);
1144 login_anon_once = 1;
1145 login_set_anon_nobody_capabilities();
1146 }
1147
1148 /*
1149 ** Return true if the user is "nobody"
1150 */
1151 int login_is_nobody(void){
1152 return g.zLogin==0 || g.zLogin[0]==0 || fossil_strcmp(g.zLogin,"nobody")==0;
1153 }
1154
1155 /*
1156 ** Return the login name. If no login name is specified, return "nobody".
1157 */
1158 const char *login_name(void){
1159 return (g.zLogin && g.zLogin[0]) ? g.zLogin : "nobody";
1160 }
1161
1162 /*
1163 ** Call this routine when the credential check fails. It causes
1164 ** a redirect to the "login" page.
1165 */
1166
+6 -3
--- src/main.c
+++ src/main.c
@@ -16,10 +16,11 @@
1616
*******************************************************************************
1717
**
1818
** This module codes the main() procedure that runs first when the
1919
** program is invoked.
2020
*/
21
+#include "VERSION.h"
2122
#include "config.h"
2223
#include "main.h"
2324
#include <string.h>
2425
#include <time.h>
2526
#include <fcntl.h>
@@ -120,11 +121,11 @@
120121
121122
struct Global {
122123
int argc; char **argv; /* Command-line arguments to the program */
123124
char *nameOfExe; /* Full path of executable. */
124125
const char *zErrlog; /* Log errors to this file, if not NULL */
125
- int isConst; /* True if the output is unchanging */
126
+ int isConst; /* True if the output is unchanging & cacheable */
126127
const char *zVfsName; /* The VFS to use for database connections */
127128
sqlite3 *db; /* The connection to the databases */
128129
sqlite3 *dbConfig; /* Separate connection for global_config table */
129130
int useAttach; /* True if global_config is attached to repository */
130131
const char *zConfigDbName;/* Path of the config database. NULL if not open */
@@ -139,10 +140,11 @@
139140
int fSqlTrace; /* True if --sqltrace flag is present */
140141
int fSqlStats; /* True if --sqltrace or --sqlstats are present */
141142
int fSqlPrint; /* True if -sqlprint flag is present */
142143
int fQuiet; /* True if -quiet flag is present */
143144
int fHttpTrace; /* Trace outbound HTTP requests */
145
+ char *zHttpAuth; /* HTTP Authorization user:pass information */
144146
int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */
145147
int fSshTrace; /* Trace the SSH setup traffic */
146148
int fSshClient; /* HTTP client flags for SSH client */
147149
char *zSshCmd; /* SSH command string */
148150
int fNoSync; /* Do not do an autosync ever. --nosync */
@@ -192,11 +194,11 @@
192194
char *urlFossil; /* The fossil query parameter on ssh: */
193195
unsigned urlFlags; /* Boolean flags controlling URL processing */
194196
int useProxy; /* Used to remember that a proxy is in use */
195197
char *proxyUrlPath;
196198
int proxyOrigPort; /* Tunneled port number for https through proxy */
197
- const char *zLogin; /* Login name. "" if not logged in. */
199
+ const char *zLogin; /* Login name. NULL or "" if not logged in. */
198200
const char *zSSLIdentity; /* Value of --ssl-identity option, filename of
199201
** SSL client identity */
200202
int useLocalauth; /* No login required if from 127.0.0.1 */
201203
int noPswd; /* Logged in without password (on 127.0.0.1) */
202204
int userUid; /* Integer user id */
@@ -650,10 +652,11 @@
650652
g.fSshClient = 0;
651653
g.zSshCmd = 0;
652654
if( g.fSqlTrace ) g.fSqlStats = 1;
653655
g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
654656
g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
657
+ g.zHttpAuth = 0;
655658
g.zLogin = find_option("user", "U", 1);
656659
g.zSSLIdentity = find_option("ssl-identity", 0, 1);
657660
g.zErrlog = find_option("errorlog", 0, 1);
658661
if( find_option("utc",0,0) ) g.fTimeFormat = 1;
659662
if( find_option("localtime",0,0) ) g.fTimeFormat = 2;
@@ -1456,11 +1459,11 @@
14561459
zAltRepo[jj] = 0;
14571460
zAltRepo += jj+1;
14581461
}else{
14591462
zUser = "nobody";
14601463
}
1461
- if( g.zLogin==0 ) zUser = "nobody";
1464
+ if( g.zLogin==0 || g.zLogin[0]==0 ) zUser = "nobody";
14621465
if( zAltRepo[0]!='/' ){
14631466
zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo);
14641467
file_simplify_name(zAltRepo, -1, 0);
14651468
}
14661469
db_close(1);
14671470
--- src/main.c
+++ src/main.c
@@ -16,10 +16,11 @@
16 *******************************************************************************
17 **
18 ** This module codes the main() procedure that runs first when the
19 ** program is invoked.
20 */
 
21 #include "config.h"
22 #include "main.h"
23 #include <string.h>
24 #include <time.h>
25 #include <fcntl.h>
@@ -120,11 +121,11 @@
120
121 struct Global {
122 int argc; char **argv; /* Command-line arguments to the program */
123 char *nameOfExe; /* Full path of executable. */
124 const char *zErrlog; /* Log errors to this file, if not NULL */
125 int isConst; /* True if the output is unchanging */
126 const char *zVfsName; /* The VFS to use for database connections */
127 sqlite3 *db; /* The connection to the databases */
128 sqlite3 *dbConfig; /* Separate connection for global_config table */
129 int useAttach; /* True if global_config is attached to repository */
130 const char *zConfigDbName;/* Path of the config database. NULL if not open */
@@ -139,10 +140,11 @@
139 int fSqlTrace; /* True if --sqltrace flag is present */
140 int fSqlStats; /* True if --sqltrace or --sqlstats are present */
141 int fSqlPrint; /* True if -sqlprint flag is present */
142 int fQuiet; /* True if -quiet flag is present */
143 int fHttpTrace; /* Trace outbound HTTP requests */
 
144 int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */
145 int fSshTrace; /* Trace the SSH setup traffic */
146 int fSshClient; /* HTTP client flags for SSH client */
147 char *zSshCmd; /* SSH command string */
148 int fNoSync; /* Do not do an autosync ever. --nosync */
@@ -192,11 +194,11 @@
192 char *urlFossil; /* The fossil query parameter on ssh: */
193 unsigned urlFlags; /* Boolean flags controlling URL processing */
194 int useProxy; /* Used to remember that a proxy is in use */
195 char *proxyUrlPath;
196 int proxyOrigPort; /* Tunneled port number for https through proxy */
197 const char *zLogin; /* Login name. "" if not logged in. */
198 const char *zSSLIdentity; /* Value of --ssl-identity option, filename of
199 ** SSL client identity */
200 int useLocalauth; /* No login required if from 127.0.0.1 */
201 int noPswd; /* Logged in without password (on 127.0.0.1) */
202 int userUid; /* Integer user id */
@@ -650,10 +652,11 @@
650 g.fSshClient = 0;
651 g.zSshCmd = 0;
652 if( g.fSqlTrace ) g.fSqlStats = 1;
653 g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
654 g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
 
655 g.zLogin = find_option("user", "U", 1);
656 g.zSSLIdentity = find_option("ssl-identity", 0, 1);
657 g.zErrlog = find_option("errorlog", 0, 1);
658 if( find_option("utc",0,0) ) g.fTimeFormat = 1;
659 if( find_option("localtime",0,0) ) g.fTimeFormat = 2;
@@ -1456,11 +1459,11 @@
1456 zAltRepo[jj] = 0;
1457 zAltRepo += jj+1;
1458 }else{
1459 zUser = "nobody";
1460 }
1461 if( g.zLogin==0 ) zUser = "nobody";
1462 if( zAltRepo[0]!='/' ){
1463 zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo);
1464 file_simplify_name(zAltRepo, -1, 0);
1465 }
1466 db_close(1);
1467
--- src/main.c
+++ src/main.c
@@ -16,10 +16,11 @@
16 *******************************************************************************
17 **
18 ** This module codes the main() procedure that runs first when the
19 ** program is invoked.
20 */
21 #include "VERSION.h"
22 #include "config.h"
23 #include "main.h"
24 #include <string.h>
25 #include <time.h>
26 #include <fcntl.h>
@@ -120,11 +121,11 @@
121
122 struct Global {
123 int argc; char **argv; /* Command-line arguments to the program */
124 char *nameOfExe; /* Full path of executable. */
125 const char *zErrlog; /* Log errors to this file, if not NULL */
126 int isConst; /* True if the output is unchanging & cacheable */
127 const char *zVfsName; /* The VFS to use for database connections */
128 sqlite3 *db; /* The connection to the databases */
129 sqlite3 *dbConfig; /* Separate connection for global_config table */
130 int useAttach; /* True if global_config is attached to repository */
131 const char *zConfigDbName;/* Path of the config database. NULL if not open */
@@ -139,10 +140,11 @@
140 int fSqlTrace; /* True if --sqltrace flag is present */
141 int fSqlStats; /* True if --sqltrace or --sqlstats are present */
142 int fSqlPrint; /* True if -sqlprint flag is present */
143 int fQuiet; /* True if -quiet flag is present */
144 int fHttpTrace; /* Trace outbound HTTP requests */
145 char *zHttpAuth; /* HTTP Authorization user:pass information */
146 int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */
147 int fSshTrace; /* Trace the SSH setup traffic */
148 int fSshClient; /* HTTP client flags for SSH client */
149 char *zSshCmd; /* SSH command string */
150 int fNoSync; /* Do not do an autosync ever. --nosync */
@@ -192,11 +194,11 @@
194 char *urlFossil; /* The fossil query parameter on ssh: */
195 unsigned urlFlags; /* Boolean flags controlling URL processing */
196 int useProxy; /* Used to remember that a proxy is in use */
197 char *proxyUrlPath;
198 int proxyOrigPort; /* Tunneled port number for https through proxy */
199 const char *zLogin; /* Login name. NULL or "" if not logged in. */
200 const char *zSSLIdentity; /* Value of --ssl-identity option, filename of
201 ** SSL client identity */
202 int useLocalauth; /* No login required if from 127.0.0.1 */
203 int noPswd; /* Logged in without password (on 127.0.0.1) */
204 int userUid; /* Integer user id */
@@ -650,10 +652,11 @@
652 g.fSshClient = 0;
653 g.zSshCmd = 0;
654 if( g.fSqlTrace ) g.fSqlStats = 1;
655 g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
656 g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
657 g.zHttpAuth = 0;
658 g.zLogin = find_option("user", "U", 1);
659 g.zSSLIdentity = find_option("ssl-identity", 0, 1);
660 g.zErrlog = find_option("errorlog", 0, 1);
661 if( find_option("utc",0,0) ) g.fTimeFormat = 1;
662 if( find_option("localtime",0,0) ) g.fTimeFormat = 2;
@@ -1456,11 +1459,11 @@
1459 zAltRepo[jj] = 0;
1460 zAltRepo += jj+1;
1461 }else{
1462 zUser = "nobody";
1463 }
1464 if( g.zLogin==0 || g.zLogin[0]==0 ) zUser = "nobody";
1465 if( zAltRepo[0]!='/' ){
1466 zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo);
1467 file_simplify_name(zAltRepo, -1, 0);
1468 }
1469 db_close(1);
1470
+14 -2
--- src/main.mk
+++ src/main.mk
@@ -66,10 +66,11 @@
6666
$(SRCDIR)/json_tag.c \
6767
$(SRCDIR)/json_timeline.c \
6868
$(SRCDIR)/json_user.c \
6969
$(SRCDIR)/json_wiki.c \
7070
$(SRCDIR)/leaf.c \
71
+ $(SRCDIR)/loadctrl.c \
7172
$(SRCDIR)/login.c \
7273
$(SRCDIR)/lookslike.c \
7374
$(SRCDIR)/main.c \
7475
$(SRCDIR)/manifest.c \
7576
$(SRCDIR)/markdown.c \
@@ -176,10 +177,11 @@
176177
$(OBJDIR)/json_tag_.c \
177178
$(OBJDIR)/json_timeline_.c \
178179
$(OBJDIR)/json_user_.c \
179180
$(OBJDIR)/json_wiki_.c \
180181
$(OBJDIR)/leaf_.c \
182
+ $(OBJDIR)/loadctrl_.c \
181183
$(OBJDIR)/login_.c \
182184
$(OBJDIR)/lookslike_.c \
183185
$(OBJDIR)/main_.c \
184186
$(OBJDIR)/manifest_.c \
185187
$(OBJDIR)/markdown_.c \
@@ -286,10 +288,11 @@
286288
$(OBJDIR)/json_tag.o \
287289
$(OBJDIR)/json_timeline.o \
288290
$(OBJDIR)/json_user.o \
289291
$(OBJDIR)/json_wiki.o \
290292
$(OBJDIR)/leaf.o \
293
+ $(OBJDIR)/loadctrl.o \
291294
$(OBJDIR)/login.o \
292295
$(OBJDIR)/lookslike.o \
293296
$(OBJDIR)/main.o \
294297
$(OBJDIR)/manifest.o \
295298
$(OBJDIR)/markdown.o \
@@ -385,11 +388,13 @@
385388
-DSQLITE_OMIT_DEPRECATED \
386389
-DSQLITE_ENABLE_EXPLAIN_COMMENTS
387390
388391
# Setup the options used to compile the included SQLite shell.
389392
SHELL_OPTIONS = -Dmain=sqlite3_shell \
390
- -DSQLITE_OMIT_LOAD_EXTENSION=1
393
+ -DSQLITE_OMIT_LOAD_EXTENSION=1 \
394
+ -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
395
+ -DSQLITE_SHELL_DBNAME_PROC=fossil_open
391396
392397
# The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
393398
# to 1. If it is set to 1, then there is no need to build or link
394399
# the sqlite3.o object. Instead, the system sqlite will be linked
395400
# using -lsqlite3.
@@ -420,11 +425,11 @@
420425
421426
422427
$(OBJDIR)/page_index.h: $(TRANS_SRC) $(OBJDIR)/mkindex
423428
$(OBJDIR)/mkindex $(TRANS_SRC) >$@
424429
$(OBJDIR)/headers: $(OBJDIR)/page_index.h $(OBJDIR)/makeheaders $(OBJDIR)/VERSION.h
425
- $(OBJDIR)/makeheaders $(OBJDIR)/add_.c:$(OBJDIR)/add.h $(OBJDIR)/allrepo_.c:$(OBJDIR)/allrepo.h $(OBJDIR)/attach_.c:$(OBJDIR)/attach.h $(OBJDIR)/bag_.c:$(OBJDIR)/bag.h $(OBJDIR)/bisect_.c:$(OBJDIR)/bisect.h $(OBJDIR)/blob_.c:$(OBJDIR)/blob.h $(OBJDIR)/branch_.c:$(OBJDIR)/branch.h $(OBJDIR)/browse_.c:$(OBJDIR)/browse.h $(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h $(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h $(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h $(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h $(OBJDIR)/clearsign_.c:$(OBJDIR)/clearsign.h $(OBJDIR)/clone_.c:$(OBJDIR)/clone.h $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h $(OBJDIR)/configure_.c:$(OBJDIR)/configure.h $(OBJDIR)/content_.c:$(OBJDIR)/content.h $(OBJDIR)/db_.c:$(OBJDIR)/db.h $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h $(OBJDIR)/encode_.c:$(OBJDIR)/encode.h $(OBJDIR)/event_.c:$(OBJDIR)/event.h $(OBJDIR)/export_.c:$(OBJDIR)/export.h $(OBJDIR)/file_.c:$(OBJDIR)/file.h $(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h $(OBJDIR)/http_.c:$(OBJDIR)/http.h $(OBJDIR)/http_socket_.c:$(OBJDIR)/http_socket.h $(OBJDIR)/http_ssl_.c:$(OBJDIR)/http_ssl.h $(OBJDIR)/http_transport_.c:$(OBJDIR)/http_transport.h $(OBJDIR)/import_.c:$(OBJDIR)/import.h $(OBJDIR)/info_.c:$(OBJDIR)/info.h $(OBJDIR)/json_.c:$(OBJDIR)/json.h $(OBJDIR)/json_artifact_.c:$(OBJDIR)/json_artifact.h $(OBJDIR)/json_branch_.c:$(OBJDIR)/json_branch.h $(OBJDIR)/json_config_.c:$(OBJDIR)/json_config.h $(OBJDIR)/json_diff_.c:$(OBJDIR)/json_diff.h $(OBJDIR)/json_dir_.c:$(OBJDIR)/json_dir.h $(OBJDIR)/json_finfo_.c:$(OBJDIR)/json_finfo.h $(OBJDIR)/json_login_.c:$(OBJDIR)/json_login.h $(OBJDIR)/json_query_.c:$(OBJDIR)/json_query.h $(OBJDIR)/json_report_.c:$(OBJDIR)/json_report.h $(OBJDIR)/json_status_.c:$(OBJDIR)/json_status.h $(OBJDIR)/json_tag_.c:$(OBJDIR)/json_tag.h $(OBJDIR)/json_timeline_.c:$(OBJDIR)/json_timeline.h $(OBJDIR)/json_user_.c:$(OBJDIR)/json_user.h $(OBJDIR)/json_wiki_.c:$(OBJDIR)/json_wiki.h $(OBJDIR)/leaf_.c:$(OBJDIR)/leaf.h $(OBJDIR)/login_.c:$(OBJDIR)/login.h $(OBJDIR)/lookslike_.c:$(OBJDIR)/lookslike.h $(OBJDIR)/main_.c:$(OBJDIR)/main.h $(OBJDIR)/manifest_.c:$(OBJDIR)/manifest.h $(OBJDIR)/markdown_.c:$(OBJDIR)/markdown.h $(OBJDIR)/markdown_html_.c:$(OBJDIR)/markdown_html.h $(OBJDIR)/md5_.c:$(OBJDIR)/md5.h $(OBJDIR)/merge_.c:$(OBJDIR)/merge.h $(OBJDIR)/merge3_.c:$(OBJDIR)/merge3.h $(OBJDIR)/moderate_.c:$(OBJDIR)/moderate.h $(OBJDIR)/name_.c:$(OBJDIR)/name.h $(OBJDIR)/path_.c:$(OBJDIR)/path.h $(OBJDIR)/pivot_.c:$(OBJDIR)/pivot.h $(OBJDIR)/popen_.c:$(OBJDIR)/popen.h $(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h $(OBJDIR)/printf_.c:$(OBJDIR)/printf.h $(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h $(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h $(OBJDIR)/report_.c:$(OBJDIR)/report.h $(OBJDIR)/rss_.c:$(OBJDIR)/rss.h $(OBJDIR)/schema_.c:$(OBJDIR)/schema.h $(OBJDIR)/search_.c:$(OBJDIR)/search.h $(OBJDIR)/setup_.c:$(OBJDIR)/setup.h $(OBJDIR)/sha1_.c:$(OBJDIR)/sha1.h $(OBJDIR)/shun_.c:$(OBJDIR)/shun.h $(OBJDIR)/skins_.c:$(OBJDIR)/skins.h $(OBJDIR)/sqlcmd_.c:$(OBJDIR)/sqlcmd.h $(OBJDIR)/stash_.c:$(OBJDIR)/stash.h $(OBJDIR)/stat_.c:$(OBJDIR)/stat.h $(OBJDIR)/style_.c:$(OBJDIR)/style.h $(OBJDIR)/sync_.c:$(OBJDIR)/sync.h $(OBJDIR)/tag_.c:$(OBJDIR)/tag.h $(OBJDIR)/tar_.c:$(OBJDIR)/tar.h $(OBJDIR)/th_main_.c:$(OBJDIR)/th_main.h $(OBJDIR)/timeline_.c:$(OBJDIR)/timeline.h $(OBJDIR)/tkt_.c:$(OBJDIR)/tkt.h $(OBJDIR)/tktsetup_.c:$(OBJDIR)/tktsetup.h $(OBJDIR)/undo_.c:$(OBJDIR)/undo.h $(OBJDIR)/unicode_.c:$(OBJDIR)/unicode.h $(OBJDIR)/update_.c:$(OBJDIR)/update.h $(OBJDIR)/url_.c:$(OBJDIR)/url.h $(OBJDIR)/user_.c:$(OBJDIR)/user.h $(OBJDIR)/utf8_.c:$(OBJDIR)/utf8.h $(OBJDIR)/util_.c:$(OBJDIR)/util.h $(OBJDIR)/verify_.c:$(OBJDIR)/verify.h $(OBJDIR)/vfile_.c:$(OBJDIR)/vfile.h $(OBJDIR)/wiki_.c:$(OBJDIR)/wiki.h $(OBJDIR)/wikiformat_.c:$(OBJDIR)/wikiformat.h $(OBJDIR)/winfile_.c:$(OBJDIR)/winfile.h $(OBJDIR)/winhttp_.c:$(OBJDIR)/winhttp.h $(OBJDIR)/wysiwyg_.c:$(OBJDIR)/wysiwyg.h $(OBJDIR)/xfer_.c:$(OBJDIR)/xfer.h $(OBJDIR)/xfersetup_.c:$(OBJDIR)/xfersetup.h $(OBJDIR)/zip_.c:$(OBJDIR)/zip.h $(SRCDIR)/sqlite3.h $(SRCDIR)/th.h $(OBJDIR)/VERSION.h
430
+ $(OBJDIR)/makeheaders $(OBJDIR)/add_.c:$(OBJDIR)/add.h $(OBJDIR)/allrepo_.c:$(OBJDIR)/allrepo.h $(OBJDIR)/attach_.c:$(OBJDIR)/attach.h $(OBJDIR)/bag_.c:$(OBJDIR)/bag.h $(OBJDIR)/bisect_.c:$(OBJDIR)/bisect.h $(OBJDIR)/blob_.c:$(OBJDIR)/blob.h $(OBJDIR)/branch_.c:$(OBJDIR)/branch.h $(OBJDIR)/browse_.c:$(OBJDIR)/browse.h $(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h $(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h $(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h $(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h $(OBJDIR)/clearsign_.c:$(OBJDIR)/clearsign.h $(OBJDIR)/clone_.c:$(OBJDIR)/clone.h $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h $(OBJDIR)/configure_.c:$(OBJDIR)/configure.h $(OBJDIR)/content_.c:$(OBJDIR)/content.h $(OBJDIR)/db_.c:$(OBJDIR)/db.h $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h $(OBJDIR)/encode_.c:$(OBJDIR)/encode.h $(OBJDIR)/event_.c:$(OBJDIR)/event.h $(OBJDIR)/export_.c:$(OBJDIR)/export.h $(OBJDIR)/file_.c:$(OBJDIR)/file.h $(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h $(OBJDIR)/http_.c:$(OBJDIR)/http.h $(OBJDIR)/http_socket_.c:$(OBJDIR)/http_socket.h $(OBJDIR)/http_ssl_.c:$(OBJDIR)/http_ssl.h $(OBJDIR)/http_transport_.c:$(OBJDIR)/http_transport.h $(OBJDIR)/import_.c:$(OBJDIR)/import.h $(OBJDIR)/info_.c:$(OBJDIR)/info.h $(OBJDIR)/json_.c:$(OBJDIR)/json.h $(OBJDIR)/json_artifact_.c:$(OBJDIR)/json_artifact.h $(OBJDIR)/json_branch_.c:$(OBJDIR)/json_branch.h $(OBJDIR)/json_config_.c:$(OBJDIR)/json_config.h $(OBJDIR)/json_diff_.c:$(OBJDIR)/json_diff.h $(OBJDIR)/json_dir_.c:$(OBJDIR)/json_dir.h $(OBJDIR)/json_finfo_.c:$(OBJDIR)/json_finfo.h $(OBJDIR)/json_login_.c:$(OBJDIR)/json_login.h $(OBJDIR)/json_query_.c:$(OBJDIR)/json_query.h $(OBJDIR)/json_report_.c:$(OBJDIR)/json_report.h $(OBJDIR)/json_status_.c:$(OBJDIR)/json_status.h $(OBJDIR)/json_tag_.c:$(OBJDIR)/json_tag.h $(OBJDIR)/json_timeline_.c:$(OBJDIR)/json_timeline.h $(OBJDIR)/json_user_.c:$(OBJDIR)/json_user.h $(OBJDIR)/json_wiki_.c:$(OBJDIR)/json_wiki.h $(OBJDIR)/leaf_.c:$(OBJDIR)/leaf.h $(OBJDIR)/loadctrl_.c:$(OBJDIR)/loadctrl.h $(OBJDIR)/login_.c:$(OBJDIR)/login.h $(OBJDIR)/lookslike_.c:$(OBJDIR)/lookslike.h $(OBJDIR)/main_.c:$(OBJDIR)/main.h $(OBJDIR)/manifest_.c:$(OBJDIR)/manifest.h $(OBJDIR)/markdown_.c:$(OBJDIR)/markdown.h $(OBJDIR)/markdown_html_.c:$(OBJDIR)/markdown_html.h $(OBJDIR)/md5_.c:$(OBJDIR)/md5.h $(OBJDIR)/merge_.c:$(OBJDIR)/merge.h $(OBJDIR)/merge3_.c:$(OBJDIR)/merge3.h $(OBJDIR)/moderate_.c:$(OBJDIR)/moderate.h $(OBJDIR)/name_.c:$(OBJDIR)/name.h $(OBJDIR)/path_.c:$(OBJDIR)/path.h $(OBJDIR)/pivot_.c:$(OBJDIR)/pivot.h $(OBJDIR)/popen_.c:$(OBJDIR)/popen.h $(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h $(OBJDIR)/printf_.c:$(OBJDIR)/printf.h $(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h $(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h $(OBJDIR)/report_.c:$(OBJDIR)/report.h $(OBJDIR)/rss_.c:$(OBJDIR)/rss.h $(OBJDIR)/schema_.c:$(OBJDIR)/schema.h $(OBJDIR)/search_.c:$(OBJDIR)/search.h $(OBJDIR)/setup_.c:$(OBJDIR)/setup.h $(OBJDIR)/sha1_.c:$(OBJDIR)/sha1.h $(OBJDIR)/shun_.c:$(OBJDIR)/shun.h $(OBJDIR)/skins_.c:$(OBJDIR)/skins.h $(OBJDIR)/sqlcmd_.c:$(OBJDIR)/sqlcmd.h $(OBJDIR)/stash_.c:$(OBJDIR)/stash.h $(OBJDIR)/stat_.c:$(OBJDIR)/stat.h $(OBJDIR)/style_.c:$(OBJDIR)/style.h $(OBJDIR)/sync_.c:$(OBJDIR)/sync.h $(OBJDIR)/tag_.c:$(OBJDIR)/tag.h $(OBJDIR)/tar_.c:$(OBJDIR)/tar.h $(OBJDIR)/th_main_.c:$(OBJDIR)/th_main.h $(OBJDIR)/timeline_.c:$(OBJDIR)/timeline.h $(OBJDIR)/tkt_.c:$(OBJDIR)/tkt.h $(OBJDIR)/tktsetup_.c:$(OBJDIR)/tktsetup.h $(OBJDIR)/undo_.c:$(OBJDIR)/undo.h $(OBJDIR)/unicode_.c:$(OBJDIR)/unicode.h $(OBJDIR)/update_.c:$(OBJDIR)/update.h $(OBJDIR)/url_.c:$(OBJDIR)/url.h $(OBJDIR)/user_.c:$(OBJDIR)/user.h $(OBJDIR)/utf8_.c:$(OBJDIR)/utf8.h $(OBJDIR)/util_.c:$(OBJDIR)/util.h $(OBJDIR)/verify_.c:$(OBJDIR)/verify.h $(OBJDIR)/vfile_.c:$(OBJDIR)/vfile.h $(OBJDIR)/wiki_.c:$(OBJDIR)/wiki.h $(OBJDIR)/wikiformat_.c:$(OBJDIR)/wikiformat.h $(OBJDIR)/winfile_.c:$(OBJDIR)/winfile.h $(OBJDIR)/winhttp_.c:$(OBJDIR)/winhttp.h $(OBJDIR)/wysiwyg_.c:$(OBJDIR)/wysiwyg.h $(OBJDIR)/xfer_.c:$(OBJDIR)/xfer.h $(OBJDIR)/xfersetup_.c:$(OBJDIR)/xfersetup.h $(OBJDIR)/zip_.c:$(OBJDIR)/zip.h $(SRCDIR)/sqlite3.h $(SRCDIR)/th.h $(OBJDIR)/VERSION.h
426431
touch $(OBJDIR)/headers
427432
$(OBJDIR)/headers: Makefile
428433
$(OBJDIR)/json.o $(OBJDIR)/json_artifact.o $(OBJDIR)/json_branch.o $(OBJDIR)/json_config.o $(OBJDIR)/json_diff.o $(OBJDIR)/json_dir.o $(OBJDIR)/json_finfo.o $(OBJDIR)/json_login.o $(OBJDIR)/json_query.o $(OBJDIR)/json_report.o $(OBJDIR)/json_status.o $(OBJDIR)/json_tag.o $(OBJDIR)/json_timeline.o $(OBJDIR)/json_user.o $(OBJDIR)/json_wiki.o : $(SRCDIR)/json_detail.h
429434
Makefile:
430435
$(OBJDIR)/add_.c: $(SRCDIR)/add.c $(OBJDIR)/translate
@@ -803,10 +808,17 @@
803808
804809
$(OBJDIR)/leaf.o: $(OBJDIR)/leaf_.c $(OBJDIR)/leaf.h $(SRCDIR)/config.h
805810
$(XTCC) -o $(OBJDIR)/leaf.o -c $(OBJDIR)/leaf_.c
806811
807812
$(OBJDIR)/leaf.h: $(OBJDIR)/headers
813
+$(OBJDIR)/loadctrl_.c: $(SRCDIR)/loadctrl.c $(OBJDIR)/translate
814
+ $(OBJDIR)/translate $(SRCDIR)/loadctrl.c >$(OBJDIR)/loadctrl_.c
815
+
816
+$(OBJDIR)/loadctrl.o: $(OBJDIR)/loadctrl_.c $(OBJDIR)/loadctrl.h $(SRCDIR)/config.h
817
+ $(XTCC) -o $(OBJDIR)/loadctrl.o -c $(OBJDIR)/loadctrl_.c
818
+
819
+$(OBJDIR)/loadctrl.h: $(OBJDIR)/headers
808820
$(OBJDIR)/login_.c: $(SRCDIR)/login.c $(OBJDIR)/translate
809821
$(OBJDIR)/translate $(SRCDIR)/login.c >$(OBJDIR)/login_.c
810822
811823
$(OBJDIR)/login.o: $(OBJDIR)/login_.c $(OBJDIR)/login.h $(SRCDIR)/config.h
812824
$(XTCC) -o $(OBJDIR)/login.o -c $(OBJDIR)/login_.c
813825
--- src/main.mk
+++ src/main.mk
@@ -66,10 +66,11 @@
66 $(SRCDIR)/json_tag.c \
67 $(SRCDIR)/json_timeline.c \
68 $(SRCDIR)/json_user.c \
69 $(SRCDIR)/json_wiki.c \
70 $(SRCDIR)/leaf.c \
 
71 $(SRCDIR)/login.c \
72 $(SRCDIR)/lookslike.c \
73 $(SRCDIR)/main.c \
74 $(SRCDIR)/manifest.c \
75 $(SRCDIR)/markdown.c \
@@ -176,10 +177,11 @@
176 $(OBJDIR)/json_tag_.c \
177 $(OBJDIR)/json_timeline_.c \
178 $(OBJDIR)/json_user_.c \
179 $(OBJDIR)/json_wiki_.c \
180 $(OBJDIR)/leaf_.c \
 
181 $(OBJDIR)/login_.c \
182 $(OBJDIR)/lookslike_.c \
183 $(OBJDIR)/main_.c \
184 $(OBJDIR)/manifest_.c \
185 $(OBJDIR)/markdown_.c \
@@ -286,10 +288,11 @@
286 $(OBJDIR)/json_tag.o \
287 $(OBJDIR)/json_timeline.o \
288 $(OBJDIR)/json_user.o \
289 $(OBJDIR)/json_wiki.o \
290 $(OBJDIR)/leaf.o \
 
291 $(OBJDIR)/login.o \
292 $(OBJDIR)/lookslike.o \
293 $(OBJDIR)/main.o \
294 $(OBJDIR)/manifest.o \
295 $(OBJDIR)/markdown.o \
@@ -385,11 +388,13 @@
385 -DSQLITE_OMIT_DEPRECATED \
386 -DSQLITE_ENABLE_EXPLAIN_COMMENTS
387
388 # Setup the options used to compile the included SQLite shell.
389 SHELL_OPTIONS = -Dmain=sqlite3_shell \
390 -DSQLITE_OMIT_LOAD_EXTENSION=1
 
 
391
392 # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
393 # to 1. If it is set to 1, then there is no need to build or link
394 # the sqlite3.o object. Instead, the system sqlite will be linked
395 # using -lsqlite3.
@@ -420,11 +425,11 @@
420
421
422 $(OBJDIR)/page_index.h: $(TRANS_SRC) $(OBJDIR)/mkindex
423 $(OBJDIR)/mkindex $(TRANS_SRC) >$@
424 $(OBJDIR)/headers: $(OBJDIR)/page_index.h $(OBJDIR)/makeheaders $(OBJDIR)/VERSION.h
425 $(OBJDIR)/makeheaders $(OBJDIR)/add_.c:$(OBJDIR)/add.h $(OBJDIR)/allrepo_.c:$(OBJDIR)/allrepo.h $(OBJDIR)/attach_.c:$(OBJDIR)/attach.h $(OBJDIR)/bag_.c:$(OBJDIR)/bag.h $(OBJDIR)/bisect_.c:$(OBJDIR)/bisect.h $(OBJDIR)/blob_.c:$(OBJDIR)/blob.h $(OBJDIR)/branch_.c:$(OBJDIR)/branch.h $(OBJDIR)/browse_.c:$(OBJDIR)/browse.h $(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h $(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h $(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h $(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h $(OBJDIR)/clearsign_.c:$(OBJDIR)/clearsign.h $(OBJDIR)/clone_.c:$(OBJDIR)/clone.h $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h $(OBJDIR)/configure_.c:$(OBJDIR)/configure.h $(OBJDIR)/content_.c:$(OBJDIR)/content.h $(OBJDIR)/db_.c:$(OBJDIR)/db.h $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h $(OBJDIR)/encode_.c:$(OBJDIR)/encode.h $(OBJDIR)/event_.c:$(OBJDIR)/event.h $(OBJDIR)/export_.c:$(OBJDIR)/export.h $(OBJDIR)/file_.c:$(OBJDIR)/file.h $(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h $(OBJDIR)/http_.c:$(OBJDIR)/http.h $(OBJDIR)/http_socket_.c:$(OBJDIR)/http_socket.h $(OBJDIR)/http_ssl_.c:$(OBJDIR)/http_ssl.h $(OBJDIR)/http_transport_.c:$(OBJDIR)/http_transport.h $(OBJDIR)/import_.c:$(OBJDIR)/import.h $(OBJDIR)/info_.c:$(OBJDIR)/info.h $(OBJDIR)/json_.c:$(OBJDIR)/json.h $(OBJDIR)/json_artifact_.c:$(OBJDIR)/json_artifact.h $(OBJDIR)/json_branch_.c:$(OBJDIR)/json_branch.h $(OBJDIR)/json_config_.c:$(OBJDIR)/json_config.h $(OBJDIR)/json_diff_.c:$(OBJDIR)/json_diff.h $(OBJDIR)/json_dir_.c:$(OBJDIR)/json_dir.h $(OBJDIR)/json_finfo_.c:$(OBJDIR)/json_finfo.h $(OBJDIR)/json_login_.c:$(OBJDIR)/json_login.h $(OBJDIR)/json_query_.c:$(OBJDIR)/json_query.h $(OBJDIR)/json_report_.c:$(OBJDIR)/json_report.h $(OBJDIR)/json_status_.c:$(OBJDIR)/json_status.h $(OBJDIR)/json_tag_.c:$(OBJDIR)/json_tag.h $(OBJDIR)/json_timeline_.c:$(OBJDIR)/json_timeline.h $(OBJDIR)/json_user_.c:$(OBJDIR)/json_user.h $(OBJDIR)/json_wiki_.c:$(OBJDIR)/json_wiki.h $(OBJDIR)/leaf_.c:$(OBJDIR)/leaf.h $(OBJDIR)/login_.c:$(OBJDIR)/login.h $(OBJDIR)/lookslike_.c:$(OBJDIR)/lookslike.h $(OBJDIR)/main_.c:$(OBJDIR)/main.h $(OBJDIR)/manifest_.c:$(OBJDIR)/manifest.h $(OBJDIR)/markdown_.c:$(OBJDIR)/markdown.h $(OBJDIR)/markdown_html_.c:$(OBJDIR)/markdown_html.h $(OBJDIR)/md5_.c:$(OBJDIR)/md5.h $(OBJDIR)/merge_.c:$(OBJDIR)/merge.h $(OBJDIR)/merge3_.c:$(OBJDIR)/merge3.h $(OBJDIR)/moderate_.c:$(OBJDIR)/moderate.h $(OBJDIR)/name_.c:$(OBJDIR)/name.h $(OBJDIR)/path_.c:$(OBJDIR)/path.h $(OBJDIR)/pivot_.c:$(OBJDIR)/pivot.h $(OBJDIR)/popen_.c:$(OBJDIR)/popen.h $(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h $(OBJDIR)/printf_.c:$(OBJDIR)/printf.h $(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h $(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h $(OBJDIR)/report_.c:$(OBJDIR)/report.h $(OBJDIR)/rss_.c:$(OBJDIR)/rss.h $(OBJDIR)/schema_.c:$(OBJDIR)/schema.h $(OBJDIR)/search_.c:$(OBJDIR)/search.h $(OBJDIR)/setup_.c:$(OBJDIR)/setup.h $(OBJDIR)/sha1_.c:$(OBJDIR)/sha1.h $(OBJDIR)/shun_.c:$(OBJDIR)/shun.h $(OBJDIR)/skins_.c:$(OBJDIR)/skins.h $(OBJDIR)/sqlcmd_.c:$(OBJDIR)/sqlcmd.h $(OBJDIR)/stash_.c:$(OBJDIR)/stash.h $(OBJDIR)/stat_.c:$(OBJDIR)/stat.h $(OBJDIR)/style_.c:$(OBJDIR)/style.h $(OBJDIR)/sync_.c:$(OBJDIR)/sync.h $(OBJDIR)/tag_.c:$(OBJDIR)/tag.h $(OBJDIR)/tar_.c:$(OBJDIR)/tar.h $(OBJDIR)/th_main_.c:$(OBJDIR)/th_main.h $(OBJDIR)/timeline_.c:$(OBJDIR)/timeline.h $(OBJDIR)/tkt_.c:$(OBJDIR)/tkt.h $(OBJDIR)/tktsetup_.c:$(OBJDIR)/tktsetup.h $(OBJDIR)/undo_.c:$(OBJDIR)/undo.h $(OBJDIR)/unicode_.c:$(OBJDIR)/unicode.h $(OBJDIR)/update_.c:$(OBJDIR)/update.h $(OBJDIR)/url_.c:$(OBJDIR)/url.h $(OBJDIR)/user_.c:$(OBJDIR)/user.h $(OBJDIR)/utf8_.c:$(OBJDIR)/utf8.h $(OBJDIR)/util_.c:$(OBJDIR)/util.h $(OBJDIR)/verify_.c:$(OBJDIR)/verify.h $(OBJDIR)/vfile_.c:$(OBJDIR)/vfile.h $(OBJDIR)/wiki_.c:$(OBJDIR)/wiki.h $(OBJDIR)/wikiformat_.c:$(OBJDIR)/wikiformat.h $(OBJDIR)/winfile_.c:$(OBJDIR)/winfile.h $(OBJDIR)/winhttp_.c:$(OBJDIR)/winhttp.h $(OBJDIR)/wysiwyg_.c:$(OBJDIR)/wysiwyg.h $(OBJDIR)/xfer_.c:$(OBJDIR)/xfer.h $(OBJDIR)/xfersetup_.c:$(OBJDIR)/xfersetup.h $(OBJDIR)/zip_.c:$(OBJDIR)/zip.h $(SRCDIR)/sqlite3.h $(SRCDIR)/th.h $(OBJDIR)/VERSION.h
426 touch $(OBJDIR)/headers
427 $(OBJDIR)/headers: Makefile
428 $(OBJDIR)/json.o $(OBJDIR)/json_artifact.o $(OBJDIR)/json_branch.o $(OBJDIR)/json_config.o $(OBJDIR)/json_diff.o $(OBJDIR)/json_dir.o $(OBJDIR)/json_finfo.o $(OBJDIR)/json_login.o $(OBJDIR)/json_query.o $(OBJDIR)/json_report.o $(OBJDIR)/json_status.o $(OBJDIR)/json_tag.o $(OBJDIR)/json_timeline.o $(OBJDIR)/json_user.o $(OBJDIR)/json_wiki.o : $(SRCDIR)/json_detail.h
429 Makefile:
430 $(OBJDIR)/add_.c: $(SRCDIR)/add.c $(OBJDIR)/translate
@@ -803,10 +808,17 @@
803
804 $(OBJDIR)/leaf.o: $(OBJDIR)/leaf_.c $(OBJDIR)/leaf.h $(SRCDIR)/config.h
805 $(XTCC) -o $(OBJDIR)/leaf.o -c $(OBJDIR)/leaf_.c
806
807 $(OBJDIR)/leaf.h: $(OBJDIR)/headers
 
 
 
 
 
 
 
808 $(OBJDIR)/login_.c: $(SRCDIR)/login.c $(OBJDIR)/translate
809 $(OBJDIR)/translate $(SRCDIR)/login.c >$(OBJDIR)/login_.c
810
811 $(OBJDIR)/login.o: $(OBJDIR)/login_.c $(OBJDIR)/login.h $(SRCDIR)/config.h
812 $(XTCC) -o $(OBJDIR)/login.o -c $(OBJDIR)/login_.c
813
--- src/main.mk
+++ src/main.mk
@@ -66,10 +66,11 @@
66 $(SRCDIR)/json_tag.c \
67 $(SRCDIR)/json_timeline.c \
68 $(SRCDIR)/json_user.c \
69 $(SRCDIR)/json_wiki.c \
70 $(SRCDIR)/leaf.c \
71 $(SRCDIR)/loadctrl.c \
72 $(SRCDIR)/login.c \
73 $(SRCDIR)/lookslike.c \
74 $(SRCDIR)/main.c \
75 $(SRCDIR)/manifest.c \
76 $(SRCDIR)/markdown.c \
@@ -176,10 +177,11 @@
177 $(OBJDIR)/json_tag_.c \
178 $(OBJDIR)/json_timeline_.c \
179 $(OBJDIR)/json_user_.c \
180 $(OBJDIR)/json_wiki_.c \
181 $(OBJDIR)/leaf_.c \
182 $(OBJDIR)/loadctrl_.c \
183 $(OBJDIR)/login_.c \
184 $(OBJDIR)/lookslike_.c \
185 $(OBJDIR)/main_.c \
186 $(OBJDIR)/manifest_.c \
187 $(OBJDIR)/markdown_.c \
@@ -286,10 +288,11 @@
288 $(OBJDIR)/json_tag.o \
289 $(OBJDIR)/json_timeline.o \
290 $(OBJDIR)/json_user.o \
291 $(OBJDIR)/json_wiki.o \
292 $(OBJDIR)/leaf.o \
293 $(OBJDIR)/loadctrl.o \
294 $(OBJDIR)/login.o \
295 $(OBJDIR)/lookslike.o \
296 $(OBJDIR)/main.o \
297 $(OBJDIR)/manifest.o \
298 $(OBJDIR)/markdown.o \
@@ -385,11 +388,13 @@
388 -DSQLITE_OMIT_DEPRECATED \
389 -DSQLITE_ENABLE_EXPLAIN_COMMENTS
390
391 # Setup the options used to compile the included SQLite shell.
392 SHELL_OPTIONS = -Dmain=sqlite3_shell \
393 -DSQLITE_OMIT_LOAD_EXTENSION=1 \
394 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \
395 -DSQLITE_SHELL_DBNAME_PROC=fossil_open
396
397 # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set
398 # to 1. If it is set to 1, then there is no need to build or link
399 # the sqlite3.o object. Instead, the system sqlite will be linked
400 # using -lsqlite3.
@@ -420,11 +425,11 @@
425
426
427 $(OBJDIR)/page_index.h: $(TRANS_SRC) $(OBJDIR)/mkindex
428 $(OBJDIR)/mkindex $(TRANS_SRC) >$@
429 $(OBJDIR)/headers: $(OBJDIR)/page_index.h $(OBJDIR)/makeheaders $(OBJDIR)/VERSION.h
430 $(OBJDIR)/makeheaders $(OBJDIR)/add_.c:$(OBJDIR)/add.h $(OBJDIR)/allrepo_.c:$(OBJDIR)/allrepo.h $(OBJDIR)/attach_.c:$(OBJDIR)/attach.h $(OBJDIR)/bag_.c:$(OBJDIR)/bag.h $(OBJDIR)/bisect_.c:$(OBJDIR)/bisect.h $(OBJDIR)/blob_.c:$(OBJDIR)/blob.h $(OBJDIR)/branch_.c:$(OBJDIR)/branch.h $(OBJDIR)/browse_.c:$(OBJDIR)/browse.h $(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h $(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h $(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h $(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h $(OBJDIR)/clearsign_.c:$(OBJDIR)/clearsign.h $(OBJDIR)/clone_.c:$(OBJDIR)/clone.h $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h $(OBJDIR)/configure_.c:$(OBJDIR)/configure.h $(OBJDIR)/content_.c:$(OBJDIR)/content.h $(OBJDIR)/db_.c:$(OBJDIR)/db.h $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h $(OBJDIR)/encode_.c:$(OBJDIR)/encode.h $(OBJDIR)/event_.c:$(OBJDIR)/event.h $(OBJDIR)/export_.c:$(OBJDIR)/export.h $(OBJDIR)/file_.c:$(OBJDIR)/file.h $(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h $(OBJDIR)/http_.c:$(OBJDIR)/http.h $(OBJDIR)/http_socket_.c:$(OBJDIR)/http_socket.h $(OBJDIR)/http_ssl_.c:$(OBJDIR)/http_ssl.h $(OBJDIR)/http_transport_.c:$(OBJDIR)/http_transport.h $(OBJDIR)/import_.c:$(OBJDIR)/import.h $(OBJDIR)/info_.c:$(OBJDIR)/info.h $(OBJDIR)/json_.c:$(OBJDIR)/json.h $(OBJDIR)/json_artifact_.c:$(OBJDIR)/json_artifact.h $(OBJDIR)/json_branch_.c:$(OBJDIR)/json_branch.h $(OBJDIR)/json_config_.c:$(OBJDIR)/json_config.h $(OBJDIR)/json_diff_.c:$(OBJDIR)/json_diff.h $(OBJDIR)/json_dir_.c:$(OBJDIR)/json_dir.h $(OBJDIR)/json_finfo_.c:$(OBJDIR)/json_finfo.h $(OBJDIR)/json_login_.c:$(OBJDIR)/json_login.h $(OBJDIR)/json_query_.c:$(OBJDIR)/json_query.h $(OBJDIR)/json_report_.c:$(OBJDIR)/json_report.h $(OBJDIR)/json_status_.c:$(OBJDIR)/json_status.h $(OBJDIR)/json_tag_.c:$(OBJDIR)/json_tag.h $(OBJDIR)/json_timeline_.c:$(OBJDIR)/json_timeline.h $(OBJDIR)/json_user_.c:$(OBJDIR)/json_user.h $(OBJDIR)/json_wiki_.c:$(OBJDIR)/json_wiki.h $(OBJDIR)/leaf_.c:$(OBJDIR)/leaf.h $(OBJDIR)/loadctrl_.c:$(OBJDIR)/loadctrl.h $(OBJDIR)/login_.c:$(OBJDIR)/login.h $(OBJDIR)/lookslike_.c:$(OBJDIR)/lookslike.h $(OBJDIR)/main_.c:$(OBJDIR)/main.h $(OBJDIR)/manifest_.c:$(OBJDIR)/manifest.h $(OBJDIR)/markdown_.c:$(OBJDIR)/markdown.h $(OBJDIR)/markdown_html_.c:$(OBJDIR)/markdown_html.h $(OBJDIR)/md5_.c:$(OBJDIR)/md5.h $(OBJDIR)/merge_.c:$(OBJDIR)/merge.h $(OBJDIR)/merge3_.c:$(OBJDIR)/merge3.h $(OBJDIR)/moderate_.c:$(OBJDIR)/moderate.h $(OBJDIR)/name_.c:$(OBJDIR)/name.h $(OBJDIR)/path_.c:$(OBJDIR)/path.h $(OBJDIR)/pivot_.c:$(OBJDIR)/pivot.h $(OBJDIR)/popen_.c:$(OBJDIR)/popen.h $(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h $(OBJDIR)/printf_.c:$(OBJDIR)/printf.h $(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h $(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h $(OBJDIR)/report_.c:$(OBJDIR)/report.h $(OBJDIR)/rss_.c:$(OBJDIR)/rss.h $(OBJDIR)/schema_.c:$(OBJDIR)/schema.h $(OBJDIR)/search_.c:$(OBJDIR)/search.h $(OBJDIR)/setup_.c:$(OBJDIR)/setup.h $(OBJDIR)/sha1_.c:$(OBJDIR)/sha1.h $(OBJDIR)/shun_.c:$(OBJDIR)/shun.h $(OBJDIR)/skins_.c:$(OBJDIR)/skins.h $(OBJDIR)/sqlcmd_.c:$(OBJDIR)/sqlcmd.h $(OBJDIR)/stash_.c:$(OBJDIR)/stash.h $(OBJDIR)/stat_.c:$(OBJDIR)/stat.h $(OBJDIR)/style_.c:$(OBJDIR)/style.h $(OBJDIR)/sync_.c:$(OBJDIR)/sync.h $(OBJDIR)/tag_.c:$(OBJDIR)/tag.h $(OBJDIR)/tar_.c:$(OBJDIR)/tar.h $(OBJDIR)/th_main_.c:$(OBJDIR)/th_main.h $(OBJDIR)/timeline_.c:$(OBJDIR)/timeline.h $(OBJDIR)/tkt_.c:$(OBJDIR)/tkt.h $(OBJDIR)/tktsetup_.c:$(OBJDIR)/tktsetup.h $(OBJDIR)/undo_.c:$(OBJDIR)/undo.h $(OBJDIR)/unicode_.c:$(OBJDIR)/unicode.h $(OBJDIR)/update_.c:$(OBJDIR)/update.h $(OBJDIR)/url_.c:$(OBJDIR)/url.h $(OBJDIR)/user_.c:$(OBJDIR)/user.h $(OBJDIR)/utf8_.c:$(OBJDIR)/utf8.h $(OBJDIR)/util_.c:$(OBJDIR)/util.h $(OBJDIR)/verify_.c:$(OBJDIR)/verify.h $(OBJDIR)/vfile_.c:$(OBJDIR)/vfile.h $(OBJDIR)/wiki_.c:$(OBJDIR)/wiki.h $(OBJDIR)/wikiformat_.c:$(OBJDIR)/wikiformat.h $(OBJDIR)/winfile_.c:$(OBJDIR)/winfile.h $(OBJDIR)/winhttp_.c:$(OBJDIR)/winhttp.h $(OBJDIR)/wysiwyg_.c:$(OBJDIR)/wysiwyg.h $(OBJDIR)/xfer_.c:$(OBJDIR)/xfer.h $(OBJDIR)/xfersetup_.c:$(OBJDIR)/xfersetup.h $(OBJDIR)/zip_.c:$(OBJDIR)/zip.h $(SRCDIR)/sqlite3.h $(SRCDIR)/th.h $(OBJDIR)/VERSION.h
431 touch $(OBJDIR)/headers
432 $(OBJDIR)/headers: Makefile
433 $(OBJDIR)/json.o $(OBJDIR)/json_artifact.o $(OBJDIR)/json_branch.o $(OBJDIR)/json_config.o $(OBJDIR)/json_diff.o $(OBJDIR)/json_dir.o $(OBJDIR)/json_finfo.o $(OBJDIR)/json_login.o $(OBJDIR)/json_query.o $(OBJDIR)/json_report.o $(OBJDIR)/json_status.o $(OBJDIR)/json_tag.o $(OBJDIR)/json_timeline.o $(OBJDIR)/json_user.o $(OBJDIR)/json_wiki.o : $(SRCDIR)/json_detail.h
434 Makefile:
435 $(OBJDIR)/add_.c: $(SRCDIR)/add.c $(OBJDIR)/translate
@@ -803,10 +808,17 @@
808
809 $(OBJDIR)/leaf.o: $(OBJDIR)/leaf_.c $(OBJDIR)/leaf.h $(SRCDIR)/config.h
810 $(XTCC) -o $(OBJDIR)/leaf.o -c $(OBJDIR)/leaf_.c
811
812 $(OBJDIR)/leaf.h: $(OBJDIR)/headers
813 $(OBJDIR)/loadctrl_.c: $(SRCDIR)/loadctrl.c $(OBJDIR)/translate
814 $(OBJDIR)/translate $(SRCDIR)/loadctrl.c >$(OBJDIR)/loadctrl_.c
815
816 $(OBJDIR)/loadctrl.o: $(OBJDIR)/loadctrl_.c $(OBJDIR)/loadctrl.h $(SRCDIR)/config.h
817 $(XTCC) -o $(OBJDIR)/loadctrl.o -c $(OBJDIR)/loadctrl_.c
818
819 $(OBJDIR)/loadctrl.h: $(OBJDIR)/headers
820 $(OBJDIR)/login_.c: $(SRCDIR)/login.c $(OBJDIR)/translate
821 $(OBJDIR)/translate $(SRCDIR)/login.c >$(OBJDIR)/login_.c
822
823 $(OBJDIR)/login.o: $(OBJDIR)/login_.c $(OBJDIR)/login.h $(SRCDIR)/config.h
824 $(XTCC) -o $(OBJDIR)/login.o -c $(OBJDIR)/login_.c
825
+59 -22
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -69,10 +69,11 @@
6969
json_tag
7070
json_timeline
7171
json_user
7272
json_wiki
7373
leaf
74
+ loadctrl
7475
login
7576
lookslike
7677
main
7778
manifest
7879
markdown
@@ -146,15 +147,18 @@
146147
# Options used to compile the included SQLite shell.
147148
#
148149
set SHELL_OPTIONS {
149150
-Dmain=sqlite3_shell
150151
-DSQLITE_OMIT_LOAD_EXTENSION=1
152
+ -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE)
153
+ -DSQLITE_SHELL_DBNAME_PROC=fossil_open
151154
}
152155
153156
# Options used to compile the included SQLite shell on Windows.
154157
#
155158
set SHELL_WIN32_OPTIONS $SHELL_OPTIONS
159
+lappend SHELL_WIN32_OPTIONS -Daccess=win32_access
156160
lappend SHELL_WIN32_OPTIONS -Dgetenv=fossil_getenv
157161
lappend SHELL_WIN32_OPTIONS -Dfopen=fossil_fopen
158162
159163
# Name of the final application
160164
#
@@ -795,11 +799,11 @@
795799
writeln "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c \$(OBJDIR)/${s}_.c\n"
796800
writeln "\$(OBJDIR)/${s}.h:\t\$(OBJDIR)/headers\n"
797801
}
798802
799803
set MINGW_SQLITE_OPTIONS $SQLITE_OPTIONS
800
-lappend MINGW_SQLITE_OPTIONS -D_HAVE_SQLITE_CONFIG_H
804
+lappend MINGW_SQLITE_OPTIONS -D_HAVE__MINGW_H
801805
lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MALLOC_H
802806
lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MSIZE
803807
804808
set j " \\\n "
805809
writeln "SQLITE_OPTIONS = [join $MINGW_SQLITE_OPTIONS $j]\n"
@@ -1015,54 +1019,78 @@
10151019
# Uncomment to enable JSON API
10161020
# FOSSIL_ENABLE_JSON = 1
10171021
10181022
# Uncomment to enable SSL support
10191023
# FOSSIL_ENABLE_SSL = 1
1024
+
1025
+# Uncomment to enable Tcl support
1026
+# FOSSIL_ENABLE_TCL = 1
10201027
10211028
!ifdef FOSSIL_ENABLE_SSL
10221029
SSLINCDIR = $(B)\compat\openssl-1.0.1f\include
10231030
SSLLIBDIR = $(B)\compat\openssl-1.0.1f\out32
10241031
SSLLIB = ssleay32.lib libeay32.lib user32.lib gdi32.lib
10251032
!endif
1033
+
1034
+!ifdef FOSSIL_ENABLE_TCL
1035
+TCLDIR = $(B)\compat\tcl-8.6
1036
+TCLSRCDIR = $(TCLDIR)
1037
+TCLINCDIR = $(TCLSRCDIR)\generic
1038
+!endif
10261039
10271040
# zlib options
10281041
ZINCDIR = $(B)\compat\zlib
10291042
ZLIBDIR = $(B)\compat\zlib
10301043
ZLIB = zlib.lib
10311044
1032
-INCL = -I. -I$(SRCDIR) -I$B\win\include -I$(ZINCDIR)
1045
+INCL = /I. /I$(SRCDIR) /I$B\win\include /I$(ZINCDIR)
10331046
10341047
!ifdef FOSSIL_ENABLE_SSL
1035
-INCL = $(INCL) -I$(SSLINCDIR)
1048
+INCL = $(INCL) /I$(SSLINCDIR)
1049
+!endif
1050
+
1051
+!ifdef FOSSIL_ENABLE_TCL
1052
+INCL = $(INCL) /I$(TCLINCDIR)
10361053
!endif
10371054
1038
-CFLAGS = -nologo
1055
+CFLAGS = /nologo
10391056
LDFLAGS = /NODEFAULTLIB:msvcrt /MANIFEST:NO
10401057
10411058
!ifdef DEBUG
1042
-CFLAGS = $(CFLAGS) -Zi -MTd -Od
1059
+CFLAGS = $(CFLAGS) /Zi /MTd /Od
10431060
LDFLAGS = $(LDFLAGS) /DEBUG
10441061
!else
1045
-CFLAGS = $(CFLAGS) -MT -O2
1062
+CFLAGS = $(CFLAGS) /MT /O2
10461063
!endif
10471064
10481065
BCC = $(CC) $(CFLAGS)
1049
-TCC = $(CC) -c $(CFLAGS) $(MSCDEF) $(INCL)
1050
-RCC = rc -D_WIN32 -D_MSC_VER $(MSCDEF) $(INCL)
1066
+TCC = $(CC) /c $(CFLAGS) $(MSCDEF) $(INCL)
1067
+RCC = rc /D_WIN32 /D_MSC_VER $(MSCDEF) $(INCL)
10511068
LIBS = $(ZLIB) ws2_32.lib advapi32.lib
1052
-LIBDIR = -LIBPATH:$(ZLIBDIR)
1069
+LIBDIR = /LIBPATH:$(ZLIBDIR)
10531070
10541071
!ifdef FOSSIL_ENABLE_JSON
1055
-TCC = $(TCC) -DFOSSIL_ENABLE_JSON=1
1056
-RCC = $(RCC) -DFOSSIL_ENABLE_JSON=1
1072
+TCC = $(TCC) /DFOSSIL_ENABLE_JSON=1
1073
+RCC = $(RCC) /DFOSSIL_ENABLE_JSON=1
10571074
!endif
10581075
10591076
!ifdef FOSSIL_ENABLE_SSL
1060
-TCC = $(TCC) -DFOSSIL_ENABLE_SSL=1
1061
-RCC = $(RCC) -DFOSSIL_ENABLE_SSL=1
1077
+TCC = $(TCC) /DFOSSIL_ENABLE_SSL=1
1078
+RCC = $(RCC) /DFOSSIL_ENABLE_SSL=1
10621079
LIBS = $(LIBS) $(SSLLIB)
1063
-LIBDIR = $(LIBDIR) -LIBPATH:$(SSLLIBDIR)
1080
+LIBDIR = $(LIBDIR) /LIBPATH:$(SSLLIBDIR)
1081
+!endif
1082
+
1083
+!ifdef FOSSIL_ENABLE_TCL
1084
+TCC = $(TCC) /DFOSSIL_ENABLE_TCL=1
1085
+RCC = $(RCC) /DFOSSIL_ENABLE_TCL=1
1086
+TCC = $(TCC) /DFOSSIL_ENABLE_TCL_STUBS=1
1087
+RCC = $(RCC) /DFOSSIL_ENABLE_TCL_STUBS=1
1088
+TCC = $(TCC) /DFOSSIL_ENABLE_TCL_PRIVATE_STUBS=1
1089
+RCC = $(RCC) /DFOSSIL_ENABLE_TCL_PRIVATE_STUBS=1
1090
+TCC = $(TCC) /DUSE_TCL_STUBS=1
1091
+RCC = $(RCC) /DUSE_TCL_STUBS=1
10641092
!endif
10651093
}
10661094
regsub -all {[-]D} [join $SQLITE_OPTIONS { }] {/D} MSC_SQLITE_OPTIONS
10671095
set j " \\\n "
10681096
writeln "SQLITE_OPTIONS = [join $MSC_SQLITE_OPTIONS $j]\n"
@@ -1090,11 +1118,14 @@
10901118
writeln -nonewline " "
10911119
}
10921120
writeln -nonewline "\$(OX)\\$s\$O"; incr i
10931121
}
10941122
writeln " \\"
1095
-writeln -nonewline " \$(OX)\\fossil.res\n"
1123
+writeln -nonewline " \$(OX)\\fossil.res\n\n"
1124
+writeln "!ifdef FOSSIL_ENABLE_TCL"
1125
+writeln "OBJ = \$(OBJ) \$(OX)\\th_tcl\$O"
1126
+writeln "!endif"
10961127
writeln {
10971128
APPNAME = $(OX)\fossil$(E)
10981129
PDBNAME = $(OX)\fossil$(P)
10991130
11001131
all: $(OX) $(APPNAME)
@@ -1103,22 +1134,24 @@
11031134
@echo Building zlib from "$(ZLIBDIR)"...
11041135
@pushd "$(ZLIBDIR)" && nmake /f win32\Makefile.msc $(ZLIB) && popd
11051136
11061137
$(APPNAME) : translate$E mkindex$E headers $(OBJ) $(OX)\linkopts zlib
11071138
cd $(OX)
1108
- link $(LDFLAGS) -OUT:$@ $(LIBDIR) Wsetargv.obj fossil.res @linkopts
1139
+ link $(LDFLAGS) /OUT:$@ $(LIBDIR) Wsetargv.obj fossil.res @linkopts
11091140
11101141
$(OX)\linkopts: $B\win\Makefile.msc}
11111142
set redir {>}
11121143
foreach s [lsort [concat $src $AdditionalObj]] {
11131144
writeln "\techo \$(OX)\\$s.obj $redir \$@"
11141145
set redir {>>}
11151146
}
1116
-writeln "\techo \$(LIBS) >> \$@\n\n"
1117
-
1147
+writeln "!ifdef FOSSIL_ENABLE_TCL"
1148
+writeln "\techo \$(OX)\\th_tcl.obj $redir \$@"
1149
+set redir {>>}
1150
+writeln "!endif"
1151
+writeln "\techo \$(LIBS) $redir \$@"
11181152
writeln {
1119
-
11201153
$(OX):
11211154
@-mkdir $@
11221155
11231156
translate$E: $(SRCDIR)\translate.c
11241157
$(BCC) $**
@@ -1141,15 +1174,20 @@
11411174
$(OX)\th$O : $(SRCDIR)\th.c
11421175
$(TCC) /Fo$@ -c $**
11431176
11441177
$(OX)\th_lang$O : $(SRCDIR)\th_lang.c
11451178
$(TCC) /Fo$@ -c $**
1179
+
1180
+!ifdef FOSSIL_ENABLE_TCL
1181
+$(OX)\th_tcl$O : $(SRCDIR)\th_tcl.c
1182
+ $(TCC) /Fo$@ -c $**
1183
+!endif
11461184
11471185
VERSION.h : mkversion$E $B\manifest.uuid $B\manifest $B\VERSION
11481186
$** > $@
11491187
$(OX)\cson_amalgamation$O : $(SRCDIR)\cson_amalgamation.c
1150
- $(TCC) /Fo$@ -c $**
1188
+ $(TCC) /Fo$@ /c $**
11511189
11521190
page_index.h: mkindex$E $(SRC)
11531191
$** > $@
11541192
11551193
clean:
@@ -1184,21 +1222,20 @@
11841222
$(OBJDIR)\json_status$O : $(SRCDIR)\json_detail.h
11851223
$(OBJDIR)\json_tag$O : $(SRCDIR)\json_detail.h
11861224
$(OBJDIR)\json_timeline$O : $(SRCDIR)\json_detail.h
11871225
$(OBJDIR)\json_user$O : $(SRCDIR)\json_detail.h
11881226
$(OBJDIR)\json_wiki$O : $(SRCDIR)\json_detail.h
1189
-
11901227
}
11911228
foreach s [lsort $src] {
11921229
writeln "\$(OX)\\$s\$O : ${s}_.c ${s}.h"
11931230
writeln "\t\$(TCC) /Fo\$@ -c ${s}_.c\n"
11941231
writeln "${s}_.c : \$(SRCDIR)\\$s.c"
11951232
writeln "\ttranslate\$E \$** > \$@\n"
11961233
}
11971234
11981235
writeln "fossil.res : \$B\\win\\fossil.rc"
1199
-writeln "\t\$(RCC) -fo \$@ \$**"
1236
+writeln "\t\$(RCC) /fo \$@ \$**\n"
12001237
12011238
writeln "headers: makeheaders\$E page_index.h VERSION.h"
12021239
writeln -nonewline "\tmakeheaders\$E "
12031240
set i 0
12041241
foreach s [lsort $src] {
12051242
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -69,10 +69,11 @@
69 json_tag
70 json_timeline
71 json_user
72 json_wiki
73 leaf
 
74 login
75 lookslike
76 main
77 manifest
78 markdown
@@ -146,15 +147,18 @@
146 # Options used to compile the included SQLite shell.
147 #
148 set SHELL_OPTIONS {
149 -Dmain=sqlite3_shell
150 -DSQLITE_OMIT_LOAD_EXTENSION=1
 
 
151 }
152
153 # Options used to compile the included SQLite shell on Windows.
154 #
155 set SHELL_WIN32_OPTIONS $SHELL_OPTIONS
 
156 lappend SHELL_WIN32_OPTIONS -Dgetenv=fossil_getenv
157 lappend SHELL_WIN32_OPTIONS -Dfopen=fossil_fopen
158
159 # Name of the final application
160 #
@@ -795,11 +799,11 @@
795 writeln "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c \$(OBJDIR)/${s}_.c\n"
796 writeln "\$(OBJDIR)/${s}.h:\t\$(OBJDIR)/headers\n"
797 }
798
799 set MINGW_SQLITE_OPTIONS $SQLITE_OPTIONS
800 lappend MINGW_SQLITE_OPTIONS -D_HAVE_SQLITE_CONFIG_H
801 lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MALLOC_H
802 lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MSIZE
803
804 set j " \\\n "
805 writeln "SQLITE_OPTIONS = [join $MINGW_SQLITE_OPTIONS $j]\n"
@@ -1015,54 +1019,78 @@
1015 # Uncomment to enable JSON API
1016 # FOSSIL_ENABLE_JSON = 1
1017
1018 # Uncomment to enable SSL support
1019 # FOSSIL_ENABLE_SSL = 1
 
 
 
1020
1021 !ifdef FOSSIL_ENABLE_SSL
1022 SSLINCDIR = $(B)\compat\openssl-1.0.1f\include
1023 SSLLIBDIR = $(B)\compat\openssl-1.0.1f\out32
1024 SSLLIB = ssleay32.lib libeay32.lib user32.lib gdi32.lib
1025 !endif
 
 
 
 
 
 
1026
1027 # zlib options
1028 ZINCDIR = $(B)\compat\zlib
1029 ZLIBDIR = $(B)\compat\zlib
1030 ZLIB = zlib.lib
1031
1032 INCL = -I. -I$(SRCDIR) -I$B\win\include -I$(ZINCDIR)
1033
1034 !ifdef FOSSIL_ENABLE_SSL
1035 INCL = $(INCL) -I$(SSLINCDIR)
 
 
 
 
1036 !endif
1037
1038 CFLAGS = -nologo
1039 LDFLAGS = /NODEFAULTLIB:msvcrt /MANIFEST:NO
1040
1041 !ifdef DEBUG
1042 CFLAGS = $(CFLAGS) -Zi -MTd -Od
1043 LDFLAGS = $(LDFLAGS) /DEBUG
1044 !else
1045 CFLAGS = $(CFLAGS) -MT -O2
1046 !endif
1047
1048 BCC = $(CC) $(CFLAGS)
1049 TCC = $(CC) -c $(CFLAGS) $(MSCDEF) $(INCL)
1050 RCC = rc -D_WIN32 -D_MSC_VER $(MSCDEF) $(INCL)
1051 LIBS = $(ZLIB) ws2_32.lib advapi32.lib
1052 LIBDIR = -LIBPATH:$(ZLIBDIR)
1053
1054 !ifdef FOSSIL_ENABLE_JSON
1055 TCC = $(TCC) -DFOSSIL_ENABLE_JSON=1
1056 RCC = $(RCC) -DFOSSIL_ENABLE_JSON=1
1057 !endif
1058
1059 !ifdef FOSSIL_ENABLE_SSL
1060 TCC = $(TCC) -DFOSSIL_ENABLE_SSL=1
1061 RCC = $(RCC) -DFOSSIL_ENABLE_SSL=1
1062 LIBS = $(LIBS) $(SSLLIB)
1063 LIBDIR = $(LIBDIR) -LIBPATH:$(SSLLIBDIR)
 
 
 
 
 
 
 
 
 
 
 
1064 !endif
1065 }
1066 regsub -all {[-]D} [join $SQLITE_OPTIONS { }] {/D} MSC_SQLITE_OPTIONS
1067 set j " \\\n "
1068 writeln "SQLITE_OPTIONS = [join $MSC_SQLITE_OPTIONS $j]\n"
@@ -1090,11 +1118,14 @@
1090 writeln -nonewline " "
1091 }
1092 writeln -nonewline "\$(OX)\\$s\$O"; incr i
1093 }
1094 writeln " \\"
1095 writeln -nonewline " \$(OX)\\fossil.res\n"
 
 
 
1096 writeln {
1097 APPNAME = $(OX)\fossil$(E)
1098 PDBNAME = $(OX)\fossil$(P)
1099
1100 all: $(OX) $(APPNAME)
@@ -1103,22 +1134,24 @@
1103 @echo Building zlib from "$(ZLIBDIR)"...
1104 @pushd "$(ZLIBDIR)" && nmake /f win32\Makefile.msc $(ZLIB) && popd
1105
1106 $(APPNAME) : translate$E mkindex$E headers $(OBJ) $(OX)\linkopts zlib
1107 cd $(OX)
1108 link $(LDFLAGS) -OUT:$@ $(LIBDIR) Wsetargv.obj fossil.res @linkopts
1109
1110 $(OX)\linkopts: $B\win\Makefile.msc}
1111 set redir {>}
1112 foreach s [lsort [concat $src $AdditionalObj]] {
1113 writeln "\techo \$(OX)\\$s.obj $redir \$@"
1114 set redir {>>}
1115 }
1116 writeln "\techo \$(LIBS) >> \$@\n\n"
1117
 
 
 
1118 writeln {
1119
1120 $(OX):
1121 @-mkdir $@
1122
1123 translate$E: $(SRCDIR)\translate.c
1124 $(BCC) $**
@@ -1141,15 +1174,20 @@
1141 $(OX)\th$O : $(SRCDIR)\th.c
1142 $(TCC) /Fo$@ -c $**
1143
1144 $(OX)\th_lang$O : $(SRCDIR)\th_lang.c
1145 $(TCC) /Fo$@ -c $**
 
 
 
 
 
1146
1147 VERSION.h : mkversion$E $B\manifest.uuid $B\manifest $B\VERSION
1148 $** > $@
1149 $(OX)\cson_amalgamation$O : $(SRCDIR)\cson_amalgamation.c
1150 $(TCC) /Fo$@ -c $**
1151
1152 page_index.h: mkindex$E $(SRC)
1153 $** > $@
1154
1155 clean:
@@ -1184,21 +1222,20 @@
1184 $(OBJDIR)\json_status$O : $(SRCDIR)\json_detail.h
1185 $(OBJDIR)\json_tag$O : $(SRCDIR)\json_detail.h
1186 $(OBJDIR)\json_timeline$O : $(SRCDIR)\json_detail.h
1187 $(OBJDIR)\json_user$O : $(SRCDIR)\json_detail.h
1188 $(OBJDIR)\json_wiki$O : $(SRCDIR)\json_detail.h
1189
1190 }
1191 foreach s [lsort $src] {
1192 writeln "\$(OX)\\$s\$O : ${s}_.c ${s}.h"
1193 writeln "\t\$(TCC) /Fo\$@ -c ${s}_.c\n"
1194 writeln "${s}_.c : \$(SRCDIR)\\$s.c"
1195 writeln "\ttranslate\$E \$** > \$@\n"
1196 }
1197
1198 writeln "fossil.res : \$B\\win\\fossil.rc"
1199 writeln "\t\$(RCC) -fo \$@ \$**"
1200
1201 writeln "headers: makeheaders\$E page_index.h VERSION.h"
1202 writeln -nonewline "\tmakeheaders\$E "
1203 set i 0
1204 foreach s [lsort $src] {
1205
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -69,10 +69,11 @@
69 json_tag
70 json_timeline
71 json_user
72 json_wiki
73 leaf
74 loadctrl
75 login
76 lookslike
77 main
78 manifest
79 markdown
@@ -146,15 +147,18 @@
147 # Options used to compile the included SQLite shell.
148 #
149 set SHELL_OPTIONS {
150 -Dmain=sqlite3_shell
151 -DSQLITE_OMIT_LOAD_EXTENSION=1
152 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE)
153 -DSQLITE_SHELL_DBNAME_PROC=fossil_open
154 }
155
156 # Options used to compile the included SQLite shell on Windows.
157 #
158 set SHELL_WIN32_OPTIONS $SHELL_OPTIONS
159 lappend SHELL_WIN32_OPTIONS -Daccess=win32_access
160 lappend SHELL_WIN32_OPTIONS -Dgetenv=fossil_getenv
161 lappend SHELL_WIN32_OPTIONS -Dfopen=fossil_fopen
162
163 # Name of the final application
164 #
@@ -795,11 +799,11 @@
799 writeln "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c \$(OBJDIR)/${s}_.c\n"
800 writeln "\$(OBJDIR)/${s}.h:\t\$(OBJDIR)/headers\n"
801 }
802
803 set MINGW_SQLITE_OPTIONS $SQLITE_OPTIONS
804 lappend MINGW_SQLITE_OPTIONS -D_HAVE__MINGW_H
805 lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MALLOC_H
806 lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MSIZE
807
808 set j " \\\n "
809 writeln "SQLITE_OPTIONS = [join $MINGW_SQLITE_OPTIONS $j]\n"
@@ -1015,54 +1019,78 @@
1019 # Uncomment to enable JSON API
1020 # FOSSIL_ENABLE_JSON = 1
1021
1022 # Uncomment to enable SSL support
1023 # FOSSIL_ENABLE_SSL = 1
1024
1025 # Uncomment to enable Tcl support
1026 # FOSSIL_ENABLE_TCL = 1
1027
1028 !ifdef FOSSIL_ENABLE_SSL
1029 SSLINCDIR = $(B)\compat\openssl-1.0.1f\include
1030 SSLLIBDIR = $(B)\compat\openssl-1.0.1f\out32
1031 SSLLIB = ssleay32.lib libeay32.lib user32.lib gdi32.lib
1032 !endif
1033
1034 !ifdef FOSSIL_ENABLE_TCL
1035 TCLDIR = $(B)\compat\tcl-8.6
1036 TCLSRCDIR = $(TCLDIR)
1037 TCLINCDIR = $(TCLSRCDIR)\generic
1038 !endif
1039
1040 # zlib options
1041 ZINCDIR = $(B)\compat\zlib
1042 ZLIBDIR = $(B)\compat\zlib
1043 ZLIB = zlib.lib
1044
1045 INCL = /I. /I$(SRCDIR) /I$B\win\include /I$(ZINCDIR)
1046
1047 !ifdef FOSSIL_ENABLE_SSL
1048 INCL = $(INCL) /I$(SSLINCDIR)
1049 !endif
1050
1051 !ifdef FOSSIL_ENABLE_TCL
1052 INCL = $(INCL) /I$(TCLINCDIR)
1053 !endif
1054
1055 CFLAGS = /nologo
1056 LDFLAGS = /NODEFAULTLIB:msvcrt /MANIFEST:NO
1057
1058 !ifdef DEBUG
1059 CFLAGS = $(CFLAGS) /Zi /MTd /Od
1060 LDFLAGS = $(LDFLAGS) /DEBUG
1061 !else
1062 CFLAGS = $(CFLAGS) /MT /O2
1063 !endif
1064
1065 BCC = $(CC) $(CFLAGS)
1066 TCC = $(CC) /c $(CFLAGS) $(MSCDEF) $(INCL)
1067 RCC = rc /D_WIN32 /D_MSC_VER $(MSCDEF) $(INCL)
1068 LIBS = $(ZLIB) ws2_32.lib advapi32.lib
1069 LIBDIR = /LIBPATH:$(ZLIBDIR)
1070
1071 !ifdef FOSSIL_ENABLE_JSON
1072 TCC = $(TCC) /DFOSSIL_ENABLE_JSON=1
1073 RCC = $(RCC) /DFOSSIL_ENABLE_JSON=1
1074 !endif
1075
1076 !ifdef FOSSIL_ENABLE_SSL
1077 TCC = $(TCC) /DFOSSIL_ENABLE_SSL=1
1078 RCC = $(RCC) /DFOSSIL_ENABLE_SSL=1
1079 LIBS = $(LIBS) $(SSLLIB)
1080 LIBDIR = $(LIBDIR) /LIBPATH:$(SSLLIBDIR)
1081 !endif
1082
1083 !ifdef FOSSIL_ENABLE_TCL
1084 TCC = $(TCC) /DFOSSIL_ENABLE_TCL=1
1085 RCC = $(RCC) /DFOSSIL_ENABLE_TCL=1
1086 TCC = $(TCC) /DFOSSIL_ENABLE_TCL_STUBS=1
1087 RCC = $(RCC) /DFOSSIL_ENABLE_TCL_STUBS=1
1088 TCC = $(TCC) /DFOSSIL_ENABLE_TCL_PRIVATE_STUBS=1
1089 RCC = $(RCC) /DFOSSIL_ENABLE_TCL_PRIVATE_STUBS=1
1090 TCC = $(TCC) /DUSE_TCL_STUBS=1
1091 RCC = $(RCC) /DUSE_TCL_STUBS=1
1092 !endif
1093 }
1094 regsub -all {[-]D} [join $SQLITE_OPTIONS { }] {/D} MSC_SQLITE_OPTIONS
1095 set j " \\\n "
1096 writeln "SQLITE_OPTIONS = [join $MSC_SQLITE_OPTIONS $j]\n"
@@ -1090,11 +1118,14 @@
1118 writeln -nonewline " "
1119 }
1120 writeln -nonewline "\$(OX)\\$s\$O"; incr i
1121 }
1122 writeln " \\"
1123 writeln -nonewline " \$(OX)\\fossil.res\n\n"
1124 writeln "!ifdef FOSSIL_ENABLE_TCL"
1125 writeln "OBJ = \$(OBJ) \$(OX)\\th_tcl\$O"
1126 writeln "!endif"
1127 writeln {
1128 APPNAME = $(OX)\fossil$(E)
1129 PDBNAME = $(OX)\fossil$(P)
1130
1131 all: $(OX) $(APPNAME)
@@ -1103,22 +1134,24 @@
1134 @echo Building zlib from "$(ZLIBDIR)"...
1135 @pushd "$(ZLIBDIR)" && nmake /f win32\Makefile.msc $(ZLIB) && popd
1136
1137 $(APPNAME) : translate$E mkindex$E headers $(OBJ) $(OX)\linkopts zlib
1138 cd $(OX)
1139 link $(LDFLAGS) /OUT:$@ $(LIBDIR) Wsetargv.obj fossil.res @linkopts
1140
1141 $(OX)\linkopts: $B\win\Makefile.msc}
1142 set redir {>}
1143 foreach s [lsort [concat $src $AdditionalObj]] {
1144 writeln "\techo \$(OX)\\$s.obj $redir \$@"
1145 set redir {>>}
1146 }
1147 writeln "!ifdef FOSSIL_ENABLE_TCL"
1148 writeln "\techo \$(OX)\\th_tcl.obj $redir \$@"
1149 set redir {>>}
1150 writeln "!endif"
1151 writeln "\techo \$(LIBS) $redir \$@"
1152 writeln {
 
1153 $(OX):
1154 @-mkdir $@
1155
1156 translate$E: $(SRCDIR)\translate.c
1157 $(BCC) $**
@@ -1141,15 +1174,20 @@
1174 $(OX)\th$O : $(SRCDIR)\th.c
1175 $(TCC) /Fo$@ -c $**
1176
1177 $(OX)\th_lang$O : $(SRCDIR)\th_lang.c
1178 $(TCC) /Fo$@ -c $**
1179
1180 !ifdef FOSSIL_ENABLE_TCL
1181 $(OX)\th_tcl$O : $(SRCDIR)\th_tcl.c
1182 $(TCC) /Fo$@ -c $**
1183 !endif
1184
1185 VERSION.h : mkversion$E $B\manifest.uuid $B\manifest $B\VERSION
1186 $** > $@
1187 $(OX)\cson_amalgamation$O : $(SRCDIR)\cson_amalgamation.c
1188 $(TCC) /Fo$@ /c $**
1189
1190 page_index.h: mkindex$E $(SRC)
1191 $** > $@
1192
1193 clean:
@@ -1184,21 +1222,20 @@
1222 $(OBJDIR)\json_status$O : $(SRCDIR)\json_detail.h
1223 $(OBJDIR)\json_tag$O : $(SRCDIR)\json_detail.h
1224 $(OBJDIR)\json_timeline$O : $(SRCDIR)\json_detail.h
1225 $(OBJDIR)\json_user$O : $(SRCDIR)\json_detail.h
1226 $(OBJDIR)\json_wiki$O : $(SRCDIR)\json_detail.h
 
1227 }
1228 foreach s [lsort $src] {
1229 writeln "\$(OX)\\$s\$O : ${s}_.c ${s}.h"
1230 writeln "\t\$(TCC) /Fo\$@ -c ${s}_.c\n"
1231 writeln "${s}_.c : \$(SRCDIR)\\$s.c"
1232 writeln "\ttranslate\$E \$** > \$@\n"
1233 }
1234
1235 writeln "fossil.res : \$B\\win\\fossil.rc"
1236 writeln "\t\$(RCC) /fo \$@ \$**\n"
1237
1238 writeln "headers: makeheaders\$E page_index.h VERSION.h"
1239 writeln -nonewline "\tmakeheaders\$E "
1240 set i 0
1241 foreach s [lsort $src] {
1242
--- src/mkversion.c
+++ src/mkversion.c
@@ -69,7 +69,21 @@
6969
}
7070
}
7171
printf("#define RELEASE_RESOURCE_VERSION %s", vx);
7272
while( d<3 ){ printf(",0"); d++; }
7373
printf("\n");
74
+#if defined(__DMC__) /* e.g. 0x857 */
75
+ d = (__DMC__ & 0xF00) >> 8; /* major */
76
+ x = (__DMC__ & 0x0F0) >> 4; /* minor */
77
+ i = (__DMC__ & 0x00F); /* revision */
78
+ printf("#define COMPILER_VERSION \"%d.%d.%d\"\n", d, x, i);
79
+#elif defined(__POCC__) /* e.g. 700 */
80
+ d = (__POCC__ / 100); /* major */
81
+ x = (__POCC__ % 100); /* minor */
82
+ printf("#define COMPILER_VERSION \"%d.%02d\"\n", d, x);
83
+#elif defined(_MSC_VER) /* e.g. 1800 */
84
+ d = (_MSC_VER / 100); /* major */
85
+ x = (_MSC_VER % 100); /* minor */
86
+ printf("#define COMPILER_VERSION \"%d.%02d\"\n", d, x);
87
+#endif
7488
return 0;
7589
}
7690
--- src/mkversion.c
+++ src/mkversion.c
@@ -69,7 +69,21 @@
69 }
70 }
71 printf("#define RELEASE_RESOURCE_VERSION %s", vx);
72 while( d<3 ){ printf(",0"); d++; }
73 printf("\n");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74 return 0;
75 }
76
--- src/mkversion.c
+++ src/mkversion.c
@@ -69,7 +69,21 @@
69 }
70 }
71 printf("#define RELEASE_RESOURCE_VERSION %s", vx);
72 while( d<3 ){ printf(",0"); d++; }
73 printf("\n");
74 #if defined(__DMC__) /* e.g. 0x857 */
75 d = (__DMC__ & 0xF00) >> 8; /* major */
76 x = (__DMC__ & 0x0F0) >> 4; /* minor */
77 i = (__DMC__ & 0x00F); /* revision */
78 printf("#define COMPILER_VERSION \"%d.%d.%d\"\n", d, x, i);
79 #elif defined(__POCC__) /* e.g. 700 */
80 d = (__POCC__ / 100); /* major */
81 x = (__POCC__ % 100); /* minor */
82 printf("#define COMPILER_VERSION \"%d.%02d\"\n", d, x);
83 #elif defined(_MSC_VER) /* e.g. 1800 */
84 d = (_MSC_VER / 100); /* major */
85 x = (_MSC_VER % 100); /* minor */
86 printf("#define COMPILER_VERSION \"%d.%02d\"\n", d, x);
87 #endif
88 return 0;
89 }
90
+7 -2
--- src/rebuild.c
+++ src/rebuild.c
@@ -793,11 +793,10 @@
793793
db_close(1);
794794
db_open_repository(g.zRepositoryName);
795795
if( !bForce ){
796796
Blob ans;
797797
char cReply;
798
- blob_zero(&ans);
799798
prompt_user(
800799
"Scrubbing the repository will permanently delete information.\n"
801800
"Changes cannot be undone. Continue (y/N)? ", &ans);
802801
cReply = blob_str(&ans)[0];
803802
if( cReply!='y' && cReply!='Y' ){
@@ -859,11 +858,17 @@
859858
continue;
860859
}
861860
zUtf8Name = fossil_filename_to_utf8(pEntry->d_name);
862861
zSubpath = mprintf("%s/%s", zPath, zUtf8Name);
863862
fossil_filename_free(zUtf8Name);
864
- if( file_isdir(zSubpath)==1 ){
863
+#ifdef _DIRENT_HAVE_D_TYPE
864
+ if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK)
865
+ ? (file_isdir(zSubpath)==1) : (pEntry->d_type==DT_DIR) )
866
+#else
867
+ if( file_isdir(zSubpath)==1 )
868
+#endif
869
+ {
865870
recon_read_dir(zSubpath);
866871
}else{
867872
blob_init(&path, 0, 0);
868873
blob_appendf(&path, "%s", zSubpath);
869874
if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){
870875
--- src/rebuild.c
+++ src/rebuild.c
@@ -793,11 +793,10 @@
793 db_close(1);
794 db_open_repository(g.zRepositoryName);
795 if( !bForce ){
796 Blob ans;
797 char cReply;
798 blob_zero(&ans);
799 prompt_user(
800 "Scrubbing the repository will permanently delete information.\n"
801 "Changes cannot be undone. Continue (y/N)? ", &ans);
802 cReply = blob_str(&ans)[0];
803 if( cReply!='y' && cReply!='Y' ){
@@ -859,11 +858,17 @@
859 continue;
860 }
861 zUtf8Name = fossil_filename_to_utf8(pEntry->d_name);
862 zSubpath = mprintf("%s/%s", zPath, zUtf8Name);
863 fossil_filename_free(zUtf8Name);
864 if( file_isdir(zSubpath)==1 ){
 
 
 
 
 
 
865 recon_read_dir(zSubpath);
866 }else{
867 blob_init(&path, 0, 0);
868 blob_appendf(&path, "%s", zSubpath);
869 if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){
870
--- src/rebuild.c
+++ src/rebuild.c
@@ -793,11 +793,10 @@
793 db_close(1);
794 db_open_repository(g.zRepositoryName);
795 if( !bForce ){
796 Blob ans;
797 char cReply;
 
798 prompt_user(
799 "Scrubbing the repository will permanently delete information.\n"
800 "Changes cannot be undone. Continue (y/N)? ", &ans);
801 cReply = blob_str(&ans)[0];
802 if( cReply!='y' && cReply!='Y' ){
@@ -859,11 +858,17 @@
858 continue;
859 }
860 zUtf8Name = fossil_filename_to_utf8(pEntry->d_name);
861 zSubpath = mprintf("%s/%s", zPath, zUtf8Name);
862 fossil_filename_free(zUtf8Name);
863 #ifdef _DIRENT_HAVE_D_TYPE
864 if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK)
865 ? (file_isdir(zSubpath)==1) : (pEntry->d_type==DT_DIR) )
866 #else
867 if( file_isdir(zSubpath)==1 )
868 #endif
869 {
870 recon_read_dir(zSubpath);
871 }else{
872 blob_init(&path, 0, 0);
873 blob_appendf(&path, "%s", zSubpath);
874 if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){
875
+1 -1
--- src/report.c
+++ src/report.c
@@ -925,11 +925,11 @@
925925
if( xCallback(pArg, nCol, azVals, azCols) ){
926926
break;
927927
}
928928
}
929929
rc = sqlite3_finalize(pStmt);
930
- fossil_free(azVals);
930
+ fossil_free((void *)azVals);
931931
return rc;
932932
}
933933
934934
/*
935935
** Output Javascript code that will enables sorting of the table with
936936
--- src/report.c
+++ src/report.c
@@ -925,11 +925,11 @@
925 if( xCallback(pArg, nCol, azVals, azCols) ){
926 break;
927 }
928 }
929 rc = sqlite3_finalize(pStmt);
930 fossil_free(azVals);
931 return rc;
932 }
933
934 /*
935 ** Output Javascript code that will enables sorting of the table with
936
--- src/report.c
+++ src/report.c
@@ -925,11 +925,11 @@
925 if( xCallback(pArg, nCol, azVals, azCols) ){
926 break;
927 }
928 }
929 rc = sqlite3_finalize(pStmt);
930 fossil_free((void *)azVals);
931 return rc;
932 }
933
934 /*
935 ** Output Javascript code that will enables sorting of the table with
936
+9 -9
--- src/schema.c
+++ src/schema.c
@@ -21,11 +21,11 @@
2121
#include "schema.h"
2222
2323
/*
2424
** The database schema for the ~/.fossil configuration database.
2525
*/
26
-const char zConfigSchema[] =
26
+const char zConfigSchema[] =
2727
@ -- This file contains the schema for the database that is kept in the
2828
@ -- ~/.fossil file and that stores information about the users setup.
2929
@ --
3030
@ CREATE TABLE global_config(
3131
@ name TEXT PRIMARY KEY,
@@ -50,19 +50,19 @@
5050
5151
#endif /* INTERFACE */
5252
5353
5454
/*
55
-** The schema for a repository database.
55
+** The schema for a repository database.
5656
**
5757
** Schema1[] contains parts of the schema that are fixed and unchanging
5858
** across versions. Schema2[] contains parts of the schema that can
5959
** change from one version to the next. The information in Schema2[]
6060
** is reconstructed from the information in Schema1[] by the "rebuild"
6161
** operation.
6262
*/
63
-const char zRepositorySchema1[] =
63
+const char zRepositorySchema1[] =
6464
@ -- The BLOB and DELTA tables contain all records held in the repository.
6565
@ --
6666
@ -- The BLOB.CONTENT column is always compressed using zlib. This
6767
@ -- column might hold the full text of the record or it might hold
6868
@ -- a delta that is able to reconstruct the record from some other
@@ -69,11 +69,11 @@
6969
@ -- record. If BLOB.CONTENT holds a delta, then a DELTA table entry
7070
@ -- will exist for the record and that entry will point to another
7171
@ -- entry that holds the source of the delta. Deltas can be chained.
7272
@ --
7373
@ -- The blob and delta tables collectively hold the "global state" of
74
-@ -- a Fossil repository.
74
+@ -- a Fossil repository.
7575
@ --
7676
@ CREATE TABLE blob(
7777
@ rid INTEGER PRIMARY KEY, -- Record ID
7878
@ rcvid INTEGER, -- Origin of this record
7979
@ size INTEGER, -- Size of content. -1 for a phantom.
@@ -89,11 +89,11 @@
8989
@
9090
@ -------------------------------------------------------------------------
9191
@ -- The BLOB and DELTA tables above hold the "global state" of a Fossil
9292
@ -- project; the stuff that is normally exchanged during "sync". The
9393
@ -- "local state" of a repository is contained in the remaining tables of
94
-@ -- the zRepositorySchema1 string.
94
+@ -- the zRepositorySchema1 string.
9595
@ -------------------------------------------------------------------------
9696
@
9797
@ -- Whenever new blobs are received into the repository, an entry
9898
@ -- in this table records the source of the blob.
9999
@ --
@@ -172,11 +172,11 @@
172172
@ );
173173
@
174174
@ -- Some ticket content (such as the originators email address or contact
175175
@ -- information) needs to be obscured to protect privacy. This is achieved
176176
@ -- by storing an SHA1 hash of the content. For display, the hash is
177
-@ -- mapped back into the original text using this table.
177
+@ -- mapped back into the original text using this table.
178178
@ --
179179
@ -- This table contains sensitive information and should not be shared
180180
@ -- with unauthorized users.
181181
@ --
182182
@ CREATE TABLE concealed(
@@ -193,11 +193,11 @@
193193
/*
194194
** The default reportfmt entry for the schema. This is in an extra
195195
** script so that (configure reset) can install the default report.
196196
*/
197197
const char zRepositorySchemaDefaultReports[] =
198
-@ INSERT INTO reportfmt(title,mtime,cols,sqlcode)
198
+@ INSERT INTO reportfmt(title,mtime,cols,sqlcode)
199199
@ VALUES('All Tickets',julianday('1970-01-01'),'#ffffff Key:
200200
@ #f2dcdc Active
201201
@ #e8e8e8 Review
202202
@ #cfe8bd Fixed
203203
@ #bde5d6 Tested
@@ -321,13 +321,13 @@
321321
@ rid INTEGER PRIMARY KEY -- Record ID of the phantom
322322
@ );
323323
@
324324
@ -- Each baseline or manifest can have one or more tags. A tag
325325
@ -- is defined by a row in the next table.
326
-@ --
326
+@ --
327327
@ -- Wiki pages are tagged with "wiki-NAME" where NAME is the name of
328
-@ -- the wiki page. Tickets changes are tagged with "ticket-UUID" where
328
+@ -- the wiki page. Tickets changes are tagged with "ticket-UUID" where
329329
@ -- UUID is the indentifier of the ticket. Tags used to assign symbolic
330330
@ -- names to baselines are branches are of the form "sym-NAME" where
331331
@ -- NAME is the symbolic name.
332332
@ --
333333
@ CREATE TABLE tag(
334334
--- src/schema.c
+++ src/schema.c
@@ -21,11 +21,11 @@
21 #include "schema.h"
22
23 /*
24 ** The database schema for the ~/.fossil configuration database.
25 */
26 const char zConfigSchema[] =
27 @ -- This file contains the schema for the database that is kept in the
28 @ -- ~/.fossil file and that stores information about the users setup.
29 @ --
30 @ CREATE TABLE global_config(
31 @ name TEXT PRIMARY KEY,
@@ -50,19 +50,19 @@
50
51 #endif /* INTERFACE */
52
53
54 /*
55 ** The schema for a repository database.
56 **
57 ** Schema1[] contains parts of the schema that are fixed and unchanging
58 ** across versions. Schema2[] contains parts of the schema that can
59 ** change from one version to the next. The information in Schema2[]
60 ** is reconstructed from the information in Schema1[] by the "rebuild"
61 ** operation.
62 */
63 const char zRepositorySchema1[] =
64 @ -- The BLOB and DELTA tables contain all records held in the repository.
65 @ --
66 @ -- The BLOB.CONTENT column is always compressed using zlib. This
67 @ -- column might hold the full text of the record or it might hold
68 @ -- a delta that is able to reconstruct the record from some other
@@ -69,11 +69,11 @@
69 @ -- record. If BLOB.CONTENT holds a delta, then a DELTA table entry
70 @ -- will exist for the record and that entry will point to another
71 @ -- entry that holds the source of the delta. Deltas can be chained.
72 @ --
73 @ -- The blob and delta tables collectively hold the "global state" of
74 @ -- a Fossil repository.
75 @ --
76 @ CREATE TABLE blob(
77 @ rid INTEGER PRIMARY KEY, -- Record ID
78 @ rcvid INTEGER, -- Origin of this record
79 @ size INTEGER, -- Size of content. -1 for a phantom.
@@ -89,11 +89,11 @@
89 @
90 @ -------------------------------------------------------------------------
91 @ -- The BLOB and DELTA tables above hold the "global state" of a Fossil
92 @ -- project; the stuff that is normally exchanged during "sync". The
93 @ -- "local state" of a repository is contained in the remaining tables of
94 @ -- the zRepositorySchema1 string.
95 @ -------------------------------------------------------------------------
96 @
97 @ -- Whenever new blobs are received into the repository, an entry
98 @ -- in this table records the source of the blob.
99 @ --
@@ -172,11 +172,11 @@
172 @ );
173 @
174 @ -- Some ticket content (such as the originators email address or contact
175 @ -- information) needs to be obscured to protect privacy. This is achieved
176 @ -- by storing an SHA1 hash of the content. For display, the hash is
177 @ -- mapped back into the original text using this table.
178 @ --
179 @ -- This table contains sensitive information and should not be shared
180 @ -- with unauthorized users.
181 @ --
182 @ CREATE TABLE concealed(
@@ -193,11 +193,11 @@
193 /*
194 ** The default reportfmt entry for the schema. This is in an extra
195 ** script so that (configure reset) can install the default report.
196 */
197 const char zRepositorySchemaDefaultReports[] =
198 @ INSERT INTO reportfmt(title,mtime,cols,sqlcode)
199 @ VALUES('All Tickets',julianday('1970-01-01'),'#ffffff Key:
200 @ #f2dcdc Active
201 @ #e8e8e8 Review
202 @ #cfe8bd Fixed
203 @ #bde5d6 Tested
@@ -321,13 +321,13 @@
321 @ rid INTEGER PRIMARY KEY -- Record ID of the phantom
322 @ );
323 @
324 @ -- Each baseline or manifest can have one or more tags. A tag
325 @ -- is defined by a row in the next table.
326 @ --
327 @ -- Wiki pages are tagged with "wiki-NAME" where NAME is the name of
328 @ -- the wiki page. Tickets changes are tagged with "ticket-UUID" where
329 @ -- UUID is the indentifier of the ticket. Tags used to assign symbolic
330 @ -- names to baselines are branches are of the form "sym-NAME" where
331 @ -- NAME is the symbolic name.
332 @ --
333 @ CREATE TABLE tag(
334
--- src/schema.c
+++ src/schema.c
@@ -21,11 +21,11 @@
21 #include "schema.h"
22
23 /*
24 ** The database schema for the ~/.fossil configuration database.
25 */
26 const char zConfigSchema[] =
27 @ -- This file contains the schema for the database that is kept in the
28 @ -- ~/.fossil file and that stores information about the users setup.
29 @ --
30 @ CREATE TABLE global_config(
31 @ name TEXT PRIMARY KEY,
@@ -50,19 +50,19 @@
50
51 #endif /* INTERFACE */
52
53
54 /*
55 ** The schema for a repository database.
56 **
57 ** Schema1[] contains parts of the schema that are fixed and unchanging
58 ** across versions. Schema2[] contains parts of the schema that can
59 ** change from one version to the next. The information in Schema2[]
60 ** is reconstructed from the information in Schema1[] by the "rebuild"
61 ** operation.
62 */
63 const char zRepositorySchema1[] =
64 @ -- The BLOB and DELTA tables contain all records held in the repository.
65 @ --
66 @ -- The BLOB.CONTENT column is always compressed using zlib. This
67 @ -- column might hold the full text of the record or it might hold
68 @ -- a delta that is able to reconstruct the record from some other
@@ -69,11 +69,11 @@
69 @ -- record. If BLOB.CONTENT holds a delta, then a DELTA table entry
70 @ -- will exist for the record and that entry will point to another
71 @ -- entry that holds the source of the delta. Deltas can be chained.
72 @ --
73 @ -- The blob and delta tables collectively hold the "global state" of
74 @ -- a Fossil repository.
75 @ --
76 @ CREATE TABLE blob(
77 @ rid INTEGER PRIMARY KEY, -- Record ID
78 @ rcvid INTEGER, -- Origin of this record
79 @ size INTEGER, -- Size of content. -1 for a phantom.
@@ -89,11 +89,11 @@
89 @
90 @ -------------------------------------------------------------------------
91 @ -- The BLOB and DELTA tables above hold the "global state" of a Fossil
92 @ -- project; the stuff that is normally exchanged during "sync". The
93 @ -- "local state" of a repository is contained in the remaining tables of
94 @ -- the zRepositorySchema1 string.
95 @ -------------------------------------------------------------------------
96 @
97 @ -- Whenever new blobs are received into the repository, an entry
98 @ -- in this table records the source of the blob.
99 @ --
@@ -172,11 +172,11 @@
172 @ );
173 @
174 @ -- Some ticket content (such as the originators email address or contact
175 @ -- information) needs to be obscured to protect privacy. This is achieved
176 @ -- by storing an SHA1 hash of the content. For display, the hash is
177 @ -- mapped back into the original text using this table.
178 @ --
179 @ -- This table contains sensitive information and should not be shared
180 @ -- with unauthorized users.
181 @ --
182 @ CREATE TABLE concealed(
@@ -193,11 +193,11 @@
193 /*
194 ** The default reportfmt entry for the schema. This is in an extra
195 ** script so that (configure reset) can install the default report.
196 */
197 const char zRepositorySchemaDefaultReports[] =
198 @ INSERT INTO reportfmt(title,mtime,cols,sqlcode)
199 @ VALUES('All Tickets',julianday('1970-01-01'),'#ffffff Key:
200 @ #f2dcdc Active
201 @ #e8e8e8 Review
202 @ #cfe8bd Fixed
203 @ #bde5d6 Tested
@@ -321,13 +321,13 @@
321 @ rid INTEGER PRIMARY KEY -- Record ID of the phantom
322 @ );
323 @
324 @ -- Each baseline or manifest can have one or more tags. A tag
325 @ -- is defined by a row in the next table.
326 @ --
327 @ -- Wiki pages are tagged with "wiki-NAME" where NAME is the name of
328 @ -- the wiki page. Tickets changes are tagged with "ticket-UUID" where
329 @ -- UUID is the indentifier of the ticket. Tags used to assign symbolic
330 @ -- names to baselines are branches are of the form "sym-NAME" where
331 @ -- NAME is the symbolic name.
332 @ --
333 @ CREATE TABLE tag(
334
+27 -6
--- src/setup.c
+++ src/setup.c
@@ -962,10 +962,21 @@
962962
@ <p>Fossil tries to spend less than this many seconds gathering
963963
@ the out-bound data of sync, clone, and pull packets.
964964
@ If the client request takes longer, a partial reply is given similar
965965
@ to the download packet limit. 30s is a reasonable default.</p>
966966
967
+ @ <hr />
968
+ entry_attribute("Server Load Average Limit", 11, "max-loadavg", "mxldavg",
969
+ "0.0", 0);
970
+ @ <p>Some expensive operations (such as computing tarballs, zip archives,
971
+ @ or annotation/blame pages) are prohibited if the load average on the host
972
+ @ computer is too large. Set the threshold for disallowing expensive
973
+ @ computations here. Set this to 0.0 to disable the load average limit.
974
+ @ This limit is only enforced on Unix servers. On Linux systems,
975
+ @ access to the /proc virtual filesystem is required, which means this limit
976
+ @ might not work inside a chroot() jail.</p>
977
+
967978
@ <hr />
968979
onoff_attribute(
969980
"Enable hyperlinks for \"nobody\" based on User-Agent and Javascript",
970981
"auto-hyperlink", "autohyperlink", 1, 0);
971982
@ <p>Enable hyperlinks (the equivalent of the "h" permission) for all users
@@ -973,11 +984,12 @@
973984
@ HTTP header indicates that the request is coming from an actual human
974985
@ being and not a a robot or spider and (2) the user agent is able to
975986
@ run Javascript in order to set the href= attribute of hyperlinks. Bots
976987
@ and spiders can forge a User-Agent string that makes them seem to be a
977988
@ normal browser and they can run javascript just like browsers. But most
978
- @ bots do not go to that much trouble so this is normally an effective defense.</p>
989
+ @ bots do not go to that much trouble so this is normally an effective
990
+ @ defense.</p>
979991
@
980992
@ <p>You do not normally want a bot to walk your entire repository because
981993
@ if it does, your server will end up computing diffs and annotations for
982994
@ every historical version of every file and creating ZIPs and tarballs of
983995
@ every historical check-in, which can use a lot of CPU and bandwidth
@@ -1261,32 +1273,41 @@
12611273
} else {
12621274
@ <br />
12631275
}
12641276
}
12651277
}
1278
+ @ <br /><input type="submit" name="submit" value="Apply Changes" />
12661279
@ </td><td style="width:50px;"></td><td valign="top">
12671280
for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1268
- if( pSet->width!=0 && !pSet->versionable){
1281
+ if( pSet->width!=0 && !pSet->versionable && !pSet->forceTextArea ){
12691282
entry_attribute(pSet->name, /*pSet->width*/ 25, pSet->name,
12701283
pSet->var!=0 ? pSet->var : pSet->name,
12711284
(char*)pSet->def, 0);
12721285
@ <br />
12731286
}
1287
+ }
1288
+ for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1289
+ if( pSet->width!=0 && !pSet->versionable && pSet->forceTextArea ){
1290
+ @<b>%s(pSet->name)</b><br />
1291
+ textarea_attribute("", /*rows*/ 3, /*cols*/ 50, pSet->name,
1292
+ pSet->var!=0 ? pSet->var : pSet->name,
1293
+ (char*)pSet->def, 0);
1294
+ @ <br />
1295
+ }
12741296
}
12751297
@ </td><td style="width:50px;"></td><td valign="top">
12761298
for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1277
- int hasVersionableValue = db_get_do_versionable(pSet->name, NULL)!=0;
1278
- if( pSet->width!=0 && pSet->versionable){
1299
+ if( pSet->width!=0 && pSet->versionable ){
1300
+ int hasVersionableValue = db_get_do_versionable(pSet->name, NULL)!=0;
12791301
@<b>%s(pSet->name)</b> (v)<br />
12801302
textarea_attribute("", /*rows*/ 3, /*cols*/ 20, pSet->name,
12811303
pSet->var!=0 ? pSet->var : pSet->name,
12821304
(char*)pSet->def, hasVersionableValue);
12831305
@<br />
12841306
}
12851307
}
12861308
@ </td></tr></table>
1287
- @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
12881309
@ </div></form>
12891310
@ <p>Settings marked with (v) are 'versionable' and will be overridden
12901311
@ by the contents of files named <tt>.fossil-settings/PROPERTY</tt>.
12911312
@ If such a file is present, the corresponding field above is not
12921313
@ editable.</p><hr /><p>
@@ -1469,11 +1490,11 @@
14691490
@ </div></form>
14701491
@ <hr />
14711492
@ The default header is shown below for reference. Other examples
14721493
@ of headers can be seen on the <a href="setup_skin">skins page</a>.
14731494
@ See also the <a href="setup_editcss">CSS</a> and
1474
- @ <a href="setup_footer">footer</a> editing screeens.
1495
+ @ <a href="setup_footer">footer</a> editing screens.
14751496
@ <blockquote><pre>
14761497
@ %h(zDefaultHeader)
14771498
@ </pre></blockquote>
14781499
style_footer();
14791500
db_end_transaction(0);
14801501
--- src/setup.c
+++ src/setup.c
@@ -962,10 +962,21 @@
962 @ <p>Fossil tries to spend less than this many seconds gathering
963 @ the out-bound data of sync, clone, and pull packets.
964 @ If the client request takes longer, a partial reply is given similar
965 @ to the download packet limit. 30s is a reasonable default.</p>
966
 
 
 
 
 
 
 
 
 
 
 
967 @ <hr />
968 onoff_attribute(
969 "Enable hyperlinks for \"nobody\" based on User-Agent and Javascript",
970 "auto-hyperlink", "autohyperlink", 1, 0);
971 @ <p>Enable hyperlinks (the equivalent of the "h" permission) for all users
@@ -973,11 +984,12 @@
973 @ HTTP header indicates that the request is coming from an actual human
974 @ being and not a a robot or spider and (2) the user agent is able to
975 @ run Javascript in order to set the href= attribute of hyperlinks. Bots
976 @ and spiders can forge a User-Agent string that makes them seem to be a
977 @ normal browser and they can run javascript just like browsers. But most
978 @ bots do not go to that much trouble so this is normally an effective defense.</p>
 
979 @
980 @ <p>You do not normally want a bot to walk your entire repository because
981 @ if it does, your server will end up computing diffs and annotations for
982 @ every historical version of every file and creating ZIPs and tarballs of
983 @ every historical check-in, which can use a lot of CPU and bandwidth
@@ -1261,32 +1273,41 @@
1261 } else {
1262 @ <br />
1263 }
1264 }
1265 }
 
1266 @ </td><td style="width:50px;"></td><td valign="top">
1267 for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1268 if( pSet->width!=0 && !pSet->versionable){
1269 entry_attribute(pSet->name, /*pSet->width*/ 25, pSet->name,
1270 pSet->var!=0 ? pSet->var : pSet->name,
1271 (char*)pSet->def, 0);
1272 @ <br />
1273 }
 
 
 
 
 
 
 
 
 
1274 }
1275 @ </td><td style="width:50px;"></td><td valign="top">
1276 for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1277 int hasVersionableValue = db_get_do_versionable(pSet->name, NULL)!=0;
1278 if( pSet->width!=0 && pSet->versionable){
1279 @<b>%s(pSet->name)</b> (v)<br />
1280 textarea_attribute("", /*rows*/ 3, /*cols*/ 20, pSet->name,
1281 pSet->var!=0 ? pSet->var : pSet->name,
1282 (char*)pSet->def, hasVersionableValue);
1283 @<br />
1284 }
1285 }
1286 @ </td></tr></table>
1287 @ <p><input type="submit" name="submit" value="Apply Changes" /></p>
1288 @ </div></form>
1289 @ <p>Settings marked with (v) are 'versionable' and will be overridden
1290 @ by the contents of files named <tt>.fossil-settings/PROPERTY</tt>.
1291 @ If such a file is present, the corresponding field above is not
1292 @ editable.</p><hr /><p>
@@ -1469,11 +1490,11 @@
1469 @ </div></form>
1470 @ <hr />
1471 @ The default header is shown below for reference. Other examples
1472 @ of headers can be seen on the <a href="setup_skin">skins page</a>.
1473 @ See also the <a href="setup_editcss">CSS</a> and
1474 @ <a href="setup_footer">footer</a> editing screeens.
1475 @ <blockquote><pre>
1476 @ %h(zDefaultHeader)
1477 @ </pre></blockquote>
1478 style_footer();
1479 db_end_transaction(0);
1480
--- src/setup.c
+++ src/setup.c
@@ -962,10 +962,21 @@
962 @ <p>Fossil tries to spend less than this many seconds gathering
963 @ the out-bound data of sync, clone, and pull packets.
964 @ If the client request takes longer, a partial reply is given similar
965 @ to the download packet limit. 30s is a reasonable default.</p>
966
967 @ <hr />
968 entry_attribute("Server Load Average Limit", 11, "max-loadavg", "mxldavg",
969 "0.0", 0);
970 @ <p>Some expensive operations (such as computing tarballs, zip archives,
971 @ or annotation/blame pages) are prohibited if the load average on the host
972 @ computer is too large. Set the threshold for disallowing expensive
973 @ computations here. Set this to 0.0 to disable the load average limit.
974 @ This limit is only enforced on Unix servers. On Linux systems,
975 @ access to the /proc virtual filesystem is required, which means this limit
976 @ might not work inside a chroot() jail.</p>
977
978 @ <hr />
979 onoff_attribute(
980 "Enable hyperlinks for \"nobody\" based on User-Agent and Javascript",
981 "auto-hyperlink", "autohyperlink", 1, 0);
982 @ <p>Enable hyperlinks (the equivalent of the "h" permission) for all users
@@ -973,11 +984,12 @@
984 @ HTTP header indicates that the request is coming from an actual human
985 @ being and not a a robot or spider and (2) the user agent is able to
986 @ run Javascript in order to set the href= attribute of hyperlinks. Bots
987 @ and spiders can forge a User-Agent string that makes them seem to be a
988 @ normal browser and they can run javascript just like browsers. But most
989 @ bots do not go to that much trouble so this is normally an effective
990 @ defense.</p>
991 @
992 @ <p>You do not normally want a bot to walk your entire repository because
993 @ if it does, your server will end up computing diffs and annotations for
994 @ every historical version of every file and creating ZIPs and tarballs of
995 @ every historical check-in, which can use a lot of CPU and bandwidth
@@ -1261,32 +1273,41 @@
1273 } else {
1274 @ <br />
1275 }
1276 }
1277 }
1278 @ <br /><input type="submit" name="submit" value="Apply Changes" />
1279 @ </td><td style="width:50px;"></td><td valign="top">
1280 for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1281 if( pSet->width!=0 && !pSet->versionable && !pSet->forceTextArea ){
1282 entry_attribute(pSet->name, /*pSet->width*/ 25, pSet->name,
1283 pSet->var!=0 ? pSet->var : pSet->name,
1284 (char*)pSet->def, 0);
1285 @ <br />
1286 }
1287 }
1288 for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1289 if( pSet->width!=0 && !pSet->versionable && pSet->forceTextArea ){
1290 @<b>%s(pSet->name)</b><br />
1291 textarea_attribute("", /*rows*/ 3, /*cols*/ 50, pSet->name,
1292 pSet->var!=0 ? pSet->var : pSet->name,
1293 (char*)pSet->def, 0);
1294 @ <br />
1295 }
1296 }
1297 @ </td><td style="width:50px;"></td><td valign="top">
1298 for(pSet=ctrlSettings; pSet->name!=0; pSet++){
1299 if( pSet->width!=0 && pSet->versionable ){
1300 int hasVersionableValue = db_get_do_versionable(pSet->name, NULL)!=0;
1301 @<b>%s(pSet->name)</b> (v)<br />
1302 textarea_attribute("", /*rows*/ 3, /*cols*/ 20, pSet->name,
1303 pSet->var!=0 ? pSet->var : pSet->name,
1304 (char*)pSet->def, hasVersionableValue);
1305 @<br />
1306 }
1307 }
1308 @ </td></tr></table>
 
1309 @ </div></form>
1310 @ <p>Settings marked with (v) are 'versionable' and will be overridden
1311 @ by the contents of files named <tt>.fossil-settings/PROPERTY</tt>.
1312 @ If such a file is present, the corresponding field above is not
1313 @ editable.</p><hr /><p>
@@ -1469,11 +1490,11 @@
1490 @ </div></form>
1491 @ <hr />
1492 @ The default header is shown below for reference. Other examples
1493 @ of headers can be seen on the <a href="setup_skin">skins page</a>.
1494 @ See also the <a href="setup_editcss">CSS</a> and
1495 @ <a href="setup_footer">footer</a> editing screens.
1496 @ <blockquote><pre>
1497 @ %h(zDefaultHeader)
1498 @ </pre></blockquote>
1499 style_footer();
1500 db_end_transaction(0);
1501
+45 -15
--- src/shell.c
+++ src/shell.c
@@ -63,11 +63,13 @@
6363
#endif
6464
6565
#if defined(_WIN32) || defined(WIN32)
6666
# include <io.h>
6767
#define isatty(h) _isatty(h)
68
-#define access(f,m) _access((f),(m))
68
+#ifndef access
69
+# define access(f,m) _access((f),(m))
70
+#endif
6971
#undef popen
7072
#define popen _popen
7173
#undef pclose
7274
#define pclose _pclose
7375
#else
@@ -442,10 +444,11 @@
442444
** state and mode information.
443445
*/
444446
struct callback_data {
445447
sqlite3 *db; /* The database */
446448
int echoOn; /* True to echo input commands */
449
+ int autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL statement */
447450
int statsOn; /* True to display memory stats before each finalize */
448451
int cnt; /* Number of records displayed so far */
449452
FILE *out; /* Write results here */
450453
FILE *traceOut; /* Output for sqlite3_trace() */
451454
int nErr; /* Number of errors seen */
@@ -1179,10 +1182,11 @@
11791182
** itself by 2 spaces.
11801183
**
11811184
** * For each "Goto", if the jump destination is earlier in the program
11821185
** and ends on one of:
11831186
** Yield SeekGt SeekLt RowSetRead Rewind
1187
+** or if the P1 parameter is one instead of zero,
11841188
** then indent all opcodes between the earlier instruction
11851189
** and "Goto" by 2 spaces.
11861190
*/
11871191
static void explain_data_prepare(struct callback_data *p, sqlite3_stmt *pSql){
11881192
const char *zSql; /* The text of the SQL statement */
@@ -1226,11 +1230,13 @@
12261230
p->nIndent = iOp+1;
12271231
12281232
if( str_in_array(zOp, azNext) ){
12291233
for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2;
12301234
}
1231
- if( str_in_array(zOp, azGoto) && p2op<p->nIndent && abYield[p2op] ){
1235
+ if( str_in_array(zOp, azGoto) && p2op<p->nIndent
1236
+ && (abYield[p2op] || sqlite3_column_int(pSql, 2))
1237
+ ){
12321238
for(i=p2op+1; i<iOp; i++) p->aiIndent[i] += 2;
12331239
}
12341240
}
12351241
12361242
p->iIndent = 0;
@@ -1297,10 +1303,27 @@
12971303
/* echo the sql statement if echo on */
12981304
if( pArg && pArg->echoOn ){
12991305
const char *zStmtSql = sqlite3_sql(pStmt);
13001306
fprintf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql);
13011307
}
1308
+
1309
+ /* Show the EXPLAIN QUERY PLAN if .eqp is on */
1310
+ if( pArg && pArg->autoEQP ){
1311
+ sqlite3_stmt *pExplain;
1312
+ char *zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", sqlite3_sql(pStmt));
1313
+ rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
1314
+ if( rc==SQLITE_OK ){
1315
+ while( sqlite3_step(pExplain)==SQLITE_ROW ){
1316
+ fprintf(pArg->out,"--EQP-- %d,", sqlite3_column_int(pExplain, 0));
1317
+ fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 1));
1318
+ fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 2));
1319
+ fprintf(pArg->out,"%s\n", sqlite3_column_text(pExplain, 3));
1320
+ }
1321
+ }
1322
+ sqlite3_finalize(pExplain);
1323
+ sqlite3_free(zEQP);
1324
+ }
13021325
13031326
/* Output TESTCTRL_EXPLAIN text of requested */
13041327
if( pArg && pArg->mode==MODE_Explain ){
13051328
const char *zExplain = 0;
13061329
sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain);
@@ -1891,11 +1914,11 @@
18911914
csv_append_char(p, c);
18921915
c = fgetc(p->in);
18931916
}
18941917
if( c=='\n' ){
18951918
p->nLine++;
1896
- if( p->n>1 && p->z[p->n-1]=='\r' ) p->n--;
1919
+ if( p->n>0 && p->z[p->n-1]=='\r' ) p->n--;
18971920
}
18981921
p->cTerm = c;
18991922
}
19001923
if( p->z ) p->z[p->n] = 0;
19011924
return p->z;
@@ -2296,10 +2319,14 @@
22962319
}else
22972320
22982321
if( c=='e' && strncmp(azArg[0], "echo", n)==0 && nArg>1 && nArg<3 ){
22992322
p->echoOn = booleanValue(azArg[1]);
23002323
}else
2324
+
2325
+ if( c=='e' && strncmp(azArg[0], "eqp", n)==0 && nArg>1 && nArg<3 ){
2326
+ p->autoEQP = booleanValue(azArg[1]);
2327
+ }else
23012328
23022329
if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){
23032330
if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc);
23042331
rc = 2;
23052332
}else
@@ -2869,10 +2896,11 @@
28692896
}else
28702897
28712898
if( c=='s' && strncmp(azArg[0], "show", n)==0 && nArg==1 ){
28722899
int i;
28732900
fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off");
2901
+ fprintf(p->out,"%9.9s: %s\n","eqp", p->autoEQP ? "on" : "off");
28742902
fprintf(p->out,"%9.9s: %s\n","explain", p->explainPrev.valid ? "on" :"off");
28752903
fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off");
28762904
fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]);
28772905
fprintf(p->out,"%9.9s: ", "nullvalue");
28782906
output_c_string(p->out, p->nullvalue);
@@ -3546,15 +3574,17 @@
35463574
char *zFirstCmd = 0;
35473575
int i;
35483576
int rc = 0;
35493577
int warnInmemoryDb = 0;
35503578
3551
- if( sqlite3_libversion_number()<3008003 ){
3552
- fprintf(stderr, "Unsuitable SQLite version %s, must be at least 3.8.3",
3553
- sqlite3_libversion());
3579
+#if USE_SYSTEM_SQLITE+0!=1
3580
+ if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
3581
+ fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
3582
+ sqlite3_sourceid(), SQLITE_SOURCE_ID);
35543583
exit(1);
35553584
}
3585
+#endif
35563586
Argv0 = argv[0];
35573587
main_init(&data);
35583588
stdin_is_interactive = isatty(0);
35593589
35603590
/* Make sure we have a valid signal handler early, before anything
@@ -3644,17 +3674,15 @@
36443674
warnInmemoryDb = argc==1;
36453675
#else
36463676
fprintf(stderr,"%s: Error: no database filename specified\n", Argv0);
36473677
return 1;
36483678
#endif
3649
- /***** Begin Fossil Patch *****/
3650
- {
3651
- extern void fossil_open(const char **);
3652
- fossil_open(&data.zDbFilename);
3653
- warnInmemoryDb = 0;
3654
- }
3655
- /***** End Fossil Patch *****/
3679
+#ifdef SQLITE_SHELL_DBNAME_PROC
3680
+ { extern void SQLITE_SHELL_DBNAME_PROC(const char**);
3681
+ SQLITE_SHELL_DBNAME_PROC(&data.zDbFilename);
3682
+ warnInmemoryDb = 0; }
3683
+#endif
36563684
}
36573685
data.out = stdout;
36583686
36593687
/* Go ahead and open the database file if it already exists. If the
36603688
** file does not exist, delay opening it. This prevents empty database
@@ -3706,10 +3734,12 @@
37063734
data.showHeader = 1;
37073735
}else if( strcmp(z,"-noheader")==0 ){
37083736
data.showHeader = 0;
37093737
}else if( strcmp(z,"-echo")==0 ){
37103738
data.echoOn = 1;
3739
+ }else if( strcmp(z,"-eqp")==0 ){
3740
+ data.autoEQP = 1;
37113741
}else if( strcmp(z,"-stats")==0 ){
37123742
data.statsOn = 1;
37133743
}else if( strcmp(z,"-bail")==0 ){
37143744
bail_on_error = 1;
37153745
}else if( strcmp(z,"-version")==0 ){
@@ -3788,12 +3818,12 @@
37883818
"Enter \".help\" for usage hints.\n",
37893819
sqlite3_libversion(), sqlite3_sourceid()
37903820
);
37913821
if( warnInmemoryDb ){
37923822
printf("Connected to a ");
3793
- printBold("transient in-memory database.");
3794
- printf("\nUse \".open FILENAME\" to reopen on a "
3823
+ printBold("transient in-memory database");
3824
+ printf(".\nUse \".open FILENAME\" to reopen on a "
37953825
"persistent database.\n");
37963826
}
37973827
zHome = find_home_dir();
37983828
if( zHome ){
37993829
nHistory = strlen30(zHome) + 20;
38003830
--- src/shell.c
+++ src/shell.c
@@ -63,11 +63,13 @@
63 #endif
64
65 #if defined(_WIN32) || defined(WIN32)
66 # include <io.h>
67 #define isatty(h) _isatty(h)
68 #define access(f,m) _access((f),(m))
 
 
69 #undef popen
70 #define popen _popen
71 #undef pclose
72 #define pclose _pclose
73 #else
@@ -442,10 +444,11 @@
442 ** state and mode information.
443 */
444 struct callback_data {
445 sqlite3 *db; /* The database */
446 int echoOn; /* True to echo input commands */
 
447 int statsOn; /* True to display memory stats before each finalize */
448 int cnt; /* Number of records displayed so far */
449 FILE *out; /* Write results here */
450 FILE *traceOut; /* Output for sqlite3_trace() */
451 int nErr; /* Number of errors seen */
@@ -1179,10 +1182,11 @@
1179 ** itself by 2 spaces.
1180 **
1181 ** * For each "Goto", if the jump destination is earlier in the program
1182 ** and ends on one of:
1183 ** Yield SeekGt SeekLt RowSetRead Rewind
 
1184 ** then indent all opcodes between the earlier instruction
1185 ** and "Goto" by 2 spaces.
1186 */
1187 static void explain_data_prepare(struct callback_data *p, sqlite3_stmt *pSql){
1188 const char *zSql; /* The text of the SQL statement */
@@ -1226,11 +1230,13 @@
1226 p->nIndent = iOp+1;
1227
1228 if( str_in_array(zOp, azNext) ){
1229 for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2;
1230 }
1231 if( str_in_array(zOp, azGoto) && p2op<p->nIndent && abYield[p2op] ){
 
 
1232 for(i=p2op+1; i<iOp; i++) p->aiIndent[i] += 2;
1233 }
1234 }
1235
1236 p->iIndent = 0;
@@ -1297,10 +1303,27 @@
1297 /* echo the sql statement if echo on */
1298 if( pArg && pArg->echoOn ){
1299 const char *zStmtSql = sqlite3_sql(pStmt);
1300 fprintf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql);
1301 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1302
1303 /* Output TESTCTRL_EXPLAIN text of requested */
1304 if( pArg && pArg->mode==MODE_Explain ){
1305 const char *zExplain = 0;
1306 sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain);
@@ -1891,11 +1914,11 @@
1891 csv_append_char(p, c);
1892 c = fgetc(p->in);
1893 }
1894 if( c=='\n' ){
1895 p->nLine++;
1896 if( p->n>1 && p->z[p->n-1]=='\r' ) p->n--;
1897 }
1898 p->cTerm = c;
1899 }
1900 if( p->z ) p->z[p->n] = 0;
1901 return p->z;
@@ -2296,10 +2319,14 @@
2296 }else
2297
2298 if( c=='e' && strncmp(azArg[0], "echo", n)==0 && nArg>1 && nArg<3 ){
2299 p->echoOn = booleanValue(azArg[1]);
2300 }else
 
 
 
 
2301
2302 if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){
2303 if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc);
2304 rc = 2;
2305 }else
@@ -2869,10 +2896,11 @@
2869 }else
2870
2871 if( c=='s' && strncmp(azArg[0], "show", n)==0 && nArg==1 ){
2872 int i;
2873 fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off");
 
2874 fprintf(p->out,"%9.9s: %s\n","explain", p->explainPrev.valid ? "on" :"off");
2875 fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off");
2876 fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]);
2877 fprintf(p->out,"%9.9s: ", "nullvalue");
2878 output_c_string(p->out, p->nullvalue);
@@ -3546,15 +3574,17 @@
3546 char *zFirstCmd = 0;
3547 int i;
3548 int rc = 0;
3549 int warnInmemoryDb = 0;
3550
3551 if( sqlite3_libversion_number()<3008003 ){
3552 fprintf(stderr, "Unsuitable SQLite version %s, must be at least 3.8.3",
3553 sqlite3_libversion());
 
3554 exit(1);
3555 }
 
3556 Argv0 = argv[0];
3557 main_init(&data);
3558 stdin_is_interactive = isatty(0);
3559
3560 /* Make sure we have a valid signal handler early, before anything
@@ -3644,17 +3674,15 @@
3644 warnInmemoryDb = argc==1;
3645 #else
3646 fprintf(stderr,"%s: Error: no database filename specified\n", Argv0);
3647 return 1;
3648 #endif
3649 /***** Begin Fossil Patch *****/
3650 {
3651 extern void fossil_open(const char **);
3652 fossil_open(&data.zDbFilename);
3653 warnInmemoryDb = 0;
3654 }
3655 /***** End Fossil Patch *****/
3656 }
3657 data.out = stdout;
3658
3659 /* Go ahead and open the database file if it already exists. If the
3660 ** file does not exist, delay opening it. This prevents empty database
@@ -3706,10 +3734,12 @@
3706 data.showHeader = 1;
3707 }else if( strcmp(z,"-noheader")==0 ){
3708 data.showHeader = 0;
3709 }else if( strcmp(z,"-echo")==0 ){
3710 data.echoOn = 1;
 
 
3711 }else if( strcmp(z,"-stats")==0 ){
3712 data.statsOn = 1;
3713 }else if( strcmp(z,"-bail")==0 ){
3714 bail_on_error = 1;
3715 }else if( strcmp(z,"-version")==0 ){
@@ -3788,12 +3818,12 @@
3788 "Enter \".help\" for usage hints.\n",
3789 sqlite3_libversion(), sqlite3_sourceid()
3790 );
3791 if( warnInmemoryDb ){
3792 printf("Connected to a ");
3793 printBold("transient in-memory database.");
3794 printf("\nUse \".open FILENAME\" to reopen on a "
3795 "persistent database.\n");
3796 }
3797 zHome = find_home_dir();
3798 if( zHome ){
3799 nHistory = strlen30(zHome) + 20;
3800
--- src/shell.c
+++ src/shell.c
@@ -63,11 +63,13 @@
63 #endif
64
65 #if defined(_WIN32) || defined(WIN32)
66 # include <io.h>
67 #define isatty(h) _isatty(h)
68 #ifndef access
69 # define access(f,m) _access((f),(m))
70 #endif
71 #undef popen
72 #define popen _popen
73 #undef pclose
74 #define pclose _pclose
75 #else
@@ -442,10 +444,11 @@
444 ** state and mode information.
445 */
446 struct callback_data {
447 sqlite3 *db; /* The database */
448 int echoOn; /* True to echo input commands */
449 int autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL statement */
450 int statsOn; /* True to display memory stats before each finalize */
451 int cnt; /* Number of records displayed so far */
452 FILE *out; /* Write results here */
453 FILE *traceOut; /* Output for sqlite3_trace() */
454 int nErr; /* Number of errors seen */
@@ -1179,10 +1182,11 @@
1182 ** itself by 2 spaces.
1183 **
1184 ** * For each "Goto", if the jump destination is earlier in the program
1185 ** and ends on one of:
1186 ** Yield SeekGt SeekLt RowSetRead Rewind
1187 ** or if the P1 parameter is one instead of zero,
1188 ** then indent all opcodes between the earlier instruction
1189 ** and "Goto" by 2 spaces.
1190 */
1191 static void explain_data_prepare(struct callback_data *p, sqlite3_stmt *pSql){
1192 const char *zSql; /* The text of the SQL statement */
@@ -1226,11 +1230,13 @@
1230 p->nIndent = iOp+1;
1231
1232 if( str_in_array(zOp, azNext) ){
1233 for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2;
1234 }
1235 if( str_in_array(zOp, azGoto) && p2op<p->nIndent
1236 && (abYield[p2op] || sqlite3_column_int(pSql, 2))
1237 ){
1238 for(i=p2op+1; i<iOp; i++) p->aiIndent[i] += 2;
1239 }
1240 }
1241
1242 p->iIndent = 0;
@@ -1297,10 +1303,27 @@
1303 /* echo the sql statement if echo on */
1304 if( pArg && pArg->echoOn ){
1305 const char *zStmtSql = sqlite3_sql(pStmt);
1306 fprintf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql);
1307 }
1308
1309 /* Show the EXPLAIN QUERY PLAN if .eqp is on */
1310 if( pArg && pArg->autoEQP ){
1311 sqlite3_stmt *pExplain;
1312 char *zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", sqlite3_sql(pStmt));
1313 rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
1314 if( rc==SQLITE_OK ){
1315 while( sqlite3_step(pExplain)==SQLITE_ROW ){
1316 fprintf(pArg->out,"--EQP-- %d,", sqlite3_column_int(pExplain, 0));
1317 fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 1));
1318 fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 2));
1319 fprintf(pArg->out,"%s\n", sqlite3_column_text(pExplain, 3));
1320 }
1321 }
1322 sqlite3_finalize(pExplain);
1323 sqlite3_free(zEQP);
1324 }
1325
1326 /* Output TESTCTRL_EXPLAIN text of requested */
1327 if( pArg && pArg->mode==MODE_Explain ){
1328 const char *zExplain = 0;
1329 sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain);
@@ -1891,11 +1914,11 @@
1914 csv_append_char(p, c);
1915 c = fgetc(p->in);
1916 }
1917 if( c=='\n' ){
1918 p->nLine++;
1919 if( p->n>0 && p->z[p->n-1]=='\r' ) p->n--;
1920 }
1921 p->cTerm = c;
1922 }
1923 if( p->z ) p->z[p->n] = 0;
1924 return p->z;
@@ -2296,10 +2319,14 @@
2319 }else
2320
2321 if( c=='e' && strncmp(azArg[0], "echo", n)==0 && nArg>1 && nArg<3 ){
2322 p->echoOn = booleanValue(azArg[1]);
2323 }else
2324
2325 if( c=='e' && strncmp(azArg[0], "eqp", n)==0 && nArg>1 && nArg<3 ){
2326 p->autoEQP = booleanValue(azArg[1]);
2327 }else
2328
2329 if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){
2330 if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc);
2331 rc = 2;
2332 }else
@@ -2869,10 +2896,11 @@
2896 }else
2897
2898 if( c=='s' && strncmp(azArg[0], "show", n)==0 && nArg==1 ){
2899 int i;
2900 fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off");
2901 fprintf(p->out,"%9.9s: %s\n","eqp", p->autoEQP ? "on" : "off");
2902 fprintf(p->out,"%9.9s: %s\n","explain", p->explainPrev.valid ? "on" :"off");
2903 fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off");
2904 fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]);
2905 fprintf(p->out,"%9.9s: ", "nullvalue");
2906 output_c_string(p->out, p->nullvalue);
@@ -3546,15 +3574,17 @@
3574 char *zFirstCmd = 0;
3575 int i;
3576 int rc = 0;
3577 int warnInmemoryDb = 0;
3578
3579 #if USE_SYSTEM_SQLITE+0!=1
3580 if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
3581 fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
3582 sqlite3_sourceid(), SQLITE_SOURCE_ID);
3583 exit(1);
3584 }
3585 #endif
3586 Argv0 = argv[0];
3587 main_init(&data);
3588 stdin_is_interactive = isatty(0);
3589
3590 /* Make sure we have a valid signal handler early, before anything
@@ -3644,17 +3674,15 @@
3674 warnInmemoryDb = argc==1;
3675 #else
3676 fprintf(stderr,"%s: Error: no database filename specified\n", Argv0);
3677 return 1;
3678 #endif
3679 #ifdef SQLITE_SHELL_DBNAME_PROC
3680 { extern void SQLITE_SHELL_DBNAME_PROC(const char**);
3681 SQLITE_SHELL_DBNAME_PROC(&data.zDbFilename);
3682 warnInmemoryDb = 0; }
3683 #endif
 
 
3684 }
3685 data.out = stdout;
3686
3687 /* Go ahead and open the database file if it already exists. If the
3688 ** file does not exist, delay opening it. This prevents empty database
@@ -3706,10 +3734,12 @@
3734 data.showHeader = 1;
3735 }else if( strcmp(z,"-noheader")==0 ){
3736 data.showHeader = 0;
3737 }else if( strcmp(z,"-echo")==0 ){
3738 data.echoOn = 1;
3739 }else if( strcmp(z,"-eqp")==0 ){
3740 data.autoEQP = 1;
3741 }else if( strcmp(z,"-stats")==0 ){
3742 data.statsOn = 1;
3743 }else if( strcmp(z,"-bail")==0 ){
3744 bail_on_error = 1;
3745 }else if( strcmp(z,"-version")==0 ){
@@ -3788,12 +3818,12 @@
3818 "Enter \".help\" for usage hints.\n",
3819 sqlite3_libversion(), sqlite3_sourceid()
3820 );
3821 if( warnInmemoryDb ){
3822 printf("Connected to a ");
3823 printBold("transient in-memory database");
3824 printf(".\nUse \".open FILENAME\" to reopen on a "
3825 "persistent database.\n");
3826 }
3827 zHome = find_home_dir();
3828 if( zHome ){
3829 nHistory = strlen30(zHome) + 20;
3830
+7 -7
--- src/shun.c
+++ src/shun.c
@@ -69,11 +69,11 @@
6969
style_header("Shunned Artifacts");
7070
if( zUuid && P("sub") ){
7171
login_verify_csrf_secret();
7272
db_multi_exec("DELETE FROM shun WHERE uuid='%s'", zUuid);
7373
if( db_exists("SELECT 1 FROM blob WHERE uuid='%s'", zUuid) ){
74
- @ <p class="noMoreShun">Artifact
74
+ @ <p class="noMoreShun">Artifact
7575
@ <a href="%s(g.zTop)/artifact/%s(zUuid)">%s(zUuid)</a> is no
7676
@ longer being shunned.</p>
7777
}else{
7878
@ <p class="noMoreShun">Artifact %s(zUuid) will no longer
7979
@ be shunned. But it does not exist in the repository. It
@@ -107,11 +107,11 @@
107107
}
108108
@ <p>A shunned artifact will not be pushed nor accepted in a pull and the
109109
@ artifact content will be purged from the repository the next time the
110110
@ repository is rebuilt. A list of shunned artifacts can be seen at the
111111
@ bottom of this page.</p>
112
- @
112
+ @
113113
@ <a name="addshun"></a>
114114
@ <p>To shun an artifact, enter its artifact ID (the 40-character SHA1
115115
@ hash of the artifact) in the
116116
@ following box and press the "Shun" button. This will cause the artifact
117117
@ to be removed from the repository and will prevent the artifact from being
@@ -124,11 +124,11 @@
124124
@ from the repository. Inappropriate content includes such things as
125125
@ spam added to Wiki, files that violate copyright or patent agreements,
126126
@ or artifacts that by design or accident interfere with the processing
127127
@ of the repository. Do not shun artifacts merely to remove them from
128128
@ sight - set the "hidden" tag on such artifacts instead.</p>
129
- @
129
+ @
130130
@ <blockquote>
131131
@ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div>
132132
login_insert_csrf_secret();
133133
@ <input type="text" name="uuid" value="%h(PD("shun",""))" size="50" />
134134
@ <input type="submit" name="add" value="Shun" />
@@ -159,14 +159,14 @@
159159
@ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div>
160160
login_insert_csrf_secret();
161161
@ <input type="submit" name="rebuild" value="Rebuild" />
162162
@ </div></form>
163163
@ </blockquote>
164
- @
164
+ @
165165
@ <hr /><p>Shunned Artifacts:</p>
166166
@ <blockquote><p>
167
- db_prepare(&q,
167
+ db_prepare(&q,
168168
"SELECT uuid, EXISTS(SELECT 1 FROM blob WHERE blob.uuid=shun.uuid)"
169169
" FROM shun ORDER BY uuid");
170170
while( db_step(&q)==SQLITE_ROW ){
171171
const char *zUuid = db_column_text(&q, 0);
172172
int stillExists = db_column_int(&q, 1);
@@ -228,11 +228,11 @@
228228
style_header("Content Sources");
229229
if( ofst>0 ){
230230
style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d",
231231
ofst>30 ? ofst-30 : 0);
232232
}
233
- db_prepare(&q,
233
+ db_prepare(&q,
234234
"SELECT rcvid, login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
235235
" FROM rcvfrom LEFT JOIN user USING(uid)"
236236
" ORDER BY rcvid DESC LIMIT 31 OFFSET %d",
237237
ofst
238238
);
@@ -287,11 +287,11 @@
287287
login_check_credentials();
288288
if( !g.perm.Admin ){
289289
login_needed();
290290
}
291291
style_header("Content Source %d", rcvid);
292
- db_prepare(&q,
292
+ db_prepare(&q,
293293
"SELECT login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
294294
" FROM rcvfrom LEFT JOIN user USING(uid)"
295295
" WHERE rcvid=%d",
296296
rcvid
297297
);
298298
--- src/shun.c
+++ src/shun.c
@@ -69,11 +69,11 @@
69 style_header("Shunned Artifacts");
70 if( zUuid && P("sub") ){
71 login_verify_csrf_secret();
72 db_multi_exec("DELETE FROM shun WHERE uuid='%s'", zUuid);
73 if( db_exists("SELECT 1 FROM blob WHERE uuid='%s'", zUuid) ){
74 @ <p class="noMoreShun">Artifact
75 @ <a href="%s(g.zTop)/artifact/%s(zUuid)">%s(zUuid)</a> is no
76 @ longer being shunned.</p>
77 }else{
78 @ <p class="noMoreShun">Artifact %s(zUuid) will no longer
79 @ be shunned. But it does not exist in the repository. It
@@ -107,11 +107,11 @@
107 }
108 @ <p>A shunned artifact will not be pushed nor accepted in a pull and the
109 @ artifact content will be purged from the repository the next time the
110 @ repository is rebuilt. A list of shunned artifacts can be seen at the
111 @ bottom of this page.</p>
112 @
113 @ <a name="addshun"></a>
114 @ <p>To shun an artifact, enter its artifact ID (the 40-character SHA1
115 @ hash of the artifact) in the
116 @ following box and press the "Shun" button. This will cause the artifact
117 @ to be removed from the repository and will prevent the artifact from being
@@ -124,11 +124,11 @@
124 @ from the repository. Inappropriate content includes such things as
125 @ spam added to Wiki, files that violate copyright or patent agreements,
126 @ or artifacts that by design or accident interfere with the processing
127 @ of the repository. Do not shun artifacts merely to remove them from
128 @ sight - set the "hidden" tag on such artifacts instead.</p>
129 @
130 @ <blockquote>
131 @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div>
132 login_insert_csrf_secret();
133 @ <input type="text" name="uuid" value="%h(PD("shun",""))" size="50" />
134 @ <input type="submit" name="add" value="Shun" />
@@ -159,14 +159,14 @@
159 @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div>
160 login_insert_csrf_secret();
161 @ <input type="submit" name="rebuild" value="Rebuild" />
162 @ </div></form>
163 @ </blockquote>
164 @
165 @ <hr /><p>Shunned Artifacts:</p>
166 @ <blockquote><p>
167 db_prepare(&q,
168 "SELECT uuid, EXISTS(SELECT 1 FROM blob WHERE blob.uuid=shun.uuid)"
169 " FROM shun ORDER BY uuid");
170 while( db_step(&q)==SQLITE_ROW ){
171 const char *zUuid = db_column_text(&q, 0);
172 int stillExists = db_column_int(&q, 1);
@@ -228,11 +228,11 @@
228 style_header("Content Sources");
229 if( ofst>0 ){
230 style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d",
231 ofst>30 ? ofst-30 : 0);
232 }
233 db_prepare(&q,
234 "SELECT rcvid, login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
235 " FROM rcvfrom LEFT JOIN user USING(uid)"
236 " ORDER BY rcvid DESC LIMIT 31 OFFSET %d",
237 ofst
238 );
@@ -287,11 +287,11 @@
287 login_check_credentials();
288 if( !g.perm.Admin ){
289 login_needed();
290 }
291 style_header("Content Source %d", rcvid);
292 db_prepare(&q,
293 "SELECT login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
294 " FROM rcvfrom LEFT JOIN user USING(uid)"
295 " WHERE rcvid=%d",
296 rcvid
297 );
298
--- src/shun.c
+++ src/shun.c
@@ -69,11 +69,11 @@
69 style_header("Shunned Artifacts");
70 if( zUuid && P("sub") ){
71 login_verify_csrf_secret();
72 db_multi_exec("DELETE FROM shun WHERE uuid='%s'", zUuid);
73 if( db_exists("SELECT 1 FROM blob WHERE uuid='%s'", zUuid) ){
74 @ <p class="noMoreShun">Artifact
75 @ <a href="%s(g.zTop)/artifact/%s(zUuid)">%s(zUuid)</a> is no
76 @ longer being shunned.</p>
77 }else{
78 @ <p class="noMoreShun">Artifact %s(zUuid) will no longer
79 @ be shunned. But it does not exist in the repository. It
@@ -107,11 +107,11 @@
107 }
108 @ <p>A shunned artifact will not be pushed nor accepted in a pull and the
109 @ artifact content will be purged from the repository the next time the
110 @ repository is rebuilt. A list of shunned artifacts can be seen at the
111 @ bottom of this page.</p>
112 @
113 @ <a name="addshun"></a>
114 @ <p>To shun an artifact, enter its artifact ID (the 40-character SHA1
115 @ hash of the artifact) in the
116 @ following box and press the "Shun" button. This will cause the artifact
117 @ to be removed from the repository and will prevent the artifact from being
@@ -124,11 +124,11 @@
124 @ from the repository. Inappropriate content includes such things as
125 @ spam added to Wiki, files that violate copyright or patent agreements,
126 @ or artifacts that by design or accident interfere with the processing
127 @ of the repository. Do not shun artifacts merely to remove them from
128 @ sight - set the "hidden" tag on such artifacts instead.</p>
129 @
130 @ <blockquote>
131 @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div>
132 login_insert_csrf_secret();
133 @ <input type="text" name="uuid" value="%h(PD("shun",""))" size="50" />
134 @ <input type="submit" name="add" value="Shun" />
@@ -159,14 +159,14 @@
159 @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div>
160 login_insert_csrf_secret();
161 @ <input type="submit" name="rebuild" value="Rebuild" />
162 @ </div></form>
163 @ </blockquote>
164 @
165 @ <hr /><p>Shunned Artifacts:</p>
166 @ <blockquote><p>
167 db_prepare(&q,
168 "SELECT uuid, EXISTS(SELECT 1 FROM blob WHERE blob.uuid=shun.uuid)"
169 " FROM shun ORDER BY uuid");
170 while( db_step(&q)==SQLITE_ROW ){
171 const char *zUuid = db_column_text(&q, 0);
172 int stillExists = db_column_int(&q, 1);
@@ -228,11 +228,11 @@
228 style_header("Content Sources");
229 if( ofst>0 ){
230 style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d",
231 ofst>30 ? ofst-30 : 0);
232 }
233 db_prepare(&q,
234 "SELECT rcvid, login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
235 " FROM rcvfrom LEFT JOIN user USING(uid)"
236 " ORDER BY rcvid DESC LIMIT 31 OFFSET %d",
237 ofst
238 );
@@ -287,11 +287,11 @@
287 login_check_credentials();
288 if( !g.perm.Admin ){
289 login_needed();
290 }
291 style_header("Content Source %d", rcvid);
292 db_prepare(&q,
293 "SELECT login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
294 " FROM rcvfrom LEFT JOIN user USING(uid)"
295 " WHERE rcvid=%d",
296 rcvid
297 );
298
+2505 -1860
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3
-** version 3.8.3.1. By combining all the individual C code files into this
3
+** version 3.8.4.1. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
77
** of 5% or more are commonly seen when SQLite is compiled as a single
88
** translation unit.
@@ -23,10 +23,97 @@
2323
# define SQLITE_PRIVATE static
2424
#endif
2525
#ifndef SQLITE_API
2626
# define SQLITE_API
2727
#endif
28
+/************** Begin file sqliteInt.h ***************************************/
29
+/*
30
+** 2001 September 15
31
+**
32
+** The author disclaims copyright to this source code. In place of
33
+** a legal notice, here is a blessing:
34
+**
35
+** May you do good and not evil.
36
+** May you find forgiveness for yourself and forgive others.
37
+** May you share freely, never taking more than you give.
38
+**
39
+*************************************************************************
40
+** Internal interface definitions for SQLite.
41
+**
42
+*/
43
+#ifndef _SQLITEINT_H_
44
+#define _SQLITEINT_H_
45
+
46
+/*
47
+** These #defines should enable >2GB file support on POSIX if the
48
+** underlying operating system supports it. If the OS lacks
49
+** large file support, or if the OS is windows, these should be no-ops.
50
+**
51
+** Ticket #2739: The _LARGEFILE_SOURCE macro must appear before any
52
+** system #includes. Hence, this block of code must be the very first
53
+** code in all source files.
54
+**
55
+** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch
56
+** on the compiler command line. This is necessary if you are compiling
57
+** on a recent machine (ex: Red Hat 7.2) but you want your code to work
58
+** on an older machine (ex: Red Hat 6.0). If you compile on Red Hat 7.2
59
+** without this option, LFS is enable. But LFS does not exist in the kernel
60
+** in Red Hat 6.0, so the code won't work. Hence, for maximum binary
61
+** portability you should omit LFS.
62
+**
63
+** The previous paragraph was written in 2005. (This paragraph is written
64
+** on 2008-11-28.) These days, all Linux kernels support large files, so
65
+** you should probably leave LFS enabled. But some embedded platforms might
66
+** lack LFS in which case the SQLITE_DISABLE_LFS macro might still be useful.
67
+**
68
+** Similar is true for Mac OS X. LFS is only supported on Mac OS X 9 and later.
69
+*/
70
+#ifndef SQLITE_DISABLE_LFS
71
+# define _LARGE_FILE 1
72
+# ifndef _FILE_OFFSET_BITS
73
+# define _FILE_OFFSET_BITS 64
74
+# endif
75
+# define _LARGEFILE_SOURCE 1
76
+#endif
77
+
78
+/*
79
+** For MinGW, check to see if we can include the header file containing its
80
+** version information, among other things. Normally, this internal MinGW
81
+** header file would [only] be included automatically by other MinGW header
82
+** files; however, the contained version information is now required by this
83
+** header file to work around binary compatibility issues (see below) and
84
+** this is the only known way to reliably obtain it. This entire #if block
85
+** would be completely unnecessary if there was any other way of detecting
86
+** MinGW via their preprocessor (e.g. if they customized their GCC to define
87
+** some MinGW-specific macros). When compiling for MinGW, either the
88
+** _HAVE_MINGW_H or _HAVE__MINGW_H (note the extra underscore) macro must be
89
+** defined; otherwise, detection of conditions specific to MinGW will be
90
+** disabled.
91
+*/
92
+#if defined(_HAVE_MINGW_H)
93
+# include "mingw.h"
94
+#elif defined(_HAVE__MINGW_H)
95
+# include "_mingw.h"
96
+#endif
97
+
98
+/*
99
+** For MinGW version 4.x (and higher), check to see if the _USE_32BIT_TIME_T
100
+** define is required to maintain binary compatibility with the MSVC runtime
101
+** library in use (e.g. for Windows XP).
102
+*/
103
+#if !defined(_USE_32BIT_TIME_T) && !defined(_USE_64BIT_TIME_T) && \
104
+ defined(_WIN32) && !defined(_WIN64) && \
105
+ defined(__MINGW_MAJOR_VERSION) && __MINGW_MAJOR_VERSION >= 4 && \
106
+ defined(__MSVCRT__)
107
+# define _USE_32BIT_TIME_T
108
+#endif
109
+
110
+/* The public SQLite interface. The _FILE_OFFSET_BITS macro must appear
111
+** first in QNX. Also, the _USE_32BIT_TIME_T macro must appear first for
112
+** MinGW.
113
+*/
114
+/************** Include sqlite3.h in the middle of sqliteInt.h ***************/
28115
/************** Begin file sqlite3.h *****************************************/
29116
/*
30117
** 2001 September 15
31118
**
32119
** The author disclaims copyright to this source code. In place of
@@ -133,13 +220,13 @@
133220
**
134221
** See also: [sqlite3_libversion()],
135222
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
136223
** [sqlite_version()] and [sqlite_source_id()].
137224
*/
138
-#define SQLITE_VERSION "3.8.3.1"
139
-#define SQLITE_VERSION_NUMBER 3008003
140
-#define SQLITE_SOURCE_ID "2014-02-11 14:52:19 ea3317a4803d71d88183b29f1d3086f46d68a00e"
225
+#define SQLITE_VERSION "3.8.4.1"
226
+#define SQLITE_VERSION_NUMBER 3008004
227
+#define SQLITE_SOURCE_ID "2014-03-11 15:27:36 018d317b1257ce68a92908b05c9c7cf1494050d0"
141228
142229
/*
143230
** CAPI3REF: Run-Time Library Version Numbers
144231
** KEYWORDS: sqlite3_version, sqlite3_sourceid
145232
**
@@ -6148,11 +6235,12 @@
61486235
#define SQLITE_TESTCTRL_ISKEYWORD 16
61496236
#define SQLITE_TESTCTRL_SCRATCHMALLOC 17
61506237
#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
61516238
#define SQLITE_TESTCTRL_EXPLAIN_STMT 19
61526239
#define SQLITE_TESTCTRL_NEVER_CORRUPT 20
6153
-#define SQLITE_TESTCTRL_LAST 20
6240
+#define SQLITE_TESTCTRL_VDBE_COVERAGE 21
6241
+#define SQLITE_TESTCTRL_LAST 21
61546242
61556243
/*
61566244
** CAPI3REF: SQLite Runtime Status
61576245
**
61586246
** ^This interface is used to retrieve runtime status information
@@ -7411,54 +7499,11 @@
74117499
74127500
#endif /* ifndef _SQLITE3RTREE_H_ */
74137501
74147502
74157503
/************** End of sqlite3.h *********************************************/
7416
-/************** Begin file sqliteInt.h ***************************************/
7417
-/*
7418
-** 2001 September 15
7419
-**
7420
-** The author disclaims copyright to this source code. In place of
7421
-** a legal notice, here is a blessing:
7422
-**
7423
-** May you do good and not evil.
7424
-** May you find forgiveness for yourself and forgive others.
7425
-** May you share freely, never taking more than you give.
7426
-**
7427
-*************************************************************************
7428
-** Internal interface definitions for SQLite.
7429
-**
7430
-*/
7431
-#ifndef _SQLITEINT_H_
7432
-#define _SQLITEINT_H_
7433
-
7434
-/*
7435
-** These #defines should enable >2GB file support on POSIX if the
7436
-** underlying operating system supports it. If the OS lacks
7437
-** large file support, or if the OS is windows, these should be no-ops.
7438
-**
7439
-** Ticket #2739: The _LARGEFILE_SOURCE macro must appear before any
7440
-** system #includes. Hence, this block of code must be the very first
7441
-** code in all source files.
7442
-**
7443
-** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch
7444
-** on the compiler command line. This is necessary if you are compiling
7445
-** on a recent machine (ex: Red Hat 7.2) but you want your code to work
7446
-** on an older machine (ex: Red Hat 6.0). If you compile on Red Hat 7.2
7447
-** without this option, LFS is enable. But LFS does not exist in the kernel
7448
-** in Red Hat 6.0, so the code won't work. Hence, for maximum binary
7449
-** portability you should omit LFS.
7450
-**
7451
-** Similar is true for Mac OS X. LFS is only supported on Mac OS X 9 and later.
7452
-*/
7453
-#ifndef SQLITE_DISABLE_LFS
7454
-# define _LARGE_FILE 1
7455
-# ifndef _FILE_OFFSET_BITS
7456
-# define _FILE_OFFSET_BITS 64
7457
-# endif
7458
-# define _LARGEFILE_SOURCE 1
7459
-#endif
7504
+/************** Continuing where we left off in sqliteInt.h ******************/
74607505
74617506
/*
74627507
** Include the configuration header output by 'configure' if we're using the
74637508
** autoconf-based build
74647509
*/
@@ -8841,12 +8886,10 @@
88418886
SQLITE_PRIVATE int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*);
88428887
SQLITE_PRIVATE const void *sqlite3BtreeKeyFetch(BtCursor*, u32 *pAmt);
88438888
SQLITE_PRIVATE const void *sqlite3BtreeDataFetch(BtCursor*, u32 *pAmt);
88448889
SQLITE_PRIVATE int sqlite3BtreeDataSize(BtCursor*, u32 *pSize);
88458890
SQLITE_PRIVATE int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*);
8846
-SQLITE_PRIVATE void sqlite3BtreeSetCachedRowid(BtCursor*, sqlite3_int64);
8847
-SQLITE_PRIVATE sqlite3_int64 sqlite3BtreeGetCachedRowid(BtCursor*);
88488891
88498892
SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*);
88508893
SQLITE_PRIVATE struct Pager *sqlite3BtreePager(Btree*);
88518894
88528895
SQLITE_PRIVATE int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*);
@@ -8982,13 +9025,16 @@
89829025
} p4;
89839026
#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
89849027
char *zComment; /* Comment to improve readability */
89859028
#endif
89869029
#ifdef VDBE_PROFILE
8987
- int cnt; /* Number of times this instruction was executed */
9030
+ u32 cnt; /* Number of times this instruction was executed */
89889031
u64 cycles; /* Total time spent executing this instruction */
89899032
#endif
9033
+#ifdef SQLITE_VDBE_COVERAGE
9034
+ int iSrcLine; /* Source-code line that generated this opcode */
9035
+#endif
89909036
};
89919037
typedef struct VdbeOp VdbeOp;
89929038
89939039
89949040
/*
@@ -9094,75 +9140,75 @@
90949140
#define OP_VUpdate 15 /* synopsis: data=r[P3@P2] */
90959141
#define OP_Goto 16
90969142
#define OP_Gosub 17
90979143
#define OP_Return 18
90989144
#define OP_Not 19 /* same as TK_NOT, synopsis: r[P2]= !r[P1] */
9099
-#define OP_Yield 20
9100
-#define OP_HaltIfNull 21 /* synopsis: if r[P3] null then halt */
9101
-#define OP_Halt 22
9102
-#define OP_Integer 23 /* synopsis: r[P2]=P1 */
9103
-#define OP_Int64 24 /* synopsis: r[P2]=P4 */
9104
-#define OP_String 25 /* synopsis: r[P2]='P4' (len=P1) */
9105
-#define OP_Null 26 /* synopsis: r[P2..P3]=NULL */
9106
-#define OP_Blob 27 /* synopsis: r[P2]=P4 (len=P1) */
9107
-#define OP_Variable 28 /* synopsis: r[P2]=parameter(P1,P4) */
9108
-#define OP_Move 29 /* synopsis: r[P2@P3]=r[P1@P3] */
9109
-#define OP_Copy 30 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
9110
-#define OP_SCopy 31 /* synopsis: r[P2]=r[P1] */
9111
-#define OP_ResultRow 32 /* synopsis: output=r[P1@P2] */
9112
-#define OP_CollSeq 33
9113
-#define OP_AddImm 34 /* synopsis: r[P1]=r[P1]+P2 */
9114
-#define OP_MustBeInt 35
9115
-#define OP_RealAffinity 36
9116
-#define OP_Permutation 37
9117
-#define OP_Compare 38
9118
-#define OP_Jump 39
9119
-#define OP_Once 40
9120
-#define OP_If 41
9121
-#define OP_IfNot 42
9122
-#define OP_Column 43 /* synopsis: r[P3]=PX */
9123
-#define OP_Affinity 44 /* synopsis: affinity(r[P1@P2]) */
9124
-#define OP_MakeRecord 45 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
9125
-#define OP_Count 46 /* synopsis: r[P2]=count() */
9126
-#define OP_ReadCookie 47
9127
-#define OP_SetCookie 48
9128
-#define OP_VerifyCookie 49
9129
-#define OP_OpenRead 50 /* synopsis: root=P2 iDb=P3 */
9130
-#define OP_OpenWrite 51 /* synopsis: root=P2 iDb=P3 */
9131
-#define OP_OpenAutoindex 52 /* synopsis: nColumn=P2 */
9132
-#define OP_OpenEphemeral 53 /* synopsis: nColumn=P2 */
9133
-#define OP_SorterOpen 54
9134
-#define OP_OpenPseudo 55 /* synopsis: content in r[P2@P3] */
9135
-#define OP_Close 56
9136
-#define OP_SeekLt 57 /* synopsis: key=r[P3@P4] */
9137
-#define OP_SeekLe 58 /* synopsis: key=r[P3@P4] */
9138
-#define OP_SeekGe 59 /* synopsis: key=r[P3@P4] */
9139
-#define OP_SeekGt 60 /* synopsis: key=r[P3@P4] */
9140
-#define OP_Seek 61 /* synopsis: intkey=r[P2] */
9141
-#define OP_NoConflict 62 /* synopsis: key=r[P3@P4] */
9142
-#define OP_NotFound 63 /* synopsis: key=r[P3@P4] */
9143
-#define OP_Found 64 /* synopsis: key=r[P3@P4] */
9144
-#define OP_NotExists 65 /* synopsis: intkey=r[P3] */
9145
-#define OP_Sequence 66 /* synopsis: r[P2]=rowid */
9146
-#define OP_NewRowid 67 /* synopsis: r[P2]=rowid */
9147
-#define OP_Insert 68 /* synopsis: intkey=r[P3] data=r[P2] */
9148
-#define OP_InsertInt 69 /* synopsis: intkey=P3 data=r[P2] */
9149
-#define OP_Delete 70
9145
+#define OP_InitCoroutine 20
9146
+#define OP_EndCoroutine 21
9147
+#define OP_Yield 22
9148
+#define OP_HaltIfNull 23 /* synopsis: if r[P3]=null halt */
9149
+#define OP_Halt 24
9150
+#define OP_Integer 25 /* synopsis: r[P2]=P1 */
9151
+#define OP_Int64 26 /* synopsis: r[P2]=P4 */
9152
+#define OP_String 27 /* synopsis: r[P2]='P4' (len=P1) */
9153
+#define OP_Null 28 /* synopsis: r[P2..P3]=NULL */
9154
+#define OP_SoftNull 29 /* synopsis: r[P1]=NULL */
9155
+#define OP_Blob 30 /* synopsis: r[P2]=P4 (len=P1) */
9156
+#define OP_Variable 31 /* synopsis: r[P2]=parameter(P1,P4) */
9157
+#define OP_Move 32 /* synopsis: r[P2@P3]=r[P1@P3] */
9158
+#define OP_Copy 33 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
9159
+#define OP_SCopy 34 /* synopsis: r[P2]=r[P1] */
9160
+#define OP_ResultRow 35 /* synopsis: output=r[P1@P2] */
9161
+#define OP_CollSeq 36
9162
+#define OP_AddImm 37 /* synopsis: r[P1]=r[P1]+P2 */
9163
+#define OP_MustBeInt 38
9164
+#define OP_RealAffinity 39
9165
+#define OP_Permutation 40
9166
+#define OP_Compare 41
9167
+#define OP_Jump 42
9168
+#define OP_Once 43
9169
+#define OP_If 44
9170
+#define OP_IfNot 45
9171
+#define OP_Column 46 /* synopsis: r[P3]=PX */
9172
+#define OP_Affinity 47 /* synopsis: affinity(r[P1@P2]) */
9173
+#define OP_MakeRecord 48 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
9174
+#define OP_Count 49 /* synopsis: r[P2]=count() */
9175
+#define OP_ReadCookie 50
9176
+#define OP_SetCookie 51
9177
+#define OP_OpenRead 52 /* synopsis: root=P2 iDb=P3 */
9178
+#define OP_OpenWrite 53 /* synopsis: root=P2 iDb=P3 */
9179
+#define OP_OpenAutoindex 54 /* synopsis: nColumn=P2 */
9180
+#define OP_OpenEphemeral 55 /* synopsis: nColumn=P2 */
9181
+#define OP_SorterOpen 56
9182
+#define OP_OpenPseudo 57 /* synopsis: P3 columns in r[P2] */
9183
+#define OP_Close 58
9184
+#define OP_SeekLT 59
9185
+#define OP_SeekLE 60
9186
+#define OP_SeekGE 61
9187
+#define OP_SeekGT 62
9188
+#define OP_Seek 63 /* synopsis: intkey=r[P2] */
9189
+#define OP_NoConflict 64 /* synopsis: key=r[P3@P4] */
9190
+#define OP_NotFound 65 /* synopsis: key=r[P3@P4] */
9191
+#define OP_Found 66 /* synopsis: key=r[P3@P4] */
9192
+#define OP_NotExists 67 /* synopsis: intkey=r[P3] */
9193
+#define OP_Sequence 68 /* synopsis: r[P2]=rowid */
9194
+#define OP_NewRowid 69 /* synopsis: r[P2]=rowid */
9195
+#define OP_Insert 70 /* synopsis: intkey=r[P3] data=r[P2] */
91509196
#define OP_Or 71 /* same as TK_OR, synopsis: r[P3]=(r[P1] || r[P2]) */
91519197
#define OP_And 72 /* same as TK_AND, synopsis: r[P3]=(r[P1] && r[P2]) */
9152
-#define OP_ResetCount 73
9153
-#define OP_SorterCompare 74 /* synopsis: if key(P1)!=rtrim(r[P3],P4) goto P2 */
9154
-#define OP_SorterData 75 /* synopsis: r[P2]=data */
9198
+#define OP_InsertInt 73 /* synopsis: intkey=P3 data=r[P2] */
9199
+#define OP_Delete 74
9200
+#define OP_ResetCount 75
91559201
#define OP_IsNull 76 /* same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */
91569202
#define OP_NotNull 77 /* same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */
91579203
#define OP_Ne 78 /* same as TK_NE, synopsis: if r[P1]!=r[P3] goto P2 */
91589204
#define OP_Eq 79 /* same as TK_EQ, synopsis: if r[P1]==r[P3] goto P2 */
91599205
#define OP_Gt 80 /* same as TK_GT, synopsis: if r[P1]>r[P3] goto P2 */
91609206
#define OP_Le 81 /* same as TK_LE, synopsis: if r[P1]<=r[P3] goto P2 */
91619207
#define OP_Lt 82 /* same as TK_LT, synopsis: if r[P1]<r[P3] goto P2 */
91629208
#define OP_Ge 83 /* same as TK_GE, synopsis: if r[P1]>=r[P3] goto P2 */
9163
-#define OP_RowKey 84 /* synopsis: r[P2]=key */
9209
+#define OP_SorterCompare 84 /* synopsis: if key(P1)!=rtrim(r[P3],P4) goto P2 */
91649210
#define OP_BitAnd 85 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
91659211
#define OP_BitOr 86 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
91669212
#define OP_ShiftLeft 87 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
91679213
#define OP_ShiftRight 88 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */
91689214
#define OP_Add 89 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */
@@ -9169,68 +9215,72 @@
91699215
#define OP_Subtract 90 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */
91709216
#define OP_Multiply 91 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */
91719217
#define OP_Divide 92 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
91729218
#define OP_Remainder 93 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
91739219
#define OP_Concat 94 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
9174
-#define OP_RowData 95 /* synopsis: r[P2]=data */
9220
+#define OP_SorterData 95 /* synopsis: r[P2]=data */
91759221
#define OP_BitNot 96 /* same as TK_BITNOT, synopsis: r[P1]= ~r[P1] */
91769222
#define OP_String8 97 /* same as TK_STRING, synopsis: r[P2]='P4' */
9177
-#define OP_Rowid 98 /* synopsis: r[P2]=rowid */
9178
-#define OP_NullRow 99
9179
-#define OP_Last 100
9180
-#define OP_SorterSort 101
9181
-#define OP_Sort 102
9182
-#define OP_Rewind 103
9183
-#define OP_SorterInsert 104
9184
-#define OP_IdxInsert 105 /* synopsis: key=r[P2] */
9185
-#define OP_IdxDelete 106 /* synopsis: key=r[P2@P3] */
9186
-#define OP_IdxRowid 107 /* synopsis: r[P2]=rowid */
9187
-#define OP_IdxLT 108 /* synopsis: key=r[P3@P4] */
9188
-#define OP_IdxGE 109 /* synopsis: key=r[P3@P4] */
9189
-#define OP_Destroy 110
9190
-#define OP_Clear 111
9191
-#define OP_CreateIndex 112 /* synopsis: r[P2]=root iDb=P1 */
9192
-#define OP_CreateTable 113 /* synopsis: r[P2]=root iDb=P1 */
9193
-#define OP_ParseSchema 114
9194
-#define OP_LoadAnalysis 115
9195
-#define OP_DropTable 116
9196
-#define OP_DropIndex 117
9197
-#define OP_DropTrigger 118
9198
-#define OP_IntegrityCk 119
9199
-#define OP_RowSetAdd 120 /* synopsis: rowset(P1)=r[P2] */
9200
-#define OP_RowSetRead 121 /* synopsis: r[P3]=rowset(P1) */
9201
-#define OP_RowSetTest 122 /* synopsis: if r[P3] in rowset(P1) goto P2 */
9202
-#define OP_Program 123
9203
-#define OP_Param 124
9204
-#define OP_FkCounter 125 /* synopsis: fkctr[P1]+=P2 */
9205
-#define OP_FkIfZero 126 /* synopsis: if fkctr[P1]==0 goto P2 */
9206
-#define OP_MemMax 127 /* synopsis: r[P1]=max(r[P1],r[P2]) */
9207
-#define OP_IfPos 128 /* synopsis: if r[P1]>0 goto P2 */
9208
-#define OP_IfNeg 129 /* synopsis: if r[P1]<0 goto P2 */
9209
-#define OP_IfZero 130 /* synopsis: r[P1]+=P3, if r[P1]==0 goto P2 */
9210
-#define OP_AggFinal 131 /* synopsis: accum=r[P1] N=P2 */
9211
-#define OP_IncrVacuum 132
9223
+#define OP_RowKey 98 /* synopsis: r[P2]=key */
9224
+#define OP_RowData 99 /* synopsis: r[P2]=data */
9225
+#define OP_Rowid 100 /* synopsis: r[P2]=rowid */
9226
+#define OP_NullRow 101
9227
+#define OP_Last 102
9228
+#define OP_SorterSort 103
9229
+#define OP_Sort 104
9230
+#define OP_Rewind 105
9231
+#define OP_SorterInsert 106
9232
+#define OP_IdxInsert 107 /* synopsis: key=r[P2] */
9233
+#define OP_IdxDelete 108 /* synopsis: key=r[P2@P3] */
9234
+#define OP_IdxRowid 109 /* synopsis: r[P2]=rowid */
9235
+#define OP_IdxLE 110 /* synopsis: key=r[P3@P4] */
9236
+#define OP_IdxGT 111 /* synopsis: key=r[P3@P4] */
9237
+#define OP_IdxLT 112 /* synopsis: key=r[P3@P4] */
9238
+#define OP_IdxGE 113 /* synopsis: key=r[P3@P4] */
9239
+#define OP_Destroy 114
9240
+#define OP_Clear 115
9241
+#define OP_CreateIndex 116 /* synopsis: r[P2]=root iDb=P1 */
9242
+#define OP_CreateTable 117 /* synopsis: r[P2]=root iDb=P1 */
9243
+#define OP_ParseSchema 118
9244
+#define OP_LoadAnalysis 119
9245
+#define OP_DropTable 120
9246
+#define OP_DropIndex 121
9247
+#define OP_DropTrigger 122
9248
+#define OP_IntegrityCk 123
9249
+#define OP_RowSetAdd 124 /* synopsis: rowset(P1)=r[P2] */
9250
+#define OP_RowSetRead 125 /* synopsis: r[P3]=rowset(P1) */
9251
+#define OP_RowSetTest 126 /* synopsis: if r[P3] in rowset(P1) goto P2 */
9252
+#define OP_Program 127
9253
+#define OP_Param 128
9254
+#define OP_FkCounter 129 /* synopsis: fkctr[P1]+=P2 */
9255
+#define OP_FkIfZero 130 /* synopsis: if fkctr[P1]==0 goto P2 */
9256
+#define OP_MemMax 131 /* synopsis: r[P1]=max(r[P1],r[P2]) */
9257
+#define OP_IfPos 132 /* synopsis: if r[P1]>0 goto P2 */
92129258
#define OP_Real 133 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
9213
-#define OP_Expire 134
9214
-#define OP_TableLock 135 /* synopsis: iDb=P1 root=P2 write=P3 */
9215
-#define OP_VBegin 136
9216
-#define OP_VCreate 137
9217
-#define OP_VDestroy 138
9218
-#define OP_VOpen 139
9219
-#define OP_VColumn 140 /* synopsis: r[P3]=vcolumn(P2) */
9220
-#define OP_VNext 141
9221
-#define OP_VRename 142
9259
+#define OP_IfNeg 134 /* synopsis: if r[P1]<0 goto P2 */
9260
+#define OP_IfZero 135 /* synopsis: r[P1]+=P3, if r[P1]==0 goto P2 */
9261
+#define OP_AggFinal 136 /* synopsis: accum=r[P1] N=P2 */
9262
+#define OP_IncrVacuum 137
9263
+#define OP_Expire 138
9264
+#define OP_TableLock 139 /* synopsis: iDb=P1 root=P2 write=P3 */
9265
+#define OP_VBegin 140
9266
+#define OP_VCreate 141
9267
+#define OP_VDestroy 142
92229268
#define OP_ToText 143 /* same as TK_TO_TEXT */
92239269
#define OP_ToBlob 144 /* same as TK_TO_BLOB */
92249270
#define OP_ToNumeric 145 /* same as TK_TO_NUMERIC */
92259271
#define OP_ToInt 146 /* same as TK_TO_INT */
92269272
#define OP_ToReal 147 /* same as TK_TO_REAL */
9227
-#define OP_Pagecount 148
9228
-#define OP_MaxPgcnt 149
9229
-#define OP_Trace 150
9230
-#define OP_Noop 151
9231
-#define OP_Explain 152
9273
+#define OP_VOpen 148
9274
+#define OP_VColumn 149 /* synopsis: r[P3]=vcolumn(P2) */
9275
+#define OP_VNext 150
9276
+#define OP_VRename 151
9277
+#define OP_Pagecount 152
9278
+#define OP_MaxPgcnt 153
9279
+#define OP_Init 154 /* synopsis: Start at P2 */
9280
+#define OP_Noop 155
9281
+#define OP_Explain 156
92329282
92339283
92349284
/* Properties such as "out2" or "jump" that are specified in
92359285
** comments following the "case" for each opcode in the vdbe.c
92369286
** are encoded into bitvectors as follows:
@@ -9243,28 +9293,28 @@
92439293
#define OPFLG_OUT2 0x0020 /* out2: P2 is an output */
92449294
#define OPFLG_OUT3 0x0040 /* out3: P3 is an output */
92459295
#define OPFLG_INITIALIZER {\
92469296
/* 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,\
92479297
/* 8 */ 0x01, 0x01, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00,\
9248
-/* 16 */ 0x01, 0x01, 0x04, 0x24, 0x04, 0x10, 0x00, 0x02,\
9249
-/* 24 */ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x20,\
9250
-/* 32 */ 0x00, 0x00, 0x04, 0x05, 0x04, 0x00, 0x00, 0x01,\
9251
-/* 40 */ 0x01, 0x05, 0x05, 0x00, 0x00, 0x00, 0x02, 0x02,\
9252
-/* 48 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
9253
-/* 56 */ 0x00, 0x11, 0x11, 0x11, 0x11, 0x08, 0x11, 0x11,\
9254
-/* 64 */ 0x11, 0x11, 0x02, 0x02, 0x00, 0x00, 0x00, 0x4c,\
9298
+/* 16 */ 0x01, 0x01, 0x04, 0x24, 0x01, 0x04, 0x05, 0x10,\
9299
+/* 24 */ 0x00, 0x02, 0x02, 0x02, 0x02, 0x00, 0x02, 0x02,\
9300
+/* 32 */ 0x00, 0x00, 0x20, 0x00, 0x00, 0x04, 0x05, 0x04,\
9301
+/* 40 */ 0x00, 0x00, 0x01, 0x01, 0x05, 0x05, 0x00, 0x00,\
9302
+/* 48 */ 0x00, 0x02, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00,\
9303
+/* 56 */ 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x08,\
9304
+/* 64 */ 0x11, 0x11, 0x11, 0x11, 0x02, 0x02, 0x00, 0x4c,\
92559305
/* 72 */ 0x4c, 0x00, 0x00, 0x00, 0x05, 0x05, 0x15, 0x15,\
92569306
/* 80 */ 0x15, 0x15, 0x15, 0x15, 0x00, 0x4c, 0x4c, 0x4c,\
92579307
/* 88 */ 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x00,\
9258
-/* 96 */ 0x24, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,\
9259
-/* 104 */ 0x08, 0x08, 0x00, 0x02, 0x01, 0x01, 0x02, 0x00,\
9260
-/* 112 */ 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
9261
-/* 120 */ 0x0c, 0x45, 0x15, 0x01, 0x02, 0x00, 0x01, 0x08,\
9262
-/* 128 */ 0x05, 0x05, 0x05, 0x00, 0x01, 0x02, 0x00, 0x00,\
9263
-/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04,\
9264
-/* 144 */ 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x00, 0x00,\
9265
-/* 152 */ 0x00,}
9308
+/* 96 */ 0x24, 0x02, 0x00, 0x00, 0x02, 0x00, 0x01, 0x01,\
9309
+/* 104 */ 0x01, 0x01, 0x08, 0x08, 0x00, 0x02, 0x01, 0x01,\
9310
+/* 112 */ 0x01, 0x01, 0x02, 0x00, 0x02, 0x02, 0x00, 0x00,\
9311
+/* 120 */ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x45, 0x15, 0x01,\
9312
+/* 128 */ 0x02, 0x00, 0x01, 0x08, 0x05, 0x02, 0x05, 0x05,\
9313
+/* 136 */ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,\
9314
+/* 144 */ 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x01, 0x00,\
9315
+/* 152 */ 0x02, 0x02, 0x01, 0x00, 0x00,}
92669316
92679317
/************** End of opcodes.h *********************************************/
92689318
/************** Continuing where we left off in vdbe.h ***********************/
92699319
92709320
/*
@@ -9276,11 +9326,11 @@
92769326
SQLITE_PRIVATE int sqlite3VdbeAddOp1(Vdbe*,int,int);
92779327
SQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe*,int,int,int);
92789328
SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int);
92799329
SQLITE_PRIVATE int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int);
92809330
SQLITE_PRIVATE int sqlite3VdbeAddOp4Int(Vdbe*,int,int,int,int,int);
9281
-SQLITE_PRIVATE int sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp);
9331
+SQLITE_PRIVATE int sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp, int iLineno);
92829332
SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*);
92839333
SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, u32 addr, int P1);
92849334
SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, u32 addr, int P2);
92859335
SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe*, u32 addr, int P3);
92869336
SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe*, u8 P5);
@@ -9317,12 +9367,15 @@
93179367
#ifndef SQLITE_OMIT_TRACE
93189368
SQLITE_PRIVATE char *sqlite3VdbeExpandSql(Vdbe*, const char*);
93199369
#endif
93209370
93219371
SQLITE_PRIVATE void sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,UnpackedRecord*);
9322
-SQLITE_PRIVATE int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*);
9372
+SQLITE_PRIVATE int sqlite3VdbeRecordCompare(int,const void*,const UnpackedRecord*,int);
93239373
SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(KeyInfo *, char *, int, char **);
9374
+
9375
+typedef int (*RecordCompare)(int,const void*,const UnpackedRecord*,int);
9376
+SQLITE_PRIVATE RecordCompare sqlite3VdbeFindCompare(UnpackedRecord*);
93249377
93259378
#ifndef SQLITE_OMIT_TRIGGER
93269379
SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *);
93279380
#endif
93289381
@@ -9347,10 +9400,47 @@
93479400
# define VdbeComment(X)
93489401
# define VdbeNoopComment(X)
93499402
# define VdbeModuleComment(X)
93509403
#endif
93519404
9405
+/*
9406
+** The VdbeCoverage macros are used to set a coverage testing point
9407
+** for VDBE branch instructions. The coverage testing points are line
9408
+** numbers in the sqlite3.c source file. VDBE branch coverage testing
9409
+** only works with an amalagmation build. That's ok since a VDBE branch
9410
+** coverage build designed for testing the test suite only. No application
9411
+** should ever ship with VDBE branch coverage measuring turned on.
9412
+**
9413
+** VdbeCoverage(v) // Mark the previously coded instruction
9414
+** // as a branch
9415
+**
9416
+** VdbeCoverageIf(v, conditional) // Mark previous if conditional true
9417
+**
9418
+** VdbeCoverageAlwaysTaken(v) // Previous branch is always taken
9419
+**
9420
+** VdbeCoverageNeverTaken(v) // Previous branch is never taken
9421
+**
9422
+** Every VDBE branch operation must be tagged with one of the macros above.
9423
+** If not, then when "make test" is run with -DSQLITE_VDBE_COVERAGE and
9424
+** -DSQLITE_DEBUG then an ALWAYS() will fail in the vdbeTakeBranch()
9425
+** routine in vdbe.c, alerting the developer to the missed tag.
9426
+*/
9427
+#ifdef SQLITE_VDBE_COVERAGE
9428
+SQLITE_PRIVATE void sqlite3VdbeSetLineNumber(Vdbe*,int);
9429
+# define VdbeCoverage(v) sqlite3VdbeSetLineNumber(v,__LINE__)
9430
+# define VdbeCoverageIf(v,x) if(x)sqlite3VdbeSetLineNumber(v,__LINE__)
9431
+# define VdbeCoverageAlwaysTaken(v) sqlite3VdbeSetLineNumber(v,2);
9432
+# define VdbeCoverageNeverTaken(v) sqlite3VdbeSetLineNumber(v,1);
9433
+# define VDBE_OFFSET_LINENO(x) (__LINE__+x)
9434
+#else
9435
+# define VdbeCoverage(v)
9436
+# define VdbeCoverageIf(v,x)
9437
+# define VdbeCoverageAlwaysTaken(v)
9438
+# define VdbeCoverageNeverTaken(v)
9439
+# define VDBE_OFFSET_LINENO(x) 0
9440
+#endif
9441
+
93529442
#endif
93539443
93549444
/************** End of vdbe.h ************************************************/
93559445
/************** Continuing where we left off in sqliteInt.h ******************/
93569446
/************** Include pager.h in the middle of sqliteInt.h *****************/
@@ -10404,12 +10494,11 @@
1040410494
1040510495
/*
1040610496
** Return true if it OK to factor constant expressions into the initialization
1040710497
** code. The argument is a Parse object for the code generator.
1040810498
*/
10409
-#define ConstFactorOk(P) \
10410
- ((P)->cookieGoto>0 && OptimizationEnabled((P)->db,SQLITE_FactorOutConst))
10499
+#define ConstFactorOk(P) ((P)->okConstFactor)
1041110500
1041210501
/*
1041310502
** Possible values for the sqlite.magic field.
1041410503
** The numbers are obtained at random and have no special meaning, other
1041510504
** than being distinct from one another.
@@ -10631,14 +10720,20 @@
1063110720
#define SQLITE_AFF_MASK 0x67
1063210721
1063310722
/*
1063410723
** Additional bit values that can be ORed with an affinity without
1063510724
** changing the affinity.
10725
+**
10726
+** The SQLITE_NOTNULL flag is a combination of NULLEQ and JUMPIFNULL.
10727
+** It causes an assert() to fire if either operand to a comparison
10728
+** operator is NULL. It is added to certain comparison operators to
10729
+** prove that the operands are always NOT NULL.
1063610730
*/
1063710731
#define SQLITE_JUMPIFNULL 0x08 /* jumps if either operand is NULL */
1063810732
#define SQLITE_STOREP2 0x10 /* Store result in reg[P2] rather than jump */
1063910733
#define SQLITE_NULLEQ 0x80 /* NULL=NULL */
10734
+#define SQLITE_NOTNULL 0x88 /* Assert that operands are never NULL */
1064010735
1064110736
/*
1064210737
** An object of this type is created for each virtual table present in
1064310738
** the database schema.
1064410739
**
@@ -10893,23 +10988,23 @@
1089310988
** the OP_MakeRecord opcode of the VDBE and is disassembled by the
1089410989
** OP_Column opcode.
1089510990
**
1089610991
** This structure holds a record that has already been disassembled
1089710992
** into its constituent fields.
10993
+**
10994
+** The r1 and r2 member variables are only used by the optimized comparison
10995
+** functions vdbeRecordCompareInt() and vdbeRecordCompareString().
1089810996
*/
1089910997
struct UnpackedRecord {
1090010998
KeyInfo *pKeyInfo; /* Collation and sort-order information */
1090110999
u16 nField; /* Number of entries in apMem[] */
10902
- u8 flags; /* Boolean settings. UNPACKED_... below */
11000
+ i8 default_rc; /* Comparison result if keys are equal */
1090311001
Mem *aMem; /* Values */
11002
+ int r1; /* Value to return if (lhs > rhs) */
11003
+ int r2; /* Value to return if (rhs < lhs) */
1090411004
};
1090511005
10906
-/*
10907
-** Allowed values of UnpackedRecord.flags
10908
-*/
10909
-#define UNPACKED_INCRKEY 0x01 /* Make this key an epsilon larger */
10910
-#define UNPACKED_PREFIX_MATCH 0x02 /* A prefix match is considered OK */
1091111006
1091211007
/*
1091311008
** Each SQL index is represented in memory by an
1091411009
** instance of the following structure.
1091511010
**
@@ -11325,21 +11420,22 @@
1132511420
**
1132611421
** In the colUsed field, the high-order bit (bit 63) is set if the table
1132711422
** contains more than 63 columns and the 64-th or later column is used.
1132811423
*/
1132911424
struct SrcList {
11330
- u8 nSrc; /* Number of tables or subqueries in the FROM clause */
11331
- u8 nAlloc; /* Number of entries allocated in a[] below */
11425
+ int nSrc; /* Number of tables or subqueries in the FROM clause */
11426
+ u32 nAlloc; /* Number of entries allocated in a[] below */
1133211427
struct SrcList_item {
1133311428
Schema *pSchema; /* Schema to which this item is fixed */
1133411429
char *zDatabase; /* Name of database holding this table */
1133511430
char *zName; /* Name of the table */
1133611431
char *zAlias; /* The "B" part of a "A AS B" phrase. zName is the "A" */
1133711432
Table *pTab; /* An SQL table corresponding to zName */
1133811433
Select *pSelect; /* A SELECT statement used in place of a table name */
1133911434
int addrFillSub; /* Address of subroutine to manifest a subquery */
1134011435
int regReturn; /* Register holding return address of addrFillSub */
11436
+ int regResult; /* Registers holding results of a co-routine */
1134111437
u8 jointype; /* Type of join between this able and the previous */
1134211438
unsigned notIndexed :1; /* True if there is a NOT INDEXED clause */
1134311439
unsigned isCorrelated :1; /* True if sub-query is correlated */
1134411440
unsigned viaCoroutine :1; /* Implemented as a co-routine */
1134511441
unsigned isRecursive :1; /* True for recursive reference in WITH */
@@ -11464,11 +11560,10 @@
1146411560
ExprList *pGroupBy; /* The GROUP BY clause */
1146511561
Expr *pHaving; /* The HAVING clause */
1146611562
ExprList *pOrderBy; /* The ORDER BY clause */
1146711563
Select *pPrior; /* Prior select in a compound select statement */
1146811564
Select *pNext; /* Next select to the left in a compound */
11469
- Select *pRightmost; /* Right-most select in a compound select statement */
1147011565
Expr *pLimit; /* LIMIT expression. NULL means not used. */
1147111566
Expr *pOffset; /* OFFSET expression. NULL means not used. */
1147211567
With *pWith; /* WITH clause attached to this select. Or NULL. */
1147311568
};
1147411569
@@ -11482,14 +11577,15 @@
1148211577
#define SF_UsesEphemeral 0x0008 /* Uses the OpenEphemeral opcode */
1148311578
#define SF_Expanded 0x0010 /* sqlite3SelectExpand() called on this */
1148411579
#define SF_HasTypeInfo 0x0020 /* FROM subqueries have Table metadata */
1148511580
#define SF_UseSorter 0x0040 /* Sort using a sorter */
1148611581
#define SF_Values 0x0080 /* Synthesized from VALUES clause */
11487
-#define SF_Materialize 0x0100 /* Force materialization of views */
11582
+#define SF_Materialize 0x0100 /* NOT USED */
1148811583
#define SF_NestedFrom 0x0200 /* Part of a parenthesized FROM clause */
1148911584
#define SF_MaybeConvert 0x0400 /* Need convertCompoundSelectToSubquery() */
1149011585
#define SF_Recursive 0x0800 /* The recursive part of a recursive CTE */
11586
+#define SF_Compound 0x1000 /* Part of a compound query */
1149111587
1149211588
1149311589
/*
1149411590
** The results of a SELECT can be distributed in several ways, as defined
1149511591
** by one of the following macros. The "SRT" prefix means "SELECT Result
@@ -11664,49 +11760,48 @@
1166411760
int rc; /* Return code from execution */
1166511761
u8 colNamesSet; /* TRUE after OP_ColumnName has been issued to pVdbe */
1166611762
u8 checkSchema; /* Causes schema cookie check after an error */
1166711763
u8 nested; /* Number of nested calls to the parser/code generator */
1166811764
u8 nTempReg; /* Number of temporary registers in aTempReg[] */
11669
- u8 nTempInUse; /* Number of aTempReg[] currently checked out */
1167011765
u8 nColCache; /* Number of entries in aColCache[] */
1167111766
u8 iColCache; /* Next entry in aColCache[] to replace */
1167211767
u8 isMultiWrite; /* True if statement may modify/insert multiple rows */
1167311768
u8 mayAbort; /* True if statement may throw an ABORT exception */
1167411769
u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */
11770
+ u8 okConstFactor; /* OK to factor out constants */
1167511771
int aTempReg[8]; /* Holding area for temporary registers */
1167611772
int nRangeReg; /* Size of the temporary register block */
1167711773
int iRangeReg; /* First register in temporary register block */
1167811774
int nErr; /* Number of errors seen */
1167911775
int nTab; /* Number of previously allocated VDBE cursors */
1168011776
int nMem; /* Number of memory cells used so far */
1168111777
int nSet; /* Number of sets used so far */
1168211778
int nOnce; /* Number of OP_Once instructions so far */
1168311779
int nOpAlloc; /* Number of slots allocated for Vdbe.aOp[] */
11684
- int nLabel; /* Number of labels used */
11685
- int *aLabel; /* Space to hold the labels */
1168611780
int iFixedOp; /* Never back out opcodes iFixedOp-1 or earlier */
1168711781
int ckBase; /* Base register of data during check constraints */
1168811782
int iPartIdxTab; /* Table corresponding to a partial index */
1168911783
int iCacheLevel; /* ColCache valid when aColCache[].iLevel<=iCacheLevel */
1169011784
int iCacheCnt; /* Counter used to generate aColCache[].lru values */
11785
+ int nLabel; /* Number of labels used */
11786
+ int *aLabel; /* Space to hold the labels */
1169111787
struct yColCache {
1169211788
int iTable; /* Table cursor number */
11693
- int iColumn; /* Table column number */
11789
+ i16 iColumn; /* Table column number */
1169411790
u8 tempReg; /* iReg is a temp register that needs to be freed */
1169511791
int iLevel; /* Nesting level */
1169611792
int iReg; /* Reg with value of this column. 0 means none. */
1169711793
int lru; /* Least recently used entry has the smallest value */
1169811794
} aColCache[SQLITE_N_COLCACHE]; /* One for each column cache entry */
1169911795
ExprList *pConstExpr;/* Constant expressions */
11796
+ Token constraintName;/* Name of the constraint currently being parsed */
1170011797
yDbMask writeMask; /* Start a write transaction on these databases */
1170111798
yDbMask cookieMask; /* Bitmask of schema verified databases */
11702
- int cookieGoto; /* Address of OP_Goto to cookie verifier subroutine */
1170311799
int cookieValue[SQLITE_MAX_ATTACHED+2]; /* Values of cookies to verify */
1170411800
int regRowid; /* Register holding rowid of CREATE TABLE entry */
1170511801
int regRoot; /* Register holding root page number for new objects */
1170611802
int nMaxArg; /* Max args passed to user function by sub-program */
11707
- Token constraintName;/* Name of the constraint currently being parsed */
1170811803
#ifndef SQLITE_OMIT_SHARED_CACHE
1170911804
int nTableLock; /* Number of locks in aTableLock */
1171011805
TableLock *aTableLock; /* Required table locks for shared-cache mode */
1171111806
#endif
1171211807
AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
@@ -11721,16 +11816,21 @@
1172111816
u32 newmask; /* Mask of new.* columns referenced */
1172211817
u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
1172311818
u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */
1172411819
u8 disableTriggers; /* True to disable triggers */
1172511820
11726
- /* Above is constant between recursions. Below is reset before and after
11727
- ** each recursion */
11821
+ /************************************************************************
11822
+ ** Above is constant between recursions. Below is reset before and after
11823
+ ** each recursion. The boundary between these two regions is determined
11824
+ ** using offsetof(Parse,nVar) so the nVar field must be the first field
11825
+ ** in the recursive region.
11826
+ ************************************************************************/
1172811827
1172911828
int nVar; /* Number of '?' variables seen in the SQL so far */
1173011829
int nzVar; /* Number of available slots in azVar[] */
1173111830
u8 iPkSortOrder; /* ASC or DESC for INTEGER PRIMARY KEY */
11831
+ u8 bFreeWith; /* True if pWith should be freed with parser */
1173211832
u8 explain; /* True if the EXPLAIN flag is found on the query */
1173311833
#ifndef SQLITE_OMIT_VIRTUALTABLE
1173411834
u8 declareVtab; /* True if inside sqlite3_declare_vtab() */
1173511835
int nVtabLock; /* Number of virtual tables to lock */
1173611836
#endif
@@ -11753,11 +11853,10 @@
1175311853
Table **apVtabLock; /* Pointer to virtual tables needing locking */
1175411854
#endif
1175511855
Table *pZombieTab; /* List of Table objects to delete after code gen */
1175611856
TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
1175711857
With *pWith; /* Current WITH clause, or NULL */
11758
- u8 bFreeWith; /* True if pWith should be freed with parser */
1175911858
};
1176011859
1176111860
/*
1176211861
** Return true if currently inside an sqlite3_declare_vtab() call.
1176311862
*/
@@ -11969,10 +12068,17 @@
1196912068
int bLocaltimeFault; /* True to fail localtime() calls */
1197012069
#ifdef SQLITE_ENABLE_SQLLOG
1197112070
void(*xSqllog)(void*,sqlite3*,const char*, int);
1197212071
void *pSqllogArg;
1197312072
#endif
12073
+#ifdef SQLITE_VDBE_COVERAGE
12074
+ /* The following callback (if not NULL) is invoked on every VDBE branch
12075
+ ** operation. Set the callback using SQLITE_TESTCTRL_VDBE_COVERAGE.
12076
+ */
12077
+ void (*xVdbeBranch)(void*,int iSrcLine,u8 eThis,u8 eMx); /* Callback */
12078
+ void *pVdbeBranchArg; /* 1st argument */
12079
+#endif
1197412080
};
1197512081
1197612082
/*
1197712083
** This macro is used inside of assert() statements to indicate that
1197812084
** the assert is only valid on a well-formed database. Instead of:
@@ -12302,11 +12408,10 @@
1230212408
SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse);
1230312409
#else
1230412410
# define sqlite3AutoincrementBegin(X)
1230512411
# define sqlite3AutoincrementEnd(X)
1230612412
#endif
12307
-SQLITE_PRIVATE int sqlite3CodeCoroutine(Parse*, Select*, SelectDest*);
1230812413
SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int);
1230912414
SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*);
1231012415
SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*);
1231112416
SQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*);
1231212417
SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int);
@@ -12350,15 +12455,16 @@
1235012455
SQLITE_PRIVATE void sqlite3ExprCachePush(Parse*);
1235112456
SQLITE_PRIVATE void sqlite3ExprCachePop(Parse*, int);
1235212457
SQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse*, int, int);
1235312458
SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse*);
1235412459
SQLITE_PRIVATE void sqlite3ExprCacheAffinityChange(Parse*, int, int);
12355
-SQLITE_PRIVATE int sqlite3ExprCode(Parse*, Expr*, int);
12460
+SQLITE_PRIVATE void sqlite3ExprCode(Parse*, Expr*, int);
12461
+SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse*, Expr*, int);
1235612462
SQLITE_PRIVATE void sqlite3ExprCodeAtInit(Parse*, Expr*, int, u8);
1235712463
SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*);
1235812464
SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse*, Expr*, int);
12359
-SQLITE_PRIVATE int sqlite3ExprCodeAndCache(Parse*, Expr*, int);
12465
+SQLITE_PRIVATE void sqlite3ExprCodeAndCache(Parse*, Expr*, int);
1236012466
SQLITE_PRIVATE int sqlite3ExprCodeExprList(Parse*, ExprList*, int, u8);
1236112467
#define SQLITE_ECEL_DUP 0x01 /* Deep, not shallow copies */
1236212468
#define SQLITE_ECEL_FACTOR 0x02 /* Factor out constant terms */
1236312469
SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse*, Expr*, int, int);
1236412470
SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse*, Expr*, int, int);
@@ -12392,11 +12498,10 @@
1239212498
SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*);
1239312499
SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*);
1239412500
SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*);
1239512501
SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr*, int*);
1239612502
SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr*);
12397
-SQLITE_PRIVATE void sqlite3ExprCodeIsNullJump(Vdbe*, const Expr*, int, int);
1239812503
SQLITE_PRIVATE int sqlite3ExprNeedsNoAffinityChange(const Expr*, char);
1239912504
SQLITE_PRIVATE int sqlite3IsRowid(const char*);
1240012505
SQLITE_PRIVATE void sqlite3GenerateRowDelete(Parse*,Table*,Trigger*,int,int,int,i16,u8,u8,u8);
1240112506
SQLITE_PRIVATE void sqlite3GenerateRowIndexDelete(Parse*, Table*, int, int, int*);
1240212507
SQLITE_PRIVATE int sqlite3GenerateIndexKey(Parse*, Index*, int, int, int, int*,Index*,int);
@@ -12536,11 +12641,11 @@
1253612641
#define getVarint sqlite3GetVarint
1253712642
#define putVarint sqlite3PutVarint
1253812643
1253912644
1254012645
SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(Vdbe *, Index *);
12541
-SQLITE_PRIVATE void sqlite3TableAffinityStr(Vdbe *, Table *);
12646
+SQLITE_PRIVATE void sqlite3TableAffinity(Vdbe*, Table*, int);
1254212647
SQLITE_PRIVATE char sqlite3CompareAffinity(Expr *pExpr, char aff2);
1254312648
SQLITE_PRIVATE int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity);
1254412649
SQLITE_PRIVATE char sqlite3ExprAffinity(Expr *pExpr);
1254512650
SQLITE_PRIVATE int sqlite3Atoi64(const char*, i64*, int, u8);
1254612651
SQLITE_PRIVATE void sqlite3Error(sqlite3*, int, const char*,...);
@@ -13348,10 +13453,13 @@
1334813453
#ifdef SQLITE_OMIT_COMPLETE
1334913454
"OMIT_COMPLETE",
1335013455
#endif
1335113456
#ifdef SQLITE_OMIT_COMPOUND_SELECT
1335213457
"OMIT_COMPOUND_SELECT",
13458
+#endif
13459
+#ifdef SQLITE_OMIT_CTE
13460
+ "OMIT_CTE",
1335313461
#endif
1335413462
#ifdef SQLITE_OMIT_DATETIME_FUNCS
1335513463
"OMIT_DATETIME_FUNCS",
1335613464
#endif
1335713465
#ifdef SQLITE_OMIT_DECLTYPE
@@ -13640,11 +13748,10 @@
1364013748
u8 rowidIsValid; /* True if lastRowid is valid */
1364113749
u8 deferredMoveto; /* A call to sqlite3BtreeMoveto() is needed */
1364213750
Bool useRandomRowid:1;/* Generate new record numbers semi-randomly */
1364313751
Bool isTable:1; /* True if a table requiring integer keys */
1364413752
Bool isOrdered:1; /* True if the underlying table is BTREE_UNORDERED */
13645
- Bool multiPseudo:1; /* Multi-register pseudo-cursor */
1364613753
sqlite3_vtab_cursor *pVtabCursor; /* The cursor for a virtual table */
1364713754
i64 seqCount; /* Sequence counter */
1364813755
i64 movetoTarget; /* Argument to the deferred sqlite3BtreeMoveto() */
1364913756
i64 lastRowid; /* Rowid being deleted by OP_Delete */
1365013757
VdbeSorter *pSorter; /* Sorter object for OP_SorterOpen cursors */
@@ -13734,11 +13841,10 @@
1373413841
RowSet *pRowSet; /* Used only when flags==MEM_RowSet */
1373513842
VdbeFrame *pFrame; /* Used when flags==MEM_Frame */
1373613843
} u;
1373713844
int n; /* Number of characters in string value, excluding '\0' */
1373813845
u16 flags; /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */
13739
- u8 type; /* One of SQLITE_NULL, SQLITE_TEXT, SQLITE_INTEGER, etc */
1374013846
u8 enc; /* SQLITE_UTF8, SQLITE_UTF16BE, SQLITE_UTF16LE */
1374113847
#ifdef SQLITE_DEBUG
1374213848
Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */
1374313849
void *pFiller; /* So that sizeof(Mem) is a multiple of 8 */
1374413850
#endif
@@ -13761,13 +13867,14 @@
1376113867
#define MEM_Null 0x0001 /* Value is NULL */
1376213868
#define MEM_Str 0x0002 /* Value is a string */
1376313869
#define MEM_Int 0x0004 /* Value is an integer */
1376413870
#define MEM_Real 0x0008 /* Value is a real number */
1376513871
#define MEM_Blob 0x0010 /* Value is a BLOB */
13872
+#define MEM_AffMask 0x001f /* Mask of affinity bits */
1376613873
#define MEM_RowSet 0x0020 /* Value is a RowSet object */
1376713874
#define MEM_Frame 0x0040 /* Value is a VdbeFrame object */
13768
-#define MEM_Invalid 0x0080 /* Value is undefined */
13875
+#define MEM_Undefined 0x0080 /* Value is undefined */
1376913876
#define MEM_Cleared 0x0100 /* NULL set by OP_Null, not from data */
1377013877
#define MEM_TypeMask 0x01ff /* Mask of type bits */
1377113878
1377213879
1377313880
/* Whenever Mem contains a valid string or blob representation, one of
@@ -13774,11 +13881,11 @@
1377413881
** the following flags must be set to determine the memory management
1377513882
** policy for Mem.z. The MEM_Term flag tells us whether or not the
1377613883
** string is \000 or \u0000 terminated
1377713884
*/
1377813885
#define MEM_Term 0x0200 /* String rep is nul terminated */
13779
-#define MEM_Dyn 0x0400 /* Need to call sqliteFree() on Mem.z */
13886
+#define MEM_Dyn 0x0400 /* Need to call Mem.xDel() on Mem.z */
1378013887
#define MEM_Static 0x0800 /* Mem.z points to a static string */
1378113888
#define MEM_Ephem 0x1000 /* Mem.z points to an ephemeral string */
1378213889
#define MEM_Agg 0x2000 /* Mem.z points to an agg function context */
1378313890
#define MEM_Zero 0x4000 /* Mem.i contains count of 0s appended to blob */
1378413891
#ifdef SQLITE_OMIT_INCRBLOB
@@ -13795,11 +13902,11 @@
1379513902
/*
1379613903
** Return true if a memory cell is not marked as invalid. This macro
1379713904
** is for use inside assert() statements only.
1379813905
*/
1379913906
#ifdef SQLITE_DEBUG
13800
-#define memIsValid(M) ((M)->flags & MEM_Invalid)==0
13907
+#define memIsValid(M) ((M)->flags & MEM_Undefined)==0
1380113908
#endif
1380213909
1380313910
/*
1380413911
** Each auxilliary data pointer stored by a user defined function
1380513912
** implementation calling sqlite3_set_auxdata() is stored in an instance
@@ -13957,11 +14064,11 @@
1395714064
SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32);
1395814065
SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
1395914066
SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(Vdbe*, int, int);
1396014067
1396114068
int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
13962
-SQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare(VdbeCursor*,UnpackedRecord*,int*);
14069
+SQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare(VdbeCursor*,const UnpackedRecord*,int*);
1396314070
SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3*, BtCursor *, i64 *);
1396414071
SQLITE_PRIVATE int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*);
1396514072
SQLITE_PRIVATE int sqlite3VdbeExec(Vdbe*);
1396614073
SQLITE_PRIVATE int sqlite3VdbeList(Vdbe*);
1396714074
SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe*);
@@ -13990,20 +14097,20 @@
1399014097
SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem*);
1399114098
SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem*);
1399214099
SQLITE_PRIVATE int sqlite3VdbeMemFromBtree(BtCursor*,u32,u32,int,Mem*);
1399314100
SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p);
1399414101
SQLITE_PRIVATE void sqlite3VdbeMemReleaseExternal(Mem *p);
14102
+#define VdbeMemDynamic(X) \
14103
+ (((X)->flags&(MEM_Agg|MEM_Dyn|MEM_RowSet|MEM_Frame))!=0)
1399514104
#define VdbeMemRelease(X) \
13996
- if((X)->flags&(MEM_Agg|MEM_Dyn|MEM_RowSet|MEM_Frame)) \
13997
- sqlite3VdbeMemReleaseExternal(X);
14105
+ if( VdbeMemDynamic(X) ) sqlite3VdbeMemReleaseExternal(X);
1399814106
SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem*, FuncDef*);
1399914107
SQLITE_PRIVATE const char *sqlite3OpcodeName(int);
1400014108
SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve);
1400114109
SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int);
1400214110
SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame*);
1400314111
SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *);
14004
-SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem);
1400514112
SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p);
1400614113
1400714114
SQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *, VdbeCursor *);
1400814115
SQLITE_PRIVATE void sqlite3VdbeSorterClose(sqlite3 *, VdbeCursor *);
1400914116
SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(const VdbeCursor *, Mem *);
@@ -14020,10 +14127,11 @@
1402014127
# define sqlite3VdbeLeave(X)
1402114128
#endif
1402214129
1402314130
#ifdef SQLITE_DEBUG
1402414131
SQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe*,Mem*);
14132
+SQLITE_PRIVATE int sqlite3VdbeCheckMemInvariants(Mem*);
1402514133
#endif
1402614134
1402714135
#ifndef SQLITE_OMIT_FOREIGN_KEY
1402814136
SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *, int);
1402914137
#else
@@ -17767,10 +17875,16 @@
1776717875
mem5.totalExcess += iFullSz - nByte;
1776817876
mem5.currentCount++;
1776917877
mem5.currentOut += iFullSz;
1777017878
if( mem5.maxCount<mem5.currentCount ) mem5.maxCount = mem5.currentCount;
1777117879
if( mem5.maxOut<mem5.currentOut ) mem5.maxOut = mem5.currentOut;
17880
+
17881
+#ifdef SQLITE_DEBUG
17882
+ /* Make sure the allocated memory does not assume that it is set to zero
17883
+ ** or retains a value from a previous allocation */
17884
+ memset(&mem5.zPool[i*mem5.szAtom], 0xAA, iFullSz);
17885
+#endif
1777217886
1777317887
/* Return a pointer to the allocated memory. */
1777417888
return (void*)&mem5.zPool[i*mem5.szAtom];
1777517889
}
1777617890
@@ -17825,10 +17939,17 @@
1782517939
mem5.aCtrl[iBlock] = CTRL_FREE | iLogsize;
1782617940
mem5.aCtrl[iBuddy] = 0;
1782717941
}
1782817942
size *= 2;
1782917943
}
17944
+
17945
+#ifdef SQLITE_DEBUG
17946
+ /* Overwrite freed memory with the 0x55 bit pattern to verify that it is
17947
+ ** not used after being freed */
17948
+ memset(&mem5.zPool[iBlock*mem5.szAtom], 0x55, size);
17949
+#endif
17950
+
1783017951
memsys5Link(iBlock, iLogsize);
1783117952
}
1783217953
1783317954
/*
1783417955
** Allocate nBytes of memory.
@@ -21390,11 +21511,11 @@
2139021511
assert( (pMem->n+(desiredEnc==SQLITE_UTF8?1:2))<=len );
2139121512
2139221513
sqlite3VdbeMemRelease(pMem);
2139321514
pMem->flags &= ~(MEM_Static|MEM_Dyn|MEM_Ephem);
2139421515
pMem->enc = desiredEnc;
21395
- pMem->flags |= (MEM_Term|MEM_Dyn);
21516
+ pMem->flags |= (MEM_Term);
2139621517
pMem->z = (char*)zOut;
2139721518
pMem->zMalloc = pMem->z;
2139821519
2139921520
translate_out:
2140021521
#if defined(TRANSLATE_TRACE) && defined(SQLITE_DEBUG)
@@ -21518,11 +21639,10 @@
2151821639
sqlite3VdbeMemRelease(&m);
2151921640
m.z = 0;
2152021641
}
2152121642
assert( (m.flags & MEM_Term)!=0 || db->mallocFailed );
2152221643
assert( (m.flags & MEM_Str)!=0 || db->mallocFailed );
21523
- assert( (m.flags & MEM_Dyn)!=0 || db->mallocFailed );
2152421644
assert( m.z || db->mallocFailed );
2152521645
return m.z;
2152621646
}
2152721647
2152821648
/*
@@ -22728,17 +22848,16 @@
2272822848
testcase( iB==-1 ); testcase( iB==0 );
2272922849
if( iB>=0 ){
2273022850
testcase( iA>0 && LARGEST_INT64 - iA == iB );
2273122851
testcase( iA>0 && LARGEST_INT64 - iA == iB - 1 );
2273222852
if( iA>0 && LARGEST_INT64 - iA < iB ) return 1;
22733
- *pA += iB;
2273422853
}else{
2273522854
testcase( iA<0 && -(iA + LARGEST_INT64) == iB + 1 );
2273622855
testcase( iA<0 && -(iA + LARGEST_INT64) == iB + 2 );
2273722856
if( iA<0 && -(iA + LARGEST_INT64) > iB + 1 ) return 1;
22738
- *pA += iB;
2273922857
}
22858
+ *pA += iB;
2274022859
return 0;
2274122860
}
2274222861
SQLITE_PRIVATE int sqlite3SubInt64(i64 *pA, i64 iB){
2274322862
testcase( iB==SMALLEST_INT64+1 );
2274422863
if( iB==SMALLEST_INT64 ){
@@ -22758,13 +22877,22 @@
2275822877
2275922878
iA1 = iA/TWOPOWER32;
2276022879
iA0 = iA % TWOPOWER32;
2276122880
iB1 = iB/TWOPOWER32;
2276222881
iB0 = iB % TWOPOWER32;
22763
- if( iA1*iB1 != 0 ) return 1;
22764
- assert( iA1*iB0==0 || iA0*iB1==0 );
22765
- r = iA1*iB0 + iA0*iB1;
22882
+ if( iA1==0 ){
22883
+ if( iB1==0 ){
22884
+ *pA *= iB;
22885
+ return 0;
22886
+ }
22887
+ r = iA0*iB1;
22888
+ }else if( iB1==0 ){
22889
+ r = iA1*iB0;
22890
+ }else{
22891
+ /* If both iA1 and iB1 are non-zero, overflow will result */
22892
+ return 1;
22893
+ }
2276622894
testcase( r==(-TWOPOWER31)-1 );
2276722895
testcase( r==(-TWOPOWER31) );
2276822896
testcase( r==TWOPOWER31 );
2276922897
testcase( r==TWOPOWER31-1 );
2277022898
if( r<(-TWOPOWER31) || r>=TWOPOWER31 ) return 1;
@@ -23206,75 +23334,75 @@
2320623334
/* 15 */ "VUpdate" OpHelp("data=r[P3@P2]"),
2320723335
/* 16 */ "Goto" OpHelp(""),
2320823336
/* 17 */ "Gosub" OpHelp(""),
2320923337
/* 18 */ "Return" OpHelp(""),
2321023338
/* 19 */ "Not" OpHelp("r[P2]= !r[P1]"),
23211
- /* 20 */ "Yield" OpHelp(""),
23212
- /* 21 */ "HaltIfNull" OpHelp("if r[P3] null then halt"),
23213
- /* 22 */ "Halt" OpHelp(""),
23214
- /* 23 */ "Integer" OpHelp("r[P2]=P1"),
23215
- /* 24 */ "Int64" OpHelp("r[P2]=P4"),
23216
- /* 25 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
23217
- /* 26 */ "Null" OpHelp("r[P2..P3]=NULL"),
23218
- /* 27 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
23219
- /* 28 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
23220
- /* 29 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
23221
- /* 30 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
23222
- /* 31 */ "SCopy" OpHelp("r[P2]=r[P1]"),
23223
- /* 32 */ "ResultRow" OpHelp("output=r[P1@P2]"),
23224
- /* 33 */ "CollSeq" OpHelp(""),
23225
- /* 34 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
23226
- /* 35 */ "MustBeInt" OpHelp(""),
23227
- /* 36 */ "RealAffinity" OpHelp(""),
23228
- /* 37 */ "Permutation" OpHelp(""),
23229
- /* 38 */ "Compare" OpHelp(""),
23230
- /* 39 */ "Jump" OpHelp(""),
23231
- /* 40 */ "Once" OpHelp(""),
23232
- /* 41 */ "If" OpHelp(""),
23233
- /* 42 */ "IfNot" OpHelp(""),
23234
- /* 43 */ "Column" OpHelp("r[P3]=PX"),
23235
- /* 44 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
23236
- /* 45 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
23237
- /* 46 */ "Count" OpHelp("r[P2]=count()"),
23238
- /* 47 */ "ReadCookie" OpHelp(""),
23239
- /* 48 */ "SetCookie" OpHelp(""),
23240
- /* 49 */ "VerifyCookie" OpHelp(""),
23241
- /* 50 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
23242
- /* 51 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
23243
- /* 52 */ "OpenAutoindex" OpHelp("nColumn=P2"),
23244
- /* 53 */ "OpenEphemeral" OpHelp("nColumn=P2"),
23245
- /* 54 */ "SorterOpen" OpHelp(""),
23246
- /* 55 */ "OpenPseudo" OpHelp("content in r[P2@P3]"),
23247
- /* 56 */ "Close" OpHelp(""),
23248
- /* 57 */ "SeekLt" OpHelp("key=r[P3@P4]"),
23249
- /* 58 */ "SeekLe" OpHelp("key=r[P3@P4]"),
23250
- /* 59 */ "SeekGe" OpHelp("key=r[P3@P4]"),
23251
- /* 60 */ "SeekGt" OpHelp("key=r[P3@P4]"),
23252
- /* 61 */ "Seek" OpHelp("intkey=r[P2]"),
23253
- /* 62 */ "NoConflict" OpHelp("key=r[P3@P4]"),
23254
- /* 63 */ "NotFound" OpHelp("key=r[P3@P4]"),
23255
- /* 64 */ "Found" OpHelp("key=r[P3@P4]"),
23256
- /* 65 */ "NotExists" OpHelp("intkey=r[P3]"),
23257
- /* 66 */ "Sequence" OpHelp("r[P2]=rowid"),
23258
- /* 67 */ "NewRowid" OpHelp("r[P2]=rowid"),
23259
- /* 68 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
23260
- /* 69 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"),
23261
- /* 70 */ "Delete" OpHelp(""),
23339
+ /* 20 */ "InitCoroutine" OpHelp(""),
23340
+ /* 21 */ "EndCoroutine" OpHelp(""),
23341
+ /* 22 */ "Yield" OpHelp(""),
23342
+ /* 23 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
23343
+ /* 24 */ "Halt" OpHelp(""),
23344
+ /* 25 */ "Integer" OpHelp("r[P2]=P1"),
23345
+ /* 26 */ "Int64" OpHelp("r[P2]=P4"),
23346
+ /* 27 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
23347
+ /* 28 */ "Null" OpHelp("r[P2..P3]=NULL"),
23348
+ /* 29 */ "SoftNull" OpHelp("r[P1]=NULL"),
23349
+ /* 30 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
23350
+ /* 31 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
23351
+ /* 32 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
23352
+ /* 33 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
23353
+ /* 34 */ "SCopy" OpHelp("r[P2]=r[P1]"),
23354
+ /* 35 */ "ResultRow" OpHelp("output=r[P1@P2]"),
23355
+ /* 36 */ "CollSeq" OpHelp(""),
23356
+ /* 37 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
23357
+ /* 38 */ "MustBeInt" OpHelp(""),
23358
+ /* 39 */ "RealAffinity" OpHelp(""),
23359
+ /* 40 */ "Permutation" OpHelp(""),
23360
+ /* 41 */ "Compare" OpHelp(""),
23361
+ /* 42 */ "Jump" OpHelp(""),
23362
+ /* 43 */ "Once" OpHelp(""),
23363
+ /* 44 */ "If" OpHelp(""),
23364
+ /* 45 */ "IfNot" OpHelp(""),
23365
+ /* 46 */ "Column" OpHelp("r[P3]=PX"),
23366
+ /* 47 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
23367
+ /* 48 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
23368
+ /* 49 */ "Count" OpHelp("r[P2]=count()"),
23369
+ /* 50 */ "ReadCookie" OpHelp(""),
23370
+ /* 51 */ "SetCookie" OpHelp(""),
23371
+ /* 52 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
23372
+ /* 53 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
23373
+ /* 54 */ "OpenAutoindex" OpHelp("nColumn=P2"),
23374
+ /* 55 */ "OpenEphemeral" OpHelp("nColumn=P2"),
23375
+ /* 56 */ "SorterOpen" OpHelp(""),
23376
+ /* 57 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
23377
+ /* 58 */ "Close" OpHelp(""),
23378
+ /* 59 */ "SeekLT" OpHelp(""),
23379
+ /* 60 */ "SeekLE" OpHelp(""),
23380
+ /* 61 */ "SeekGE" OpHelp(""),
23381
+ /* 62 */ "SeekGT" OpHelp(""),
23382
+ /* 63 */ "Seek" OpHelp("intkey=r[P2]"),
23383
+ /* 64 */ "NoConflict" OpHelp("key=r[P3@P4]"),
23384
+ /* 65 */ "NotFound" OpHelp("key=r[P3@P4]"),
23385
+ /* 66 */ "Found" OpHelp("key=r[P3@P4]"),
23386
+ /* 67 */ "NotExists" OpHelp("intkey=r[P3]"),
23387
+ /* 68 */ "Sequence" OpHelp("r[P2]=rowid"),
23388
+ /* 69 */ "NewRowid" OpHelp("r[P2]=rowid"),
23389
+ /* 70 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
2326223390
/* 71 */ "Or" OpHelp("r[P3]=(r[P1] || r[P2])"),
2326323391
/* 72 */ "And" OpHelp("r[P3]=(r[P1] && r[P2])"),
23264
- /* 73 */ "ResetCount" OpHelp(""),
23265
- /* 74 */ "SorterCompare" OpHelp("if key(P1)!=rtrim(r[P3],P4) goto P2"),
23266
- /* 75 */ "SorterData" OpHelp("r[P2]=data"),
23392
+ /* 73 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"),
23393
+ /* 74 */ "Delete" OpHelp(""),
23394
+ /* 75 */ "ResetCount" OpHelp(""),
2326723395
/* 76 */ "IsNull" OpHelp("if r[P1]==NULL goto P2"),
2326823396
/* 77 */ "NotNull" OpHelp("if r[P1]!=NULL goto P2"),
2326923397
/* 78 */ "Ne" OpHelp("if r[P1]!=r[P3] goto P2"),
2327023398
/* 79 */ "Eq" OpHelp("if r[P1]==r[P3] goto P2"),
2327123399
/* 80 */ "Gt" OpHelp("if r[P1]>r[P3] goto P2"),
2327223400
/* 81 */ "Le" OpHelp("if r[P1]<=r[P3] goto P2"),
2327323401
/* 82 */ "Lt" OpHelp("if r[P1]<r[P3] goto P2"),
2327423402
/* 83 */ "Ge" OpHelp("if r[P1]>=r[P3] goto P2"),
23275
- /* 84 */ "RowKey" OpHelp("r[P2]=key"),
23403
+ /* 84 */ "SorterCompare" OpHelp("if key(P1)!=rtrim(r[P3],P4) goto P2"),
2327623404
/* 85 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
2327723405
/* 86 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
2327823406
/* 87 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
2327923407
/* 88 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"),
2328023408
/* 89 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"),
@@ -23281,68 +23409,72 @@
2328123409
/* 90 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"),
2328223410
/* 91 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"),
2328323411
/* 92 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
2328423412
/* 93 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
2328523413
/* 94 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
23286
- /* 95 */ "RowData" OpHelp("r[P2]=data"),
23414
+ /* 95 */ "SorterData" OpHelp("r[P2]=data"),
2328723415
/* 96 */ "BitNot" OpHelp("r[P1]= ~r[P1]"),
2328823416
/* 97 */ "String8" OpHelp("r[P2]='P4'"),
23289
- /* 98 */ "Rowid" OpHelp("r[P2]=rowid"),
23290
- /* 99 */ "NullRow" OpHelp(""),
23291
- /* 100 */ "Last" OpHelp(""),
23292
- /* 101 */ "SorterSort" OpHelp(""),
23293
- /* 102 */ "Sort" OpHelp(""),
23294
- /* 103 */ "Rewind" OpHelp(""),
23295
- /* 104 */ "SorterInsert" OpHelp(""),
23296
- /* 105 */ "IdxInsert" OpHelp("key=r[P2]"),
23297
- /* 106 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
23298
- /* 107 */ "IdxRowid" OpHelp("r[P2]=rowid"),
23299
- /* 108 */ "IdxLT" OpHelp("key=r[P3@P4]"),
23300
- /* 109 */ "IdxGE" OpHelp("key=r[P3@P4]"),
23301
- /* 110 */ "Destroy" OpHelp(""),
23302
- /* 111 */ "Clear" OpHelp(""),
23303
- /* 112 */ "CreateIndex" OpHelp("r[P2]=root iDb=P1"),
23304
- /* 113 */ "CreateTable" OpHelp("r[P2]=root iDb=P1"),
23305
- /* 114 */ "ParseSchema" OpHelp(""),
23306
- /* 115 */ "LoadAnalysis" OpHelp(""),
23307
- /* 116 */ "DropTable" OpHelp(""),
23308
- /* 117 */ "DropIndex" OpHelp(""),
23309
- /* 118 */ "DropTrigger" OpHelp(""),
23310
- /* 119 */ "IntegrityCk" OpHelp(""),
23311
- /* 120 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
23312
- /* 121 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"),
23313
- /* 122 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"),
23314
- /* 123 */ "Program" OpHelp(""),
23315
- /* 124 */ "Param" OpHelp(""),
23316
- /* 125 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
23317
- /* 126 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
23318
- /* 127 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
23319
- /* 128 */ "IfPos" OpHelp("if r[P1]>0 goto P2"),
23320