Fossil SCM

merge trunk

jan.nijtmans 2014-03-23 09:42 UTC cleanX merge
Commit d7f04ea46fbf65b4e323e2e98f7225a9225bf4d2
72 files changed +2 -2 +12 -12 +4 -2 +8 +18 -1 +2 -2 +7 -38 +1 -1 +11 -5 +1 -2 +1 -1 +5 -5 +5 -5 +3 -3 +51 +1 +11 -1 +9 -5 +180 -75 +94 -32 +10 -10 +68 -5 +92 -9 +122 -98 +3 -3 +1 -1 +1 +14 +6 -9 +14 -2 +5 -1 +173 -68 +1 -2 +7 -1 -13 +9 -9 +13 -1 +47 -16 +7 -7 +2505 -1860 +5 -4 +6 -1 +7 -3 +5 +1 -1 +1 +24 -24 +31 -31 +11 -13 +24 -5 +20 +12 -12 +118 -96 +2 -1 +1 +5 +3 -21 +66 -55 +48 +1 -1 +1 -1 +1 -1 +11 -5 +16 -1 +16 -1 +13 +1 +12 -2 +21 -21 +1 -1 +23 +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,17 +36,19 @@
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@
47
-SQLITE_CFLAGS += -DSQLITE_WIN32_NO_ANSI -DSQLITE_WINNT_MAX_PATH_CHARS=4096
47
+SQLITE_CFLAGS += -DSQLITE_WIN32_NO_ANSI
48
+SQLITE_CFLAGS += -DSQLITE_WIN32_MAX_PATH_BYTES=4096
49
+SQLITE_CFLAGS += -DSQLITE_MAX_MMAP_SIZE=0x7fff0000
4850
4951
include $(SRCDIR)/main.mk
5052
5153
distclean: clean
5254
rm -f autoconfig.h config.log Makefile
5355
--- Makefile.Cygwin.in
+++ Makefile.Cygwin.in
@@ -36,17 +36,19 @@
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 SQLITE_CFLAGS += -DSQLITE_WIN32_NO_ANSI -DSQLITE_WINNT_MAX_PATH_CHARS=4096
 
 
48
49 include $(SRCDIR)/main.mk
50
51 distclean: clean
52 rm -f autoconfig.h config.log Makefile
53
--- Makefile.Cygwin.in
+++ Makefile.Cygwin.in
@@ -36,17 +36,19 @@
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 SQLITE_CFLAGS += -DSQLITE_WIN32_NO_ANSI
48 SQLITE_CFLAGS += -DSQLITE_WIN32_MAX_PATH_BYTES=4096
49 SQLITE_CFLAGS += -DSQLITE_MAX_MMAP_SIZE=0x7fff0000
50
51 include $(SRCDIR)/main.mk
52
53 distclean: clean
54 rm -f autoconfig.h config.log Makefile
55
+8
--- src/add.c
+++ src/add.c
@@ -692,5 +692,13 @@
692692
mv_one_file(vid, zFrom, zTo);
693693
}
694694
db_finalize(&q);
695695
db_end_transaction(0);
696696
}
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
+}
697705
--- src/add.c
+++ src/add.c
@@ -692,5 +692,13 @@
692 mv_one_file(vid, zFrom, zTo);
693 }
694 db_finalize(&q);
695 db_end_transaction(0);
696 }
 
 
 
 
 
 
 
 
697
--- src/add.c
+++ src/add.c
@@ -692,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 -1
--- src/branch.c
+++ src/branch.c
@@ -134,11 +134,11 @@
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;
145145
--- src/branch.c
+++ src/branch.c
@@ -134,11 +134,11 @@
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
--- src/branch.c
+++ src/branch.c
@@ -134,11 +134,11 @@
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
+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
+1 -1
--- src/cgi.c
+++ src/cgi.c
@@ -874,11 +874,11 @@
874874
char *z;
875875
const char *zType;
876876
int len;
877877
const char *zRequestUri = cgi_parameter("REQUEST_URI",0);
878878
const char *zScriptName = cgi_parameter("SCRIPT_NAME",0);
879
- const char *zPathInfo = cgi_parameter("PATH_INFO","");
879
+ const char *zPathInfo = cgi_parameter("PATH_INFO",0);
880880
881881
#ifdef FOSSIL_ENABLE_JSON
882882
json_main_bootstrap();
883883
#endif
884884
g.isHTTP = 1;
885885
--- src/cgi.c
+++ src/cgi.c
@@ -874,11 +874,11 @@
874 char *z;
875 const char *zType;
876 int len;
877 const char *zRequestUri = cgi_parameter("REQUEST_URI",0);
878 const char *zScriptName = cgi_parameter("SCRIPT_NAME",0);
879 const char *zPathInfo = cgi_parameter("PATH_INFO","");
880
881 #ifdef FOSSIL_ENABLE_JSON
882 json_main_bootstrap();
883 #endif
884 g.isHTTP = 1;
885
--- src/cgi.c
+++ src/cgi.c
@@ -874,11 +874,11 @@
874 char *z;
875 const char *zType;
876 int len;
877 const char *zRequestUri = cgi_parameter("REQUEST_URI",0);
878 const char *zScriptName = cgi_parameter("SCRIPT_NAME",0);
879 const char *zPathInfo = cgi_parameter("PATH_INFO",0);
880
881 #ifdef FOSSIL_ENABLE_JSON
882 json_main_bootstrap();
883 #endif
884 g.isHTTP = 1;
885
+5 -5
--- src/checkin.c
+++ src/checkin.c
@@ -843,11 +843,11 @@
843843
blob_append(&prompt,
844844
"\n"
845845
"# Enter commit message for this check-in. Lines beginning with # are ignored.\n"
846846
"#\n", -1
847847
);
848
- blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin);
848
+ blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : login_name());
849849
if( p->zBranch && p->zBranch[0] ){
850850
blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch);
851851
}else{
852852
char *zTags = info_tags_of_checkin(parent_rid, 1);
853853
if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags);
@@ -1005,11 +1005,11 @@
10051005
int verifyDate; /* Verify that child is younger */
10061006
int closeFlag; /* Close the branch being committed */
10071007
int integrateFlag; /* Close merged-in branches */
10081008
Blob *pCksum; /* Repository checksum. May be 0 */
10091009
const char *zDateOvrd; /* Date override. If 0 then use 'now' */
1010
- const char *zUserOvrd; /* User override. If 0 then use g.zLogin */
1010
+ const char *zUserOvrd; /* User override. If 0 then use login_name() */
10111011
const char *zBranch; /* Branch name. May be 0 */
10121012
const char *zColor; /* One-time background color. May be 0 */
10131013
const char *zBrClr; /* Persistent branch color. May be 0 */
10141014
const char **azTag; /* Tags to apply to this check-in */
10151015
};
@@ -1231,11 +1231,11 @@
12311231
const char *zBrTag = db_column_text(&q, 0);
12321232
blob_appendf(pOut, "T -%F *\n", zBrTag);
12331233
}
12341234
db_finalize(&q);
12351235
}
1236
- blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin);
1236
+ blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : login_name());
12371237
md5sum_blob(pOut, &mcksum);
12381238
blob_appendf(pOut, "Z %b\n", &mcksum);
12391239
if( pnFBcard ) *pnFBcard = nFBcard;
12401240
}
12411241
@@ -1602,11 +1602,11 @@
16021602
** should be committed.
16031603
*/
16041604
if( select_commit_files() ){
16051605
prompt_user("continue (y/N)? ", &ans);
16061606
cReply = blob_str(&ans)[0];
1607
- if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
1607
+ if( cReply!='y' && cReply!='Y' ) fossil_exit(1);
16081608
}
16091609
isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2");
16101610
if( g.aCommitFile && isAMerge ){
16111611
fossil_fatal("cannot do a partial commit of a merge");
16121612
}
@@ -1702,11 +1702,11 @@
17021702
char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
17031703
prepare_commit_comment(&comment, zInit, &sCiInfo, vid);
17041704
if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){
17051705
prompt_user("unchanged check-in comment. continue (y/N)? ", &ans);
17061706
cReply = blob_str(&ans)[0];
1707
- if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
1707
+ if( cReply!='y' && cReply!='Y' ) fossil_exit(1);
17081708
}
17091709
free(zInit);
17101710
}
17111711
if( blob_size(&comment)==0 ){
17121712
if( !dryRunFlag ){
17131713
--- src/checkin.c
+++ src/checkin.c
@@ -843,11 +843,11 @@
843 blob_append(&prompt,
844 "\n"
845 "# Enter commit message for this check-in. Lines beginning with # are ignored.\n"
846 "#\n", -1
847 );
848 blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin);
849 if( p->zBranch && p->zBranch[0] ){
850 blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch);
851 }else{
852 char *zTags = info_tags_of_checkin(parent_rid, 1);
853 if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags);
@@ -1005,11 +1005,11 @@
1005 int verifyDate; /* Verify that child is younger */
1006 int closeFlag; /* Close the branch being committed */
1007 int integrateFlag; /* Close merged-in branches */
1008 Blob *pCksum; /* Repository checksum. May be 0 */
1009 const char *zDateOvrd; /* Date override. If 0 then use 'now' */
1010 const char *zUserOvrd; /* User override. If 0 then use g.zLogin */
1011 const char *zBranch; /* Branch name. May be 0 */
1012 const char *zColor; /* One-time background color. May be 0 */
1013 const char *zBrClr; /* Persistent branch color. May be 0 */
1014 const char **azTag; /* Tags to apply to this check-in */
1015 };
@@ -1231,11 +1231,11 @@
1231 const char *zBrTag = db_column_text(&q, 0);
1232 blob_appendf(pOut, "T -%F *\n", zBrTag);
1233 }
1234 db_finalize(&q);
1235 }
1236 blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin);
1237 md5sum_blob(pOut, &mcksum);
1238 blob_appendf(pOut, "Z %b\n", &mcksum);
1239 if( pnFBcard ) *pnFBcard = nFBcard;
1240 }
1241
@@ -1602,11 +1602,11 @@
1602 ** should be committed.
1603 */
1604 if( select_commit_files() ){
1605 prompt_user("continue (y/N)? ", &ans);
1606 cReply = blob_str(&ans)[0];
1607 if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
1608 }
1609 isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2");
1610 if( g.aCommitFile && isAMerge ){
1611 fossil_fatal("cannot do a partial commit of a merge");
1612 }
@@ -1702,11 +1702,11 @@
1702 char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
1703 prepare_commit_comment(&comment, zInit, &sCiInfo, vid);
1704 if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){
1705 prompt_user("unchanged check-in comment. continue (y/N)? ", &ans);
1706 cReply = blob_str(&ans)[0];
1707 if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
1708 }
1709 free(zInit);
1710 }
1711 if( blob_size(&comment)==0 ){
1712 if( !dryRunFlag ){
1713
--- src/checkin.c
+++ src/checkin.c
@@ -843,11 +843,11 @@
843 blob_append(&prompt,
844 "\n"
845 "# Enter commit message for this check-in. Lines beginning with # are ignored.\n"
846 "#\n", -1
847 );
848 blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : login_name());
849 if( p->zBranch && p->zBranch[0] ){
850 blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch);
851 }else{
852 char *zTags = info_tags_of_checkin(parent_rid, 1);
853 if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags);
@@ -1005,11 +1005,11 @@
1005 int verifyDate; /* Verify that child is younger */
1006 int closeFlag; /* Close the branch being committed */
1007 int integrateFlag; /* Close merged-in branches */
1008 Blob *pCksum; /* Repository checksum. May be 0 */
1009 const char *zDateOvrd; /* Date override. If 0 then use 'now' */
1010 const char *zUserOvrd; /* User override. If 0 then use login_name() */
1011 const char *zBranch; /* Branch name. May be 0 */
1012 const char *zColor; /* One-time background color. May be 0 */
1013 const char *zBrClr; /* Persistent branch color. May be 0 */
1014 const char **azTag; /* Tags to apply to this check-in */
1015 };
@@ -1231,11 +1231,11 @@
1231 const char *zBrTag = db_column_text(&q, 0);
1232 blob_appendf(pOut, "T -%F *\n", zBrTag);
1233 }
1234 db_finalize(&q);
1235 }
1236 blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : login_name());
1237 md5sum_blob(pOut, &mcksum);
1238 blob_appendf(pOut, "Z %b\n", &mcksum);
1239 if( pnFBcard ) *pnFBcard = nFBcard;
1240 }
1241
@@ -1602,11 +1602,11 @@
1602 ** should be committed.
1603 */
1604 if( select_commit_files() ){
1605 prompt_user("continue (y/N)? ", &ans);
1606 cReply = blob_str(&ans)[0];
1607 if( cReply!='y' && cReply!='Y' ) fossil_exit(1);
1608 }
1609 isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2");
1610 if( g.aCommitFile && isAMerge ){
1611 fossil_fatal("cannot do a partial commit of a merge");
1612 }
@@ -1702,11 +1702,11 @@
1702 char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
1703 prepare_commit_comment(&comment, zInit, &sCiInfo, vid);
1704 if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){
1705 prompt_user("unchanged check-in comment. continue (y/N)? ", &ans);
1706 cReply = blob_str(&ans)[0];
1707 if( cReply!='y' && cReply!='Y' ) fossil_exit(1);
1708 }
1709 free(zInit);
1710 }
1711 if( blob_size(&comment)==0 ){
1712 if( !dryRunFlag ){
1713
+5 -5
--- src/checkin.c
+++ src/checkin.c
@@ -843,11 +843,11 @@
843843
blob_append(&prompt,
844844
"\n"
845845
"# Enter commit message for this check-in. Lines beginning with # are ignored.\n"
846846
"#\n", -1
847847
);
848
- blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin);
848
+ blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : login_name());
849849
if( p->zBranch && p->zBranch[0] ){
850850
blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch);
851851
}else{
852852
char *zTags = info_tags_of_checkin(parent_rid, 1);
853853
if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags);
@@ -1005,11 +1005,11 @@
10051005
int verifyDate; /* Verify that child is younger */
10061006
int closeFlag; /* Close the branch being committed */
10071007
int integrateFlag; /* Close merged-in branches */
10081008
Blob *pCksum; /* Repository checksum. May be 0 */
10091009
const char *zDateOvrd; /* Date override. If 0 then use 'now' */
1010
- const char *zUserOvrd; /* User override. If 0 then use g.zLogin */
1010
+ const char *zUserOvrd; /* User override. If 0 then use login_name() */
10111011
const char *zBranch; /* Branch name. May be 0 */
10121012
const char *zColor; /* One-time background color. May be 0 */
10131013
const char *zBrClr; /* Persistent branch color. May be 0 */
10141014
const char **azTag; /* Tags to apply to this check-in */
10151015
};
@@ -1231,11 +1231,11 @@
12311231
const char *zBrTag = db_column_text(&q, 0);
12321232
blob_appendf(pOut, "T -%F *\n", zBrTag);
12331233
}
12341234
db_finalize(&q);
12351235
}
1236
- blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin);
1236
+ blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : login_name());
12371237
md5sum_blob(pOut, &mcksum);
12381238
blob_appendf(pOut, "Z %b\n", &mcksum);
12391239
if( pnFBcard ) *pnFBcard = nFBcard;
12401240
}
12411241
@@ -1602,11 +1602,11 @@
16021602
** should be committed.
16031603
*/
16041604
if( select_commit_files() ){
16051605
prompt_user("continue (y/N)? ", &ans);
16061606
cReply = blob_str(&ans)[0];
1607
- if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
1607
+ if( cReply!='y' && cReply!='Y' ) fossil_exit(1);
16081608
}
16091609
isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2");
16101610
if( g.aCommitFile && isAMerge ){
16111611
fossil_fatal("cannot do a partial commit of a merge");
16121612
}
@@ -1702,11 +1702,11 @@
17021702
char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
17031703
prepare_commit_comment(&comment, zInit, &sCiInfo, vid);
17041704
if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){
17051705
prompt_user("unchanged check-in comment. continue (y/N)? ", &ans);
17061706
cReply = blob_str(&ans)[0];
1707
- if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
1707
+ if( cReply!='y' && cReply!='Y' ) fossil_exit(1);
17081708
}
17091709
free(zInit);
17101710
}
17111711
if( blob_size(&comment)==0 ){
17121712
if( !dryRunFlag ){
17131713
--- src/checkin.c
+++ src/checkin.c
@@ -843,11 +843,11 @@
843 blob_append(&prompt,
844 "\n"
845 "# Enter commit message for this check-in. Lines beginning with # are ignored.\n"
846 "#\n", -1
847 );
848 blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin);
849 if( p->zBranch && p->zBranch[0] ){
850 blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch);
851 }else{
852 char *zTags = info_tags_of_checkin(parent_rid, 1);
853 if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags);
@@ -1005,11 +1005,11 @@
1005 int verifyDate; /* Verify that child is younger */
1006 int closeFlag; /* Close the branch being committed */
1007 int integrateFlag; /* Close merged-in branches */
1008 Blob *pCksum; /* Repository checksum. May be 0 */
1009 const char *zDateOvrd; /* Date override. If 0 then use 'now' */
1010 const char *zUserOvrd; /* User override. If 0 then use g.zLogin */
1011 const char *zBranch; /* Branch name. May be 0 */
1012 const char *zColor; /* One-time background color. May be 0 */
1013 const char *zBrClr; /* Persistent branch color. May be 0 */
1014 const char **azTag; /* Tags to apply to this check-in */
1015 };
@@ -1231,11 +1231,11 @@
1231 const char *zBrTag = db_column_text(&q, 0);
1232 blob_appendf(pOut, "T -%F *\n", zBrTag);
1233 }
1234 db_finalize(&q);
1235 }
1236 blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin);
1237 md5sum_blob(pOut, &mcksum);
1238 blob_appendf(pOut, "Z %b\n", &mcksum);
1239 if( pnFBcard ) *pnFBcard = nFBcard;
1240 }
1241
@@ -1602,11 +1602,11 @@
1602 ** should be committed.
1603 */
1604 if( select_commit_files() ){
1605 prompt_user("continue (y/N)? ", &ans);
1606 cReply = blob_str(&ans)[0];
1607 if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
1608 }
1609 isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2");
1610 if( g.aCommitFile && isAMerge ){
1611 fossil_fatal("cannot do a partial commit of a merge");
1612 }
@@ -1702,11 +1702,11 @@
1702 char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
1703 prepare_commit_comment(&comment, zInit, &sCiInfo, vid);
1704 if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){
1705 prompt_user("unchanged check-in comment. continue (y/N)? ", &ans);
1706 cReply = blob_str(&ans)[0];
1707 if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
1708 }
1709 free(zInit);
1710 }
1711 if( blob_size(&comment)==0 ){
1712 if( !dryRunFlag ){
1713
--- src/checkin.c
+++ src/checkin.c
@@ -843,11 +843,11 @@
843 blob_append(&prompt,
844 "\n"
845 "# Enter commit message for this check-in. Lines beginning with # are ignored.\n"
846 "#\n", -1
847 );
848 blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : login_name());
849 if( p->zBranch && p->zBranch[0] ){
850 blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch);
851 }else{
852 char *zTags = info_tags_of_checkin(parent_rid, 1);
853 if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags);
@@ -1005,11 +1005,11 @@
1005 int verifyDate; /* Verify that child is younger */
1006 int closeFlag; /* Close the branch being committed */
1007 int integrateFlag; /* Close merged-in branches */
1008 Blob *pCksum; /* Repository checksum. May be 0 */
1009 const char *zDateOvrd; /* Date override. If 0 then use 'now' */
1010 const char *zUserOvrd; /* User override. If 0 then use login_name() */
1011 const char *zBranch; /* Branch name. May be 0 */
1012 const char *zColor; /* One-time background color. May be 0 */
1013 const char *zBrClr; /* Persistent branch color. May be 0 */
1014 const char **azTag; /* Tags to apply to this check-in */
1015 };
@@ -1231,11 +1231,11 @@
1231 const char *zBrTag = db_column_text(&q, 0);
1232 blob_appendf(pOut, "T -%F *\n", zBrTag);
1233 }
1234 db_finalize(&q);
1235 }
1236 blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : login_name());
1237 md5sum_blob(pOut, &mcksum);
1238 blob_appendf(pOut, "Z %b\n", &mcksum);
1239 if( pnFBcard ) *pnFBcard = nFBcard;
1240 }
1241
@@ -1602,11 +1602,11 @@
1602 ** should be committed.
1603 */
1604 if( select_commit_files() ){
1605 prompt_user("continue (y/N)? ", &ans);
1606 cReply = blob_str(&ans)[0];
1607 if( cReply!='y' && cReply!='Y' ) fossil_exit(1);
1608 }
1609 isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2");
1610 if( g.aCommitFile && isAMerge ){
1611 fossil_fatal("cannot do a partial commit of a merge");
1612 }
@@ -1702,11 +1702,11 @@
1702 char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
1703 prepare_commit_comment(&comment, zInit, &sCiInfo, vid);
1704 if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){
1705 prompt_user("unchanged check-in comment. continue (y/N)? ", &ans);
1706 cReply = blob_str(&ans)[0];
1707 if( cReply!='y' && cReply!='Y' ) fossil_exit(1);
1708 }
1709 free(zInit);
1710 }
1711 if( blob_size(&comment)==0 ){
1712 if( !dryRunFlag ){
1713
+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
--- src/comformat.c
+++ src/comformat.c
@@ -36,10 +36,11 @@
3636
int doIndent = 0;
3737
char *zBuf;
3838
char zBuffer[400];
3939
int lineCnt = 0;
4040
41
+ if( zText==0 ) zText = "(NULL)";
4142
if( tlen<=0 ){
4243
tlen = strlen(zText);
4344
}
4445
if( tlen >= (sizeof(zBuffer)) ){
4546
zBuf = fossil_malloc(tlen+1);
4647
--- src/comformat.c
+++ src/comformat.c
@@ -36,10 +36,11 @@
36 int doIndent = 0;
37 char *zBuf;
38 char zBuffer[400];
39 int lineCnt = 0;
40
 
41 if( tlen<=0 ){
42 tlen = strlen(zText);
43 }
44 if( tlen >= (sizeof(zBuffer)) ){
45 zBuf = fossil_malloc(tlen+1);
46
--- src/comformat.c
+++ src/comformat.c
@@ -36,10 +36,11 @@
36 int doIndent = 0;
37 char *zBuf;
38 char zBuffer[400];
39 int lineCnt = 0;
40
41 if( zText==0 ) zText = "(NULL)";
42 if( tlen<=0 ){
43 tlen = strlen(zText);
44 }
45 if( tlen >= (sizeof(zBuffer)) ){
46 zBuf = fossil_malloc(tlen+1);
47
+11 -1
--- src/config.h
+++ src/config.h
@@ -105,11 +105,21 @@
105105
# else
106106
# define COMPILER_NAME "msc"
107107
# endif
108108
# elif defined(__MINGW32__)
109109
# if !defined(COMPILER_VERSION)
110
-# if defined(__MINGW32_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)
111121
# if defined(__GNUC__)
112122
# if defined(__VERSION__)
113123
# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc-" __VERSION__
114124
# else
115125
# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc"
116126
--- src/config.h
+++ src/config.h
@@ -105,11 +105,21 @@
105 # else
106 # define COMPILER_NAME "msc"
107 # endif
108 # elif defined(__MINGW32__)
109 # if !defined(COMPILER_VERSION)
110 # if defined(__MINGW32_VERSION)
 
 
 
 
 
 
 
 
 
 
111 # if defined(__GNUC__)
112 # if defined(__VERSION__)
113 # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc-" __VERSION__
114 # else
115 # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc"
116
--- src/config.h
+++ src/config.h
@@ -105,11 +105,21 @@
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
+9 -5
--- 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__) && USE_SYSTEM_SQLITE+0!=1
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,
@@ -1022,15 +1022,11 @@
10221022
g.json.resultCode = FSL_JSON_E_DB_NOT_VALID;
10231023
#endif
10241024
fossil_panic("not a valid repository: %s", zDbName);
10251025
}
10261026
}
1027
-#if defined(__CYGWIN__)
1028
- g.zRepositoryName = fossil_utf8_to_filename(zDbName);
1029
-#else
10301027
g.zRepositoryName = mprintf("%s", zDbName);
1031
-#endif
10321028
db_open_or_attach(g.zRepositoryName, "repository", 0);
10331029
g.repositoryOpen = 1;
10341030
/* Cache "allow-symlinks" option, because we'll need it on every stat call */
10351031
g.allowSymlinks = db_get_boolean("allow-symlinks", 0);
10361032
}
@@ -2147,10 +2143,11 @@
21472143
{ "ignore-glob", 0, 40, 1, 0, "" },
21482144
{ "keep-glob", 0, 40, 1, 0, "" },
21492145
{ "localauth", 0, 0, 0, 0, "off" },
21502146
{ "main-branch", 0, 40, 0, 0, "trunk" },
21512147
{ "manifest", 0, 0, 1, 0, "off" },
2148
+ { "max-loadavg", 0, 25, 0, 0, "0.0" },
21522149
{ "max-upload", 0, 25, 0, 0, "250000" },
21532150
{ "mtime-changes", 0, 0, 0, 0, "on" },
21542151
{ "pgp-command", 0, 40, 0, 0, "gpg --clearsign -o " },
21552152
{ "proxy", 0, 32, 0, 0, "off" },
21562153
{ "relative-paths", 0, 0, 0, 0, "on" },
@@ -2296,10 +2293,17 @@
22962293
** main-branch The primary branch for the project. Default: trunk
22972294
**
22982295
** manifest If enabled, automatically create files "manifest" and
22992296
** (versionable) "manifest.uuid" in every checkout. The SQLite and
23002297
** Fossil repositories both require this. Default: off.
2298
+**
2299
+** max-loadavg Some CPU-intensive web pages (ex: /zip, /tarball, /blame)
2300
+** are disallowed if the system load average goes above this
2301
+** value. "0.0" means no limit. This only works on unix.
2302
+** Only local settings of this value make a difference since
2303
+** when running as a web-server, Fossil does not open the
2304
+** global configuration database.
23012305
**
23022306
** max-upload A limit on the size of uplink HTTP requests. The
23032307
** default is 250000 bytes.
23042308
**
23052309
** mtime-changes Use file modification times (mtimes) to detect when
23062310
--- 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,
@@ -1022,15 +1022,11 @@
1022 g.json.resultCode = FSL_JSON_E_DB_NOT_VALID;
1023 #endif
1024 fossil_panic("not a valid repository: %s", zDbName);
1025 }
1026 }
1027 #if defined(__CYGWIN__)
1028 g.zRepositoryName = fossil_utf8_to_filename(zDbName);
1029 #else
1030 g.zRepositoryName = mprintf("%s", zDbName);
1031 #endif
1032 db_open_or_attach(g.zRepositoryName, "repository", 0);
1033 g.repositoryOpen = 1;
1034 /* Cache "allow-symlinks" option, because we'll need it on every stat call */
1035 g.allowSymlinks = db_get_boolean("allow-symlinks", 0);
1036 }
@@ -2147,10 +2143,11 @@
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-upload", 0, 25, 0, 0, "250000" },
2153 { "mtime-changes", 0, 0, 0, 0, "on" },
2154 { "pgp-command", 0, 40, 0, 0, "gpg --clearsign -o " },
2155 { "proxy", 0, 32, 0, 0, "off" },
2156 { "relative-paths", 0, 0, 0, 0, "on" },
@@ -2296,10 +2293,17 @@
2296 ** main-branch The primary branch for the project. Default: trunk
2297 **
2298 ** manifest If enabled, automatically create files "manifest" and
2299 ** (versionable) "manifest.uuid" in every checkout. The SQLite and
2300 ** Fossil repositories both require this. Default: off.
 
 
 
 
 
 
 
2301 **
2302 ** max-upload A limit on the size of uplink HTTP requests. The
2303 ** default is 250000 bytes.
2304 **
2305 ** mtime-changes Use file modification times (mtimes) to detect when
2306
--- 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__) && USE_SYSTEM_SQLITE+0!=1
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,
@@ -1022,15 +1022,11 @@
1022 g.json.resultCode = FSL_JSON_E_DB_NOT_VALID;
1023 #endif
1024 fossil_panic("not a valid repository: %s", zDbName);
1025 }
1026 }
 
 
 
1027 g.zRepositoryName = mprintf("%s", zDbName);
 
1028 db_open_or_attach(g.zRepositoryName, "repository", 0);
1029 g.repositoryOpen = 1;
1030 /* Cache "allow-symlinks" option, because we'll need it on every stat call */
1031 g.allowSymlinks = db_get_boolean("allow-symlinks", 0);
1032 }
@@ -2147,10 +2143,11 @@
2143 { "ignore-glob", 0, 40, 1, 0, "" },
2144 { "keep-glob", 0, 40, 1, 0, "" },
2145 { "localauth", 0, 0, 0, 0, "off" },
2146 { "main-branch", 0, 40, 0, 0, "trunk" },
2147 { "manifest", 0, 0, 1, 0, "off" },
2148 { "max-loadavg", 0, 25, 0, 0, "0.0" },
2149 { "max-upload", 0, 25, 0, 0, "250000" },
2150 { "mtime-changes", 0, 0, 0, 0, "on" },
2151 { "pgp-command", 0, 40, 0, 0, "gpg --clearsign -o " },
2152 { "proxy", 0, 32, 0, 0, "off" },
2153 { "relative-paths", 0, 0, 0, 0, "on" },
@@ -2296,10 +2293,17 @@
2293 ** main-branch The primary branch for the project. Default: trunk
2294 **
2295 ** manifest If enabled, automatically create files "manifest" and
2296 ** (versionable) "manifest.uuid" in every checkout. The SQLite and
2297 ** Fossil repositories both require this. Default: off.
2298 **
2299 ** max-loadavg Some CPU-intensive web pages (ex: /zip, /tarball, /blame)
2300 ** are disallowed if the system load average goes above this
2301 ** value. "0.0" means no limit. This only works on unix.
2302 ** Only local settings of this value make a difference since
2303 ** when running as a web-server, Fossil does not open the
2304 ** global configuration database.
2305 **
2306 ** max-upload A limit on the size of uplink HTTP requests. The
2307 ** default is 250000 bytes.
2308 **
2309 ** mtime-changes Use file modification times (mtimes) to detect when
2310
+180 -75
--- src/diff.c
+++ src/diff.c
@@ -29,21 +29,21 @@
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 */
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 */
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_BRIEF ((u64)0x10000000) /* Show filenames only */
38
+#define DIFF_HTML ((u64)0x20000000) /* Render for HTML */
39
+#define DIFF_LINENO ((u64)0x40000000) /* Show line numbers */
4140
#define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */
4241
#define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */
4342
#define DIFF_CONTEXT_EX (((u64)0x04)<<32) /* Use context even if zero */
4443
#define DIFF_NOTTOOBIG (((u64)0x08)<<32) /* Only display if not too big */
44
+#define DIFF_STRIP_EOLCR (((u64)0x10)<<32) /* Strip trailing CR */
4545
4646
/*
4747
** These error messages are shared in multiple locations. They are defined
4848
** here for consistency.
4949
*/
@@ -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: */
@@ -84,11 +89,11 @@
8489
};
8590
8691
/*
8792
** Length of a dline
8893
*/
89
-#define LENGTH(X) ((X)->h & LENGTH_MASK)
94
+#define LENGTH(X) ((X)->n)
9095
9196
/*
9297
** A context for running a raw diff.
9398
**
9499
** The aEdit[] array describes the raw diff. Each triple of integers in
@@ -108,10 +113,11 @@
108113
int nEditAlloc; /* Space allocated for aEdit[] */
109114
DLine *aFrom; /* File on left side of the diff */
110115
int nFrom; /* Number of lines in aFrom[] */
111116
DLine *aTo; /* File on right side of the diff */
112117
int nTo; /* Number of lines in aTo[] */
118
+ int (*same_fn)(const DLine *, const DLine *); /* Function to be used for comparing */
113119
};
114120
115121
/*
116122
** Return an array of DLine objects containing a pointer to the
117123
** start of each line and a hash of that line. The lower
@@ -125,12 +131,12 @@
125131
** too long.
126132
**
127133
** Profiling show that in most cases this routine consumes the bulk of
128134
** the CPU time on a diff.
129135
*/
130
-static DLine *break_into_lines(const char *z, int n, int *pnLine, int ignoreWS){
131
- int nLine, i, j, k, x;
136
+static DLine *break_into_lines(const char *z, int n, int *pnLine, u64 diffFlags){
137
+ int nLine, i, j, k, s, x;
132138
unsigned int h, h2;
133139
DLine *a;
134140
135141
/* Count the number of lines. Allocate space to hold
136142
** the returned array.
@@ -158,18 +164,39 @@
158164
return a;
159165
}
160166
161167
/* Fill in the array */
162168
for(i=0; i<nLine; i++){
163
- a[i].z = z;
164169
for(j=0; z[j] && z[j]!='\n'; j++){}
170
+ a[i].z = z;
165171
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];
172
+ if( diffFlags & DIFF_STRIP_EOLCR ){
173
+ if( k>0 && z[k-1]=='\r' ){ k--; }
174
+ }
175
+ a[i].n = k;
176
+ s = 0;
177
+ if( diffFlags & DIFF_IGNORE_EOLWS ){
178
+ while( k>0 && fossil_isspace(z[k-1]) ){ k--; }
179
+ }
180
+ if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
181
+ int numws = 0;
182
+ while( s<k && fossil_isspace(z[s]) ){ s++; }
183
+ for(h=0, x=s; x<k; x++){
184
+ if( fossil_isspace(z[x]) ){
185
+ ++numws;
186
+ }else{
187
+ h = h ^ (h<<2) ^ z[x];
188
+ }
189
+ }
190
+ k -= numws;
191
+ }else{
192
+ for(h=0, x=s; x<k; x++){
193
+ h = h ^ (h<<2) ^ z[x];
194
+ }
169195
}
170
- a[i].h = h = (h<<LENGTH_MASK_SZ) | k;;
196
+ a[i].indent = s;
197
+ a[i].h = h = (h<<LENGTH_MASK_SZ) | (k-s);
171198
h2 = h % nLine;
172199
a[i].iNext = a[h2].iHash;
173200
a[h2].iHash = i+1;
174201
z += j+1;
175202
}
@@ -180,12 +207,31 @@
180207
}
181208
182209
/*
183210
** Return true if two DLine elements are identical.
184211
*/
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;
212
+static int same_dline(const DLine *pA, const DLine *pB){
213
+ return pA->h==pB->h && memcmp(pA->z,pB->z, pA->h&LENGTH_MASK)==0;
214
+}
215
+
216
+/*
217
+** Return true if two DLine elements are identical, ignoring
218
+** all whitespace. The indent field of pA/pB already points
219
+** to the first non-space character in the string.
220
+*/
221
+
222
+static int same_dline_ignore_allws(const DLine *pA, const DLine *pB){
223
+ int a = pA->indent, b = pB->indent;
224
+ if( pA->h==pB->h ){
225
+ while( a<pA->n && b<pB->n ){
226
+ if( pA->z[a++] != pB->z[b++] ) return 0;
227
+ while( a<pA->n && fossil_isspace(pA->z[a])) ++a;
228
+ while( b<pB->n && fossil_isspace(pB->z[b])) ++b;
229
+ }
230
+ return pA->n-a == b<pB->n-b;
231
+ }
232
+ return 0;
187233
}
188234
189235
/*
190236
** Return true if the regular expression *pRe matches any of the
191237
** N dlines
@@ -221,16 +267,16 @@
221267
}else if( cPrefix=='+' ){
222268
blob_append(pOut, "<span class=\"diffadd\">", -1);
223269
}else if( cPrefix=='-' ){
224270
blob_append(pOut, "<span class=\"diffrm\">", -1);
225271
}
226
- htmlize_to_blob(pOut, pLine->z, (pLine->h & LENGTH_MASK));
272
+ htmlize_to_blob(pOut, pLine->z, pLine->n);
227273
if( cPrefix!=' ' ){
228274
blob_append(pOut, "</span>", -1);
229275
}
230276
}else{
231
- blob_append(pOut, pLine->z, pLine->h & LENGTH_MASK);
277
+ blob_append(pOut, pLine->z, pLine->n);
232278
}
233279
blob_append(pOut, "\n", 1);
234280
}
235281
236282
/*
@@ -402,11 +448,11 @@
402448
b += m;
403449
if( i<nr-1 ){
404450
m = R[r+i*3+3];
405451
for(j=0; j<m; j++){
406452
if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html);
407
- appendDiffLine(pOut, ' ', &B[b+j], html, 0);
453
+ appendDiffLine(pOut, ' ', &A[a+j], html, 0);
408454
}
409455
b += m;
410456
a += m;
411457
}
412458
}
@@ -415,11 +461,11 @@
415461
assert( nr==i );
416462
m = R[r+nr*3];
417463
if( m>nContext ) m = nContext;
418464
for(j=0; j<m; j++){
419465
if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html);
420
- appendDiffLine(pOut, ' ', &B[b+j], html, 0);
466
+ appendDiffLine(pOut, ' ', &A[a+j], html, 0);
421467
}
422468
}
423469
}
424470
425471
/*
@@ -476,11 +522,11 @@
476522
** This comment contains multibyte unicode characters (ü, Æ, ð) in order
477523
** to test the ability of the diff code to handle such characters.
478524
*/
479525
static void sbsWriteText(SbsLine *p, DLine *pLine, int col){
480526
Blob *pCol = p->apCols[col];
481
- int n = pLine->h & LENGTH_MASK;
527
+ int n = pLine->n;
482528
int i; /* Number of input characters consumed */
483529
int k; /* Cursor position */
484530
int needEndSpan = 0;
485531
const char *zIn = pLine->z;
486532
int w = p->width;
@@ -1305,11 +1351,11 @@
13051351
sbsWriteMarker(&s, " ", "");
13061352
sbsWriteLineno(&s, b+j, SBS_LNB);
13071353
sbsWriteText(&s, &B[b+j], SBS_TXTB);
13081354
}
13091355
}
1310
-
1356
+
13111357
if( s.escHtml && blob_size(s.apCols[SBS_LNA])>0 ){
13121358
blob_append(pOut, "<table class=\"sbsdiffcols\"><tr>\n", -1);
13131359
for(i=SBS_LNA; i<=SBS_TXTB; i++){
13141360
sbsWriteColumn(pOut, s.apCols[i], i);
13151361
blob_reset(s.apCols[i]);
@@ -1337,16 +1383,16 @@
13371383
int iSXb = iS1; /* Best match so far */
13381384
int iSYb = iS2; /* Best match so far */
13391385
13401386
for(i=iS1; i<iE1-mxLength; i++){
13411387
for(j=iS2; j<iE2-mxLength; j++){
1342
- if( !same_dline(&p->aFrom[i], &p->aTo[j]) ) continue;
1343
- if( mxLength && !same_dline(&p->aFrom[i+mxLength], &p->aTo[j+mxLength]) ){
1388
+ if( !p->same_fn(&p->aFrom[i], &p->aTo[j]) ) continue;
1389
+ if( mxLength && !p->same_fn(&p->aFrom[i+mxLength], &p->aTo[j+mxLength]) ){
13441390
continue;
13451391
}
13461392
k = 1;
1347
- while( i+k<iE1 && j+k<iE2 && same_dline(&p->aFrom[i+k],&p->aTo[j+k]) ){
1393
+ while( i+k<iE1 && j+k<iE2 && p->same_fn(&p->aFrom[i+k],&p->aTo[j+k]) ){
13481394
k++;
13491395
}
13501396
if( k>mxLength ){
13511397
iSXb = i;
13521398
iSYb = j;
@@ -1408,11 +1454,11 @@
14081454
mid = (iE1 + iS1)/2;
14091455
for(i=iS1; i<iE1; i++){
14101456
int limit = 0;
14111457
j = p->aTo[p->aFrom[i].h % p->nTo].iHash;
14121458
while( j>0
1413
- && (j-1<iS2 || j>=iE2 || !same_dline(&p->aFrom[i], &p->aTo[j-1]))
1459
+ && (j-1<iS2 || j>=iE2 || !p->same_fn(&p->aFrom[i], &p->aTo[j-1]))
14141460
){
14151461
if( limit++ > 10 ){
14161462
j = 0;
14171463
break;
14181464
}
@@ -1425,19 +1471,19 @@
14251471
iSX = i;
14261472
iSY = j-1;
14271473
pA = &p->aFrom[iSX-1];
14281474
pB = &p->aTo[iSY-1];
14291475
n = minInt(iSX-iS1, iSY-iS2);
1430
- for(k=0; k<n && same_dline(pA,pB); k++, pA--, pB--){}
1476
+ for(k=0; k<n && p->same_fn(pA,pB); k++, pA--, pB--){}
14311477
iSX -= k;
14321478
iSY -= k;
14331479
iEX = i+1;
14341480
iEY = j;
14351481
pA = &p->aFrom[iEX];
14361482
pB = &p->aTo[iEY];
14371483
n = minInt(iE1-iEX, iE2-iEY);
1438
- for(k=0; k<n && same_dline(pA,pB); k++, pA++, pB++){}
1484
+ for(k=0; k<n && p->same_fn(pA,pB); k++, pA++, pB++){}
14391485
iEX += k;
14401486
iEY += k;
14411487
skew = (iSX-iS1) - (iSY-iS2);
14421488
if( skew<0 ) skew = -skew;
14431489
dist = (iSX+iEX)/2 - mid;
@@ -1574,16 +1620,16 @@
15741620
int mnE, iS, iE1, iE2;
15751621
15761622
/* Carve off the common header and footer */
15771623
iE1 = p->nFrom;
15781624
iE2 = p->nTo;
1579
- while( iE1>0 && iE2>0 && same_dline(&p->aFrom[iE1-1], &p->aTo[iE2-1]) ){
1625
+ while( iE1>0 && iE2>0 && p->same_fn(&p->aFrom[iE1-1], &p->aTo[iE2-1]) ){
15801626
iE1--;
15811627
iE2--;
15821628
}
15831629
mnE = iE1<iE2 ? iE1 : iE2;
1584
- for(iS=0; iS<mnE && same_dline(&p->aFrom[iS],&p->aTo[iS]); iS++){}
1630
+ for(iS=0; iS<mnE && p->same_fn(&p->aFrom[iS],&p->aTo[iS]); iS++){}
15851631
15861632
/* do the difference */
15871633
if( iS>0 ){
15881634
appendTriple(p, iS, 0, 0);
15891635
}
@@ -1648,11 +1694,11 @@
16481694
16491695
/* Shift insertions toward the beginning of the file */
16501696
while( cpy>0 && del==0 && ins>0 ){
16511697
DLine *pTop = &p->aFrom[lnFrom-1]; /* Line before start of insert */
16521698
DLine *pBtm = &p->aTo[lnTo+ins-1]; /* Last line inserted */
1653
- if( same_dline(pTop, pBtm)==0 ) break;
1699
+ if( p->same_fn(pTop, pBtm)==0 ) break;
16541700
if( LENGTH(pTop+1)+LENGTH(pBtm)<=LENGTH(pTop)+LENGTH(pBtm-1) ) break;
16551701
lnFrom--;
16561702
lnTo--;
16571703
p->aEdit[r]--;
16581704
p->aEdit[r+3]++;
@@ -1661,11 +1707,11 @@
16611707
16621708
/* Shift insertions toward the end of the file */
16631709
while( r+3<p->nEdit && p->aEdit[r+3]>0 && del==0 && ins>0 ){
16641710
DLine *pTop = &p->aTo[lnTo]; /* First line inserted */
16651711
DLine *pBtm = &p->aTo[lnTo+ins]; /* First line past end of insert */
1666
- if( same_dline(pTop, pBtm)==0 ) break;
1712
+ if( p->same_fn(pTop, pBtm)==0 ) break;
16671713
if( LENGTH(pTop)+LENGTH(pBtm-1)<=LENGTH(pTop+1)+LENGTH(pBtm) ) break;
16681714
lnFrom++;
16691715
lnTo++;
16701716
p->aEdit[r]++;
16711717
p->aEdit[r+3]--;
@@ -1674,11 +1720,11 @@
16741720
16751721
/* Shift deletions toward the beginning of the file */
16761722
while( cpy>0 && del>0 && ins==0 ){
16771723
DLine *pTop = &p->aFrom[lnFrom-1]; /* Line before start of delete */
16781724
DLine *pBtm = &p->aFrom[lnFrom+del-1]; /* Last line deleted */
1679
- if( same_dline(pTop, pBtm)==0 ) break;
1725
+ if( p->same_fn(pTop, pBtm)==0 ) break;
16801726
if( LENGTH(pTop+1)+LENGTH(pBtm)<=LENGTH(pTop)+LENGTH(pBtm-1) ) break;
16811727
lnFrom--;
16821728
lnTo--;
16831729
p->aEdit[r]--;
16841730
p->aEdit[r+3]++;
@@ -1687,11 +1733,11 @@
16871733
16881734
/* Shift deletions toward the end of the file */
16891735
while( r+3<p->nEdit && p->aEdit[r+3]>0 && del>0 && ins==0 ){
16901736
DLine *pTop = &p->aFrom[lnFrom]; /* First line deleted */
16911737
DLine *pBtm = &p->aFrom[lnFrom+del]; /* First line past end of delete */
1692
- if( same_dline(pTop, pBtm)==0 ) break;
1738
+ if( p->same_fn(pTop, pBtm)==0 ) break;
16931739
if( LENGTH(pTop)+LENGTH(pBtm-1)<=LENGTH(pTop)+LENGTH(pBtm) ) break;
16941740
lnFrom++;
16951741
lnTo++;
16961742
p->aEdit[r]++;
16971743
p->aEdit[r+3]--;
@@ -1753,28 +1799,33 @@
17531799
Blob *pB_Blob, /* TO file */
17541800
Blob *pOut, /* Write diff here if not NULL */
17551801
ReCompiled *pRe, /* Only output changes where this Regexp matches */
17561802
u64 diffFlags /* DIFF_* flags defined above */
17571803
){
1758
- int ignoreEolWs; /* Ignore whitespace at the end of lines */
1804
+ int ignoreWs; /* Ignore whitespace */
17591805
DContext c;
17601806
17611807
if( diffFlags & DIFF_INVERT ){
17621808
Blob *pTemp = pA_Blob;
17631809
pA_Blob = pB_Blob;
17641810
pB_Blob = pTemp;
17651811
}
1766
- ignoreEolWs = (diffFlags & DIFF_IGNORE_EOLWS)!=0;
1812
+ ignoreWs = (diffFlags & DIFF_IGNORE_ALLWS)!=0;
17671813
blob_to_utf8_no_bom(pA_Blob, 0);
17681814
blob_to_utf8_no_bom(pB_Blob, 0);
17691815
17701816
/* Prepare the input files */
17711817
memset(&c, 0, sizeof(c));
1818
+ if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
1819
+ c.same_fn = same_dline_ignore_allws;
1820
+ }else{
1821
+ c.same_fn = same_dline;
1822
+ }
17721823
c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob),
1773
- &c.nFrom, ignoreEolWs);
1824
+ &c.nFrom, diffFlags);
17741825
c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob),
1775
- &c.nTo, ignoreEolWs);
1826
+ &c.nTo, diffFlags);
17761827
if( c.aFrom==0 || c.aTo==0 ){
17771828
fossil_free(c.aFrom);
17781829
fossil_free(c.aTo);
17791830
if( pOut ){
17801831
diff_errmsg(pOut, DIFF_CANNOT_COMPUTE_BINARY, diffFlags);
@@ -1782,20 +1833,27 @@
17821833
return 0;
17831834
}
17841835
17851836
/* Compute the difference */
17861837
diff_all(&c);
1838
+ if( ignoreWs && c.nEdit==6 && c.aEdit[1]==0 && c.aEdit[2]==0 ){
1839
+ fossil_free(c.aFrom);
1840
+ fossil_free(c.aTo);
1841
+ fossil_free(c.aEdit);
1842
+ if( pOut ) diff_errmsg(pOut, DIFF_WHITESPACE_ONLY, diffFlags);
1843
+ return 0;
1844
+ }
17871845
if( (diffFlags & DIFF_NOTTOOBIG)!=0 ){
17881846
int i, m, n;
17891847
int *a = c.aEdit;
17901848
int mx = c.nEdit;
17911849
for(i=m=n=0; i<mx; i+=3){ m += a[i]; n += a[i+1]+a[i+2]; }
17921850
if( n>10000 ){
17931851
fossil_free(c.aFrom);
17941852
fossil_free(c.aTo);
17951853
fossil_free(c.aEdit);
1796
- diff_errmsg(pOut, DIFF_TOO_MANY_CHANGES, diffFlags);
1854
+ if( pOut ) diff_errmsg(pOut, DIFF_TOO_MANY_CHANGES, diffFlags);
17971855
return 0;
17981856
}
17991857
}
18001858
if( (diffFlags & DIFF_NOOPT)==0 ){
18011859
diff_optimize(&c);
@@ -1824,24 +1882,36 @@
18241882
18251883
/*
18261884
** Process diff-related command-line options and return an appropriate
18271885
** "diffFlags" integer.
18281886
**
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
1887
+** --brief Show filenames only DIFF_BRIEF
1888
+** -c|--context N N lines of context. DIFF_CONTEXT_MASK
1889
+** --html Format for HTML DIFF_HTML
1890
+** --invert Invert the diff DIFF_INVERT
1891
+** -n|--linenum Show line numbers DIFF_LINENO
1892
+** --noopt Disable optimization DIFF_NOOPT
1893
+** --strip-trailing-cr Strip trailing CR DIFF_STRIP_EOLCR
1894
+** --unified Unified diff. ~DIFF_SIDEBYSIDE
1895
+** -w|--ignore-all-space Ignore all whitespaces DIFF_IGNORE_ALLWS
1896
+** -W|--width N N character lines. DIFF_WIDTH_MASK
1897
+** -y|--side-by-side Side-by-side diff. DIFF_SIDEBYSIDE
1898
+** -Z|--ignore-trailing-space Ignore eol-whitespaces DIFF_IGNORE_EOLWS
18381899
*/
18391900
u64 diff_options(void){
18401901
u64 diffFlags = 0;
18411902
const char *z;
18421903
int f;
1904
+ if( find_option("ignore-trailing-space","Z",0)!=0 ){
1905
+ diffFlags = DIFF_IGNORE_EOLWS;
1906
+ }
1907
+ if( find_option("ignore-all-space","w",0)!=0 ){
1908
+ diffFlags = DIFF_IGNORE_ALLWS; /* stronger than DIFF_IGNORE_EOLWS */
1909
+ }
1910
+ if( find_option("strip-trailing-cr",0,0)!=0 ){
1911
+ diffFlags |= DIFF_STRIP_EOLCR;
1912
+ }
18431913
if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE;
18441914
if( find_option("unified",0,0)!=0 ) diffFlags &= ~DIFF_SIDEBYSIDE;
18451915
if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>=0 ){
18461916
if( f > DIFF_CONTEXT_MASK ) f = DIFF_CONTEXT_MASK;
18471917
diffFlags |= f + DIFF_CONTEXT_EX;
@@ -1930,11 +2000,11 @@
19302000
typedef struct Annotator Annotator;
19312001
struct Annotator {
19322002
DContext c; /* The diff-engine context */
19332003
struct AnnLine { /* Lines of the original files... */
19342004
const char *z; /* The text of the line */
1935
- short int n; /* Number of bytes (omitting trailing space and \n) */
2005
+ short int n; /* Number of bytes (omitting trailing \n) */
19362006
short int iVers; /* Level at which tag was set */
19372007
} *aOrig;
19382008
int nOrig; /* Number of elements in aOrig[] */
19392009
int nVers; /* Number of versions analyzed */
19402010
int bLimit; /* True if the iLimit was reached */
@@ -1952,22 +2022,28 @@
19522022
/*
19532023
** Initialize the annotation process by specifying the file that is
19542024
** to be annotated. The annotator takes control of the input Blob and
19552025
** will release it when it is finished with it.
19562026
*/
1957
-static int annotation_start(Annotator *p, Blob *pInput){
2027
+static int annotation_start(Annotator *p, Blob *pInput, u64 diffFlags){
19582028
int i;
19592029
19602030
memset(p, 0, sizeof(*p));
1961
- p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo,1);
2031
+ if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
2032
+ p->c.same_fn = same_dline_ignore_allws;
2033
+ }else{
2034
+ p->c.same_fn = same_dline;
2035
+ }
2036
+ p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo,
2037
+ diffFlags);
19622038
if( p->c.aTo==0 ){
19632039
return 1;
19642040
}
19652041
p->aOrig = fossil_malloc( sizeof(p->aOrig[0])*p->c.nTo );
19662042
for(i=0; i<p->c.nTo; i++){
19672043
p->aOrig[i].z = p->c.aTo[i].z;
1968
- p->aOrig[i].n = p->c.aTo[i].h & LENGTH_MASK;
2044
+ p->aOrig[i].n = p->c.aTo[i].n;
19692045
p->aOrig[i].iVers = -1;
19702046
}
19712047
p->nOrig = p->c.nTo;
19722048
return 0;
19732049
}
@@ -1977,17 +2053,17 @@
19772053
** being annotated. Do another step of the annotation. Return true
19782054
** if additional annotation is required. zPName is the tag to insert
19792055
** on each line of the file being annotated that was contributed by
19802056
** pParent. Memory to hold zPName is leaked.
19812057
*/
1982
-static int annotation_step(Annotator *p, Blob *pParent, int iVers){
2058
+static int annotation_step(Annotator *p, Blob *pParent, int iVers, u64 diffFlags){
19832059
int i, j;
19842060
int lnTo;
19852061
19862062
/* Prepare the parent file to be diffed */
19872063
p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent),
1988
- &p->c.nFrom, 1);
2064
+ &p->c.nFrom, diffFlags);
19892065
if( p->c.aFrom==0 ){
19902066
return 1;
19912067
}
19922068
19932069
/* Compute the differences going from pParent to the file being
@@ -2020,13 +2096,13 @@
20202096
/* Return no errors */
20212097
return 0;
20222098
}
20232099
20242100
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 */
2101
+/* Annotation flags (any DIFF flag can be used as Annotation flag as well) */
2102
+#define ANN_FILE_VERS (((u64)0x20)<<32) /* Show file vers rather than commit vers */
2103
+#define ANN_FILE_ANCEST (((u64)0x40)<<32) /* Prefer check-ins in the ANCESTOR table */
20282104
20292105
/*
20302106
** Compute a complete annotation on a file. The file is identified
20312107
** by its filename number (filename.fnid) and the baseline in which
20322108
** it was checked in (mlink.mid).
@@ -2034,11 +2110,11 @@
20342110
static void annotate_file(
20352111
Annotator *p, /* The annotator */
20362112
int fnid, /* The name of the file to be annotated */
20372113
int mid, /* Use the version of the file in this check-in */
20382114
int iLimit, /* Limit the number of levels if greater than zero */
2039
- int annFlags /* Flags to alter the annotation */
2115
+ u64 annFlags /* Flags to alter the annotation */
20402116
){
20412117
Blob toAnnotate; /* Text of the final (mid) version of the file */
20422118
Blob step; /* Text of previous revision */
20432119
int rid; /* Artifact ID of the file being annotated */
20442120
Stmt q; /* Query returning all ancestor versions */
@@ -2052,11 +2128,12 @@
20522128
}
20532129
if( !content_get(rid, &toAnnotate) ){
20542130
fossil_fatal("unable to retrieve content of artifact #%d", rid);
20552131
}
20562132
if( iLimit<=0 ) iLimit = 1000000000;
2057
- annotation_start(p, &toAnnotate);
2133
+ blob_to_utf8_no_bom(&toAnnotate, 0);
2134
+ annotation_start(p, &toAnnotate, annFlags);
20582135
db_begin_transaction();
20592136
db_multi_exec(
20602137
"CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);"
20612138
"DELETE FROM vseen;"
20622139
);
@@ -2086,11 +2163,12 @@
20862163
p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1));
20872164
p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2));
20882165
p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3));
20892166
if( p->nVers ){
20902167
content_get(rid, &step);
2091
- annotation_step(p, &step, p->nVers-1);
2168
+ blob_to_utf8_no_bom(&step, 0);
2169
+ annotation_step(p, &step, p->nVers-1, annFlags);
20922170
blob_reset(&step);
20932171
}
20942172
p->nVers++;
20952173
db_bind_int(&ins, ":rid", rid);
20962174
db_step(&ins);
@@ -2111,10 +2189,11 @@
21112189
*/
21122190
unsigned gradient_color(unsigned c1, unsigned c2, int n, int i){
21132191
unsigned c; /* Result color */
21142192
unsigned x1, x2;
21152193
if( i==0 || n==0 ) return c1;
2194
+ else if(i>=n) return c2;
21162195
x1 = (c1>>16)&0xff;
21172196
x2 = (c2>>16)&0xff;
21182197
c = (x1*(n-i) + x2*i)/n<<16 & 0xff0000;
21192198
x1 = (c1>>8)&0xff;
21202199
x2 = (c2>>8)&0xff;
@@ -2126,10 +2205,11 @@
21262205
}
21272206
21282207
/*
21292208
** WEBPAGE: annotate
21302209
** WEBPAGE: blame
2210
+** WEBPAGE: praise
21312211
**
21322212
** Query parameters:
21332213
**
21342214
** checkin=ID The manifest ID at which to start the annotation
21352215
** filename=FILENAME The filename.
@@ -2140,31 +2220,35 @@
21402220
void annotation_page(void){
21412221
int mid;
21422222
int fnid;
21432223
int i;
21442224
int iLimit; /* Depth limit */
2145
- int annFlags = ANN_FILE_ANCEST;
2225
+ u64 annFlags = (ANN_FILE_ANCEST|DIFF_STRIP_EOLCR);
21462226
int showLog = 0; /* True to display the log */
2227
+ int ignoreWs = 0; /* Ignore whitespace */
21472228
const char *zFilename; /* Name of file to annotate */
21482229
const char *zCI; /* The check-in containing zFilename */
21492230
Annotator ann;
21502231
HQuery url;
21512232
struct AnnVers *p;
21522233
unsigned clr1, clr2, clr;
2153
- int bBlame = g.zPath[0]=='b';/* True for BLAME output. False for ANNOTATE. */
2234
+ int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */
21542235
21552236
/* Gather query parameters */
21562237
showLog = atoi(PD("log","1"));
21572238
login_check_credentials();
21582239
if( !g.perm.Read ){ login_needed(); return; }
21592240
if( exclude_spiders("annotate") ) return;
2241
+ load_control();
21602242
mid = name_to_typed_rid(PD("checkin","0"),"ci");
21612243
zFilename = P("filename");
21622244
fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
21632245
if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
21642246
iLimit = atoi(PD("limit","20"));
21652247
if( P("filevers") ) annFlags |= ANN_FILE_VERS;
2248
+ ignoreWs = P("w")!=0;
2249
+ if( ignoreWs ) annFlags |= DIFF_IGNORE_ALLWS;
21662250
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
21672251
fossil_redirect_home();
21682252
}
21692253
21702254
/* compute the annotation */
@@ -2172,17 +2256,29 @@
21722256
annotate_file(&ann, fnid, mid, iLimit, annFlags);
21732257
zCI = ann.aVers[0].zMUuid;
21742258
21752259
/* generate the web page */
21762260
style_header("Annotation For %h", zFilename);
2177
- url_initialize(&url, "annotate");
2261
+ if( bBlame ){
2262
+ url_initialize(&url, "blame");
2263
+ }else{
2264
+ url_initialize(&url, "annotate");
2265
+ }
21782266
url_add_parameter(&url, "checkin", P("checkin"));
21792267
url_add_parameter(&url, "filename", zFilename);
21802268
if( iLimit!=20 ){
21812269
url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit));
21822270
}
21832271
url_add_parameter(&url, "log", showLog ? "1" : "0");
2272
+ if( ignoreWs ){
2273
+ url_add_parameter(&url, "w", "");
2274
+ style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes",
2275
+ "%s", url_render(&url, "w", 0, 0, 0));
2276
+ }else{
2277
+ style_submenu_element("Ignore Whitespace", "Ignore Whitespace",
2278
+ "%s", url_render(&url, "w", "", 0, 0));
2279
+ }
21842280
if( showLog ){
21852281
style_submenu_element("Hide Log", "Hide Log",
21862282
"%s", url_render(&url, "log", "0", 0, 0));
21872283
}else{
21882284
style_submenu_element("Show Log", "Show Log",
@@ -2208,11 +2304,11 @@
22082304
clr2 = 0xb5e0ff; /* Older changes: blue (cold) */
22092305
}
22102306
for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
22112307
clr = gradient_color(clr1, clr2, ann.nVers-1, i);
22122308
ann.aVers[i].zBgColor = mprintf("#%06x", clr);
2213
- }
2309
+ }
22142310
22152311
if( showLog ){
22162312
char *zLink = href("%R/finfo?name=%t&ci=%S",zFilename,zCI);
22172313
@ <h2>Ancestors of %z(zLink)%h(zFilename)</a> analyzed:</h2>
22182314
@ <ol>
@@ -2238,11 +2334,11 @@
22382334
}
22392335
@ </ol>
22402336
@ <hr>
22412337
}
22422338
if( !ann.bLimit ){
2243
- @ <h2>Origin for each line in
2339
+ @ <h2>Origin for each line in
22442340
@ %z(href("%R/finfo?name=%h&ci=%S", zFilename, zCI))%h(zFilename)</a>
22452341
@ from check-in %z(href("%R/info/%S",zCI))%S(zCI)</a>:</h2>
22462342
iLimit = ann.nVers+10;
22472343
}else{
22482344
@ <h2>Lines added by the %d(iLimit) most recent ancestors of
@@ -2291,22 +2387,25 @@
22912387
}
22922388
22932389
/*
22942390
** COMMAND: annotate
22952391
** COMMAND: blame
2392
+** COMMAND: praise
22962393
**
2297
-** %fossil (annotate|blame) ?OPTIONS? FILENAME
2394
+** %fossil (annotate|blame|praise) ?OPTIONS? FILENAME
22982395
**
22992396
** Output the text of a file with markings to show when each line of
23002397
** 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.
2398
+** and omits the username. The "blame" and "praise" commands show the user
2399
+** who made each checkin and omits the line number.
23032400
**
23042401
** 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
2402
+** --filevers Show file version numbers rather than check-in versions
2403
+** -l|--log List all versions analyzed
2404
+** -n|--limit N Only look backwards in time by N versions
2405
+** -w|--ignore-all-space Ignore white space when comparing lines
2406
+** -Z|--ignore-trailing-space Ignore whitespace at line end
23082407
**
23092408
** See also: info, finfo, timeline
23102409
*/
23112410
void annotate_cmd(void){
23122411
int fnid; /* Filename ID */
@@ -2319,18 +2418,24 @@
23192418
int i; /* Loop counter */
23202419
const char *zLimit; /* The value to the -n|--limit option */
23212420
int iLimit; /* How far back in time to look */
23222421
int showLog; /* True to show the log */
23232422
int fileVers; /* Show file version instead of check-in versions */
2324
- int annFlags = 0; /* Flags to control annotation properties */
2423
+ u64 annFlags = 0; /* Flags to control annotation properties */
23252424
int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */
23262425
2327
- bBlame = g.argv[1][0]=='b';
2426
+ bBlame = g.argv[1][0]!='a';
23282427
zLimit = find_option("limit","n",1);
23292428
if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1";
23302429
iLimit = atoi(zLimit);
23312430
showLog = find_option("log","l",0)!=0;
2431
+ if( find_option("ignore-trailing-space","Z",0)!=0 ){
2432
+ annFlags = DIFF_IGNORE_EOLWS;
2433
+ }
2434
+ if( find_option("ignore-all-space","w",0)!=0 ){
2435
+ annFlags = DIFF_IGNORE_ALLWS; /* stronger than DIFF_IGNORE_EOLWS */
2436
+ }
23322437
fileVers = find_option("filevers",0,0)!=0;
23332438
db_must_be_within_tree();
23342439
if( g.argc<3 ) {
23352440
usage("FILENAME");
23362441
}
@@ -2355,11 +2460,11 @@
23552460
" ORDER BY ancestor.generation ASC LIMIT 1",
23562461
fid, fnid);
23572462
if( mid==0 ){
23582463
fossil_fatal("unable to find manifest");
23592464
}
2360
- annFlags |= ANN_FILE_ANCEST;
2465
+ annFlags |= (ANN_FILE_ANCEST|DIFF_STRIP_EOLCR);
23612466
annotate_file(&ann, fnid, mid, iLimit, annFlags);
23622467
if( showLog ){
23632468
struct AnnVers *p;
23642469
for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
23652470
fossil_print("version %3d: %s %.10s file %.10s\n",
23662471
--- src/diff.c
+++ src/diff.c
@@ -29,21 +29,21 @@
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
46 /*
47 ** These error messages are shared in multiple locations. They are defined
48 ** here for consistency.
49 */
@@ -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: */
@@ -84,11 +89,11 @@
84 };
85
86 /*
87 ** Length of a dline
88 */
89 #define LENGTH(X) ((X)->h & LENGTH_MASK)
90
91 /*
92 ** A context for running a raw diff.
93 **
94 ** The aEdit[] array describes the raw diff. Each triple of integers in
@@ -108,10 +113,11 @@
108 int nEditAlloc; /* Space allocated for aEdit[] */
109 DLine *aFrom; /* File on left side of the diff */
110 int nFrom; /* Number of lines in aFrom[] */
111 DLine *aTo; /* File on right side of the diff */
112 int nTo; /* Number of lines in aTo[] */
 
113 };
114
115 /*
116 ** Return an array of DLine objects containing a pointer to the
117 ** start of each line and a hash of that line. The lower
@@ -125,12 +131,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 +164,39 @@
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 }
@@ -180,12 +207,31 @@
180 }
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 +267,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 +448,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 +461,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 +522,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 +1351,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]);
@@ -1337,16 +1383,16 @@
1337 int iSXb = iS1; /* Best match so far */
1338 int iSYb = iS2; /* Best match so far */
1339
1340 for(i=iS1; i<iE1-mxLength; i++){
1341 for(j=iS2; j<iE2-mxLength; j++){
1342 if( !same_dline(&p->aFrom[i], &p->aTo[j]) ) continue;
1343 if( mxLength && !same_dline(&p->aFrom[i+mxLength], &p->aTo[j+mxLength]) ){
1344 continue;
1345 }
1346 k = 1;
1347 while( i+k<iE1 && j+k<iE2 && same_dline(&p->aFrom[i+k],&p->aTo[j+k]) ){
1348 k++;
1349 }
1350 if( k>mxLength ){
1351 iSXb = i;
1352 iSYb = j;
@@ -1408,11 +1454,11 @@
1408 mid = (iE1 + iS1)/2;
1409 for(i=iS1; i<iE1; i++){
1410 int limit = 0;
1411 j = p->aTo[p->aFrom[i].h % p->nTo].iHash;
1412 while( j>0
1413 && (j-1<iS2 || j>=iE2 || !same_dline(&p->aFrom[i], &p->aTo[j-1]))
1414 ){
1415 if( limit++ > 10 ){
1416 j = 0;
1417 break;
1418 }
@@ -1425,19 +1471,19 @@
1425 iSX = i;
1426 iSY = j-1;
1427 pA = &p->aFrom[iSX-1];
1428 pB = &p->aTo[iSY-1];
1429 n = minInt(iSX-iS1, iSY-iS2);
1430 for(k=0; k<n && same_dline(pA,pB); k++, pA--, pB--){}
1431 iSX -= k;
1432 iSY -= k;
1433 iEX = i+1;
1434 iEY = j;
1435 pA = &p->aFrom[iEX];
1436 pB = &p->aTo[iEY];
1437 n = minInt(iE1-iEX, iE2-iEY);
1438 for(k=0; k<n && same_dline(pA,pB); k++, pA++, pB++){}
1439 iEX += k;
1440 iEY += k;
1441 skew = (iSX-iS1) - (iSY-iS2);
1442 if( skew<0 ) skew = -skew;
1443 dist = (iSX+iEX)/2 - mid;
@@ -1574,16 +1620,16 @@
1574 int mnE, iS, iE1, iE2;
1575
1576 /* Carve off the common header and footer */
1577 iE1 = p->nFrom;
1578 iE2 = p->nTo;
1579 while( iE1>0 && iE2>0 && same_dline(&p->aFrom[iE1-1], &p->aTo[iE2-1]) ){
1580 iE1--;
1581 iE2--;
1582 }
1583 mnE = iE1<iE2 ? iE1 : iE2;
1584 for(iS=0; iS<mnE && same_dline(&p->aFrom[iS],&p->aTo[iS]); iS++){}
1585
1586 /* do the difference */
1587 if( iS>0 ){
1588 appendTriple(p, iS, 0, 0);
1589 }
@@ -1648,11 +1694,11 @@
1648
1649 /* Shift insertions toward the beginning of the file */
1650 while( cpy>0 && del==0 && ins>0 ){
1651 DLine *pTop = &p->aFrom[lnFrom-1]; /* Line before start of insert */
1652 DLine *pBtm = &p->aTo[lnTo+ins-1]; /* Last line inserted */
1653 if( same_dline(pTop, pBtm)==0 ) break;
1654 if( LENGTH(pTop+1)+LENGTH(pBtm)<=LENGTH(pTop)+LENGTH(pBtm-1) ) break;
1655 lnFrom--;
1656 lnTo--;
1657 p->aEdit[r]--;
1658 p->aEdit[r+3]++;
@@ -1661,11 +1707,11 @@
1661
1662 /* Shift insertions toward the end of the file */
1663 while( r+3<p->nEdit && p->aEdit[r+3]>0 && del==0 && ins>0 ){
1664 DLine *pTop = &p->aTo[lnTo]; /* First line inserted */
1665 DLine *pBtm = &p->aTo[lnTo+ins]; /* First line past end of insert */
1666 if( same_dline(pTop, pBtm)==0 ) break;
1667 if( LENGTH(pTop)+LENGTH(pBtm-1)<=LENGTH(pTop+1)+LENGTH(pBtm) ) break;
1668 lnFrom++;
1669 lnTo++;
1670 p->aEdit[r]++;
1671 p->aEdit[r+3]--;
@@ -1674,11 +1720,11 @@
1674
1675 /* Shift deletions toward the beginning of the file */
1676 while( cpy>0 && del>0 && ins==0 ){
1677 DLine *pTop = &p->aFrom[lnFrom-1]; /* Line before start of delete */
1678 DLine *pBtm = &p->aFrom[lnFrom+del-1]; /* Last line deleted */
1679 if( same_dline(pTop, pBtm)==0 ) break;
1680 if( LENGTH(pTop+1)+LENGTH(pBtm)<=LENGTH(pTop)+LENGTH(pBtm-1) ) break;
1681 lnFrom--;
1682 lnTo--;
1683 p->aEdit[r]--;
1684 p->aEdit[r+3]++;
@@ -1687,11 +1733,11 @@
1687
1688 /* Shift deletions toward the end of the file */
1689 while( r+3<p->nEdit && p->aEdit[r+3]>0 && del>0 && ins==0 ){
1690 DLine *pTop = &p->aFrom[lnFrom]; /* First line deleted */
1691 DLine *pBtm = &p->aFrom[lnFrom+del]; /* First line past end of delete */
1692 if( same_dline(pTop, pBtm)==0 ) break;
1693 if( LENGTH(pTop)+LENGTH(pBtm-1)<=LENGTH(pTop)+LENGTH(pBtm) ) break;
1694 lnFrom++;
1695 lnTo++;
1696 p->aEdit[r]++;
1697 p->aEdit[r+3]--;
@@ -1753,28 +1799,33 @@
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 +1833,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,24 +1882,36 @@
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;
 
 
 
 
 
 
 
 
 
1843 if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE;
1844 if( find_option("unified",0,0)!=0 ) diffFlags &= ~DIFF_SIDEBYSIDE;
1845 if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>=0 ){
1846 if( f > DIFF_CONTEXT_MASK ) f = DIFF_CONTEXT_MASK;
1847 diffFlags |= f + DIFF_CONTEXT_EX;
@@ -1930,11 +2000,11 @@
1930 typedef struct Annotator Annotator;
1931 struct Annotator {
1932 DContext c; /* The diff-engine context */
1933 struct AnnLine { /* Lines of the original files... */
1934 const char *z; /* The text of the line */
1935 short int n; /* Number of bytes (omitting trailing space and \n) */
1936 short int iVers; /* Level at which tag was set */
1937 } *aOrig;
1938 int nOrig; /* Number of elements in aOrig[] */
1939 int nVers; /* Number of versions analyzed */
1940 int bLimit; /* True if the iLimit was reached */
@@ -1952,22 +2022,28 @@
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 +2053,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 +2096,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 +2110,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 +2128,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 +2163,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);
@@ -2111,10 +2189,11 @@
2111 */
2112 unsigned gradient_color(unsigned c1, unsigned c2, int n, int i){
2113 unsigned c; /* Result color */
2114 unsigned x1, x2;
2115 if( i==0 || n==0 ) return c1;
 
2116 x1 = (c1>>16)&0xff;
2117 x2 = (c2>>16)&0xff;
2118 c = (x1*(n-i) + x2*i)/n<<16 & 0xff0000;
2119 x1 = (c1>>8)&0xff;
2120 x2 = (c2>>8)&0xff;
@@ -2126,10 +2205,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 +2220,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 +2256,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 +2304,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 +2334,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 +2387,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 +2418,24 @@
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 }
@@ -2355,11 +2460,11 @@
2355 " ORDER BY ancestor.generation ASC LIMIT 1",
2356 fid, fnid);
2357 if( mid==0 ){
2358 fossil_fatal("unable to find manifest");
2359 }
2360 annFlags |= ANN_FILE_ANCEST;
2361 annotate_file(&ann, fnid, mid, iLimit, annFlags);
2362 if( showLog ){
2363 struct AnnVers *p;
2364 for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
2365 fossil_print("version %3d: %s %.10s file %.10s\n",
2366
--- src/diff.c
+++ src/diff.c
@@ -29,21 +29,21 @@
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_BRIEF ((u64)0x10000000) /* Show filenames only */
38 #define DIFF_HTML ((u64)0x20000000) /* Render for HTML */
39 #define DIFF_LINENO ((u64)0x40000000) /* Show line numbers */
 
40 #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */
41 #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */
42 #define DIFF_CONTEXT_EX (((u64)0x04)<<32) /* Use context even if zero */
43 #define DIFF_NOTTOOBIG (((u64)0x08)<<32) /* Only display if not too big */
44 #define DIFF_STRIP_EOLCR (((u64)0x10)<<32) /* Strip trailing CR */
45
46 /*
47 ** These error messages are shared in multiple locations. They are defined
48 ** here for consistency.
49 */
@@ -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: */
@@ -84,11 +89,11 @@
89 };
90
91 /*
92 ** Length of a dline
93 */
94 #define LENGTH(X) ((X)->n)
95
96 /*
97 ** A context for running a raw diff.
98 **
99 ** The aEdit[] array describes the raw diff. Each triple of integers in
@@ -108,10 +113,11 @@
113 int nEditAlloc; /* Space allocated for aEdit[] */
114 DLine *aFrom; /* File on left side of the diff */
115 int nFrom; /* Number of lines in aFrom[] */
116 DLine *aTo; /* File on right side of the diff */
117 int nTo; /* Number of lines in aTo[] */
118 int (*same_fn)(const DLine *, const DLine *); /* Function to be used for comparing */
119 };
120
121 /*
122 ** Return an array of DLine objects containing a pointer to the
123 ** start of each line and a hash of that line. The lower
@@ -125,12 +131,12 @@
131 ** too long.
132 **
133 ** Profiling show that in most cases this routine consumes the bulk of
134 ** the CPU time on a diff.
135 */
136 static DLine *break_into_lines(const char *z, int n, int *pnLine, u64 diffFlags){
137 int nLine, i, j, k, s, x;
138 unsigned int h, h2;
139 DLine *a;
140
141 /* Count the number of lines. Allocate space to hold
142 ** the returned array.
@@ -158,18 +164,39 @@
164 return a;
165 }
166
167 /* Fill in the array */
168 for(i=0; i<nLine; i++){
 
169 for(j=0; z[j] && z[j]!='\n'; j++){}
170 a[i].z = z;
171 k = j;
172 if( diffFlags & DIFF_STRIP_EOLCR ){
173 if( k>0 && z[k-1]=='\r' ){ k--; }
174 }
175 a[i].n = k;
176 s = 0;
177 if( diffFlags & DIFF_IGNORE_EOLWS ){
178 while( k>0 && fossil_isspace(z[k-1]) ){ k--; }
179 }
180 if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
181 int numws = 0;
182 while( s<k && fossil_isspace(z[s]) ){ s++; }
183 for(h=0, x=s; x<k; x++){
184 if( fossil_isspace(z[x]) ){
185 ++numws;
186 }else{
187 h = h ^ (h<<2) ^ z[x];
188 }
189 }
190 k -= numws;
191 }else{
192 for(h=0, x=s; x<k; x++){
193 h = h ^ (h<<2) ^ z[x];
194 }
195 }
196 a[i].indent = s;
197 a[i].h = h = (h<<LENGTH_MASK_SZ) | (k-s);
198 h2 = h % nLine;
199 a[i].iNext = a[h2].iHash;
200 a[h2].iHash = i+1;
201 z += j+1;
202 }
@@ -180,12 +207,31 @@
207 }
208
209 /*
210 ** Return true if two DLine elements are identical.
211 */
212 static int same_dline(const DLine *pA, const DLine *pB){
213 return pA->h==pB->h && memcmp(pA->z,pB->z, pA->h&LENGTH_MASK)==0;
214 }
215
216 /*
217 ** Return true if two DLine elements are identical, ignoring
218 ** all whitespace. The indent field of pA/pB already points
219 ** to the first non-space character in the string.
220 */
221
222 static int same_dline_ignore_allws(const DLine *pA, const DLine *pB){
223 int a = pA->indent, b = pB->indent;
224 if( pA->h==pB->h ){
225 while( a<pA->n && b<pB->n ){
226 if( pA->z[a++] != pB->z[b++] ) return 0;
227 while( a<pA->n && fossil_isspace(pA->z[a])) ++a;
228 while( b<pB->n && fossil_isspace(pB->z[b])) ++b;
229 }
230 return pA->n-a == b<pB->n-b;
231 }
232 return 0;
233 }
234
235 /*
236 ** Return true if the regular expression *pRe matches any of the
237 ** N dlines
@@ -221,16 +267,16 @@
267 }else if( cPrefix=='+' ){
268 blob_append(pOut, "<span class=\"diffadd\">", -1);
269 }else if( cPrefix=='-' ){
270 blob_append(pOut, "<span class=\"diffrm\">", -1);
271 }
272 htmlize_to_blob(pOut, pLine->z, pLine->n);
273 if( cPrefix!=' ' ){
274 blob_append(pOut, "</span>", -1);
275 }
276 }else{
277 blob_append(pOut, pLine->z, pLine->n);
278 }
279 blob_append(pOut, "\n", 1);
280 }
281
282 /*
@@ -402,11 +448,11 @@
448 b += m;
449 if( i<nr-1 ){
450 m = R[r+i*3+3];
451 for(j=0; j<m; j++){
452 if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html);
453 appendDiffLine(pOut, ' ', &A[a+j], html, 0);
454 }
455 b += m;
456 a += m;
457 }
458 }
@@ -415,11 +461,11 @@
461 assert( nr==i );
462 m = R[r+nr*3];
463 if( m>nContext ) m = nContext;
464 for(j=0; j<m; j++){
465 if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html);
466 appendDiffLine(pOut, ' ', &A[a+j], html, 0);
467 }
468 }
469 }
470
471 /*
@@ -476,11 +522,11 @@
522 ** This comment contains multibyte unicode characters (ü, Æ, ð) in order
523 ** to test the ability of the diff code to handle such characters.
524 */
525 static void sbsWriteText(SbsLine *p, DLine *pLine, int col){
526 Blob *pCol = p->apCols[col];
527 int n = pLine->n;
528 int i; /* Number of input characters consumed */
529 int k; /* Cursor position */
530 int needEndSpan = 0;
531 const char *zIn = pLine->z;
532 int w = p->width;
@@ -1305,11 +1351,11 @@
1351 sbsWriteMarker(&s, " ", "");
1352 sbsWriteLineno(&s, b+j, SBS_LNB);
1353 sbsWriteText(&s, &B[b+j], SBS_TXTB);
1354 }
1355 }
1356
1357 if( s.escHtml && blob_size(s.apCols[SBS_LNA])>0 ){
1358 blob_append(pOut, "<table class=\"sbsdiffcols\"><tr>\n", -1);
1359 for(i=SBS_LNA; i<=SBS_TXTB; i++){
1360 sbsWriteColumn(pOut, s.apCols[i], i);
1361 blob_reset(s.apCols[i]);
@@ -1337,16 +1383,16 @@
1383 int iSXb = iS1; /* Best match so far */
1384 int iSYb = iS2; /* Best match so far */
1385
1386 for(i=iS1; i<iE1-mxLength; i++){
1387 for(j=iS2; j<iE2-mxLength; j++){
1388 if( !p->same_fn(&p->aFrom[i], &p->aTo[j]) ) continue;
1389 if( mxLength && !p->same_fn(&p->aFrom[i+mxLength], &p->aTo[j+mxLength]) ){
1390 continue;
1391 }
1392 k = 1;
1393 while( i+k<iE1 && j+k<iE2 && p->same_fn(&p->aFrom[i+k],&p->aTo[j+k]) ){
1394 k++;
1395 }
1396 if( k>mxLength ){
1397 iSXb = i;
1398 iSYb = j;
@@ -1408,11 +1454,11 @@
1454 mid = (iE1 + iS1)/2;
1455 for(i=iS1; i<iE1; i++){
1456 int limit = 0;
1457 j = p->aTo[p->aFrom[i].h % p->nTo].iHash;
1458 while( j>0
1459 && (j-1<iS2 || j>=iE2 || !p->same_fn(&p->aFrom[i], &p->aTo[j-1]))
1460 ){
1461 if( limit++ > 10 ){
1462 j = 0;
1463 break;
1464 }
@@ -1425,19 +1471,19 @@
1471 iSX = i;
1472 iSY = j-1;
1473 pA = &p->aFrom[iSX-1];
1474 pB = &p->aTo[iSY-1];
1475 n = minInt(iSX-iS1, iSY-iS2);
1476 for(k=0; k<n && p->same_fn(pA,pB); k++, pA--, pB--){}
1477 iSX -= k;
1478 iSY -= k;
1479 iEX = i+1;
1480 iEY = j;
1481 pA = &p->aFrom[iEX];
1482 pB = &p->aTo[iEY];
1483 n = minInt(iE1-iEX, iE2-iEY);
1484 for(k=0; k<n && p->same_fn(pA,pB); k++, pA++, pB++){}
1485 iEX += k;
1486 iEY += k;
1487 skew = (iSX-iS1) - (iSY-iS2);
1488 if( skew<0 ) skew = -skew;
1489 dist = (iSX+iEX)/2 - mid;
@@ -1574,16 +1620,16 @@
1620 int mnE, iS, iE1, iE2;
1621
1622 /* Carve off the common header and footer */
1623 iE1 = p->nFrom;
1624 iE2 = p->nTo;
1625 while( iE1>0 && iE2>0 && p->same_fn(&p->aFrom[iE1-1], &p->aTo[iE2-1]) ){
1626 iE1--;
1627 iE2--;
1628 }
1629 mnE = iE1<iE2 ? iE1 : iE2;
1630 for(iS=0; iS<mnE && p->same_fn(&p->aFrom[iS],&p->aTo[iS]); iS++){}
1631
1632 /* do the difference */
1633 if( iS>0 ){
1634 appendTriple(p, iS, 0, 0);
1635 }
@@ -1648,11 +1694,11 @@
1694
1695 /* Shift insertions toward the beginning of the file */
1696 while( cpy>0 && del==0 && ins>0 ){
1697 DLine *pTop = &p->aFrom[lnFrom-1]; /* Line before start of insert */
1698 DLine *pBtm = &p->aTo[lnTo+ins-1]; /* Last line inserted */
1699 if( p->same_fn(pTop, pBtm)==0 ) break;
1700 if( LENGTH(pTop+1)+LENGTH(pBtm)<=LENGTH(pTop)+LENGTH(pBtm-1) ) break;
1701 lnFrom--;
1702 lnTo--;
1703 p->aEdit[r]--;
1704 p->aEdit[r+3]++;
@@ -1661,11 +1707,11 @@
1707
1708 /* Shift insertions toward the end of the file */
1709 while( r+3<p->nEdit && p->aEdit[r+3]>0 && del==0 && ins>0 ){
1710 DLine *pTop = &p->aTo[lnTo]; /* First line inserted */
1711 DLine *pBtm = &p->aTo[lnTo+ins]; /* First line past end of insert */
1712 if( p->same_fn(pTop, pBtm)==0 ) break;
1713 if( LENGTH(pTop)+LENGTH(pBtm-1)<=LENGTH(pTop+1)+LENGTH(pBtm) ) break;
1714 lnFrom++;
1715 lnTo++;
1716 p->aEdit[r]++;
1717 p->aEdit[r+3]--;
@@ -1674,11 +1720,11 @@
1720
1721 /* Shift deletions toward the beginning of the file */
1722 while( cpy>0 && del>0 && ins==0 ){
1723 DLine *pTop = &p->aFrom[lnFrom-1]; /* Line before start of delete */
1724 DLine *pBtm = &p->aFrom[lnFrom+del-1]; /* Last line deleted */
1725 if( p->same_fn(pTop, pBtm)==0 ) break;
1726 if( LENGTH(pTop+1)+LENGTH(pBtm)<=LENGTH(pTop)+LENGTH(pBtm-1) ) break;
1727 lnFrom--;
1728 lnTo--;
1729 p->aEdit[r]--;
1730 p->aEdit[r+3]++;
@@ -1687,11 +1733,11 @@
1733
1734 /* Shift deletions toward the end of the file */
1735 while( r+3<p->nEdit && p->aEdit[r+3]>0 && del>0 && ins==0 ){
1736 DLine *pTop = &p->aFrom[lnFrom]; /* First line deleted */
1737 DLine *pBtm = &p->aFrom[lnFrom+del]; /* First line past end of delete */
1738 if( p->same_fn(pTop, pBtm)==0 ) break;
1739 if( LENGTH(pTop)+LENGTH(pBtm-1)<=LENGTH(pTop)+LENGTH(pBtm) ) break;
1740 lnFrom++;
1741 lnTo++;
1742 p->aEdit[r]++;
1743 p->aEdit[r+3]--;
@@ -1753,28 +1799,33 @@
1799 Blob *pB_Blob, /* TO file */
1800 Blob *pOut, /* Write diff here if not NULL */
1801 ReCompiled *pRe, /* Only output changes where this Regexp matches */
1802 u64 diffFlags /* DIFF_* flags defined above */
1803 ){
1804 int ignoreWs; /* Ignore whitespace */
1805 DContext c;
1806
1807 if( diffFlags & DIFF_INVERT ){
1808 Blob *pTemp = pA_Blob;
1809 pA_Blob = pB_Blob;
1810 pB_Blob = pTemp;
1811 }
1812 ignoreWs = (diffFlags & DIFF_IGNORE_ALLWS)!=0;
1813 blob_to_utf8_no_bom(pA_Blob, 0);
1814 blob_to_utf8_no_bom(pB_Blob, 0);
1815
1816 /* Prepare the input files */
1817 memset(&c, 0, sizeof(c));
1818 if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
1819 c.same_fn = same_dline_ignore_allws;
1820 }else{
1821 c.same_fn = same_dline;
1822 }
1823 c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob),
1824 &c.nFrom, diffFlags);
1825 c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob),
1826 &c.nTo, diffFlags);
1827 if( c.aFrom==0 || c.aTo==0 ){
1828 fossil_free(c.aFrom);
1829 fossil_free(c.aTo);
1830 if( pOut ){
1831 diff_errmsg(pOut, DIFF_CANNOT_COMPUTE_BINARY, diffFlags);
@@ -1782,20 +1833,27 @@
1833 return 0;
1834 }
1835
1836 /* Compute the difference */
1837 diff_all(&c);
1838 if( ignoreWs && c.nEdit==6 && c.aEdit[1]==0 && c.aEdit[2]==0 ){
1839 fossil_free(c.aFrom);
1840 fossil_free(c.aTo);
1841 fossil_free(c.aEdit);
1842 if( pOut ) diff_errmsg(pOut, DIFF_WHITESPACE_ONLY, diffFlags);
1843 return 0;
1844 }
1845 if( (diffFlags & DIFF_NOTTOOBIG)!=0 ){
1846 int i, m, n;
1847 int *a = c.aEdit;
1848 int mx = c.nEdit;
1849 for(i=m=n=0; i<mx; i+=3){ m += a[i]; n += a[i+1]+a[i+2]; }
1850 if( n>10000 ){
1851 fossil_free(c.aFrom);
1852 fossil_free(c.aTo);
1853 fossil_free(c.aEdit);
1854 if( pOut ) diff_errmsg(pOut, DIFF_TOO_MANY_CHANGES, diffFlags);
1855 return 0;
1856 }
1857 }
1858 if( (diffFlags & DIFF_NOOPT)==0 ){
1859 diff_optimize(&c);
@@ -1824,24 +1882,36 @@
1882
1883 /*
1884 ** Process diff-related command-line options and return an appropriate
1885 ** "diffFlags" integer.
1886 **
1887 ** --brief Show filenames only DIFF_BRIEF
1888 ** -c|--context N N lines of context. DIFF_CONTEXT_MASK
1889 ** --html Format for HTML DIFF_HTML
1890 ** --invert Invert the diff DIFF_INVERT
1891 ** -n|--linenum Show line numbers DIFF_LINENO
1892 ** --noopt Disable optimization DIFF_NOOPT
1893 ** --strip-trailing-cr Strip trailing CR DIFF_STRIP_EOLCR
1894 ** --unified Unified diff. ~DIFF_SIDEBYSIDE
1895 ** -w|--ignore-all-space Ignore all whitespaces DIFF_IGNORE_ALLWS
1896 ** -W|--width N N character lines. DIFF_WIDTH_MASK
1897 ** -y|--side-by-side Side-by-side diff. DIFF_SIDEBYSIDE
1898 ** -Z|--ignore-trailing-space Ignore eol-whitespaces DIFF_IGNORE_EOLWS
1899 */
1900 u64 diff_options(void){
1901 u64 diffFlags = 0;
1902 const char *z;
1903 int f;
1904 if( find_option("ignore-trailing-space","Z",0)!=0 ){
1905 diffFlags = DIFF_IGNORE_EOLWS;
1906 }
1907 if( find_option("ignore-all-space","w",0)!=0 ){
1908 diffFlags = DIFF_IGNORE_ALLWS; /* stronger than DIFF_IGNORE_EOLWS */
1909 }
1910 if( find_option("strip-trailing-cr",0,0)!=0 ){
1911 diffFlags |= DIFF_STRIP_EOLCR;
1912 }
1913 if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE;
1914 if( find_option("unified",0,0)!=0 ) diffFlags &= ~DIFF_SIDEBYSIDE;
1915 if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>=0 ){
1916 if( f > DIFF_CONTEXT_MASK ) f = DIFF_CONTEXT_MASK;
1917 diffFlags |= f + DIFF_CONTEXT_EX;
@@ -1930,11 +2000,11 @@
2000 typedef struct Annotator Annotator;
2001 struct Annotator {
2002 DContext c; /* The diff-engine context */
2003 struct AnnLine { /* Lines of the original files... */
2004 const char *z; /* The text of the line */
2005 short int n; /* Number of bytes (omitting trailing \n) */
2006 short int iVers; /* Level at which tag was set */
2007 } *aOrig;
2008 int nOrig; /* Number of elements in aOrig[] */
2009 int nVers; /* Number of versions analyzed */
2010 int bLimit; /* True if the iLimit was reached */
@@ -1952,22 +2022,28 @@
2022 /*
2023 ** Initialize the annotation process by specifying the file that is
2024 ** to be annotated. The annotator takes control of the input Blob and
2025 ** will release it when it is finished with it.
2026 */
2027 static int annotation_start(Annotator *p, Blob *pInput, u64 diffFlags){
2028 int i;
2029
2030 memset(p, 0, sizeof(*p));
2031 if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
2032 p->c.same_fn = same_dline_ignore_allws;
2033 }else{
2034 p->c.same_fn = same_dline;
2035 }
2036 p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo,
2037 diffFlags);
2038 if( p->c.aTo==0 ){
2039 return 1;
2040 }
2041 p->aOrig = fossil_malloc( sizeof(p->aOrig[0])*p->c.nTo );
2042 for(i=0; i<p->c.nTo; i++){
2043 p->aOrig[i].z = p->c.aTo[i].z;
2044 p->aOrig[i].n = p->c.aTo[i].n;
2045 p->aOrig[i].iVers = -1;
2046 }
2047 p->nOrig = p->c.nTo;
2048 return 0;
2049 }
@@ -1977,17 +2053,17 @@
2053 ** being annotated. Do another step of the annotation. Return true
2054 ** if additional annotation is required. zPName is the tag to insert
2055 ** on each line of the file being annotated that was contributed by
2056 ** pParent. Memory to hold zPName is leaked.
2057 */
2058 static int annotation_step(Annotator *p, Blob *pParent, int iVers, u64 diffFlags){
2059 int i, j;
2060 int lnTo;
2061
2062 /* Prepare the parent file to be diffed */
2063 p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent),
2064 &p->c.nFrom, diffFlags);
2065 if( p->c.aFrom==0 ){
2066 return 1;
2067 }
2068
2069 /* Compute the differences going from pParent to the file being
@@ -2020,13 +2096,13 @@
2096 /* Return no errors */
2097 return 0;
2098 }
2099
2100
2101 /* Annotation flags (any DIFF flag can be used as Annotation flag as well) */
2102 #define ANN_FILE_VERS (((u64)0x20)<<32) /* Show file vers rather than commit vers */
2103 #define ANN_FILE_ANCEST (((u64)0x40)<<32) /* Prefer check-ins in the ANCESTOR table */
2104
2105 /*
2106 ** Compute a complete annotation on a file. The file is identified
2107 ** by its filename number (filename.fnid) and the baseline in which
2108 ** it was checked in (mlink.mid).
@@ -2034,11 +2110,11 @@
2110 static void annotate_file(
2111 Annotator *p, /* The annotator */
2112 int fnid, /* The name of the file to be annotated */
2113 int mid, /* Use the version of the file in this check-in */
2114 int iLimit, /* Limit the number of levels if greater than zero */
2115 u64 annFlags /* Flags to alter the annotation */
2116 ){
2117 Blob toAnnotate; /* Text of the final (mid) version of the file */
2118 Blob step; /* Text of previous revision */
2119 int rid; /* Artifact ID of the file being annotated */
2120 Stmt q; /* Query returning all ancestor versions */
@@ -2052,11 +2128,12 @@
2128 }
2129 if( !content_get(rid, &toAnnotate) ){
2130 fossil_fatal("unable to retrieve content of artifact #%d", rid);
2131 }
2132 if( iLimit<=0 ) iLimit = 1000000000;
2133 blob_to_utf8_no_bom(&toAnnotate, 0);
2134 annotation_start(p, &toAnnotate, annFlags);
2135 db_begin_transaction();
2136 db_multi_exec(
2137 "CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);"
2138 "DELETE FROM vseen;"
2139 );
@@ -2086,11 +2163,12 @@
2163 p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1));
2164 p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2));
2165 p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3));
2166 if( p->nVers ){
2167 content_get(rid, &step);
2168 blob_to_utf8_no_bom(&step, 0);
2169 annotation_step(p, &step, p->nVers-1, annFlags);
2170 blob_reset(&step);
2171 }
2172 p->nVers++;
2173 db_bind_int(&ins, ":rid", rid);
2174 db_step(&ins);
@@ -2111,10 +2189,11 @@
2189 */
2190 unsigned gradient_color(unsigned c1, unsigned c2, int n, int i){
2191 unsigned c; /* Result color */
2192 unsigned x1, x2;
2193 if( i==0 || n==0 ) return c1;
2194 else if(i>=n) return c2;
2195 x1 = (c1>>16)&0xff;
2196 x2 = (c2>>16)&0xff;
2197 c = (x1*(n-i) + x2*i)/n<<16 & 0xff0000;
2198 x1 = (c1>>8)&0xff;
2199 x2 = (c2>>8)&0xff;
@@ -2126,10 +2205,11 @@
2205 }
2206
2207 /*
2208 ** WEBPAGE: annotate
2209 ** WEBPAGE: blame
2210 ** WEBPAGE: praise
2211 **
2212 ** Query parameters:
2213 **
2214 ** checkin=ID The manifest ID at which to start the annotation
2215 ** filename=FILENAME The filename.
@@ -2140,31 +2220,35 @@
2220 void annotation_page(void){
2221 int mid;
2222 int fnid;
2223 int i;
2224 int iLimit; /* Depth limit */
2225 u64 annFlags = (ANN_FILE_ANCEST|DIFF_STRIP_EOLCR);
2226 int showLog = 0; /* True to display the log */
2227 int ignoreWs = 0; /* Ignore whitespace */
2228 const char *zFilename; /* Name of file to annotate */
2229 const char *zCI; /* The check-in containing zFilename */
2230 Annotator ann;
2231 HQuery url;
2232 struct AnnVers *p;
2233 unsigned clr1, clr2, clr;
2234 int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */
2235
2236 /* Gather query parameters */
2237 showLog = atoi(PD("log","1"));
2238 login_check_credentials();
2239 if( !g.perm.Read ){ login_needed(); return; }
2240 if( exclude_spiders("annotate") ) return;
2241 load_control();
2242 mid = name_to_typed_rid(PD("checkin","0"),"ci");
2243 zFilename = P("filename");
2244 fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
2245 if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
2246 iLimit = atoi(PD("limit","20"));
2247 if( P("filevers") ) annFlags |= ANN_FILE_VERS;
2248 ignoreWs = P("w")!=0;
2249 if( ignoreWs ) annFlags |= DIFF_IGNORE_ALLWS;
2250 if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
2251 fossil_redirect_home();
2252 }
2253
2254 /* compute the annotation */
@@ -2172,17 +2256,29 @@
2256 annotate_file(&ann, fnid, mid, iLimit, annFlags);
2257 zCI = ann.aVers[0].zMUuid;
2258
2259 /* generate the web page */
2260 style_header("Annotation For %h", zFilename);
2261 if( bBlame ){
2262 url_initialize(&url, "blame");
2263 }else{
2264 url_initialize(&url, "annotate");
2265 }
2266 url_add_parameter(&url, "checkin", P("checkin"));
2267 url_add_parameter(&url, "filename", zFilename);
2268 if( iLimit!=20 ){
2269 url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit));
2270 }
2271 url_add_parameter(&url, "log", showLog ? "1" : "0");
2272 if( ignoreWs ){
2273 url_add_parameter(&url, "w", "");
2274 style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes",
2275 "%s", url_render(&url, "w", 0, 0, 0));
2276 }else{
2277 style_submenu_element("Ignore Whitespace", "Ignore Whitespace",
2278 "%s", url_render(&url, "w", "", 0, 0));
2279 }
2280 if( showLog ){
2281 style_submenu_element("Hide Log", "Hide Log",
2282 "%s", url_render(&url, "log", "0", 0, 0));
2283 }else{
2284 style_submenu_element("Show Log", "Show Log",
@@ -2208,11 +2304,11 @@
2304 clr2 = 0xb5e0ff; /* Older changes: blue (cold) */
2305 }
2306 for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
2307 clr = gradient_color(clr1, clr2, ann.nVers-1, i);
2308 ann.aVers[i].zBgColor = mprintf("#%06x", clr);
2309 }
2310
2311 if( showLog ){
2312 char *zLink = href("%R/finfo?name=%t&ci=%S",zFilename,zCI);
2313 @ <h2>Ancestors of %z(zLink)%h(zFilename)</a> analyzed:</h2>
2314 @ <ol>
@@ -2238,11 +2334,11 @@
2334 }
2335 @ </ol>
2336 @ <hr>
2337 }
2338 if( !ann.bLimit ){
2339 @ <h2>Origin for each line in
2340 @ %z(href("%R/finfo?name=%h&ci=%S", zFilename, zCI))%h(zFilename)</a>
2341 @ from check-in %z(href("%R/info/%S",zCI))%S(zCI)</a>:</h2>
2342 iLimit = ann.nVers+10;
2343 }else{
2344 @ <h2>Lines added by the %d(iLimit) most recent ancestors of
@@ -2291,22 +2387,25 @@
2387 }
2388
2389 /*
2390 ** COMMAND: annotate
2391 ** COMMAND: blame
2392 ** COMMAND: praise
2393 **
2394 ** %fossil (annotate|blame|praise) ?OPTIONS? FILENAME
2395 **
2396 ** Output the text of a file with markings to show when each line of
2397 ** the file was last modified. The "annotate" command shows line numbers
2398 ** and omits the username. The "blame" and "praise" commands show the user
2399 ** who made each checkin and omits the line number.
2400 **
2401 ** Options:
2402 ** --filevers Show file version numbers rather than check-in versions
2403 ** -l|--log List all versions analyzed
2404 ** -n|--limit N Only look backwards in time by N versions
2405 ** -w|--ignore-all-space Ignore white space when comparing lines
2406 ** -Z|--ignore-trailing-space Ignore whitespace at line end
2407 **
2408 ** See also: info, finfo, timeline
2409 */
2410 void annotate_cmd(void){
2411 int fnid; /* Filename ID */
@@ -2319,18 +2418,24 @@
2418 int i; /* Loop counter */
2419 const char *zLimit; /* The value to the -n|--limit option */
2420 int iLimit; /* How far back in time to look */
2421 int showLog; /* True to show the log */
2422 int fileVers; /* Show file version instead of check-in versions */
2423 u64 annFlags = 0; /* Flags to control annotation properties */
2424 int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */
2425
2426 bBlame = g.argv[1][0]!='a';
2427 zLimit = find_option("limit","n",1);
2428 if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1";
2429 iLimit = atoi(zLimit);
2430 showLog = find_option("log","l",0)!=0;
2431 if( find_option("ignore-trailing-space","Z",0)!=0 ){
2432 annFlags = DIFF_IGNORE_EOLWS;
2433 }
2434 if( find_option("ignore-all-space","w",0)!=0 ){
2435 annFlags = DIFF_IGNORE_ALLWS; /* stronger than DIFF_IGNORE_EOLWS */
2436 }
2437 fileVers = find_option("filevers",0,0)!=0;
2438 db_must_be_within_tree();
2439 if( g.argc<3 ) {
2440 usage("FILENAME");
2441 }
@@ -2355,11 +2460,11 @@
2460 " ORDER BY ancestor.generation ASC LIMIT 1",
2461 fid, fnid);
2462 if( mid==0 ){
2463 fossil_fatal("unable to find manifest");
2464 }
2465 annFlags |= (ANN_FILE_ANCEST|DIFF_STRIP_EOLCR);
2466 annotate_file(&ann, fnid, mid, iLimit, annFlags);
2467 if( showLog ){
2468 struct AnnVers *p;
2469 for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){
2470 fossil_print("version %3d: %s %.10s file %.10s\n",
2471
+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
+** --strip-trailing-cr Strip trailing CR
1103
+** --tk Launch a Tcl/Tk GUI for display
1104
+** --to VERSION select VERSION as target for the diff
1105
+** --unified unified diff
1106
+** -v|--verbose output complete text of added or deleted files
1107
+** -w|--ignore-all-space Ignore white space when comparing lines
1108
+** -W|--width <num> 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 ** --strip-trailing-cr Strip trailing CR
1103 ** --tk Launch a Tcl/Tk GUI for display
1104 ** --to VERSION select VERSION as target for the diff
1105 ** --unified unified diff
1106 ** -v|--verbose output complete text of added or deleted files
1107 ** -w|--ignore-all-space Ignore white space when comparing lines
1108 ** -W|--width <num> 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 0;
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 0;
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
+122 -98
--- src/info.c
+++ src/info.c
@@ -443,37 +443,36 @@
443443
/*
444444
** Construct an appropriate diffFlag for text_diff() based on query
445445
** parameters and the to boolean arguments.
446446
*/
447447
u64 construct_diff_flags(int verboseFlag, int sideBySide){
448
- u64 diffFlags;
449
- if( verboseFlag==0 ){
450
- diffFlags = 0; /* Zero means do not show any diff */
451
- }else{
448
+ u64 diffFlags = 0; /* Zero means do not show any diff */
449
+ if( verboseFlag!=0 ){
452450
int x;
453451
if( sideBySide ){
454
- diffFlags = DIFF_SIDEBYSIDE | DIFF_IGNORE_EOLWS;
452
+ diffFlags = DIFF_SIDEBYSIDE;
455453
456454
/* "dw" query parameter determines width of each column */
457455
x = atoi(PD("dw","80"))*(DIFF_CONTEXT_MASK+1);
458456
if( x<0 || x>DIFF_WIDTH_MASK ) x = DIFF_WIDTH_MASK;
459457
diffFlags += x;
460
- }else{
461
- diffFlags = DIFF_INLINE | DIFF_IGNORE_EOLWS;
462458
}
463459
460
+ if( P("w") ){
461
+ diffFlags |= DIFF_IGNORE_ALLWS;
462
+ }
464463
/* "dc" query parameter determines lines of context */
465464
x = atoi(PD("dc","7"));
466465
if( x<0 || x>DIFF_CONTEXT_MASK ) x = DIFF_CONTEXT_MASK;
467466
diffFlags += x;
468467
469468
/* The "noopt" parameter disables diff optimization */
470469
if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT;
470
+ diffFlags |= DIFF_STRIP_EOLCR;
471471
}
472472
return diffFlags;
473473
}
474
-
475474
476475
/*
477476
** WEBPAGE: vinfo
478477
** WEBPAGE: ci
479478
** URL: /ci?name=RID|ARTIFACTID
@@ -498,10 +497,13 @@
498497
const char *zName; /* Name of the checkin to be displayed */
499498
const char *zUuid; /* UUID of zName */
500499
const char *zParent; /* UUID of the parent checkin (if any) */
501500
const char *zRe; /* regex parameter */
502501
ReCompiled *pRe = 0; /* regex */
502
+ const char *zW; /* URL param for ignoring whitespace */
503
+ const char *zPage = "vinfo"; /* Page that shows diffs */
504
+ const char *zPageHide = "ci"; /* Page that hides diffs */
503505
504506
login_check_credentials();
505507
if( !g.perm.Read ){ login_needed(); return; }
506508
zName = P("name");
507509
rid = name_to_rid_www("name");
@@ -663,79 +665,74 @@
663665
style_header("Check-in Information");
664666
login_anonymous_available();
665667
}
666668
db_finalize(&q1);
667669
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
- }
670
+ @ <div class="section">Changes</div>
671
+ @ <div class="sectionmenu">
672
+ verboseFlag = g.zPath[0]!='c';
673
+ if( db_get_boolean("show-version-diffs", 0)==0 ){
674
+ verboseFlag = !verboseFlag;
675
+ zPage = "ci";
676
+ zPageHide = "vinfo";
677
+ }
678
+ diffFlags = construct_diff_flags(verboseFlag, sideBySide);
679
+ zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
680
+ if( verboseFlag ){
681
+ @ %z(xhref("class='button'","%R/%s/%T",zPageHide,zName))
682
+ @ Hide&nbsp;Diffs</a>
683
+ if( sideBySide ){
684
+ @ %z(xhref("class='button'","%R/%s/%T?sbs=0%s",zPage,zName,zW))
685
+ @ Unified&nbsp;Diffs</a>
686
+ }else{
687
+ @ %z(xhref("class='button'","%R/%s/%T?sbs=1%s",zPage,zName,zW))
688
+ @ Side-by-Side&nbsp;Diffs</a>
689
+ }
690
+ if( *zW ){
691
+ @ %z(xhref("class='button'","%R/%s/%T?sbs=%d",zPage,zName,sideBySide))
692
+ @ Show&nbsp;Whitespace&nbsp;Changes</a>
693
+ }else{
694
+ @ %z(xhref("class='button'","%R/%s/%T?sbs=%d&w",zPage,zName,sideBySide))
695
+ @ Ignore&nbsp;Whitespace</a>
696
+ }
697
+ }else{
698
+ @ %z(xhref("class='button'","%R/%s/%T?sbs=0",zPage,zName))
699
+ @ Show&nbsp;Unified&nbsp;Diffs</a>
700
+ @ %z(xhref("class='button'","%R/%s/%T?sbs=1",zPage,zName))
701
+ @ Show&nbsp;Side-by-Side&nbsp;Diffs</a>
702
+ }
703
+ if( zParent ){
707704
@ %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
- }
705
+ @ Patch</a>
706
+ }
707
+ @</div>
708
+ if( pRe ){
709
+ @ <p><b>Only differences that match regular expression "%h(zRe)"
710
+ @ are shown.</b></p>
711
+ }
712
+ db_prepare(&q3,
713
+ "SELECT name,"
714
+ " mperm,"
715
+ " (SELECT uuid FROM blob WHERE rid=mlink.pid),"
716
+ " (SELECT uuid FROM blob WHERE rid=mlink.fid),"
717
+ " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)"
718
+ " FROM mlink JOIN filename ON filename.fnid=mlink.fnid"
719
+ " WHERE mlink.mid=%d"
720
+ " AND (mlink.fid>0"
721
+ " OR mlink.fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=%d))"
722
+ " ORDER BY name /*sort*/",
723
+ rid, rid
724
+ );
725
+ while( db_step(&q3)==SQLITE_ROW ){
726
+ const char *zName = db_column_text(&q3,0);
727
+ int mperm = db_column_int(&q3, 1);
728
+ const char *zOld = db_column_text(&q3,2);
729
+ const char *zNew = db_column_text(&q3,3);
730
+ const char *zOldName = db_column_text(&q3, 4);
731
+ append_file_change_line(zName, zOld, zNew, zOldName, diffFlags,pRe,mperm);
732
+ }
733
+ db_finalize(&q3);
737734
append_diff_javascript(sideBySide);
738735
style_footer();
739736
}
740737
741738
/*
@@ -954,10 +951,11 @@
954951
ManifestFile *pFileFrom, *pFileTo;
955952
const char *zBranch;
956953
const char *zFrom;
957954
const char *zTo;
958955
const char *zRe;
956
+ const char *zW;
959957
const char *zVerbose;
960958
const char *zGlob;
961959
ReCompiled *pRe = 0;
962960
login_check_credentials();
963961
if( !g.perm.Read ){ login_needed(); return; }
@@ -987,39 +985,54 @@
987985
zFrom = P("from");
988986
zTo = P("to");
989987
if(zGlob && !*zGlob){
990988
zGlob = NULL;
991989
}
990
+ diffFlags = construct_diff_flags(verboseFlag, sideBySide);
991
+ zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
992992
if( sideBySide || verboseFlag ){
993993
style_submenu_element("Hide Diff", "hidediff",
994
- "%R/vdiff?from=%T&to=%T&sbs=0%s%T",
994
+ "%R/vdiff?from=%T&to=%T&sbs=0%s%T%s",
995995
zFrom, zTo,
996
- zGlob ? "&glob=" : "", zGlob ? zGlob : "");
996
+ zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW);
997997
}
998998
if( !sideBySide ){
999
- style_submenu_element("Side-by-side Diff", "sbsdiff",
1000
- "%R/vdiff?from=%T&to=%T&sbs=1%s%T",
999
+ style_submenu_element("Side-by-Side Diff", "sbsdiff",
1000
+ "%R/vdiff?from=%T&to=%T&sbs=1%s%T%s",
10011001
zFrom, zTo,
1002
- zGlob ? "&glob=" : "", zGlob ? zGlob : "");
1002
+ zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW);
10031003
}
10041004
if( sideBySide || !verboseFlag ) {
10051005
style_submenu_element("Unified Diff", "udiff",
1006
- "%R/vdiff?from=%T&to=%T&sbs=0&v%s%T",
1006
+ "%R/vdiff?from=%T&to=%T&sbs=0&v%s%T%s",
10071007
zFrom, zTo,
1008
- zGlob ? "&glob=" : "", zGlob ? zGlob : "");
1008
+ zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW);
10091009
}
10101010
style_submenu_element("Invert", "invert",
1011
- "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T", zTo, zFrom,
1011
+ "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T%s", zTo, zFrom,
10121012
sideBySide, (verboseFlag && !sideBySide)?"&v":"",
1013
- zGlob ? "&glob=" : "", zGlob ? zGlob : "");
1013
+ zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW);
10141014
if( zGlob ){
10151015
style_submenu_element("Clear glob", "clearglob",
1016
- "%R/vdiff?from=%T&to=%T&sbs=%d%s", zFrom, zTo,
1017
- sideBySide, (verboseFlag && !sideBySide)?"&v":"");
1016
+ "%R/vdiff?from=%T&to=%T&sbs=%d%s%s", zFrom, zTo,
1017
+ sideBySide, (verboseFlag && !sideBySide)?"&v":"", zW);
10181018
}else{
10191019
style_submenu_element("Patch", "patch",
1020
- "%R/vpatch?from=%T&to=%T", zFrom, zTo);
1020
+ "%R/vpatch?from=%T&to=%T%s", zFrom, zTo, zW);
1021
+ }
1022
+ if( sideBySide || verboseFlag ){
1023
+ if( *zW ){
1024
+ style_submenu_element("Show Whitespace Differences", "whitespace",
1025
+ "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T", zFrom, zTo,
1026
+ sideBySide, (verboseFlag && !sideBySide)?"&v":"",
1027
+ zGlob ? "&glob=" : "", zGlob ? zGlob : "");
1028
+ }else{
1029
+ style_submenu_element("Ignore Whitespace", "ignorews",
1030
+ "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T&w", zFrom, zTo,
1031
+ sideBySide, (verboseFlag && !sideBySide)?"&v":"",
1032
+ zGlob ? "&glob=" : "", zGlob ? zGlob : "");
1033
+ }
10211034
}
10221035
style_header("Check-in Differences");
10231036
@ <h2>Difference From:</h2><blockquote>
10241037
checkin_description(ridFrom);
10251038
@ </blockquote><h2>To:</h2><blockquote>
@@ -1036,11 +1049,10 @@
10361049
10371050
manifest_file_rewind(pFrom);
10381051
pFileFrom = manifest_file_next(pFrom, 0);
10391052
manifest_file_rewind(pTo);
10401053
pFileTo = manifest_file_next(pTo, 0);
1041
- diffFlags = construct_diff_flags(verboseFlag, sideBySide);
10421054
while( pFileFrom || pFileTo ){
10431055
int cmp;
10441056
if( pFileFrom==0 ){
10451057
cmp = +1;
10461058
}else if( pFileTo==0 ){
@@ -1337,10 +1349,11 @@
13371349
int isPatch;
13381350
int sideBySide;
13391351
char *zV1;
13401352
char *zV2;
13411353
const char *zRe;
1354
+ const char *zW; /* URL param for ignoring whitespace */
13421355
ReCompiled *pRe = 0;
13431356
u64 diffFlags;
13441357
13451358
login_check_credentials();
13461359
if( !g.perm.Read ){ login_needed(); return; }
@@ -1367,20 +1380,30 @@
13671380
zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
13681381
zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
13691382
diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML;
13701383
13711384
style_header("Diff");
1385
+ zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
1386
+ if( *zW ){
1387
+ style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes",
1388
+ "%s/fdiff?v1=%T&v2=%T&sbs=%d",
1389
+ g.zTop, P("v1"), P("v2"), sideBySide);
1390
+ }else{
1391
+ style_submenu_element("Ignore Whitespace", "Ignore Whitespace",
1392
+ "%s/fdiff?v1=%T&v2=%T&sbs=%d&w",
1393
+ g.zTop, P("v1"), P("v2"), sideBySide);
1394
+ }
13721395
style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch",
13731396
g.zTop, P("v1"), P("v2"));
13741397
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"));
1398
+ style_submenu_element("Side-by-Side Diff", "sbsdiff",
1399
+ "%s/fdiff?v1=%T&v2=%T&sbs=1%s",
1400
+ g.zTop, P("v1"), P("v2"), zW);
13781401
}else{
13791402
style_submenu_element("Unified Diff", "udiff",
1380
- "%s/fdiff?v1=%T&v2=%T&sbs=0",
1381
- g.zTop, P("v1"), P("v2"));
1403
+ "%s/fdiff?v1=%T&v2=%T&sbs=0%s",
1404
+ g.zTop, P("v1"), P("v2"), zW);
13821405
}
13831406
13841407
if( P("smhdr")!=0 ){
13851408
@ <h2>Differences From Artifact
13861409
@ %z(href("%R/artifact/%S",zV1))[%S(zV1)]</a> To
@@ -1418,11 +1441,11 @@
14181441
rid = name_to_rid_www("name");
14191442
login_check_credentials();
14201443
if( !g.perm.Read ){ login_needed(); return; }
14211444
if( rid==0 ) fossil_redirect_home();
14221445
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1423
- if( fossil_strcmp(P("name"), zUuid)==0 ){
1446
+ if( fossil_strcmp(P("name"), zUuid)==0 && login_is_nobody() ){
14241447
g.isConst = 1;
14251448
}
14261449
free(zUuid);
14271450
zMime = P("m");
14281451
if( zMime==0 ){
@@ -1696,11 +1719,12 @@
16961719
}else{
16971720
renderAsHtml = 1;
16981721
style_submenu_element("Text", "Text",
16991722
"%s/artifact/%s?txt=1", g.zTop, zUuid);
17001723
}
1701
- }else if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0 ){
1724
+ }else if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0
1725
+ || fossil_strcmp(zMime, "text/x-markdown")==0 ){
17021726
if( asText ){
17031727
style_submenu_element("Wiki", "Wiki",
17041728
"%s/artifact/%s", g.zTop, zUuid);
17051729
}else{
17061730
renderAsWiki = 1;
@@ -1713,11 +1737,11 @@
17131737
style_submenu_element("Parsed", "Parsed", "%R/info/%s", zUuid);
17141738
}
17151739
@ <hr />
17161740
content_get(rid, &content);
17171741
if( renderAsWiki ){
1718
- wiki_convert(&content, 0, 0);
1742
+ wiki_render_by_mimetype(&content, zMime);
17191743
}else if( renderAsHtml ){
17201744
@ <iframe src="%R/raw/%T(blob_str(&downloadName))?name=%s(zUuid)"
17211745
@ width="100%%" frameborder="0" marginwidth="0" marginheight="0"
17221746
@ sandbox="allow-same-origin"
17231747
@ onload="this.height = this.contentDocument.documentElement.scrollHeight;">
@@ -2237,11 +2261,11 @@
22372261
}
22382262
db_finalize(&q);
22392263
if( nChng>0 ){
22402264
int nrid;
22412265
Blob cksum;
2242
- blob_appendf(&ctrl, "U %F\n", g.zLogin);
2266
+ blob_appendf(&ctrl, "U %F\n", login_name());
22432267
md5sum_blob(&ctrl, &cksum);
22442268
blob_appendf(&ctrl, "Z %b\n", &cksum);
22452269
db_begin_transaction();
22462270
g.markPrivate = content_is_private(rid);
22472271
nrid = content_put(&ctrl);
22482272
--- src/info.c
+++ src/info.c
@@ -443,37 +443,36 @@
443 /*
444 ** Construct an appropriate diffFlag for text_diff() based on query
445 ** parameters and the to boolean arguments.
446 */
447 u64 construct_diff_flags(int verboseFlag, int sideBySide){
448 u64 diffFlags;
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 /* 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 +497,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 +665,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 +951,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 +985,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 +1049,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 +1349,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 +1380,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 +1441,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 ){
@@ -1696,11 +1719,12 @@
1696 }else{
1697 renderAsHtml = 1;
1698 style_submenu_element("Text", "Text",
1699 "%s/artifact/%s?txt=1", g.zTop, zUuid);
1700 }
1701 }else if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0 ){
 
1702 if( asText ){
1703 style_submenu_element("Wiki", "Wiki",
1704 "%s/artifact/%s", g.zTop, zUuid);
1705 }else{
1706 renderAsWiki = 1;
@@ -1713,11 +1737,11 @@
1713 style_submenu_element("Parsed", "Parsed", "%R/info/%s", zUuid);
1714 }
1715 @ <hr />
1716 content_get(rid, &content);
1717 if( renderAsWiki ){
1718 wiki_convert(&content, 0, 0);
1719 }else if( renderAsHtml ){
1720 @ <iframe src="%R/raw/%T(blob_str(&downloadName))?name=%s(zUuid)"
1721 @ width="100%%" frameborder="0" marginwidth="0" marginheight="0"
1722 @ sandbox="allow-same-origin"
1723 @ onload="this.height = this.contentDocument.documentElement.scrollHeight;">
@@ -2237,11 +2261,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
@@ -443,37 +443,36 @@
443 /*
444 ** Construct an appropriate diffFlag for text_diff() based on query
445 ** parameters and the to boolean arguments.
446 */
447 u64 construct_diff_flags(int verboseFlag, int sideBySide){
448 u64 diffFlags = 0; /* Zero means do not show any diff */
449 if( verboseFlag!=0 ){
 
 
450 int x;
451 if( sideBySide ){
452 diffFlags = DIFF_SIDEBYSIDE;
453
454 /* "dw" query parameter determines width of each column */
455 x = atoi(PD("dw","80"))*(DIFF_CONTEXT_MASK+1);
456 if( x<0 || x>DIFF_WIDTH_MASK ) x = DIFF_WIDTH_MASK;
457 diffFlags += x;
 
 
458 }
459
460 if( P("w") ){
461 diffFlags |= DIFF_IGNORE_ALLWS;
462 }
463 /* "dc" query parameter determines lines of context */
464 x = atoi(PD("dc","7"));
465 if( x<0 || x>DIFF_CONTEXT_MASK ) x = DIFF_CONTEXT_MASK;
466 diffFlags += x;
467
468 /* The "noopt" parameter disables diff optimization */
469 if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT;
470 diffFlags |= DIFF_STRIP_EOLCR;
471 }
472 return diffFlags;
473 }
 
474
475 /*
476 ** WEBPAGE: vinfo
477 ** WEBPAGE: ci
478 ** URL: /ci?name=RID|ARTIFACTID
@@ -498,10 +497,13 @@
497 const char *zName; /* Name of the checkin to be displayed */
498 const char *zUuid; /* UUID of zName */
499 const char *zParent; /* UUID of the parent checkin (if any) */
500 const char *zRe; /* regex parameter */
501 ReCompiled *pRe = 0; /* regex */
502 const char *zW; /* URL param for ignoring whitespace */
503 const char *zPage = "vinfo"; /* Page that shows diffs */
504 const char *zPageHide = "ci"; /* Page that hides diffs */
505
506 login_check_credentials();
507 if( !g.perm.Read ){ login_needed(); return; }
508 zName = P("name");
509 rid = name_to_rid_www("name");
@@ -663,79 +665,74 @@
665 style_header("Check-in Information");
666 login_anonymous_available();
667 }
668 db_finalize(&q1);
669 showTags(rid, "");
670 @ <div class="section">Changes</div>
671 @ <div class="sectionmenu">
672 verboseFlag = g.zPath[0]!='c';
673 if( db_get_boolean("show-version-diffs", 0)==0 ){
674 verboseFlag = !verboseFlag;
675 zPage = "ci";
676 zPageHide = "vinfo";
677 }
678 diffFlags = construct_diff_flags(verboseFlag, sideBySide);
679 zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
680 if( verboseFlag ){
681 @ %z(xhref("class='button'","%R/%s/%T",zPageHide,zName))
682 @ Hide&nbsp;Diffs</a>
683 if( sideBySide ){
684 @ %z(xhref("class='button'","%R/%s/%T?sbs=0%s",zPage,zName,zW))
685 @ Unified&nbsp;Diffs</a>
686 }else{
687 @ %z(xhref("class='button'","%R/%s/%T?sbs=1%s",zPage,zName,zW))
688 @ Side-by-Side&nbsp;Diffs</a>
689 }
690 if( *zW ){
691 @ %z(xhref("class='button'","%R/%s/%T?sbs=%d",zPage,zName,sideBySide))
692 @ Show&nbsp;Whitespace&nbsp;Changes</a>
693 }else{
694 @ %z(xhref("class='button'","%R/%s/%T?sbs=%d&w",zPage,zName,sideBySide))
695 @ Ignore&nbsp;Whitespace</a>
696 }
697 }else{
698 @ %z(xhref("class='button'","%R/%s/%T?sbs=0",zPage,zName))
699 @ Show&nbsp;Unified&nbsp;Diffs</a>
700 @ %z(xhref("class='button'","%R/%s/%T?sbs=1",zPage,zName))
701 @ Show&nbsp;Side-by-Side&nbsp;Diffs</a>
702 }
703 if( zParent ){
 
 
 
 
 
704 @ %z(xhref("class='button'","%R/vpatch?from=%S&to=%S",zParent,zUuid))
705 @ Patch</a>
706 }
707 @</div>
708 if( pRe ){
709 @ <p><b>Only differences that match regular expression "%h(zRe)"
710 @ are shown.</b></p>
711 }
712 db_prepare(&q3,
713 "SELECT name,"
714 " mperm,"
715 " (SELECT uuid FROM blob WHERE rid=mlink.pid),"
716 " (SELECT uuid FROM blob WHERE rid=mlink.fid),"
717 " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)"
718 " FROM mlink JOIN filename ON filename.fnid=mlink.fnid"
719 " WHERE mlink.mid=%d"
720 " AND (mlink.fid>0"
721 " OR mlink.fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=%d))"
722 " ORDER BY name /*sort*/",
723 rid, rid
724 );
725 while( db_step(&q3)==SQLITE_ROW ){
726 const char *zName = db_column_text(&q3,0);
727 int mperm = db_column_int(&q3, 1);
728 const char *zOld = db_column_text(&q3,2);
729 const char *zNew = db_column_text(&q3,3);
730 const char *zOldName = db_column_text(&q3, 4);
731 append_file_change_line(zName, zOld, zNew, zOldName, diffFlags,pRe,mperm);
732 }
733 db_finalize(&q3);
734 append_diff_javascript(sideBySide);
735 style_footer();
736 }
737
738 /*
@@ -954,10 +951,11 @@
951 ManifestFile *pFileFrom, *pFileTo;
952 const char *zBranch;
953 const char *zFrom;
954 const char *zTo;
955 const char *zRe;
956 const char *zW;
957 const char *zVerbose;
958 const char *zGlob;
959 ReCompiled *pRe = 0;
960 login_check_credentials();
961 if( !g.perm.Read ){ login_needed(); return; }
@@ -987,39 +985,54 @@
985 zFrom = P("from");
986 zTo = P("to");
987 if(zGlob && !*zGlob){
988 zGlob = NULL;
989 }
990 diffFlags = construct_diff_flags(verboseFlag, sideBySide);
991 zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
992 if( sideBySide || verboseFlag ){
993 style_submenu_element("Hide Diff", "hidediff",
994 "%R/vdiff?from=%T&to=%T&sbs=0%s%T%s",
995 zFrom, zTo,
996 zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW);
997 }
998 if( !sideBySide ){
999 style_submenu_element("Side-by-Side Diff", "sbsdiff",
1000 "%R/vdiff?from=%T&to=%T&sbs=1%s%T%s",
1001 zFrom, zTo,
1002 zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW);
1003 }
1004 if( sideBySide || !verboseFlag ) {
1005 style_submenu_element("Unified Diff", "udiff",
1006 "%R/vdiff?from=%T&to=%T&sbs=0&v%s%T%s",
1007 zFrom, zTo,
1008 zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW);
1009 }
1010 style_submenu_element("Invert", "invert",
1011 "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T%s", zTo, zFrom,
1012 sideBySide, (verboseFlag && !sideBySide)?"&v":"",
1013 zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW);
1014 if( zGlob ){
1015 style_submenu_element("Clear glob", "clearglob",
1016 "%R/vdiff?from=%T&to=%T&sbs=%d%s%s", zFrom, zTo,
1017 sideBySide, (verboseFlag && !sideBySide)?"&v":"", zW);
1018 }else{
1019 style_submenu_element("Patch", "patch",
1020 "%R/vpatch?from=%T&to=%T%s", zFrom, zTo, zW);
1021 }
1022 if( sideBySide || verboseFlag ){
1023 if( *zW ){
1024 style_submenu_element("Show Whitespace Differences", "whitespace",
1025 "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T", zFrom, zTo,
1026 sideBySide, (verboseFlag && !sideBySide)?"&v":"",
1027 zGlob ? "&glob=" : "", zGlob ? zGlob : "");
1028 }else{
1029 style_submenu_element("Ignore Whitespace", "ignorews",
1030 "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T&w", zFrom, zTo,
1031 sideBySide, (verboseFlag && !sideBySide)?"&v":"",
1032 zGlob ? "&glob=" : "", zGlob ? zGlob : "");
1033 }
1034 }
1035 style_header("Check-in Differences");
1036 @ <h2>Difference From:</h2><blockquote>
1037 checkin_description(ridFrom);
1038 @ </blockquote><h2>To:</h2><blockquote>
@@ -1036,11 +1049,10 @@
1049
1050 manifest_file_rewind(pFrom);
1051 pFileFrom = manifest_file_next(pFrom, 0);
1052 manifest_file_rewind(pTo);
1053 pFileTo = manifest_file_next(pTo, 0);
 
1054 while( pFileFrom || pFileTo ){
1055 int cmp;
1056 if( pFileFrom==0 ){
1057 cmp = +1;
1058 }else if( pFileTo==0 ){
@@ -1337,10 +1349,11 @@
1349 int isPatch;
1350 int sideBySide;
1351 char *zV1;
1352 char *zV2;
1353 const char *zRe;
1354 const char *zW; /* URL param for ignoring whitespace */
1355 ReCompiled *pRe = 0;
1356 u64 diffFlags;
1357
1358 login_check_credentials();
1359 if( !g.perm.Read ){ login_needed(); return; }
@@ -1367,20 +1380,30 @@
1380 zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
1381 zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
1382 diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML;
1383
1384 style_header("Diff");
1385 zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
1386 if( *zW ){
1387 style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes",
1388 "%s/fdiff?v1=%T&v2=%T&sbs=%d",
1389 g.zTop, P("v1"), P("v2"), sideBySide);
1390 }else{
1391 style_submenu_element("Ignore Whitespace", "Ignore Whitespace",
1392 "%s/fdiff?v1=%T&v2=%T&sbs=%d&w",
1393 g.zTop, P("v1"), P("v2"), sideBySide);
1394 }
1395 style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch",
1396 g.zTop, P("v1"), P("v2"));
1397 if( !sideBySide ){
1398 style_submenu_element("Side-by-Side Diff", "sbsdiff",
1399 "%s/fdiff?v1=%T&v2=%T&sbs=1%s",
1400 g.zTop, P("v1"), P("v2"), zW);
1401 }else{
1402 style_submenu_element("Unified Diff", "udiff",
1403 "%s/fdiff?v1=%T&v2=%T&sbs=0%s",
1404 g.zTop, P("v1"), P("v2"), zW);
1405 }
1406
1407 if( P("smhdr")!=0 ){
1408 @ <h2>Differences From Artifact
1409 @ %z(href("%R/artifact/%S",zV1))[%S(zV1)]</a> To
@@ -1418,11 +1441,11 @@
1441 rid = name_to_rid_www("name");
1442 login_check_credentials();
1443 if( !g.perm.Read ){ login_needed(); return; }
1444 if( rid==0 ) fossil_redirect_home();
1445 zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
1446 if( fossil_strcmp(P("name"), zUuid)==0 && login_is_nobody() ){
1447 g.isConst = 1;
1448 }
1449 free(zUuid);
1450 zMime = P("m");
1451 if( zMime==0 ){
@@ -1696,11 +1719,12 @@
1719 }else{
1720 renderAsHtml = 1;
1721 style_submenu_element("Text", "Text",
1722 "%s/artifact/%s?txt=1", g.zTop, zUuid);
1723 }
1724 }else if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0
1725 || fossil_strcmp(zMime, "text/x-markdown")==0 ){
1726 if( asText ){
1727 style_submenu_element("Wiki", "Wiki",
1728 "%s/artifact/%s", g.zTop, zUuid);
1729 }else{
1730 renderAsWiki = 1;
@@ -1713,11 +1737,11 @@
1737 style_submenu_element("Parsed", "Parsed", "%R/info/%s", zUuid);
1738 }
1739 @ <hr />
1740 content_get(rid, &content);
1741 if( renderAsWiki ){
1742 wiki_render_by_mimetype(&content, zMime);
1743 }else if( renderAsHtml ){
1744 @ <iframe src="%R/raw/%T(blob_str(&downloadName))?name=%s(zUuid)"
1745 @ width="100%%" frameborder="0" marginwidth="0" marginheight="0"
1746 @ sandbox="allow-same-origin"
1747 @ onload="this.height = this.contentDocument.documentElement.scrollHeight;">
@@ -2237,11 +2261,11 @@
2261 }
2262 db_finalize(&q);
2263 if( nChng>0 ){
2264 int nrid;
2265 Blob cksum;
2266 blob_appendf(&ctrl, "U %F\n", login_name());
2267 md5sum_blob(&ctrl, &cksum);
2268 blob_appendf(&ctrl, "Z %b\n", &cksum);
2269 db_begin_transaction();
2270 g.markPrivate = content_is_private(rid);
2271 nrid = content_put(&ctrl);
2272
--- 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
--- 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
--- 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
+1 -1
--- src/json_wiki.c
+++ src/json_wiki.c
@@ -542,11 +542,11 @@
542542
543543
blob_init(&w1, pW1->zWiki, -1);
544544
blob_zero(&w2);
545545
blob_init(&w2, pW2->zWiki, -1);
546546
blob_zero(&d);
547
- diffFlags = DIFF_IGNORE_EOLWS | DIFF_INLINE;
547
+ diffFlags = DIFF_IGNORE_EOLWS | DIFF_STRIP_EOLCR;
548548
text_diff(&w2, &w1, &d, 0, diffFlags);
549549
blob_reset(&w1);
550550
blob_reset(&w2);
551551
552552
pay = cson_new_object();
553553
554554
ADDED src/loadctrl.c
--- src/json_wiki.c
+++ src/json_wiki.c
@@ -542,11 +542,11 @@
542
543 blob_init(&w1, pW1->zWiki, -1);
544 blob_zero(&w2);
545 blob_init(&w2, pW2->zWiki, -1);
546 blob_zero(&d);
547 diffFlags = DIFF_IGNORE_EOLWS | DIFF_INLINE;
548 text_diff(&w2, &w1, &d, 0, diffFlags);
549 blob_reset(&w1);
550 blob_reset(&w2);
551
552 pay = cson_new_object();
553
554 DDED src/loadctrl.c
--- src/json_wiki.c
+++ src/json_wiki.c
@@ -542,11 +542,11 @@
542
543 blob_init(&w1, pW1->zWiki, -1);
544 blob_zero(&w2);
545 blob_init(&w2, pW2->zWiki, -1);
546 blob_zero(&d);
547 diffFlags = DIFF_IGNORE_EOLWS | DIFF_STRIP_EOLCR;
548 text_diff(&w2, &w1, &d, 0, diffFlags);
549 blob_reset(&w1);
550 blob_reset(&w2);
551
552 pay = cson_new_object();
553
554 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 -9
--- src/main.c
+++ src/main.c
@@ -121,11 +121,11 @@
121121
122122
struct Global {
123123
int argc; char **argv; /* Command-line arguments to the program */
124124
char *nameOfExe; /* Full path of executable. */
125125
const char *zErrlog; /* Log errors to this file, if not NULL */
126
- int isConst; /* True if the output is unchanging */
126
+ int isConst; /* True if the output is unchanging & cacheable */
127127
const char *zVfsName; /* The VFS to use for database connections */
128128
sqlite3 *db; /* The connection to the databases */
129129
sqlite3 *dbConfig; /* Separate connection for global_config table */
130130
int useAttach; /* True if global_config is attached to repository */
131131
const char *zConfigDbName;/* Path of the config database. NULL if not open */
@@ -140,10 +140,11 @@
140140
int fSqlTrace; /* True if --sqltrace flag is present */
141141
int fSqlStats; /* True if --sqltrace or --sqlstats are present */
142142
int fSqlPrint; /* True if -sqlprint flag is present */
143143
int fQuiet; /* True if -quiet flag is present */
144144
int fHttpTrace; /* Trace outbound HTTP requests */
145
+ char *zHttpAuth; /* HTTP Authorization user:pass information */
145146
int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */
146147
int fSshTrace; /* Trace the SSH setup traffic */
147148
int fSshClient; /* HTTP client flags for SSH client */
148149
char *zSshCmd; /* SSH command string */
149150
int fNoSync; /* Do not do an autosync ever. --nosync */
@@ -193,11 +194,11 @@
193194
char *urlFossil; /* The fossil query parameter on ssh: */
194195
unsigned urlFlags; /* Boolean flags controlling URL processing */
195196
int useProxy; /* Used to remember that a proxy is in use */
196197
char *proxyUrlPath;
197198
int proxyOrigPort; /* Tunneled port number for https through proxy */
198
- const char *zLogin; /* Login name. "" if not logged in. */
199
+ const char *zLogin; /* Login name. NULL or "" if not logged in. */
199200
const char *zSSLIdentity; /* Value of --ssl-identity option, filename of
200201
** SSL client identity */
201202
int useLocalauth; /* No login required if from 127.0.0.1 */
202203
int noPswd; /* Logged in without password (on 127.0.0.1) */
203204
int userUid; /* Integer user id */
@@ -603,15 +604,10 @@
603604
#endif
604605
g.mainTimerId = fossil_timer_start();
605606
g.zVfsName = find_option("vfs",0,1);
606607
if( g.zVfsName==0 ){
607608
g.zVfsName = fossil_getenv("FOSSIL_VFS");
608
-#if defined(__CYGWIN__)
609
- if( g.zVfsName==0 ){
610
- g.zVfsName = "win32-longpath";
611
- }
612
-#endif
613609
}
614610
if( g.zVfsName ){
615611
sqlite3_vfs *pVfs = sqlite3_vfs_find(g.zVfsName);
616612
if( pVfs ){
617613
sqlite3_vfs_register(pVfs, 1);
@@ -651,10 +647,11 @@
651647
g.fSshClient = 0;
652648
g.zSshCmd = 0;
653649
if( g.fSqlTrace ) g.fSqlStats = 1;
654650
g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
655651
g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
652
+ g.zHttpAuth = 0;
656653
g.zLogin = find_option("user", "U", 1);
657654
g.zSSLIdentity = find_option("ssl-identity", 0, 1);
658655
g.zErrlog = find_option("errorlog", 0, 1);
659656
if( find_option("utc",0,0) ) g.fTimeFormat = 1;
660657
if( find_option("localtime",0,0) ) g.fTimeFormat = 2;
@@ -1068,11 +1065,11 @@
10681065
if( j>0 ){
10691066
@ </ul></td>
10701067
}
10711068
@ </tr></table>
10721069
1073
- @ <h1>Available pages:</h1>
1070
+ @ <h1>Available web UI pages:</h1>
10741071
@ (Only pages with help text are linked.)
10751072
@ <table border="0"><tr>
10761073
for(i=j=0; i<count(aCommand); i++){
10771074
const char *z = aCommand[i].zName;
10781075
if( '/'!=*z ) continue;
@@ -1457,11 +1454,11 @@
14571454
zAltRepo[jj] = 0;
14581455
zAltRepo += jj+1;
14591456
}else{
14601457
zUser = "nobody";
14611458
}
1462
- if( g.zLogin==0 ) zUser = "nobody";
1459
+ if( g.zLogin==0 || g.zLogin[0]==0 ) zUser = "nobody";
14631460
if( zAltRepo[0]!='/' ){
14641461
zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo);
14651462
file_simplify_name(zAltRepo, -1, 0);
14661463
}
14671464
db_close(1);
14681465
--- src/main.c
+++ src/main.c
@@ -121,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 */
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 */
@@ -140,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 int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */
146 int fSshTrace; /* Trace the SSH setup traffic */
147 int fSshClient; /* HTTP client flags for SSH client */
148 char *zSshCmd; /* SSH command string */
149 int fNoSync; /* Do not do an autosync ever. --nosync */
@@ -193,11 +194,11 @@
193 char *urlFossil; /* The fossil query parameter on ssh: */
194 unsigned urlFlags; /* Boolean flags controlling URL processing */
195 int useProxy; /* Used to remember that a proxy is in use */
196 char *proxyUrlPath;
197 int proxyOrigPort; /* Tunneled port number for https through proxy */
198 const char *zLogin; /* Login name. "" if not logged in. */
199 const char *zSSLIdentity; /* Value of --ssl-identity option, filename of
200 ** SSL client identity */
201 int useLocalauth; /* No login required if from 127.0.0.1 */
202 int noPswd; /* Logged in without password (on 127.0.0.1) */
203 int userUid; /* Integer user id */
@@ -603,15 +604,10 @@
603 #endif
604 g.mainTimerId = fossil_timer_start();
605 g.zVfsName = find_option("vfs",0,1);
606 if( g.zVfsName==0 ){
607 g.zVfsName = fossil_getenv("FOSSIL_VFS");
608 #if defined(__CYGWIN__)
609 if( g.zVfsName==0 ){
610 g.zVfsName = "win32-longpath";
611 }
612 #endif
613 }
614 if( g.zVfsName ){
615 sqlite3_vfs *pVfs = sqlite3_vfs_find(g.zVfsName);
616 if( pVfs ){
617 sqlite3_vfs_register(pVfs, 1);
@@ -651,10 +647,11 @@
651 g.fSshClient = 0;
652 g.zSshCmd = 0;
653 if( g.fSqlTrace ) g.fSqlStats = 1;
654 g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
655 g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
 
656 g.zLogin = find_option("user", "U", 1);
657 g.zSSLIdentity = find_option("ssl-identity", 0, 1);
658 g.zErrlog = find_option("errorlog", 0, 1);
659 if( find_option("utc",0,0) ) g.fTimeFormat = 1;
660 if( find_option("localtime",0,0) ) g.fTimeFormat = 2;
@@ -1068,11 +1065,11 @@
1068 if( j>0 ){
1069 @ </ul></td>
1070 }
1071 @ </tr></table>
1072
1073 @ <h1>Available pages:</h1>
1074 @ (Only pages with help text are linked.)
1075 @ <table border="0"><tr>
1076 for(i=j=0; i<count(aCommand); i++){
1077 const char *z = aCommand[i].zName;
1078 if( '/'!=*z ) continue;
@@ -1457,11 +1454,11 @@
1457 zAltRepo[jj] = 0;
1458 zAltRepo += jj+1;
1459 }else{
1460 zUser = "nobody";
1461 }
1462 if( g.zLogin==0 ) zUser = "nobody";
1463 if( zAltRepo[0]!='/' ){
1464 zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo);
1465 file_simplify_name(zAltRepo, -1, 0);
1466 }
1467 db_close(1);
1468
--- src/main.c
+++ src/main.c
@@ -121,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 */
@@ -140,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 */
@@ -193,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 */
@@ -603,15 +604,10 @@
604 #endif
605 g.mainTimerId = fossil_timer_start();
606 g.zVfsName = find_option("vfs",0,1);
607 if( g.zVfsName==0 ){
608 g.zVfsName = fossil_getenv("FOSSIL_VFS");
 
 
 
 
 
609 }
610 if( g.zVfsName ){
611 sqlite3_vfs *pVfs = sqlite3_vfs_find(g.zVfsName);
612 if( pVfs ){
613 sqlite3_vfs_register(pVfs, 1);
@@ -651,10 +647,11 @@
647 g.fSshClient = 0;
648 g.zSshCmd = 0;
649 if( g.fSqlTrace ) g.fSqlStats = 1;
650 g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
651 g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
652 g.zHttpAuth = 0;
653 g.zLogin = find_option("user", "U", 1);
654 g.zSSLIdentity = find_option("ssl-identity", 0, 1);
655 g.zErrlog = find_option("errorlog", 0, 1);
656 if( find_option("utc",0,0) ) g.fTimeFormat = 1;
657 if( find_option("localtime",0,0) ) g.fTimeFormat = 2;
@@ -1068,11 +1065,11 @@
1065 if( j>0 ){
1066 @ </ul></td>
1067 }
1068 @ </tr></table>
1069
1070 @ <h1>Available web UI pages:</h1>
1071 @ (Only pages with help text are linked.)
1072 @ <table border="0"><tr>
1073 for(i=j=0; i<count(aCommand); i++){
1074 const char *z = aCommand[i].zName;
1075 if( '/'!=*z ) continue;
@@ -1457,11 +1454,11 @@
1454 zAltRepo[jj] = 0;
1455 zAltRepo += jj+1;
1456 }else{
1457 zUser = "nobody";
1458 }
1459 if( g.zLogin==0 || g.zLogin[0]==0 ) zUser = "nobody";
1460 if( zAltRepo[0]!='/' ){
1461 zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo);
1462 file_simplify_name(zAltRepo, -1, 0);
1463 }
1464 db_close(1);
1465
+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
--- 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"
806810
--- 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"
806
--- 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"
810
+173 -68
--- src/name.c
+++ src/name.c
@@ -433,10 +433,152 @@
433433
cgi_redirectf("%s/ambiguous/%T?src=%t", g.zTop, zName, g.zPath);
434434
rid = 0;
435435
}
436436
return rid;
437437
}
438
+
439
+/*
440
+** Generate a description of artifact "rid"
441
+*/
442
+static void whatis_rid(int rid, int verboseFlag){
443
+ Stmt q;
444
+ int cnt;
445
+
446
+ /* Basic information about the object. */
447
+ db_prepare(&q,
448
+ "SELECT uuid, size, datetime(mtime%s), ipaddr"
449
+ " FROM blob, rcvfrom"
450
+ " WHERE rid=%d"
451
+ " AND rcvfrom.rcvid=blob.rcvid",
452
+ timeline_utc(), rid);
453
+ if( db_step(&q)==SQLITE_ROW ){
454
+ if( verboseFlag ){
455
+ fossil_print("artifact: %s (%d)\n", db_column_text(&q,0), rid);
456
+ fossil_print("size: %d bytes\n", db_column_int(&q,1));
457
+ fossil_print("received: %s from %s\n",
458
+ db_column_text(&q, 2),
459
+ db_column_text(&q, 3));
460
+ }else{
461
+ fossil_print("artifact: %s\n", db_column_text(&q,0));
462
+ fossil_print("size: %d bytes\n", db_column_int(&q,1));
463
+ }
464
+ }
465
+ db_finalize(&q);
466
+
467
+ /* Report any symbolic tags on this artifact */
468
+ db_prepare(&q,
469
+ "SELECT substr(tagname,5)"
470
+ " FROM tag JOIN tagxref ON tag.tagid=tagxref.tagid"
471
+ " WHERE tagxref.rid=%d"
472
+ " AND tagname GLOB 'sym-*'"
473
+ " ORDER BY 1",
474
+ rid
475
+ );
476
+ cnt = 0;
477
+ while( db_step(&q)==SQLITE_ROW ){
478
+ const char *zPrefix = cnt++ ? ", " : "tags: ";
479
+ fossil_print("%s%s", zPrefix, db_column_text(&q,0));
480
+ }
481
+ if( cnt ) fossil_print("\n");
482
+ db_finalize(&q);
483
+
484
+ /* Report any HIDDEN, PRIVATE, CLUSTER, or CLOSED tags on this artifact */
485
+ db_prepare(&q,
486
+ "SELECT tagname"
487
+ " FROM tag JOIN tagxref ON tag.tagid=tagxref.tagid"
488
+ " WHERE tagxref.rid=%d"
489
+ " AND tag.tagid IN (5,6,7,9)"
490
+ " ORDER BY 1",
491
+ rid, rid
492
+ );
493
+ cnt = 0;
494
+ while( db_step(&q)==SQLITE_ROW ){
495
+ const char *zPrefix = cnt++ ? ", " : "raw-tags: ";
496
+ fossil_print("%s%s", zPrefix, db_column_text(&q,0));
497
+ }
498
+ if( cnt ) fossil_print("\n");
499
+ db_finalize(&q);
500
+
501
+ /* Check for entries on the timeline that reference this object */
502
+ db_prepare(&q,
503
+ "SELECT type, datetime(mtime%s),"
504
+ " coalesce(euser,user), coalesce(ecomment,comment)"
505
+ " FROM event WHERE objid=%d", timeline_utc(), rid);
506
+ if( db_step(&q)==SQLITE_ROW ){
507
+ const char *zType;
508
+ switch( db_column_text(&q,0)[0] ){
509
+ case 'c': zType = "Check-in"; break;
510
+ case 'w': zType = "Wiki-edit"; break;
511
+ case 'e': zType = "Event"; break;
512
+ case 't': zType = "Ticket-change"; break;
513
+ case 'g': zType = "Tag-change"; break;
514
+ default: zType = "Unknown"; break;
515
+ }
516
+ fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2),
517
+ db_column_text(&q, 1));
518
+ fossil_print("comment: ");
519
+ comment_print(db_column_text(&q,3), 12, 78);
520
+ }
521
+ db_finalize(&q);
522
+
523
+ /* Check to see if this object is used as a file in a check-in */
524
+ db_prepare(&q,
525
+ "SELECT filename.name, blob.uuid, datetime(event.mtime%s),"
526
+ " coalesce(euser,user), coalesce(ecomment,comment)"
527
+ " FROM mlink, filename, blob, event"
528
+ " WHERE mlink.fid=%d"
529
+ " AND filename.fnid=mlink.fnid"
530
+ " AND event.objid=mlink.mid"
531
+ " AND blob.rid=mlink.mid"
532
+ " ORDER BY event.mtime DESC /*sort*/",
533
+ timeline_utc(), rid);
534
+ while( db_step(&q)==SQLITE_ROW ){
535
+ fossil_print("file: %s\n", db_column_text(&q,0));
536
+ fossil_print(" part of [%.10s] by %s on %s\n",
537
+ db_column_text(&q, 1),
538
+ db_column_text(&q, 3),
539
+ db_column_text(&q, 2));
540
+ fossil_print(" ");
541
+ comment_print(db_column_text(&q,4), 12, 78);
542
+ }
543
+ db_finalize(&q);
544
+
545
+ /* Check to see if this object is used as an attachment */
546
+ db_prepare(&q,
547
+ "SELECT attachment.filename,"
548
+ " attachment.comment,"
549
+ " attachment.user,"
550
+ " datetime(attachment.mtime%s),"
551
+ " attachment.target,"
552
+ " CASE WHEN EXISTS(SELECT 1 FROM tag WHERE tagname=('tkt-'||target))"
553
+ " THEN 'ticket'"
554
+ " WHEN EXISTS(SELECT 1 FROM tag WHERE tagname=('wiki-'||target))"
555
+ " THEN 'wiki' END,"
556
+ " attachment.attachid,"
557
+ " (SELECT uuid FROM blob WHERE rid=attachid)"
558
+ " FROM attachment JOIN blob ON attachment.src=blob.uuid"
559
+ " WHERE blob.rid=%d",
560
+ timeline_utc(), rid
561
+ );
562
+ while( db_step(&q)==SQLITE_ROW ){
563
+ fossil_print("attachment: %s\n", db_column_text(&q,0));
564
+ fossil_print(" attached to %s %s\n",
565
+ db_column_text(&q,5), db_column_text(&q,4));
566
+ if( verboseFlag ){
567
+ fossil_print(" via %s (%d)\n",
568
+ db_column_text(&q,7), db_column_int(&q,6));
569
+ }else{
570
+ fossil_print(" via %s\n",
571
+ db_column_text(&q,7));
572
+ }
573
+ fossil_print(" by user %s on %s\n",
574
+ db_column_text(&q,2), db_column_text(&q,3));
575
+ fossil_print(" ");
576
+ comment_print(db_column_text(&q,1), 12, 78);
577
+ }
578
+ db_finalize(&q);
579
+}
438580
439581
/*
440582
** COMMAND: whatis*
441583
** Usage: %fossil whatis NAME
442584
**
@@ -452,78 +594,41 @@
452594
verboseFlag = find_option("verbose","v",0)!=0;
453595
if( g.argc!=3 ) usage("whatis NAME");
454596
zName = g.argv[2];
455597
rid = symbolic_name_to_rid(zName, 0);
456598
if( rid<0 ){
599
+ Stmt q;
600
+ int cnt = 0;
457601
fossil_print("Ambiguous artifact name prefix: %s\n", zName);
602
+ db_prepare(&q,
603
+ "SELECT rid FROM blob WHERE uuid>=lower(%Q) AND uuid<(lower(%Q)||'z')",
604
+ zName, zName
605
+ );
606
+ while( db_step(&q)==SQLITE_ROW ){
607
+ if( cnt++ ) fossil_print("%.79c\n", '-');
608
+ whatis_rid(db_column_int(&q, 0), verboseFlag);
609
+ }
610
+ db_finalize(&q);
458611
}else if( rid==0 ){
459612
fossil_print("Unknown artifact: %s\n", zName);
460613
}else{
461
- Stmt q;
462
- db_prepare(&q,
463
- "SELECT uuid, size, datetime(mtime%s), ipaddr,"
464
- " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
465
- " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
466
- " AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
467
- " FROM blob, rcvfrom"
468
- " WHERE rid=%d"
469
- " AND rcvfrom.rcvid=blob.rcvid",
470
- timeline_utc(), rid);
471
- if( db_step(&q)==SQLITE_ROW ){
472
- const char *zTagList = db_column_text(&q, 4);
473
- if( verboseFlag ){
474
- fossil_print("artifact: %s (%d)\n", db_column_text(&q,0), rid);
475
- fossil_print("size: %d bytes\n", db_column_int(&q,1));
476
- fossil_print("received: %s from %s\n",
477
- db_column_text(&q, 2),
478
- db_column_text(&q, 3));
479
- }else{
480
- fossil_print("artifact: %s\n", db_column_text(&q,0));
481
- fossil_print("size: %d bytes\n", db_column_int(&q,1));
482
- }
483
- if( zTagList && zTagList[0] ){
484
- fossil_print("tags: %s\n", zTagList);
485
- }
486
- }
487
- db_finalize(&q);
488
- db_prepare(&q,
489
- "SELECT type, datetime(mtime%s),"
490
- " coalesce(euser,user), coalesce(ecomment,comment)"
491
- " FROM event WHERE objid=%d", timeline_utc(), rid);
492
- if( db_step(&q)==SQLITE_ROW ){
493
- const char *zType;
494
- switch( db_column_text(&q,0)[0] ){
495
- case 'c': zType = "Check-in"; break;
496
- case 'w': zType = "Wiki-edit"; break;
497
- case 'e': zType = "Event"; break;
498
- case 't': zType = "Ticket-change"; break;
499
- case 'g': zType = "Tag-change"; break;
500
- default: zType = "Unknown"; break;
501
- }
502
- fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2),
503
- db_column_text(&q, 1));
504
- fossil_print("comment: ");
505
- comment_print(db_column_text(&q,3), 10, 78);
506
- }
507
- db_finalize(&q);
508
- db_prepare(&q,
509
- "SELECT filename.name, blob.uuid, datetime(event.mtime%s),"
510
- " coalesce(euser,user), coalesce(ecomment,comment)"
511
- " FROM mlink, filename, blob, event"
512
- " WHERE mlink.fid=%d"
513
- " AND filename.fnid=mlink.fnid"
514
- " AND event.objid=mlink.mid"
515
- " AND blob.rid=mlink.mid"
516
- " ORDER BY event.mtime DESC /*sort*/",
517
- timeline_utc(), rid);
518
- while( db_step(&q)==SQLITE_ROW ){
519
- fossil_print("file: %s\n", db_column_text(&q,0));
520
- fossil_print(" part of [%.10s] by %s on %s\n",
521
- db_column_text(&q, 1),
522
- db_column_text(&q, 3),
523
- db_column_text(&q, 2));
524
- fossil_print(" ");
525
- comment_print(db_column_text(&q,4), 10, 78);
526
- }
527
- db_finalize(&q);
528
- }
614
+ whatis_rid(rid, verboseFlag);
615
+ }
616
+}
617
+
618
+/*
619
+** COMMAND: test-whatis-all
620
+** Usage: %fossil test-whatis-all
621
+**
622
+** Show "whatis" information about every artifact in the repository
623
+*/
624
+void test_whatis_all_cmd(void){
625
+ Stmt q;
626
+ int cnt = 0;
627
+ db_find_and_open_repository(0,0);
628
+ db_prepare(&q, "SELECT rid FROM blob ORDER BY rid");
629
+ while( db_step(&q)==SQLITE_ROW ){
630
+ if( cnt++ ) fossil_print("%.79c\n", '-');
631
+ whatis_rid(db_column_int(&q,0), 1);
632
+ }
633
+ db_finalize(&q);
529634
}
530635
--- src/name.c
+++ src/name.c
@@ -433,10 +433,152 @@
433 cgi_redirectf("%s/ambiguous/%T?src=%t", g.zTop, zName, g.zPath);
434 rid = 0;
435 }
436 return rid;
437 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
438
439 /*
440 ** COMMAND: whatis*
441 ** Usage: %fossil whatis NAME
442 **
@@ -452,78 +594,41 @@
452 verboseFlag = find_option("verbose","v",0)!=0;
453 if( g.argc!=3 ) usage("whatis NAME");
454 zName = g.argv[2];
455 rid = symbolic_name_to_rid(zName, 0);
456 if( rid<0 ){
 
 
457 fossil_print("Ambiguous artifact name prefix: %s\n", zName);
 
 
 
 
 
 
 
 
 
458 }else if( rid==0 ){
459 fossil_print("Unknown artifact: %s\n", zName);
460 }else{
461 Stmt q;
462 db_prepare(&q,
463 "SELECT uuid, size, datetime(mtime%s), ipaddr,"
464 " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
465 " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
466 " AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
467 " FROM blob, rcvfrom"
468 " WHERE rid=%d"
469 " AND rcvfrom.rcvid=blob.rcvid",
470 timeline_utc(), rid);
471 if( db_step(&q)==SQLITE_ROW ){
472 const char *zTagList = db_column_text(&q, 4);
473 if( verboseFlag ){
474 fossil_print("artifact: %s (%d)\n", db_column_text(&q,0), rid);
475 fossil_print("size: %d bytes\n", db_column_int(&q,1));
476 fossil_print("received: %s from %s\n",
477 db_column_text(&q, 2),
478 db_column_text(&q, 3));
479 }else{
480 fossil_print("artifact: %s\n", db_column_text(&q,0));
481 fossil_print("size: %d bytes\n", db_column_int(&q,1));
482 }
483 if( zTagList && zTagList[0] ){
484 fossil_print("tags: %s\n", zTagList);
485 }
486 }
487 db_finalize(&q);
488 db_prepare(&q,
489 "SELECT type, datetime(mtime%s),"
490 " coalesce(euser,user), coalesce(ecomment,comment)"
491 " FROM event WHERE objid=%d", timeline_utc(), rid);
492 if( db_step(&q)==SQLITE_ROW ){
493 const char *zType;
494 switch( db_column_text(&q,0)[0] ){
495 case 'c': zType = "Check-in"; break;
496 case 'w': zType = "Wiki-edit"; break;
497 case 'e': zType = "Event"; break;
498 case 't': zType = "Ticket-change"; break;
499 case 'g': zType = "Tag-change"; break;
500 default: zType = "Unknown"; break;
501 }
502 fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2),
503 db_column_text(&q, 1));
504 fossil_print("comment: ");
505 comment_print(db_column_text(&q,3), 10, 78);
506 }
507 db_finalize(&q);
508 db_prepare(&q,
509 "SELECT filename.name, blob.uuid, datetime(event.mtime%s),"
510 " coalesce(euser,user), coalesce(ecomment,comment)"
511 " FROM mlink, filename, blob, event"
512 " WHERE mlink.fid=%d"
513 " AND filename.fnid=mlink.fnid"
514 " AND event.objid=mlink.mid"
515 " AND blob.rid=mlink.mid"
516 " ORDER BY event.mtime DESC /*sort*/",
517 timeline_utc(), rid);
518 while( db_step(&q)==SQLITE_ROW ){
519 fossil_print("file: %s\n", db_column_text(&q,0));
520 fossil_print(" part of [%.10s] by %s on %s\n",
521 db_column_text(&q, 1),
522 db_column_text(&q, 3),
523 db_column_text(&q, 2));
524 fossil_print(" ");
525 comment_print(db_column_text(&q,4), 10, 78);
526 }
527 db_finalize(&q);
528 }
529 }
530
--- src/name.c
+++ src/name.c
@@ -433,10 +433,152 @@
433 cgi_redirectf("%s/ambiguous/%T?src=%t", g.zTop, zName, g.zPath);
434 rid = 0;
435 }
436 return rid;
437 }
438
439 /*
440 ** Generate a description of artifact "rid"
441 */
442 static void whatis_rid(int rid, int verboseFlag){
443 Stmt q;
444 int cnt;
445
446 /* Basic information about the object. */
447 db_prepare(&q,
448 "SELECT uuid, size, datetime(mtime%s), ipaddr"
449 " FROM blob, rcvfrom"
450 " WHERE rid=%d"
451 " AND rcvfrom.rcvid=blob.rcvid",
452 timeline_utc(), rid);
453 if( db_step(&q)==SQLITE_ROW ){
454 if( verboseFlag ){
455 fossil_print("artifact: %s (%d)\n", db_column_text(&q,0), rid);
456 fossil_print("size: %d bytes\n", db_column_int(&q,1));
457 fossil_print("received: %s from %s\n",
458 db_column_text(&q, 2),
459 db_column_text(&q, 3));
460 }else{
461 fossil_print("artifact: %s\n", db_column_text(&q,0));
462 fossil_print("size: %d bytes\n", db_column_int(&q,1));
463 }
464 }
465 db_finalize(&q);
466
467 /* Report any symbolic tags on this artifact */
468 db_prepare(&q,
469 "SELECT substr(tagname,5)"
470 " FROM tag JOIN tagxref ON tag.tagid=tagxref.tagid"
471 " WHERE tagxref.rid=%d"
472 " AND tagname GLOB 'sym-*'"
473 " ORDER BY 1",
474 rid
475 );
476 cnt = 0;
477 while( db_step(&q)==SQLITE_ROW ){
478 const char *zPrefix = cnt++ ? ", " : "tags: ";
479 fossil_print("%s%s", zPrefix, db_column_text(&q,0));
480 }
481 if( cnt ) fossil_print("\n");
482 db_finalize(&q);
483
484 /* Report any HIDDEN, PRIVATE, CLUSTER, or CLOSED tags on this artifact */
485 db_prepare(&q,
486 "SELECT tagname"
487 " FROM tag JOIN tagxref ON tag.tagid=tagxref.tagid"
488 " WHERE tagxref.rid=%d"
489 " AND tag.tagid IN (5,6,7,9)"
490 " ORDER BY 1",
491 rid, rid
492 );
493 cnt = 0;
494 while( db_step(&q)==SQLITE_ROW ){
495 const char *zPrefix = cnt++ ? ", " : "raw-tags: ";
496 fossil_print("%s%s", zPrefix, db_column_text(&q,0));
497 }
498 if( cnt ) fossil_print("\n");
499 db_finalize(&q);
500
501 /* Check for entries on the timeline that reference this object */
502 db_prepare(&q,
503 "SELECT type, datetime(mtime%s),"
504 " coalesce(euser,user), coalesce(ecomment,comment)"
505 " FROM event WHERE objid=%d", timeline_utc(), rid);
506 if( db_step(&q)==SQLITE_ROW ){
507 const char *zType;
508 switch( db_column_text(&q,0)[0] ){
509 case 'c': zType = "Check-in"; break;
510 case 'w': zType = "Wiki-edit"; break;
511 case 'e': zType = "Event"; break;
512 case 't': zType = "Ticket-change"; break;
513 case 'g': zType = "Tag-change"; break;
514 default: zType = "Unknown"; break;
515 }
516 fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2),
517 db_column_text(&q, 1));
518 fossil_print("comment: ");
519 comment_print(db_column_text(&q,3), 12, 78);
520 }
521 db_finalize(&q);
522
523 /* Check to see if this object is used as a file in a check-in */
524 db_prepare(&q,
525 "SELECT filename.name, blob.uuid, datetime(event.mtime%s),"
526 " coalesce(euser,user), coalesce(ecomment,comment)"
527 " FROM mlink, filename, blob, event"
528 " WHERE mlink.fid=%d"
529 " AND filename.fnid=mlink.fnid"
530 " AND event.objid=mlink.mid"
531 " AND blob.rid=mlink.mid"
532 " ORDER BY event.mtime DESC /*sort*/",
533 timeline_utc(), rid);
534 while( db_step(&q)==SQLITE_ROW ){
535 fossil_print("file: %s\n", db_column_text(&q,0));
536 fossil_print(" part of [%.10s] by %s on %s\n",
537 db_column_text(&q, 1),
538 db_column_text(&q, 3),
539 db_column_text(&q, 2));
540 fossil_print(" ");
541 comment_print(db_column_text(&q,4), 12, 78);
542 }
543 db_finalize(&q);
544
545 /* Check to see if this object is used as an attachment */
546 db_prepare(&q,
547 "SELECT attachment.filename,"
548 " attachment.comment,"
549 " attachment.user,"
550 " datetime(attachment.mtime%s),"
551 " attachment.target,"
552 " CASE WHEN EXISTS(SELECT 1 FROM tag WHERE tagname=('tkt-'||target))"
553 " THEN 'ticket'"
554 " WHEN EXISTS(SELECT 1 FROM tag WHERE tagname=('wiki-'||target))"
555 " THEN 'wiki' END,"
556 " attachment.attachid,"
557 " (SELECT uuid FROM blob WHERE rid=attachid)"
558 " FROM attachment JOIN blob ON attachment.src=blob.uuid"
559 " WHERE blob.rid=%d",
560 timeline_utc(), rid
561 );
562 while( db_step(&q)==SQLITE_ROW ){
563 fossil_print("attachment: %s\n", db_column_text(&q,0));
564 fossil_print(" attached to %s %s\n",
565 db_column_text(&q,5), db_column_text(&q,4));
566 if( verboseFlag ){
567 fossil_print(" via %s (%d)\n",
568 db_column_text(&q,7), db_column_int(&q,6));
569 }else{
570 fossil_print(" via %s\n",
571 db_column_text(&q,7));
572 }
573 fossil_print(" by user %s on %s\n",
574 db_column_text(&q,2), db_column_text(&q,3));
575 fossil_print(" ");
576 comment_print(db_column_text(&q,1), 12, 78);
577 }
578 db_finalize(&q);
579 }
580
581 /*
582 ** COMMAND: whatis*
583 ** Usage: %fossil whatis NAME
584 **
@@ -452,78 +594,41 @@
594 verboseFlag = find_option("verbose","v",0)!=0;
595 if( g.argc!=3 ) usage("whatis NAME");
596 zName = g.argv[2];
597 rid = symbolic_name_to_rid(zName, 0);
598 if( rid<0 ){
599 Stmt q;
600 int cnt = 0;
601 fossil_print("Ambiguous artifact name prefix: %s\n", zName);
602 db_prepare(&q,
603 "SELECT rid FROM blob WHERE uuid>=lower(%Q) AND uuid<(lower(%Q)||'z')",
604 zName, zName
605 );
606 while( db_step(&q)==SQLITE_ROW ){
607 if( cnt++ ) fossil_print("%.79c\n", '-');
608 whatis_rid(db_column_int(&q, 0), verboseFlag);
609 }
610 db_finalize(&q);
611 }else if( rid==0 ){
612 fossil_print("Unknown artifact: %s\n", zName);
613 }else{
614 whatis_rid(rid, verboseFlag);
615 }
616 }
617
618 /*
619 ** COMMAND: test-whatis-all
620 ** Usage: %fossil test-whatis-all
621 **
622 ** Show "whatis" information about every artifact in the repository
623 */
624 void test_whatis_all_cmd(void){
625 Stmt q;
626 int cnt = 0;
627 db_find_and_open_repository(0,0);
628 db_prepare(&q, "SELECT rid FROM blob ORDER BY rid");
629 while( db_step(&q)==SQLITE_ROW ){
630 if( cnt++ ) fossil_print("%.79c\n", '-');
631 whatis_rid(db_column_int(&q,0), 1);
632 }
633 db_finalize(&q);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
634 }
635
+1 -2
--- src/popen.c
+++ src/popen.c
@@ -204,19 +204,18 @@
204204
#endif
205205
}
206206
207207
/*
208208
** Close the connection to a child process previously created using
209
-** popen2(). Kill off the child process, then close the pipes.
209
+** popen2().
210210
*/
211211
void pclose2(int fdIn, FILE *pOut, int childPid){
212212
#ifdef _WIN32
213213
/* Not implemented, yet */
214214
close(fdIn);
215215
fclose(pOut);
216216
#else
217217
close(fdIn);
218218
fclose(pOut);
219
- kill(childPid, SIGINT);
220219
while( waitpid(0, 0, WNOHANG)>0 ) {}
221220
#endif
222221
}
223222
--- src/popen.c
+++ src/popen.c
@@ -204,19 +204,18 @@
204 #endif
205 }
206
207 /*
208 ** Close the connection to a child process previously created using
209 ** popen2(). Kill off the child process, then close the pipes.
210 */
211 void pclose2(int fdIn, FILE *pOut, int childPid){
212 #ifdef _WIN32
213 /* Not implemented, yet */
214 close(fdIn);
215 fclose(pOut);
216 #else
217 close(fdIn);
218 fclose(pOut);
219 kill(childPid, SIGINT);
220 while( waitpid(0, 0, WNOHANG)>0 ) {}
221 #endif
222 }
223
--- src/popen.c
+++ src/popen.c
@@ -204,19 +204,18 @@
204 #endif
205 }
206
207 /*
208 ** Close the connection to a child process previously created using
209 ** popen2().
210 */
211 void pclose2(int fdIn, FILE *pOut, int childPid){
212 #ifdef _WIN32
213 /* Not implemented, yet */
214 close(fdIn);
215 fclose(pOut);
216 #else
217 close(fdIn);
218 fclose(pOut);
 
219 while( waitpid(0, 0, WNOHANG)>0 ) {}
220 #endif
221 }
222
+7 -1
--- src/rebuild.c
+++ src/rebuild.c
@@ -858,11 +858,17 @@
858858
continue;
859859
}
860860
zUtf8Name = fossil_filename_to_utf8(pEntry->d_name);
861861
zSubpath = mprintf("%s/%s", zPath, zUtf8Name);
862862
fossil_filename_free(zUtf8Name);
863
- 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
+ {
864870
recon_read_dir(zSubpath);
865871
}else{
866872
blob_init(&path, 0, 0);
867873
blob_appendf(&path, "%s", zSubpath);
868874
if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){
869875
--- src/rebuild.c
+++ src/rebuild.c
@@ -858,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 if( file_isdir(zSubpath)==1 ){
 
 
 
 
 
 
864 recon_read_dir(zSubpath);
865 }else{
866 blob_init(&path, 0, 0);
867 blob_appendf(&path, "%s", zSubpath);
868 if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){
869
--- src/rebuild.c
+++ src/rebuild.c
@@ -858,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
-13
--- src/report.c
+++ src/report.c
@@ -612,23 +612,10 @@
612612
@ priority AS 'Pri',
613613
@ title AS 'Title',
614614
@ description AS '_Description', -- When the column name begins with '_'
615615
@ remarks AS '_Remarks' -- content is rendered as wiki
616616
@ FROM ticket
617
- @ </pre></blockquote>
618
- @
619
- @ <p>Or, to see part of the description on the same row, use the
620
- @ <b>wiki()</b> function with some string manipulation. Using the
621
- @ <b>tkt()</b> function on the ticket number will also generate a linked
622
- @ field, but without the extra <i>edit</i> column:
623
- @ </p>
624
- @ <blockquote><pre>
625
- @ SELECT
626
- @ tkt(tn) AS '',
627
- @ title AS 'Title',
628
- @ wiki(substr(description,0,80)) AS 'Description'
629
- @ FROM ticket
630617
@ </pre></blockquote>
631618
@
632619
}
633620
634621
/*
635622
--- src/report.c
+++ src/report.c
@@ -612,23 +612,10 @@
612 @ priority AS 'Pri',
613 @ title AS 'Title',
614 @ description AS '_Description', -- When the column name begins with '_'
615 @ remarks AS '_Remarks' -- content is rendered as wiki
616 @ FROM ticket
617 @ </pre></blockquote>
618 @
619 @ <p>Or, to see part of the description on the same row, use the
620 @ <b>wiki()</b> function with some string manipulation. Using the
621 @ <b>tkt()</b> function on the ticket number will also generate a linked
622 @ field, but without the extra <i>edit</i> column:
623 @ </p>
624 @ <blockquote><pre>
625 @ SELECT
626 @ tkt(tn) AS '',
627 @ title AS 'Title',
628 @ wiki(substr(description,0,80)) AS 'Description'
629 @ FROM ticket
630 @ </pre></blockquote>
631 @
632 }
633
634 /*
635
--- src/report.c
+++ src/report.c
@@ -612,23 +612,10 @@
612 @ priority AS 'Pri',
613 @ title AS 'Title',
614 @ description AS '_Description', -- When the column name begins with '_'
615 @ remarks AS '_Remarks' -- content is rendered as wiki
616 @ FROM ticket
 
 
 
 
 
 
 
 
 
 
 
 
 
617 @ </pre></blockquote>
618 @
619 }
620
621 /*
622
+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
+13 -1
--- 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
984996
--- 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
984
--- 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
996
+47 -16
--- 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 */
@@ -1189,11 +1193,12 @@
11891193
const char *z; /* Used to check if this is an EXPLAIN */
11901194
int *abYield = 0; /* True if op is an OP_Yield */
11911195
int nAlloc = 0; /* Allocated size of p->aiIndent[], abYield */
11921196
int iOp; /* Index of operation in p->aiIndent[] */
11931197
1194
- const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext", 0 };
1198
+ const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext",
1199
+ "NextIfOpen", "PrevIfOpen", 0 };
11951200
const char *azYield[] = { "Yield", "SeekLt", "SeekGt", "RowSetRead", "Rewind", 0 };
11961201
const char *azGoto[] = { "Goto", 0 };
11971202
11981203
/* Try to figure out if this is really an EXPLAIN statement. If this
11991204
** cannot be verified, return early. */
@@ -1226,11 +1231,13 @@
12261231
p->nIndent = iOp+1;
12271232
12281233
if( str_in_array(zOp, azNext) ){
12291234
for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2;
12301235
}
1231
- if( str_in_array(zOp, azGoto) && p2op<p->nIndent && abYield[p2op] ){
1236
+ if( str_in_array(zOp, azGoto) && p2op<p->nIndent
1237
+ && (abYield[p2op] || sqlite3_column_int(pSql, 2))
1238
+ ){
12321239
for(i=p2op+1; i<iOp; i++) p->aiIndent[i] += 2;
12331240
}
12341241
}
12351242
12361243
p->iIndent = 0;
@@ -1297,10 +1304,27 @@
12971304
/* echo the sql statement if echo on */
12981305
if( pArg && pArg->echoOn ){
12991306
const char *zStmtSql = sqlite3_sql(pStmt);
13001307
fprintf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql);
13011308
}
1309
+
1310
+ /* Show the EXPLAIN QUERY PLAN if .eqp is on */
1311
+ if( pArg && pArg->autoEQP ){
1312
+ sqlite3_stmt *pExplain;
1313
+ char *zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", sqlite3_sql(pStmt));
1314
+ rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
1315
+ if( rc==SQLITE_OK ){
1316
+ while( sqlite3_step(pExplain)==SQLITE_ROW ){
1317
+ fprintf(pArg->out,"--EQP-- %d,", sqlite3_column_int(pExplain, 0));
1318
+ fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 1));
1319
+ fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 2));
1320
+ fprintf(pArg->out,"%s\n", sqlite3_column_text(pExplain, 3));
1321
+ }
1322
+ }
1323
+ sqlite3_finalize(pExplain);
1324
+ sqlite3_free(zEQP);
1325
+ }
13021326
13031327
/* Output TESTCTRL_EXPLAIN text of requested */
13041328
if( pArg && pArg->mode==MODE_Explain ){
13051329
const char *zExplain = 0;
13061330
sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain);
@@ -1891,11 +1915,11 @@
18911915
csv_append_char(p, c);
18921916
c = fgetc(p->in);
18931917
}
18941918
if( c=='\n' ){
18951919
p->nLine++;
1896
- if( p->n>1 && p->z[p->n-1]=='\r' ) p->n--;
1920
+ if( p->n>0 && p->z[p->n-1]=='\r' ) p->n--;
18971921
}
18981922
p->cTerm = c;
18991923
}
19001924
if( p->z ) p->z[p->n] = 0;
19011925
return p->z;
@@ -2296,10 +2320,14 @@
22962320
}else
22972321
22982322
if( c=='e' && strncmp(azArg[0], "echo", n)==0 && nArg>1 && nArg<3 ){
22992323
p->echoOn = booleanValue(azArg[1]);
23002324
}else
2325
+
2326
+ if( c=='e' && strncmp(azArg[0], "eqp", n)==0 && nArg>1 && nArg<3 ){
2327
+ p->autoEQP = booleanValue(azArg[1]);
2328
+ }else
23012329
23022330
if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){
23032331
if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc);
23042332
rc = 2;
23052333
}else
@@ -2869,10 +2897,11 @@
28692897
}else
28702898
28712899
if( c=='s' && strncmp(azArg[0], "show", n)==0 && nArg==1 ){
28722900
int i;
28732901
fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off");
2902
+ fprintf(p->out,"%9.9s: %s\n","eqp", p->autoEQP ? "on" : "off");
28742903
fprintf(p->out,"%9.9s: %s\n","explain", p->explainPrev.valid ? "on" :"off");
28752904
fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off");
28762905
fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]);
28772906
fprintf(p->out,"%9.9s: ", "nullvalue");
28782907
output_c_string(p->out, p->nullvalue);
@@ -3546,15 +3575,17 @@
35463575
char *zFirstCmd = 0;
35473576
int i;
35483577
int rc = 0;
35493578
int warnInmemoryDb = 0;
35503579
3551
- if( sqlite3_libversion_number()<3008003 ){
3552
- fprintf(stderr, "Unsuitable SQLite version %s, must be at least 3.8.3",
3553
- sqlite3_libversion());
3580
+#if USE_SYSTEM_SQLITE+0!=1
3581
+ if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
3582
+ fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
3583
+ sqlite3_sourceid(), SQLITE_SOURCE_ID);
35543584
exit(1);
35553585
}
3586
+#endif
35563587
Argv0 = argv[0];
35573588
main_init(&data);
35583589
stdin_is_interactive = isatty(0);
35593590
35603591
/* Make sure we have a valid signal handler early, before anything
@@ -3644,17 +3675,15 @@
36443675
warnInmemoryDb = argc==1;
36453676
#else
36463677
fprintf(stderr,"%s: Error: no database filename specified\n", Argv0);
36473678
return 1;
36483679
#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 *****/
3680
+#ifdef SQLITE_SHELL_DBNAME_PROC
3681
+ { extern void SQLITE_SHELL_DBNAME_PROC(const char**);
3682
+ SQLITE_SHELL_DBNAME_PROC(&data.zDbFilename);
3683
+ warnInmemoryDb = 0; }
3684
+#endif
36563685
}
36573686
data.out = stdout;
36583687
36593688
/* Go ahead and open the database file if it already exists. If the
36603689
** file does not exist, delay opening it. This prevents empty database
@@ -3706,10 +3735,12 @@
37063735
data.showHeader = 1;
37073736
}else if( strcmp(z,"-noheader")==0 ){
37083737
data.showHeader = 0;
37093738
}else if( strcmp(z,"-echo")==0 ){
37103739
data.echoOn = 1;
3740
+ }else if( strcmp(z,"-eqp")==0 ){
3741
+ data.autoEQP = 1;
37113742
}else if( strcmp(z,"-stats")==0 ){
37123743
data.statsOn = 1;
37133744
}else if( strcmp(z,"-bail")==0 ){
37143745
bail_on_error = 1;
37153746
}else if( strcmp(z,"-version")==0 ){
@@ -3788,12 +3819,12 @@
37883819
"Enter \".help\" for usage hints.\n",
37893820
sqlite3_libversion(), sqlite3_sourceid()
37903821
);
37913822
if( warnInmemoryDb ){
37923823
printf("Connected to a ");
3793
- printBold("transient in-memory database.");
3794
- printf("\nUse \".open FILENAME\" to reopen on a "
3824
+ printBold("transient in-memory database");
3825
+ printf(".\nUse \".open FILENAME\" to reopen on a "
37953826
"persistent database.\n");
37963827
}
37973828
zHome = find_home_dir();
37983829
if( zHome ){
37993830
nHistory = strlen30(zHome) + 20;
38003831
--- 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 */
@@ -1189,11 +1193,12 @@
1189 const char *z; /* Used to check if this is an EXPLAIN */
1190 int *abYield = 0; /* True if op is an OP_Yield */
1191 int nAlloc = 0; /* Allocated size of p->aiIndent[], abYield */
1192 int iOp; /* Index of operation in p->aiIndent[] */
1193
1194 const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext", 0 };
 
1195 const char *azYield[] = { "Yield", "SeekLt", "SeekGt", "RowSetRead", "Rewind", 0 };
1196 const char *azGoto[] = { "Goto", 0 };
1197
1198 /* Try to figure out if this is really an EXPLAIN statement. If this
1199 ** cannot be verified, return early. */
@@ -1226,11 +1231,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 +1304,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 +1915,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 +2320,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 +2897,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 +3575,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 +3675,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 +3735,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 +3819,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 */
@@ -1189,11 +1193,12 @@
1193 const char *z; /* Used to check if this is an EXPLAIN */
1194 int *abYield = 0; /* True if op is an OP_Yield */
1195 int nAlloc = 0; /* Allocated size of p->aiIndent[], abYield */
1196 int iOp; /* Index of operation in p->aiIndent[] */
1197
1198 const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext",
1199 "NextIfOpen", "PrevIfOpen", 0 };
1200 const char *azYield[] = { "Yield", "SeekLt", "SeekGt", "RowSetRead", "Rewind", 0 };
1201 const char *azGoto[] = { "Goto", 0 };
1202
1203 /* Try to figure out if this is really an EXPLAIN statement. If this
1204 ** cannot be verified, return early. */
@@ -1226,11 +1231,13 @@
1231 p->nIndent = iOp+1;
1232
1233 if( str_in_array(zOp, azNext) ){
1234 for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2;
1235 }
1236 if( str_in_array(zOp, azGoto) && p2op<p->nIndent
1237 && (abYield[p2op] || sqlite3_column_int(pSql, 2))
1238 ){
1239 for(i=p2op+1; i<iOp; i++) p->aiIndent[i] += 2;
1240 }
1241 }
1242
1243 p->iIndent = 0;
@@ -1297,10 +1304,27 @@
1304 /* echo the sql statement if echo on */
1305 if( pArg && pArg->echoOn ){
1306 const char *zStmtSql = sqlite3_sql(pStmt);
1307 fprintf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql);
1308 }
1309
1310 /* Show the EXPLAIN QUERY PLAN if .eqp is on */
1311 if( pArg && pArg->autoEQP ){
1312 sqlite3_stmt *pExplain;
1313 char *zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", sqlite3_sql(pStmt));
1314 rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
1315 if( rc==SQLITE_OK ){
1316 while( sqlite3_step(pExplain)==SQLITE_ROW ){
1317 fprintf(pArg->out,"--EQP-- %d,", sqlite3_column_int(pExplain, 0));
1318 fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 1));
1319 fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 2));
1320 fprintf(pArg->out,"%s\n", sqlite3_column_text(pExplain, 3));
1321 }
1322 }
1323 sqlite3_finalize(pExplain);
1324 sqlite3_free(zEQP);
1325 }
1326
1327 /* Output TESTCTRL_EXPLAIN text of requested */
1328 if( pArg && pArg->mode==MODE_Explain ){
1329 const char *zExplain = 0;
1330 sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain);
@@ -1891,11 +1915,11 @@
1915 csv_append_char(p, c);
1916 c = fgetc(p->in);
1917 }
1918 if( c=='\n' ){
1919 p->nLine++;
1920 if( p->n>0 && p->z[p->n-1]=='\r' ) p->n--;
1921 }
1922 p->cTerm = c;
1923 }
1924 if( p->z ) p->z[p->n] = 0;
1925 return p->z;
@@ -2296,10 +2320,14 @@
2320 }else
2321
2322 if( c=='e' && strncmp(azArg[0], "echo", n)==0 && nArg>1 && nArg<3 ){
2323 p->echoOn = booleanValue(azArg[1]);
2324 }else
2325
2326 if( c=='e' && strncmp(azArg[0], "eqp", n)==0 && nArg>1 && nArg<3 ){
2327 p->autoEQP = booleanValue(azArg[1]);
2328 }else
2329
2330 if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){
2331 if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc);
2332 rc = 2;
2333 }else
@@ -2869,10 +2897,11 @@
2897 }else
2898
2899 if( c=='s' && strncmp(azArg[0], "show", n)==0 && nArg==1 ){
2900 int i;
2901 fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off");
2902 fprintf(p->out,"%9.9s: %s\n","eqp", p->autoEQP ? "on" : "off");
2903 fprintf(p->out,"%9.9s: %s\n","explain", p->explainPrev.valid ? "on" :"off");
2904 fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off");
2905 fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]);
2906 fprintf(p->out,"%9.9s: ", "nullvalue");
2907 output_c_string(p->out, p->nullvalue);
@@ -3546,15 +3575,17 @@
3575 char *zFirstCmd = 0;
3576 int i;
3577 int rc = 0;
3578 int warnInmemoryDb = 0;
3579
3580 #if USE_SYSTEM_SQLITE+0!=1
3581 if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
3582 fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
3583 sqlite3_sourceid(), SQLITE_SOURCE_ID);
3584 exit(1);
3585 }
3586 #endif
3587 Argv0 = argv[0];
3588 main_init(&data);
3589 stdin_is_interactive = isatty(0);
3590
3591 /* Make sure we have a valid signal handler early, before anything
@@ -3644,17 +3675,15 @@
3675 warnInmemoryDb = argc==1;
3676 #else
3677 fprintf(stderr,"%s: Error: no database filename specified\n", Argv0);
3678 return 1;
3679 #endif
3680 #ifdef SQLITE_SHELL_DBNAME_PROC
3681 { extern void SQLITE_SHELL_DBNAME_PROC(const char**);
3682 SQLITE_SHELL_DBNAME_PROC(&data.zDbFilename);
3683 warnInmemoryDb = 0; }
3684 #endif
 
 
3685 }
3686 data.out = stdout;
3687
3688 /* Go ahead and open the database file if it already exists. If the
3689 ** file does not exist, delay opening it. This prevents empty database
@@ -3706,10 +3735,12 @@
3735 data.showHeader = 1;
3736 }else if( strcmp(z,"-noheader")==0 ){
3737 data.showHeader = 0;
3738 }else if( strcmp(z,"-echo")==0 ){
3739 data.echoOn = 1;
3740 }else if( strcmp(z,"-eqp")==0 ){
3741 data.autoEQP = 1;
3742 }else if( strcmp(z,"-stats")==0 ){
3743 data.statsOn = 1;
3744 }else if( strcmp(z,"-bail")==0 ){
3745 bail_on_error = 1;
3746 }else if( strcmp(z,"-version")==0 ){
@@ -3788,12 +3819,12 @@
3819 "Enter \".help\" for usage hints.\n",
3820 sqlite3_libversion(), sqlite3_sourceid()
3821 );
3822 if( warnInmemoryDb ){
3823 printf("Connected to a ");
3824 printBold("transient in-memory database");
3825 printf(".\nUse \".open FILENAME\" to reopen on a "
3826 "persistent database.\n");
3827 }
3828 zHome = find_home_dir();
3829 if( zHome ){
3830 nHistory = strlen30(zHome) + 20;
3831
+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
- /* 129 */ "IfNeg" OpHelp("if r[P1]<0 goto P2"),
23321
- /* 130 */ "IfZero" OpHelp("r[P1]+=P3, if r[P1]==0 goto P2"),
23322
- /* 131 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
23323
- /* 132 */ "IncrVacuum" OpHelp(""),
23417
+ /* 98 */ "RowKey" OpHelp("r[P2]=key"),
23418
+ /* 99 */ "RowData" OpHelp("r[P2]=data"),
23419
+ /* 100 */ "Rowid" OpHelp("r[P2]=rowid"),
23420
+ /* 101 */ "NullRow" OpHelp(""),
23421
+ /* 102 */ "Last" OpHelp(""),
23422
+ /* 103 */ "SorterSort" OpHelp(""),
23423
+ /* 104 */ "Sort" OpHelp(""),
23424
+ /* 105 */ "Rewind" OpHelp(""),
23425
+ /* 106 */ "SorterInsert" OpHelp(""),
23426
+ /* 107 */ "IdxInsert" OpHelp("key=r[P2]"),
23427
+ /* 108 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
23428
+ /* 109 */ "IdxRowid" OpHelp("r[P2]=rowid"),
23429
+ /* 110 */ "IdxLE" OpHelp("key=r[P3@P4]"),
23430
+ /* 111 */ "IdxGT" OpHelp("key=r[P3@P4]"),
23431
+ /* 112 */ "IdxLT" OpHelp("key=r[P3@P4]"),
23432
+ /* 113 */ "IdxGE" OpHelp("key=r[P3@P4]"),
23433
+ /* 114 */ "Destroy" OpHelp(""),
23434
+ /* 115 */ "Clear" OpHelp(""),
23435
+ /* 116 */ "CreateIndex" OpHelp("r[P2]=root iDb=P1"),
23436
+ /* 117 */ "CreateTable" OpHelp("r[P2]=root iDb=P1"),
23437
+ /* 118 */ "ParseSchema" OpHelp(""),
23438
+ /* 119 */ "LoadAnalysis" OpHelp(""),
23439
+ /* 120 */ "DropTable" OpHelp(""),
23440
+ /* 121 */ "DropIndex" OpHelp(""),
23441