Fossil SCM
merge trunk
Commit
d88d1bc0f69b4bbaaba5f29968605a79dc3090e7
Parent
9cc1c9d6904103f…
78 files changed
+2
-2
+12
-12
+1
-1
+11
-11
+30
+18
-1
+2
-2
+7
-38
+1
-2
+11
-5
+1
-2
+8
-15
+3
-3
+51
+70
-7
+77
-60
+107
-58
+94
-32
+10
-10
+68
-5
+92
-9
+117
-91
+1
-1
+3
-3
+1
+14
+6
-3
+14
-2
+59
-22
+14
+7
-2
+1
-1
+9
-9
+27
-6
+45
-15
+7
-7
+2505
-1860
+2505
-1860
+5
-4
+9
-4
+1
+8
-3
+5
+1
-1
+1
+1
-1
+24
-24
+31
-31
+11
-13
+19
-13
+23
-3
+12
-12
+85
-56
+2
-1
+6
-5
+5
+5
+1
+1
+3
-28
+3
-28
+59
-55
+59
-55
+48
+2
-2
+2
-2
+1
-1
+1
-1
+1
-1
+11
-5
+16
-1
+18
-3
+66
-20
+1
+33
-24
+21
-21
+1
-1
+67
~
BUILD.txt
~
COPYRIGHT-BSD2.txt
~
Makefile.Cygwin.in
~
auto.def
~
src/add.c
~
src/allrepo.c
~
src/attach.c
~
src/blob.c
~
src/branch.c
~
src/browse.c
~
src/captcha.c
~
src/checkin.c
~
src/checkout.c
~
src/clone.c
~
src/config.h
~
src/db.c
~
src/diff.c
~
src/diffcmd.c
~
src/event.c
~
src/file.c
~
src/http.c
~
src/info.c
~
src/json.c
~
src/json_timeline.c
~
src/loadctrl.c
~
src/login.c
~
src/main.c
~
src/main.mk
~
src/makemake.tcl
~
src/mkversion.c
~
src/rebuild.c
~
src/report.c
~
src/schema.c
~
src/setup.c
~
src/shell.c
~
src/shun.c
~
src/sqlite3.c
~
src/sqlite3.c
~
src/sqlite3.h
~
src/stash.c
~
src/stat.c
~
src/style.c
~
src/sync.c
~
src/tag.c
~
src/tar.c
~
src/th.h
~
src/tkt.c
~
src/tktsetup.c
~
src/update.c
~
src/utf8.c
~
src/vfile.c
~
src/wiki.c
~
src/wikiformat.c
~
src/xfer.c
~
src/zip.c
~
test/file1.test
~
test/file1.test
~
test/merge5.test
~
test/merge5.test
~
test/merge_renames.test
~
test/merge_renames.test
~
test/revert.test
~
test/revert.test
~
test/tester.tcl
~
test/th1.test
~
test/th1.test
~
test/utf16be.txt
~
test/utf16le.txt
~
win/Makefile.PellesCGMake
~
win/Makefile.dmc
~
win/Makefile.mingw
~
win/Makefile.mingw.mistachkin
~
win/Makefile.msc
~
win/include/dirent.h
~
www/changes.wiki
~
www/fileformat.wiki
~
www/index.wiki
~
www/server.wiki
+2
-2
| --- BUILD.txt | ||
| +++ BUILD.txt | ||
| @@ -22,11 +22,11 @@ | ||
| 22 | 22 | |
| 23 | 23 | cd win; nmake /f Makefile.msc |
| 24 | 24 | |
| 25 | 25 | If you have trouble, or you want to do something fancy, just look at |
| 26 | 26 | 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 | |
| 28 | 28 | Makefile.classic to an alternative name such as "GNUMakefile", |
| 29 | 29 | "BSDMakefile", or "makefile" and editing the copy. |
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | BUILDING OUTSIDE THE SOURCE TREE |
| @@ -61,11 +61,11 @@ | ||
| 61 | 61 | Do not edit src/main.mk directly. Update src/makemake.tcl and |
| 62 | 62 | then rerun it. |
| 63 | 63 | |
| 64 | 64 | * The *.h header files are automatically generated using a program |
| 65 | 65 | 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 | |
| 67 | 67 | src/makeheaders.html. |
| 68 | 68 | |
| 69 | 69 | * Most *.c source files are preprocessed using a program called |
| 70 | 70 | "translate". The sources to translate are found in src/translate.c. |
| 71 | 71 | A header comment in src/translate.c explains in detail what it does. |
| 72 | 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 |
| --- 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 @@ | ||
| 1 | 1 | Copyright 2007 D. Richard Hipp. All rights reserved. |
| 2 | 2 | |
| 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 | |
| 5 | 5 | following conditions are met: |
| 6 | 6 | |
| 7 | 7 | 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 | |
| 9 | 9 | following disclaimer. |
| 10 | 10 | |
| 11 | 11 | 2. Redistributions in binary form must reproduce the above |
| 12 | 12 | copyright notice, this list of conditions and the |
| 13 | 13 | following disclaimer in the documentation and/or other |
| 14 | 14 | materials provided with the distribution. |
| 15 | 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 | |
| 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 | 18 | 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 | |
| 20 | 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 | |
| 21 | +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 22 | +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | |
| 23 | 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, | |
| 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 | 26 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 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 | |
| 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 | 30 | as representing official policies, either expressed or implied, of anybody |
| 31 | 31 | else. |
| 32 | 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 |
| --- 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 |
+1
-1
| --- Makefile.Cygwin.in | ||
| +++ Makefile.Cygwin.in | ||
| @@ -36,11 +36,11 @@ | ||
| 36 | 36 | # care about testing the end result, this can be blank. |
| 37 | 37 | # |
| 38 | 38 | TCLSH = tclsh |
| 39 | 39 | |
| 40 | 40 | 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 | |
| 42 | 42 | INSTALLDIR =$(DESTDIR)@prefix@/bin |
| 43 | 43 | USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@ |
| 44 | 44 | FOSSIL_ENABLE_TCL = @FOSSIL_ENABLE_TCL@ |
| 45 | 45 | FOSSIL_ENABLE_TCL_STUBS = @FOSSIL_ENABLE_TCL_STUBS@ |
| 46 | 46 | FOSSIL_ENABLE_TCL_PRIVATE_STUBS = @FOSSIL_ENABLE_TCL_PRIVATE_STUBS@ |
| 47 | 47 |
| --- Makefile.Cygwin.in | |
| +++ Makefile.Cygwin.in | |
| @@ -36,11 +36,11 @@ | |
| 36 | # care about testing the end result, this can be blank. |
| 37 | # |
| 38 | TCLSH = tclsh |
| 39 | |
| 40 | LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@ |
| 41 | TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H |
| 42 | INSTALLDIR =$(DESTDIR)@prefix@/bin |
| 43 | USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@ |
| 44 | FOSSIL_ENABLE_TCL = @FOSSIL_ENABLE_TCL@ |
| 45 | FOSSIL_ENABLE_TCL_STUBS = @FOSSIL_ENABLE_TCL_STUBS@ |
| 46 | FOSSIL_ENABLE_TCL_PRIVATE_STUBS = @FOSSIL_ENABLE_TCL_PRIVATE_STUBS@ |
| 47 |
| --- Makefile.Cygwin.in | |
| +++ Makefile.Cygwin.in | |
| @@ -36,11 +36,11 @@ | |
| 36 | # care about testing the end result, this can be blank. |
| 37 | # |
| 38 | TCLSH = tclsh |
| 39 | |
| 40 | LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@ |
| 41 | TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H -DFOSSIL_OMIT_LOAD_AVERAGE |
| 42 | INSTALLDIR =$(DESTDIR)@prefix@/bin |
| 43 | USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@ |
| 44 | FOSSIL_ENABLE_TCL = @FOSSIL_ENABLE_TCL@ |
| 45 | FOSSIL_ENABLE_TCL_STUBS = @FOSSIL_ENABLE_TCL_STUBS@ |
| 46 | FOSSIL_ENABLE_TCL_PRIVATE_STUBS = @FOSSIL_ENABLE_TCL_PRIVATE_STUBS@ |
| 47 |
M
auto.def
+11
-11
| --- auto.def | ||
| +++ auto.def | ||
| @@ -89,21 +89,10 @@ | ||
| 89 | 89 | if {[opt-bool static]} { |
| 90 | 90 | # XXX: This will not work on all systems. |
| 91 | 91 | define-append EXTRA_LDFLAGS -static |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | -# Check for zlib, using the given location if specified | |
| 95 | -set zlibpath [opt-val with-zlib] | |
| 96 | -if {$zlibpath ne ""} { | |
| 97 | - cc-with [list -cflags "-I$zlibpath -L$zlibpath"] | |
| 98 | - define-append EXTRA_CFLAGS -I$zlibpath | |
| 99 | - define-append EXTRA_LDFLAGS -L$zlibpath | |
| 100 | -} | |
| 101 | -if {![cc-check-includes zlib.h] || ![cc-check-function-in-lib inflateEnd z]} { | |
| 102 | - user-error "zlib not found please install it or specify the location with --with-zlib" | |
| 103 | -} | |
| 104 | - | |
| 105 | 94 | set tclpath [opt-val with-tcl] |
| 106 | 95 | if {$tclpath ne ""} { |
| 107 | 96 | set tclprivatestubs [opt-bool with-tcl-private-stubs] |
| 108 | 97 | # Note parse-tclconfig-sh is in autosetup/local.tcl |
| 109 | 98 | if {$tclpath eq "1"} { |
| @@ -226,10 +215,21 @@ | ||
| 226 | 215 | } |
| 227 | 216 | } else { |
| 228 | 217 | user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support" |
| 229 | 218 | } |
| 230 | 219 | } |
| 220 | + | |
| 221 | +# Check for zlib, using the given location if specified | |
| 222 | +set zlibpath [opt-val with-zlib] | |
| 223 | +if {$zlibpath ne ""} { | |
| 224 | + cc-with [list -cflags "-I$zlibpath -L$zlibpath"] | |
| 225 | + define-append EXTRA_CFLAGS -I$zlibpath | |
| 226 | + define-append EXTRA_LDFLAGS -L$zlibpath | |
| 227 | +} | |
| 228 | +if {![cc-check-includes zlib.h] || ![cc-check-function-in-lib inflateEnd z]} { | |
| 229 | + user-error "zlib not found please install it or specify the location with --with-zlib" | |
| 230 | +} | |
| 231 | 231 | |
| 232 | 232 | if {[opt-bool lineedit]} { |
| 233 | 233 | # Need readline-compatible line editing |
| 234 | 234 | cc-with {-includes stdio.h} { |
| 235 | 235 | if {[cc-check-includes readline/readline.h] && [cc-check-function-in-lib readline readline]} { |
| 236 | 236 |
| --- auto.def | |
| +++ auto.def | |
| @@ -89,21 +89,10 @@ | |
| 89 | if {[opt-bool static]} { |
| 90 | # XXX: This will not work on all systems. |
| 91 | define-append EXTRA_LDFLAGS -static |
| 92 | } |
| 93 | |
| 94 | # Check for zlib, using the given location if specified |
| 95 | set zlibpath [opt-val with-zlib] |
| 96 | if {$zlibpath ne ""} { |
| 97 | cc-with [list -cflags "-I$zlibpath -L$zlibpath"] |
| 98 | define-append EXTRA_CFLAGS -I$zlibpath |
| 99 | define-append EXTRA_LDFLAGS -L$zlibpath |
| 100 | } |
| 101 | if {![cc-check-includes zlib.h] || ![cc-check-function-in-lib inflateEnd z]} { |
| 102 | user-error "zlib not found please install it or specify the location with --with-zlib" |
| 103 | } |
| 104 | |
| 105 | set tclpath [opt-val with-tcl] |
| 106 | if {$tclpath ne ""} { |
| 107 | set tclprivatestubs [opt-bool with-tcl-private-stubs] |
| 108 | # Note parse-tclconfig-sh is in autosetup/local.tcl |
| 109 | if {$tclpath eq "1"} { |
| @@ -226,10 +215,21 @@ | |
| 226 | } |
| 227 | } else { |
| 228 | user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support" |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | if {[opt-bool lineedit]} { |
| 233 | # Need readline-compatible line editing |
| 234 | cc-with {-includes stdio.h} { |
| 235 | if {[cc-check-includes readline/readline.h] && [cc-check-function-in-lib readline readline]} { |
| 236 |
| --- auto.def | |
| +++ auto.def | |
| @@ -89,21 +89,10 @@ | |
| 89 | if {[opt-bool static]} { |
| 90 | # XXX: This will not work on all systems. |
| 91 | define-append EXTRA_LDFLAGS -static |
| 92 | } |
| 93 | |
| 94 | set tclpath [opt-val with-tcl] |
| 95 | if {$tclpath ne ""} { |
| 96 | set tclprivatestubs [opt-bool with-tcl-private-stubs] |
| 97 | # Note parse-tclconfig-sh is in autosetup/local.tcl |
| 98 | if {$tclpath eq "1"} { |
| @@ -226,10 +215,21 @@ | |
| 215 | } |
| 216 | } else { |
| 217 | user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support" |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | # Check for zlib, using the given location if specified |
| 222 | set zlibpath [opt-val with-zlib] |
| 223 | if {$zlibpath ne ""} { |
| 224 | cc-with [list -cflags "-I$zlibpath -L$zlibpath"] |
| 225 | define-append EXTRA_CFLAGS -I$zlibpath |
| 226 | define-append EXTRA_LDFLAGS -L$zlibpath |
| 227 | } |
| 228 | if {![cc-check-includes zlib.h] || ![cc-check-function-in-lib inflateEnd z]} { |
| 229 | user-error "zlib not found please install it or specify the location with --with-zlib" |
| 230 | } |
| 231 | |
| 232 | if {[opt-bool lineedit]} { |
| 233 | # Need readline-compatible line editing |
| 234 | cc-with {-includes stdio.h} { |
| 235 | if {[cc-check-includes readline/readline.h] && [cc-check-function-in-lib readline readline]} { |
| 236 |
+30
| --- src/add.c | ||
| +++ src/add.c | ||
| @@ -221,19 +221,24 @@ | ||
| 221 | 221 | ** The --ignore and --clean options are comma-separate lists of glob patterns |
| 222 | 222 | ** for files to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore |
| 223 | 223 | ** option does not appear on the command line then the "ignore-glob" setting |
| 224 | 224 | ** is used. If the --clean option does not appear on the command line then |
| 225 | 225 | ** the "clean-glob" setting is used. |
| 226 | +** | |
| 227 | +** If files are attempted to be added explicitly on the command line which | |
| 228 | +** match "ignore-glob", a confirmation is asked first. This can be prevented | |
| 229 | +** using the -f|--force option. | |
| 226 | 230 | ** |
| 227 | 231 | ** The --case-sensitive option determines whether or not filenames should |
| 228 | 232 | ** be treated case sensitive or not. If the option is not given, the default |
| 229 | 233 | ** depends on the global setting, or the operating system default, if not set. |
| 230 | 234 | ** |
| 231 | 235 | ** Options: |
| 232 | 236 | ** |
| 233 | 237 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 234 | 238 | ** --dotfiles include files beginning with a dot (".") |
| 239 | +** -f|--force Add files without prompting | |
| 235 | 240 | ** --ignore <CSG> ignore files matching patterns from the |
| 236 | 241 | ** comma separated list of glob patterns. |
| 237 | 242 | ** --clean <CSG> also ignore files matching patterns from |
| 238 | 243 | ** the comma separated list of glob patterns. |
| 239 | 244 | ** |
| @@ -245,13 +250,15 @@ | ||
| 245 | 250 | int nRoot; /* Full path characters in g.zLocalRoot */ |
| 246 | 251 | const char *zCleanFlag; /* The --clean option or clean-glob setting */ |
| 247 | 252 | const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */ |
| 248 | 253 | Glob *pIgnore, *pClean; /* Ignore everything matching the glob patterns */ |
| 249 | 254 | unsigned scanFlags = 0; /* Flags passed to vfile_scan() */ |
| 255 | + int forceFlag; | |
| 250 | 256 | |
| 251 | 257 | zCleanFlag = find_option("clean",0,1); |
| 252 | 258 | zIgnoreFlag = find_option("ignore",0,1); |
| 259 | + forceFlag = find_option("force","f",0)!=0; | |
| 253 | 260 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 254 | 261 | capture_case_sensitive_option(); |
| 255 | 262 | db_must_be_within_tree(); |
| 256 | 263 | if( zCleanFlag==0 ){ |
| 257 | 264 | zCleanFlag = db_get("clean-glob", 0); |
| @@ -287,10 +294,25 @@ | ||
| 287 | 294 | fossil_warning("not found: %s", zName); |
| 288 | 295 | }else if( file_access(zName, R_OK) ){ |
| 289 | 296 | fossil_fatal("cannot open %s", zName); |
| 290 | 297 | }else{ |
| 291 | 298 | char *zTreeName = &zName[nRoot]; |
| 299 | + if( !forceFlag && glob_match(pIgnore, zTreeName) ){ | |
| 300 | + Blob ans; | |
| 301 | + char cReply; | |
| 302 | + char *prompt = mprintf("file \"%s\" matches \"ignore-glob\". " | |
| 303 | + "Add it (a=all/y/N)? ", zTreeName); | |
| 304 | + prompt_user(prompt, &ans); | |
| 305 | + cReply = blob_str(&ans)[0]; | |
| 306 | + blob_reset(&ans); | |
| 307 | + if( cReply=='a' || cReply=='A' ){ | |
| 308 | + forceFlag = 1; | |
| 309 | + }else if( cReply!='y' && cReply!='Y' ){ | |
| 310 | + blob_reset(&fullName); | |
| 311 | + continue; | |
| 312 | + } | |
| 313 | + } | |
| 292 | 314 | db_multi_exec( |
| 293 | 315 | "INSERT OR IGNORE INTO sfile(x) VALUES(%Q)", |
| 294 | 316 | zTreeName |
| 295 | 317 | ); |
| 296 | 318 | } |
| @@ -670,5 +692,13 @@ | ||
| 670 | 692 | mv_one_file(vid, zFrom, zTo); |
| 671 | 693 | } |
| 672 | 694 | db_finalize(&q); |
| 673 | 695 | db_end_transaction(0); |
| 674 | 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 | +} | |
| 675 | 705 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -221,19 +221,24 @@ | |
| 221 | ** The --ignore and --clean options are comma-separate lists of glob patterns |
| 222 | ** for files to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore |
| 223 | ** option does not appear on the command line then the "ignore-glob" setting |
| 224 | ** is used. If the --clean option does not appear on the command line then |
| 225 | ** the "clean-glob" setting is used. |
| 226 | ** |
| 227 | ** The --case-sensitive option determines whether or not filenames should |
| 228 | ** be treated case sensitive or not. If the option is not given, the default |
| 229 | ** depends on the global setting, or the operating system default, if not set. |
| 230 | ** |
| 231 | ** Options: |
| 232 | ** |
| 233 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 234 | ** --dotfiles include files beginning with a dot (".") |
| 235 | ** --ignore <CSG> ignore files matching patterns from the |
| 236 | ** comma separated list of glob patterns. |
| 237 | ** --clean <CSG> also ignore files matching patterns from |
| 238 | ** the comma separated list of glob patterns. |
| 239 | ** |
| @@ -245,13 +250,15 @@ | |
| 245 | int nRoot; /* Full path characters in g.zLocalRoot */ |
| 246 | const char *zCleanFlag; /* The --clean option or clean-glob setting */ |
| 247 | const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */ |
| 248 | Glob *pIgnore, *pClean; /* Ignore everything matching the glob patterns */ |
| 249 | unsigned scanFlags = 0; /* Flags passed to vfile_scan() */ |
| 250 | |
| 251 | zCleanFlag = find_option("clean",0,1); |
| 252 | zIgnoreFlag = find_option("ignore",0,1); |
| 253 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 254 | capture_case_sensitive_option(); |
| 255 | db_must_be_within_tree(); |
| 256 | if( zCleanFlag==0 ){ |
| 257 | zCleanFlag = db_get("clean-glob", 0); |
| @@ -287,10 +294,25 @@ | |
| 287 | fossil_warning("not found: %s", zName); |
| 288 | }else if( file_access(zName, R_OK) ){ |
| 289 | fossil_fatal("cannot open %s", zName); |
| 290 | }else{ |
| 291 | char *zTreeName = &zName[nRoot]; |
| 292 | db_multi_exec( |
| 293 | "INSERT OR IGNORE INTO sfile(x) VALUES(%Q)", |
| 294 | zTreeName |
| 295 | ); |
| 296 | } |
| @@ -670,5 +692,13 @@ | |
| 670 | mv_one_file(vid, zFrom, zTo); |
| 671 | } |
| 672 | db_finalize(&q); |
| 673 | db_end_transaction(0); |
| 674 | } |
| 675 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -221,19 +221,24 @@ | |
| 221 | ** The --ignore and --clean options are comma-separate lists of glob patterns |
| 222 | ** for files to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore |
| 223 | ** option does not appear on the command line then the "ignore-glob" setting |
| 224 | ** is used. If the --clean option does not appear on the command line then |
| 225 | ** the "clean-glob" setting is used. |
| 226 | ** |
| 227 | ** If files are attempted to be added explicitly on the command line which |
| 228 | ** match "ignore-glob", a confirmation is asked first. This can be prevented |
| 229 | ** using the -f|--force option. |
| 230 | ** |
| 231 | ** The --case-sensitive option determines whether or not filenames should |
| 232 | ** be treated case sensitive or not. If the option is not given, the default |
| 233 | ** depends on the global setting, or the operating system default, if not set. |
| 234 | ** |
| 235 | ** Options: |
| 236 | ** |
| 237 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 238 | ** --dotfiles include files beginning with a dot (".") |
| 239 | ** -f|--force Add files without prompting |
| 240 | ** --ignore <CSG> ignore files matching patterns from the |
| 241 | ** comma separated list of glob patterns. |
| 242 | ** --clean <CSG> also ignore files matching patterns from |
| 243 | ** the comma separated list of glob patterns. |
| 244 | ** |
| @@ -245,13 +250,15 @@ | |
| 250 | int nRoot; /* Full path characters in g.zLocalRoot */ |
| 251 | const char *zCleanFlag; /* The --clean option or clean-glob setting */ |
| 252 | const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */ |
| 253 | Glob *pIgnore, *pClean; /* Ignore everything matching the glob patterns */ |
| 254 | unsigned scanFlags = 0; /* Flags passed to vfile_scan() */ |
| 255 | int forceFlag; |
| 256 | |
| 257 | zCleanFlag = find_option("clean",0,1); |
| 258 | zIgnoreFlag = find_option("ignore",0,1); |
| 259 | forceFlag = find_option("force","f",0)!=0; |
| 260 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 261 | capture_case_sensitive_option(); |
| 262 | db_must_be_within_tree(); |
| 263 | if( zCleanFlag==0 ){ |
| 264 | zCleanFlag = db_get("clean-glob", 0); |
| @@ -287,10 +294,25 @@ | |
| 294 | fossil_warning("not found: %s", zName); |
| 295 | }else if( file_access(zName, R_OK) ){ |
| 296 | fossil_fatal("cannot open %s", zName); |
| 297 | }else{ |
| 298 | char *zTreeName = &zName[nRoot]; |
| 299 | if( !forceFlag && glob_match(pIgnore, zTreeName) ){ |
| 300 | Blob ans; |
| 301 | char cReply; |
| 302 | char *prompt = mprintf("file \"%s\" matches \"ignore-glob\". " |
| 303 | "Add it (a=all/y/N)? ", zTreeName); |
| 304 | prompt_user(prompt, &ans); |
| 305 | cReply = blob_str(&ans)[0]; |
| 306 | blob_reset(&ans); |
| 307 | if( cReply=='a' || cReply=='A' ){ |
| 308 | forceFlag = 1; |
| 309 | }else if( cReply!='y' && cReply!='Y' ){ |
| 310 | blob_reset(&fullName); |
| 311 | continue; |
| 312 | } |
| 313 | } |
| 314 | db_multi_exec( |
| 315 | "INSERT OR IGNORE INTO sfile(x) VALUES(%Q)", |
| 316 | zTreeName |
| 317 | ); |
| 318 | } |
| @@ -670,5 +692,13 @@ | |
| 692 | mv_one_file(vid, zFrom, zTo); |
| 693 | } |
| 694 | db_finalize(&q); |
| 695 | db_end_transaction(0); |
| 696 | } |
| 697 | |
| 698 | /* |
| 699 | ** Function for stash_apply to be able to restore a file and indicate |
| 700 | ** newly ADDED state. |
| 701 | */ |
| 702 | int stash_add_files_in_sfile(int vid){ |
| 703 | return add_files_in_sfile(vid); |
| 704 | } |
| 705 |
+18
-1
| --- src/allrepo.c | ||
| +++ src/allrepo.c | ||
| @@ -65,10 +65,16 @@ | ||
| 65 | 65 | }else{ |
| 66 | 66 | blob_appendf(pExtra, " --%s \"\"", zArg); |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 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 | +} | |
| 70 | 76 | |
| 71 | 77 | |
| 72 | 78 | /* |
| 73 | 79 | ** COMMAND: all |
| 74 | 80 | ** |
| @@ -118,10 +124,15 @@ | ||
| 118 | 124 | ** present, are passed along verbatim. The --force and |
| 119 | 125 | ** --randomize options are not supported. |
| 120 | 126 | ** |
| 121 | 127 | ** sync Run a "sync" on all repositories. Only the --verbose |
| 122 | 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. | |
| 123 | 134 | ** |
| 124 | 135 | ** Repositories are automatically added to the set of known repositories |
| 125 | 136 | ** when one of the following commands are run against the repository: |
| 126 | 137 | ** clone, info, pull, push, or sync. Even previously ignored repositories |
| 127 | 138 | ** are added back to the list of repositories by these commands. |
| @@ -155,11 +166,11 @@ | ||
| 155 | 166 | } |
| 156 | 167 | n = strlen(g.argv[2]); |
| 157 | 168 | db_open_config(1); |
| 158 | 169 | blob_zero(&extra); |
| 159 | 170 | 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); | |
| 161 | 172 | if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){ |
| 162 | 173 | zCmd = "list"; |
| 163 | 174 | useCheckouts = find_option("ckout","c",0)!=0; |
| 164 | 175 | }else if( strncmp(zCmd, "clean", n)==0 ){ |
| 165 | 176 | zCmd = "clean --chdir"; |
| @@ -201,10 +212,16 @@ | ||
| 201 | 212 | collect_argument(&extra, "vacuum",0); |
| 202 | 213 | collect_argument(&extra, "deanalyze",0); |
| 203 | 214 | collect_argument(&extra, "analyze",0); |
| 204 | 215 | collect_argument(&extra, "wal",0); |
| 205 | 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); | |
| 206 | 223 | }else if( strncmp(zCmd, "sync", n)==0 ){ |
| 207 | 224 | zCmd = "sync -autourl -R"; |
| 208 | 225 | collect_argument(&extra, "verbose","v"); |
| 209 | 226 | }else if( strncmp(zCmd, "test-integrity", n)==0 ){ |
| 210 | 227 | collect_argument(&extra, "parse", 0); |
| 211 | 228 |
| --- 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 @@ | ||
| 309 | 309 | if( n>0 ){ |
| 310 | 310 | blob_appendf(&manifest, "C %#F\n", n, zComment); |
| 311 | 311 | } |
| 312 | 312 | zDate = date_in_standard_format("now"); |
| 313 | 313 | 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()); | |
| 315 | 315 | md5sum_blob(&manifest, &cksum); |
| 316 | 316 | blob_appendf(&manifest, "Z %b\n", &cksum); |
| 317 | 317 | attach_put(&manifest, rid, needModerator); |
| 318 | 318 | assert( blob_is_reset(&manifest) ); |
| 319 | 319 | db_end_transaction(0); |
| @@ -427,11 +427,11 @@ | ||
| 427 | 427 | zFile += n; |
| 428 | 428 | if( zFile[0]==0 ) zFile = "unknown"; |
| 429 | 429 | blob_appendf(&manifest, "A %F %F\n", zFile, zTarget); |
| 430 | 430 | zDate = date_in_standard_format("now"); |
| 431 | 431 | 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()); | |
| 433 | 433 | md5sum_blob(&manifest, &cksum); |
| 434 | 434 | blob_appendf(&manifest, "Z %b\n", &cksum); |
| 435 | 435 | rid = content_put(&manifest); |
| 436 | 436 | manifest_crosslink(rid, &manifest, MC_NONE); |
| 437 | 437 | db_end_transaction(0); |
| 438 | 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", 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 @@ | ||
| 786 | 786 | return nWrote; |
| 787 | 787 | } |
| 788 | 788 | #endif |
| 789 | 789 | fwrite(blob_buffer(pBlob), 1, nWrote, stdout); |
| 790 | 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); | |
| 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 | + } | |
| 829 | 798 | blob_is_init(pBlob); |
| 830 | 799 | nWrote = fwrite(blob_buffer(pBlob), 1, blob_size(pBlob), out); |
| 831 | 800 | fclose(out); |
| 832 | 801 | if( nWrote!=blob_size(pBlob) ){ |
| 833 | 802 | fossil_fatal_recursive("short write: %d of %d bytes to %s", nWrote, |
| 834 | 803 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -786,48 +786,17 @@ | |
| 786 | return nWrote; |
| 787 | } |
| 788 | #endif |
| 789 | fwrite(blob_buffer(pBlob), 1, nWrote, stdout); |
| 790 | }else{ |
| 791 | int i, nName; |
| 792 | char *zName, zBuf[1000]; |
| 793 | |
| 794 | nName = strlen(zFilename); |
| 795 | if( nName>=sizeof(zBuf) ){ |
| 796 | zName = mprintf("%s", zFilename); |
| 797 | }else{ |
| 798 | zName = zBuf; |
| 799 | memcpy(zName, zFilename, nName+1); |
| 800 | } |
| 801 | nName = file_simplify_name(zName, nName, 0); |
| 802 | for(i=1; i<nName; i++){ |
| 803 | if( zName[i]=='/' ){ |
| 804 | zName[i] = 0; |
| 805 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 806 | /* |
| 807 | ** On Windows, local path looks like: C:/develop/project/file.txt |
| 808 | ** The if stops us from trying to create a directory of a drive letter |
| 809 | ** C: in this example. |
| 810 | */ |
| 811 | if( !(i==2 && zName[1]==':') ){ |
| 812 | #endif |
| 813 | if( file_mkdir(zName, 1) && file_isdir(zName)!=1 ){ |
| 814 | fossil_fatal_recursive("unable to create directory %s", zName); |
| 815 | return 0; |
| 816 | } |
| 817 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 818 | } |
| 819 | #endif |
| 820 | zName[i] = '/'; |
| 821 | } |
| 822 | } |
| 823 | out = fossil_fopen(zName, "wb"); |
| 824 | if( out==0 ){ |
| 825 | fossil_fatal_recursive("unable to open file \"%s\" for writing", zName); |
| 826 | return 0; |
| 827 | } |
| 828 | if( zName!=zBuf ) free(zName); |
| 829 | blob_is_init(pBlob); |
| 830 | nWrote = fwrite(blob_buffer(pBlob), 1, blob_size(pBlob), out); |
| 831 | fclose(out); |
| 832 | if( nWrote!=blob_size(pBlob) ){ |
| 833 | fossil_fatal_recursive("short write: %d of %d bytes to %s", nWrote, |
| 834 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -786,48 +786,17 @@ | |
| 786 | return nWrote; |
| 787 | } |
| 788 | #endif |
| 789 | fwrite(blob_buffer(pBlob), 1, nWrote, stdout); |
| 790 | }else{ |
| 791 | file_mkfolder(zFilename, 1); |
| 792 | out = fossil_fopen(zFilename, "wb"); |
| 793 | if( out==0 ){ |
| 794 | fossil_fatal_recursive("unable to open file \"%s\" for writing", |
| 795 | zFilename); |
| 796 | return 0; |
| 797 | } |
| 798 | blob_is_init(pBlob); |
| 799 | nWrote = fwrite(blob_buffer(pBlob), 1, blob_size(pBlob), out); |
| 800 | fclose(out); |
| 801 | if( nWrote!=blob_size(pBlob) ){ |
| 802 | fossil_fatal_recursive("short write: %d of %d bytes to %s", nWrote, |
| 803 |
+1
-2
| --- src/branch.c | ||
| +++ src/branch.c | ||
| @@ -134,17 +134,16 @@ | ||
| 134 | 134 | const char *zTag = db_column_text(&q, 0); |
| 135 | 135 | blob_appendf(&branch, "T -%F *\n", zTag); |
| 136 | 136 | } |
| 137 | 137 | db_finalize(&q); |
| 138 | 138 | |
| 139 | - blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin); | |
| 139 | + blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : login_name()); | |
| 140 | 140 | md5sum_blob(&branch, &mcksum); |
| 141 | 141 | blob_appendf(&branch, "Z %b\n", &mcksum); |
| 142 | 142 | if( !noSign && clearsign(&branch, &branch) ){ |
| 143 | 143 | Blob ans; |
| 144 | 144 | char cReply; |
| 145 | - blob_zero(&ans); | |
| 146 | 145 | prompt_user("unable to sign manifest. continue (y/N)? ", &ans); |
| 147 | 146 | cReply = blob_str(&ans)[0]; |
| 148 | 147 | if( cReply!='y' && cReply!='Y'){ |
| 149 | 148 | db_end_transaction(1); |
| 150 | 149 | fossil_exit(1); |
| 151 | 150 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -134,17 +134,16 @@ | |
| 134 | const char *zTag = db_column_text(&q, 0); |
| 135 | blob_appendf(&branch, "T -%F *\n", zTag); |
| 136 | } |
| 137 | db_finalize(&q); |
| 138 | |
| 139 | blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin); |
| 140 | md5sum_blob(&branch, &mcksum); |
| 141 | blob_appendf(&branch, "Z %b\n", &mcksum); |
| 142 | if( !noSign && clearsign(&branch, &branch) ){ |
| 143 | Blob ans; |
| 144 | char cReply; |
| 145 | blob_zero(&ans); |
| 146 | prompt_user("unable to sign manifest. continue (y/N)? ", &ans); |
| 147 | cReply = blob_str(&ans)[0]; |
| 148 | if( cReply!='y' && cReply!='Y'){ |
| 149 | db_end_transaction(1); |
| 150 | fossil_exit(1); |
| 151 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -134,17 +134,16 @@ | |
| 134 | const char *zTag = db_column_text(&q, 0); |
| 135 | blob_appendf(&branch, "T -%F *\n", zTag); |
| 136 | } |
| 137 | db_finalize(&q); |
| 138 | |
| 139 | blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : login_name()); |
| 140 | md5sum_blob(&branch, &mcksum); |
| 141 | blob_appendf(&branch, "Z %b\n", &mcksum); |
| 142 | if( !noSign && clearsign(&branch, &branch) ){ |
| 143 | Blob ans; |
| 144 | char cReply; |
| 145 | prompt_user("unable to sign manifest. continue (y/N)? ", &ans); |
| 146 | cReply = blob_str(&ans)[0]; |
| 147 | if( cReply!='y' && cReply!='Y'){ |
| 148 | db_end_transaction(1); |
| 149 | fossil_exit(1); |
| 150 |
+11
-5
| --- src/browse.c | ||
| +++ src/browse.c | ||
| @@ -732,20 +732,22 @@ | ||
| 732 | 732 | |
| 733 | 733 | /* |
| 734 | 734 | ** Look at all file containing in the version "vid". Construct a |
| 735 | 735 | ** temporary table named "fileage" that contains the file-id for each |
| 736 | 736 | ** 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. | |
| 738 | 739 | */ |
| 739 | -int compute_fileage(int vid){ | |
| 740 | +int compute_fileage(int vid, char const * zGlob){ | |
| 740 | 741 | Manifest *pManifest; |
| 741 | 742 | ManifestFile *pFile; |
| 742 | 743 | int nFile = 0; |
| 743 | 744 | double vmtime; |
| 744 | 745 | Stmt ins; |
| 745 | 746 | Stmt q1, q2, q3; |
| 746 | 747 | Stmt upd; |
| 748 | + if(zGlob && !*zGlob) zGlob = NULL; | |
| 747 | 749 | db_multi_exec( |
| 748 | 750 | /*"DROP TABLE IF EXISTS temp.fileage;"*/ |
| 749 | 751 | "CREATE TEMP TABLE fileage(" |
| 750 | 752 | " fid INTEGER," |
| 751 | 753 | " mid INTEGER," |
| @@ -760,10 +762,11 @@ | ||
| 760 | 762 | db_prepare(&ins, |
| 761 | 763 | "INSERT INTO temp.fileage(fid, pathname)" |
| 762 | 764 | " SELECT rid, :path FROM blob WHERE uuid=:uuid" |
| 763 | 765 | ); |
| 764 | 766 | while( (pFile = manifest_file_next(pManifest, 0))!=0 ){ |
| 767 | + if(zGlob && !strglob(zGlob, pFile->zName)) continue; | |
| 765 | 768 | db_bind_text(&ins, ":uuid", pFile->zUuid); |
| 766 | 769 | db_bind_text(&ins, ":path", pFile->zName); |
| 767 | 770 | db_step(&ins); |
| 768 | 771 | db_reset(&ins); |
| 769 | 772 | nFile++; |
| @@ -807,20 +810,22 @@ | ||
| 807 | 810 | |
| 808 | 811 | /* |
| 809 | 812 | ** WEBPAGE: fileage |
| 810 | 813 | ** |
| 811 | 814 | ** 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). | |
| 813 | 818 | */ |
| 814 | 819 | void fileage_page(void){ |
| 815 | 820 | int rid; |
| 816 | 821 | const char *zName; |
| 817 | 822 | char *zBaseTime; |
| 823 | + char const * zGlob; | |
| 818 | 824 | Stmt q; |
| 819 | 825 | double baseTime; |
| 820 | 826 | int lastMid = -1; |
| 821 | - | |
| 822 | 827 | login_check_credentials(); |
| 823 | 828 | if( !g.perm.Read ){ login_needed(); return; } |
| 824 | 829 | zName = P("name"); |
| 825 | 830 | if( zName==0 ) zName = "tip"; |
| 826 | 831 | rid = symbolic_name_to_rid(zName, "ci"); |
| @@ -827,11 +832,12 @@ | ||
| 827 | 832 | if( rid==0 ){ |
| 828 | 833 | fossil_fatal("not a valid check-in: %s", zName); |
| 829 | 834 | } |
| 830 | 835 | style_submenu_element("Tree-View", "Tree-View", "%R/tree?ci=%T", zName); |
| 831 | 836 | style_header("File Ages", zName); |
| 832 | - compute_fileage(rid); | |
| 837 | + zGlob = P("glob"); | |
| 838 | + compute_fileage(rid,zGlob); | |
| 833 | 839 | baseTime = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid); |
| 834 | 840 | zBaseTime = db_text("","SELECT datetime(%.20g%s)", baseTime, timeline_utc()); |
| 835 | 841 | @ <h2>File Ages For Check-in |
| 836 | 842 | @ %z(href("%R/info?name=%T",zName))%h(zName)</a></h2> |
| 837 | 843 | @ |
| 838 | 844 |
| --- 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 @@ | ||
| 482 | 482 | ** are user "nobody") and if the "require-captcha" setting is true. The |
| 483 | 483 | ** "require-captcha" setting is controlled on the Admin/Access page. It |
| 484 | 484 | ** defaults to true. |
| 485 | 485 | */ |
| 486 | 486 | 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); | |
| 489 | 488 | } |
| 490 | 489 | |
| 491 | 490 | /* |
| 492 | 491 | ** If a captcha is required but the correct captcha code is not supplied |
| 493 | 492 | ** in the query parameters, then return false (0). |
| 494 | 493 |
| --- src/captcha.c | |
| +++ src/captcha.c | |
| @@ -482,12 +482,11 @@ | |
| 482 | ** are user "nobody") and if the "require-captcha" setting is true. The |
| 483 | ** "require-captcha" setting is controlled on the Admin/Access page. It |
| 484 | ** defaults to true. |
| 485 | */ |
| 486 | int captcha_needed(void){ |
| 487 | if( g.zLogin!=0 ) return 0; |
| 488 | return db_get_boolean("require-captcha", 1); |
| 489 | } |
| 490 | |
| 491 | /* |
| 492 | ** If a captcha is required but the correct captcha code is not supplied |
| 493 | ** in the query parameters, then return false (0). |
| 494 |
| --- src/captcha.c | |
| +++ src/captcha.c | |
| @@ -482,12 +482,11 @@ | |
| 482 | ** are user "nobody") and if the "require-captcha" setting is true. The |
| 483 | ** "require-captcha" setting is controlled on the Admin/Access page. It |
| 484 | ** defaults to true. |
| 485 | */ |
| 486 | int captcha_needed(void){ |
| 487 | return login_is_nobody() && db_get_boolean("require-captcha", 1); |
| 488 | } |
| 489 | |
| 490 | /* |
| 491 | ** If a captcha is required but the correct captcha code is not supplied |
| 492 | ** in the query parameters, then return false (0). |
| 493 |
+8
-15
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -600,11 +600,10 @@ | ||
| 600 | 600 | if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ |
| 601 | 601 | Blob ans; |
| 602 | 602 | char cReply; |
| 603 | 603 | char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ", |
| 604 | 604 | zName+nRoot); |
| 605 | - blob_zero(&ans); | |
| 606 | 605 | prompt_user(prompt, &ans); |
| 607 | 606 | cReply = blob_str(&ans)[0]; |
| 608 | 607 | if( cReply=='a' || cReply=='A' ){ |
| 609 | 608 | allFileFlag = 1; |
| 610 | 609 | }else if( cReply!='y' && cReply!='Y' ){ |
| @@ -642,11 +641,10 @@ | ||
| 642 | 641 | if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ |
| 643 | 642 | Blob ans; |
| 644 | 643 | char cReply; |
| 645 | 644 | char *prompt = mprintf("Remove empty directory \"%s\" (a=all/y/N)? ", |
| 646 | 645 | zName+nRoot); |
| 647 | - blob_zero(&ans); | |
| 648 | 646 | prompt_user(prompt, &ans); |
| 649 | 647 | cReply = blob_str(&ans)[0]; |
| 650 | 648 | if( cReply=='a' || cReply=='A' ){ |
| 651 | 649 | allDirFlag = 1; |
| 652 | 650 | }else if( cReply!='y' && cReply!='Y' ){ |
| @@ -803,11 +801,11 @@ | ||
| 803 | 801 | blob_append(&prompt, |
| 804 | 802 | "\n" |
| 805 | 803 | "# Enter commit message for this check-in. Lines beginning with # are ignored.\n" |
| 806 | 804 | "#\n", -1 |
| 807 | 805 | ); |
| 808 | - blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin); | |
| 806 | + blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : login_name()); | |
| 809 | 807 | if( p->zBranch && p->zBranch[0] ){ |
| 810 | 808 | blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch); |
| 811 | 809 | }else{ |
| 812 | 810 | char *zTags = info_tags_of_checkin(parent_rid, 1); |
| 813 | 811 | if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags); |
| @@ -965,11 +963,11 @@ | ||
| 965 | 963 | int verifyDate; /* Verify that child is younger */ |
| 966 | 964 | int closeFlag; /* Close the branch being committed */ |
| 967 | 965 | int integrateFlag; /* Close merged-in branches */ |
| 968 | 966 | Blob *pCksum; /* Repository checksum. May be 0 */ |
| 969 | 967 | const char *zDateOvrd; /* Date override. If 0 then use 'now' */ |
| 970 | - const char *zUserOvrd; /* User override. If 0 then use g.zLogin */ | |
| 968 | + const char *zUserOvrd; /* User override. If 0 then use login_name() */ | |
| 971 | 969 | const char *zBranch; /* Branch name. May be 0 */ |
| 972 | 970 | const char *zColor; /* One-time background color. May be 0 */ |
| 973 | 971 | const char *zBrClr; /* Persistent branch color. May be 0 */ |
| 974 | 972 | const char **azTag; /* Tags to apply to this check-in */ |
| 975 | 973 | }; |
| @@ -1191,11 +1189,11 @@ | ||
| 1191 | 1189 | const char *zBrTag = db_column_text(&q, 0); |
| 1192 | 1190 | blob_appendf(pOut, "T -%F *\n", zBrTag); |
| 1193 | 1191 | } |
| 1194 | 1192 | db_finalize(&q); |
| 1195 | 1193 | } |
| 1196 | - blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin); | |
| 1194 | + blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : login_name()); | |
| 1197 | 1195 | md5sum_blob(pOut, &mcksum); |
| 1198 | 1196 | blob_appendf(pOut, "Z %b\n", &mcksum); |
| 1199 | 1197 | if( pnFBcard ) *pnFBcard = nFBcard; |
| 1200 | 1198 | } |
| 1201 | 1199 | |
| @@ -1288,11 +1286,10 @@ | ||
| 1288 | 1286 | } |
| 1289 | 1287 | zWarning = "Unicode"; |
| 1290 | 1288 | zDisable = "\"encoding-glob\" setting"; |
| 1291 | 1289 | } |
| 1292 | 1290 | file_relative_name(zFilename, &fname, 0); |
| 1293 | - blob_zero(&ans); | |
| 1294 | 1291 | zMsg = mprintf( |
| 1295 | 1292 | "%s contains %s. Use --no-warnings or the %s to disable this warning.\n" |
| 1296 | 1293 | "Commit anyhow (a=all/%sy/N)? ", |
| 1297 | 1294 | blob_str(&fname), zWarning, zDisable, zConvert); |
| 1298 | 1295 | prompt_user(zMsg, &ans); |
| @@ -1520,20 +1517,21 @@ | ||
| 1520 | 1517 | forceBaseline = 1; |
| 1521 | 1518 | } |
| 1522 | 1519 | |
| 1523 | 1520 | /* Get the ID of the parent manifest artifact */ |
| 1524 | 1521 | vid = db_lget_int("checkout", 0); |
| 1525 | - if( content_is_private(vid) ){ | |
| 1522 | + if( vid==0 ){ | |
| 1523 | + useCksum = 1; | |
| 1524 | + }else if( content_is_private(vid) ){ | |
| 1526 | 1525 | g.markPrivate = 1; |
| 1527 | 1526 | } |
| 1528 | 1527 | |
| 1529 | 1528 | /* |
| 1530 | 1529 | ** Autosync if autosync is enabled and this is not a private check-in. |
| 1531 | 1530 | */ |
| 1532 | 1531 | if( !g.markPrivate ){ |
| 1533 | 1532 | if( autosync(SYNC_PULL) ){ |
| 1534 | - blob_zero(&ans); | |
| 1535 | 1533 | prompt_user("continue in spite of sync failure (y/N)? ", &ans); |
| 1536 | 1534 | cReply = blob_str(&ans)[0]; |
| 1537 | 1535 | if( cReply!='y' && cReply!='Y' ){ |
| 1538 | 1536 | fossil_exit(1); |
| 1539 | 1537 | } |
| @@ -1542,11 +1540,10 @@ | ||
| 1542 | 1540 | |
| 1543 | 1541 | /* Require confirmation to continue with the check-in if there is |
| 1544 | 1542 | ** clock skew |
| 1545 | 1543 | */ |
| 1546 | 1544 | if( g.clockSkewSeen ){ |
| 1547 | - blob_zero(&ans); | |
| 1548 | 1545 | prompt_user("continue in spite of time skew (y/N)? ", &ans); |
| 1549 | 1546 | cReply = blob_str(&ans)[0]; |
| 1550 | 1547 | if( cReply!='y' && cReply!='Y' ){ |
| 1551 | 1548 | fossil_exit(1); |
| 1552 | 1549 | } |
| @@ -1561,14 +1558,13 @@ | ||
| 1561 | 1558 | ** array is allocated to contain the "id" field from the vfile table |
| 1562 | 1559 | ** for each file to be committed. Or, if aCommitFile is NULL, all files |
| 1563 | 1560 | ** should be committed. |
| 1564 | 1561 | */ |
| 1565 | 1562 | if( select_commit_files() ){ |
| 1566 | - blob_zero(&ans); | |
| 1567 | 1563 | prompt_user("continue (y/N)? ", &ans); |
| 1568 | 1564 | cReply = blob_str(&ans)[0]; |
| 1569 | - if( cReply!='y' && cReply!='Y' ) fossil_exit(1);; | |
| 1565 | + if( cReply!='y' && cReply!='Y' ) fossil_exit(1); | |
| 1570 | 1566 | } |
| 1571 | 1567 | isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2"); |
| 1572 | 1568 | if( g.aCommitFile && isAMerge ){ |
| 1573 | 1569 | fossil_fatal("cannot do a partial commit of a merge"); |
| 1574 | 1570 | } |
| @@ -1662,20 +1658,18 @@ | ||
| 1662 | 1658 | blob_zero(&comment); |
| 1663 | 1659 | }else{ |
| 1664 | 1660 | char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'"); |
| 1665 | 1661 | prepare_commit_comment(&comment, zInit, &sCiInfo, vid); |
| 1666 | 1662 | if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){ |
| 1667 | - blob_zero(&ans); | |
| 1668 | 1663 | prompt_user("unchanged check-in comment. continue (y/N)? ", &ans); |
| 1669 | 1664 | cReply = blob_str(&ans)[0]; |
| 1670 | - if( cReply!='y' && cReply!='Y' ) fossil_exit(1);; | |
| 1665 | + if( cReply!='y' && cReply!='Y' ) fossil_exit(1); | |
| 1671 | 1666 | } |
| 1672 | 1667 | free(zInit); |
| 1673 | 1668 | } |
| 1674 | 1669 | if( blob_size(&comment)==0 ){ |
| 1675 | 1670 | if( !dryRunFlag ){ |
| 1676 | - blob_zero(&ans); | |
| 1677 | 1671 | prompt_user("empty check-in comment. continue (y/N)? ", &ans); |
| 1678 | 1672 | cReply = blob_str(&ans)[0]; |
| 1679 | 1673 | if( cReply!='y' && cReply!='Y' ){ |
| 1680 | 1674 | fossil_exit(1); |
| 1681 | 1675 | } |
| @@ -1804,11 +1798,10 @@ | ||
| 1804 | 1798 | }else if( forceDelta ){ |
| 1805 | 1799 | fossil_fatal("unable to find a baseline-manifest for the delta"); |
| 1806 | 1800 | } |
| 1807 | 1801 | } |
| 1808 | 1802 | if( !noSign && !g.markPrivate && clearsign(&manifest, &manifest) ){ |
| 1809 | - blob_zero(&ans); | |
| 1810 | 1803 | prompt_user("unable to sign manifest. continue (y/N)? ", &ans); |
| 1811 | 1804 | cReply = blob_str(&ans)[0]; |
| 1812 | 1805 | if( cReply!='y' && cReply!='Y' ){ |
| 1813 | 1806 | fossil_exit(1); |
| 1814 | 1807 | } |
| 1815 | 1808 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -600,11 +600,10 @@ | |
| 600 | if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ |
| 601 | Blob ans; |
| 602 | char cReply; |
| 603 | char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ", |
| 604 | zName+nRoot); |
| 605 | blob_zero(&ans); |
| 606 | prompt_user(prompt, &ans); |
| 607 | cReply = blob_str(&ans)[0]; |
| 608 | if( cReply=='a' || cReply=='A' ){ |
| 609 | allFileFlag = 1; |
| 610 | }else if( cReply!='y' && cReply!='Y' ){ |
| @@ -642,11 +641,10 @@ | |
| 642 | if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ |
| 643 | Blob ans; |
| 644 | char cReply; |
| 645 | char *prompt = mprintf("Remove empty directory \"%s\" (a=all/y/N)? ", |
| 646 | zName+nRoot); |
| 647 | blob_zero(&ans); |
| 648 | prompt_user(prompt, &ans); |
| 649 | cReply = blob_str(&ans)[0]; |
| 650 | if( cReply=='a' || cReply=='A' ){ |
| 651 | allDirFlag = 1; |
| 652 | }else if( cReply!='y' && cReply!='Y' ){ |
| @@ -803,11 +801,11 @@ | |
| 803 | blob_append(&prompt, |
| 804 | "\n" |
| 805 | "# Enter commit message for this check-in. Lines beginning with # are ignored.\n" |
| 806 | "#\n", -1 |
| 807 | ); |
| 808 | blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin); |
| 809 | if( p->zBranch && p->zBranch[0] ){ |
| 810 | blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch); |
| 811 | }else{ |
| 812 | char *zTags = info_tags_of_checkin(parent_rid, 1); |
| 813 | if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags); |
| @@ -965,11 +963,11 @@ | |
| 965 | int verifyDate; /* Verify that child is younger */ |
| 966 | int closeFlag; /* Close the branch being committed */ |
| 967 | int integrateFlag; /* Close merged-in branches */ |
| 968 | Blob *pCksum; /* Repository checksum. May be 0 */ |
| 969 | const char *zDateOvrd; /* Date override. If 0 then use 'now' */ |
| 970 | const char *zUserOvrd; /* User override. If 0 then use g.zLogin */ |
| 971 | const char *zBranch; /* Branch name. May be 0 */ |
| 972 | const char *zColor; /* One-time background color. May be 0 */ |
| 973 | const char *zBrClr; /* Persistent branch color. May be 0 */ |
| 974 | const char **azTag; /* Tags to apply to this check-in */ |
| 975 | }; |
| @@ -1191,11 +1189,11 @@ | |
| 1191 | const char *zBrTag = db_column_text(&q, 0); |
| 1192 | blob_appendf(pOut, "T -%F *\n", zBrTag); |
| 1193 | } |
| 1194 | db_finalize(&q); |
| 1195 | } |
| 1196 | blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin); |
| 1197 | md5sum_blob(pOut, &mcksum); |
| 1198 | blob_appendf(pOut, "Z %b\n", &mcksum); |
| 1199 | if( pnFBcard ) *pnFBcard = nFBcard; |
| 1200 | } |
| 1201 | |
| @@ -1288,11 +1286,10 @@ | |
| 1288 | } |
| 1289 | zWarning = "Unicode"; |
| 1290 | zDisable = "\"encoding-glob\" setting"; |
| 1291 | } |
| 1292 | file_relative_name(zFilename, &fname, 0); |
| 1293 | blob_zero(&ans); |
| 1294 | zMsg = mprintf( |
| 1295 | "%s contains %s. Use --no-warnings or the %s to disable this warning.\n" |
| 1296 | "Commit anyhow (a=all/%sy/N)? ", |
| 1297 | blob_str(&fname), zWarning, zDisable, zConvert); |
| 1298 | prompt_user(zMsg, &ans); |
| @@ -1520,20 +1517,21 @@ | |
| 1520 | forceBaseline = 1; |
| 1521 | } |
| 1522 | |
| 1523 | /* Get the ID of the parent manifest artifact */ |
| 1524 | vid = db_lget_int("checkout", 0); |
| 1525 | if( content_is_private(vid) ){ |
| 1526 | g.markPrivate = 1; |
| 1527 | } |
| 1528 | |
| 1529 | /* |
| 1530 | ** Autosync if autosync is enabled and this is not a private check-in. |
| 1531 | */ |
| 1532 | if( !g.markPrivate ){ |
| 1533 | if( autosync(SYNC_PULL) ){ |
| 1534 | blob_zero(&ans); |
| 1535 | prompt_user("continue in spite of sync failure (y/N)? ", &ans); |
| 1536 | cReply = blob_str(&ans)[0]; |
| 1537 | if( cReply!='y' && cReply!='Y' ){ |
| 1538 | fossil_exit(1); |
| 1539 | } |
| @@ -1542,11 +1540,10 @@ | |
| 1542 | |
| 1543 | /* Require confirmation to continue with the check-in if there is |
| 1544 | ** clock skew |
| 1545 | */ |
| 1546 | if( g.clockSkewSeen ){ |
| 1547 | blob_zero(&ans); |
| 1548 | prompt_user("continue in spite of time skew (y/N)? ", &ans); |
| 1549 | cReply = blob_str(&ans)[0]; |
| 1550 | if( cReply!='y' && cReply!='Y' ){ |
| 1551 | fossil_exit(1); |
| 1552 | } |
| @@ -1561,14 +1558,13 @@ | |
| 1561 | ** array is allocated to contain the "id" field from the vfile table |
| 1562 | ** for each file to be committed. Or, if aCommitFile is NULL, all files |
| 1563 | ** should be committed. |
| 1564 | */ |
| 1565 | if( select_commit_files() ){ |
| 1566 | blob_zero(&ans); |
| 1567 | prompt_user("continue (y/N)? ", &ans); |
| 1568 | cReply = blob_str(&ans)[0]; |
| 1569 | if( cReply!='y' && cReply!='Y' ) fossil_exit(1);; |
| 1570 | } |
| 1571 | isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2"); |
| 1572 | if( g.aCommitFile && isAMerge ){ |
| 1573 | fossil_fatal("cannot do a partial commit of a merge"); |
| 1574 | } |
| @@ -1662,20 +1658,18 @@ | |
| 1662 | blob_zero(&comment); |
| 1663 | }else{ |
| 1664 | char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'"); |
| 1665 | prepare_commit_comment(&comment, zInit, &sCiInfo, vid); |
| 1666 | if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){ |
| 1667 | blob_zero(&ans); |
| 1668 | prompt_user("unchanged check-in comment. continue (y/N)? ", &ans); |
| 1669 | cReply = blob_str(&ans)[0]; |
| 1670 | if( cReply!='y' && cReply!='Y' ) fossil_exit(1);; |
| 1671 | } |
| 1672 | free(zInit); |
| 1673 | } |
| 1674 | if( blob_size(&comment)==0 ){ |
| 1675 | if( !dryRunFlag ){ |
| 1676 | blob_zero(&ans); |
| 1677 | prompt_user("empty check-in comment. continue (y/N)? ", &ans); |
| 1678 | cReply = blob_str(&ans)[0]; |
| 1679 | if( cReply!='y' && cReply!='Y' ){ |
| 1680 | fossil_exit(1); |
| 1681 | } |
| @@ -1804,11 +1798,10 @@ | |
| 1804 | }else if( forceDelta ){ |
| 1805 | fossil_fatal("unable to find a baseline-manifest for the delta"); |
| 1806 | } |
| 1807 | } |
| 1808 | if( !noSign && !g.markPrivate && clearsign(&manifest, &manifest) ){ |
| 1809 | blob_zero(&ans); |
| 1810 | prompt_user("unable to sign manifest. continue (y/N)? ", &ans); |
| 1811 | cReply = blob_str(&ans)[0]; |
| 1812 | if( cReply!='y' && cReply!='Y' ){ |
| 1813 | fossil_exit(1); |
| 1814 | } |
| 1815 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -600,11 +600,10 @@ | |
| 600 | if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ |
| 601 | Blob ans; |
| 602 | char cReply; |
| 603 | char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ", |
| 604 | zName+nRoot); |
| 605 | prompt_user(prompt, &ans); |
| 606 | cReply = blob_str(&ans)[0]; |
| 607 | if( cReply=='a' || cReply=='A' ){ |
| 608 | allFileFlag = 1; |
| 609 | }else if( cReply!='y' && cReply!='Y' ){ |
| @@ -642,11 +641,10 @@ | |
| 641 | if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ |
| 642 | Blob ans; |
| 643 | char cReply; |
| 644 | char *prompt = mprintf("Remove empty directory \"%s\" (a=all/y/N)? ", |
| 645 | zName+nRoot); |
| 646 | prompt_user(prompt, &ans); |
| 647 | cReply = blob_str(&ans)[0]; |
| 648 | if( cReply=='a' || cReply=='A' ){ |
| 649 | allDirFlag = 1; |
| 650 | }else if( cReply!='y' && cReply!='Y' ){ |
| @@ -803,11 +801,11 @@ | |
| 801 | blob_append(&prompt, |
| 802 | "\n" |
| 803 | "# Enter commit message for this check-in. Lines beginning with # are ignored.\n" |
| 804 | "#\n", -1 |
| 805 | ); |
| 806 | blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : login_name()); |
| 807 | if( p->zBranch && p->zBranch[0] ){ |
| 808 | blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch); |
| 809 | }else{ |
| 810 | char *zTags = info_tags_of_checkin(parent_rid, 1); |
| 811 | if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags); |
| @@ -965,11 +963,11 @@ | |
| 963 | int verifyDate; /* Verify that child is younger */ |
| 964 | int closeFlag; /* Close the branch being committed */ |
| 965 | int integrateFlag; /* Close merged-in branches */ |
| 966 | Blob *pCksum; /* Repository checksum. May be 0 */ |
| 967 | const char *zDateOvrd; /* Date override. If 0 then use 'now' */ |
| 968 | const char *zUserOvrd; /* User override. If 0 then use login_name() */ |
| 969 | const char *zBranch; /* Branch name. May be 0 */ |
| 970 | const char *zColor; /* One-time background color. May be 0 */ |
| 971 | const char *zBrClr; /* Persistent branch color. May be 0 */ |
| 972 | const char **azTag; /* Tags to apply to this check-in */ |
| 973 | }; |
| @@ -1191,11 +1189,11 @@ | |
| 1189 | const char *zBrTag = db_column_text(&q, 0); |
| 1190 | blob_appendf(pOut, "T -%F *\n", zBrTag); |
| 1191 | } |
| 1192 | db_finalize(&q); |
| 1193 | } |
| 1194 | blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : login_name()); |
| 1195 | md5sum_blob(pOut, &mcksum); |
| 1196 | blob_appendf(pOut, "Z %b\n", &mcksum); |
| 1197 | if( pnFBcard ) *pnFBcard = nFBcard; |
| 1198 | } |
| 1199 | |
| @@ -1288,11 +1286,10 @@ | |
| 1286 | } |
| 1287 | zWarning = "Unicode"; |
| 1288 | zDisable = "\"encoding-glob\" setting"; |
| 1289 | } |
| 1290 | file_relative_name(zFilename, &fname, 0); |
| 1291 | zMsg = mprintf( |
| 1292 | "%s contains %s. Use --no-warnings or the %s to disable this warning.\n" |
| 1293 | "Commit anyhow (a=all/%sy/N)? ", |
| 1294 | blob_str(&fname), zWarning, zDisable, zConvert); |
| 1295 | prompt_user(zMsg, &ans); |
| @@ -1520,20 +1517,21 @@ | |
| 1517 | forceBaseline = 1; |
| 1518 | } |
| 1519 | |
| 1520 | /* Get the ID of the parent manifest artifact */ |
| 1521 | vid = db_lget_int("checkout", 0); |
| 1522 | if( vid==0 ){ |
| 1523 | useCksum = 1; |
| 1524 | }else if( content_is_private(vid) ){ |
| 1525 | g.markPrivate = 1; |
| 1526 | } |
| 1527 | |
| 1528 | /* |
| 1529 | ** Autosync if autosync is enabled and this is not a private check-in. |
| 1530 | */ |
| 1531 | if( !g.markPrivate ){ |
| 1532 | if( autosync(SYNC_PULL) ){ |
| 1533 | prompt_user("continue in spite of sync failure (y/N)? ", &ans); |
| 1534 | cReply = blob_str(&ans)[0]; |
| 1535 | if( cReply!='y' && cReply!='Y' ){ |
| 1536 | fossil_exit(1); |
| 1537 | } |
| @@ -1542,11 +1540,10 @@ | |
| 1540 | |
| 1541 | /* Require confirmation to continue with the check-in if there is |
| 1542 | ** clock skew |
| 1543 | */ |
| 1544 | if( g.clockSkewSeen ){ |
| 1545 | prompt_user("continue in spite of time skew (y/N)? ", &ans); |
| 1546 | cReply = blob_str(&ans)[0]; |
| 1547 | if( cReply!='y' && cReply!='Y' ){ |
| 1548 | fossil_exit(1); |
| 1549 | } |
| @@ -1561,14 +1558,13 @@ | |
| 1558 | ** array is allocated to contain the "id" field from the vfile table |
| 1559 | ** for each file to be committed. Or, if aCommitFile is NULL, all files |
| 1560 | ** should be committed. |
| 1561 | */ |
| 1562 | if( select_commit_files() ){ |
| 1563 | prompt_user("continue (y/N)? ", &ans); |
| 1564 | cReply = blob_str(&ans)[0]; |
| 1565 | if( cReply!='y' && cReply!='Y' ) fossil_exit(1); |
| 1566 | } |
| 1567 | isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2"); |
| 1568 | if( g.aCommitFile && isAMerge ){ |
| 1569 | fossil_fatal("cannot do a partial commit of a merge"); |
| 1570 | } |
| @@ -1662,20 +1658,18 @@ | |
| 1658 | blob_zero(&comment); |
| 1659 | }else{ |
| 1660 | char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'"); |
| 1661 | prepare_commit_comment(&comment, zInit, &sCiInfo, vid); |
| 1662 | if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){ |
| 1663 | prompt_user("unchanged check-in comment. continue (y/N)? ", &ans); |
| 1664 | cReply = blob_str(&ans)[0]; |
| 1665 | if( cReply!='y' && cReply!='Y' ) fossil_exit(1); |
| 1666 | } |
| 1667 | free(zInit); |
| 1668 | } |
| 1669 | if( blob_size(&comment)==0 ){ |
| 1670 | if( !dryRunFlag ){ |
| 1671 | prompt_user("empty check-in comment. continue (y/N)? ", &ans); |
| 1672 | cReply = blob_str(&ans)[0]; |
| 1673 | if( cReply!='y' && cReply!='Y' ){ |
| 1674 | fossil_exit(1); |
| 1675 | } |
| @@ -1804,11 +1798,10 @@ | |
| 1798 | }else if( forceDelta ){ |
| 1799 | fossil_fatal("unable to find a baseline-manifest for the delta"); |
| 1800 | } |
| 1801 | } |
| 1802 | if( !noSign && !g.markPrivate && clearsign(&manifest, &manifest) ){ |
| 1803 | prompt_user("unable to sign manifest. continue (y/N)? ", &ans); |
| 1804 | cReply = blob_str(&ans)[0]; |
| 1805 | if( cReply!='y' && cReply!='Y' ){ |
| 1806 | fossil_exit(1); |
| 1807 | } |
| 1808 |
+3
-3
| --- src/checkout.c | ||
| +++ src/checkout.c | ||
| @@ -157,11 +157,11 @@ | ||
| 157 | 157 | zManFile = mprintf("%smanifest.uuid", g.zLocalRoot); |
| 158 | 158 | file_delete(zManFile); |
| 159 | 159 | free(zManFile); |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | - | |
| 162 | + | |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /* |
| 166 | 166 | ** COMMAND: checkout* |
| 167 | 167 | ** COMMAND: co* |
| @@ -175,11 +175,11 @@ | ||
| 175 | 175 | ** leaves files on disk unchanged, except the manifest and manifest.uuid |
| 176 | 176 | ** files. |
| 177 | 177 | ** |
| 178 | 178 | ** The --latest flag can be used in place of VERSION to checkout the |
| 179 | 179 | ** latest version in the repository. |
| 180 | -** | |
| 180 | +** | |
| 181 | 181 | ** Options: |
| 182 | 182 | ** --force Ignore edited files in the current checkout |
| 183 | 183 | ** --keep Only update the manifest and manifest.uuid files |
| 184 | 184 | ** |
| 185 | 185 | ** See also: update |
| @@ -190,11 +190,11 @@ | ||
| 190 | 190 | int latestFlag; /* Checkout the latest version */ |
| 191 | 191 | char *zVers; /* Version to checkout */ |
| 192 | 192 | int promptFlag; /* True to prompt before overwriting */ |
| 193 | 193 | int vid, prior; |
| 194 | 194 | Blob cksum1, cksum1b, cksum2; |
| 195 | - | |
| 195 | + | |
| 196 | 196 | db_must_be_within_tree(); |
| 197 | 197 | db_begin_transaction(); |
| 198 | 198 | forceFlag = find_option("force","f",0)!=0; |
| 199 | 199 | keepFlag = find_option("keep",0,0)!=0; |
| 200 | 200 | latestFlag = find_option("latest",0,0)!=0; |
| 201 | 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 |
| --- 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 @@ | ||
| 109 | 109 | ** --admin-user|-A USERNAME Make USERNAME the administrator |
| 110 | 110 | ** --once Don't save url. |
| 111 | 111 | ** --private Also clone private branches |
| 112 | 112 | ** --ssl-identity=filename Use the SSL identity if requested by the server |
| 113 | 113 | ** --ssh-command|-c 'command' Use this SSH command |
| 114 | +** --httpauth|-B 'user:pass' Add HTTP Basic Authorization to requests | |
| 114 | 115 | ** |
| 115 | 116 | ** See also: init |
| 116 | 117 | */ |
| 117 | 118 | void clone_cmd(void){ |
| 118 | 119 | char *zPassword; |
| 119 | 120 | const char *zDefaultUser; /* Optional name of the default user */ |
| 121 | + const char *zHttpAuth; /* HTTP Authorization user:pass information */ | |
| 120 | 122 | int nErr = 0; |
| 121 | 123 | int bPrivate = 0; /* Also clone private branches */ |
| 122 | 124 | int urlFlags = URL_PROMPT_PW | URL_REMEMBER; |
| 123 | 125 | |
| 124 | 126 | if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE; |
| 125 | 127 | if( find_option("once",0,0)!=0) urlFlags &= ~URL_REMEMBER; |
| 128 | + zHttpAuth = find_option("httpauth","B",1); | |
| 126 | 129 | zDefaultUser = find_option("admin-user","A",1); |
| 127 | 130 | clone_ssh_find_options(); |
| 128 | 131 | url_proxy_options(); |
| 129 | 132 | if( g.argc < 4 ){ |
| 130 | 133 | usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); |
| @@ -159,10 +162,11 @@ | ||
| 159 | 162 | db_initial_setup(0, 0, zDefaultUser, 0); |
| 160 | 163 | user_select(); |
| 161 | 164 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 162 | 165 | db_set("aux-schema", AUX_SCHEMA, 0); |
| 163 | 166 | db_set("rebuilt", get_version(), 0); |
| 167 | + remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]); | |
| 164 | 168 | url_remember(); |
| 165 | 169 | if( g.zSSLIdentity!=0 ){ |
| 166 | 170 | /* If the --ssl-identity option was specified, store it as a setting */ |
| 167 | 171 | Blob fn; |
| 168 | 172 | blob_zero(&fn); |
| @@ -195,10 +199,57 @@ | ||
| 195 | 199 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 196 | 200 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 197 | 201 | fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); |
| 198 | 202 | db_end_transaction(0); |
| 199 | 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 | +} | |
| 200 | 251 | |
| 201 | 252 | /* |
| 202 | 253 | ** Look for SSH clone command line options and setup in globals. |
| 203 | 254 | */ |
| 204 | 255 | void clone_ssh_find_options(void){ |
| 205 | 256 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -109,22 +109,25 @@ | |
| 109 | ** --admin-user|-A USERNAME Make USERNAME the administrator |
| 110 | ** --once Don't save url. |
| 111 | ** --private Also clone private branches |
| 112 | ** --ssl-identity=filename Use the SSL identity if requested by the server |
| 113 | ** --ssh-command|-c 'command' Use this SSH command |
| 114 | ** |
| 115 | ** See also: init |
| 116 | */ |
| 117 | void clone_cmd(void){ |
| 118 | char *zPassword; |
| 119 | const char *zDefaultUser; /* Optional name of the default user */ |
| 120 | int nErr = 0; |
| 121 | int bPrivate = 0; /* Also clone private branches */ |
| 122 | int urlFlags = URL_PROMPT_PW | URL_REMEMBER; |
| 123 | |
| 124 | if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE; |
| 125 | if( find_option("once",0,0)!=0) urlFlags &= ~URL_REMEMBER; |
| 126 | zDefaultUser = find_option("admin-user","A",1); |
| 127 | clone_ssh_find_options(); |
| 128 | url_proxy_options(); |
| 129 | if( g.argc < 4 ){ |
| 130 | usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); |
| @@ -159,10 +162,11 @@ | |
| 159 | db_initial_setup(0, 0, zDefaultUser, 0); |
| 160 | user_select(); |
| 161 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 162 | db_set("aux-schema", AUX_SCHEMA, 0); |
| 163 | db_set("rebuilt", get_version(), 0); |
| 164 | url_remember(); |
| 165 | if( g.zSSLIdentity!=0 ){ |
| 166 | /* If the --ssl-identity option was specified, store it as a setting */ |
| 167 | Blob fn; |
| 168 | blob_zero(&fn); |
| @@ -195,10 +199,57 @@ | |
| 195 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 196 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 197 | fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); |
| 198 | db_end_transaction(0); |
| 199 | } |
| 200 | |
| 201 | /* |
| 202 | ** Look for SSH clone command line options and setup in globals. |
| 203 | */ |
| 204 | void clone_ssh_find_options(void){ |
| 205 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -109,22 +109,25 @@ | |
| 109 | ** --admin-user|-A USERNAME Make USERNAME the administrator |
| 110 | ** --once Don't save url. |
| 111 | ** --private Also clone private branches |
| 112 | ** --ssl-identity=filename Use the SSL identity if requested by the server |
| 113 | ** --ssh-command|-c 'command' Use this SSH command |
| 114 | ** --httpauth|-B 'user:pass' Add HTTP Basic Authorization to requests |
| 115 | ** |
| 116 | ** See also: init |
| 117 | */ |
| 118 | void clone_cmd(void){ |
| 119 | char *zPassword; |
| 120 | const char *zDefaultUser; /* Optional name of the default user */ |
| 121 | const char *zHttpAuth; /* HTTP Authorization user:pass information */ |
| 122 | int nErr = 0; |
| 123 | int bPrivate = 0; /* Also clone private branches */ |
| 124 | int urlFlags = URL_PROMPT_PW | URL_REMEMBER; |
| 125 | |
| 126 | if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE; |
| 127 | if( find_option("once",0,0)!=0) urlFlags &= ~URL_REMEMBER; |
| 128 | zHttpAuth = find_option("httpauth","B",1); |
| 129 | zDefaultUser = find_option("admin-user","A",1); |
| 130 | clone_ssh_find_options(); |
| 131 | url_proxy_options(); |
| 132 | if( g.argc < 4 ){ |
| 133 | usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); |
| @@ -159,10 +162,11 @@ | |
| 162 | db_initial_setup(0, 0, zDefaultUser, 0); |
| 163 | user_select(); |
| 164 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 165 | db_set("aux-schema", AUX_SCHEMA, 0); |
| 166 | db_set("rebuilt", get_version(), 0); |
| 167 | remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]); |
| 168 | url_remember(); |
| 169 | if( g.zSSLIdentity!=0 ){ |
| 170 | /* If the --ssl-identity option was specified, store it as a setting */ |
| 171 | Blob fn; |
| 172 | blob_zero(&fn); |
| @@ -195,10 +199,57 @@ | |
| 199 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 200 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 201 | fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); |
| 202 | db_end_transaction(0); |
| 203 | } |
| 204 | |
| 205 | /* |
| 206 | ** If user chooses to use HTTP Authentication over unencrypted HTTP, |
| 207 | ** remember decision. Otherwise, if the URL is being changed and no |
| 208 | ** preference has been indicated, err on the safe side and revert the |
| 209 | ** decision. Set the global preference if the URL is not being changed. |
| 210 | */ |
| 211 | void remember_or_get_http_auth( |
| 212 | const char *zHttpAuth, /* Credentials in the form "user:password" */ |
| 213 | int fRemember, /* True to remember credentials for later reuse */ |
| 214 | const char *zUrl /* URL for which these credentials apply */ |
| 215 | ){ |
| 216 | char *zKey = mprintf("http-auth:%s", g.urlCanonical); |
| 217 | if( zHttpAuth && zHttpAuth[0] ){ |
| 218 | g.zHttpAuth = mprintf("%s", zHttpAuth); |
| 219 | } |
| 220 | if( fRemember ){ |
| 221 | if( g.zHttpAuth && g.zHttpAuth[0] ){ |
| 222 | set_httpauth(g.zHttpAuth); |
| 223 | }else if( zUrl && zUrl[0] ){ |
| 224 | db_unset(zKey, 0); |
| 225 | }else{ |
| 226 | g.zHttpAuth = get_httpauth(); |
| 227 | } |
| 228 | }else if( g.zHttpAuth==0 && zUrl==0 ){ |
| 229 | g.zHttpAuth = get_httpauth(); |
| 230 | } |
| 231 | free(zKey); |
| 232 | } |
| 233 | |
| 234 | /* |
| 235 | ** Get the HTTP Authorization preference from db. |
| 236 | */ |
| 237 | char *get_httpauth(void){ |
| 238 | char *zKey = mprintf("http-auth:%s", g.urlCanonical); |
| 239 | return unobscure(db_get(zKey, 0)); |
| 240 | free(zKey); |
| 241 | } |
| 242 | |
| 243 | /* |
| 244 | ** Set the HTTP Authorization preference in db. |
| 245 | */ |
| 246 | void set_httpauth(const char *zHttpAuth){ |
| 247 | char *zKey = mprintf("http-auth:%s", g.urlCanonical); |
| 248 | db_set(zKey, obscure(zHttpAuth), 0); |
| 249 | free(zKey); |
| 250 | } |
| 251 | |
| 252 | /* |
| 253 | ** Look for SSH clone command line options and setup in globals. |
| 254 | */ |
| 255 | void clone_ssh_find_options(void){ |
| 256 |
+70
-7
| --- src/config.h | ||
| +++ src/config.h | ||
| @@ -62,30 +62,93 @@ | ||
| 62 | 62 | # include <sys/types.h> |
| 63 | 63 | # include <signal.h> |
| 64 | 64 | # include <pwd.h> |
| 65 | 65 | #endif |
| 66 | 66 | |
| 67 | +/* | |
| 68 | +** Utility macro to wrap an argument with double quotes. | |
| 69 | +*/ | |
| 70 | +#if !defined(COMPILER_STRINGIFY) | |
| 71 | +# define COMPILER_STRINGIFY(x) COMPILER_STRINGIFY1(x) | |
| 72 | +# define COMPILER_STRINGIFY1(x) #x | |
| 73 | +#endif | |
| 74 | + | |
| 67 | 75 | /* |
| 68 | 76 | ** Define the compiler variant, used to compile the project |
| 69 | 77 | */ |
| 70 | 78 | #if !defined(COMPILER_NAME) |
| 71 | 79 | # if defined(__DMC__) |
| 72 | -# define COMPILER_NAME "dmc" | |
| 80 | +# if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION) | |
| 81 | +# define COMPILER_NAME "dmc-" COMPILER_VERSION | |
| 82 | +# else | |
| 83 | +# define COMPILER_NAME "dmc" | |
| 84 | +# endif | |
| 73 | 85 | # elif defined(__POCC__) |
| 74 | 86 | # if defined(_M_X64) |
| 75 | -# define COMPILER_NAME "pellesc64" | |
| 87 | +# if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION) | |
| 88 | +# define COMPILER_NAME "pellesc64-" COMPILER_VERSION | |
| 89 | +# else | |
| 90 | +# define COMPILER_NAME "pellesc64" | |
| 91 | +# endif | |
| 76 | 92 | # else |
| 77 | -# define COMPILER_NAME "pellesc32" | |
| 93 | +# if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION) | |
| 94 | +# define COMPILER_NAME "pellesc32-" COMPILER_VERSION | |
| 95 | +# else | |
| 96 | +# define COMPILER_NAME "pellesc32" | |
| 97 | +# endif | |
| 78 | 98 | # endif |
| 79 | 99 | # elif defined(_MSC_VER) |
| 80 | -# define COMPILER_NAME "msc" | |
| 100 | +# if !defined(COMPILER_VERSION) | |
| 101 | +# define COMPILER_VERSION COMPILER_STRINGIFY(_MSC_VER) | |
| 102 | +# endif | |
| 103 | +# if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION) | |
| 104 | +# define COMPILER_NAME "msc-" COMPILER_VERSION | |
| 105 | +# else | |
| 106 | +# define COMPILER_NAME "msc" | |
| 107 | +# endif | |
| 81 | 108 | # elif defined(__MINGW32__) |
| 82 | -# define COMPILER_NAME "mingw32" | |
| 109 | +# if !defined(COMPILER_VERSION) | |
| 110 | +# if defined(__MINGW_VERSION) | |
| 111 | +# if defined(__GNUC__) | |
| 112 | +# if defined(__VERSION__) | |
| 113 | +# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW_VERSION) "-gcc-" __VERSION__ | |
| 114 | +# else | |
| 115 | +# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW_VERSION) "-gcc" | |
| 116 | +# endif | |
| 117 | +# else | |
| 118 | +# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW_VERSION) | |
| 119 | +# endif | |
| 120 | +# elif defined(__MINGW32_VERSION) | |
| 121 | +# if defined(__GNUC__) | |
| 122 | +# if defined(__VERSION__) | |
| 123 | +# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc-" __VERSION__ | |
| 124 | +# else | |
| 125 | +# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc" | |
| 126 | +# endif | |
| 127 | +# else | |
| 128 | +# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) | |
| 129 | +# endif | |
| 130 | +# endif | |
| 131 | +# endif | |
| 132 | +# if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION) | |
| 133 | +# define COMPILER_NAME "mingw32-" COMPILER_VERSION | |
| 134 | +# else | |
| 135 | +# define COMPILER_NAME "mingw32" | |
| 136 | +# endif | |
| 83 | 137 | # elif defined(_WIN32) |
| 84 | 138 | # define COMPILER_NAME "win32" |
| 85 | 139 | # elif defined(__GNUC__) |
| 86 | -# define COMPILER_NAME "gcc-" __VERSION__ | |
| 140 | +# if !defined(COMPILER_VERSION) | |
| 141 | +# if defined(__VERSION__) | |
| 142 | +# define COMPILER_VERSION __VERSION__ | |
| 143 | +# endif | |
| 144 | +# endif | |
| 145 | +# if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION) | |
| 146 | +# define COMPILER_NAME "gcc-" COMPILER_VERSION | |
| 147 | +# else | |
| 148 | +# define COMPILER_NAME "gcc" | |
| 149 | +# endif | |
| 87 | 150 | # else |
| 88 | 151 | # define COMPILER_NAME "unknown" |
| 89 | 152 | # endif |
| 90 | 153 | #endif |
| 91 | 154 | |
| @@ -123,11 +186,11 @@ | ||
| 123 | 186 | ** The following macros are used to cast pointers to integers and |
| 124 | 187 | ** integers to pointers. The way you do this varies from one compiler |
| 125 | 188 | ** to the next, so we have developed the following set of #if statements |
| 126 | 189 | ** to generate appropriate macros for a wide range of compilers. |
| 127 | 190 | ** |
| 128 | -** The correct "ANSI" way to do this is to use the intptr_t type. | |
| 191 | +** The correct "ANSI" way to do this is to use the intptr_t type. | |
| 129 | 192 | ** Unfortunately, that typedef is not available on all compilers, or |
| 130 | 193 | ** if it is available, it requires an #include of specific headers |
| 131 | 194 | ** that vary from one machine to the next. |
| 132 | 195 | */ |
| 133 | 196 | #if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ |
| 134 | 197 |
| --- src/config.h | |
| +++ src/config.h | |
| @@ -62,30 +62,93 @@ | |
| 62 | # include <sys/types.h> |
| 63 | # include <signal.h> |
| 64 | # include <pwd.h> |
| 65 | #endif |
| 66 | |
| 67 | /* |
| 68 | ** Define the compiler variant, used to compile the project |
| 69 | */ |
| 70 | #if !defined(COMPILER_NAME) |
| 71 | # if defined(__DMC__) |
| 72 | # define COMPILER_NAME "dmc" |
| 73 | # elif defined(__POCC__) |
| 74 | # if defined(_M_X64) |
| 75 | # define COMPILER_NAME "pellesc64" |
| 76 | # else |
| 77 | # define COMPILER_NAME "pellesc32" |
| 78 | # endif |
| 79 | # elif defined(_MSC_VER) |
| 80 | # define COMPILER_NAME "msc" |
| 81 | # elif defined(__MINGW32__) |
| 82 | # define COMPILER_NAME "mingw32" |
| 83 | # elif defined(_WIN32) |
| 84 | # define COMPILER_NAME "win32" |
| 85 | # elif defined(__GNUC__) |
| 86 | # define COMPILER_NAME "gcc-" __VERSION__ |
| 87 | # else |
| 88 | # define COMPILER_NAME "unknown" |
| 89 | # endif |
| 90 | #endif |
| 91 | |
| @@ -123,11 +186,11 @@ | |
| 123 | ** The following macros are used to cast pointers to integers and |
| 124 | ** integers to pointers. The way you do this varies from one compiler |
| 125 | ** to the next, so we have developed the following set of #if statements |
| 126 | ** to generate appropriate macros for a wide range of compilers. |
| 127 | ** |
| 128 | ** The correct "ANSI" way to do this is to use the intptr_t type. |
| 129 | ** Unfortunately, that typedef is not available on all compilers, or |
| 130 | ** if it is available, it requires an #include of specific headers |
| 131 | ** that vary from one machine to the next. |
| 132 | */ |
| 133 | #if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ |
| 134 |
| --- src/config.h | |
| +++ src/config.h | |
| @@ -62,30 +62,93 @@ | |
| 62 | # include <sys/types.h> |
| 63 | # include <signal.h> |
| 64 | # include <pwd.h> |
| 65 | #endif |
| 66 | |
| 67 | /* |
| 68 | ** Utility macro to wrap an argument with double quotes. |
| 69 | */ |
| 70 | #if !defined(COMPILER_STRINGIFY) |
| 71 | # define COMPILER_STRINGIFY(x) COMPILER_STRINGIFY1(x) |
| 72 | # define COMPILER_STRINGIFY1(x) #x |
| 73 | #endif |
| 74 | |
| 75 | /* |
| 76 | ** Define the compiler variant, used to compile the project |
| 77 | */ |
| 78 | #if !defined(COMPILER_NAME) |
| 79 | # if defined(__DMC__) |
| 80 | # if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION) |
| 81 | # define COMPILER_NAME "dmc-" COMPILER_VERSION |
| 82 | # else |
| 83 | # define COMPILER_NAME "dmc" |
| 84 | # endif |
| 85 | # elif defined(__POCC__) |
| 86 | # if defined(_M_X64) |
| 87 | # if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION) |
| 88 | # define COMPILER_NAME "pellesc64-" COMPILER_VERSION |
| 89 | # else |
| 90 | # define COMPILER_NAME "pellesc64" |
| 91 | # endif |
| 92 | # else |
| 93 | # if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION) |
| 94 | # define COMPILER_NAME "pellesc32-" COMPILER_VERSION |
| 95 | # else |
| 96 | # define COMPILER_NAME "pellesc32" |
| 97 | # endif |
| 98 | # endif |
| 99 | # elif defined(_MSC_VER) |
| 100 | # if !defined(COMPILER_VERSION) |
| 101 | # define COMPILER_VERSION COMPILER_STRINGIFY(_MSC_VER) |
| 102 | # endif |
| 103 | # if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION) |
| 104 | # define COMPILER_NAME "msc-" COMPILER_VERSION |
| 105 | # else |
| 106 | # define COMPILER_NAME "msc" |
| 107 | # endif |
| 108 | # elif defined(__MINGW32__) |
| 109 | # if !defined(COMPILER_VERSION) |
| 110 | # if defined(__MINGW_VERSION) |
| 111 | # if defined(__GNUC__) |
| 112 | # if defined(__VERSION__) |
| 113 | # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW_VERSION) "-gcc-" __VERSION__ |
| 114 | # else |
| 115 | # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW_VERSION) "-gcc" |
| 116 | # endif |
| 117 | # else |
| 118 | # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW_VERSION) |
| 119 | # endif |
| 120 | # elif defined(__MINGW32_VERSION) |
| 121 | # if defined(__GNUC__) |
| 122 | # if defined(__VERSION__) |
| 123 | # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc-" __VERSION__ |
| 124 | # else |
| 125 | # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc" |
| 126 | # endif |
| 127 | # else |
| 128 | # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) |
| 129 | # endif |
| 130 | # endif |
| 131 | # endif |
| 132 | # if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION) |
| 133 | # define COMPILER_NAME "mingw32-" COMPILER_VERSION |
| 134 | # else |
| 135 | # define COMPILER_NAME "mingw32" |
| 136 | # endif |
| 137 | # elif defined(_WIN32) |
| 138 | # define COMPILER_NAME "win32" |
| 139 | # elif defined(__GNUC__) |
| 140 | # if !defined(COMPILER_VERSION) |
| 141 | # if defined(__VERSION__) |
| 142 | # define COMPILER_VERSION __VERSION__ |
| 143 | # endif |
| 144 | # endif |
| 145 | # if defined(COMPILER_VERSION) && !defined(NO_COMPILER_VERSION) |
| 146 | # define COMPILER_NAME "gcc-" COMPILER_VERSION |
| 147 | # else |
| 148 | # define COMPILER_NAME "gcc" |
| 149 | # endif |
| 150 | # else |
| 151 | # define COMPILER_NAME "unknown" |
| 152 | # endif |
| 153 | #endif |
| 154 | |
| @@ -123,11 +186,11 @@ | |
| 186 | ** The following macros are used to cast pointers to integers and |
| 187 | ** integers to pointers. The way you do this varies from one compiler |
| 188 | ** to the next, so we have developed the following set of #if statements |
| 189 | ** to generate appropriate macros for a wide range of compilers. |
| 190 | ** |
| 191 | ** The correct "ANSI" way to do this is to use the intptr_t type. |
| 192 | ** Unfortunately, that typedef is not available on all compilers, or |
| 193 | ** if it is available, it requires an #include of specific headers |
| 194 | ** that vary from one machine to the next. |
| 195 | */ |
| 196 | #if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ |
| 197 |
M
src/db.c
+77
-60
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -715,11 +715,11 @@ | ||
| 715 | 715 | */ |
| 716 | 716 | LOCAL sqlite3 *db_open(const char *zDbName){ |
| 717 | 717 | int rc; |
| 718 | 718 | sqlite3 *db; |
| 719 | 719 | |
| 720 | -#if defined(__CYGWIN__) | |
| 720 | +#if defined(__CYGWIN__) && !defined(USE_SYSTEM_SQLITE) | |
| 721 | 721 | zDbName = fossil_utf8_to_filename(zDbName); |
| 722 | 722 | #endif |
| 723 | 723 | if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName); |
| 724 | 724 | rc = sqlite3_open_v2( |
| 725 | 725 | zDbName, &db, |
| @@ -1989,23 +1989,28 @@ | ||
| 1989 | 1989 | ** If VERSION is specified then that version is checked out. Otherwise |
| 1990 | 1990 | ** the latest version is checked out. No files other than "manifest" |
| 1991 | 1991 | ** and "manifest.uuid" are modified if the --keep option is present. |
| 1992 | 1992 | ** |
| 1993 | 1993 | ** Options: |
| 1994 | +** --empty Initialize checkout as being empty, but still connected | |
| 1995 | +** with the local repository. If you commit this checkout, | |
| 1996 | +** it will become a new "initial" commit in the repository. | |
| 1994 | 1997 | ** --keep Only modify the manifest and manifest.uuid files |
| 1995 | 1998 | ** --nested Allow opening a repository inside an opened checkout |
| 1996 | 1999 | ** |
| 1997 | 2000 | ** See also: close |
| 1998 | 2001 | */ |
| 1999 | 2002 | void cmd_open(void){ |
| 2003 | + int emptyFlag; | |
| 2000 | 2004 | int keepFlag; |
| 2001 | 2005 | int allowNested; |
| 2002 | 2006 | char **oldArgv; |
| 2003 | 2007 | int oldArgc; |
| 2004 | 2008 | static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0 }; |
| 2005 | 2009 | |
| 2006 | 2010 | url_proxy_options(); |
| 2011 | + emptyFlag = find_option("empty",0,0)!=0; | |
| 2007 | 2012 | keepFlag = find_option("keep",0,0)!=0; |
| 2008 | 2013 | allowNested = find_option("nested",0,0)!=0; |
| 2009 | 2014 | if( g.argc!=3 && g.argc!=4 ){ |
| 2010 | 2015 | usage("REPOSITORY-FILENAME ?VERSION?"); |
| 2011 | 2016 | } |
| @@ -2030,22 +2035,24 @@ | ||
| 2030 | 2035 | db_lset_int("checkout", 0); |
| 2031 | 2036 | oldArgv = g.argv; |
| 2032 | 2037 | oldArgc = g.argc; |
| 2033 | 2038 | azNewArgv[0] = g.argv[0]; |
| 2034 | 2039 | g.argv = azNewArgv; |
| 2035 | - g.argc = 3; | |
| 2036 | - if( oldArgc==4 ){ | |
| 2037 | - azNewArgv[g.argc-1] = oldArgv[3]; | |
| 2038 | - }else if( !db_exists("SELECT 1 FROM event WHERE type='ci'") ){ | |
| 2039 | - azNewArgv[g.argc-1] = "--latest"; | |
| 2040 | - }else{ | |
| 2041 | - azNewArgv[g.argc-1] = db_get("main-branch", "trunk"); | |
| 2042 | - } | |
| 2043 | - if( keepFlag ){ | |
| 2044 | - azNewArgv[g.argc++] = "--keep"; | |
| 2045 | - } | |
| 2046 | - checkout_cmd(); | |
| 2040 | + if( !emptyFlag){ | |
| 2041 | + g.argc = 3; | |
| 2042 | + if( oldArgc==4 ){ | |
| 2043 | + azNewArgv[g.argc-1] = oldArgv[3]; | |
| 2044 | + }else if( !db_exists("SELECT 1 FROM event WHERE type='ci'") ){ | |
| 2045 | + azNewArgv[g.argc-1] = "--latest"; | |
| 2046 | + }else{ | |
| 2047 | + azNewArgv[g.argc-1] = db_get("main-branch", "trunk"); | |
| 2048 | + } | |
| 2049 | + if( keepFlag ){ | |
| 2050 | + azNewArgv[g.argc++] = "--keep"; | |
| 2051 | + } | |
| 2052 | + checkout_cmd(); | |
| 2053 | + } | |
| 2047 | 2054 | g.argc = 2; |
| 2048 | 2055 | info_cmd(); |
| 2049 | 2056 | } |
| 2050 | 2057 | |
| 2051 | 2058 | /* |
| @@ -2101,66 +2108,69 @@ | ||
| 2101 | 2108 | */ |
| 2102 | 2109 | #if INTERFACE |
| 2103 | 2110 | struct stControlSettings { |
| 2104 | 2111 | char const *name; /* Name of the setting */ |
| 2105 | 2112 | char const *var; /* Internal variable name used by db_set() */ |
| 2106 | - int width; /* Width of display. 0 for boolean values */ | |
| 2113 | + int width; /* Width of display. 0 for boolean values. */ | |
| 2107 | 2114 | int versionable; /* Is this setting versionable? */ |
| 2115 | + int forceTextArea; /* Force using a text area for display? */ | |
| 2108 | 2116 | char const *def; /* Default value */ |
| 2109 | 2117 | }; |
| 2110 | 2118 | #endif /* INTERFACE */ |
| 2111 | 2119 | struct stControlSettings const ctrlSettings[] = { |
| 2112 | - { "access-log", 0, 0, 0, "off" }, | |
| 2113 | - { "allow-symlinks",0, 0, 1, "off" }, | |
| 2114 | - { "auto-captcha", "autocaptcha", 0, 0, "on" }, | |
| 2115 | - { "auto-hyperlink",0, 0, 0, "on", }, | |
| 2116 | - { "auto-shun", 0, 0, 0, "on" }, | |
| 2117 | - { "autosync", 0, 0, 0, "on" }, | |
| 2118 | - { "binary-glob", 0, 40, 1, "" }, | |
| 2119 | - { "clearsign", 0, 0, 0, "off" }, | |
| 2120 | -#if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || defined(__APPLE__) | |
| 2121 | - { "case-sensitive",0, 0, 0, "off" }, | |
| 2120 | + { "access-log", 0, 0, 0, 0, "off" }, | |
| 2121 | + { "allow-symlinks", 0, 0, 1, 0, "off" }, | |
| 2122 | + { "auto-captcha", "autocaptcha", 0, 0, 0, "on" }, | |
| 2123 | + { "auto-hyperlink", 0, 0, 0, 0, "on", }, | |
| 2124 | + { "auto-shun", 0, 0, 0, 0, "on" }, | |
| 2125 | + { "autosync", 0, 0, 0, 0, "on" }, | |
| 2126 | + { "binary-glob", 0, 40, 1, 0, "" }, | |
| 2127 | + { "clearsign", 0, 0, 0, 0, "off" }, | |
| 2128 | +#if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || \ | |
| 2129 | + defined(__APPLE__) | |
| 2130 | + { "case-sensitive", 0, 0, 0, 0, "off" }, | |
| 2122 | 2131 | #else |
| 2123 | - { "case-sensitive",0, 0, 0, "on" }, | |
| 2132 | + { "case-sensitive", 0, 0, 0, 0, "on" }, | |
| 2124 | 2133 | #endif |
| 2125 | - { "clean-glob", 0, 40, 1, "" }, | |
| 2126 | - { "crnl-glob", 0, 40, 1, "" }, | |
| 2127 | - { "default-perms", 0, 16, 0, "u" }, | |
| 2128 | - { "diff-binary", 0, 0, 0, "on" }, | |
| 2129 | - { "diff-command", 0, 40, 0, "" }, | |
| 2130 | - { "dont-push", 0, 0, 0, "off" }, | |
| 2131 | - { "editor", 0, 32, 0, "" }, | |
| 2132 | - { "empty-dirs", 0, 40, 1, "" }, | |
| 2133 | - { "encoding-glob", 0, 40, 1, "" }, | |
| 2134 | - { "gdiff-command", 0, 40, 0, "gdiff" }, | |
| 2135 | - { "gmerge-command",0, 40, 0, "" }, | |
| 2136 | - { "http-port", 0, 16, 0, "8080" }, | |
| 2137 | - { "https-login", 0, 0, 0, "off" }, | |
| 2138 | - { "ignore-glob", 0, 40, 1, "" }, | |
| 2139 | - { "keep-glob", 0, 40, 1, "" }, | |
| 2140 | - { "localauth", 0, 0, 0, "off" }, | |
| 2141 | - { "main-branch", 0, 40, 0, "trunk" }, | |
| 2142 | - { "manifest", 0, 0, 1, "off" }, | |
| 2143 | - { "max-upload", 0, 25, 0, "250000" }, | |
| 2144 | - { "mtime-changes", 0, 0, 0, "on" }, | |
| 2145 | - { "pgp-command", 0, 40, 0, "gpg --clearsign -o " }, | |
| 2146 | - { "proxy", 0, 32, 0, "off" }, | |
| 2147 | - { "relative-paths",0, 0, 0, "on" }, | |
| 2148 | - { "repo-cksum", 0, 0, 0, "on" }, | |
| 2149 | - { "self-register", 0, 0, 0, "off" }, | |
| 2150 | - { "ssh-command", 0, 40, 0, "" }, | |
| 2151 | - { "ssl-ca-location",0, 40, 0, "" }, | |
| 2152 | - { "ssl-identity", 0, 40, 0, "" }, | |
| 2134 | + { "clean-glob", 0, 40, 1, 0, "" }, | |
| 2135 | + { "crnl-glob", 0, 40, 1, 0, "" }, | |
| 2136 | + { "default-perms", 0, 16, 0, 0, "u" }, | |
| 2137 | + { "diff-binary", 0, 0, 0, 0, "on" }, | |
| 2138 | + { "diff-command", 0, 40, 0, 0, "" }, | |
| 2139 | + { "dont-push", 0, 0, 0, 0, "off" }, | |
| 2140 | + { "editor", 0, 32, 0, 0, "" }, | |
| 2141 | + { "empty-dirs", 0, 40, 1, 0, "" }, | |
| 2142 | + { "encoding-glob", 0, 40, 1, 0, "" }, | |
| 2143 | + { "gdiff-command", 0, 40, 0, 0, "gdiff" }, | |
| 2144 | + { "gmerge-command", 0, 40, 0, 0, "" }, | |
| 2145 | + { "http-port", 0, 16, 0, 0, "8080" }, | |
| 2146 | + { "https-login", 0, 0, 0, 0, "off" }, | |
| 2147 | + { "ignore-glob", 0, 40, 1, 0, "" }, | |
| 2148 | + { "keep-glob", 0, 40, 1, 0, "" }, | |
| 2149 | + { "localauth", 0, 0, 0, 0, "off" }, | |
| 2150 | + { "main-branch", 0, 40, 0, 0, "trunk" }, | |
| 2151 | + { "manifest", 0, 0, 1, 0, "off" }, | |
| 2152 | + { "max-loadavg", 0, 25, 0, 0, "0.0" }, | |
| 2153 | + { "max-upload", 0, 25, 0, 0, "250000" }, | |
| 2154 | + { "mtime-changes", 0, 0, 0, 0, "on" }, | |
| 2155 | + { "pgp-command", 0, 40, 0, 0, "gpg --clearsign -o " }, | |
| 2156 | + { "proxy", 0, 32, 0, 0, "off" }, | |
| 2157 | + { "relative-paths", 0, 0, 0, 0, "on" }, | |
| 2158 | + { "repo-cksum", 0, 0, 0, 0, "on" }, | |
| 2159 | + { "self-register", 0, 0, 0, 0, "off" }, | |
| 2160 | + { "ssh-command", 0, 40, 0, 0, "" }, | |
| 2161 | + { "ssl-ca-location", 0, 40, 0, 0, "" }, | |
| 2162 | + { "ssl-identity", 0, 40, 0, 0, "" }, | |
| 2153 | 2163 | #ifdef FOSSIL_ENABLE_TCL |
| 2154 | - { "tcl", 0, 0, 0, "off" }, | |
| 2155 | - { "tcl-setup", 0, 40, 0, "" }, | |
| 2164 | + { "tcl", 0, 0, 0, 0, "off" }, | |
| 2165 | + { "tcl-setup", 0, 40, 0, 1, "" }, | |
| 2156 | 2166 | #endif |
| 2157 | - { "th1-setup", 0, 40, 0, "" }, | |
| 2158 | - { "th1-uri-regexp",0, 40, 0, "" }, | |
| 2159 | - { "web-browser", 0, 32, 0, "" }, | |
| 2160 | - { "white-foreground", 0, 0, 0, "off" }, | |
| 2161 | - { 0,0,0,0,0 } | |
| 2167 | + { "th1-setup", 0, 40, 0, 1, "" }, | |
| 2168 | + { "th1-uri-regexp", 0, 40, 0, 0, "" }, | |
| 2169 | + { "web-browser", 0, 32, 0, 0, "" }, | |
| 2170 | + { "white-foreground", 0, 0, 0, 0, "off" }, | |
| 2171 | + { 0,0,0,0,0,0 } | |
| 2162 | 2172 | }; |
| 2163 | 2173 | |
| 2164 | 2174 | /* |
| 2165 | 2175 | ** COMMAND: settings |
| 2166 | 2176 | ** COMMAND: unset* |
| @@ -2287,10 +2297,17 @@ | ||
| 2287 | 2297 | ** main-branch The primary branch for the project. Default: trunk |
| 2288 | 2298 | ** |
| 2289 | 2299 | ** manifest If enabled, automatically create files "manifest" and |
| 2290 | 2300 | ** (versionable) "manifest.uuid" in every checkout. The SQLite and |
| 2291 | 2301 | ** Fossil repositories both require this. Default: off. |
| 2302 | +** | |
| 2303 | +** max-loadavg Some CPU-intensive web pages (ex: /zip, /tarball, /blame) | |
| 2304 | +** are disallowed if the system load average goes above this | |
| 2305 | +** value. "0.0" means no limit. This only works on unix. | |
| 2306 | +** Only local settings of this value make a difference since | |
| 2307 | +** when running as a web-server, Fossil does not open the | |
| 2308 | +** global configuration database. | |
| 2292 | 2309 | ** |
| 2293 | 2310 | ** max-upload A limit on the size of uplink HTTP requests. The |
| 2294 | 2311 | ** default is 250000 bytes. |
| 2295 | 2312 | ** |
| 2296 | 2313 | ** mtime-changes Use file modification times (mtimes) to detect when |
| 2297 | 2314 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -715,11 +715,11 @@ | |
| 715 | */ |
| 716 | LOCAL sqlite3 *db_open(const char *zDbName){ |
| 717 | int rc; |
| 718 | sqlite3 *db; |
| 719 | |
| 720 | #if defined(__CYGWIN__) |
| 721 | zDbName = fossil_utf8_to_filename(zDbName); |
| 722 | #endif |
| 723 | if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName); |
| 724 | rc = sqlite3_open_v2( |
| 725 | zDbName, &db, |
| @@ -1989,23 +1989,28 @@ | |
| 1989 | ** If VERSION is specified then that version is checked out. Otherwise |
| 1990 | ** the latest version is checked out. No files other than "manifest" |
| 1991 | ** and "manifest.uuid" are modified if the --keep option is present. |
| 1992 | ** |
| 1993 | ** Options: |
| 1994 | ** --keep Only modify the manifest and manifest.uuid files |
| 1995 | ** --nested Allow opening a repository inside an opened checkout |
| 1996 | ** |
| 1997 | ** See also: close |
| 1998 | */ |
| 1999 | void cmd_open(void){ |
| 2000 | int keepFlag; |
| 2001 | int allowNested; |
| 2002 | char **oldArgv; |
| 2003 | int oldArgc; |
| 2004 | static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0 }; |
| 2005 | |
| 2006 | url_proxy_options(); |
| 2007 | keepFlag = find_option("keep",0,0)!=0; |
| 2008 | allowNested = find_option("nested",0,0)!=0; |
| 2009 | if( g.argc!=3 && g.argc!=4 ){ |
| 2010 | usage("REPOSITORY-FILENAME ?VERSION?"); |
| 2011 | } |
| @@ -2030,22 +2035,24 @@ | |
| 2030 | db_lset_int("checkout", 0); |
| 2031 | oldArgv = g.argv; |
| 2032 | oldArgc = g.argc; |
| 2033 | azNewArgv[0] = g.argv[0]; |
| 2034 | g.argv = azNewArgv; |
| 2035 | g.argc = 3; |
| 2036 | if( oldArgc==4 ){ |
| 2037 | azNewArgv[g.argc-1] = oldArgv[3]; |
| 2038 | }else if( !db_exists("SELECT 1 FROM event WHERE type='ci'") ){ |
| 2039 | azNewArgv[g.argc-1] = "--latest"; |
| 2040 | }else{ |
| 2041 | azNewArgv[g.argc-1] = db_get("main-branch", "trunk"); |
| 2042 | } |
| 2043 | if( keepFlag ){ |
| 2044 | azNewArgv[g.argc++] = "--keep"; |
| 2045 | } |
| 2046 | checkout_cmd(); |
| 2047 | g.argc = 2; |
| 2048 | info_cmd(); |
| 2049 | } |
| 2050 | |
| 2051 | /* |
| @@ -2101,66 +2108,69 @@ | |
| 2101 | */ |
| 2102 | #if INTERFACE |
| 2103 | struct stControlSettings { |
| 2104 | char const *name; /* Name of the setting */ |
| 2105 | char const *var; /* Internal variable name used by db_set() */ |
| 2106 | int width; /* Width of display. 0 for boolean values */ |
| 2107 | int versionable; /* Is this setting versionable? */ |
| 2108 | char const *def; /* Default value */ |
| 2109 | }; |
| 2110 | #endif /* INTERFACE */ |
| 2111 | struct stControlSettings const ctrlSettings[] = { |
| 2112 | { "access-log", 0, 0, 0, "off" }, |
| 2113 | { "allow-symlinks",0, 0, 1, "off" }, |
| 2114 | { "auto-captcha", "autocaptcha", 0, 0, "on" }, |
| 2115 | { "auto-hyperlink",0, 0, 0, "on", }, |
| 2116 | { "auto-shun", 0, 0, 0, "on" }, |
| 2117 | { "autosync", 0, 0, 0, "on" }, |
| 2118 | { "binary-glob", 0, 40, 1, "" }, |
| 2119 | { "clearsign", 0, 0, 0, "off" }, |
| 2120 | #if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || defined(__APPLE__) |
| 2121 | { "case-sensitive",0, 0, 0, "off" }, |
| 2122 | #else |
| 2123 | { "case-sensitive",0, 0, 0, "on" }, |
| 2124 | #endif |
| 2125 | { "clean-glob", 0, 40, 1, "" }, |
| 2126 | { "crnl-glob", 0, 40, 1, "" }, |
| 2127 | { "default-perms", 0, 16, 0, "u" }, |
| 2128 | { "diff-binary", 0, 0, 0, "on" }, |
| 2129 | { "diff-command", 0, 40, 0, "" }, |
| 2130 | { "dont-push", 0, 0, 0, "off" }, |
| 2131 | { "editor", 0, 32, 0, "" }, |
| 2132 | { "empty-dirs", 0, 40, 1, "" }, |
| 2133 | { "encoding-glob", 0, 40, 1, "" }, |
| 2134 | { "gdiff-command", 0, 40, 0, "gdiff" }, |
| 2135 | { "gmerge-command",0, 40, 0, "" }, |
| 2136 | { "http-port", 0, 16, 0, "8080" }, |
| 2137 | { "https-login", 0, 0, 0, "off" }, |
| 2138 | { "ignore-glob", 0, 40, 1, "" }, |
| 2139 | { "keep-glob", 0, 40, 1, "" }, |
| 2140 | { "localauth", 0, 0, 0, "off" }, |
| 2141 | { "main-branch", 0, 40, 0, "trunk" }, |
| 2142 | { "manifest", 0, 0, 1, "off" }, |
| 2143 | { "max-upload", 0, 25, 0, "250000" }, |
| 2144 | { "mtime-changes", 0, 0, 0, "on" }, |
| 2145 | { "pgp-command", 0, 40, 0, "gpg --clearsign -o " }, |
| 2146 | { "proxy", 0, 32, 0, "off" }, |
| 2147 | { "relative-paths",0, 0, 0, "on" }, |
| 2148 | { "repo-cksum", 0, 0, 0, "on" }, |
| 2149 | { "self-register", 0, 0, 0, "off" }, |
| 2150 | { "ssh-command", 0, 40, 0, "" }, |
| 2151 | { "ssl-ca-location",0, 40, 0, "" }, |
| 2152 | { "ssl-identity", 0, 40, 0, "" }, |
| 2153 | #ifdef FOSSIL_ENABLE_TCL |
| 2154 | { "tcl", 0, 0, 0, "off" }, |
| 2155 | { "tcl-setup", 0, 40, 0, "" }, |
| 2156 | #endif |
| 2157 | { "th1-setup", 0, 40, 0, "" }, |
| 2158 | { "th1-uri-regexp",0, 40, 0, "" }, |
| 2159 | { "web-browser", 0, 32, 0, "" }, |
| 2160 | { "white-foreground", 0, 0, 0, "off" }, |
| 2161 | { 0,0,0,0,0 } |
| 2162 | }; |
| 2163 | |
| 2164 | /* |
| 2165 | ** COMMAND: settings |
| 2166 | ** COMMAND: unset* |
| @@ -2287,10 +2297,17 @@ | |
| 2287 | ** main-branch The primary branch for the project. Default: trunk |
| 2288 | ** |
| 2289 | ** manifest If enabled, automatically create files "manifest" and |
| 2290 | ** (versionable) "manifest.uuid" in every checkout. The SQLite and |
| 2291 | ** Fossil repositories both require this. Default: off. |
| 2292 | ** |
| 2293 | ** max-upload A limit on the size of uplink HTTP requests. The |
| 2294 | ** default is 250000 bytes. |
| 2295 | ** |
| 2296 | ** mtime-changes Use file modification times (mtimes) to detect when |
| 2297 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -715,11 +715,11 @@ | |
| 715 | */ |
| 716 | LOCAL sqlite3 *db_open(const char *zDbName){ |
| 717 | int rc; |
| 718 | sqlite3 *db; |
| 719 | |
| 720 | #if defined(__CYGWIN__) && !defined(USE_SYSTEM_SQLITE) |
| 721 | zDbName = fossil_utf8_to_filename(zDbName); |
| 722 | #endif |
| 723 | if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName); |
| 724 | rc = sqlite3_open_v2( |
| 725 | zDbName, &db, |
| @@ -1989,23 +1989,28 @@ | |
| 1989 | ** If VERSION is specified then that version is checked out. Otherwise |
| 1990 | ** the latest version is checked out. No files other than "manifest" |
| 1991 | ** and "manifest.uuid" are modified if the --keep option is present. |
| 1992 | ** |
| 1993 | ** Options: |
| 1994 | ** --empty Initialize checkout as being empty, but still connected |
| 1995 | ** with the local repository. If you commit this checkout, |
| 1996 | ** it will become a new "initial" commit in the repository. |
| 1997 | ** --keep Only modify the manifest and manifest.uuid files |
| 1998 | ** --nested Allow opening a repository inside an opened checkout |
| 1999 | ** |
| 2000 | ** See also: close |
| 2001 | */ |
| 2002 | void cmd_open(void){ |
| 2003 | int emptyFlag; |
| 2004 | int keepFlag; |
| 2005 | int allowNested; |
| 2006 | char **oldArgv; |
| 2007 | int oldArgc; |
| 2008 | static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0 }; |
| 2009 | |
| 2010 | url_proxy_options(); |
| 2011 | emptyFlag = find_option("empty",0,0)!=0; |
| 2012 | keepFlag = find_option("keep",0,0)!=0; |
| 2013 | allowNested = find_option("nested",0,0)!=0; |
| 2014 | if( g.argc!=3 && g.argc!=4 ){ |
| 2015 | usage("REPOSITORY-FILENAME ?VERSION?"); |
| 2016 | } |
| @@ -2030,22 +2035,24 @@ | |
| 2035 | db_lset_int("checkout", 0); |
| 2036 | oldArgv = g.argv; |
| 2037 | oldArgc = g.argc; |
| 2038 | azNewArgv[0] = g.argv[0]; |
| 2039 | g.argv = azNewArgv; |
| 2040 | if( !emptyFlag){ |
| 2041 | g.argc = 3; |
| 2042 | if( oldArgc==4 ){ |
| 2043 | azNewArgv[g.argc-1] = oldArgv[3]; |
| 2044 | }else if( !db_exists("SELECT 1 FROM event WHERE type='ci'") ){ |
| 2045 | azNewArgv[g.argc-1] = "--latest"; |
| 2046 | }else{ |
| 2047 | azNewArgv[g.argc-1] = db_get("main-branch", "trunk"); |
| 2048 | } |
| 2049 | if( keepFlag ){ |
| 2050 | azNewArgv[g.argc++] = "--keep"; |
| 2051 | } |
| 2052 | checkout_cmd(); |
| 2053 | } |
| 2054 | g.argc = 2; |
| 2055 | info_cmd(); |
| 2056 | } |
| 2057 | |
| 2058 | /* |
| @@ -2101,66 +2108,69 @@ | |
| 2108 | */ |
| 2109 | #if INTERFACE |
| 2110 | struct stControlSettings { |
| 2111 | char const *name; /* Name of the setting */ |
| 2112 | char const *var; /* Internal variable name used by db_set() */ |
| 2113 | int width; /* Width of display. 0 for boolean values. */ |
| 2114 | int versionable; /* Is this setting versionable? */ |
| 2115 | int forceTextArea; /* Force using a text area for display? */ |
| 2116 | char const *def; /* Default value */ |
| 2117 | }; |
| 2118 | #endif /* INTERFACE */ |
| 2119 | struct stControlSettings const ctrlSettings[] = { |
| 2120 | { "access-log", 0, 0, 0, 0, "off" }, |
| 2121 | { "allow-symlinks", 0, 0, 1, 0, "off" }, |
| 2122 | { "auto-captcha", "autocaptcha", 0, 0, 0, "on" }, |
| 2123 | { "auto-hyperlink", 0, 0, 0, 0, "on", }, |
| 2124 | { "auto-shun", 0, 0, 0, 0, "on" }, |
| 2125 | { "autosync", 0, 0, 0, 0, "on" }, |
| 2126 | { "binary-glob", 0, 40, 1, 0, "" }, |
| 2127 | { "clearsign", 0, 0, 0, 0, "off" }, |
| 2128 | #if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || \ |
| 2129 | defined(__APPLE__) |
| 2130 | { "case-sensitive", 0, 0, 0, 0, "off" }, |
| 2131 | #else |
| 2132 | { "case-sensitive", 0, 0, 0, 0, "on" }, |
| 2133 | #endif |
| 2134 | { "clean-glob", 0, 40, 1, 0, "" }, |
| 2135 | { "crnl-glob", 0, 40, 1, 0, "" }, |
| 2136 | { "default-perms", 0, 16, 0, 0, "u" }, |
| 2137 | { "diff-binary", 0, 0, 0, 0, "on" }, |
| 2138 | { "diff-command", 0, 40, 0, 0, "" }, |
| 2139 | { "dont-push", 0, 0, 0, 0, "off" }, |
| 2140 | { "editor", 0, 32, 0, 0, "" }, |
| 2141 | { "empty-dirs", 0, 40, 1, 0, "" }, |
| 2142 | { "encoding-glob", 0, 40, 1, 0, "" }, |
| 2143 | { "gdiff-command", 0, 40, 0, 0, "gdiff" }, |
| 2144 | { "gmerge-command", 0, 40, 0, 0, "" }, |
| 2145 | { "http-port", 0, 16, 0, 0, "8080" }, |
| 2146 | { "https-login", 0, 0, 0, 0, "off" }, |
| 2147 | { "ignore-glob", 0, 40, 1, 0, "" }, |
| 2148 | { "keep-glob", 0, 40, 1, 0, "" }, |
| 2149 | { "localauth", 0, 0, 0, 0, "off" }, |
| 2150 | { "main-branch", 0, 40, 0, 0, "trunk" }, |
| 2151 | { "manifest", 0, 0, 1, 0, "off" }, |
| 2152 | { "max-loadavg", 0, 25, 0, 0, "0.0" }, |
| 2153 | { "max-upload", 0, 25, 0, 0, "250000" }, |
| 2154 | { "mtime-changes", 0, 0, 0, 0, "on" }, |
| 2155 | { "pgp-command", 0, 40, 0, 0, "gpg --clearsign -o " }, |
| 2156 | { "proxy", 0, 32, 0, 0, "off" }, |
| 2157 | { "relative-paths", 0, 0, 0, 0, "on" }, |
| 2158 | { "repo-cksum", 0, 0, 0, 0, "on" }, |
| 2159 | { "self-register", 0, 0, 0, 0, "off" }, |
| 2160 | { "ssh-command", 0, 40, 0, 0, "" }, |
| 2161 | { "ssl-ca-location", 0, 40, 0, 0, "" }, |
| 2162 | { "ssl-identity", 0, 40, 0, 0, "" }, |
| 2163 | #ifdef FOSSIL_ENABLE_TCL |
| 2164 | { "tcl", 0, 0, 0, 0, "off" }, |
| 2165 | { "tcl-setup", 0, 40, 0, 1, "" }, |
| 2166 | #endif |
| 2167 | { "th1-setup", 0, 40, 0, 1, "" }, |
| 2168 | { "th1-uri-regexp", 0, 40, 0, 0, "" }, |
| 2169 | { "web-browser", 0, 32, 0, 0, "" }, |
| 2170 | { "white-foreground", 0, 0, 0, 0, "off" }, |
| 2171 | { 0,0,0,0,0,0 } |
| 2172 | }; |
| 2173 | |
| 2174 | /* |
| 2175 | ** COMMAND: settings |
| 2176 | ** COMMAND: unset* |
| @@ -2287,10 +2297,17 @@ | |
| 2297 | ** main-branch The primary branch for the project. Default: trunk |
| 2298 | ** |
| 2299 | ** manifest If enabled, automatically create files "manifest" and |
| 2300 | ** (versionable) "manifest.uuid" in every checkout. The SQLite and |
| 2301 | ** Fossil repositories both require this. Default: off. |
| 2302 | ** |
| 2303 | ** max-loadavg Some CPU-intensive web pages (ex: /zip, /tarball, /blame) |
| 2304 | ** are disallowed if the system load average goes above this |
| 2305 | ** value. "0.0" means no limit. This only works on unix. |
| 2306 | ** Only local settings of this value make a difference since |
| 2307 | ** when running as a web-server, Fossil does not open the |
| 2308 | ** global configuration database. |
| 2309 | ** |
| 2310 | ** max-upload A limit on the size of uplink HTTP requests. The |
| 2311 | ** default is 250000 bytes. |
| 2312 | ** |
| 2313 | ** mtime-changes Use file modification times (mtimes) to detect when |
| 2314 |
+107
-58
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -29,17 +29,17 @@ | ||
| 29 | 29 | ** of the diff output. |
| 30 | 30 | */ |
| 31 | 31 | #define DIFF_CONTEXT_MASK ((u64)0x0000ffff) /* Lines of context. Default if 0 */ |
| 32 | 32 | #define DIFF_WIDTH_MASK ((u64)0x00ff0000) /* side-by-side column width */ |
| 33 | 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 */ | |
| 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 | 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 */ | |
| 38 | +#define DIFF_BRIEF ((u64)0x10000000) /* Show filenames only */ | |
| 39 | +#define DIFF_HTML ((u64)0x20000000) /* Render for HTML */ | |
| 40 | +#define DIFF_LINENO ((u64)0x40000000) /* Show line numbers */ | |
| 41 | 41 | #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */ |
| 42 | 42 | #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */ |
| 43 | 43 | #define DIFF_CONTEXT_EX (((u64)0x04)<<32) /* Use context even if zero */ |
| 44 | 44 | #define DIFF_NOTTOOBIG (((u64)0x08)<<32) /* Only display if not too big */ |
| 45 | 45 | |
| @@ -54,10 +54,13 @@ | ||
| 54 | 54 | "cannot compute difference between symlink and regular file\n" |
| 55 | 55 | |
| 56 | 56 | #define DIFF_TOO_MANY_CHANGES \ |
| 57 | 57 | "more than 10,000 changes\n" |
| 58 | 58 | |
| 59 | +#define DIFF_WHITESPACE_ONLY \ | |
| 60 | + "whitespace changes only\n" | |
| 61 | + | |
| 59 | 62 | /* |
| 60 | 63 | ** Maximum length of a line in a text file, in bytes. (2**13 = 8192 bytes) |
| 61 | 64 | */ |
| 62 | 65 | #define LENGTH_MASK_SZ 13 |
| 63 | 66 | #define LENGTH_MASK ((1<<LENGTH_MASK_SZ)-1) |
| @@ -73,10 +76,12 @@ | ||
| 73 | 76 | */ |
| 74 | 77 | typedef struct DLine DLine; |
| 75 | 78 | struct DLine { |
| 76 | 79 | const char *z; /* The text of the line */ |
| 77 | 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 */ | |
| 78 | 83 | unsigned int iNext; /* 1+(Index of next line with same the same hash) */ |
| 79 | 84 | |
| 80 | 85 | /* an array of DLine elements serves two purposes. The fields |
| 81 | 86 | ** above are one per line of input text. But each entry is also |
| 82 | 87 | ** a bucket in a hash table, as follows: */ |
| @@ -125,12 +130,12 @@ | ||
| 125 | 130 | ** too long. |
| 126 | 131 | ** |
| 127 | 132 | ** Profiling show that in most cases this routine consumes the bulk of |
| 128 | 133 | ** the CPU time on a diff. |
| 129 | 134 | */ |
| 130 | -static DLine *break_into_lines(const char *z, int n, int *pnLine, int ignoreWS){ | |
| 131 | - int nLine, i, j, k, x; | |
| 135 | +static DLine *break_into_lines(const char *z, int n, int *pnLine, u64 diffFlags){ | |
| 136 | + int nLine, i, j, k, s, x; | |
| 132 | 137 | unsigned int h, h2; |
| 133 | 138 | DLine *a; |
| 134 | 139 | |
| 135 | 140 | /* Count the number of lines. Allocate space to hold |
| 136 | 141 | ** the returned array. |
| @@ -158,18 +163,25 @@ | ||
| 158 | 163 | return a; |
| 159 | 164 | } |
| 160 | 165 | |
| 161 | 166 | /* Fill in the array */ |
| 162 | 167 | for(i=0; i<nLine; i++){ |
| 163 | - a[i].z = z; | |
| 164 | 168 | for(j=0; z[j] && z[j]!='\n'; j++){} |
| 165 | - k = j; | |
| 166 | - while( ignoreWS && k>0 && fossil_isspace(z[k-1]) ){ k--; } | |
| 167 | - for(h=0, x=0; x<=k; x++){ | |
| 169 | + a[i].z = z; | |
| 170 | + a[i].n = k = j; | |
| 171 | + s = 0; | |
| 172 | + if( diffFlags & DIFF_IGNORE_EOLWS ){ | |
| 173 | + while( k>0 && fossil_isspace(z[k-1]) ){ k--; } | |
| 174 | + } | |
| 175 | + if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){ | |
| 176 | + while( s<k && fossil_isspace(z[s]) ){ s++; } | |
| 177 | + } | |
| 178 | + a[i].indent = s; | |
| 179 | + for(h=0, x=s; x<k; x++){ | |
| 168 | 180 | h = h ^ (h<<2) ^ z[x]; |
| 169 | 181 | } |
| 170 | - a[i].h = h = (h<<LENGTH_MASK_SZ) | k;; | |
| 182 | + a[i].h = h = (h<<LENGTH_MASK_SZ) | (k-s); | |
| 171 | 183 | h2 = h % nLine; |
| 172 | 184 | a[i].iNext = a[h2].iHash; |
| 173 | 185 | a[h2].iHash = i+1; |
| 174 | 186 | z += j+1; |
| 175 | 187 | } |
| @@ -181,11 +193,12 @@ | ||
| 181 | 193 | |
| 182 | 194 | /* |
| 183 | 195 | ** Return true if two DLine elements are identical. |
| 184 | 196 | */ |
| 185 | 197 | static int same_dline(DLine *pA, DLine *pB){ |
| 186 | - return pA->h==pB->h && memcmp(pA->z,pB->z,pA->h & LENGTH_MASK)==0; | |
| 198 | + return pA->h==pB->h && memcmp(pA->z+pA->indent,pB->z+pB->indent, | |
| 199 | + pA->h & LENGTH_MASK)==0; | |
| 187 | 200 | } |
| 188 | 201 | |
| 189 | 202 | /* |
| 190 | 203 | ** Return true if the regular expression *pRe matches any of the |
| 191 | 204 | ** N dlines |
| @@ -221,16 +234,16 @@ | ||
| 221 | 234 | }else if( cPrefix=='+' ){ |
| 222 | 235 | blob_append(pOut, "<span class=\"diffadd\">", -1); |
| 223 | 236 | }else if( cPrefix=='-' ){ |
| 224 | 237 | blob_append(pOut, "<span class=\"diffrm\">", -1); |
| 225 | 238 | } |
| 226 | - htmlize_to_blob(pOut, pLine->z, (pLine->h & LENGTH_MASK)); | |
| 239 | + htmlize_to_blob(pOut, pLine->z, pLine->n); | |
| 227 | 240 | if( cPrefix!=' ' ){ |
| 228 | 241 | blob_append(pOut, "</span>", -1); |
| 229 | 242 | } |
| 230 | 243 | }else{ |
| 231 | - blob_append(pOut, pLine->z, pLine->h & LENGTH_MASK); | |
| 244 | + blob_append(pOut, pLine->z, pLine->n); | |
| 232 | 245 | } |
| 233 | 246 | blob_append(pOut, "\n", 1); |
| 234 | 247 | } |
| 235 | 248 | |
| 236 | 249 | /* |
| @@ -402,11 +415,11 @@ | ||
| 402 | 415 | b += m; |
| 403 | 416 | if( i<nr-1 ){ |
| 404 | 417 | m = R[r+i*3+3]; |
| 405 | 418 | for(j=0; j<m; j++){ |
| 406 | 419 | if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html); |
| 407 | - appendDiffLine(pOut, ' ', &B[b+j], html, 0); | |
| 420 | + appendDiffLine(pOut, ' ', &A[a+j], html, 0); | |
| 408 | 421 | } |
| 409 | 422 | b += m; |
| 410 | 423 | a += m; |
| 411 | 424 | } |
| 412 | 425 | } |
| @@ -415,11 +428,11 @@ | ||
| 415 | 428 | assert( nr==i ); |
| 416 | 429 | m = R[r+nr*3]; |
| 417 | 430 | if( m>nContext ) m = nContext; |
| 418 | 431 | for(j=0; j<m; j++){ |
| 419 | 432 | if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html); |
| 420 | - appendDiffLine(pOut, ' ', &B[b+j], html, 0); | |
| 433 | + appendDiffLine(pOut, ' ', &A[a+j], html, 0); | |
| 421 | 434 | } |
| 422 | 435 | } |
| 423 | 436 | } |
| 424 | 437 | |
| 425 | 438 | /* |
| @@ -476,11 +489,11 @@ | ||
| 476 | 489 | ** This comment contains multibyte unicode characters (ü, Æ, ð) in order |
| 477 | 490 | ** to test the ability of the diff code to handle such characters. |
| 478 | 491 | */ |
| 479 | 492 | static void sbsWriteText(SbsLine *p, DLine *pLine, int col){ |
| 480 | 493 | Blob *pCol = p->apCols[col]; |
| 481 | - int n = pLine->h & LENGTH_MASK; | |
| 494 | + int n = pLine->n; | |
| 482 | 495 | int i; /* Number of input characters consumed */ |
| 483 | 496 | int k; /* Cursor position */ |
| 484 | 497 | int needEndSpan = 0; |
| 485 | 498 | const char *zIn = pLine->z; |
| 486 | 499 | int w = p->width; |
| @@ -1305,11 +1318,11 @@ | ||
| 1305 | 1318 | sbsWriteMarker(&s, " ", ""); |
| 1306 | 1319 | sbsWriteLineno(&s, b+j, SBS_LNB); |
| 1307 | 1320 | sbsWriteText(&s, &B[b+j], SBS_TXTB); |
| 1308 | 1321 | } |
| 1309 | 1322 | } |
| 1310 | - | |
| 1323 | + | |
| 1311 | 1324 | if( s.escHtml && blob_size(s.apCols[SBS_LNA])>0 ){ |
| 1312 | 1325 | blob_append(pOut, "<table class=\"sbsdiffcols\"><tr>\n", -1); |
| 1313 | 1326 | for(i=SBS_LNA; i<=SBS_TXTB; i++){ |
| 1314 | 1327 | sbsWriteColumn(pOut, s.apCols[i], i); |
| 1315 | 1328 | blob_reset(s.apCols[i]); |
| @@ -1753,28 +1766,28 @@ | ||
| 1753 | 1766 | Blob *pB_Blob, /* TO file */ |
| 1754 | 1767 | Blob *pOut, /* Write diff here if not NULL */ |
| 1755 | 1768 | ReCompiled *pRe, /* Only output changes where this Regexp matches */ |
| 1756 | 1769 | u64 diffFlags /* DIFF_* flags defined above */ |
| 1757 | 1770 | ){ |
| 1758 | - int ignoreEolWs; /* Ignore whitespace at the end of lines */ | |
| 1771 | + int ignoreWs; /* Ignore whitespace */ | |
| 1759 | 1772 | DContext c; |
| 1760 | 1773 | |
| 1761 | 1774 | if( diffFlags & DIFF_INVERT ){ |
| 1762 | 1775 | Blob *pTemp = pA_Blob; |
| 1763 | 1776 | pA_Blob = pB_Blob; |
| 1764 | 1777 | pB_Blob = pTemp; |
| 1765 | 1778 | } |
| 1766 | - ignoreEolWs = (diffFlags & DIFF_IGNORE_EOLWS)!=0; | |
| 1779 | + ignoreWs = (diffFlags & DIFF_IGNORE_ALLWS)!=0; | |
| 1767 | 1780 | blob_to_utf8_no_bom(pA_Blob, 0); |
| 1768 | 1781 | blob_to_utf8_no_bom(pB_Blob, 0); |
| 1769 | 1782 | |
| 1770 | 1783 | /* Prepare the input files */ |
| 1771 | 1784 | memset(&c, 0, sizeof(c)); |
| 1772 | 1785 | c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob), |
| 1773 | - &c.nFrom, ignoreEolWs); | |
| 1786 | + &c.nFrom, diffFlags); | |
| 1774 | 1787 | c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob), |
| 1775 | - &c.nTo, ignoreEolWs); | |
| 1788 | + &c.nTo, diffFlags); | |
| 1776 | 1789 | if( c.aFrom==0 || c.aTo==0 ){ |
| 1777 | 1790 | fossil_free(c.aFrom); |
| 1778 | 1791 | fossil_free(c.aTo); |
| 1779 | 1792 | if( pOut ){ |
| 1780 | 1793 | diff_errmsg(pOut, DIFF_CANNOT_COMPUTE_BINARY, diffFlags); |
| @@ -1782,20 +1795,27 @@ | ||
| 1782 | 1795 | return 0; |
| 1783 | 1796 | } |
| 1784 | 1797 | |
| 1785 | 1798 | /* Compute the difference */ |
| 1786 | 1799 | diff_all(&c); |
| 1800 | + if( ignoreWs && c.nEdit==6 && c.aEdit[1]==0 && c.aEdit[2]==0 ){ | |
| 1801 | + fossil_free(c.aFrom); | |
| 1802 | + fossil_free(c.aTo); | |
| 1803 | + fossil_free(c.aEdit); | |
| 1804 | + if( pOut ) diff_errmsg(pOut, DIFF_WHITESPACE_ONLY, diffFlags); | |
| 1805 | + return 0; | |
| 1806 | + } | |
| 1787 | 1807 | if( (diffFlags & DIFF_NOTTOOBIG)!=0 ){ |
| 1788 | 1808 | int i, m, n; |
| 1789 | 1809 | int *a = c.aEdit; |
| 1790 | 1810 | int mx = c.nEdit; |
| 1791 | 1811 | for(i=m=n=0; i<mx; i+=3){ m += a[i]; n += a[i+1]+a[i+2]; } |
| 1792 | 1812 | if( n>10000 ){ |
| 1793 | 1813 | fossil_free(c.aFrom); |
| 1794 | 1814 | fossil_free(c.aTo); |
| 1795 | 1815 | fossil_free(c.aEdit); |
| 1796 | - diff_errmsg(pOut, DIFF_TOO_MANY_CHANGES, diffFlags); | |
| 1816 | + if( pOut ) diff_errmsg(pOut, DIFF_TOO_MANY_CHANGES, diffFlags); | |
| 1797 | 1817 | return 0; |
| 1798 | 1818 | } |
| 1799 | 1819 | } |
| 1800 | 1820 | if( (diffFlags & DIFF_NOOPT)==0 ){ |
| 1801 | 1821 | diff_optimize(&c); |
| @@ -1824,19 +1844,21 @@ | ||
| 1824 | 1844 | |
| 1825 | 1845 | /* |
| 1826 | 1846 | ** Process diff-related command-line options and return an appropriate |
| 1827 | 1847 | ** "diffFlags" integer. |
| 1828 | 1848 | ** |
| 1829 | -** --brief Show filenames only DIFF_BRIEF | |
| 1830 | -** --context|-c N N lines of context. DIFF_CONTEXT_MASK | |
| 1831 | -** --html Format for HTML DIFF_HTML | |
| 1832 | -** --invert Invert the diff DIFF_INVERT | |
| 1833 | -** --linenum|-n Show line numbers DIFF_LINENO | |
| 1834 | -** --noopt Disable optimization DIFF_NOOPT | |
| 1835 | -** --side-by-side|-y Side-by-side diff. DIFF_SIDEBYSIDE | |
| 1836 | -** --unified Unified diff. ~DIFF_SIDEBYSIDE | |
| 1837 | -** --width|-W N N character lines. DIFF_WIDTH_MASK | |
| 1849 | +** --brief Show filenames only DIFF_BRIEF | |
| 1850 | +** -c|--context N N lines of context. DIFF_CONTEXT_MASK | |
| 1851 | +** --html Format for HTML DIFF_HTML | |
| 1852 | +** --invert Invert the diff DIFF_INVERT | |
| 1853 | +** -n|--linenum Show line numbers DIFF_LINENO | |
| 1854 | +** --noopt Disable optimization DIFF_NOOPT | |
| 1855 | +** --unified Unified diff. ~DIFF_SIDEBYSIDE | |
| 1856 | +** -w|--ignore-all-space Ignore all whitespaces DIFF_IGNORE_ALLWS | |
| 1857 | +** --width|-W N N character lines. DIFF_WIDTH_MASK | |
| 1858 | +** -y|--side-by-side Side-by-side diff. DIFF_SIDEBYSIDE | |
| 1859 | +** -Z|--ignore-trailing-space Ignore eol-whitespaces DIFF_IGNORE_EOLWS | |
| 1838 | 1860 | */ |
| 1839 | 1861 | u64 diff_options(void){ |
| 1840 | 1862 | u64 diffFlags = 0; |
| 1841 | 1863 | const char *z; |
| 1842 | 1864 | int f; |
| @@ -1850,10 +1872,12 @@ | ||
| 1850 | 1872 | f *= DIFF_CONTEXT_MASK+1; |
| 1851 | 1873 | if( f > DIFF_WIDTH_MASK ) f = DIFF_CONTEXT_MASK; |
| 1852 | 1874 | diffFlags |= f; |
| 1853 | 1875 | } |
| 1854 | 1876 | if( find_option("html",0,0)!=0 ) diffFlags |= DIFF_HTML; |
| 1877 | + if( find_option("ignore-trailing-space","Z",0)!=0 ) diffFlags |= DIFF_IGNORE_EOLWS; | |
| 1878 | + if( find_option("ignore-all-space","w",0)!=0 ) diffFlags |= DIFF_IGNORE_ALLWS; | |
| 1855 | 1879 | if( find_option("linenum","n",0)!=0 ) diffFlags |= DIFF_LINENO; |
| 1856 | 1880 | if( find_option("noopt",0,0)!=0 ) diffFlags |= DIFF_NOOPT; |
| 1857 | 1881 | if( find_option("invert",0,0)!=0 ) diffFlags |= DIFF_INVERT; |
| 1858 | 1882 | if( find_option("brief",0,0)!=0 ) diffFlags |= DIFF_BRIEF; |
| 1859 | 1883 | return diffFlags; |
| @@ -1952,22 +1976,23 @@ | ||
| 1952 | 1976 | /* |
| 1953 | 1977 | ** Initialize the annotation process by specifying the file that is |
| 1954 | 1978 | ** to be annotated. The annotator takes control of the input Blob and |
| 1955 | 1979 | ** will release it when it is finished with it. |
| 1956 | 1980 | */ |
| 1957 | -static int annotation_start(Annotator *p, Blob *pInput){ | |
| 1981 | +static int annotation_start(Annotator *p, Blob *pInput, u64 diffFlags){ | |
| 1958 | 1982 | int i; |
| 1959 | 1983 | |
| 1960 | 1984 | memset(p, 0, sizeof(*p)); |
| 1961 | - p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo,1); | |
| 1985 | + p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo, | |
| 1986 | + diffFlags); | |
| 1962 | 1987 | if( p->c.aTo==0 ){ |
| 1963 | 1988 | return 1; |
| 1964 | 1989 | } |
| 1965 | 1990 | p->aOrig = fossil_malloc( sizeof(p->aOrig[0])*p->c.nTo ); |
| 1966 | 1991 | for(i=0; i<p->c.nTo; i++){ |
| 1967 | 1992 | p->aOrig[i].z = p->c.aTo[i].z; |
| 1968 | - p->aOrig[i].n = p->c.aTo[i].h & LENGTH_MASK; | |
| 1993 | + p->aOrig[i].n = p->c.aTo[i].n; | |
| 1969 | 1994 | p->aOrig[i].iVers = -1; |
| 1970 | 1995 | } |
| 1971 | 1996 | p->nOrig = p->c.nTo; |
| 1972 | 1997 | return 0; |
| 1973 | 1998 | } |
| @@ -1977,17 +2002,17 @@ | ||
| 1977 | 2002 | ** being annotated. Do another step of the annotation. Return true |
| 1978 | 2003 | ** if additional annotation is required. zPName is the tag to insert |
| 1979 | 2004 | ** on each line of the file being annotated that was contributed by |
| 1980 | 2005 | ** pParent. Memory to hold zPName is leaked. |
| 1981 | 2006 | */ |
| 1982 | -static int annotation_step(Annotator *p, Blob *pParent, int iVers){ | |
| 2007 | +static int annotation_step(Annotator *p, Blob *pParent, int iVers, u64 diffFlags){ | |
| 1983 | 2008 | int i, j; |
| 1984 | 2009 | int lnTo; |
| 1985 | 2010 | |
| 1986 | 2011 | /* Prepare the parent file to be diffed */ |
| 1987 | 2012 | p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent), |
| 1988 | - &p->c.nFrom, 1); | |
| 2013 | + &p->c.nFrom, diffFlags); | |
| 1989 | 2014 | if( p->c.aFrom==0 ){ |
| 1990 | 2015 | return 1; |
| 1991 | 2016 | } |
| 1992 | 2017 | |
| 1993 | 2018 | /* Compute the differences going from pParent to the file being |
| @@ -2020,13 +2045,13 @@ | ||
| 2020 | 2045 | /* Return no errors */ |
| 2021 | 2046 | return 0; |
| 2022 | 2047 | } |
| 2023 | 2048 | |
| 2024 | 2049 | |
| 2025 | -/* Annotation flags */ | |
| 2026 | -#define ANN_FILE_VERS 0x01 /* Show file vers rather than commit vers */ | |
| 2027 | -#define ANN_FILE_ANCEST 0x02 /* Prefer check-ins in the ANCESTOR table */ | |
| 2050 | +/* Annotation flags (any DIFF flag can be used as Annotation flag as well) */ | |
| 2051 | +#define ANN_FILE_VERS (((u64)0x20)<<32) /* Show file vers rather than commit vers */ | |
| 2052 | +#define ANN_FILE_ANCEST (((u64)0x40)<<32) /* Prefer check-ins in the ANCESTOR table */ | |
| 2028 | 2053 | |
| 2029 | 2054 | /* |
| 2030 | 2055 | ** Compute a complete annotation on a file. The file is identified |
| 2031 | 2056 | ** by its filename number (filename.fnid) and the baseline in which |
| 2032 | 2057 | ** it was checked in (mlink.mid). |
| @@ -2034,11 +2059,11 @@ | ||
| 2034 | 2059 | static void annotate_file( |
| 2035 | 2060 | Annotator *p, /* The annotator */ |
| 2036 | 2061 | int fnid, /* The name of the file to be annotated */ |
| 2037 | 2062 | int mid, /* Use the version of the file in this check-in */ |
| 2038 | 2063 | int iLimit, /* Limit the number of levels if greater than zero */ |
| 2039 | - int annFlags /* Flags to alter the annotation */ | |
| 2064 | + u64 annFlags /* Flags to alter the annotation */ | |
| 2040 | 2065 | ){ |
| 2041 | 2066 | Blob toAnnotate; /* Text of the final (mid) version of the file */ |
| 2042 | 2067 | Blob step; /* Text of previous revision */ |
| 2043 | 2068 | int rid; /* Artifact ID of the file being annotated */ |
| 2044 | 2069 | Stmt q; /* Query returning all ancestor versions */ |
| @@ -2052,11 +2077,12 @@ | ||
| 2052 | 2077 | } |
| 2053 | 2078 | if( !content_get(rid, &toAnnotate) ){ |
| 2054 | 2079 | fossil_fatal("unable to retrieve content of artifact #%d", rid); |
| 2055 | 2080 | } |
| 2056 | 2081 | if( iLimit<=0 ) iLimit = 1000000000; |
| 2057 | - annotation_start(p, &toAnnotate); | |
| 2082 | + blob_to_utf8_no_bom(&toAnnotate, 0); | |
| 2083 | + annotation_start(p, &toAnnotate, annFlags); | |
| 2058 | 2084 | db_begin_transaction(); |
| 2059 | 2085 | db_multi_exec( |
| 2060 | 2086 | "CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);" |
| 2061 | 2087 | "DELETE FROM vseen;" |
| 2062 | 2088 | ); |
| @@ -2086,11 +2112,12 @@ | ||
| 2086 | 2112 | p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1)); |
| 2087 | 2113 | p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2)); |
| 2088 | 2114 | p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3)); |
| 2089 | 2115 | if( p->nVers ){ |
| 2090 | 2116 | content_get(rid, &step); |
| 2091 | - annotation_step(p, &step, p->nVers-1); | |
| 2117 | + blob_to_utf8_no_bom(&step, 0); | |
| 2118 | + annotation_step(p, &step, p->nVers-1, annFlags); | |
| 2092 | 2119 | blob_reset(&step); |
| 2093 | 2120 | } |
| 2094 | 2121 | p->nVers++; |
| 2095 | 2122 | db_bind_int(&ins, ":rid", rid); |
| 2096 | 2123 | db_step(&ins); |
| @@ -2126,10 +2153,11 @@ | ||
| 2126 | 2153 | } |
| 2127 | 2154 | |
| 2128 | 2155 | /* |
| 2129 | 2156 | ** WEBPAGE: annotate |
| 2130 | 2157 | ** WEBPAGE: blame |
| 2158 | +** WEBPAGE: praise | |
| 2131 | 2159 | ** |
| 2132 | 2160 | ** Query parameters: |
| 2133 | 2161 | ** |
| 2134 | 2162 | ** checkin=ID The manifest ID at which to start the annotation |
| 2135 | 2163 | ** filename=FILENAME The filename. |
| @@ -2140,31 +2168,35 @@ | ||
| 2140 | 2168 | void annotation_page(void){ |
| 2141 | 2169 | int mid; |
| 2142 | 2170 | int fnid; |
| 2143 | 2171 | int i; |
| 2144 | 2172 | int iLimit; /* Depth limit */ |
| 2145 | - int annFlags = ANN_FILE_ANCEST; | |
| 2173 | + u64 annFlags = ANN_FILE_ANCEST; | |
| 2146 | 2174 | int showLog = 0; /* True to display the log */ |
| 2175 | + int ignoreWs = 0; /* Ignore whitespace */ | |
| 2147 | 2176 | const char *zFilename; /* Name of file to annotate */ |
| 2148 | 2177 | const char *zCI; /* The check-in containing zFilename */ |
| 2149 | 2178 | Annotator ann; |
| 2150 | 2179 | HQuery url; |
| 2151 | 2180 | struct AnnVers *p; |
| 2152 | 2181 | unsigned clr1, clr2, clr; |
| 2153 | - int bBlame = g.zPath[0]=='b';/* True for BLAME output. False for ANNOTATE. */ | |
| 2182 | + int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */ | |
| 2154 | 2183 | |
| 2155 | 2184 | /* Gather query parameters */ |
| 2156 | 2185 | showLog = atoi(PD("log","1")); |
| 2157 | 2186 | login_check_credentials(); |
| 2158 | 2187 | if( !g.perm.Read ){ login_needed(); return; } |
| 2159 | 2188 | if( exclude_spiders("annotate") ) return; |
| 2189 | + load_control(); | |
| 2160 | 2190 | mid = name_to_typed_rid(PD("checkin","0"),"ci"); |
| 2161 | 2191 | zFilename = P("filename"); |
| 2162 | 2192 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); |
| 2163 | 2193 | if( mid==0 || fnid==0 ){ fossil_redirect_home(); } |
| 2164 | 2194 | iLimit = atoi(PD("limit","20")); |
| 2165 | 2195 | if( P("filevers") ) annFlags |= ANN_FILE_VERS; |
| 2196 | + ignoreWs = P("w")!=0; | |
| 2197 | + if( ignoreWs ) annFlags |= DIFF_IGNORE_ALLWS; | |
| 2166 | 2198 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ |
| 2167 | 2199 | fossil_redirect_home(); |
| 2168 | 2200 | } |
| 2169 | 2201 | |
| 2170 | 2202 | /* compute the annotation */ |
| @@ -2172,17 +2204,29 @@ | ||
| 2172 | 2204 | annotate_file(&ann, fnid, mid, iLimit, annFlags); |
| 2173 | 2205 | zCI = ann.aVers[0].zMUuid; |
| 2174 | 2206 | |
| 2175 | 2207 | /* generate the web page */ |
| 2176 | 2208 | style_header("Annotation For %h", zFilename); |
| 2177 | - url_initialize(&url, "annotate"); | |
| 2209 | + if( bBlame ){ | |
| 2210 | + url_initialize(&url, "blame"); | |
| 2211 | + }else{ | |
| 2212 | + url_initialize(&url, "annotate"); | |
| 2213 | + } | |
| 2178 | 2214 | url_add_parameter(&url, "checkin", P("checkin")); |
| 2179 | 2215 | url_add_parameter(&url, "filename", zFilename); |
| 2180 | 2216 | if( iLimit!=20 ){ |
| 2181 | 2217 | url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit)); |
| 2182 | 2218 | } |
| 2183 | 2219 | url_add_parameter(&url, "log", showLog ? "1" : "0"); |
| 2220 | + if( ignoreWs ){ | |
| 2221 | + url_add_parameter(&url, "w", ""); | |
| 2222 | + style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes", | |
| 2223 | + "%s", url_render(&url, "w", 0, 0, 0)); | |
| 2224 | + }else{ | |
| 2225 | + style_submenu_element("Ignore Whitespace", "Ignore Whitespace", | |
| 2226 | + "%s", url_render(&url, "w", "", 0, 0)); | |
| 2227 | + } | |
| 2184 | 2228 | if( showLog ){ |
| 2185 | 2229 | style_submenu_element("Hide Log", "Hide Log", |
| 2186 | 2230 | "%s", url_render(&url, "log", "0", 0, 0)); |
| 2187 | 2231 | }else{ |
| 2188 | 2232 | style_submenu_element("Show Log", "Show Log", |
| @@ -2208,11 +2252,11 @@ | ||
| 2208 | 2252 | clr2 = 0xb5e0ff; /* Older changes: blue (cold) */ |
| 2209 | 2253 | } |
| 2210 | 2254 | for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){ |
| 2211 | 2255 | clr = gradient_color(clr1, clr2, ann.nVers-1, i); |
| 2212 | 2256 | ann.aVers[i].zBgColor = mprintf("#%06x", clr); |
| 2213 | - } | |
| 2257 | + } | |
| 2214 | 2258 | |
| 2215 | 2259 | if( showLog ){ |
| 2216 | 2260 | char *zLink = href("%R/finfo?name=%t&ci=%S",zFilename,zCI); |
| 2217 | 2261 | @ <h2>Ancestors of %z(zLink)%h(zFilename)</a> analyzed:</h2> |
| 2218 | 2262 | @ <ol> |
| @@ -2238,11 +2282,11 @@ | ||
| 2238 | 2282 | } |
| 2239 | 2283 | @ </ol> |
| 2240 | 2284 | @ <hr> |
| 2241 | 2285 | } |
| 2242 | 2286 | if( !ann.bLimit ){ |
| 2243 | - @ <h2>Origin for each line in | |
| 2287 | + @ <h2>Origin for each line in | |
| 2244 | 2288 | @ %z(href("%R/finfo?name=%h&ci=%S", zFilename, zCI))%h(zFilename)</a> |
| 2245 | 2289 | @ from check-in %z(href("%R/info/%S",zCI))%S(zCI)</a>:</h2> |
| 2246 | 2290 | iLimit = ann.nVers+10; |
| 2247 | 2291 | }else{ |
| 2248 | 2292 | @ <h2>Lines added by the %d(iLimit) most recent ancestors of |
| @@ -2291,22 +2335,25 @@ | ||
| 2291 | 2335 | } |
| 2292 | 2336 | |
| 2293 | 2337 | /* |
| 2294 | 2338 | ** COMMAND: annotate |
| 2295 | 2339 | ** COMMAND: blame |
| 2340 | +** COMMAND: praise | |
| 2296 | 2341 | ** |
| 2297 | -** %fossil (annotate|blame) ?OPTIONS? FILENAME | |
| 2342 | +** %fossil (annotate|blame|praise) ?OPTIONS? FILENAME | |
| 2298 | 2343 | ** |
| 2299 | 2344 | ** Output the text of a file with markings to show when each line of |
| 2300 | 2345 | ** the file was last modified. The "annotate" command shows line numbers |
| 2301 | -** and omits the username. The "blame" command shows the user who made each | |
| 2302 | -** checkin and omits the line number. | |
| 2346 | +** and omits the username. The "blame" and "praise" commands show the user | |
| 2347 | +** who made each checkin and omits the line number. | |
| 2303 | 2348 | ** |
| 2304 | 2349 | ** Options: |
| 2305 | -** --filevers Show file version numbers rather than check-in versions | |
| 2306 | -** -l|--log List all versions analyzed | |
| 2307 | -** -n|--limit N Only look backwards in time by N versions | |
| 2350 | +** --filevers Show file version numbers rather than check-in versions | |
| 2351 | +** -l|--log List all versions analyzed | |
| 2352 | +** -n|--limit N Only look backwards in time by N versions | |
| 2353 | +** -Z|--ignore-trailing-space Ignore eol-whitespaces | |
| 2354 | +** -w|--ignore-all-space Ignore all whitespaces | |
| 2308 | 2355 | ** |
| 2309 | 2356 | ** See also: info, finfo, timeline |
| 2310 | 2357 | */ |
| 2311 | 2358 | void annotate_cmd(void){ |
| 2312 | 2359 | int fnid; /* Filename ID */ |
| @@ -2319,18 +2366,20 @@ | ||
| 2319 | 2366 | int i; /* Loop counter */ |
| 2320 | 2367 | const char *zLimit; /* The value to the -n|--limit option */ |
| 2321 | 2368 | int iLimit; /* How far back in time to look */ |
| 2322 | 2369 | int showLog; /* True to show the log */ |
| 2323 | 2370 | int fileVers; /* Show file version instead of check-in versions */ |
| 2324 | - int annFlags = 0; /* Flags to control annotation properties */ | |
| 2371 | + u64 annFlags = 0; /* Flags to control annotation properties */ | |
| 2325 | 2372 | int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */ |
| 2326 | 2373 | |
| 2327 | - bBlame = g.argv[1][0]=='b'; | |
| 2374 | + bBlame = g.argv[1][0]!='a'; | |
| 2328 | 2375 | zLimit = find_option("limit","n",1); |
| 2329 | 2376 | if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1"; |
| 2330 | 2377 | iLimit = atoi(zLimit); |
| 2331 | 2378 | showLog = find_option("log","l",0)!=0; |
| 2379 | + if( find_option("ignore-trailing-space","Z",0)!=0 ) annFlags |= DIFF_IGNORE_EOLWS; | |
| 2380 | + if( find_option("ignore-all-space","w",0)!=0 ) annFlags |= DIFF_IGNORE_ALLWS; | |
| 2332 | 2381 | fileVers = find_option("filevers",0,0)!=0; |
| 2333 | 2382 | db_must_be_within_tree(); |
| 2334 | 2383 | if( g.argc<3 ) { |
| 2335 | 2384 | usage("FILENAME"); |
| 2336 | 2385 | } |
| 2337 | 2386 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -29,17 +29,17 @@ | |
| 29 | ** of the diff output. |
| 30 | */ |
| 31 | #define DIFF_CONTEXT_MASK ((u64)0x0000ffff) /* Lines of context. Default if 0 */ |
| 32 | #define DIFF_WIDTH_MASK ((u64)0x00ff0000) /* side-by-side column width */ |
| 33 | #define DIFF_IGNORE_EOLWS ((u64)0x01000000) /* Ignore end-of-line whitespace */ |
| 34 | #define DIFF_SIDEBYSIDE ((u64)0x02000000) /* Generate a side-by-side diff */ |
| 35 | #define DIFF_VERBOSE ((u64)0x04000000) /* Missing shown as empty files */ |
| 36 | #define DIFF_BRIEF ((u64)0x08000000) /* Show filenames only */ |
| 37 | #define DIFF_INLINE ((u64)0x00000000) /* Inline (not side-by-side) diff */ |
| 38 | #define DIFF_HTML ((u64)0x10000000) /* Render for HTML */ |
| 39 | #define DIFF_LINENO ((u64)0x20000000) /* Show line numbers */ |
| 40 | #define DIFF_WS_WARNING ((u64)0x40000000) /* Warn about whitespace */ |
| 41 | #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */ |
| 42 | #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */ |
| 43 | #define DIFF_CONTEXT_EX (((u64)0x04)<<32) /* Use context even if zero */ |
| 44 | #define DIFF_NOTTOOBIG (((u64)0x08)<<32) /* Only display if not too big */ |
| 45 | |
| @@ -54,10 +54,13 @@ | |
| 54 | "cannot compute difference between symlink and regular file\n" |
| 55 | |
| 56 | #define DIFF_TOO_MANY_CHANGES \ |
| 57 | "more than 10,000 changes\n" |
| 58 | |
| 59 | /* |
| 60 | ** Maximum length of a line in a text file, in bytes. (2**13 = 8192 bytes) |
| 61 | */ |
| 62 | #define LENGTH_MASK_SZ 13 |
| 63 | #define LENGTH_MASK ((1<<LENGTH_MASK_SZ)-1) |
| @@ -73,10 +76,12 @@ | |
| 73 | */ |
| 74 | typedef struct DLine DLine; |
| 75 | struct DLine { |
| 76 | const char *z; /* The text of the line */ |
| 77 | unsigned int h; /* Hash of the line */ |
| 78 | unsigned int iNext; /* 1+(Index of next line with same the same hash) */ |
| 79 | |
| 80 | /* an array of DLine elements serves two purposes. The fields |
| 81 | ** above are one per line of input text. But each entry is also |
| 82 | ** a bucket in a hash table, as follows: */ |
| @@ -125,12 +130,12 @@ | |
| 125 | ** too long. |
| 126 | ** |
| 127 | ** Profiling show that in most cases this routine consumes the bulk of |
| 128 | ** the CPU time on a diff. |
| 129 | */ |
| 130 | static DLine *break_into_lines(const char *z, int n, int *pnLine, int ignoreWS){ |
| 131 | int nLine, i, j, k, x; |
| 132 | unsigned int h, h2; |
| 133 | DLine *a; |
| 134 | |
| 135 | /* Count the number of lines. Allocate space to hold |
| 136 | ** the returned array. |
| @@ -158,18 +163,25 @@ | |
| 158 | return a; |
| 159 | } |
| 160 | |
| 161 | /* Fill in the array */ |
| 162 | for(i=0; i<nLine; i++){ |
| 163 | a[i].z = z; |
| 164 | for(j=0; z[j] && z[j]!='\n'; j++){} |
| 165 | k = j; |
| 166 | while( ignoreWS && k>0 && fossil_isspace(z[k-1]) ){ k--; } |
| 167 | for(h=0, x=0; x<=k; x++){ |
| 168 | h = h ^ (h<<2) ^ z[x]; |
| 169 | } |
| 170 | a[i].h = h = (h<<LENGTH_MASK_SZ) | k;; |
| 171 | h2 = h % nLine; |
| 172 | a[i].iNext = a[h2].iHash; |
| 173 | a[h2].iHash = i+1; |
| 174 | z += j+1; |
| 175 | } |
| @@ -181,11 +193,12 @@ | |
| 181 | |
| 182 | /* |
| 183 | ** Return true if two DLine elements are identical. |
| 184 | */ |
| 185 | static int same_dline(DLine *pA, DLine *pB){ |
| 186 | return pA->h==pB->h && memcmp(pA->z,pB->z,pA->h & LENGTH_MASK)==0; |
| 187 | } |
| 188 | |
| 189 | /* |
| 190 | ** Return true if the regular expression *pRe matches any of the |
| 191 | ** N dlines |
| @@ -221,16 +234,16 @@ | |
| 221 | }else if( cPrefix=='+' ){ |
| 222 | blob_append(pOut, "<span class=\"diffadd\">", -1); |
| 223 | }else if( cPrefix=='-' ){ |
| 224 | blob_append(pOut, "<span class=\"diffrm\">", -1); |
| 225 | } |
| 226 | htmlize_to_blob(pOut, pLine->z, (pLine->h & LENGTH_MASK)); |
| 227 | if( cPrefix!=' ' ){ |
| 228 | blob_append(pOut, "</span>", -1); |
| 229 | } |
| 230 | }else{ |
| 231 | blob_append(pOut, pLine->z, pLine->h & LENGTH_MASK); |
| 232 | } |
| 233 | blob_append(pOut, "\n", 1); |
| 234 | } |
| 235 | |
| 236 | /* |
| @@ -402,11 +415,11 @@ | |
| 402 | b += m; |
| 403 | if( i<nr-1 ){ |
| 404 | m = R[r+i*3+3]; |
| 405 | for(j=0; j<m; j++){ |
| 406 | if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html); |
| 407 | appendDiffLine(pOut, ' ', &B[b+j], html, 0); |
| 408 | } |
| 409 | b += m; |
| 410 | a += m; |
| 411 | } |
| 412 | } |
| @@ -415,11 +428,11 @@ | |
| 415 | assert( nr==i ); |
| 416 | m = R[r+nr*3]; |
| 417 | if( m>nContext ) m = nContext; |
| 418 | for(j=0; j<m; j++){ |
| 419 | if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html); |
| 420 | appendDiffLine(pOut, ' ', &B[b+j], html, 0); |
| 421 | } |
| 422 | } |
| 423 | } |
| 424 | |
| 425 | /* |
| @@ -476,11 +489,11 @@ | |
| 476 | ** This comment contains multibyte unicode characters (ü, Æ, ð) in order |
| 477 | ** to test the ability of the diff code to handle such characters. |
| 478 | */ |
| 479 | static void sbsWriteText(SbsLine *p, DLine *pLine, int col){ |
| 480 | Blob *pCol = p->apCols[col]; |
| 481 | int n = pLine->h & LENGTH_MASK; |
| 482 | int i; /* Number of input characters consumed */ |
| 483 | int k; /* Cursor position */ |
| 484 | int needEndSpan = 0; |
| 485 | const char *zIn = pLine->z; |
| 486 | int w = p->width; |
| @@ -1305,11 +1318,11 @@ | |
| 1305 | sbsWriteMarker(&s, " ", ""); |
| 1306 | sbsWriteLineno(&s, b+j, SBS_LNB); |
| 1307 | sbsWriteText(&s, &B[b+j], SBS_TXTB); |
| 1308 | } |
| 1309 | } |
| 1310 | |
| 1311 | if( s.escHtml && blob_size(s.apCols[SBS_LNA])>0 ){ |
| 1312 | blob_append(pOut, "<table class=\"sbsdiffcols\"><tr>\n", -1); |
| 1313 | for(i=SBS_LNA; i<=SBS_TXTB; i++){ |
| 1314 | sbsWriteColumn(pOut, s.apCols[i], i); |
| 1315 | blob_reset(s.apCols[i]); |
| @@ -1753,28 +1766,28 @@ | |
| 1753 | Blob *pB_Blob, /* TO file */ |
| 1754 | Blob *pOut, /* Write diff here if not NULL */ |
| 1755 | ReCompiled *pRe, /* Only output changes where this Regexp matches */ |
| 1756 | u64 diffFlags /* DIFF_* flags defined above */ |
| 1757 | ){ |
| 1758 | int ignoreEolWs; /* Ignore whitespace at the end of lines */ |
| 1759 | DContext c; |
| 1760 | |
| 1761 | if( diffFlags & DIFF_INVERT ){ |
| 1762 | Blob *pTemp = pA_Blob; |
| 1763 | pA_Blob = pB_Blob; |
| 1764 | pB_Blob = pTemp; |
| 1765 | } |
| 1766 | ignoreEolWs = (diffFlags & DIFF_IGNORE_EOLWS)!=0; |
| 1767 | blob_to_utf8_no_bom(pA_Blob, 0); |
| 1768 | blob_to_utf8_no_bom(pB_Blob, 0); |
| 1769 | |
| 1770 | /* Prepare the input files */ |
| 1771 | memset(&c, 0, sizeof(c)); |
| 1772 | c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob), |
| 1773 | &c.nFrom, ignoreEolWs); |
| 1774 | c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob), |
| 1775 | &c.nTo, ignoreEolWs); |
| 1776 | if( c.aFrom==0 || c.aTo==0 ){ |
| 1777 | fossil_free(c.aFrom); |
| 1778 | fossil_free(c.aTo); |
| 1779 | if( pOut ){ |
| 1780 | diff_errmsg(pOut, DIFF_CANNOT_COMPUTE_BINARY, diffFlags); |
| @@ -1782,20 +1795,27 @@ | |
| 1782 | return 0; |
| 1783 | } |
| 1784 | |
| 1785 | /* Compute the difference */ |
| 1786 | diff_all(&c); |
| 1787 | if( (diffFlags & DIFF_NOTTOOBIG)!=0 ){ |
| 1788 | int i, m, n; |
| 1789 | int *a = c.aEdit; |
| 1790 | int mx = c.nEdit; |
| 1791 | for(i=m=n=0; i<mx; i+=3){ m += a[i]; n += a[i+1]+a[i+2]; } |
| 1792 | if( n>10000 ){ |
| 1793 | fossil_free(c.aFrom); |
| 1794 | fossil_free(c.aTo); |
| 1795 | fossil_free(c.aEdit); |
| 1796 | diff_errmsg(pOut, DIFF_TOO_MANY_CHANGES, diffFlags); |
| 1797 | return 0; |
| 1798 | } |
| 1799 | } |
| 1800 | if( (diffFlags & DIFF_NOOPT)==0 ){ |
| 1801 | diff_optimize(&c); |
| @@ -1824,19 +1844,21 @@ | |
| 1824 | |
| 1825 | /* |
| 1826 | ** Process diff-related command-line options and return an appropriate |
| 1827 | ** "diffFlags" integer. |
| 1828 | ** |
| 1829 | ** --brief Show filenames only DIFF_BRIEF |
| 1830 | ** --context|-c N N lines of context. DIFF_CONTEXT_MASK |
| 1831 | ** --html Format for HTML DIFF_HTML |
| 1832 | ** --invert Invert the diff DIFF_INVERT |
| 1833 | ** --linenum|-n Show line numbers DIFF_LINENO |
| 1834 | ** --noopt Disable optimization DIFF_NOOPT |
| 1835 | ** --side-by-side|-y Side-by-side diff. DIFF_SIDEBYSIDE |
| 1836 | ** --unified Unified diff. ~DIFF_SIDEBYSIDE |
| 1837 | ** --width|-W N N character lines. DIFF_WIDTH_MASK |
| 1838 | */ |
| 1839 | u64 diff_options(void){ |
| 1840 | u64 diffFlags = 0; |
| 1841 | const char *z; |
| 1842 | int f; |
| @@ -1850,10 +1872,12 @@ | |
| 1850 | f *= DIFF_CONTEXT_MASK+1; |
| 1851 | if( f > DIFF_WIDTH_MASK ) f = DIFF_CONTEXT_MASK; |
| 1852 | diffFlags |= f; |
| 1853 | } |
| 1854 | if( find_option("html",0,0)!=0 ) diffFlags |= DIFF_HTML; |
| 1855 | if( find_option("linenum","n",0)!=0 ) diffFlags |= DIFF_LINENO; |
| 1856 | if( find_option("noopt",0,0)!=0 ) diffFlags |= DIFF_NOOPT; |
| 1857 | if( find_option("invert",0,0)!=0 ) diffFlags |= DIFF_INVERT; |
| 1858 | if( find_option("brief",0,0)!=0 ) diffFlags |= DIFF_BRIEF; |
| 1859 | return diffFlags; |
| @@ -1952,22 +1976,23 @@ | |
| 1952 | /* |
| 1953 | ** Initialize the annotation process by specifying the file that is |
| 1954 | ** to be annotated. The annotator takes control of the input Blob and |
| 1955 | ** will release it when it is finished with it. |
| 1956 | */ |
| 1957 | static int annotation_start(Annotator *p, Blob *pInput){ |
| 1958 | int i; |
| 1959 | |
| 1960 | memset(p, 0, sizeof(*p)); |
| 1961 | p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo,1); |
| 1962 | if( p->c.aTo==0 ){ |
| 1963 | return 1; |
| 1964 | } |
| 1965 | p->aOrig = fossil_malloc( sizeof(p->aOrig[0])*p->c.nTo ); |
| 1966 | for(i=0; i<p->c.nTo; i++){ |
| 1967 | p->aOrig[i].z = p->c.aTo[i].z; |
| 1968 | p->aOrig[i].n = p->c.aTo[i].h & LENGTH_MASK; |
| 1969 | p->aOrig[i].iVers = -1; |
| 1970 | } |
| 1971 | p->nOrig = p->c.nTo; |
| 1972 | return 0; |
| 1973 | } |
| @@ -1977,17 +2002,17 @@ | |
| 1977 | ** being annotated. Do another step of the annotation. Return true |
| 1978 | ** if additional annotation is required. zPName is the tag to insert |
| 1979 | ** on each line of the file being annotated that was contributed by |
| 1980 | ** pParent. Memory to hold zPName is leaked. |
| 1981 | */ |
| 1982 | static int annotation_step(Annotator *p, Blob *pParent, int iVers){ |
| 1983 | int i, j; |
| 1984 | int lnTo; |
| 1985 | |
| 1986 | /* Prepare the parent file to be diffed */ |
| 1987 | p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent), |
| 1988 | &p->c.nFrom, 1); |
| 1989 | if( p->c.aFrom==0 ){ |
| 1990 | return 1; |
| 1991 | } |
| 1992 | |
| 1993 | /* Compute the differences going from pParent to the file being |
| @@ -2020,13 +2045,13 @@ | |
| 2020 | /* Return no errors */ |
| 2021 | return 0; |
| 2022 | } |
| 2023 | |
| 2024 | |
| 2025 | /* Annotation flags */ |
| 2026 | #define ANN_FILE_VERS 0x01 /* Show file vers rather than commit vers */ |
| 2027 | #define ANN_FILE_ANCEST 0x02 /* Prefer check-ins in the ANCESTOR table */ |
| 2028 | |
| 2029 | /* |
| 2030 | ** Compute a complete annotation on a file. The file is identified |
| 2031 | ** by its filename number (filename.fnid) and the baseline in which |
| 2032 | ** it was checked in (mlink.mid). |
| @@ -2034,11 +2059,11 @@ | |
| 2034 | static void annotate_file( |
| 2035 | Annotator *p, /* The annotator */ |
| 2036 | int fnid, /* The name of the file to be annotated */ |
| 2037 | int mid, /* Use the version of the file in this check-in */ |
| 2038 | int iLimit, /* Limit the number of levels if greater than zero */ |
| 2039 | int annFlags /* Flags to alter the annotation */ |
| 2040 | ){ |
| 2041 | Blob toAnnotate; /* Text of the final (mid) version of the file */ |
| 2042 | Blob step; /* Text of previous revision */ |
| 2043 | int rid; /* Artifact ID of the file being annotated */ |
| 2044 | Stmt q; /* Query returning all ancestor versions */ |
| @@ -2052,11 +2077,12 @@ | |
| 2052 | } |
| 2053 | if( !content_get(rid, &toAnnotate) ){ |
| 2054 | fossil_fatal("unable to retrieve content of artifact #%d", rid); |
| 2055 | } |
| 2056 | if( iLimit<=0 ) iLimit = 1000000000; |
| 2057 | annotation_start(p, &toAnnotate); |
| 2058 | db_begin_transaction(); |
| 2059 | db_multi_exec( |
| 2060 | "CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);" |
| 2061 | "DELETE FROM vseen;" |
| 2062 | ); |
| @@ -2086,11 +2112,12 @@ | |
| 2086 | p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1)); |
| 2087 | p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2)); |
| 2088 | p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3)); |
| 2089 | if( p->nVers ){ |
| 2090 | content_get(rid, &step); |
| 2091 | annotation_step(p, &step, p->nVers-1); |
| 2092 | blob_reset(&step); |
| 2093 | } |
| 2094 | p->nVers++; |
| 2095 | db_bind_int(&ins, ":rid", rid); |
| 2096 | db_step(&ins); |
| @@ -2126,10 +2153,11 @@ | |
| 2126 | } |
| 2127 | |
| 2128 | /* |
| 2129 | ** WEBPAGE: annotate |
| 2130 | ** WEBPAGE: blame |
| 2131 | ** |
| 2132 | ** Query parameters: |
| 2133 | ** |
| 2134 | ** checkin=ID The manifest ID at which to start the annotation |
| 2135 | ** filename=FILENAME The filename. |
| @@ -2140,31 +2168,35 @@ | |
| 2140 | void annotation_page(void){ |
| 2141 | int mid; |
| 2142 | int fnid; |
| 2143 | int i; |
| 2144 | int iLimit; /* Depth limit */ |
| 2145 | int annFlags = ANN_FILE_ANCEST; |
| 2146 | int showLog = 0; /* True to display the log */ |
| 2147 | const char *zFilename; /* Name of file to annotate */ |
| 2148 | const char *zCI; /* The check-in containing zFilename */ |
| 2149 | Annotator ann; |
| 2150 | HQuery url; |
| 2151 | struct AnnVers *p; |
| 2152 | unsigned clr1, clr2, clr; |
| 2153 | int bBlame = g.zPath[0]=='b';/* True for BLAME output. False for ANNOTATE. */ |
| 2154 | |
| 2155 | /* Gather query parameters */ |
| 2156 | showLog = atoi(PD("log","1")); |
| 2157 | login_check_credentials(); |
| 2158 | if( !g.perm.Read ){ login_needed(); return; } |
| 2159 | if( exclude_spiders("annotate") ) return; |
| 2160 | mid = name_to_typed_rid(PD("checkin","0"),"ci"); |
| 2161 | zFilename = P("filename"); |
| 2162 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); |
| 2163 | if( mid==0 || fnid==0 ){ fossil_redirect_home(); } |
| 2164 | iLimit = atoi(PD("limit","20")); |
| 2165 | if( P("filevers") ) annFlags |= ANN_FILE_VERS; |
| 2166 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ |
| 2167 | fossil_redirect_home(); |
| 2168 | } |
| 2169 | |
| 2170 | /* compute the annotation */ |
| @@ -2172,17 +2204,29 @@ | |
| 2172 | annotate_file(&ann, fnid, mid, iLimit, annFlags); |
| 2173 | zCI = ann.aVers[0].zMUuid; |
| 2174 | |
| 2175 | /* generate the web page */ |
| 2176 | style_header("Annotation For %h", zFilename); |
| 2177 | url_initialize(&url, "annotate"); |
| 2178 | url_add_parameter(&url, "checkin", P("checkin")); |
| 2179 | url_add_parameter(&url, "filename", zFilename); |
| 2180 | if( iLimit!=20 ){ |
| 2181 | url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit)); |
| 2182 | } |
| 2183 | url_add_parameter(&url, "log", showLog ? "1" : "0"); |
| 2184 | if( showLog ){ |
| 2185 | style_submenu_element("Hide Log", "Hide Log", |
| 2186 | "%s", url_render(&url, "log", "0", 0, 0)); |
| 2187 | }else{ |
| 2188 | style_submenu_element("Show Log", "Show Log", |
| @@ -2208,11 +2252,11 @@ | |
| 2208 | clr2 = 0xb5e0ff; /* Older changes: blue (cold) */ |
| 2209 | } |
| 2210 | for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){ |
| 2211 | clr = gradient_color(clr1, clr2, ann.nVers-1, i); |
| 2212 | ann.aVers[i].zBgColor = mprintf("#%06x", clr); |
| 2213 | } |
| 2214 | |
| 2215 | if( showLog ){ |
| 2216 | char *zLink = href("%R/finfo?name=%t&ci=%S",zFilename,zCI); |
| 2217 | @ <h2>Ancestors of %z(zLink)%h(zFilename)</a> analyzed:</h2> |
| 2218 | @ <ol> |
| @@ -2238,11 +2282,11 @@ | |
| 2238 | } |
| 2239 | @ </ol> |
| 2240 | @ <hr> |
| 2241 | } |
| 2242 | if( !ann.bLimit ){ |
| 2243 | @ <h2>Origin for each line in |
| 2244 | @ %z(href("%R/finfo?name=%h&ci=%S", zFilename, zCI))%h(zFilename)</a> |
| 2245 | @ from check-in %z(href("%R/info/%S",zCI))%S(zCI)</a>:</h2> |
| 2246 | iLimit = ann.nVers+10; |
| 2247 | }else{ |
| 2248 | @ <h2>Lines added by the %d(iLimit) most recent ancestors of |
| @@ -2291,22 +2335,25 @@ | |
| 2291 | } |
| 2292 | |
| 2293 | /* |
| 2294 | ** COMMAND: annotate |
| 2295 | ** COMMAND: blame |
| 2296 | ** |
| 2297 | ** %fossil (annotate|blame) ?OPTIONS? FILENAME |
| 2298 | ** |
| 2299 | ** Output the text of a file with markings to show when each line of |
| 2300 | ** the file was last modified. The "annotate" command shows line numbers |
| 2301 | ** and omits the username. The "blame" command shows the user who made each |
| 2302 | ** checkin and omits the line number. |
| 2303 | ** |
| 2304 | ** Options: |
| 2305 | ** --filevers Show file version numbers rather than check-in versions |
| 2306 | ** -l|--log List all versions analyzed |
| 2307 | ** -n|--limit N Only look backwards in time by N versions |
| 2308 | ** |
| 2309 | ** See also: info, finfo, timeline |
| 2310 | */ |
| 2311 | void annotate_cmd(void){ |
| 2312 | int fnid; /* Filename ID */ |
| @@ -2319,18 +2366,20 @@ | |
| 2319 | int i; /* Loop counter */ |
| 2320 | const char *zLimit; /* The value to the -n|--limit option */ |
| 2321 | int iLimit; /* How far back in time to look */ |
| 2322 | int showLog; /* True to show the log */ |
| 2323 | int fileVers; /* Show file version instead of check-in versions */ |
| 2324 | int annFlags = 0; /* Flags to control annotation properties */ |
| 2325 | int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */ |
| 2326 | |
| 2327 | bBlame = g.argv[1][0]=='b'; |
| 2328 | zLimit = find_option("limit","n",1); |
| 2329 | if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1"; |
| 2330 | iLimit = atoi(zLimit); |
| 2331 | showLog = find_option("log","l",0)!=0; |
| 2332 | fileVers = find_option("filevers",0,0)!=0; |
| 2333 | db_must_be_within_tree(); |
| 2334 | if( g.argc<3 ) { |
| 2335 | usage("FILENAME"); |
| 2336 | } |
| 2337 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -29,17 +29,17 @@ | |
| 29 | ** of the diff output. |
| 30 | */ |
| 31 | #define DIFF_CONTEXT_MASK ((u64)0x0000ffff) /* Lines of context. Default if 0 */ |
| 32 | #define DIFF_WIDTH_MASK ((u64)0x00ff0000) /* side-by-side column width */ |
| 33 | #define DIFF_IGNORE_EOLWS ((u64)0x01000000) /* Ignore end-of-line whitespace */ |
| 34 | #define DIFF_IGNORE_ALLWS ((u64)0x03000000) /* Ignore all whitespace */ |
| 35 | #define DIFF_SIDEBYSIDE ((u64)0x04000000) /* Generate a side-by-side diff */ |
| 36 | #define DIFF_VERBOSE ((u64)0x08000000) /* Missing shown as empty files */ |
| 37 | #define DIFF_INLINE ((u64)0x00000000) /* Inline (not side-by-side) diff */ |
| 38 | #define DIFF_BRIEF ((u64)0x10000000) /* Show filenames only */ |
| 39 | #define DIFF_HTML ((u64)0x20000000) /* Render for HTML */ |
| 40 | #define DIFF_LINENO ((u64)0x40000000) /* Show line numbers */ |
| 41 | #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */ |
| 42 | #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */ |
| 43 | #define DIFF_CONTEXT_EX (((u64)0x04)<<32) /* Use context even if zero */ |
| 44 | #define DIFF_NOTTOOBIG (((u64)0x08)<<32) /* Only display if not too big */ |
| 45 | |
| @@ -54,10 +54,13 @@ | |
| 54 | "cannot compute difference between symlink and regular file\n" |
| 55 | |
| 56 | #define DIFF_TOO_MANY_CHANGES \ |
| 57 | "more than 10,000 changes\n" |
| 58 | |
| 59 | #define DIFF_WHITESPACE_ONLY \ |
| 60 | "whitespace changes only\n" |
| 61 | |
| 62 | /* |
| 63 | ** Maximum length of a line in a text file, in bytes. (2**13 = 8192 bytes) |
| 64 | */ |
| 65 | #define LENGTH_MASK_SZ 13 |
| 66 | #define LENGTH_MASK ((1<<LENGTH_MASK_SZ)-1) |
| @@ -73,10 +76,12 @@ | |
| 76 | */ |
| 77 | typedef struct DLine DLine; |
| 78 | struct DLine { |
| 79 | const char *z; /* The text of the line */ |
| 80 | unsigned int h; /* Hash of the line */ |
| 81 | unsigned short indent; /* Indent of the line. Only !=0 with -w/-Z option */ |
| 82 | unsigned short n; /* number of bytes */ |
| 83 | unsigned int iNext; /* 1+(Index of next line with same the same hash) */ |
| 84 | |
| 85 | /* an array of DLine elements serves two purposes. The fields |
| 86 | ** above are one per line of input text. But each entry is also |
| 87 | ** a bucket in a hash table, as follows: */ |
| @@ -125,12 +130,12 @@ | |
| 130 | ** too long. |
| 131 | ** |
| 132 | ** Profiling show that in most cases this routine consumes the bulk of |
| 133 | ** the CPU time on a diff. |
| 134 | */ |
| 135 | static DLine *break_into_lines(const char *z, int n, int *pnLine, u64 diffFlags){ |
| 136 | int nLine, i, j, k, s, x; |
| 137 | unsigned int h, h2; |
| 138 | DLine *a; |
| 139 | |
| 140 | /* Count the number of lines. Allocate space to hold |
| 141 | ** the returned array. |
| @@ -158,18 +163,25 @@ | |
| 163 | return a; |
| 164 | } |
| 165 | |
| 166 | /* Fill in the array */ |
| 167 | for(i=0; i<nLine; i++){ |
| 168 | for(j=0; z[j] && z[j]!='\n'; j++){} |
| 169 | a[i].z = z; |
| 170 | a[i].n = k = j; |
| 171 | s = 0; |
| 172 | if( diffFlags & DIFF_IGNORE_EOLWS ){ |
| 173 | while( k>0 && fossil_isspace(z[k-1]) ){ k--; } |
| 174 | } |
| 175 | if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){ |
| 176 | while( s<k && fossil_isspace(z[s]) ){ s++; } |
| 177 | } |
| 178 | a[i].indent = s; |
| 179 | for(h=0, x=s; x<k; x++){ |
| 180 | h = h ^ (h<<2) ^ z[x]; |
| 181 | } |
| 182 | a[i].h = h = (h<<LENGTH_MASK_SZ) | (k-s); |
| 183 | h2 = h % nLine; |
| 184 | a[i].iNext = a[h2].iHash; |
| 185 | a[h2].iHash = i+1; |
| 186 | z += j+1; |
| 187 | } |
| @@ -181,11 +193,12 @@ | |
| 193 | |
| 194 | /* |
| 195 | ** Return true if two DLine elements are identical. |
| 196 | */ |
| 197 | static int same_dline(DLine *pA, DLine *pB){ |
| 198 | return pA->h==pB->h && memcmp(pA->z+pA->indent,pB->z+pB->indent, |
| 199 | pA->h & LENGTH_MASK)==0; |
| 200 | } |
| 201 | |
| 202 | /* |
| 203 | ** Return true if the regular expression *pRe matches any of the |
| 204 | ** N dlines |
| @@ -221,16 +234,16 @@ | |
| 234 | }else if( cPrefix=='+' ){ |
| 235 | blob_append(pOut, "<span class=\"diffadd\">", -1); |
| 236 | }else if( cPrefix=='-' ){ |
| 237 | blob_append(pOut, "<span class=\"diffrm\">", -1); |
| 238 | } |
| 239 | htmlize_to_blob(pOut, pLine->z, pLine->n); |
| 240 | if( cPrefix!=' ' ){ |
| 241 | blob_append(pOut, "</span>", -1); |
| 242 | } |
| 243 | }else{ |
| 244 | blob_append(pOut, pLine->z, pLine->n); |
| 245 | } |
| 246 | blob_append(pOut, "\n", 1); |
| 247 | } |
| 248 | |
| 249 | /* |
| @@ -402,11 +415,11 @@ | |
| 415 | b += m; |
| 416 | if( i<nr-1 ){ |
| 417 | m = R[r+i*3+3]; |
| 418 | for(j=0; j<m; j++){ |
| 419 | if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html); |
| 420 | appendDiffLine(pOut, ' ', &A[a+j], html, 0); |
| 421 | } |
| 422 | b += m; |
| 423 | a += m; |
| 424 | } |
| 425 | } |
| @@ -415,11 +428,11 @@ | |
| 428 | assert( nr==i ); |
| 429 | m = R[r+nr*3]; |
| 430 | if( m>nContext ) m = nContext; |
| 431 | for(j=0; j<m; j++){ |
| 432 | if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html); |
| 433 | appendDiffLine(pOut, ' ', &A[a+j], html, 0); |
| 434 | } |
| 435 | } |
| 436 | } |
| 437 | |
| 438 | /* |
| @@ -476,11 +489,11 @@ | |
| 489 | ** This comment contains multibyte unicode characters (ü, Æ, ð) in order |
| 490 | ** to test the ability of the diff code to handle such characters. |
| 491 | */ |
| 492 | static void sbsWriteText(SbsLine *p, DLine *pLine, int col){ |
| 493 | Blob *pCol = p->apCols[col]; |
| 494 | int n = pLine->n; |
| 495 | int i; /* Number of input characters consumed */ |
| 496 | int k; /* Cursor position */ |
| 497 | int needEndSpan = 0; |
| 498 | const char *zIn = pLine->z; |
| 499 | int w = p->width; |
| @@ -1305,11 +1318,11 @@ | |
| 1318 | sbsWriteMarker(&s, " ", ""); |
| 1319 | sbsWriteLineno(&s, b+j, SBS_LNB); |
| 1320 | sbsWriteText(&s, &B[b+j], SBS_TXTB); |
| 1321 | } |
| 1322 | } |
| 1323 | |
| 1324 | if( s.escHtml && blob_size(s.apCols[SBS_LNA])>0 ){ |
| 1325 | blob_append(pOut, "<table class=\"sbsdiffcols\"><tr>\n", -1); |
| 1326 | for(i=SBS_LNA; i<=SBS_TXTB; i++){ |
| 1327 | sbsWriteColumn(pOut, s.apCols[i], i); |
| 1328 | blob_reset(s.apCols[i]); |
| @@ -1753,28 +1766,28 @@ | |
| 1766 | Blob *pB_Blob, /* TO file */ |
| 1767 | Blob *pOut, /* Write diff here if not NULL */ |
| 1768 | ReCompiled *pRe, /* Only output changes where this Regexp matches */ |
| 1769 | u64 diffFlags /* DIFF_* flags defined above */ |
| 1770 | ){ |
| 1771 | int ignoreWs; /* Ignore whitespace */ |
| 1772 | DContext c; |
| 1773 | |
| 1774 | if( diffFlags & DIFF_INVERT ){ |
| 1775 | Blob *pTemp = pA_Blob; |
| 1776 | pA_Blob = pB_Blob; |
| 1777 | pB_Blob = pTemp; |
| 1778 | } |
| 1779 | ignoreWs = (diffFlags & DIFF_IGNORE_ALLWS)!=0; |
| 1780 | blob_to_utf8_no_bom(pA_Blob, 0); |
| 1781 | blob_to_utf8_no_bom(pB_Blob, 0); |
| 1782 | |
| 1783 | /* Prepare the input files */ |
| 1784 | memset(&c, 0, sizeof(c)); |
| 1785 | c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob), |
| 1786 | &c.nFrom, diffFlags); |
| 1787 | c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob), |
| 1788 | &c.nTo, diffFlags); |
| 1789 | if( c.aFrom==0 || c.aTo==0 ){ |
| 1790 | fossil_free(c.aFrom); |
| 1791 | fossil_free(c.aTo); |
| 1792 | if( pOut ){ |
| 1793 | diff_errmsg(pOut, DIFF_CANNOT_COMPUTE_BINARY, diffFlags); |
| @@ -1782,20 +1795,27 @@ | |
| 1795 | return 0; |
| 1796 | } |
| 1797 | |
| 1798 | /* Compute the difference */ |
| 1799 | diff_all(&c); |
| 1800 | if( ignoreWs && c.nEdit==6 && c.aEdit[1]==0 && c.aEdit[2]==0 ){ |
| 1801 | fossil_free(c.aFrom); |
| 1802 | fossil_free(c.aTo); |
| 1803 | fossil_free(c.aEdit); |
| 1804 | if( pOut ) diff_errmsg(pOut, DIFF_WHITESPACE_ONLY, diffFlags); |
| 1805 | return 0; |
| 1806 | } |
| 1807 | if( (diffFlags & DIFF_NOTTOOBIG)!=0 ){ |
| 1808 | int i, m, n; |
| 1809 | int *a = c.aEdit; |
| 1810 | int mx = c.nEdit; |
| 1811 | for(i=m=n=0; i<mx; i+=3){ m += a[i]; n += a[i+1]+a[i+2]; } |
| 1812 | if( n>10000 ){ |
| 1813 | fossil_free(c.aFrom); |
| 1814 | fossil_free(c.aTo); |
| 1815 | fossil_free(c.aEdit); |
| 1816 | if( pOut ) diff_errmsg(pOut, DIFF_TOO_MANY_CHANGES, diffFlags); |
| 1817 | return 0; |
| 1818 | } |
| 1819 | } |
| 1820 | if( (diffFlags & DIFF_NOOPT)==0 ){ |
| 1821 | diff_optimize(&c); |
| @@ -1824,19 +1844,21 @@ | |
| 1844 | |
| 1845 | /* |
| 1846 | ** Process diff-related command-line options and return an appropriate |
| 1847 | ** "diffFlags" integer. |
| 1848 | ** |
| 1849 | ** --brief Show filenames only DIFF_BRIEF |
| 1850 | ** -c|--context N N lines of context. DIFF_CONTEXT_MASK |
| 1851 | ** --html Format for HTML DIFF_HTML |
| 1852 | ** --invert Invert the diff DIFF_INVERT |
| 1853 | ** -n|--linenum Show line numbers DIFF_LINENO |
| 1854 | ** --noopt Disable optimization DIFF_NOOPT |
| 1855 | ** --unified Unified diff. ~DIFF_SIDEBYSIDE |
| 1856 | ** -w|--ignore-all-space Ignore all whitespaces DIFF_IGNORE_ALLWS |
| 1857 | ** --width|-W N N character lines. DIFF_WIDTH_MASK |
| 1858 | ** -y|--side-by-side Side-by-side diff. DIFF_SIDEBYSIDE |
| 1859 | ** -Z|--ignore-trailing-space Ignore eol-whitespaces DIFF_IGNORE_EOLWS |
| 1860 | */ |
| 1861 | u64 diff_options(void){ |
| 1862 | u64 diffFlags = 0; |
| 1863 | const char *z; |
| 1864 | int f; |
| @@ -1850,10 +1872,12 @@ | |
| 1872 | f *= DIFF_CONTEXT_MASK+1; |
| 1873 | if( f > DIFF_WIDTH_MASK ) f = DIFF_CONTEXT_MASK; |
| 1874 | diffFlags |= f; |
| 1875 | } |
| 1876 | if( find_option("html",0,0)!=0 ) diffFlags |= DIFF_HTML; |
| 1877 | if( find_option("ignore-trailing-space","Z",0)!=0 ) diffFlags |= DIFF_IGNORE_EOLWS; |
| 1878 | if( find_option("ignore-all-space","w",0)!=0 ) diffFlags |= DIFF_IGNORE_ALLWS; |
| 1879 | if( find_option("linenum","n",0)!=0 ) diffFlags |= DIFF_LINENO; |
| 1880 | if( find_option("noopt",0,0)!=0 ) diffFlags |= DIFF_NOOPT; |
| 1881 | if( find_option("invert",0,0)!=0 ) diffFlags |= DIFF_INVERT; |
| 1882 | if( find_option("brief",0,0)!=0 ) diffFlags |= DIFF_BRIEF; |
| 1883 | return diffFlags; |
| @@ -1952,22 +1976,23 @@ | |
| 1976 | /* |
| 1977 | ** Initialize the annotation process by specifying the file that is |
| 1978 | ** to be annotated. The annotator takes control of the input Blob and |
| 1979 | ** will release it when it is finished with it. |
| 1980 | */ |
| 1981 | static int annotation_start(Annotator *p, Blob *pInput, u64 diffFlags){ |
| 1982 | int i; |
| 1983 | |
| 1984 | memset(p, 0, sizeof(*p)); |
| 1985 | p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo, |
| 1986 | diffFlags); |
| 1987 | if( p->c.aTo==0 ){ |
| 1988 | return 1; |
| 1989 | } |
| 1990 | p->aOrig = fossil_malloc( sizeof(p->aOrig[0])*p->c.nTo ); |
| 1991 | for(i=0; i<p->c.nTo; i++){ |
| 1992 | p->aOrig[i].z = p->c.aTo[i].z; |
| 1993 | p->aOrig[i].n = p->c.aTo[i].n; |
| 1994 | p->aOrig[i].iVers = -1; |
| 1995 | } |
| 1996 | p->nOrig = p->c.nTo; |
| 1997 | return 0; |
| 1998 | } |
| @@ -1977,17 +2002,17 @@ | |
| 2002 | ** being annotated. Do another step of the annotation. Return true |
| 2003 | ** if additional annotation is required. zPName is the tag to insert |
| 2004 | ** on each line of the file being annotated that was contributed by |
| 2005 | ** pParent. Memory to hold zPName is leaked. |
| 2006 | */ |
| 2007 | static int annotation_step(Annotator *p, Blob *pParent, int iVers, u64 diffFlags){ |
| 2008 | int i, j; |
| 2009 | int lnTo; |
| 2010 | |
| 2011 | /* Prepare the parent file to be diffed */ |
| 2012 | p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent), |
| 2013 | &p->c.nFrom, diffFlags); |
| 2014 | if( p->c.aFrom==0 ){ |
| 2015 | return 1; |
| 2016 | } |
| 2017 | |
| 2018 | /* Compute the differences going from pParent to the file being |
| @@ -2020,13 +2045,13 @@ | |
| 2045 | /* Return no errors */ |
| 2046 | return 0; |
| 2047 | } |
| 2048 | |
| 2049 | |
| 2050 | /* Annotation flags (any DIFF flag can be used as Annotation flag as well) */ |
| 2051 | #define ANN_FILE_VERS (((u64)0x20)<<32) /* Show file vers rather than commit vers */ |
| 2052 | #define ANN_FILE_ANCEST (((u64)0x40)<<32) /* Prefer check-ins in the ANCESTOR table */ |
| 2053 | |
| 2054 | /* |
| 2055 | ** Compute a complete annotation on a file. The file is identified |
| 2056 | ** by its filename number (filename.fnid) and the baseline in which |
| 2057 | ** it was checked in (mlink.mid). |
| @@ -2034,11 +2059,11 @@ | |
| 2059 | static void annotate_file( |
| 2060 | Annotator *p, /* The annotator */ |
| 2061 | int fnid, /* The name of the file to be annotated */ |
| 2062 | int mid, /* Use the version of the file in this check-in */ |
| 2063 | int iLimit, /* Limit the number of levels if greater than zero */ |
| 2064 | u64 annFlags /* Flags to alter the annotation */ |
| 2065 | ){ |
| 2066 | Blob toAnnotate; /* Text of the final (mid) version of the file */ |
| 2067 | Blob step; /* Text of previous revision */ |
| 2068 | int rid; /* Artifact ID of the file being annotated */ |
| 2069 | Stmt q; /* Query returning all ancestor versions */ |
| @@ -2052,11 +2077,12 @@ | |
| 2077 | } |
| 2078 | if( !content_get(rid, &toAnnotate) ){ |
| 2079 | fossil_fatal("unable to retrieve content of artifact #%d", rid); |
| 2080 | } |
| 2081 | if( iLimit<=0 ) iLimit = 1000000000; |
| 2082 | blob_to_utf8_no_bom(&toAnnotate, 0); |
| 2083 | annotation_start(p, &toAnnotate, annFlags); |
| 2084 | db_begin_transaction(); |
| 2085 | db_multi_exec( |
| 2086 | "CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);" |
| 2087 | "DELETE FROM vseen;" |
| 2088 | ); |
| @@ -2086,11 +2112,12 @@ | |
| 2112 | p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1)); |
| 2113 | p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2)); |
| 2114 | p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3)); |
| 2115 | if( p->nVers ){ |
| 2116 | content_get(rid, &step); |
| 2117 | blob_to_utf8_no_bom(&step, 0); |
| 2118 | annotation_step(p, &step, p->nVers-1, annFlags); |
| 2119 | blob_reset(&step); |
| 2120 | } |
| 2121 | p->nVers++; |
| 2122 | db_bind_int(&ins, ":rid", rid); |
| 2123 | db_step(&ins); |
| @@ -2126,10 +2153,11 @@ | |
| 2153 | } |
| 2154 | |
| 2155 | /* |
| 2156 | ** WEBPAGE: annotate |
| 2157 | ** WEBPAGE: blame |
| 2158 | ** WEBPAGE: praise |
| 2159 | ** |
| 2160 | ** Query parameters: |
| 2161 | ** |
| 2162 | ** checkin=ID The manifest ID at which to start the annotation |
| 2163 | ** filename=FILENAME The filename. |
| @@ -2140,31 +2168,35 @@ | |
| 2168 | void annotation_page(void){ |
| 2169 | int mid; |
| 2170 | int fnid; |
| 2171 | int i; |
| 2172 | int iLimit; /* Depth limit */ |
| 2173 | u64 annFlags = ANN_FILE_ANCEST; |
| 2174 | int showLog = 0; /* True to display the log */ |
| 2175 | int ignoreWs = 0; /* Ignore whitespace */ |
| 2176 | const char *zFilename; /* Name of file to annotate */ |
| 2177 | const char *zCI; /* The check-in containing zFilename */ |
| 2178 | Annotator ann; |
| 2179 | HQuery url; |
| 2180 | struct AnnVers *p; |
| 2181 | unsigned clr1, clr2, clr; |
| 2182 | int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */ |
| 2183 | |
| 2184 | /* Gather query parameters */ |
| 2185 | showLog = atoi(PD("log","1")); |
| 2186 | login_check_credentials(); |
| 2187 | if( !g.perm.Read ){ login_needed(); return; } |
| 2188 | if( exclude_spiders("annotate") ) return; |
| 2189 | load_control(); |
| 2190 | mid = name_to_typed_rid(PD("checkin","0"),"ci"); |
| 2191 | zFilename = P("filename"); |
| 2192 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); |
| 2193 | if( mid==0 || fnid==0 ){ fossil_redirect_home(); } |
| 2194 | iLimit = atoi(PD("limit","20")); |
| 2195 | if( P("filevers") ) annFlags |= ANN_FILE_VERS; |
| 2196 | ignoreWs = P("w")!=0; |
| 2197 | if( ignoreWs ) annFlags |= DIFF_IGNORE_ALLWS; |
| 2198 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ |
| 2199 | fossil_redirect_home(); |
| 2200 | } |
| 2201 | |
| 2202 | /* compute the annotation */ |
| @@ -2172,17 +2204,29 @@ | |
| 2204 | annotate_file(&ann, fnid, mid, iLimit, annFlags); |
| 2205 | zCI = ann.aVers[0].zMUuid; |
| 2206 | |
| 2207 | /* generate the web page */ |
| 2208 | style_header("Annotation For %h", zFilename); |
| 2209 | if( bBlame ){ |
| 2210 | url_initialize(&url, "blame"); |
| 2211 | }else{ |
| 2212 | url_initialize(&url, "annotate"); |
| 2213 | } |
| 2214 | url_add_parameter(&url, "checkin", P("checkin")); |
| 2215 | url_add_parameter(&url, "filename", zFilename); |
| 2216 | if( iLimit!=20 ){ |
| 2217 | url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit)); |
| 2218 | } |
| 2219 | url_add_parameter(&url, "log", showLog ? "1" : "0"); |
| 2220 | if( ignoreWs ){ |
| 2221 | url_add_parameter(&url, "w", ""); |
| 2222 | style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes", |
| 2223 | "%s", url_render(&url, "w", 0, 0, 0)); |
| 2224 | }else{ |
| 2225 | style_submenu_element("Ignore Whitespace", "Ignore Whitespace", |
| 2226 | "%s", url_render(&url, "w", "", 0, 0)); |
| 2227 | } |
| 2228 | if( showLog ){ |
| 2229 | style_submenu_element("Hide Log", "Hide Log", |
| 2230 | "%s", url_render(&url, "log", "0", 0, 0)); |
| 2231 | }else{ |
| 2232 | style_submenu_element("Show Log", "Show Log", |
| @@ -2208,11 +2252,11 @@ | |
| 2252 | clr2 = 0xb5e0ff; /* Older changes: blue (cold) */ |
| 2253 | } |
| 2254 | for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){ |
| 2255 | clr = gradient_color(clr1, clr2, ann.nVers-1, i); |
| 2256 | ann.aVers[i].zBgColor = mprintf("#%06x", clr); |
| 2257 | } |
| 2258 | |
| 2259 | if( showLog ){ |
| 2260 | char *zLink = href("%R/finfo?name=%t&ci=%S",zFilename,zCI); |
| 2261 | @ <h2>Ancestors of %z(zLink)%h(zFilename)</a> analyzed:</h2> |
| 2262 | @ <ol> |
| @@ -2238,11 +2282,11 @@ | |
| 2282 | } |
| 2283 | @ </ol> |
| 2284 | @ <hr> |
| 2285 | } |
| 2286 | if( !ann.bLimit ){ |
| 2287 | @ <h2>Origin for each line in |
| 2288 | @ %z(href("%R/finfo?name=%h&ci=%S", zFilename, zCI))%h(zFilename)</a> |
| 2289 | @ from check-in %z(href("%R/info/%S",zCI))%S(zCI)</a>:</h2> |
| 2290 | iLimit = ann.nVers+10; |
| 2291 | }else{ |
| 2292 | @ <h2>Lines added by the %d(iLimit) most recent ancestors of |
| @@ -2291,22 +2335,25 @@ | |
| 2335 | } |
| 2336 | |
| 2337 | /* |
| 2338 | ** COMMAND: annotate |
| 2339 | ** COMMAND: blame |
| 2340 | ** COMMAND: praise |
| 2341 | ** |
| 2342 | ** %fossil (annotate|blame|praise) ?OPTIONS? FILENAME |
| 2343 | ** |
| 2344 | ** Output the text of a file with markings to show when each line of |
| 2345 | ** the file was last modified. The "annotate" command shows line numbers |
| 2346 | ** and omits the username. The "blame" and "praise" commands show the user |
| 2347 | ** who made each checkin and omits the line number. |
| 2348 | ** |
| 2349 | ** Options: |
| 2350 | ** --filevers Show file version numbers rather than check-in versions |
| 2351 | ** -l|--log List all versions analyzed |
| 2352 | ** -n|--limit N Only look backwards in time by N versions |
| 2353 | ** -Z|--ignore-trailing-space Ignore eol-whitespaces |
| 2354 | ** -w|--ignore-all-space Ignore all whitespaces |
| 2355 | ** |
| 2356 | ** See also: info, finfo, timeline |
| 2357 | */ |
| 2358 | void annotate_cmd(void){ |
| 2359 | int fnid; /* Filename ID */ |
| @@ -2319,18 +2366,20 @@ | |
| 2366 | int i; /* Loop counter */ |
| 2367 | const char *zLimit; /* The value to the -n|--limit option */ |
| 2368 | int iLimit; /* How far back in time to look */ |
| 2369 | int showLog; /* True to show the log */ |
| 2370 | int fileVers; /* Show file version instead of check-in versions */ |
| 2371 | u64 annFlags = 0; /* Flags to control annotation properties */ |
| 2372 | int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */ |
| 2373 | |
| 2374 | bBlame = g.argv[1][0]!='a'; |
| 2375 | zLimit = find_option("limit","n",1); |
| 2376 | if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1"; |
| 2377 | iLimit = atoi(zLimit); |
| 2378 | showLog = find_option("log","l",0)!=0; |
| 2379 | if( find_option("ignore-trailing-space","Z",0)!=0 ) annFlags |= DIFF_IGNORE_EOLWS; |
| 2380 | if( find_option("ignore-all-space","w",0)!=0 ) annFlags |= DIFF_IGNORE_ALLWS; |
| 2381 | fileVers = find_option("filevers",0,0)!=0; |
| 2382 | db_must_be_within_tree(); |
| 2383 | if( g.argc<3 ) { |
| 2384 | usage("FILENAME"); |
| 2385 | } |
| 2386 |
+94
-32
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -49,15 +49,25 @@ | ||
| 49 | 49 | if( diffFlags & DIFF_BRIEF ){ |
| 50 | 50 | /* no-op */ |
| 51 | 51 | }else if( diffFlags & DIFF_SIDEBYSIDE ){ |
| 52 | 52 | int w = diff_width(diffFlags); |
| 53 | 53 | int n1 = strlen(zLeft); |
| 54 | + int n2 = strlen(zRight); | |
| 54 | 55 | 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 | + } | |
| 59 | 69 | }else{ |
| 60 | 70 | z = mprintf("--- %s\n+++ %s\n", zLeft, zRight); |
| 61 | 71 | } |
| 62 | 72 | fossil_print("%s", z); |
| 63 | 73 | fossil_free(z); |
| @@ -598,10 +608,11 @@ | ||
| 598 | 608 | } |
| 599 | 609 | |
| 600 | 610 | /* A Tcl/Tk script used to render diff output. |
| 601 | 611 | */ |
| 602 | 612 | static const char zDiffScript[] = |
| 613 | +@ set prog { | |
| 603 | 614 | @ package require Tk |
| 604 | 615 | @ |
| 605 | 616 | @ array set CFG { |
| 606 | 617 | @ TITLE {Fossil Diff} |
| 607 | 618 | @ LN_COL_BG #dddddd |
| @@ -617,10 +628,11 @@ | ||
| 617 | 628 | @ HR_PAD_TOP 4 |
| 618 | 629 | @ HR_PAD_BTM 8 |
| 619 | 630 | @ FN_BG #444444 |
| 620 | 631 | @ FN_FG #ffffff |
| 621 | 632 | @ FN_PAD 5 |
| 633 | +@ ERR_FG #ee0000 | |
| 622 | 634 | @ PADX 5 |
| 623 | 635 | @ WIDTH 80 |
| 624 | 636 | @ HEIGHT 45 |
| 625 | 637 | @ LB_HEIGHT 25 |
| 626 | 638 | @ } |
| @@ -641,43 +653,65 @@ | ||
| 641 | 653 | @ |
| 642 | 654 | @ proc colType {c} { |
| 643 | 655 | @ regexp {[a-z]+} $c type |
| 644 | 656 | @ return $type |
| 645 | 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 | +@ } | |
| 646 | 666 | @ |
| 647 | 667 | @ 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 | |
| 650 | 677 | @ set nDiffs 0 |
| 651 | 678 | @ 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 | +@ } { | |
| 654 | 684 | @ continue |
| 655 | 685 | @ } |
| 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]} { | |
| 657 | 690 | @ continue |
| 658 | 691 | @ } |
| 659 | 692 | @ incr nDiffs |
| 660 | 693 | @ set idx [expr {$nDiffs > 1 ? [.txtA index end] : "1.0"}] |
| 661 | 694 | @ .wfiles.lb insert end $fn |
| 662 | 695 | @ |
| 663 | 696 | @ foreach c [cols] { |
| 664 | -@ while {[gets $in] ne "<pre>"} continue | |
| 665 | -@ | |
| 666 | 697 | @ if {$nDiffs > 1} { |
| 667 | 698 | @ $c insert end \n - |
| 668 | 699 | @ } |
| 669 | 700 | @ if {[colType $c] eq "txt"} { |
| 670 | 701 | @ $c insert end $fn\n fn |
| 702 | +@ if {$fn2!=""} {set fn $fn2} | |
| 671 | 703 | @ } else { |
| 672 | 704 | @ $c insert end \n fn |
| 673 | 705 | @ } |
| 674 | 706 | @ $c insert end \n - |
| 675 | 707 | @ |
| 708 | +@ if {$errMsg ne ""} continue | |
| 709 | +@ while {[getLine $difftxt $N ii] ne "<pre>"} continue | |
| 676 | 710 | @ set type [colType $c] |
| 677 | 711 | @ set str {} |
| 678 | -@ while {[set line [gets $in]] ne "</pre>"} { | |
| 712 | +@ while {[set line [getLine $difftxt $N ii]] ne "</pre>"} { | |
| 679 | 713 | @ set len [string length [dehtml $line]] |
| 680 | 714 | @ if {$len > $widths($type)} { |
| 681 | 715 | @ set widths($type) $len |
| 682 | 716 | @ } |
| 683 | 717 | @ append str $line\n |
| @@ -693,12 +727,16 @@ | ||
| 693 | 727 | @ } else { |
| 694 | 728 | @ $c insert end [dehtml $pre] - |
| 695 | 729 | @ } |
| 696 | 730 | @ } |
| 697 | 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 | +@ } | |
| 698 | 737 | @ } |
| 699 | -@ close $in | |
| 700 | 738 | @ |
| 701 | 739 | @ foreach c [cols] { |
| 702 | 740 | @ set type [colType $c] |
| 703 | 741 | @ if {$type ne "txt"} { |
| 704 | 742 | @ $c config -width $widths($type) |
| @@ -797,12 +835,12 @@ | ||
| 797 | 835 | @ bind . <q> exit |
| 798 | 836 | @ bind . <Destroy> {after 0 exit} |
| 799 | 837 | @ bind . <Tab> {cycleDiffs; break} |
| 800 | 838 | @ bind . <<PrevWindow>> {cycleDiffs 1; break} |
| 801 | 839 | @ 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> | |
| 804 | 842 | @ break |
| 805 | 843 | @ } |
| 806 | 844 | @ foreach {key axis args} { |
| 807 | 845 | @ Up y {scroll -5 units} |
| 808 | 846 | @ Down y {scroll 5 units} |
| @@ -815,21 +853,22 @@ | ||
| 815 | 853 | @ } { |
| 816 | 854 | @ bind . <$key> "scroll-$axis $args; break" |
| 817 | 855 | @ bind . <Shift-$key> continue |
| 818 | 856 | @ } |
| 819 | 857 | @ |
| 820 | -@ ::ttk::menubutton .files -text "Files" | |
| 858 | +@ frame .bb | |
| 859 | +@ ::ttk::menubutton .bb.files -text "Files" | |
| 821 | 860 | @ toplevel .wfiles |
| 822 | 861 | @ wm withdraw .wfiles |
| 823 | 862 | @ update idletasks |
| 824 | 863 | @ wm transient .wfiles . |
| 825 | 864 | @ wm overrideredirect .wfiles 1 |
| 826 | 865 | @ listbox .wfiles.lb -width 0 -height $CFG(LB_HEIGHT) -activestyle none \ |
| 827 | 866 | @ -yscroll {.wfiles.sb set} |
| 828 | 867 | @ ::ttk::scrollbar .wfiles.sb -command {.wfiles.lb yview} |
| 829 | 868 | @ grid .wfiles.lb .wfiles.sb -sticky ns |
| 830 | -@ bind .files <1> { | |
| 869 | +@ bind .bb.files <1> { | |
| 831 | 870 | @ set x [winfo rootx %W] |
| 832 | 871 | @ set y [expr {[winfo rooty %W]+[winfo height %W]}] |
| 833 | 872 | @ wm geometry .wfiles +$x+$y |
| 834 | 873 | @ wm deiconify .wfiles |
| 835 | 874 | @ focus .wfiles.lb |
| @@ -864,10 +903,11 @@ | ||
| 864 | 903 | @ $txt tag config $tag -background $CFG([string toupper $tag]_BG) |
| 865 | 904 | @ $txt tag lower $tag |
| 866 | 905 | @ } |
| 867 | 906 | @ $txt tag config fn -background $CFG(FN_BG) -foreground $CFG(FN_FG) \ |
| 868 | 907 | @ -justify center |
| 908 | +@ $txt tag config err -foreground $CFG(ERR_FG) | |
| 869 | 909 | @ } |
| 870 | 910 | @ text .mkr |
| 871 | 911 | @ |
| 872 | 912 | @ foreach c [cols] { |
| 873 | 913 | @ set keyPrefix [string toupper [colType $c]]_COL_ |
| @@ -890,22 +930,42 @@ | ||
| 890 | 930 | @ tk_messageBox -type ok -title $CFG(TITLE) -message "No changes" |
| 891 | 931 | @ exit |
| 892 | 932 | @ } |
| 893 | 933 | @ update idletasks |
| 894 | 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 | |
| 895 | 953 | @ grid rowconfigure . 1 -weight 1 |
| 896 | 954 | @ grid columnconfigure . 1 -weight 1 |
| 897 | 955 | @ grid columnconfigure . 4 -weight 1 |
| 898 | -@ grid .files -row 0 -columnspan 6 | |
| 956 | +@ grid .bb -row 0 -columnspan 6 | |
| 899 | 957 | @ eval grid [cols] -row 1 -sticky nsew |
| 900 | 958 | @ grid .sby -row 1 -column 5 -sticky ns |
| 901 | 959 | @ grid .sbxA -row 2 -columnspan 2 -sticky ew |
| 902 | 960 | @ grid .spacer -row 2 -column 2 |
| 903 | 961 | @ grid .sbxB -row 2 -column 3 -columnspan 2 -sticky ew |
| 904 | 962 | @ |
| 905 | 963 | @ .spacer config -height [winfo height .sbxA] |
| 906 | 964 | @ wm deiconify . |
| 965 | +@ } | |
| 966 | +@ eval $prog | |
| 907 | 967 | ; |
| 908 | 968 | |
| 909 | 969 | /* |
| 910 | 970 | ** Show diff output in a Tcl/Tk window, in response to the --tk option |
| 911 | 971 | ** to the diff command. |
| @@ -1029,23 +1089,26 @@ | ||
| 1029 | 1089 | ** The "--binary" option causes files matching the glob PATTERN to be treated |
| 1030 | 1090 | ** as binary when considering if they should be used with external diff program. |
| 1031 | 1091 | ** This option overrides the "binary-glob" setting. |
| 1032 | 1092 | ** |
| 1033 | 1093 | ** Options: |
| 1034 | -** --binary PATTERN Treat files that match the glob PATTERN as binary | |
| 1035 | -** --branch BRANCH Show diff of all changes on BRANCH | |
| 1036 | -** --brief Show filenames only | |
| 1037 | -** --context|-c N Use N lines of context | |
| 1038 | -** --diff-binary BOOL Include binary files when using external commands | |
| 1039 | -** --from|-r VERSION select VERSION as source for the diff | |
| 1040 | -** --internal|-i use internal diff logic | |
| 1041 | -** --side-by-side|-y side-by-side diff | |
| 1042 | -** --tk Launch a Tcl/Tk GUI for display | |
| 1043 | -** --to VERSION select VERSION as target for the diff | |
| 1044 | -** --unified unified diff | |
| 1045 | -** -v|--verbose output complete text of added or deleted files | |
| 1046 | -** -W|--width Width of lines in side-by-side diff | |
| 1094 | +** --binary PATTERN Treat files that match the glob PATTERN as binary | |
| 1095 | +** --branch BRANCH Show diff of all changes on BRANCH | |
| 1096 | +** --brief Show filenames only | |
| 1097 | +** --context|-c N Use N lines of context | |
| 1098 | +** --diff-binary BOOL Include binary files when using external commands | |
| 1099 | +** --from|-r VERSION select VERSION as source for the diff | |
| 1100 | +** --internal|-i use internal diff logic | |
| 1101 | +** --side-by-side|-y side-by-side diff | |
| 1102 | +** --tk Launch a Tcl/Tk GUI for display | |
| 1103 | +** --to VERSION select VERSION as target for the diff | |
| 1104 | +** --unified unified diff | |
| 1105 | +** -v|--verbose output complete text of added or deleted files | |
| 1106 | +** -w|--ignore-all-space Ignore changes to start-of-line and end-of-line | |
| 1107 | +** whitespace | |
| 1108 | +** -W|--width Width of lines in side-by-side diff | |
| 1109 | +** -Z|--ignore-trailing-space Ignore changes to end-of-line whitespace | |
| 1047 | 1110 | */ |
| 1048 | 1111 | void diff_cmd(void){ |
| 1049 | 1112 | int isGDiff; /* True for gdiff. False for normal diff */ |
| 1050 | 1113 | int isInternDiff; /* True for internal diff */ |
| 1051 | 1114 | int verboseFlag; /* True if -v or --verbose flag is used */ |
| @@ -1071,11 +1134,10 @@ | ||
| 1071 | 1134 | verboseFlag = find_option("verbose","v",0)!=0; |
| 1072 | 1135 | if( !verboseFlag ){ |
| 1073 | 1136 | verboseFlag = find_option("new-file","N",0)!=0; /* deprecated */ |
| 1074 | 1137 | } |
| 1075 | 1138 | if( verboseFlag ) diffFlags |= DIFF_VERBOSE; |
| 1076 | - | |
| 1077 | 1139 | if( zBranch ){ |
| 1078 | 1140 | if( zTo || zFrom ){ |
| 1079 | 1141 | fossil_fatal("cannot use --from or --to with --branch"); |
| 1080 | 1142 | } |
| 1081 | 1143 | zTo = zBranch; |
| 1082 | 1144 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -49,15 +49,25 @@ | |
| 49 | if( diffFlags & DIFF_BRIEF ){ |
| 50 | /* no-op */ |
| 51 | }else if( diffFlags & DIFF_SIDEBYSIDE ){ |
| 52 | int w = diff_width(diffFlags); |
| 53 | int n1 = strlen(zLeft); |
| 54 | int x; |
| 55 | if( n1>w*2 ) n1 = w*2; |
| 56 | x = w*2+17 - (n1+2); |
| 57 | z = mprintf("%.*c %.*s %.*c\n", |
| 58 | x/2, '=', n1, zLeft, (x+1)/2, '='); |
| 59 | }else{ |
| 60 | z = mprintf("--- %s\n+++ %s\n", zLeft, zRight); |
| 61 | } |
| 62 | fossil_print("%s", z); |
| 63 | fossil_free(z); |
| @@ -598,10 +608,11 @@ | |
| 598 | } |
| 599 | |
| 600 | /* A Tcl/Tk script used to render diff output. |
| 601 | */ |
| 602 | static const char zDiffScript[] = |
| 603 | @ package require Tk |
| 604 | @ |
| 605 | @ array set CFG { |
| 606 | @ TITLE {Fossil Diff} |
| 607 | @ LN_COL_BG #dddddd |
| @@ -617,10 +628,11 @@ | |
| 617 | @ HR_PAD_TOP 4 |
| 618 | @ HR_PAD_BTM 8 |
| 619 | @ FN_BG #444444 |
| 620 | @ FN_FG #ffffff |
| 621 | @ FN_PAD 5 |
| 622 | @ PADX 5 |
| 623 | @ WIDTH 80 |
| 624 | @ HEIGHT 45 |
| 625 | @ LB_HEIGHT 25 |
| 626 | @ } |
| @@ -641,43 +653,65 @@ | |
| 641 | @ |
| 642 | @ proc colType {c} { |
| 643 | @ regexp {[a-z]+} $c type |
| 644 | @ return $type |
| 645 | @ } |
| 646 | @ |
| 647 | @ proc readDiffs {fossilcmd} { |
| 648 | @ set in [open $fossilcmd r] |
| 649 | @ fconfigure $in -encoding utf-8 |
| 650 | @ set nDiffs 0 |
| 651 | @ array set widths {txt 0 ln 0 mkr 0} |
| 652 | @ while {[gets $in line] != -1} { |
| 653 | @ if {![regexp {^=+\s+(.*?)\s+=+$} $line all fn]} { |
| 654 | @ continue |
| 655 | @ } |
| 656 | @ if {[string compare -length 6 [gets $in] "<table"]} { |
| 657 | @ continue |
| 658 | @ } |
| 659 | @ incr nDiffs |
| 660 | @ set idx [expr {$nDiffs > 1 ? [.txtA index end] : "1.0"}] |
| 661 | @ .wfiles.lb insert end $fn |
| 662 | @ |
| 663 | @ foreach c [cols] { |
| 664 | @ while {[gets $in] ne "<pre>"} continue |
| 665 | @ |
| 666 | @ if {$nDiffs > 1} { |
| 667 | @ $c insert end \n - |
| 668 | @ } |
| 669 | @ if {[colType $c] eq "txt"} { |
| 670 | @ $c insert end $fn\n fn |
| 671 | @ } else { |
| 672 | @ $c insert end \n fn |
| 673 | @ } |
| 674 | @ $c insert end \n - |
| 675 | @ |
| 676 | @ set type [colType $c] |
| 677 | @ set str {} |
| 678 | @ while {[set line [gets $in]] ne "</pre>"} { |
| 679 | @ set len [string length [dehtml $line]] |
| 680 | @ if {$len > $widths($type)} { |
| 681 | @ set widths($type) $len |
| 682 | @ } |
| 683 | @ append str $line\n |
| @@ -693,12 +727,16 @@ | |
| 693 | @ } else { |
| 694 | @ $c insert end [dehtml $pre] - |
| 695 | @ } |
| 696 | @ } |
| 697 | @ } |
| 698 | @ } |
| 699 | @ close $in |
| 700 | @ |
| 701 | @ foreach c [cols] { |
| 702 | @ set type [colType $c] |
| 703 | @ if {$type ne "txt"} { |
| 704 | @ $c config -width $widths($type) |
| @@ -797,12 +835,12 @@ | |
| 797 | @ bind . <q> exit |
| 798 | @ bind . <Destroy> {after 0 exit} |
| 799 | @ bind . <Tab> {cycleDiffs; break} |
| 800 | @ bind . <<PrevWindow>> {cycleDiffs 1; break} |
| 801 | @ bind . <Return> { |
| 802 | @ event generate .files <1> |
| 803 | @ event generate .files <ButtonRelease-1> |
| 804 | @ break |
| 805 | @ } |
| 806 | @ foreach {key axis args} { |
| 807 | @ Up y {scroll -5 units} |
| 808 | @ Down y {scroll 5 units} |
| @@ -815,21 +853,22 @@ | |
| 815 | @ } { |
| 816 | @ bind . <$key> "scroll-$axis $args; break" |
| 817 | @ bind . <Shift-$key> continue |
| 818 | @ } |
| 819 | @ |
| 820 | @ ::ttk::menubutton .files -text "Files" |
| 821 | @ toplevel .wfiles |
| 822 | @ wm withdraw .wfiles |
| 823 | @ update idletasks |
| 824 | @ wm transient .wfiles . |
| 825 | @ wm overrideredirect .wfiles 1 |
| 826 | @ listbox .wfiles.lb -width 0 -height $CFG(LB_HEIGHT) -activestyle none \ |
| 827 | @ -yscroll {.wfiles.sb set} |
| 828 | @ ::ttk::scrollbar .wfiles.sb -command {.wfiles.lb yview} |
| 829 | @ grid .wfiles.lb .wfiles.sb -sticky ns |
| 830 | @ bind .files <1> { |
| 831 | @ set x [winfo rootx %W] |
| 832 | @ set y [expr {[winfo rooty %W]+[winfo height %W]}] |
| 833 | @ wm geometry .wfiles +$x+$y |
| 834 | @ wm deiconify .wfiles |
| 835 | @ focus .wfiles.lb |
| @@ -864,10 +903,11 @@ | |
| 864 | @ $txt tag config $tag -background $CFG([string toupper $tag]_BG) |
| 865 | @ $txt tag lower $tag |
| 866 | @ } |
| 867 | @ $txt tag config fn -background $CFG(FN_BG) -foreground $CFG(FN_FG) \ |
| 868 | @ -justify center |
| 869 | @ } |
| 870 | @ text .mkr |
| 871 | @ |
| 872 | @ foreach c [cols] { |
| 873 | @ set keyPrefix [string toupper [colType $c]]_COL_ |
| @@ -890,22 +930,42 @@ | |
| 890 | @ tk_messageBox -type ok -title $CFG(TITLE) -message "No changes" |
| 891 | @ exit |
| 892 | @ } |
| 893 | @ update idletasks |
| 894 | @ |
| 895 | @ grid rowconfigure . 1 -weight 1 |
| 896 | @ grid columnconfigure . 1 -weight 1 |
| 897 | @ grid columnconfigure . 4 -weight 1 |
| 898 | @ grid .files -row 0 -columnspan 6 |
| 899 | @ eval grid [cols] -row 1 -sticky nsew |
| 900 | @ grid .sby -row 1 -column 5 -sticky ns |
| 901 | @ grid .sbxA -row 2 -columnspan 2 -sticky ew |
| 902 | @ grid .spacer -row 2 -column 2 |
| 903 | @ grid .sbxB -row 2 -column 3 -columnspan 2 -sticky ew |
| 904 | @ |
| 905 | @ .spacer config -height [winfo height .sbxA] |
| 906 | @ wm deiconify . |
| 907 | ; |
| 908 | |
| 909 | /* |
| 910 | ** Show diff output in a Tcl/Tk window, in response to the --tk option |
| 911 | ** to the diff command. |
| @@ -1029,23 +1089,26 @@ | |
| 1029 | ** The "--binary" option causes files matching the glob PATTERN to be treated |
| 1030 | ** as binary when considering if they should be used with external diff program. |
| 1031 | ** This option overrides the "binary-glob" setting. |
| 1032 | ** |
| 1033 | ** Options: |
| 1034 | ** --binary PATTERN Treat files that match the glob PATTERN as binary |
| 1035 | ** --branch BRANCH Show diff of all changes on BRANCH |
| 1036 | ** --brief Show filenames only |
| 1037 | ** --context|-c N Use N lines of context |
| 1038 | ** --diff-binary BOOL Include binary files when using external commands |
| 1039 | ** --from|-r VERSION select VERSION as source for the diff |
| 1040 | ** --internal|-i use internal diff logic |
| 1041 | ** --side-by-side|-y side-by-side diff |
| 1042 | ** --tk Launch a Tcl/Tk GUI for display |
| 1043 | ** --to VERSION select VERSION as target for the diff |
| 1044 | ** --unified unified diff |
| 1045 | ** -v|--verbose output complete text of added or deleted files |
| 1046 | ** -W|--width Width of lines in side-by-side diff |
| 1047 | */ |
| 1048 | void diff_cmd(void){ |
| 1049 | int isGDiff; /* True for gdiff. False for normal diff */ |
| 1050 | int isInternDiff; /* True for internal diff */ |
| 1051 | int verboseFlag; /* True if -v or --verbose flag is used */ |
| @@ -1071,11 +1134,10 @@ | |
| 1071 | verboseFlag = find_option("verbose","v",0)!=0; |
| 1072 | if( !verboseFlag ){ |
| 1073 | verboseFlag = find_option("new-file","N",0)!=0; /* deprecated */ |
| 1074 | } |
| 1075 | if( verboseFlag ) diffFlags |= DIFF_VERBOSE; |
| 1076 | |
| 1077 | if( zBranch ){ |
| 1078 | if( zTo || zFrom ){ |
| 1079 | fossil_fatal("cannot use --from or --to with --branch"); |
| 1080 | } |
| 1081 | zTo = zBranch; |
| 1082 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -49,15 +49,25 @@ | |
| 49 | if( diffFlags & DIFF_BRIEF ){ |
| 50 | /* no-op */ |
| 51 | }else if( diffFlags & DIFF_SIDEBYSIDE ){ |
| 52 | int w = diff_width(diffFlags); |
| 53 | int n1 = strlen(zLeft); |
| 54 | int n2 = strlen(zRight); |
| 55 | int x; |
| 56 | if( n1==n2 && fossil_strcmp(zLeft,zRight)==0 ){ |
| 57 | if( n1>w*2 ) n1 = w*2; |
| 58 | x = w*2+17 - (n1+2); |
| 59 | z = mprintf("%.*c %.*s %.*c\n", |
| 60 | x/2, '=', n1, zLeft, (x+1)/2, '='); |
| 61 | }else{ |
| 62 | if( w<20 ) w = 20; |
| 63 | if( n1>w-10 ) n1 = w - 10; |
| 64 | if( n2>w-10 ) n2 = w - 10; |
| 65 | z = mprintf("%.*c %.*s %.*c versus %.*c %.*s %.*c\n", |
| 66 | (w-n1+10)/2, '=', n1, zLeft, (w-n1+1)/2, '=', |
| 67 | (w-n2)/2, '=', n2, zRight, (w-n2+1)/2, '='); |
| 68 | } |
| 69 | }else{ |
| 70 | z = mprintf("--- %s\n+++ %s\n", zLeft, zRight); |
| 71 | } |
| 72 | fossil_print("%s", z); |
| 73 | fossil_free(z); |
| @@ -598,10 +608,11 @@ | |
| 608 | } |
| 609 | |
| 610 | /* A Tcl/Tk script used to render diff output. |
| 611 | */ |
| 612 | static const char zDiffScript[] = |
| 613 | @ set prog { |
| 614 | @ package require Tk |
| 615 | @ |
| 616 | @ array set CFG { |
| 617 | @ TITLE {Fossil Diff} |
| 618 | @ LN_COL_BG #dddddd |
| @@ -617,10 +628,11 @@ | |
| 628 | @ HR_PAD_TOP 4 |
| 629 | @ HR_PAD_BTM 8 |
| 630 | @ FN_BG #444444 |
| 631 | @ FN_FG #ffffff |
| 632 | @ FN_PAD 5 |
| 633 | @ ERR_FG #ee0000 |
| 634 | @ PADX 5 |
| 635 | @ WIDTH 80 |
| 636 | @ HEIGHT 45 |
| 637 | @ LB_HEIGHT 25 |
| 638 | @ } |
| @@ -641,43 +653,65 @@ | |
| 653 | @ |
| 654 | @ proc colType {c} { |
| 655 | @ regexp {[a-z]+} $c type |
| 656 | @ return $type |
| 657 | @ } |
| 658 | @ |
| 659 | @ proc getLine {difftxt N iivar} { |
| 660 | @ upvar $iivar ii |
| 661 | @ if {$ii>=$N} {return -1} |
| 662 | @ set x [lindex $difftxt $ii] |
| 663 | @ incr ii |
| 664 | @ return $x |
| 665 | @ } |
| 666 | @ |
| 667 | @ proc readDiffs {fossilcmd} { |
| 668 | @ global difftxt |
| 669 | @ if {![info exists difftxt]} { |
| 670 | @ set in [open $fossilcmd r] |
| 671 | @ fconfigure $in -encoding utf-8 |
| 672 | @ set difftxt [split [read $in] \n] |
| 673 | @ close $in |
| 674 | @ } |
| 675 | @ set N [llength $difftxt] |
| 676 | @ set ii 0 |
| 677 | @ set nDiffs 0 |
| 678 | @ array set widths {txt 0 ln 0 mkr 0} |
| 679 | @ while {[set line [getLine $difftxt $N ii]] != -1} { |
| 680 | @ set fn2 {} |
| 681 | @ if {![regexp {^=+ (.*?) =+ versus =+ (.*?) =+$} $line all fn fn2] |
| 682 | @ && ![regexp {^=+ (.*?) =+$} $line all fn] |
| 683 | @ } { |
| 684 | @ continue |
| 685 | @ } |
| 686 | @ set errMsg "" |
| 687 | @ set line [getLine $difftxt $N ii] |
| 688 | @ if {[string compare -length 6 $line "<table"] |
| 689 | @ && ![regexp {<p[^>]*>(.+)} $line - errMsg]} { |
| 690 | @ continue |
| 691 | @ } |
| 692 | @ incr nDiffs |
| 693 | @ set idx [expr {$nDiffs > 1 ? [.txtA index end] : "1.0"}] |
| 694 | @ .wfiles.lb insert end $fn |
| 695 | @ |
| 696 | @ foreach c [cols] { |
| 697 | @ if {$nDiffs > 1} { |
| 698 | @ $c insert end \n - |
| 699 | @ } |
| 700 | @ if {[colType $c] eq "txt"} { |
| 701 | @ $c insert end $fn\n fn |
| 702 | @ if {$fn2!=""} {set fn $fn2} |
| 703 | @ } else { |
| 704 | @ $c insert end \n fn |
| 705 | @ } |
| 706 | @ $c insert end \n - |
| 707 | @ |
| 708 | @ if {$errMsg ne ""} continue |
| 709 | @ while {[getLine $difftxt $N ii] ne "<pre>"} continue |
| 710 | @ set type [colType $c] |
| 711 | @ set str {} |
| 712 | @ while {[set line [getLine $difftxt $N ii]] ne "</pre>"} { |
| 713 | @ set len [string length [dehtml $line]] |
| 714 | @ if {$len > $widths($type)} { |
| 715 | @ set widths($type) $len |
| 716 | @ } |
| 717 | @ append str $line\n |
| @@ -693,12 +727,16 @@ | |
| 727 | @ } else { |
| 728 | @ $c insert end [dehtml $pre] - |
| 729 | @ } |
| 730 | @ } |
| 731 | @ } |
| 732 | @ |
| 733 | @ if {$errMsg ne ""} { |
| 734 | @ foreach c {.txtA .txtB} {$c insert end [string trim $errMsg] err} |
| 735 | @ foreach c [cols] {$c insert end \n -} |
| 736 | @ } |
| 737 | @ } |
| 738 | @ |
| 739 | @ foreach c [cols] { |
| 740 | @ set type [colType $c] |
| 741 | @ if {$type ne "txt"} { |
| 742 | @ $c config -width $widths($type) |
| @@ -797,12 +835,12 @@ | |
| 835 | @ bind . <q> exit |
| 836 | @ bind . <Destroy> {after 0 exit} |
| 837 | @ bind . <Tab> {cycleDiffs; break} |
| 838 | @ bind . <<PrevWindow>> {cycleDiffs 1; break} |
| 839 | @ bind . <Return> { |
| 840 | @ event generate .bb.files <1> |
| 841 | @ event generate .bb.files <ButtonRelease-1> |
| 842 | @ break |
| 843 | @ } |
| 844 | @ foreach {key axis args} { |
| 845 | @ Up y {scroll -5 units} |
| 846 | @ Down y {scroll 5 units} |
| @@ -815,21 +853,22 @@ | |
| 853 | @ } { |
| 854 | @ bind . <$key> "scroll-$axis $args; break" |
| 855 | @ bind . <Shift-$key> continue |
| 856 | @ } |
| 857 | @ |
| 858 | @ frame .bb |
| 859 | @ ::ttk::menubutton .bb.files -text "Files" |
| 860 | @ toplevel .wfiles |
| 861 | @ wm withdraw .wfiles |
| 862 | @ update idletasks |
| 863 | @ wm transient .wfiles . |
| 864 | @ wm overrideredirect .wfiles 1 |
| 865 | @ listbox .wfiles.lb -width 0 -height $CFG(LB_HEIGHT) -activestyle none \ |
| 866 | @ -yscroll {.wfiles.sb set} |
| 867 | @ ::ttk::scrollbar .wfiles.sb -command {.wfiles.lb yview} |
| 868 | @ grid .wfiles.lb .wfiles.sb -sticky ns |
| 869 | @ bind .bb.files <1> { |
| 870 | @ set x [winfo rootx %W] |
| 871 | @ set y [expr {[winfo rooty %W]+[winfo height %W]}] |
| 872 | @ wm geometry .wfiles +$x+$y |
| 873 | @ wm deiconify .wfiles |
| 874 | @ focus .wfiles.lb |
| @@ -864,10 +903,11 @@ | |
| 903 | @ $txt tag config $tag -background $CFG([string toupper $tag]_BG) |
| 904 | @ $txt tag lower $tag |
| 905 | @ } |
| 906 | @ $txt tag config fn -background $CFG(FN_BG) -foreground $CFG(FN_FG) \ |
| 907 | @ -justify center |
| 908 | @ $txt tag config err -foreground $CFG(ERR_FG) |
| 909 | @ } |
| 910 | @ text .mkr |
| 911 | @ |
| 912 | @ foreach c [cols] { |
| 913 | @ set keyPrefix [string toupper [colType $c]]_COL_ |
| @@ -890,22 +930,42 @@ | |
| 930 | @ tk_messageBox -type ok -title $CFG(TITLE) -message "No changes" |
| 931 | @ exit |
| 932 | @ } |
| 933 | @ update idletasks |
| 934 | @ |
| 935 | @ proc saveDiff {} { |
| 936 | @ set fn [tk_getSaveFile] |
| 937 | @ set out [open $fn wb] |
| 938 | @ puts $out "#!/usr/bin/tclsh\n#\n# Run this script using 'tclsh' or 'wish'" |
| 939 | @ puts $out "# to see the graphical diff.\n#" |
| 940 | @ puts $out "set fossilcmd {}" |
| 941 | @ puts $out "set prog [list $::prog]" |
| 942 | @ puts $out "set difftxt \173" |
| 943 | @ foreach e $::difftxt {puts $out [list $e]} |
| 944 | @ puts $out "\175" |
| 945 | @ puts $out "eval \$prog" |
| 946 | @ close $out |
| 947 | @ } |
| 948 | @ ::ttk::button .bb.quit -text {Quit} -command exit |
| 949 | @ ::ttk::button .bb.save -text {Save As...} -command saveDiff |
| 950 | @ pack .bb.quit -side left |
| 951 | @ if {$fossilcmd!=""} {pack .bb.save -side left} |
| 952 | @ pack .bb.files -side left |
| 953 | @ grid rowconfigure . 1 -weight 1 |
| 954 | @ grid columnconfigure . 1 -weight 1 |
| 955 | @ grid columnconfigure . 4 -weight 1 |
| 956 | @ grid .bb -row 0 -columnspan 6 |
| 957 | @ eval grid [cols] -row 1 -sticky nsew |
| 958 | @ grid .sby -row 1 -column 5 -sticky ns |
| 959 | @ grid .sbxA -row 2 -columnspan 2 -sticky ew |
| 960 | @ grid .spacer -row 2 -column 2 |
| 961 | @ grid .sbxB -row 2 -column 3 -columnspan 2 -sticky ew |
| 962 | @ |
| 963 | @ .spacer config -height [winfo height .sbxA] |
| 964 | @ wm deiconify . |
| 965 | @ } |
| 966 | @ eval $prog |
| 967 | ; |
| 968 | |
| 969 | /* |
| 970 | ** Show diff output in a Tcl/Tk window, in response to the --tk option |
| 971 | ** to the diff command. |
| @@ -1029,23 +1089,26 @@ | |
| 1089 | ** The "--binary" option causes files matching the glob PATTERN to be treated |
| 1090 | ** as binary when considering if they should be used with external diff program. |
| 1091 | ** This option overrides the "binary-glob" setting. |
| 1092 | ** |
| 1093 | ** Options: |
| 1094 | ** --binary PATTERN Treat files that match the glob PATTERN as binary |
| 1095 | ** --branch BRANCH Show diff of all changes on BRANCH |
| 1096 | ** --brief Show filenames only |
| 1097 | ** --context|-c N Use N lines of context |
| 1098 | ** --diff-binary BOOL Include binary files when using external commands |
| 1099 | ** --from|-r VERSION select VERSION as source for the diff |
| 1100 | ** --internal|-i use internal diff logic |
| 1101 | ** --side-by-side|-y side-by-side diff |
| 1102 | ** --tk Launch a Tcl/Tk GUI for display |
| 1103 | ** --to VERSION select VERSION as target for the diff |
| 1104 | ** --unified unified diff |
| 1105 | ** -v|--verbose output complete text of added or deleted files |
| 1106 | ** -w|--ignore-all-space Ignore changes to start-of-line and end-of-line |
| 1107 | ** whitespace |
| 1108 | ** -W|--width Width of lines in side-by-side diff |
| 1109 | ** -Z|--ignore-trailing-space Ignore changes to end-of-line whitespace |
| 1110 | */ |
| 1111 | void diff_cmd(void){ |
| 1112 | int isGDiff; /* True for gdiff. False for normal diff */ |
| 1113 | int isInternDiff; /* True for internal diff */ |
| 1114 | int verboseFlag; /* True if -v or --verbose flag is used */ |
| @@ -1071,11 +1134,10 @@ | |
| 1134 | verboseFlag = find_option("verbose","v",0)!=0; |
| 1135 | if( !verboseFlag ){ |
| 1136 | verboseFlag = find_option("new-file","N",0)!=0; /* deprecated */ |
| 1137 | } |
| 1138 | if( verboseFlag ) diffFlags |= DIFF_VERBOSE; |
| 1139 | if( zBranch ){ |
| 1140 | if( zTo || zFrom ){ |
| 1141 | fossil_fatal("cannot use --from or --to with --branch"); |
| 1142 | } |
| 1143 | zTo = zBranch; |
| 1144 |
+10
-10
| --- src/event.c | ||
| +++ src/event.c | ||
| @@ -185,11 +185,11 @@ | ||
| 185 | 185 | blob_init(&comment, pEvent->zComment, -1); |
| 186 | 186 | wiki_convert(&comment, 0, WIKI_INLINE); |
| 187 | 187 | blob_reset(&comment); |
| 188 | 188 | @ </div> |
| 189 | 189 | @ </blockquote><hr /> |
| 190 | - } | |
| 190 | + } | |
| 191 | 191 | |
| 192 | 192 | wiki_convert(&tail, 0, 0); |
| 193 | 193 | style_footer(); |
| 194 | 194 | manifest_destroy(pEvent); |
| 195 | 195 | } |
| @@ -227,11 +227,11 @@ | ||
| 227 | 227 | fossil_redirect_home(); |
| 228 | 228 | return; |
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | zTag = mprintf("event-%s", zEventId); |
| 232 | - rid = db_int(0, | |
| 232 | + rid = db_int(0, | |
| 233 | 233 | "SELECT rid FROM tagxref" |
| 234 | 234 | " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)" |
| 235 | 235 | " ORDER BY mtime DESC", zTag |
| 236 | 236 | ); |
| 237 | 237 | free(zTag); |
| @@ -312,11 +312,11 @@ | ||
| 312 | 312 | Stmt q; |
| 313 | 313 | char *zBlob; |
| 314 | 314 | |
| 315 | 315 | /* Load the tags string into a blob */ |
| 316 | 316 | blob_zero(&tags); |
| 317 | - blob_append(&tags, zTags, -1); | |
| 317 | + blob_append(&tags, zTags, -1); | |
| 318 | 318 | |
| 319 | 319 | /* Collapse all sequences of whitespace and "," characters into |
| 320 | 320 | ** a single space character */ |
| 321 | 321 | zBlob = blob_str(&tags); |
| 322 | 322 | for(i=j=0; zBlob[i]; i++, j++){ |
| @@ -341,13 +341,13 @@ | ||
| 341 | 341 | db_prepare(&q, "SELECT x FROM newtags ORDER BY x"); |
| 342 | 342 | while( db_step(&q)==SQLITE_ROW ){ |
| 343 | 343 | blob_appendf(&event, "T +sym-%F *\n", db_column_text(&q, 0)); |
| 344 | 344 | } |
| 345 | 345 | 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()); | |
| 349 | 349 | } |
| 350 | 350 | blob_appendf(&event, "W %d\n%s\n", strlen(zBody), zBody); |
| 351 | 351 | md5sum_blob(&event, &cksum); |
| 352 | 352 | blob_appendf(&event, "Z %b\n", &cksum); |
| 353 | 353 | blob_reset(&cksum); |
| @@ -411,27 +411,27 @@ | ||
| 411 | 411 | @ <input type="text" name="t" size="25" value="%h(zETime)" /> |
| 412 | 412 | @ </td></tr> |
| 413 | 413 | |
| 414 | 414 | @ <tr><th align="right" valign="top">Timeline Comment:</th> |
| 415 | 415 | @ <td valign="top"> |
| 416 | - @ <textarea name="c" class="eventedit" cols="80" | |
| 416 | + @ <textarea name="c" class="eventedit" cols="80" | |
| 417 | 417 | @ rows="3" wrap="virtual">%h(zComment)</textarea> |
| 418 | 418 | @ </td></tr> |
| 419 | 419 | |
| 420 | 420 | @ <tr><th align="right" valign="top">Background Color:</th> |
| 421 | 421 | @ <td valign="top"> |
| 422 | 422 | render_color_chooser(0, zClr, 0, "clr", "cclr"); |
| 423 | 423 | @ </td></tr> |
| 424 | - | |
| 424 | + | |
| 425 | 425 | @ <tr><th align="right" valign="top">Tags:</th> |
| 426 | 426 | @ <td valign="top"> |
| 427 | 427 | @ <input type="text" name="g" size="40" value="%h(zTags)" /> |
| 428 | 428 | @ </td></tr> |
| 429 | - | |
| 429 | + | |
| 430 | 430 | @ <tr><th align="right" valign="top">Page Content:</th> |
| 431 | 431 | @ <td valign="top"> |
| 432 | - @ <textarea name="w" class="eventedit" cols="80" | |
| 432 | + @ <textarea name="w" class="eventedit" cols="80" | |
| 433 | 433 | @ rows="%d(n)" wrap="virtual">%h(zBody)</textarea> |
| 434 | 434 | @ </td></tr> |
| 435 | 435 | |
| 436 | 436 | @ <tr><td colspan="2"> |
| 437 | 437 | @ <input type="submit" name="preview" value="Preview Your Changes" /> |
| 438 | 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( 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 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 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 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 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 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 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 @@ | ||
| 393 | 393 | FILE *in, *out; |
| 394 | 394 | int got; |
| 395 | 395 | char zBuf[8192]; |
| 396 | 396 | in = fossil_fopen(zFrom, "rb"); |
| 397 | 397 | if( in==0 ) fossil_fatal("cannot open \"%s\" for reading", zFrom); |
| 398 | + file_mkfolder(zTo, 0); | |
| 398 | 399 | out = fossil_fopen(zTo, "wb"); |
| 399 | 400 | if( out==0 ) fossil_fatal("cannot open \"%s\" for writing", zTo); |
| 400 | 401 | while( (got=fread(zBuf, 1, sizeof(zBuf), in))>0 ){ |
| 401 | 402 | fwrite(zBuf, 1, got, out); |
| 402 | 403 | } |
| 403 | 404 | fclose(in); |
| 404 | 405 | fclose(out); |
| 405 | 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 | +} | |
| 406 | 423 | |
| 407 | 424 | /* |
| 408 | 425 | ** Set or clear the execute bit on a file. Return true if a change |
| 409 | 426 | ** occurred and false if this routine is a no-op. |
| 410 | 427 | */ |
| @@ -516,10 +533,45 @@ | ||
| 516 | 533 | fossil_filename_free(zMbcs); |
| 517 | 534 | return rc; |
| 518 | 535 | } |
| 519 | 536 | return 0; |
| 520 | 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 | +} | |
| 521 | 573 | |
| 522 | 574 | /* |
| 523 | 575 | ** Removes the directory named in the argument, if it exists. The directory |
| 524 | 576 | ** must be empty and cannot be the current directory or the root directory. |
| 525 | 577 | ** |
| @@ -644,10 +696,11 @@ | ||
| 644 | 696 | } |
| 645 | 697 | |
| 646 | 698 | /* |
| 647 | 699 | ** Simplify a filename by |
| 648 | 700 | ** |
| 701 | +** * Remove extended path prefix on windows and cygwin | |
| 649 | 702 | ** * Convert all \ into / on windows and cygwin |
| 650 | 703 | ** * removing any trailing and duplicate / |
| 651 | 704 | ** * removing /./ |
| 652 | 705 | ** * removing /A/../ |
| 653 | 706 | ** |
| @@ -654,17 +707,27 @@ | ||
| 654 | 707 | ** Changes are made in-place. Return the new name length. |
| 655 | 708 | ** If the slash parameter is non-zero, the trailing slash, if any, |
| 656 | 709 | ** is retained. |
| 657 | 710 | */ |
| 658 | 711 | int file_simplify_name(char *z, int n, int slash){ |
| 659 | - int i, j; | |
| 712 | + int i = 1, j; | |
| 660 | 713 | if( n<0 ) n = strlen(z); |
| 661 | 714 | |
| 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 */ | |
| 663 | 717 | #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 | + } | |
| 666 | 729 | } |
| 667 | 730 | #endif |
| 668 | 731 | |
| 669 | 732 | /* Removing trailing "/" characters */ |
| 670 | 733 | if( !slash ){ |
| @@ -671,11 +734,11 @@ | ||
| 671 | 734 | while( n>1 && z[n-1]=='/' ){ n--; } |
| 672 | 735 | } |
| 673 | 736 | |
| 674 | 737 | /* Remove duplicate '/' characters. Except, two // at the beginning |
| 675 | 738 | ** 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++){ | |
| 677 | 740 | z[j++] = z[i]; |
| 678 | 741 | while( z[i]=='/' && i<n-1 && z[i+1]=='/' ) i++; |
| 679 | 742 | } |
| 680 | 743 | n = j; |
| 681 | 744 | |
| 682 | 745 |
| --- 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 @@ | ||
| 19 | 19 | */ |
| 20 | 20 | #include "config.h" |
| 21 | 21 | #include "http.h" |
| 22 | 22 | #include <assert.h> |
| 23 | 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 | + | |
| 24 | 40 | /* |
| 25 | 41 | ** Construct the "login" card with the client credentials. |
| 26 | 42 | ** |
| 27 | 43 | ** login LOGIN NONCE SIGNATURE |
| 28 | 44 | ** |
| @@ -62,16 +78,10 @@ | ||
| 62 | 78 | /* Password failure while doing a sync from the command-line interface */ |
| 63 | 79 | url_prompt_for_password(); |
| 64 | 80 | zPw = g.urlPasswd; |
| 65 | 81 | } |
| 66 | 82 | |
| 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 | 83 | /* The login card wants the SHA1 hash of the password, so convert the |
| 74 | 84 | ** password to its SHA1 hash it it isn't already a SHA1 hash. |
| 75 | 85 | */ |
| 76 | 86 | /* fossil_print("\nzPw=[%s]\n", zPw); // TESTING ONLY */ |
| 77 | 87 | if( zPw && zPw[0] ) zPw = sha1_shared_secret(zPw, zLogin, 0); |
| @@ -102,16 +112,15 @@ | ||
| 102 | 112 | } |
| 103 | 113 | blob_appendf(pHdr, "POST %s%sxfer/xfer HTTP/1.0\r\n", g.urlPath, zSep); |
| 104 | 114 | if( g.urlProxyAuth ){ |
| 105 | 115 | blob_appendf(pHdr, "Proxy-Authorization: %s\r\n", g.urlProxyAuth); |
| 106 | 116 | } |
| 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; | |
| 109 | 119 | char *zEncoded = encode64(zCredentials, -1); |
| 110 | 120 | blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded); |
| 111 | 121 | fossil_free(zEncoded); |
| 112 | - fossil_free(zCredentials); | |
| 113 | 122 | } |
| 114 | 123 | blob_appendf(pHdr, "Host: %s\r\n", g.urlHostname); |
| 115 | 124 | blob_appendf(pHdr, "User-Agent: %s\r\n", get_user_agent()); |
| 116 | 125 | if( g.urlIsSsh ) blob_appendf(pHdr, "X-Fossil-Transport: SSH\r\n"); |
| 117 | 126 | if( g.fHttpTrace ){ |
| @@ -119,10 +128,71 @@ | ||
| 119 | 128 | }else{ |
| 120 | 129 | blob_appendf(pHdr, "Content-Type: application/x-fossil\r\n"); |
| 121 | 130 | } |
| 122 | 131 | blob_appendf(pHdr, "Content-Length: %d\r\n\r\n", blob_size(pPayload)); |
| 123 | 132 | } |
| 133 | + | |
| 134 | +/* | |
| 135 | +** Use Fossil credentials for HTTP Basic Authorization prompt | |
| 136 | +*/ | |
| 137 | +static int use_fossil_creds_for_httpauth_prompt(void){ | |
| 138 | + Blob x; | |
| 139 | + char c; | |
| 140 | + prompt_user("Use Fossil username and password (y/N)? ", &x); | |
| 141 | + c = blob_str(&x)[0]; | |
| 142 | + blob_reset(&x); | |
| 143 | + return ( c=='y' || c=='Y' ); | |
| 144 | +} | |
| 145 | + | |
| 146 | +/* | |
| 147 | +** Prompt to save HTTP Basic Authorization information | |
| 148 | +*/ | |
| 149 | +static int save_httpauth_prompt(void){ | |
| 150 | + Blob x; | |
| 151 | + char c; | |
| 152 | + if( (g.urlFlags & URL_REMEMBER)==0 ) return; | |
| 153 | + prompt_user("Remember Basic Authorization credentials (Y/n)? ", &x); | |
| 154 | + c = blob_str(&x)[0]; | |
| 155 | + blob_reset(&x); | |
| 156 | + return ( c!='n' && c!='N' ); | |
| 157 | +} | |
| 158 | + | |
| 159 | +/* | |
| 160 | +** Get the HTTP Basic Authorization credentials from the user | |
| 161 | +** when 401 is received. | |
| 162 | +*/ | |
| 163 | +char *prompt_for_httpauth_creds(void){ | |
| 164 | + Blob x; | |
| 165 | + char *zUser; | |
| 166 | + char *zPw; | |
| 167 | + char *zPrompt; | |
| 168 | + char *zHttpAuth = 0; | |
| 169 | + if( !isatty(fileno(stdin)) ) return 0; | |
| 170 | + zPrompt = mprintf("\n%s authorization required by\n%s\n", | |
| 171 | + g.urlIsHttps==1 ? "Encrypted HTTPS" : "Unencrypted HTTP", g.urlCanonical); | |
| 172 | + fossil_print(zPrompt); | |
| 173 | + free(zPrompt); | |
| 174 | + if ( g.urlUser && g.urlPasswd && use_fossil_creds_for_httpauth_prompt() ){ | |
| 175 | + zHttpAuth = mprintf("%s:%s", g.urlUser, g.urlPasswd); | |
| 176 | + }else{ | |
| 177 | + prompt_user("Basic Authorization user: ", &x); | |
| 178 | + zUser = mprintf("%b", &x); | |
| 179 | + zPrompt = mprintf("HTTP password for %b: ", &x); | |
| 180 | + blob_reset(&x); | |
| 181 | + prompt_for_password(zPrompt, &x, 1); | |
| 182 | + zPw = mprintf("%b", &x); | |
| 183 | + zHttpAuth = mprintf("%s:%s", zUser, zPw); | |
| 184 | + free(zUser); | |
| 185 | + free(zPw); | |
| 186 | + free(zPrompt); | |
| 187 | + blob_reset(&x); | |
| 188 | + } | |
| 189 | + if( save_httpauth_prompt() ){ | |
| 190 | + set_httpauth(zHttpAuth); | |
| 191 | + } | |
| 192 | + return zHttpAuth; | |
| 193 | +} | |
| 124 | 194 | |
| 125 | 195 | /* |
| 126 | 196 | ** Sign the content in pSend, compress it, and send it to the server |
| 127 | 197 | ** via HTTP or HTTPS. Get a reply, uncompress the reply, and store the reply |
| 128 | 198 | ** in pRecv. pRecv is assumed to be uninitialized when |
| @@ -205,10 +275,20 @@ | ||
| 205 | 275 | iLength = -1; |
| 206 | 276 | while( (zLine = transport_receive_line(GLOBAL_URL()))!=0 && zLine[0]!=0 ){ |
| 207 | 277 | /* printf("[%s]\n", zLine); fflush(stdout); */ |
| 208 | 278 | if( fossil_strnicmp(zLine, "http/1.", 7)==0 ){ |
| 209 | 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 | + } | |
| 210 | 290 | if( rc!=200 && rc!=302 ){ |
| 211 | 291 | int ii; |
| 212 | 292 | for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){} |
| 213 | 293 | while( zLine[ii]==' ' ) ii++; |
| 214 | 294 | fossil_warning("server says: %s", &zLine[ii]); |
| @@ -254,10 +334,13 @@ | ||
| 254 | 334 | j -= 4; |
| 255 | 335 | zLine[j] = 0; |
| 256 | 336 | } |
| 257 | 337 | fossil_print("redirect to %s\n", &zLine[i]); |
| 258 | 338 | url_parse(&zLine[i], 0); |
| 339 | + fSeenHttpAuth = 0; | |
| 340 | + if( g.zHttpAuth ) free(g.zHttpAuth); | |
| 341 | + g.zHttpAuth = get_httpauth(); | |
| 259 | 342 | transport_close(GLOBAL_URL()); |
| 260 | 343 | return http_exchange(pSend, pReply, useLogin, maxRedirect); |
| 261 | 344 | }else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){ |
| 262 | 345 | if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){ |
| 263 | 346 | isCompressed = 0; |
| 264 | 347 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -19,10 +19,26 @@ | |
| 19 | */ |
| 20 | #include "config.h" |
| 21 | #include "http.h" |
| 22 | #include <assert.h> |
| 23 | |
| 24 | /* |
| 25 | ** Construct the "login" card with the client credentials. |
| 26 | ** |
| 27 | ** login LOGIN NONCE SIGNATURE |
| 28 | ** |
| @@ -62,16 +78,10 @@ | |
| 62 | /* Password failure while doing a sync from the command-line interface */ |
| 63 | url_prompt_for_password(); |
| 64 | zPw = g.urlPasswd; |
| 65 | } |
| 66 | |
| 67 | /* If the first character of the password is "#", then that character is |
| 68 | ** not really part of the password - it is an indicator that we should |
| 69 | ** use Basic Authentication. So skip that character. |
| 70 | */ |
| 71 | if( zPw && zPw[0]=='#' ) zPw++; |
| 72 | |
| 73 | /* The login card wants the SHA1 hash of the password, so convert the |
| 74 | ** password to its SHA1 hash it it isn't already a SHA1 hash. |
| 75 | */ |
| 76 | /* fossil_print("\nzPw=[%s]\n", zPw); // TESTING ONLY */ |
| 77 | if( zPw && zPw[0] ) zPw = sha1_shared_secret(zPw, zLogin, 0); |
| @@ -102,16 +112,15 @@ | |
| 102 | } |
| 103 | blob_appendf(pHdr, "POST %s%sxfer/xfer HTTP/1.0\r\n", g.urlPath, zSep); |
| 104 | if( g.urlProxyAuth ){ |
| 105 | blob_appendf(pHdr, "Proxy-Authorization: %s\r\n", g.urlProxyAuth); |
| 106 | } |
| 107 | if( g.urlPasswd && g.urlUser && g.urlPasswd[0]=='#' ){ |
| 108 | char *zCredentials = mprintf("%s:%s", g.urlUser, &g.urlPasswd[1]); |
| 109 | char *zEncoded = encode64(zCredentials, -1); |
| 110 | blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded); |
| 111 | fossil_free(zEncoded); |
| 112 | fossil_free(zCredentials); |
| 113 | } |
| 114 | blob_appendf(pHdr, "Host: %s\r\n", g.urlHostname); |
| 115 | blob_appendf(pHdr, "User-Agent: %s\r\n", get_user_agent()); |
| 116 | if( g.urlIsSsh ) blob_appendf(pHdr, "X-Fossil-Transport: SSH\r\n"); |
| 117 | if( g.fHttpTrace ){ |
| @@ -119,10 +128,71 @@ | |
| 119 | }else{ |
| 120 | blob_appendf(pHdr, "Content-Type: application/x-fossil\r\n"); |
| 121 | } |
| 122 | blob_appendf(pHdr, "Content-Length: %d\r\n\r\n", blob_size(pPayload)); |
| 123 | } |
| 124 | |
| 125 | /* |
| 126 | ** Sign the content in pSend, compress it, and send it to the server |
| 127 | ** via HTTP or HTTPS. Get a reply, uncompress the reply, and store the reply |
| 128 | ** in pRecv. pRecv is assumed to be uninitialized when |
| @@ -205,10 +275,20 @@ | |
| 205 | iLength = -1; |
| 206 | while( (zLine = transport_receive_line(GLOBAL_URL()))!=0 && zLine[0]!=0 ){ |
| 207 | /* printf("[%s]\n", zLine); fflush(stdout); */ |
| 208 | if( fossil_strnicmp(zLine, "http/1.", 7)==0 ){ |
| 209 | if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err; |
| 210 | if( rc!=200 && rc!=302 ){ |
| 211 | int ii; |
| 212 | for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){} |
| 213 | while( zLine[ii]==' ' ) ii++; |
| 214 | fossil_warning("server says: %s", &zLine[ii]); |
| @@ -254,10 +334,13 @@ | |
| 254 | j -= 4; |
| 255 | zLine[j] = 0; |
| 256 | } |
| 257 | fossil_print("redirect to %s\n", &zLine[i]); |
| 258 | url_parse(&zLine[i], 0); |
| 259 | transport_close(GLOBAL_URL()); |
| 260 | return http_exchange(pSend, pReply, useLogin, maxRedirect); |
| 261 | }else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){ |
| 262 | if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){ |
| 263 | isCompressed = 0; |
| 264 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -19,10 +19,26 @@ | |
| 19 | */ |
| 20 | #include "config.h" |
| 21 | #include "http.h" |
| 22 | #include <assert.h> |
| 23 | |
| 24 | #ifdef _WIN32 |
| 25 | #include <io.h> |
| 26 | #ifndef isatty |
| 27 | #define isatty(d) _isatty(d) |
| 28 | #endif |
| 29 | #ifndef fileno |
| 30 | #define fileno(s) _fileno(s) |
| 31 | #endif |
| 32 | #endif |
| 33 | |
| 34 | /* Maximum number of HTTP Authorization attempts */ |
| 35 | #define MAX_HTTP_AUTH 2 |
| 36 | |
| 37 | /* Keep track of HTTP Basic Authorization failures */ |
| 38 | static int fSeenHttpAuth = 0; |
| 39 | |
| 40 | /* |
| 41 | ** Construct the "login" card with the client credentials. |
| 42 | ** |
| 43 | ** login LOGIN NONCE SIGNATURE |
| 44 | ** |
| @@ -62,16 +78,10 @@ | |
| 78 | /* Password failure while doing a sync from the command-line interface */ |
| 79 | url_prompt_for_password(); |
| 80 | zPw = g.urlPasswd; |
| 81 | } |
| 82 | |
| 83 | /* The login card wants the SHA1 hash of the password, so convert the |
| 84 | ** password to its SHA1 hash it it isn't already a SHA1 hash. |
| 85 | */ |
| 86 | /* fossil_print("\nzPw=[%s]\n", zPw); // TESTING ONLY */ |
| 87 | if( zPw && zPw[0] ) zPw = sha1_shared_secret(zPw, zLogin, 0); |
| @@ -102,16 +112,15 @@ | |
| 112 | } |
| 113 | blob_appendf(pHdr, "POST %s%sxfer/xfer HTTP/1.0\r\n", g.urlPath, zSep); |
| 114 | if( g.urlProxyAuth ){ |
| 115 | blob_appendf(pHdr, "Proxy-Authorization: %s\r\n", g.urlProxyAuth); |
| 116 | } |
| 117 | if( g.zHttpAuth && g.zHttpAuth[0] ){ |
| 118 | const char *zCredentials = g.zHttpAuth; |
| 119 | char *zEncoded = encode64(zCredentials, -1); |
| 120 | blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded); |
| 121 | fossil_free(zEncoded); |
| 122 | } |
| 123 | blob_appendf(pHdr, "Host: %s\r\n", g.urlHostname); |
| 124 | blob_appendf(pHdr, "User-Agent: %s\r\n", get_user_agent()); |
| 125 | if( g.urlIsSsh ) blob_appendf(pHdr, "X-Fossil-Transport: SSH\r\n"); |
| 126 | if( g.fHttpTrace ){ |
| @@ -119,10 +128,71 @@ | |
| 128 | }else{ |
| 129 | blob_appendf(pHdr, "Content-Type: application/x-fossil\r\n"); |
| 130 | } |
| 131 | blob_appendf(pHdr, "Content-Length: %d\r\n\r\n", blob_size(pPayload)); |
| 132 | } |
| 133 | |
| 134 | /* |
| 135 | ** Use Fossil credentials for HTTP Basic Authorization prompt |
| 136 | */ |
| 137 | static int use_fossil_creds_for_httpauth_prompt(void){ |
| 138 | Blob x; |
| 139 | char c; |
| 140 | prompt_user("Use Fossil username and password (y/N)? ", &x); |
| 141 | c = blob_str(&x)[0]; |
| 142 | blob_reset(&x); |
| 143 | return ( c=='y' || c=='Y' ); |
| 144 | } |
| 145 | |
| 146 | /* |
| 147 | ** Prompt to save HTTP Basic Authorization information |
| 148 | */ |
| 149 | static int save_httpauth_prompt(void){ |
| 150 | Blob x; |
| 151 | char c; |
| 152 | if( (g.urlFlags & URL_REMEMBER)==0 ) return; |
| 153 | prompt_user("Remember Basic Authorization credentials (Y/n)? ", &x); |
| 154 | c = blob_str(&x)[0]; |
| 155 | blob_reset(&x); |
| 156 | return ( c!='n' && c!='N' ); |
| 157 | } |
| 158 | |
| 159 | /* |
| 160 | ** Get the HTTP Basic Authorization credentials from the user |
| 161 | ** when 401 is received. |
| 162 | */ |
| 163 | char *prompt_for_httpauth_creds(void){ |
| 164 | Blob x; |
| 165 | char *zUser; |
| 166 | char *zPw; |
| 167 | char *zPrompt; |
| 168 | char *zHttpAuth = 0; |
| 169 | if( !isatty(fileno(stdin)) ) return 0; |
| 170 | zPrompt = mprintf("\n%s authorization required by\n%s\n", |
| 171 | g.urlIsHttps==1 ? "Encrypted HTTPS" : "Unencrypted HTTP", g.urlCanonical); |
| 172 | fossil_print(zPrompt); |
| 173 | free(zPrompt); |
| 174 | if ( g.urlUser && g.urlPasswd && use_fossil_creds_for_httpauth_prompt() ){ |
| 175 | zHttpAuth = mprintf("%s:%s", g.urlUser, g.urlPasswd); |
| 176 | }else{ |
| 177 | prompt_user("Basic Authorization user: ", &x); |
| 178 | zUser = mprintf("%b", &x); |
| 179 | zPrompt = mprintf("HTTP password for %b: ", &x); |
| 180 | blob_reset(&x); |
| 181 | prompt_for_password(zPrompt, &x, 1); |
| 182 | zPw = mprintf("%b", &x); |
| 183 | zHttpAuth = mprintf("%s:%s", zUser, zPw); |
| 184 | free(zUser); |
| 185 | free(zPw); |
| 186 | free(zPrompt); |
| 187 | blob_reset(&x); |
| 188 | } |
| 189 | if( save_httpauth_prompt() ){ |
| 190 | set_httpauth(zHttpAuth); |
| 191 | } |
| 192 | return zHttpAuth; |
| 193 | } |
| 194 | |
| 195 | /* |
| 196 | ** Sign the content in pSend, compress it, and send it to the server |
| 197 | ** via HTTP or HTTPS. Get a reply, uncompress the reply, and store the reply |
| 198 | ** in pRecv. pRecv is assumed to be uninitialized when |
| @@ -205,10 +275,20 @@ | |
| 275 | iLength = -1; |
| 276 | while( (zLine = transport_receive_line(GLOBAL_URL()))!=0 && zLine[0]!=0 ){ |
| 277 | /* printf("[%s]\n", zLine); fflush(stdout); */ |
| 278 | if( fossil_strnicmp(zLine, "http/1.", 7)==0 ){ |
| 279 | if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err; |
| 280 | if( rc==401 ){ |
| 281 | if( fSeenHttpAuth++ < MAX_HTTP_AUTH ){ |
| 282 | if( g.zHttpAuth ){ |
| 283 | if( g.zHttpAuth ) free(g.zHttpAuth); |
| 284 | } |
| 285 | g.zHttpAuth = prompt_for_httpauth_creds(); |
| 286 | transport_close(GLOBAL_URL()); |
| 287 | return http_exchange(pSend, pReply, useLogin, maxRedirect); |
| 288 | } |
| 289 | } |
| 290 | if( rc!=200 && rc!=302 ){ |
| 291 | int ii; |
| 292 | for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){} |
| 293 | while( zLine[ii]==' ' ) ii++; |
| 294 | fossil_warning("server says: %s", &zLine[ii]); |
| @@ -254,10 +334,13 @@ | |
| 334 | j -= 4; |
| 335 | zLine[j] = 0; |
| 336 | } |
| 337 | fossil_print("redirect to %s\n", &zLine[i]); |
| 338 | url_parse(&zLine[i], 0); |
| 339 | fSeenHttpAuth = 0; |
| 340 | if( g.zHttpAuth ) free(g.zHttpAuth); |
| 341 | g.zHttpAuth = get_httpauth(); |
| 342 | transport_close(GLOBAL_URL()); |
| 343 | return http_exchange(pSend, pReply, useLogin, maxRedirect); |
| 344 | }else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){ |
| 345 | if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){ |
| 346 | isCompressed = 0; |
| 347 |
+117
-91
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -449,20 +449,23 @@ | ||
| 449 | 449 | if( verboseFlag==0 ){ |
| 450 | 450 | diffFlags = 0; /* Zero means do not show any diff */ |
| 451 | 451 | }else{ |
| 452 | 452 | int x; |
| 453 | 453 | if( sideBySide ){ |
| 454 | - diffFlags = DIFF_SIDEBYSIDE | DIFF_IGNORE_EOLWS; | |
| 454 | + diffFlags = DIFF_SIDEBYSIDE; | |
| 455 | 455 | |
| 456 | 456 | /* "dw" query parameter determines width of each column */ |
| 457 | 457 | x = atoi(PD("dw","80"))*(DIFF_CONTEXT_MASK+1); |
| 458 | 458 | if( x<0 || x>DIFF_WIDTH_MASK ) x = DIFF_WIDTH_MASK; |
| 459 | 459 | diffFlags += x; |
| 460 | 460 | }else{ |
| 461 | - diffFlags = DIFF_INLINE | DIFF_IGNORE_EOLWS; | |
| 461 | + diffFlags = DIFF_INLINE; | |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | + if( P("w") ){ | |
| 465 | + diffFlags |= DIFF_IGNORE_ALLWS; | |
| 466 | + } | |
| 464 | 467 | /* "dc" query parameter determines lines of context */ |
| 465 | 468 | x = atoi(PD("dc","7")); |
| 466 | 469 | if( x<0 || x>DIFF_CONTEXT_MASK ) x = DIFF_CONTEXT_MASK; |
| 467 | 470 | diffFlags += x; |
| 468 | 471 | |
| @@ -469,11 +472,10 @@ | ||
| 469 | 472 | /* The "noopt" parameter disables diff optimization */ |
| 470 | 473 | if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT; |
| 471 | 474 | } |
| 472 | 475 | return diffFlags; |
| 473 | 476 | } |
| 474 | - | |
| 475 | 477 | |
| 476 | 478 | /* |
| 477 | 479 | ** WEBPAGE: vinfo |
| 478 | 480 | ** WEBPAGE: ci |
| 479 | 481 | ** URL: /ci?name=RID|ARTIFACTID |
| @@ -498,10 +500,13 @@ | ||
| 498 | 500 | const char *zName; /* Name of the checkin to be displayed */ |
| 499 | 501 | const char *zUuid; /* UUID of zName */ |
| 500 | 502 | const char *zParent; /* UUID of the parent checkin (if any) */ |
| 501 | 503 | const char *zRe; /* regex parameter */ |
| 502 | 504 | ReCompiled *pRe = 0; /* regex */ |
| 505 | + const char *zW; /* URL param for ignoring whitespace */ | |
| 506 | + const char *zPage = "vinfo"; /* Page that shows diffs */ | |
| 507 | + const char *zPageHide = "ci"; /* Page that hides diffs */ | |
| 503 | 508 | |
| 504 | 509 | login_check_credentials(); |
| 505 | 510 | if( !g.perm.Read ){ login_needed(); return; } |
| 506 | 511 | zName = P("name"); |
| 507 | 512 | rid = name_to_rid_www("name"); |
| @@ -663,79 +668,74 @@ | ||
| 663 | 668 | style_header("Check-in Information"); |
| 664 | 669 | login_anonymous_available(); |
| 665 | 670 | } |
| 666 | 671 | db_finalize(&q1); |
| 667 | 672 | 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 diffs</a> | |
| 677 | - if( sideBySide ){ | |
| 678 | - @ %z(xhref("class='button'","%R/ci/%T?sbs=0",zName)) | |
| 679 | - @ unified diffs</a> | |
| 680 | - }else{ | |
| 681 | - @ %z(xhref("class='button'","%R/ci/%T?sbs=1",zName)) | |
| 682 | - @ side-by-side diffs</a> | |
| 683 | - } | |
| 684 | - }else{ | |
| 685 | - @ %z(xhref("class='button'","%R/ci/%T?sbs=0",zName)) | |
| 686 | - @ show unified diffs</a> | |
| 687 | - @ %z(xhref("class='button'","%R/ci/%T?sbs=1",zName)) | |
| 688 | - @ show side-by-side diffs</a> | |
| 689 | - } | |
| 690 | - }else{ | |
| 691 | - if( verboseFlag ){ | |
| 692 | - @ %z(xhref("class='button'","%R/ci/%T",zName))hide diffs</a> | |
| 693 | - if( sideBySide ){ | |
| 694 | - @ %z(xhref("class='button'","%R/info/%T?sbs=0",zName)) | |
| 695 | - @ unified diffs</a> | |
| 696 | - }else{ | |
| 697 | - @ %z(xhref("class='button'","%R/info/%T?sbs=1",zName)) | |
| 698 | - @ side-by-side diffs</a> | |
| 699 | - } | |
| 700 | - }else{ | |
| 701 | - @ %z(xhref("class='button'","%R/vinfo/%T?sbs=0",zName)) | |
| 702 | - @ show unified diffs</a> | |
| 703 | - @ %z(xhref("class='button'","%R/vinfo/%T?sbs=1",zName)) | |
| 704 | - @ show side-by-side diffs</a> | |
| 705 | - } | |
| 706 | - } | |
| 673 | + @ <div class="section">Changes</div> | |
| 674 | + @ <div class="sectionmenu"> | |
| 675 | + verboseFlag = g.zPath[0]!='c'; | |
| 676 | + if( db_get_boolean("show-version-diffs", 0)==0 ){ | |
| 677 | + verboseFlag = !verboseFlag; | |
| 678 | + zPage = "ci"; | |
| 679 | + zPageHide = "vinfo"; | |
| 680 | + } | |
| 681 | + diffFlags = construct_diff_flags(verboseFlag, sideBySide); | |
| 682 | + zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; | |
| 683 | + if( verboseFlag ){ | |
| 684 | + @ %z(xhref("class='button'","%R/%s/%T",zPageHide,zName)) | |
| 685 | + @ Hide Diffs</a> | |
| 686 | + if( sideBySide ){ | |
| 687 | + @ %z(xhref("class='button'","%R/%s/%T?sbs=0%s",zPage,zName,zW)) | |
| 688 | + @ Unified Diffs</a> | |
| 689 | + }else{ | |
| 690 | + @ %z(xhref("class='button'","%R/%s/%T?sbs=1%s",zPage,zName,zW)) | |
| 691 | + @ Side-by-Side Diffs</a> | |
| 692 | + } | |
| 693 | + if( *zW ){ | |
| 694 | + @ %z(xhref("class='button'","%R/%s/%T?sbs=%d",zPage,zName,sideBySide)) | |
| 695 | + @ Show Whitespace Changes</a> | |
| 696 | + }else{ | |
| 697 | + @ %z(xhref("class='button'","%R/%s/%T?sbs=%d&w",zPage,zName,sideBySide)) | |
| 698 | + @ Ignore Whitespace</a> | |
| 699 | + } | |
| 700 | + }else{ | |
| 701 | + @ %z(xhref("class='button'","%R/%s/%T?sbs=0",zPage,zName)) | |
| 702 | + @ Show Unified Diffs</a> | |
| 703 | + @ %z(xhref("class='button'","%R/%s/%T?sbs=1",zPage,zName)) | |
| 704 | + @ Show Side-by-Side Diffs</a> | |
| 705 | + } | |
| 706 | + if( zParent ){ | |
| 707 | 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 | - } | |
| 708 | + @ Patch</a> | |
| 709 | + } | |
| 710 | + @</div> | |
| 711 | + if( pRe ){ | |
| 712 | + @ <p><b>Only differences that match regular expression "%h(zRe)" | |
| 713 | + @ are shown.</b></p> | |
| 714 | + } | |
| 715 | + db_prepare(&q3, | |
| 716 | + "SELECT name," | |
| 717 | + " mperm," | |
| 718 | + " (SELECT uuid FROM blob WHERE rid=mlink.pid)," | |
| 719 | + " (SELECT uuid FROM blob WHERE rid=mlink.fid)," | |
| 720 | + " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)" | |
| 721 | + " FROM mlink JOIN filename ON filename.fnid=mlink.fnid" | |
| 722 | + " WHERE mlink.mid=%d" | |
| 723 | + " AND (mlink.fid>0" | |
| 724 | + " OR mlink.fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=%d))" | |
| 725 | + " ORDER BY name /*sort*/", | |
| 726 | + rid, rid | |
| 727 | + ); | |
| 728 | + while( db_step(&q3)==SQLITE_ROW ){ | |
| 729 | + const char *zName = db_column_text(&q3,0); | |
| 730 | + int mperm = db_column_int(&q3, 1); | |
| 731 | + const char *zOld = db_column_text(&q3,2); | |
| 732 | + const char *zNew = db_column_text(&q3,3); | |
| 733 | + const char *zOldName = db_column_text(&q3, 4); | |
| 734 | + append_file_change_line(zName, zOld, zNew, zOldName, diffFlags,pRe,mperm); | |
| 735 | + } | |
| 736 | + db_finalize(&q3); | |
| 737 | 737 | append_diff_javascript(sideBySide); |
| 738 | 738 | style_footer(); |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | /* |
| @@ -954,10 +954,11 @@ | ||
| 954 | 954 | ManifestFile *pFileFrom, *pFileTo; |
| 955 | 955 | const char *zBranch; |
| 956 | 956 | const char *zFrom; |
| 957 | 957 | const char *zTo; |
| 958 | 958 | const char *zRe; |
| 959 | + const char *zW; | |
| 959 | 960 | const char *zVerbose; |
| 960 | 961 | const char *zGlob; |
| 961 | 962 | ReCompiled *pRe = 0; |
| 962 | 963 | login_check_credentials(); |
| 963 | 964 | if( !g.perm.Read ){ login_needed(); return; } |
| @@ -987,39 +988,54 @@ | ||
| 987 | 988 | zFrom = P("from"); |
| 988 | 989 | zTo = P("to"); |
| 989 | 990 | if(zGlob && !*zGlob){ |
| 990 | 991 | zGlob = NULL; |
| 991 | 992 | } |
| 993 | + diffFlags = construct_diff_flags(verboseFlag, sideBySide); | |
| 994 | + zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; | |
| 992 | 995 | if( sideBySide || verboseFlag ){ |
| 993 | 996 | style_submenu_element("Hide Diff", "hidediff", |
| 994 | - "%R/vdiff?from=%T&to=%T&sbs=0%s%T", | |
| 997 | + "%R/vdiff?from=%T&to=%T&sbs=0%s%T%s", | |
| 995 | 998 | zFrom, zTo, |
| 996 | - zGlob ? "&glob=" : "", zGlob ? zGlob : ""); | |
| 999 | + zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); | |
| 997 | 1000 | } |
| 998 | 1001 | if( !sideBySide ){ |
| 999 | - style_submenu_element("Side-by-side Diff", "sbsdiff", | |
| 1000 | - "%R/vdiff?from=%T&to=%T&sbs=1%s%T", | |
| 1002 | + style_submenu_element("Side-by-Side Diff", "sbsdiff", | |
| 1003 | + "%R/vdiff?from=%T&to=%T&sbs=1%s%T%s", | |
| 1001 | 1004 | zFrom, zTo, |
| 1002 | - zGlob ? "&glob=" : "", zGlob ? zGlob : ""); | |
| 1005 | + zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); | |
| 1003 | 1006 | } |
| 1004 | 1007 | if( sideBySide || !verboseFlag ) { |
| 1005 | 1008 | style_submenu_element("Unified Diff", "udiff", |
| 1006 | - "%R/vdiff?from=%T&to=%T&sbs=0&v%s%T", | |
| 1009 | + "%R/vdiff?from=%T&to=%T&sbs=0&v%s%T%s", | |
| 1007 | 1010 | zFrom, zTo, |
| 1008 | - zGlob ? "&glob=" : "", zGlob ? zGlob : ""); | |
| 1011 | + zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); | |
| 1009 | 1012 | } |
| 1010 | 1013 | style_submenu_element("Invert", "invert", |
| 1011 | - "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T", zTo, zFrom, | |
| 1014 | + "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T%s", zTo, zFrom, | |
| 1012 | 1015 | sideBySide, (verboseFlag && !sideBySide)?"&v":"", |
| 1013 | - zGlob ? "&glob=" : "", zGlob ? zGlob : ""); | |
| 1016 | + zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); | |
| 1014 | 1017 | if( zGlob ){ |
| 1015 | 1018 | style_submenu_element("Clear glob", "clearglob", |
| 1016 | - "%R/vdiff?from=%T&to=%T&sbs=%d%s", zFrom, zTo, | |
| 1017 | - sideBySide, (verboseFlag && !sideBySide)?"&v":""); | |
| 1019 | + "%R/vdiff?from=%T&to=%T&sbs=%d%s%s", zFrom, zTo, | |
| 1020 | + sideBySide, (verboseFlag && !sideBySide)?"&v":"", zW); | |
| 1018 | 1021 | }else{ |
| 1019 | 1022 | style_submenu_element("Patch", "patch", |
| 1020 | - "%R/vpatch?from=%T&to=%T", zFrom, zTo); | |
| 1023 | + "%R/vpatch?from=%T&to=%T%s", zFrom, zTo, zW); | |
| 1024 | + } | |
| 1025 | + if( sideBySide || verboseFlag ){ | |
| 1026 | + if( *zW ){ | |
| 1027 | + style_submenu_element("Show Whitespace Differences", "whitespace", | |
| 1028 | + "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T", zFrom, zTo, | |
| 1029 | + sideBySide, (verboseFlag && !sideBySide)?"&v":"", | |
| 1030 | + zGlob ? "&glob=" : "", zGlob ? zGlob : ""); | |
| 1031 | + }else{ | |
| 1032 | + style_submenu_element("Ignore Whitespace", "ignorews", | |
| 1033 | + "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T&w", zFrom, zTo, | |
| 1034 | + sideBySide, (verboseFlag && !sideBySide)?"&v":"", | |
| 1035 | + zGlob ? "&glob=" : "", zGlob ? zGlob : ""); | |
| 1036 | + } | |
| 1021 | 1037 | } |
| 1022 | 1038 | style_header("Check-in Differences"); |
| 1023 | 1039 | @ <h2>Difference From:</h2><blockquote> |
| 1024 | 1040 | checkin_description(ridFrom); |
| 1025 | 1041 | @ </blockquote><h2>To:</h2><blockquote> |
| @@ -1036,11 +1052,10 @@ | ||
| 1036 | 1052 | |
| 1037 | 1053 | manifest_file_rewind(pFrom); |
| 1038 | 1054 | pFileFrom = manifest_file_next(pFrom, 0); |
| 1039 | 1055 | manifest_file_rewind(pTo); |
| 1040 | 1056 | pFileTo = manifest_file_next(pTo, 0); |
| 1041 | - diffFlags = construct_diff_flags(verboseFlag, sideBySide); | |
| 1042 | 1057 | while( pFileFrom || pFileTo ){ |
| 1043 | 1058 | int cmp; |
| 1044 | 1059 | if( pFileFrom==0 ){ |
| 1045 | 1060 | cmp = +1; |
| 1046 | 1061 | }else if( pFileTo==0 ){ |
| @@ -1337,10 +1352,11 @@ | ||
| 1337 | 1352 | int isPatch; |
| 1338 | 1353 | int sideBySide; |
| 1339 | 1354 | char *zV1; |
| 1340 | 1355 | char *zV2; |
| 1341 | 1356 | const char *zRe; |
| 1357 | + const char *zW; /* URL param for ignoring whitespace */ | |
| 1342 | 1358 | ReCompiled *pRe = 0; |
| 1343 | 1359 | u64 diffFlags; |
| 1344 | 1360 | |
| 1345 | 1361 | login_check_credentials(); |
| 1346 | 1362 | if( !g.perm.Read ){ login_needed(); return; } |
| @@ -1367,20 +1383,30 @@ | ||
| 1367 | 1383 | zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1); |
| 1368 | 1384 | zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2); |
| 1369 | 1385 | diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML; |
| 1370 | 1386 | |
| 1371 | 1387 | style_header("Diff"); |
| 1388 | + zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; | |
| 1389 | + if( *zW ){ | |
| 1390 | + style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes", | |
| 1391 | + "%s/fdiff?v1=%T&v2=%T&sbs=%d", | |
| 1392 | + g.zTop, P("v1"), P("v2"), sideBySide); | |
| 1393 | + }else{ | |
| 1394 | + style_submenu_element("Ignore Whitespace", "Ignore Whitespace", | |
| 1395 | + "%s/fdiff?v1=%T&v2=%T&sbs=%d&w", | |
| 1396 | + g.zTop, P("v1"), P("v2"), sideBySide); | |
| 1397 | + } | |
| 1372 | 1398 | style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch", |
| 1373 | 1399 | g.zTop, P("v1"), P("v2")); |
| 1374 | 1400 | if( !sideBySide ){ |
| 1375 | - style_submenu_element("Side-by-side Diff", "sbsdiff", | |
| 1376 | - "%s/fdiff?v1=%T&v2=%T&sbs=1", | |
| 1377 | - g.zTop, P("v1"), P("v2")); | |
| 1401 | + style_submenu_element("Side-by-Side Diff", "sbsdiff", | |
| 1402 | + "%s/fdiff?v1=%T&v2=%T&sbs=1%s", | |
| 1403 | + g.zTop, P("v1"), P("v2"), zW); | |
| 1378 | 1404 | }else{ |
| 1379 | 1405 | style_submenu_element("Unified Diff", "udiff", |
| 1380 | - "%s/fdiff?v1=%T&v2=%T&sbs=0", | |
| 1381 | - g.zTop, P("v1"), P("v2")); | |
| 1406 | + "%s/fdiff?v1=%T&v2=%T&sbs=0%s", | |
| 1407 | + g.zTop, P("v1"), P("v2"), zW); | |
| 1382 | 1408 | } |
| 1383 | 1409 | |
| 1384 | 1410 | if( P("smhdr")!=0 ){ |
| 1385 | 1411 | @ <h2>Differences From Artifact |
| 1386 | 1412 | @ %z(href("%R/artifact/%S",zV1))[%S(zV1)]</a> To |
| @@ -1418,11 +1444,11 @@ | ||
| 1418 | 1444 | rid = name_to_rid_www("name"); |
| 1419 | 1445 | login_check_credentials(); |
| 1420 | 1446 | if( !g.perm.Read ){ login_needed(); return; } |
| 1421 | 1447 | if( rid==0 ) fossil_redirect_home(); |
| 1422 | 1448 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1423 | - if( fossil_strcmp(P("name"), zUuid)==0 ){ | |
| 1449 | + if( fossil_strcmp(P("name"), zUuid)==0 && login_is_nobody() ){ | |
| 1424 | 1450 | g.isConst = 1; |
| 1425 | 1451 | } |
| 1426 | 1452 | free(zUuid); |
| 1427 | 1453 | zMime = P("m"); |
| 1428 | 1454 | if( zMime==0 ){ |
| @@ -2237,11 +2263,11 @@ | ||
| 2237 | 2263 | } |
| 2238 | 2264 | db_finalize(&q); |
| 2239 | 2265 | if( nChng>0 ){ |
| 2240 | 2266 | int nrid; |
| 2241 | 2267 | Blob cksum; |
| 2242 | - blob_appendf(&ctrl, "U %F\n", g.zLogin); | |
| 2268 | + blob_appendf(&ctrl, "U %F\n", login_name()); | |
| 2243 | 2269 | md5sum_blob(&ctrl, &cksum); |
| 2244 | 2270 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 2245 | 2271 | db_begin_transaction(); |
| 2246 | 2272 | g.markPrivate = content_is_private(rid); |
| 2247 | 2273 | nrid = content_put(&ctrl); |
| 2248 | 2274 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -449,20 +449,23 @@ | |
| 449 | if( verboseFlag==0 ){ |
| 450 | diffFlags = 0; /* Zero means do not show any diff */ |
| 451 | }else{ |
| 452 | int x; |
| 453 | if( sideBySide ){ |
| 454 | diffFlags = DIFF_SIDEBYSIDE | DIFF_IGNORE_EOLWS; |
| 455 | |
| 456 | /* "dw" query parameter determines width of each column */ |
| 457 | x = atoi(PD("dw","80"))*(DIFF_CONTEXT_MASK+1); |
| 458 | if( x<0 || x>DIFF_WIDTH_MASK ) x = DIFF_WIDTH_MASK; |
| 459 | diffFlags += x; |
| 460 | }else{ |
| 461 | diffFlags = DIFF_INLINE | DIFF_IGNORE_EOLWS; |
| 462 | } |
| 463 | |
| 464 | /* "dc" query parameter determines lines of context */ |
| 465 | x = atoi(PD("dc","7")); |
| 466 | if( x<0 || x>DIFF_CONTEXT_MASK ) x = DIFF_CONTEXT_MASK; |
| 467 | diffFlags += x; |
| 468 | |
| @@ -469,11 +472,10 @@ | |
| 469 | /* The "noopt" parameter disables diff optimization */ |
| 470 | if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT; |
| 471 | } |
| 472 | return diffFlags; |
| 473 | } |
| 474 | |
| 475 | |
| 476 | /* |
| 477 | ** WEBPAGE: vinfo |
| 478 | ** WEBPAGE: ci |
| 479 | ** URL: /ci?name=RID|ARTIFACTID |
| @@ -498,10 +500,13 @@ | |
| 498 | const char *zName; /* Name of the checkin to be displayed */ |
| 499 | const char *zUuid; /* UUID of zName */ |
| 500 | const char *zParent; /* UUID of the parent checkin (if any) */ |
| 501 | const char *zRe; /* regex parameter */ |
| 502 | ReCompiled *pRe = 0; /* regex */ |
| 503 | |
| 504 | login_check_credentials(); |
| 505 | if( !g.perm.Read ){ login_needed(); return; } |
| 506 | zName = P("name"); |
| 507 | rid = name_to_rid_www("name"); |
| @@ -663,79 +668,74 @@ | |
| 663 | style_header("Check-in Information"); |
| 664 | login_anonymous_available(); |
| 665 | } |
| 666 | db_finalize(&q1); |
| 667 | showTags(rid, ""); |
| 668 | if( zParent ){ |
| 669 | @ <div class="section">Changes</div> |
| 670 | @ <div class="sectionmenu"> |
| 671 | verboseFlag = g.zPath[0]!='c'; |
| 672 | if( db_get_boolean("show-version-diffs", 0)==0 ){ |
| 673 | verboseFlag = !verboseFlag; |
| 674 | if( verboseFlag ){ |
| 675 | @ %z(xhref("class='button'","%R/vinfo/%T",zName)) |
| 676 | @ hide diffs</a> |
| 677 | if( sideBySide ){ |
| 678 | @ %z(xhref("class='button'","%R/ci/%T?sbs=0",zName)) |
| 679 | @ unified diffs</a> |
| 680 | }else{ |
| 681 | @ %z(xhref("class='button'","%R/ci/%T?sbs=1",zName)) |
| 682 | @ side-by-side diffs</a> |
| 683 | } |
| 684 | }else{ |
| 685 | @ %z(xhref("class='button'","%R/ci/%T?sbs=0",zName)) |
| 686 | @ show unified diffs</a> |
| 687 | @ %z(xhref("class='button'","%R/ci/%T?sbs=1",zName)) |
| 688 | @ show side-by-side diffs</a> |
| 689 | } |
| 690 | }else{ |
| 691 | if( verboseFlag ){ |
| 692 | @ %z(xhref("class='button'","%R/ci/%T",zName))hide diffs</a> |
| 693 | if( sideBySide ){ |
| 694 | @ %z(xhref("class='button'","%R/info/%T?sbs=0",zName)) |
| 695 | @ unified diffs</a> |
| 696 | }else{ |
| 697 | @ %z(xhref("class='button'","%R/info/%T?sbs=1",zName)) |
| 698 | @ side-by-side diffs</a> |
| 699 | } |
| 700 | }else{ |
| 701 | @ %z(xhref("class='button'","%R/vinfo/%T?sbs=0",zName)) |
| 702 | @ show unified diffs</a> |
| 703 | @ %z(xhref("class='button'","%R/vinfo/%T?sbs=1",zName)) |
| 704 | @ show side-by-side diffs</a> |
| 705 | } |
| 706 | } |
| 707 | @ %z(xhref("class='button'","%R/vpatch?from=%S&to=%S",zParent,zUuid)) |
| 708 | @ patch</a></div> |
| 709 | if( pRe ){ |
| 710 | @ <p><b>Only differences that match regular expression "%h(zRe)" |
| 711 | @ are shown.</b></p> |
| 712 | } |
| 713 | db_prepare(&q3, |
| 714 | "SELECT name," |
| 715 | " mperm," |
| 716 | " (SELECT uuid FROM blob WHERE rid=mlink.pid)," |
| 717 | " (SELECT uuid FROM blob WHERE rid=mlink.fid)," |
| 718 | " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)" |
| 719 | " FROM mlink JOIN filename ON filename.fnid=mlink.fnid" |
| 720 | " WHERE mlink.mid=%d" |
| 721 | " AND (mlink.fid>0" |
| 722 | " OR mlink.fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=%d))" |
| 723 | " ORDER BY name /*sort*/", |
| 724 | rid, rid |
| 725 | ); |
| 726 | diffFlags = construct_diff_flags(verboseFlag, sideBySide); |
| 727 | while( db_step(&q3)==SQLITE_ROW ){ |
| 728 | const char *zName = db_column_text(&q3,0); |
| 729 | int mperm = db_column_int(&q3, 1); |
| 730 | const char *zOld = db_column_text(&q3,2); |
| 731 | const char *zNew = db_column_text(&q3,3); |
| 732 | const char *zOldName = db_column_text(&q3, 4); |
| 733 | append_file_change_line(zName, zOld, zNew, zOldName, diffFlags,pRe,mperm); |
| 734 | } |
| 735 | db_finalize(&q3); |
| 736 | } |
| 737 | append_diff_javascript(sideBySide); |
| 738 | style_footer(); |
| 739 | } |
| 740 | |
| 741 | /* |
| @@ -954,10 +954,11 @@ | |
| 954 | ManifestFile *pFileFrom, *pFileTo; |
| 955 | const char *zBranch; |
| 956 | const char *zFrom; |
| 957 | const char *zTo; |
| 958 | const char *zRe; |
| 959 | const char *zVerbose; |
| 960 | const char *zGlob; |
| 961 | ReCompiled *pRe = 0; |
| 962 | login_check_credentials(); |
| 963 | if( !g.perm.Read ){ login_needed(); return; } |
| @@ -987,39 +988,54 @@ | |
| 987 | zFrom = P("from"); |
| 988 | zTo = P("to"); |
| 989 | if(zGlob && !*zGlob){ |
| 990 | zGlob = NULL; |
| 991 | } |
| 992 | if( sideBySide || verboseFlag ){ |
| 993 | style_submenu_element("Hide Diff", "hidediff", |
| 994 | "%R/vdiff?from=%T&to=%T&sbs=0%s%T", |
| 995 | zFrom, zTo, |
| 996 | zGlob ? "&glob=" : "", zGlob ? zGlob : ""); |
| 997 | } |
| 998 | if( !sideBySide ){ |
| 999 | style_submenu_element("Side-by-side Diff", "sbsdiff", |
| 1000 | "%R/vdiff?from=%T&to=%T&sbs=1%s%T", |
| 1001 | zFrom, zTo, |
| 1002 | zGlob ? "&glob=" : "", zGlob ? zGlob : ""); |
| 1003 | } |
| 1004 | if( sideBySide || !verboseFlag ) { |
| 1005 | style_submenu_element("Unified Diff", "udiff", |
| 1006 | "%R/vdiff?from=%T&to=%T&sbs=0&v%s%T", |
| 1007 | zFrom, zTo, |
| 1008 | zGlob ? "&glob=" : "", zGlob ? zGlob : ""); |
| 1009 | } |
| 1010 | style_submenu_element("Invert", "invert", |
| 1011 | "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T", zTo, zFrom, |
| 1012 | sideBySide, (verboseFlag && !sideBySide)?"&v":"", |
| 1013 | zGlob ? "&glob=" : "", zGlob ? zGlob : ""); |
| 1014 | if( zGlob ){ |
| 1015 | style_submenu_element("Clear glob", "clearglob", |
| 1016 | "%R/vdiff?from=%T&to=%T&sbs=%d%s", zFrom, zTo, |
| 1017 | sideBySide, (verboseFlag && !sideBySide)?"&v":""); |
| 1018 | }else{ |
| 1019 | style_submenu_element("Patch", "patch", |
| 1020 | "%R/vpatch?from=%T&to=%T", zFrom, zTo); |
| 1021 | } |
| 1022 | style_header("Check-in Differences"); |
| 1023 | @ <h2>Difference From:</h2><blockquote> |
| 1024 | checkin_description(ridFrom); |
| 1025 | @ </blockquote><h2>To:</h2><blockquote> |
| @@ -1036,11 +1052,10 @@ | |
| 1036 | |
| 1037 | manifest_file_rewind(pFrom); |
| 1038 | pFileFrom = manifest_file_next(pFrom, 0); |
| 1039 | manifest_file_rewind(pTo); |
| 1040 | pFileTo = manifest_file_next(pTo, 0); |
| 1041 | diffFlags = construct_diff_flags(verboseFlag, sideBySide); |
| 1042 | while( pFileFrom || pFileTo ){ |
| 1043 | int cmp; |
| 1044 | if( pFileFrom==0 ){ |
| 1045 | cmp = +1; |
| 1046 | }else if( pFileTo==0 ){ |
| @@ -1337,10 +1352,11 @@ | |
| 1337 | int isPatch; |
| 1338 | int sideBySide; |
| 1339 | char *zV1; |
| 1340 | char *zV2; |
| 1341 | const char *zRe; |
| 1342 | ReCompiled *pRe = 0; |
| 1343 | u64 diffFlags; |
| 1344 | |
| 1345 | login_check_credentials(); |
| 1346 | if( !g.perm.Read ){ login_needed(); return; } |
| @@ -1367,20 +1383,30 @@ | |
| 1367 | zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1); |
| 1368 | zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2); |
| 1369 | diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML; |
| 1370 | |
| 1371 | style_header("Diff"); |
| 1372 | style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch", |
| 1373 | g.zTop, P("v1"), P("v2")); |
| 1374 | if( !sideBySide ){ |
| 1375 | style_submenu_element("Side-by-side Diff", "sbsdiff", |
| 1376 | "%s/fdiff?v1=%T&v2=%T&sbs=1", |
| 1377 | g.zTop, P("v1"), P("v2")); |
| 1378 | }else{ |
| 1379 | style_submenu_element("Unified Diff", "udiff", |
| 1380 | "%s/fdiff?v1=%T&v2=%T&sbs=0", |
| 1381 | g.zTop, P("v1"), P("v2")); |
| 1382 | } |
| 1383 | |
| 1384 | if( P("smhdr")!=0 ){ |
| 1385 | @ <h2>Differences From Artifact |
| 1386 | @ %z(href("%R/artifact/%S",zV1))[%S(zV1)]</a> To |
| @@ -1418,11 +1444,11 @@ | |
| 1418 | rid = name_to_rid_www("name"); |
| 1419 | login_check_credentials(); |
| 1420 | if( !g.perm.Read ){ login_needed(); return; } |
| 1421 | if( rid==0 ) fossil_redirect_home(); |
| 1422 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1423 | if( fossil_strcmp(P("name"), zUuid)==0 ){ |
| 1424 | g.isConst = 1; |
| 1425 | } |
| 1426 | free(zUuid); |
| 1427 | zMime = P("m"); |
| 1428 | if( zMime==0 ){ |
| @@ -2237,11 +2263,11 @@ | |
| 2237 | } |
| 2238 | db_finalize(&q); |
| 2239 | if( nChng>0 ){ |
| 2240 | int nrid; |
| 2241 | Blob cksum; |
| 2242 | blob_appendf(&ctrl, "U %F\n", g.zLogin); |
| 2243 | md5sum_blob(&ctrl, &cksum); |
| 2244 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 2245 | db_begin_transaction(); |
| 2246 | g.markPrivate = content_is_private(rid); |
| 2247 | nrid = content_put(&ctrl); |
| 2248 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -449,20 +449,23 @@ | |
| 449 | if( verboseFlag==0 ){ |
| 450 | diffFlags = 0; /* Zero means do not show any diff */ |
| 451 | }else{ |
| 452 | int x; |
| 453 | if( sideBySide ){ |
| 454 | diffFlags = DIFF_SIDEBYSIDE; |
| 455 | |
| 456 | /* "dw" query parameter determines width of each column */ |
| 457 | x = atoi(PD("dw","80"))*(DIFF_CONTEXT_MASK+1); |
| 458 | if( x<0 || x>DIFF_WIDTH_MASK ) x = DIFF_WIDTH_MASK; |
| 459 | diffFlags += x; |
| 460 | }else{ |
| 461 | diffFlags = DIFF_INLINE; |
| 462 | } |
| 463 | |
| 464 | if( P("w") ){ |
| 465 | diffFlags |= DIFF_IGNORE_ALLWS; |
| 466 | } |
| 467 | /* "dc" query parameter determines lines of context */ |
| 468 | x = atoi(PD("dc","7")); |
| 469 | if( x<0 || x>DIFF_CONTEXT_MASK ) x = DIFF_CONTEXT_MASK; |
| 470 | diffFlags += x; |
| 471 | |
| @@ -469,11 +472,10 @@ | |
| 472 | /* The "noopt" parameter disables diff optimization */ |
| 473 | if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT; |
| 474 | } |
| 475 | return diffFlags; |
| 476 | } |
| 477 | |
| 478 | /* |
| 479 | ** WEBPAGE: vinfo |
| 480 | ** WEBPAGE: ci |
| 481 | ** URL: /ci?name=RID|ARTIFACTID |
| @@ -498,10 +500,13 @@ | |
| 500 | const char *zName; /* Name of the checkin to be displayed */ |
| 501 | const char *zUuid; /* UUID of zName */ |
| 502 | const char *zParent; /* UUID of the parent checkin (if any) */ |
| 503 | const char *zRe; /* regex parameter */ |
| 504 | ReCompiled *pRe = 0; /* regex */ |
| 505 | const char *zW; /* URL param for ignoring whitespace */ |
| 506 | const char *zPage = "vinfo"; /* Page that shows diffs */ |
| 507 | const char *zPageHide = "ci"; /* Page that hides diffs */ |
| 508 | |
| 509 | login_check_credentials(); |
| 510 | if( !g.perm.Read ){ login_needed(); return; } |
| 511 | zName = P("name"); |
| 512 | rid = name_to_rid_www("name"); |
| @@ -663,79 +668,74 @@ | |
| 668 | style_header("Check-in Information"); |
| 669 | login_anonymous_available(); |
| 670 | } |
| 671 | db_finalize(&q1); |
| 672 | showTags(rid, ""); |
| 673 | @ <div class="section">Changes</div> |
| 674 | @ <div class="sectionmenu"> |
| 675 | verboseFlag = g.zPath[0]!='c'; |
| 676 | if( db_get_boolean("show-version-diffs", 0)==0 ){ |
| 677 | verboseFlag = !verboseFlag; |
| 678 | zPage = "ci"; |
| 679 | zPageHide = "vinfo"; |
| 680 | } |
| 681 | diffFlags = construct_diff_flags(verboseFlag, sideBySide); |
| 682 | zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; |
| 683 | if( verboseFlag ){ |
| 684 | @ %z(xhref("class='button'","%R/%s/%T",zPageHide,zName)) |
| 685 | @ Hide Diffs</a> |
| 686 | if( sideBySide ){ |
| 687 | @ %z(xhref("class='button'","%R/%s/%T?sbs=0%s",zPage,zName,zW)) |
| 688 | @ Unified Diffs</a> |
| 689 | }else{ |
| 690 | @ %z(xhref("class='button'","%R/%s/%T?sbs=1%s",zPage,zName,zW)) |
| 691 | @ Side-by-Side Diffs</a> |
| 692 | } |
| 693 | if( *zW ){ |
| 694 | @ %z(xhref("class='button'","%R/%s/%T?sbs=%d",zPage,zName,sideBySide)) |
| 695 | @ Show Whitespace Changes</a> |
| 696 | }else{ |
| 697 | @ %z(xhref("class='button'","%R/%s/%T?sbs=%d&w",zPage,zName,sideBySide)) |
| 698 | @ Ignore Whitespace</a> |
| 699 | } |
| 700 | }else{ |
| 701 | @ %z(xhref("class='button'","%R/%s/%T?sbs=0",zPage,zName)) |
| 702 | @ Show Unified Diffs</a> |
| 703 | @ %z(xhref("class='button'","%R/%s/%T?sbs=1",zPage,zName)) |
| 704 | @ Show Side-by-Side Diffs</a> |
| 705 | } |
| 706 | if( zParent ){ |
| 707 | @ %z(xhref("class='button'","%R/vpatch?from=%S&to=%S",zParent,zUuid)) |
| 708 | @ Patch</a> |
| 709 | } |
| 710 | @</div> |
| 711 | if( pRe ){ |
| 712 | @ <p><b>Only differences that match regular expression "%h(zRe)" |
| 713 | @ are shown.</b></p> |
| 714 | } |
| 715 | db_prepare(&q3, |
| 716 | "SELECT name," |
| 717 | " mperm," |
| 718 | " (SELECT uuid FROM blob WHERE rid=mlink.pid)," |
| 719 | " (SELECT uuid FROM blob WHERE rid=mlink.fid)," |
| 720 | " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)" |
| 721 | " FROM mlink JOIN filename ON filename.fnid=mlink.fnid" |
| 722 | " WHERE mlink.mid=%d" |
| 723 | " AND (mlink.fid>0" |
| 724 | " OR mlink.fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=%d))" |
| 725 | " ORDER BY name /*sort*/", |
| 726 | rid, rid |
| 727 | ); |
| 728 | while( db_step(&q3)==SQLITE_ROW ){ |
| 729 | const char *zName = db_column_text(&q3,0); |
| 730 | int mperm = db_column_int(&q3, 1); |
| 731 | const char *zOld = db_column_text(&q3,2); |
| 732 | const char *zNew = db_column_text(&q3,3); |
| 733 | const char *zOldName = db_column_text(&q3, 4); |
| 734 | append_file_change_line(zName, zOld, zNew, zOldName, diffFlags,pRe,mperm); |
| 735 | } |
| 736 | db_finalize(&q3); |
| 737 | append_diff_javascript(sideBySide); |
| 738 | style_footer(); |
| 739 | } |
| 740 | |
| 741 | /* |
| @@ -954,10 +954,11 @@ | |
| 954 | ManifestFile *pFileFrom, *pFileTo; |
| 955 | const char *zBranch; |
| 956 | const char *zFrom; |
| 957 | const char *zTo; |
| 958 | const char *zRe; |
| 959 | const char *zW; |
| 960 | const char *zVerbose; |
| 961 | const char *zGlob; |
| 962 | ReCompiled *pRe = 0; |
| 963 | login_check_credentials(); |
| 964 | if( !g.perm.Read ){ login_needed(); return; } |
| @@ -987,39 +988,54 @@ | |
| 988 | zFrom = P("from"); |
| 989 | zTo = P("to"); |
| 990 | if(zGlob && !*zGlob){ |
| 991 | zGlob = NULL; |
| 992 | } |
| 993 | diffFlags = construct_diff_flags(verboseFlag, sideBySide); |
| 994 | zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; |
| 995 | if( sideBySide || verboseFlag ){ |
| 996 | style_submenu_element("Hide Diff", "hidediff", |
| 997 | "%R/vdiff?from=%T&to=%T&sbs=0%s%T%s", |
| 998 | zFrom, zTo, |
| 999 | zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); |
| 1000 | } |
| 1001 | if( !sideBySide ){ |
| 1002 | style_submenu_element("Side-by-Side Diff", "sbsdiff", |
| 1003 | "%R/vdiff?from=%T&to=%T&sbs=1%s%T%s", |
| 1004 | zFrom, zTo, |
| 1005 | zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); |
| 1006 | } |
| 1007 | if( sideBySide || !verboseFlag ) { |
| 1008 | style_submenu_element("Unified Diff", "udiff", |
| 1009 | "%R/vdiff?from=%T&to=%T&sbs=0&v%s%T%s", |
| 1010 | zFrom, zTo, |
| 1011 | zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); |
| 1012 | } |
| 1013 | style_submenu_element("Invert", "invert", |
| 1014 | "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T%s", zTo, zFrom, |
| 1015 | sideBySide, (verboseFlag && !sideBySide)?"&v":"", |
| 1016 | zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); |
| 1017 | if( zGlob ){ |
| 1018 | style_submenu_element("Clear glob", "clearglob", |
| 1019 | "%R/vdiff?from=%T&to=%T&sbs=%d%s%s", zFrom, zTo, |
| 1020 | sideBySide, (verboseFlag && !sideBySide)?"&v":"", zW); |
| 1021 | }else{ |
| 1022 | style_submenu_element("Patch", "patch", |
| 1023 | "%R/vpatch?from=%T&to=%T%s", zFrom, zTo, zW); |
| 1024 | } |
| 1025 | if( sideBySide || verboseFlag ){ |
| 1026 | if( *zW ){ |
| 1027 | style_submenu_element("Show Whitespace Differences", "whitespace", |
| 1028 | "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T", zFrom, zTo, |
| 1029 | sideBySide, (verboseFlag && !sideBySide)?"&v":"", |
| 1030 | zGlob ? "&glob=" : "", zGlob ? zGlob : ""); |
| 1031 | }else{ |
| 1032 | style_submenu_element("Ignore Whitespace", "ignorews", |
| 1033 | "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T&w", zFrom, zTo, |
| 1034 | sideBySide, (verboseFlag && !sideBySide)?"&v":"", |
| 1035 | zGlob ? "&glob=" : "", zGlob ? zGlob : ""); |
| 1036 | } |
| 1037 | } |
| 1038 | style_header("Check-in Differences"); |
| 1039 | @ <h2>Difference From:</h2><blockquote> |
| 1040 | checkin_description(ridFrom); |
| 1041 | @ </blockquote><h2>To:</h2><blockquote> |
| @@ -1036,11 +1052,10 @@ | |
| 1052 | |
| 1053 | manifest_file_rewind(pFrom); |
| 1054 | pFileFrom = manifest_file_next(pFrom, 0); |
| 1055 | manifest_file_rewind(pTo); |
| 1056 | pFileTo = manifest_file_next(pTo, 0); |
| 1057 | while( pFileFrom || pFileTo ){ |
| 1058 | int cmp; |
| 1059 | if( pFileFrom==0 ){ |
| 1060 | cmp = +1; |
| 1061 | }else if( pFileTo==0 ){ |
| @@ -1337,10 +1352,11 @@ | |
| 1352 | int isPatch; |
| 1353 | int sideBySide; |
| 1354 | char *zV1; |
| 1355 | char *zV2; |
| 1356 | const char *zRe; |
| 1357 | const char *zW; /* URL param for ignoring whitespace */ |
| 1358 | ReCompiled *pRe = 0; |
| 1359 | u64 diffFlags; |
| 1360 | |
| 1361 | login_check_credentials(); |
| 1362 | if( !g.perm.Read ){ login_needed(); return; } |
| @@ -1367,20 +1383,30 @@ | |
| 1383 | zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1); |
| 1384 | zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2); |
| 1385 | diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML; |
| 1386 | |
| 1387 | style_header("Diff"); |
| 1388 | zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; |
| 1389 | if( *zW ){ |
| 1390 | style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes", |
| 1391 | "%s/fdiff?v1=%T&v2=%T&sbs=%d", |
| 1392 | g.zTop, P("v1"), P("v2"), sideBySide); |
| 1393 | }else{ |
| 1394 | style_submenu_element("Ignore Whitespace", "Ignore Whitespace", |
| 1395 | "%s/fdiff?v1=%T&v2=%T&sbs=%d&w", |
| 1396 | g.zTop, P("v1"), P("v2"), sideBySide); |
| 1397 | } |
| 1398 | style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch", |
| 1399 | g.zTop, P("v1"), P("v2")); |
| 1400 | if( !sideBySide ){ |
| 1401 | style_submenu_element("Side-by-Side Diff", "sbsdiff", |
| 1402 | "%s/fdiff?v1=%T&v2=%T&sbs=1%s", |
| 1403 | g.zTop, P("v1"), P("v2"), zW); |
| 1404 | }else{ |
| 1405 | style_submenu_element("Unified Diff", "udiff", |
| 1406 | "%s/fdiff?v1=%T&v2=%T&sbs=0%s", |
| 1407 | g.zTop, P("v1"), P("v2"), zW); |
| 1408 | } |
| 1409 | |
| 1410 | if( P("smhdr")!=0 ){ |
| 1411 | @ <h2>Differences From Artifact |
| 1412 | @ %z(href("%R/artifact/%S",zV1))[%S(zV1)]</a> To |
| @@ -1418,11 +1444,11 @@ | |
| 1444 | rid = name_to_rid_www("name"); |
| 1445 | login_check_credentials(); |
| 1446 | if( !g.perm.Read ){ login_needed(); return; } |
| 1447 | if( rid==0 ) fossil_redirect_home(); |
| 1448 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1449 | if( fossil_strcmp(P("name"), zUuid)==0 && login_is_nobody() ){ |
| 1450 | g.isConst = 1; |
| 1451 | } |
| 1452 | free(zUuid); |
| 1453 | zMime = P("m"); |
| 1454 | if( zMime==0 ){ |
| @@ -2237,11 +2263,11 @@ | |
| 2263 | } |
| 2264 | db_finalize(&q); |
| 2265 | if( nChng>0 ){ |
| 2266 | int nrid; |
| 2267 | Blob cksum; |
| 2268 | blob_appendf(&ctrl, "U %F\n", login_name()); |
| 2269 | md5sum_blob(&ctrl, &cksum); |
| 2270 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 2271 | db_begin_transaction(); |
| 2272 | g.markPrivate = content_is_private(rid); |
| 2273 | nrid = content_put(&ctrl); |
| 2274 |
+1
-1
| --- src/json.c | ||
| +++ src/json.c | ||
| @@ -30,12 +30,12 @@ | ||
| 30 | 30 | ** dispatch to a JSON-mode-specific command/page handler with the type fossil_json_f(). |
| 31 | 31 | ** See the API docs for that typedef (below) for the semantics of the callbacks. |
| 32 | 32 | ** |
| 33 | 33 | ** |
| 34 | 34 | */ |
| 35 | -#include "config.h" | |
| 36 | 35 | #include "VERSION.h" |
| 36 | +#include "config.h" | |
| 37 | 37 | #include "json.h" |
| 38 | 38 | #include <assert.h> |
| 39 | 39 | #include <time.h> |
| 40 | 40 | |
| 41 | 41 | #if INTERFACE |
| 42 | 42 |
| --- src/json.c | |
| +++ src/json.c | |
| @@ -30,12 +30,12 @@ | |
| 30 | ** dispatch to a JSON-mode-specific command/page handler with the type fossil_json_f(). |
| 31 | ** See the API docs for that typedef (below) for the semantics of the callbacks. |
| 32 | ** |
| 33 | ** |
| 34 | */ |
| 35 | #include "config.h" |
| 36 | #include "VERSION.h" |
| 37 | #include "json.h" |
| 38 | #include <assert.h> |
| 39 | #include <time.h> |
| 40 | |
| 41 | #if INTERFACE |
| 42 |
| --- src/json.c | |
| +++ src/json.c | |
| @@ -30,12 +30,12 @@ | |
| 30 | ** dispatch to a JSON-mode-specific command/page handler with the type fossil_json_f(). |
| 31 | ** See the API docs for that typedef (below) for the semantics of the callbacks. |
| 32 | ** |
| 33 | ** |
| 34 | */ |
| 35 | #include "VERSION.h" |
| 36 | #include "config.h" |
| 37 | #include "json.h" |
| 38 | #include <assert.h> |
| 39 | #include <time.h> |
| 40 | |
| 41 | #if INTERFACE |
| 42 |
+3
-3
| --- src/json_timeline.c | ||
| +++ src/json_timeline.c | ||
| @@ -66,11 +66,11 @@ | ||
| 66 | 66 | /* |
| 67 | 67 | ** Create a temporary table suitable for storing timeline data. |
| 68 | 68 | */ |
| 69 | 69 | static void json_timeline_temp_table(void){ |
| 70 | 70 | /* Field order MUST match that from json_timeline_query()!!! */ |
| 71 | - static const char zSql[] = | |
| 71 | + static const char zSql[] = | |
| 72 | 72 | @ CREATE TEMP TABLE IF NOT EXISTS json_timeline( |
| 73 | 73 | @ sortId INTEGER PRIMARY KEY, |
| 74 | 74 | @ rid INTEGER, |
| 75 | 75 | @ uuid TEXT, |
| 76 | 76 | @ mtime INTEGER, |
| @@ -109,11 +109,11 @@ | ||
| 109 | 109 | @ (SELECT group_concat(substr(tagname,5), ',') FROM tag, tagxref |
| 110 | 110 | @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid |
| 111 | 111 | @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0) as tags, |
| 112 | 112 | @ tagid as tagId, |
| 113 | 113 | @ brief as brief |
| 114 | - @ FROM event JOIN blob | |
| 114 | + @ FROM event JOIN blob | |
| 115 | 115 | @ WHERE blob.rid=event.objid |
| 116 | 116 | ; |
| 117 | 117 | return zBaseSql; |
| 118 | 118 | } |
| 119 | 119 | |
| @@ -316,11 +316,11 @@ | ||
| 316 | 316 | */ |
| 317 | 317 | cson_value * json_get_changed_files(int rid, int flags){ |
| 318 | 318 | cson_value * rowsV = NULL; |
| 319 | 319 | cson_array * rows = NULL; |
| 320 | 320 | Stmt q = empty_Stmt; |
| 321 | - db_prepare(&q, | |
| 321 | + db_prepare(&q, | |
| 322 | 322 | "SELECT (pid==0) AS isnew," |
| 323 | 323 | " (fid==0) AS isdel," |
| 324 | 324 | " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name," |
| 325 | 325 | " blob.uuid as uuid," |
| 326 | 326 | " (SELECT uuid FROM blob WHERE rid=pid) as parent," |
| 327 | 327 | |
| 328 | 328 | ADDED src/loadctrl.c |
| --- src/json_timeline.c | |
| +++ src/json_timeline.c | |
| @@ -66,11 +66,11 @@ | |
| 66 | /* |
| 67 | ** Create a temporary table suitable for storing timeline data. |
| 68 | */ |
| 69 | static void json_timeline_temp_table(void){ |
| 70 | /* Field order MUST match that from json_timeline_query()!!! */ |
| 71 | static const char zSql[] = |
| 72 | @ CREATE TEMP TABLE IF NOT EXISTS json_timeline( |
| 73 | @ sortId INTEGER PRIMARY KEY, |
| 74 | @ rid INTEGER, |
| 75 | @ uuid TEXT, |
| 76 | @ mtime INTEGER, |
| @@ -109,11 +109,11 @@ | |
| 109 | @ (SELECT group_concat(substr(tagname,5), ',') FROM tag, tagxref |
| 110 | @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid |
| 111 | @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0) as tags, |
| 112 | @ tagid as tagId, |
| 113 | @ brief as brief |
| 114 | @ FROM event JOIN blob |
| 115 | @ WHERE blob.rid=event.objid |
| 116 | ; |
| 117 | return zBaseSql; |
| 118 | } |
| 119 | |
| @@ -316,11 +316,11 @@ | |
| 316 | */ |
| 317 | cson_value * json_get_changed_files(int rid, int flags){ |
| 318 | cson_value * rowsV = NULL; |
| 319 | cson_array * rows = NULL; |
| 320 | Stmt q = empty_Stmt; |
| 321 | db_prepare(&q, |
| 322 | "SELECT (pid==0) AS isnew," |
| 323 | " (fid==0) AS isdel," |
| 324 | " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name," |
| 325 | " blob.uuid as uuid," |
| 326 | " (SELECT uuid FROM blob WHERE rid=pid) as parent," |
| 327 | |
| 328 | DDED src/loadctrl.c |
| --- src/json_timeline.c | |
| +++ src/json_timeline.c | |
| @@ -66,11 +66,11 @@ | |
| 66 | /* |
| 67 | ** Create a temporary table suitable for storing timeline data. |
| 68 | */ |
| 69 | static void json_timeline_temp_table(void){ |
| 70 | /* Field order MUST match that from json_timeline_query()!!! */ |
| 71 | static const char zSql[] = |
| 72 | @ CREATE TEMP TABLE IF NOT EXISTS json_timeline( |
| 73 | @ sortId INTEGER PRIMARY KEY, |
| 74 | @ rid INTEGER, |
| 75 | @ uuid TEXT, |
| 76 | @ mtime INTEGER, |
| @@ -109,11 +109,11 @@ | |
| 109 | @ (SELECT group_concat(substr(tagname,5), ',') FROM tag, tagxref |
| 110 | @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid |
| 111 | @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0) as tags, |
| 112 | @ tagid as tagId, |
| 113 | @ brief as brief |
| 114 | @ FROM event JOIN blob |
| 115 | @ WHERE blob.rid=event.objid |
| 116 | ; |
| 117 | return zBaseSql; |
| 118 | } |
| 119 | |
| @@ -316,11 +316,11 @@ | |
| 316 | */ |
| 317 | cson_value * json_get_changed_files(int rid, int flags){ |
| 318 | cson_value * rowsV = NULL; |
| 319 | cson_array * rows = NULL; |
| 320 | Stmt q = empty_Stmt; |
| 321 | db_prepare(&q, |
| 322 | "SELECT (pid==0) AS isnew," |
| 323 | " (fid==0) AS isdel," |
| 324 | " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name," |
| 325 | " blob.uuid as uuid," |
| 326 | " (SELECT uuid FROM blob WHERE rid=pid) as parent," |
| 327 | |
| 328 | DDED src/loadctrl.c |
+1
| --- 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 @@ | ||
| 1142 | 1142 | /* Set the capabilities */ |
| 1143 | 1143 | login_set_capabilities(zCap, 0); |
| 1144 | 1144 | login_anon_once = 1; |
| 1145 | 1145 | login_set_anon_nobody_capabilities(); |
| 1146 | 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 | +} | |
| 1147 | 1161 | |
| 1148 | 1162 | /* |
| 1149 | 1163 | ** Call this routine when the credential check fails. It causes |
| 1150 | 1164 | ** a redirect to the "login" page. |
| 1151 | 1165 | */ |
| 1152 | 1166 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -1142,10 +1142,24 @@ | |
| 1142 | /* Set the capabilities */ |
| 1143 | login_set_capabilities(zCap, 0); |
| 1144 | login_anon_once = 1; |
| 1145 | login_set_anon_nobody_capabilities(); |
| 1146 | } |
| 1147 | |
| 1148 | /* |
| 1149 | ** Call this routine when the credential check fails. It causes |
| 1150 | ** a redirect to the "login" page. |
| 1151 | */ |
| 1152 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -1142,10 +1142,24 @@ | |
| 1142 | /* Set the capabilities */ |
| 1143 | login_set_capabilities(zCap, 0); |
| 1144 | login_anon_once = 1; |
| 1145 | login_set_anon_nobody_capabilities(); |
| 1146 | } |
| 1147 | |
| 1148 | /* |
| 1149 | ** Return true if the user is "nobody" |
| 1150 | */ |
| 1151 | int login_is_nobody(void){ |
| 1152 | return g.zLogin==0 || g.zLogin[0]==0 || fossil_strcmp(g.zLogin,"nobody")==0; |
| 1153 | } |
| 1154 | |
| 1155 | /* |
| 1156 | ** Return the login name. If no login name is specified, return "nobody". |
| 1157 | */ |
| 1158 | const char *login_name(void){ |
| 1159 | return (g.zLogin && g.zLogin[0]) ? g.zLogin : "nobody"; |
| 1160 | } |
| 1161 | |
| 1162 | /* |
| 1163 | ** Call this routine when the credential check fails. It causes |
| 1164 | ** a redirect to the "login" page. |
| 1165 | */ |
| 1166 |
+6
-3
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -16,10 +16,11 @@ | ||
| 16 | 16 | ******************************************************************************* |
| 17 | 17 | ** |
| 18 | 18 | ** This module codes the main() procedure that runs first when the |
| 19 | 19 | ** program is invoked. |
| 20 | 20 | */ |
| 21 | +#include "VERSION.h" | |
| 21 | 22 | #include "config.h" |
| 22 | 23 | #include "main.h" |
| 23 | 24 | #include <string.h> |
| 24 | 25 | #include <time.h> |
| 25 | 26 | #include <fcntl.h> |
| @@ -120,11 +121,11 @@ | ||
| 120 | 121 | |
| 121 | 122 | struct Global { |
| 122 | 123 | int argc; char **argv; /* Command-line arguments to the program */ |
| 123 | 124 | char *nameOfExe; /* Full path of executable. */ |
| 124 | 125 | const char *zErrlog; /* Log errors to this file, if not NULL */ |
| 125 | - int isConst; /* True if the output is unchanging */ | |
| 126 | + int isConst; /* True if the output is unchanging & cacheable */ | |
| 126 | 127 | const char *zVfsName; /* The VFS to use for database connections */ |
| 127 | 128 | sqlite3 *db; /* The connection to the databases */ |
| 128 | 129 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 129 | 130 | int useAttach; /* True if global_config is attached to repository */ |
| 130 | 131 | const char *zConfigDbName;/* Path of the config database. NULL if not open */ |
| @@ -139,10 +140,11 @@ | ||
| 139 | 140 | int fSqlTrace; /* True if --sqltrace flag is present */ |
| 140 | 141 | int fSqlStats; /* True if --sqltrace or --sqlstats are present */ |
| 141 | 142 | int fSqlPrint; /* True if -sqlprint flag is present */ |
| 142 | 143 | int fQuiet; /* True if -quiet flag is present */ |
| 143 | 144 | int fHttpTrace; /* Trace outbound HTTP requests */ |
| 145 | + char *zHttpAuth; /* HTTP Authorization user:pass information */ | |
| 144 | 146 | int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */ |
| 145 | 147 | int fSshTrace; /* Trace the SSH setup traffic */ |
| 146 | 148 | int fSshClient; /* HTTP client flags for SSH client */ |
| 147 | 149 | char *zSshCmd; /* SSH command string */ |
| 148 | 150 | int fNoSync; /* Do not do an autosync ever. --nosync */ |
| @@ -192,11 +194,11 @@ | ||
| 192 | 194 | char *urlFossil; /* The fossil query parameter on ssh: */ |
| 193 | 195 | unsigned urlFlags; /* Boolean flags controlling URL processing */ |
| 194 | 196 | int useProxy; /* Used to remember that a proxy is in use */ |
| 195 | 197 | char *proxyUrlPath; |
| 196 | 198 | int proxyOrigPort; /* Tunneled port number for https through proxy */ |
| 197 | - const char *zLogin; /* Login name. "" if not logged in. */ | |
| 199 | + const char *zLogin; /* Login name. NULL or "" if not logged in. */ | |
| 198 | 200 | const char *zSSLIdentity; /* Value of --ssl-identity option, filename of |
| 199 | 201 | ** SSL client identity */ |
| 200 | 202 | int useLocalauth; /* No login required if from 127.0.0.1 */ |
| 201 | 203 | int noPswd; /* Logged in without password (on 127.0.0.1) */ |
| 202 | 204 | int userUid; /* Integer user id */ |
| @@ -650,10 +652,11 @@ | ||
| 650 | 652 | g.fSshClient = 0; |
| 651 | 653 | g.zSshCmd = 0; |
| 652 | 654 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| 653 | 655 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 654 | 656 | g.fHttpTrace = find_option("httptrace", 0, 0)!=0; |
| 657 | + g.zHttpAuth = 0; | |
| 655 | 658 | g.zLogin = find_option("user", "U", 1); |
| 656 | 659 | g.zSSLIdentity = find_option("ssl-identity", 0, 1); |
| 657 | 660 | g.zErrlog = find_option("errorlog", 0, 1); |
| 658 | 661 | if( find_option("utc",0,0) ) g.fTimeFormat = 1; |
| 659 | 662 | if( find_option("localtime",0,0) ) g.fTimeFormat = 2; |
| @@ -1456,11 +1459,11 @@ | ||
| 1456 | 1459 | zAltRepo[jj] = 0; |
| 1457 | 1460 | zAltRepo += jj+1; |
| 1458 | 1461 | }else{ |
| 1459 | 1462 | zUser = "nobody"; |
| 1460 | 1463 | } |
| 1461 | - if( g.zLogin==0 ) zUser = "nobody"; | |
| 1464 | + if( g.zLogin==0 || g.zLogin[0]==0 ) zUser = "nobody"; | |
| 1462 | 1465 | if( zAltRepo[0]!='/' ){ |
| 1463 | 1466 | zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo); |
| 1464 | 1467 | file_simplify_name(zAltRepo, -1, 0); |
| 1465 | 1468 | } |
| 1466 | 1469 | db_close(1); |
| 1467 | 1470 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -16,10 +16,11 @@ | |
| 16 | ******************************************************************************* |
| 17 | ** |
| 18 | ** This module codes the main() procedure that runs first when the |
| 19 | ** program is invoked. |
| 20 | */ |
| 21 | #include "config.h" |
| 22 | #include "main.h" |
| 23 | #include <string.h> |
| 24 | #include <time.h> |
| 25 | #include <fcntl.h> |
| @@ -120,11 +121,11 @@ | |
| 120 | |
| 121 | struct Global { |
| 122 | int argc; char **argv; /* Command-line arguments to the program */ |
| 123 | char *nameOfExe; /* Full path of executable. */ |
| 124 | const char *zErrlog; /* Log errors to this file, if not NULL */ |
| 125 | int isConst; /* True if the output is unchanging */ |
| 126 | const char *zVfsName; /* The VFS to use for database connections */ |
| 127 | sqlite3 *db; /* The connection to the databases */ |
| 128 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 129 | int useAttach; /* True if global_config is attached to repository */ |
| 130 | const char *zConfigDbName;/* Path of the config database. NULL if not open */ |
| @@ -139,10 +140,11 @@ | |
| 139 | int fSqlTrace; /* True if --sqltrace flag is present */ |
| 140 | int fSqlStats; /* True if --sqltrace or --sqlstats are present */ |
| 141 | int fSqlPrint; /* True if -sqlprint flag is present */ |
| 142 | int fQuiet; /* True if -quiet flag is present */ |
| 143 | int fHttpTrace; /* Trace outbound HTTP requests */ |
| 144 | int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */ |
| 145 | int fSshTrace; /* Trace the SSH setup traffic */ |
| 146 | int fSshClient; /* HTTP client flags for SSH client */ |
| 147 | char *zSshCmd; /* SSH command string */ |
| 148 | int fNoSync; /* Do not do an autosync ever. --nosync */ |
| @@ -192,11 +194,11 @@ | |
| 192 | char *urlFossil; /* The fossil query parameter on ssh: */ |
| 193 | unsigned urlFlags; /* Boolean flags controlling URL processing */ |
| 194 | int useProxy; /* Used to remember that a proxy is in use */ |
| 195 | char *proxyUrlPath; |
| 196 | int proxyOrigPort; /* Tunneled port number for https through proxy */ |
| 197 | const char *zLogin; /* Login name. "" if not logged in. */ |
| 198 | const char *zSSLIdentity; /* Value of --ssl-identity option, filename of |
| 199 | ** SSL client identity */ |
| 200 | int useLocalauth; /* No login required if from 127.0.0.1 */ |
| 201 | int noPswd; /* Logged in without password (on 127.0.0.1) */ |
| 202 | int userUid; /* Integer user id */ |
| @@ -650,10 +652,11 @@ | |
| 650 | g.fSshClient = 0; |
| 651 | g.zSshCmd = 0; |
| 652 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| 653 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 654 | g.fHttpTrace = find_option("httptrace", 0, 0)!=0; |
| 655 | g.zLogin = find_option("user", "U", 1); |
| 656 | g.zSSLIdentity = find_option("ssl-identity", 0, 1); |
| 657 | g.zErrlog = find_option("errorlog", 0, 1); |
| 658 | if( find_option("utc",0,0) ) g.fTimeFormat = 1; |
| 659 | if( find_option("localtime",0,0) ) g.fTimeFormat = 2; |
| @@ -1456,11 +1459,11 @@ | |
| 1456 | zAltRepo[jj] = 0; |
| 1457 | zAltRepo += jj+1; |
| 1458 | }else{ |
| 1459 | zUser = "nobody"; |
| 1460 | } |
| 1461 | if( g.zLogin==0 ) zUser = "nobody"; |
| 1462 | if( zAltRepo[0]!='/' ){ |
| 1463 | zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo); |
| 1464 | file_simplify_name(zAltRepo, -1, 0); |
| 1465 | } |
| 1466 | db_close(1); |
| 1467 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -16,10 +16,11 @@ | |
| 16 | ******************************************************************************* |
| 17 | ** |
| 18 | ** This module codes the main() procedure that runs first when the |
| 19 | ** program is invoked. |
| 20 | */ |
| 21 | #include "VERSION.h" |
| 22 | #include "config.h" |
| 23 | #include "main.h" |
| 24 | #include <string.h> |
| 25 | #include <time.h> |
| 26 | #include <fcntl.h> |
| @@ -120,11 +121,11 @@ | |
| 121 | |
| 122 | struct Global { |
| 123 | int argc; char **argv; /* Command-line arguments to the program */ |
| 124 | char *nameOfExe; /* Full path of executable. */ |
| 125 | const char *zErrlog; /* Log errors to this file, if not NULL */ |
| 126 | int isConst; /* True if the output is unchanging & cacheable */ |
| 127 | const char *zVfsName; /* The VFS to use for database connections */ |
| 128 | sqlite3 *db; /* The connection to the databases */ |
| 129 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 130 | int useAttach; /* True if global_config is attached to repository */ |
| 131 | const char *zConfigDbName;/* Path of the config database. NULL if not open */ |
| @@ -139,10 +140,11 @@ | |
| 140 | int fSqlTrace; /* True if --sqltrace flag is present */ |
| 141 | int fSqlStats; /* True if --sqltrace or --sqlstats are present */ |
| 142 | int fSqlPrint; /* True if -sqlprint flag is present */ |
| 143 | int fQuiet; /* True if -quiet flag is present */ |
| 144 | int fHttpTrace; /* Trace outbound HTTP requests */ |
| 145 | char *zHttpAuth; /* HTTP Authorization user:pass information */ |
| 146 | int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */ |
| 147 | int fSshTrace; /* Trace the SSH setup traffic */ |
| 148 | int fSshClient; /* HTTP client flags for SSH client */ |
| 149 | char *zSshCmd; /* SSH command string */ |
| 150 | int fNoSync; /* Do not do an autosync ever. --nosync */ |
| @@ -192,11 +194,11 @@ | |
| 194 | char *urlFossil; /* The fossil query parameter on ssh: */ |
| 195 | unsigned urlFlags; /* Boolean flags controlling URL processing */ |
| 196 | int useProxy; /* Used to remember that a proxy is in use */ |
| 197 | char *proxyUrlPath; |
| 198 | int proxyOrigPort; /* Tunneled port number for https through proxy */ |
| 199 | const char *zLogin; /* Login name. NULL or "" if not logged in. */ |
| 200 | const char *zSSLIdentity; /* Value of --ssl-identity option, filename of |
| 201 | ** SSL client identity */ |
| 202 | int useLocalauth; /* No login required if from 127.0.0.1 */ |
| 203 | int noPswd; /* Logged in without password (on 127.0.0.1) */ |
| 204 | int userUid; /* Integer user id */ |
| @@ -650,10 +652,11 @@ | |
| 652 | g.fSshClient = 0; |
| 653 | g.zSshCmd = 0; |
| 654 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| 655 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 656 | g.fHttpTrace = find_option("httptrace", 0, 0)!=0; |
| 657 | g.zHttpAuth = 0; |
| 658 | g.zLogin = find_option("user", "U", 1); |
| 659 | g.zSSLIdentity = find_option("ssl-identity", 0, 1); |
| 660 | g.zErrlog = find_option("errorlog", 0, 1); |
| 661 | if( find_option("utc",0,0) ) g.fTimeFormat = 1; |
| 662 | if( find_option("localtime",0,0) ) g.fTimeFormat = 2; |
| @@ -1456,11 +1459,11 @@ | |
| 1459 | zAltRepo[jj] = 0; |
| 1460 | zAltRepo += jj+1; |
| 1461 | }else{ |
| 1462 | zUser = "nobody"; |
| 1463 | } |
| 1464 | if( g.zLogin==0 || g.zLogin[0]==0 ) zUser = "nobody"; |
| 1465 | if( zAltRepo[0]!='/' ){ |
| 1466 | zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo); |
| 1467 | file_simplify_name(zAltRepo, -1, 0); |
| 1468 | } |
| 1469 | db_close(1); |
| 1470 |
+14
-2
| --- src/main.mk | ||
| +++ src/main.mk | ||
| @@ -66,10 +66,11 @@ | ||
| 66 | 66 | $(SRCDIR)/json_tag.c \ |
| 67 | 67 | $(SRCDIR)/json_timeline.c \ |
| 68 | 68 | $(SRCDIR)/json_user.c \ |
| 69 | 69 | $(SRCDIR)/json_wiki.c \ |
| 70 | 70 | $(SRCDIR)/leaf.c \ |
| 71 | + $(SRCDIR)/loadctrl.c \ | |
| 71 | 72 | $(SRCDIR)/login.c \ |
| 72 | 73 | $(SRCDIR)/lookslike.c \ |
| 73 | 74 | $(SRCDIR)/main.c \ |
| 74 | 75 | $(SRCDIR)/manifest.c \ |
| 75 | 76 | $(SRCDIR)/markdown.c \ |
| @@ -176,10 +177,11 @@ | ||
| 176 | 177 | $(OBJDIR)/json_tag_.c \ |
| 177 | 178 | $(OBJDIR)/json_timeline_.c \ |
| 178 | 179 | $(OBJDIR)/json_user_.c \ |
| 179 | 180 | $(OBJDIR)/json_wiki_.c \ |
| 180 | 181 | $(OBJDIR)/leaf_.c \ |
| 182 | + $(OBJDIR)/loadctrl_.c \ | |
| 181 | 183 | $(OBJDIR)/login_.c \ |
| 182 | 184 | $(OBJDIR)/lookslike_.c \ |
| 183 | 185 | $(OBJDIR)/main_.c \ |
| 184 | 186 | $(OBJDIR)/manifest_.c \ |
| 185 | 187 | $(OBJDIR)/markdown_.c \ |
| @@ -286,10 +288,11 @@ | ||
| 286 | 288 | $(OBJDIR)/json_tag.o \ |
| 287 | 289 | $(OBJDIR)/json_timeline.o \ |
| 288 | 290 | $(OBJDIR)/json_user.o \ |
| 289 | 291 | $(OBJDIR)/json_wiki.o \ |
| 290 | 292 | $(OBJDIR)/leaf.o \ |
| 293 | + $(OBJDIR)/loadctrl.o \ | |
| 291 | 294 | $(OBJDIR)/login.o \ |
| 292 | 295 | $(OBJDIR)/lookslike.o \ |
| 293 | 296 | $(OBJDIR)/main.o \ |
| 294 | 297 | $(OBJDIR)/manifest.o \ |
| 295 | 298 | $(OBJDIR)/markdown.o \ |
| @@ -385,11 +388,13 @@ | ||
| 385 | 388 | -DSQLITE_OMIT_DEPRECATED \ |
| 386 | 389 | -DSQLITE_ENABLE_EXPLAIN_COMMENTS |
| 387 | 390 | |
| 388 | 391 | # Setup the options used to compile the included SQLite shell. |
| 389 | 392 | 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 | |
| 391 | 396 | |
| 392 | 397 | # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set |
| 393 | 398 | # to 1. If it is set to 1, then there is no need to build or link |
| 394 | 399 | # the sqlite3.o object. Instead, the system sqlite will be linked |
| 395 | 400 | # using -lsqlite3. |
| @@ -420,11 +425,11 @@ | ||
| 420 | 425 | |
| 421 | 426 | |
| 422 | 427 | $(OBJDIR)/page_index.h: $(TRANS_SRC) $(OBJDIR)/mkindex |
| 423 | 428 | $(OBJDIR)/mkindex $(TRANS_SRC) >$@ |
| 424 | 429 | $(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 | |
| 426 | 431 | touch $(OBJDIR)/headers |
| 427 | 432 | $(OBJDIR)/headers: Makefile |
| 428 | 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 |
| 429 | 434 | Makefile: |
| 430 | 435 | $(OBJDIR)/add_.c: $(SRCDIR)/add.c $(OBJDIR)/translate |
| @@ -803,10 +808,17 @@ | ||
| 803 | 808 | |
| 804 | 809 | $(OBJDIR)/leaf.o: $(OBJDIR)/leaf_.c $(OBJDIR)/leaf.h $(SRCDIR)/config.h |
| 805 | 810 | $(XTCC) -o $(OBJDIR)/leaf.o -c $(OBJDIR)/leaf_.c |
| 806 | 811 | |
| 807 | 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 | |
| 808 | 820 | $(OBJDIR)/login_.c: $(SRCDIR)/login.c $(OBJDIR)/translate |
| 809 | 821 | $(OBJDIR)/translate $(SRCDIR)/login.c >$(OBJDIR)/login_.c |
| 810 | 822 | |
| 811 | 823 | $(OBJDIR)/login.o: $(OBJDIR)/login_.c $(OBJDIR)/login.h $(SRCDIR)/config.h |
| 812 | 824 | $(XTCC) -o $(OBJDIR)/login.o -c $(OBJDIR)/login_.c |
| 813 | 825 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -66,10 +66,11 @@ | |
| 66 | $(SRCDIR)/json_tag.c \ |
| 67 | $(SRCDIR)/json_timeline.c \ |
| 68 | $(SRCDIR)/json_user.c \ |
| 69 | $(SRCDIR)/json_wiki.c \ |
| 70 | $(SRCDIR)/leaf.c \ |
| 71 | $(SRCDIR)/login.c \ |
| 72 | $(SRCDIR)/lookslike.c \ |
| 73 | $(SRCDIR)/main.c \ |
| 74 | $(SRCDIR)/manifest.c \ |
| 75 | $(SRCDIR)/markdown.c \ |
| @@ -176,10 +177,11 @@ | |
| 176 | $(OBJDIR)/json_tag_.c \ |
| 177 | $(OBJDIR)/json_timeline_.c \ |
| 178 | $(OBJDIR)/json_user_.c \ |
| 179 | $(OBJDIR)/json_wiki_.c \ |
| 180 | $(OBJDIR)/leaf_.c \ |
| 181 | $(OBJDIR)/login_.c \ |
| 182 | $(OBJDIR)/lookslike_.c \ |
| 183 | $(OBJDIR)/main_.c \ |
| 184 | $(OBJDIR)/manifest_.c \ |
| 185 | $(OBJDIR)/markdown_.c \ |
| @@ -286,10 +288,11 @@ | |
| 286 | $(OBJDIR)/json_tag.o \ |
| 287 | $(OBJDIR)/json_timeline.o \ |
| 288 | $(OBJDIR)/json_user.o \ |
| 289 | $(OBJDIR)/json_wiki.o \ |
| 290 | $(OBJDIR)/leaf.o \ |
| 291 | $(OBJDIR)/login.o \ |
| 292 | $(OBJDIR)/lookslike.o \ |
| 293 | $(OBJDIR)/main.o \ |
| 294 | $(OBJDIR)/manifest.o \ |
| 295 | $(OBJDIR)/markdown.o \ |
| @@ -385,11 +388,13 @@ | |
| 385 | -DSQLITE_OMIT_DEPRECATED \ |
| 386 | -DSQLITE_ENABLE_EXPLAIN_COMMENTS |
| 387 | |
| 388 | # Setup the options used to compile the included SQLite shell. |
| 389 | SHELL_OPTIONS = -Dmain=sqlite3_shell \ |
| 390 | -DSQLITE_OMIT_LOAD_EXTENSION=1 |
| 391 | |
| 392 | # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set |
| 393 | # to 1. If it is set to 1, then there is no need to build or link |
| 394 | # the sqlite3.o object. Instead, the system sqlite will be linked |
| 395 | # using -lsqlite3. |
| @@ -420,11 +425,11 @@ | |
| 420 | |
| 421 | |
| 422 | $(OBJDIR)/page_index.h: $(TRANS_SRC) $(OBJDIR)/mkindex |
| 423 | $(OBJDIR)/mkindex $(TRANS_SRC) >$@ |
| 424 | $(OBJDIR)/headers: $(OBJDIR)/page_index.h $(OBJDIR)/makeheaders $(OBJDIR)/VERSION.h |
| 425 | $(OBJDIR)/makeheaders $(OBJDIR)/add_.c:$(OBJDIR)/add.h $(OBJDIR)/allrepo_.c:$(OBJDIR)/allrepo.h $(OBJDIR)/attach_.c:$(OBJDIR)/attach.h $(OBJDIR)/bag_.c:$(OBJDIR)/bag.h $(OBJDIR)/bisect_.c:$(OBJDIR)/bisect.h $(OBJDIR)/blob_.c:$(OBJDIR)/blob.h $(OBJDIR)/branch_.c:$(OBJDIR)/branch.h $(OBJDIR)/browse_.c:$(OBJDIR)/browse.h $(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h $(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h $(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h $(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h $(OBJDIR)/clearsign_.c:$(OBJDIR)/clearsign.h $(OBJDIR)/clone_.c:$(OBJDIR)/clone.h $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h $(OBJDIR)/configure_.c:$(OBJDIR)/configure.h $(OBJDIR)/content_.c:$(OBJDIR)/content.h $(OBJDIR)/db_.c:$(OBJDIR)/db.h $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h $(OBJDIR)/encode_.c:$(OBJDIR)/encode.h $(OBJDIR)/event_.c:$(OBJDIR)/event.h $(OBJDIR)/export_.c:$(OBJDIR)/export.h $(OBJDIR)/file_.c:$(OBJDIR)/file.h $(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h $(OBJDIR)/http_.c:$(OBJDIR)/http.h $(OBJDIR)/http_socket_.c:$(OBJDIR)/http_socket.h $(OBJDIR)/http_ssl_.c:$(OBJDIR)/http_ssl.h $(OBJDIR)/http_transport_.c:$(OBJDIR)/http_transport.h $(OBJDIR)/import_.c:$(OBJDIR)/import.h $(OBJDIR)/info_.c:$(OBJDIR)/info.h $(OBJDIR)/json_.c:$(OBJDIR)/json.h $(OBJDIR)/json_artifact_.c:$(OBJDIR)/json_artifact.h $(OBJDIR)/json_branch_.c:$(OBJDIR)/json_branch.h $(OBJDIR)/json_config_.c:$(OBJDIR)/json_config.h $(OBJDIR)/json_diff_.c:$(OBJDIR)/json_diff.h $(OBJDIR)/json_dir_.c:$(OBJDIR)/json_dir.h $(OBJDIR)/json_finfo_.c:$(OBJDIR)/json_finfo.h $(OBJDIR)/json_login_.c:$(OBJDIR)/json_login.h $(OBJDIR)/json_query_.c:$(OBJDIR)/json_query.h $(OBJDIR)/json_report_.c:$(OBJDIR)/json_report.h $(OBJDIR)/json_status_.c:$(OBJDIR)/json_status.h $(OBJDIR)/json_tag_.c:$(OBJDIR)/json_tag.h $(OBJDIR)/json_timeline_.c:$(OBJDIR)/json_timeline.h $(OBJDIR)/json_user_.c:$(OBJDIR)/json_user.h $(OBJDIR)/json_wiki_.c:$(OBJDIR)/json_wiki.h $(OBJDIR)/leaf_.c:$(OBJDIR)/leaf.h $(OBJDIR)/login_.c:$(OBJDIR)/login.h $(OBJDIR)/lookslike_.c:$(OBJDIR)/lookslike.h $(OBJDIR)/main_.c:$(OBJDIR)/main.h $(OBJDIR)/manifest_.c:$(OBJDIR)/manifest.h $(OBJDIR)/markdown_.c:$(OBJDIR)/markdown.h $(OBJDIR)/markdown_html_.c:$(OBJDIR)/markdown_html.h $(OBJDIR)/md5_.c:$(OBJDIR)/md5.h $(OBJDIR)/merge_.c:$(OBJDIR)/merge.h $(OBJDIR)/merge3_.c:$(OBJDIR)/merge3.h $(OBJDIR)/moderate_.c:$(OBJDIR)/moderate.h $(OBJDIR)/name_.c:$(OBJDIR)/name.h $(OBJDIR)/path_.c:$(OBJDIR)/path.h $(OBJDIR)/pivot_.c:$(OBJDIR)/pivot.h $(OBJDIR)/popen_.c:$(OBJDIR)/popen.h $(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h $(OBJDIR)/printf_.c:$(OBJDIR)/printf.h $(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h $(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h $(OBJDIR)/report_.c:$(OBJDIR)/report.h $(OBJDIR)/rss_.c:$(OBJDIR)/rss.h $(OBJDIR)/schema_.c:$(OBJDIR)/schema.h $(OBJDIR)/search_.c:$(OBJDIR)/search.h $(OBJDIR)/setup_.c:$(OBJDIR)/setup.h $(OBJDIR)/sha1_.c:$(OBJDIR)/sha1.h $(OBJDIR)/shun_.c:$(OBJDIR)/shun.h $(OBJDIR)/skins_.c:$(OBJDIR)/skins.h $(OBJDIR)/sqlcmd_.c:$(OBJDIR)/sqlcmd.h $(OBJDIR)/stash_.c:$(OBJDIR)/stash.h $(OBJDIR)/stat_.c:$(OBJDIR)/stat.h $(OBJDIR)/style_.c:$(OBJDIR)/style.h $(OBJDIR)/sync_.c:$(OBJDIR)/sync.h $(OBJDIR)/tag_.c:$(OBJDIR)/tag.h $(OBJDIR)/tar_.c:$(OBJDIR)/tar.h $(OBJDIR)/th_main_.c:$(OBJDIR)/th_main.h $(OBJDIR)/timeline_.c:$(OBJDIR)/timeline.h $(OBJDIR)/tkt_.c:$(OBJDIR)/tkt.h $(OBJDIR)/tktsetup_.c:$(OBJDIR)/tktsetup.h $(OBJDIR)/undo_.c:$(OBJDIR)/undo.h $(OBJDIR)/unicode_.c:$(OBJDIR)/unicode.h $(OBJDIR)/update_.c:$(OBJDIR)/update.h $(OBJDIR)/url_.c:$(OBJDIR)/url.h $(OBJDIR)/user_.c:$(OBJDIR)/user.h $(OBJDIR)/utf8_.c:$(OBJDIR)/utf8.h $(OBJDIR)/util_.c:$(OBJDIR)/util.h $(OBJDIR)/verify_.c:$(OBJDIR)/verify.h $(OBJDIR)/vfile_.c:$(OBJDIR)/vfile.h $(OBJDIR)/wiki_.c:$(OBJDIR)/wiki.h $(OBJDIR)/wikiformat_.c:$(OBJDIR)/wikiformat.h $(OBJDIR)/winfile_.c:$(OBJDIR)/winfile.h $(OBJDIR)/winhttp_.c:$(OBJDIR)/winhttp.h $(OBJDIR)/wysiwyg_.c:$(OBJDIR)/wysiwyg.h $(OBJDIR)/xfer_.c:$(OBJDIR)/xfer.h $(OBJDIR)/xfersetup_.c:$(OBJDIR)/xfersetup.h $(OBJDIR)/zip_.c:$(OBJDIR)/zip.h $(SRCDIR)/sqlite3.h $(SRCDIR)/th.h $(OBJDIR)/VERSION.h |
| 426 | touch $(OBJDIR)/headers |
| 427 | $(OBJDIR)/headers: Makefile |
| 428 | $(OBJDIR)/json.o $(OBJDIR)/json_artifact.o $(OBJDIR)/json_branch.o $(OBJDIR)/json_config.o $(OBJDIR)/json_diff.o $(OBJDIR)/json_dir.o $(OBJDIR)/json_finfo.o $(OBJDIR)/json_login.o $(OBJDIR)/json_query.o $(OBJDIR)/json_report.o $(OBJDIR)/json_status.o $(OBJDIR)/json_tag.o $(OBJDIR)/json_timeline.o $(OBJDIR)/json_user.o $(OBJDIR)/json_wiki.o : $(SRCDIR)/json_detail.h |
| 429 | Makefile: |
| 430 | $(OBJDIR)/add_.c: $(SRCDIR)/add.c $(OBJDIR)/translate |
| @@ -803,10 +808,17 @@ | |
| 803 | |
| 804 | $(OBJDIR)/leaf.o: $(OBJDIR)/leaf_.c $(OBJDIR)/leaf.h $(SRCDIR)/config.h |
| 805 | $(XTCC) -o $(OBJDIR)/leaf.o -c $(OBJDIR)/leaf_.c |
| 806 | |
| 807 | $(OBJDIR)/leaf.h: $(OBJDIR)/headers |
| 808 | $(OBJDIR)/login_.c: $(SRCDIR)/login.c $(OBJDIR)/translate |
| 809 | $(OBJDIR)/translate $(SRCDIR)/login.c >$(OBJDIR)/login_.c |
| 810 | |
| 811 | $(OBJDIR)/login.o: $(OBJDIR)/login_.c $(OBJDIR)/login.h $(SRCDIR)/config.h |
| 812 | $(XTCC) -o $(OBJDIR)/login.o -c $(OBJDIR)/login_.c |
| 813 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -66,10 +66,11 @@ | |
| 66 | $(SRCDIR)/json_tag.c \ |
| 67 | $(SRCDIR)/json_timeline.c \ |
| 68 | $(SRCDIR)/json_user.c \ |
| 69 | $(SRCDIR)/json_wiki.c \ |
| 70 | $(SRCDIR)/leaf.c \ |
| 71 | $(SRCDIR)/loadctrl.c \ |
| 72 | $(SRCDIR)/login.c \ |
| 73 | $(SRCDIR)/lookslike.c \ |
| 74 | $(SRCDIR)/main.c \ |
| 75 | $(SRCDIR)/manifest.c \ |
| 76 | $(SRCDIR)/markdown.c \ |
| @@ -176,10 +177,11 @@ | |
| 177 | $(OBJDIR)/json_tag_.c \ |
| 178 | $(OBJDIR)/json_timeline_.c \ |
| 179 | $(OBJDIR)/json_user_.c \ |
| 180 | $(OBJDIR)/json_wiki_.c \ |
| 181 | $(OBJDIR)/leaf_.c \ |
| 182 | $(OBJDIR)/loadctrl_.c \ |
| 183 | $(OBJDIR)/login_.c \ |
| 184 | $(OBJDIR)/lookslike_.c \ |
| 185 | $(OBJDIR)/main_.c \ |
| 186 | $(OBJDIR)/manifest_.c \ |
| 187 | $(OBJDIR)/markdown_.c \ |
| @@ -286,10 +288,11 @@ | |
| 288 | $(OBJDIR)/json_tag.o \ |
| 289 | $(OBJDIR)/json_timeline.o \ |
| 290 | $(OBJDIR)/json_user.o \ |
| 291 | $(OBJDIR)/json_wiki.o \ |
| 292 | $(OBJDIR)/leaf.o \ |
| 293 | $(OBJDIR)/loadctrl.o \ |
| 294 | $(OBJDIR)/login.o \ |
| 295 | $(OBJDIR)/lookslike.o \ |
| 296 | $(OBJDIR)/main.o \ |
| 297 | $(OBJDIR)/manifest.o \ |
| 298 | $(OBJDIR)/markdown.o \ |
| @@ -385,11 +388,13 @@ | |
| 388 | -DSQLITE_OMIT_DEPRECATED \ |
| 389 | -DSQLITE_ENABLE_EXPLAIN_COMMENTS |
| 390 | |
| 391 | # Setup the options used to compile the included SQLite shell. |
| 392 | SHELL_OPTIONS = -Dmain=sqlite3_shell \ |
| 393 | -DSQLITE_OMIT_LOAD_EXTENSION=1 \ |
| 394 | -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \ |
| 395 | -DSQLITE_SHELL_DBNAME_PROC=fossil_open |
| 396 | |
| 397 | # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set |
| 398 | # to 1. If it is set to 1, then there is no need to build or link |
| 399 | # the sqlite3.o object. Instead, the system sqlite will be linked |
| 400 | # using -lsqlite3. |
| @@ -420,11 +425,11 @@ | |
| 425 | |
| 426 | |
| 427 | $(OBJDIR)/page_index.h: $(TRANS_SRC) $(OBJDIR)/mkindex |
| 428 | $(OBJDIR)/mkindex $(TRANS_SRC) >$@ |
| 429 | $(OBJDIR)/headers: $(OBJDIR)/page_index.h $(OBJDIR)/makeheaders $(OBJDIR)/VERSION.h |
| 430 | $(OBJDIR)/makeheaders $(OBJDIR)/add_.c:$(OBJDIR)/add.h $(OBJDIR)/allrepo_.c:$(OBJDIR)/allrepo.h $(OBJDIR)/attach_.c:$(OBJDIR)/attach.h $(OBJDIR)/bag_.c:$(OBJDIR)/bag.h $(OBJDIR)/bisect_.c:$(OBJDIR)/bisect.h $(OBJDIR)/blob_.c:$(OBJDIR)/blob.h $(OBJDIR)/branch_.c:$(OBJDIR)/branch.h $(OBJDIR)/browse_.c:$(OBJDIR)/browse.h $(OBJDIR)/captcha_.c:$(OBJDIR)/captcha.h $(OBJDIR)/cgi_.c:$(OBJDIR)/cgi.h $(OBJDIR)/checkin_.c:$(OBJDIR)/checkin.h $(OBJDIR)/checkout_.c:$(OBJDIR)/checkout.h $(OBJDIR)/clearsign_.c:$(OBJDIR)/clearsign.h $(OBJDIR)/clone_.c:$(OBJDIR)/clone.h $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h $(OBJDIR)/configure_.c:$(OBJDIR)/configure.h $(OBJDIR)/content_.c:$(OBJDIR)/content.h $(OBJDIR)/db_.c:$(OBJDIR)/db.h $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h $(OBJDIR)/encode_.c:$(OBJDIR)/encode.h $(OBJDIR)/event_.c:$(OBJDIR)/event.h $(OBJDIR)/export_.c:$(OBJDIR)/export.h $(OBJDIR)/file_.c:$(OBJDIR)/file.h $(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h $(OBJDIR)/http_.c:$(OBJDIR)/http.h $(OBJDIR)/http_socket_.c:$(OBJDIR)/http_socket.h $(OBJDIR)/http_ssl_.c:$(OBJDIR)/http_ssl.h $(OBJDIR)/http_transport_.c:$(OBJDIR)/http_transport.h $(OBJDIR)/import_.c:$(OBJDIR)/import.h $(OBJDIR)/info_.c:$(OBJDIR)/info.h $(OBJDIR)/json_.c:$(OBJDIR)/json.h $(OBJDIR)/json_artifact_.c:$(OBJDIR)/json_artifact.h $(OBJDIR)/json_branch_.c:$(OBJDIR)/json_branch.h $(OBJDIR)/json_config_.c:$(OBJDIR)/json_config.h $(OBJDIR)/json_diff_.c:$(OBJDIR)/json_diff.h $(OBJDIR)/json_dir_.c:$(OBJDIR)/json_dir.h $(OBJDIR)/json_finfo_.c:$(OBJDIR)/json_finfo.h $(OBJDIR)/json_login_.c:$(OBJDIR)/json_login.h $(OBJDIR)/json_query_.c:$(OBJDIR)/json_query.h $(OBJDIR)/json_report_.c:$(OBJDIR)/json_report.h $(OBJDIR)/json_status_.c:$(OBJDIR)/json_status.h $(OBJDIR)/json_tag_.c:$(OBJDIR)/json_tag.h $(OBJDIR)/json_timeline_.c:$(OBJDIR)/json_timeline.h $(OBJDIR)/json_user_.c:$(OBJDIR)/json_user.h $(OBJDIR)/json_wiki_.c:$(OBJDIR)/json_wiki.h $(OBJDIR)/leaf_.c:$(OBJDIR)/leaf.h $(OBJDIR)/loadctrl_.c:$(OBJDIR)/loadctrl.h $(OBJDIR)/login_.c:$(OBJDIR)/login.h $(OBJDIR)/lookslike_.c:$(OBJDIR)/lookslike.h $(OBJDIR)/main_.c:$(OBJDIR)/main.h $(OBJDIR)/manifest_.c:$(OBJDIR)/manifest.h $(OBJDIR)/markdown_.c:$(OBJDIR)/markdown.h $(OBJDIR)/markdown_html_.c:$(OBJDIR)/markdown_html.h $(OBJDIR)/md5_.c:$(OBJDIR)/md5.h $(OBJDIR)/merge_.c:$(OBJDIR)/merge.h $(OBJDIR)/merge3_.c:$(OBJDIR)/merge3.h $(OBJDIR)/moderate_.c:$(OBJDIR)/moderate.h $(OBJDIR)/name_.c:$(OBJDIR)/name.h $(OBJDIR)/path_.c:$(OBJDIR)/path.h $(OBJDIR)/pivot_.c:$(OBJDIR)/pivot.h $(OBJDIR)/popen_.c:$(OBJDIR)/popen.h $(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h $(OBJDIR)/printf_.c:$(OBJDIR)/printf.h $(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h $(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h $(OBJDIR)/report_.c:$(OBJDIR)/report.h $(OBJDIR)/rss_.c:$(OBJDIR)/rss.h $(OBJDIR)/schema_.c:$(OBJDIR)/schema.h $(OBJDIR)/search_.c:$(OBJDIR)/search.h $(OBJDIR)/setup_.c:$(OBJDIR)/setup.h $(OBJDIR)/sha1_.c:$(OBJDIR)/sha1.h $(OBJDIR)/shun_.c:$(OBJDIR)/shun.h $(OBJDIR)/skins_.c:$(OBJDIR)/skins.h $(OBJDIR)/sqlcmd_.c:$(OBJDIR)/sqlcmd.h $(OBJDIR)/stash_.c:$(OBJDIR)/stash.h $(OBJDIR)/stat_.c:$(OBJDIR)/stat.h $(OBJDIR)/style_.c:$(OBJDIR)/style.h $(OBJDIR)/sync_.c:$(OBJDIR)/sync.h $(OBJDIR)/tag_.c:$(OBJDIR)/tag.h $(OBJDIR)/tar_.c:$(OBJDIR)/tar.h $(OBJDIR)/th_main_.c:$(OBJDIR)/th_main.h $(OBJDIR)/timeline_.c:$(OBJDIR)/timeline.h $(OBJDIR)/tkt_.c:$(OBJDIR)/tkt.h $(OBJDIR)/tktsetup_.c:$(OBJDIR)/tktsetup.h $(OBJDIR)/undo_.c:$(OBJDIR)/undo.h $(OBJDIR)/unicode_.c:$(OBJDIR)/unicode.h $(OBJDIR)/update_.c:$(OBJDIR)/update.h $(OBJDIR)/url_.c:$(OBJDIR)/url.h $(OBJDIR)/user_.c:$(OBJDIR)/user.h $(OBJDIR)/utf8_.c:$(OBJDIR)/utf8.h $(OBJDIR)/util_.c:$(OBJDIR)/util.h $(OBJDIR)/verify_.c:$(OBJDIR)/verify.h $(OBJDIR)/vfile_.c:$(OBJDIR)/vfile.h $(OBJDIR)/wiki_.c:$(OBJDIR)/wiki.h $(OBJDIR)/wikiformat_.c:$(OBJDIR)/wikiformat.h $(OBJDIR)/winfile_.c:$(OBJDIR)/winfile.h $(OBJDIR)/winhttp_.c:$(OBJDIR)/winhttp.h $(OBJDIR)/wysiwyg_.c:$(OBJDIR)/wysiwyg.h $(OBJDIR)/xfer_.c:$(OBJDIR)/xfer.h $(OBJDIR)/xfersetup_.c:$(OBJDIR)/xfersetup.h $(OBJDIR)/zip_.c:$(OBJDIR)/zip.h $(SRCDIR)/sqlite3.h $(SRCDIR)/th.h $(OBJDIR)/VERSION.h |
| 431 | touch $(OBJDIR)/headers |
| 432 | $(OBJDIR)/headers: Makefile |
| 433 | $(OBJDIR)/json.o $(OBJDIR)/json_artifact.o $(OBJDIR)/json_branch.o $(OBJDIR)/json_config.o $(OBJDIR)/json_diff.o $(OBJDIR)/json_dir.o $(OBJDIR)/json_finfo.o $(OBJDIR)/json_login.o $(OBJDIR)/json_query.o $(OBJDIR)/json_report.o $(OBJDIR)/json_status.o $(OBJDIR)/json_tag.o $(OBJDIR)/json_timeline.o $(OBJDIR)/json_user.o $(OBJDIR)/json_wiki.o : $(SRCDIR)/json_detail.h |
| 434 | Makefile: |
| 435 | $(OBJDIR)/add_.c: $(SRCDIR)/add.c $(OBJDIR)/translate |
| @@ -803,10 +808,17 @@ | |
| 808 | |
| 809 | $(OBJDIR)/leaf.o: $(OBJDIR)/leaf_.c $(OBJDIR)/leaf.h $(SRCDIR)/config.h |
| 810 | $(XTCC) -o $(OBJDIR)/leaf.o -c $(OBJDIR)/leaf_.c |
| 811 | |
| 812 | $(OBJDIR)/leaf.h: $(OBJDIR)/headers |
| 813 | $(OBJDIR)/loadctrl_.c: $(SRCDIR)/loadctrl.c $(OBJDIR)/translate |
| 814 | $(OBJDIR)/translate $(SRCDIR)/loadctrl.c >$(OBJDIR)/loadctrl_.c |
| 815 | |
| 816 | $(OBJDIR)/loadctrl.o: $(OBJDIR)/loadctrl_.c $(OBJDIR)/loadctrl.h $(SRCDIR)/config.h |
| 817 | $(XTCC) -o $(OBJDIR)/loadctrl.o -c $(OBJDIR)/loadctrl_.c |
| 818 | |
| 819 | $(OBJDIR)/loadctrl.h: $(OBJDIR)/headers |
| 820 | $(OBJDIR)/login_.c: $(SRCDIR)/login.c $(OBJDIR)/translate |
| 821 | $(OBJDIR)/translate $(SRCDIR)/login.c >$(OBJDIR)/login_.c |
| 822 | |
| 823 | $(OBJDIR)/login.o: $(OBJDIR)/login_.c $(OBJDIR)/login.h $(SRCDIR)/config.h |
| 824 | $(XTCC) -o $(OBJDIR)/login.o -c $(OBJDIR)/login_.c |
| 825 |
+59
-22
| --- src/makemake.tcl | ||
| +++ src/makemake.tcl | ||
| @@ -69,10 +69,11 @@ | ||
| 69 | 69 | json_tag |
| 70 | 70 | json_timeline |
| 71 | 71 | json_user |
| 72 | 72 | json_wiki |
| 73 | 73 | leaf |
| 74 | + loadctrl | |
| 74 | 75 | login |
| 75 | 76 | lookslike |
| 76 | 77 | main |
| 77 | 78 | manifest |
| 78 | 79 | markdown |
| @@ -146,15 +147,18 @@ | ||
| 146 | 147 | # Options used to compile the included SQLite shell. |
| 147 | 148 | # |
| 148 | 149 | set SHELL_OPTIONS { |
| 149 | 150 | -Dmain=sqlite3_shell |
| 150 | 151 | -DSQLITE_OMIT_LOAD_EXTENSION=1 |
| 152 | + -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) | |
| 153 | + -DSQLITE_SHELL_DBNAME_PROC=fossil_open | |
| 151 | 154 | } |
| 152 | 155 | |
| 153 | 156 | # Options used to compile the included SQLite shell on Windows. |
| 154 | 157 | # |
| 155 | 158 | set SHELL_WIN32_OPTIONS $SHELL_OPTIONS |
| 159 | +lappend SHELL_WIN32_OPTIONS -Daccess=win32_access | |
| 156 | 160 | lappend SHELL_WIN32_OPTIONS -Dgetenv=fossil_getenv |
| 157 | 161 | lappend SHELL_WIN32_OPTIONS -Dfopen=fossil_fopen |
| 158 | 162 | |
| 159 | 163 | # Name of the final application |
| 160 | 164 | # |
| @@ -795,11 +799,11 @@ | ||
| 795 | 799 | writeln "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c \$(OBJDIR)/${s}_.c\n" |
| 796 | 800 | writeln "\$(OBJDIR)/${s}.h:\t\$(OBJDIR)/headers\n" |
| 797 | 801 | } |
| 798 | 802 | |
| 799 | 803 | 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 | |
| 801 | 805 | lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MALLOC_H |
| 802 | 806 | lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MSIZE |
| 803 | 807 | |
| 804 | 808 | set j " \\\n " |
| 805 | 809 | writeln "SQLITE_OPTIONS = [join $MINGW_SQLITE_OPTIONS $j]\n" |
| @@ -1015,54 +1019,78 @@ | ||
| 1015 | 1019 | # Uncomment to enable JSON API |
| 1016 | 1020 | # FOSSIL_ENABLE_JSON = 1 |
| 1017 | 1021 | |
| 1018 | 1022 | # Uncomment to enable SSL support |
| 1019 | 1023 | # FOSSIL_ENABLE_SSL = 1 |
| 1024 | + | |
| 1025 | +# Uncomment to enable Tcl support | |
| 1026 | +# FOSSIL_ENABLE_TCL = 1 | |
| 1020 | 1027 | |
| 1021 | 1028 | !ifdef FOSSIL_ENABLE_SSL |
| 1022 | 1029 | SSLINCDIR = $(B)\compat\openssl-1.0.1f\include |
| 1023 | 1030 | SSLLIBDIR = $(B)\compat\openssl-1.0.1f\out32 |
| 1024 | 1031 | SSLLIB = ssleay32.lib libeay32.lib user32.lib gdi32.lib |
| 1025 | 1032 | !endif |
| 1033 | + | |
| 1034 | +!ifdef FOSSIL_ENABLE_TCL | |
| 1035 | +TCLDIR = $(B)\compat\tcl-8.6 | |
| 1036 | +TCLSRCDIR = $(TCLDIR) | |
| 1037 | +TCLINCDIR = $(TCLSRCDIR)\generic | |
| 1038 | +!endif | |
| 1026 | 1039 | |
| 1027 | 1040 | # zlib options |
| 1028 | 1041 | ZINCDIR = $(B)\compat\zlib |
| 1029 | 1042 | ZLIBDIR = $(B)\compat\zlib |
| 1030 | 1043 | ZLIB = zlib.lib |
| 1031 | 1044 | |
| 1032 | -INCL = -I. -I$(SRCDIR) -I$B\win\include -I$(ZINCDIR) | |
| 1045 | +INCL = /I. /I$(SRCDIR) /I$B\win\include /I$(ZINCDIR) | |
| 1033 | 1046 | |
| 1034 | 1047 | !ifdef FOSSIL_ENABLE_SSL |
| 1035 | -INCL = $(INCL) -I$(SSLINCDIR) | |
| 1048 | +INCL = $(INCL) /I$(SSLINCDIR) | |
| 1049 | +!endif | |
| 1050 | + | |
| 1051 | +!ifdef FOSSIL_ENABLE_TCL | |
| 1052 | +INCL = $(INCL) /I$(TCLINCDIR) | |
| 1036 | 1053 | !endif |
| 1037 | 1054 | |
| 1038 | -CFLAGS = -nologo | |
| 1055 | +CFLAGS = /nologo | |
| 1039 | 1056 | LDFLAGS = /NODEFAULTLIB:msvcrt /MANIFEST:NO |
| 1040 | 1057 | |
| 1041 | 1058 | !ifdef DEBUG |
| 1042 | -CFLAGS = $(CFLAGS) -Zi -MTd -Od | |
| 1059 | +CFLAGS = $(CFLAGS) /Zi /MTd /Od | |
| 1043 | 1060 | LDFLAGS = $(LDFLAGS) /DEBUG |
| 1044 | 1061 | !else |
| 1045 | -CFLAGS = $(CFLAGS) -MT -O2 | |
| 1062 | +CFLAGS = $(CFLAGS) /MT /O2 | |
| 1046 | 1063 | !endif |
| 1047 | 1064 | |
| 1048 | 1065 | BCC = $(CC) $(CFLAGS) |
| 1049 | -TCC = $(CC) -c $(CFLAGS) $(MSCDEF) $(INCL) | |
| 1050 | -RCC = rc -D_WIN32 -D_MSC_VER $(MSCDEF) $(INCL) | |
| 1066 | +TCC = $(CC) /c $(CFLAGS) $(MSCDEF) $(INCL) | |
| 1067 | +RCC = rc /D_WIN32 /D_MSC_VER $(MSCDEF) $(INCL) | |
| 1051 | 1068 | LIBS = $(ZLIB) ws2_32.lib advapi32.lib |
| 1052 | -LIBDIR = -LIBPATH:$(ZLIBDIR) | |
| 1069 | +LIBDIR = /LIBPATH:$(ZLIBDIR) | |
| 1053 | 1070 | |
| 1054 | 1071 | !ifdef FOSSIL_ENABLE_JSON |
| 1055 | -TCC = $(TCC) -DFOSSIL_ENABLE_JSON=1 | |
| 1056 | -RCC = $(RCC) -DFOSSIL_ENABLE_JSON=1 | |
| 1072 | +TCC = $(TCC) /DFOSSIL_ENABLE_JSON=1 | |
| 1073 | +RCC = $(RCC) /DFOSSIL_ENABLE_JSON=1 | |
| 1057 | 1074 | !endif |
| 1058 | 1075 | |
| 1059 | 1076 | !ifdef FOSSIL_ENABLE_SSL |
| 1060 | -TCC = $(TCC) -DFOSSIL_ENABLE_SSL=1 | |
| 1061 | -RCC = $(RCC) -DFOSSIL_ENABLE_SSL=1 | |
| 1077 | +TCC = $(TCC) /DFOSSIL_ENABLE_SSL=1 | |
| 1078 | +RCC = $(RCC) /DFOSSIL_ENABLE_SSL=1 | |
| 1062 | 1079 | LIBS = $(LIBS) $(SSLLIB) |
| 1063 | -LIBDIR = $(LIBDIR) -LIBPATH:$(SSLLIBDIR) | |
| 1080 | +LIBDIR = $(LIBDIR) /LIBPATH:$(SSLLIBDIR) | |
| 1081 | +!endif | |
| 1082 | + | |
| 1083 | +!ifdef FOSSIL_ENABLE_TCL | |
| 1084 | +TCC = $(TCC) /DFOSSIL_ENABLE_TCL=1 | |
| 1085 | +RCC = $(RCC) /DFOSSIL_ENABLE_TCL=1 | |
| 1086 | +TCC = $(TCC) /DFOSSIL_ENABLE_TCL_STUBS=1 | |
| 1087 | +RCC = $(RCC) /DFOSSIL_ENABLE_TCL_STUBS=1 | |
| 1088 | +TCC = $(TCC) /DFOSSIL_ENABLE_TCL_PRIVATE_STUBS=1 | |
| 1089 | +RCC = $(RCC) /DFOSSIL_ENABLE_TCL_PRIVATE_STUBS=1 | |
| 1090 | +TCC = $(TCC) /DUSE_TCL_STUBS=1 | |
| 1091 | +RCC = $(RCC) /DUSE_TCL_STUBS=1 | |
| 1064 | 1092 | !endif |
| 1065 | 1093 | } |
| 1066 | 1094 | regsub -all {[-]D} [join $SQLITE_OPTIONS { }] {/D} MSC_SQLITE_OPTIONS |
| 1067 | 1095 | set j " \\\n " |
| 1068 | 1096 | writeln "SQLITE_OPTIONS = [join $MSC_SQLITE_OPTIONS $j]\n" |
| @@ -1090,11 +1118,14 @@ | ||
| 1090 | 1118 | writeln -nonewline " " |
| 1091 | 1119 | } |
| 1092 | 1120 | writeln -nonewline "\$(OX)\\$s\$O"; incr i |
| 1093 | 1121 | } |
| 1094 | 1122 | writeln " \\" |
| 1095 | -writeln -nonewline " \$(OX)\\fossil.res\n" | |
| 1123 | +writeln -nonewline " \$(OX)\\fossil.res\n\n" | |
| 1124 | +writeln "!ifdef FOSSIL_ENABLE_TCL" | |
| 1125 | +writeln "OBJ = \$(OBJ) \$(OX)\\th_tcl\$O" | |
| 1126 | +writeln "!endif" | |
| 1096 | 1127 | writeln { |
| 1097 | 1128 | APPNAME = $(OX)\fossil$(E) |
| 1098 | 1129 | PDBNAME = $(OX)\fossil$(P) |
| 1099 | 1130 | |
| 1100 | 1131 | all: $(OX) $(APPNAME) |
| @@ -1103,22 +1134,24 @@ | ||
| 1103 | 1134 | @echo Building zlib from "$(ZLIBDIR)"... |
| 1104 | 1135 | @pushd "$(ZLIBDIR)" && nmake /f win32\Makefile.msc $(ZLIB) && popd |
| 1105 | 1136 | |
| 1106 | 1137 | $(APPNAME) : translate$E mkindex$E headers $(OBJ) $(OX)\linkopts zlib |
| 1107 | 1138 | cd $(OX) |
| 1108 | - link $(LDFLAGS) -OUT:$@ $(LIBDIR) Wsetargv.obj fossil.res @linkopts | |
| 1139 | + link $(LDFLAGS) /OUT:$@ $(LIBDIR) Wsetargv.obj fossil.res @linkopts | |
| 1109 | 1140 | |
| 1110 | 1141 | $(OX)\linkopts: $B\win\Makefile.msc} |
| 1111 | 1142 | set redir {>} |
| 1112 | 1143 | foreach s [lsort [concat $src $AdditionalObj]] { |
| 1113 | 1144 | writeln "\techo \$(OX)\\$s.obj $redir \$@" |
| 1114 | 1145 | set redir {>>} |
| 1115 | 1146 | } |
| 1116 | -writeln "\techo \$(LIBS) >> \$@\n\n" | |
| 1117 | - | |
| 1147 | +writeln "!ifdef FOSSIL_ENABLE_TCL" | |
| 1148 | +writeln "\techo \$(OX)\\th_tcl.obj $redir \$@" | |
| 1149 | +set redir {>>} | |
| 1150 | +writeln "!endif" | |
| 1151 | +writeln "\techo \$(LIBS) $redir \$@" | |
| 1118 | 1152 | writeln { |
| 1119 | - | |
| 1120 | 1153 | $(OX): |
| 1121 | 1154 | @-mkdir $@ |
| 1122 | 1155 | |
| 1123 | 1156 | translate$E: $(SRCDIR)\translate.c |
| 1124 | 1157 | $(BCC) $** |
| @@ -1141,15 +1174,20 @@ | ||
| 1141 | 1174 | $(OX)\th$O : $(SRCDIR)\th.c |
| 1142 | 1175 | $(TCC) /Fo$@ -c $** |
| 1143 | 1176 | |
| 1144 | 1177 | $(OX)\th_lang$O : $(SRCDIR)\th_lang.c |
| 1145 | 1178 | $(TCC) /Fo$@ -c $** |
| 1179 | + | |
| 1180 | +!ifdef FOSSIL_ENABLE_TCL | |
| 1181 | +$(OX)\th_tcl$O : $(SRCDIR)\th_tcl.c | |
| 1182 | + $(TCC) /Fo$@ -c $** | |
| 1183 | +!endif | |
| 1146 | 1184 | |
| 1147 | 1185 | VERSION.h : mkversion$E $B\manifest.uuid $B\manifest $B\VERSION |
| 1148 | 1186 | $** > $@ |
| 1149 | 1187 | $(OX)\cson_amalgamation$O : $(SRCDIR)\cson_amalgamation.c |
| 1150 | - $(TCC) /Fo$@ -c $** | |
| 1188 | + $(TCC) /Fo$@ /c $** | |
| 1151 | 1189 | |
| 1152 | 1190 | page_index.h: mkindex$E $(SRC) |
| 1153 | 1191 | $** > $@ |
| 1154 | 1192 | |
| 1155 | 1193 | clean: |
| @@ -1184,21 +1222,20 @@ | ||
| 1184 | 1222 | $(OBJDIR)\json_status$O : $(SRCDIR)\json_detail.h |
| 1185 | 1223 | $(OBJDIR)\json_tag$O : $(SRCDIR)\json_detail.h |
| 1186 | 1224 | $(OBJDIR)\json_timeline$O : $(SRCDIR)\json_detail.h |
| 1187 | 1225 | $(OBJDIR)\json_user$O : $(SRCDIR)\json_detail.h |
| 1188 | 1226 | $(OBJDIR)\json_wiki$O : $(SRCDIR)\json_detail.h |
| 1189 | - | |
| 1190 | 1227 | } |
| 1191 | 1228 | foreach s [lsort $src] { |
| 1192 | 1229 | writeln "\$(OX)\\$s\$O : ${s}_.c ${s}.h" |
| 1193 | 1230 | writeln "\t\$(TCC) /Fo\$@ -c ${s}_.c\n" |
| 1194 | 1231 | writeln "${s}_.c : \$(SRCDIR)\\$s.c" |
| 1195 | 1232 | writeln "\ttranslate\$E \$** > \$@\n" |
| 1196 | 1233 | } |
| 1197 | 1234 | |
| 1198 | 1235 | writeln "fossil.res : \$B\\win\\fossil.rc" |
| 1199 | -writeln "\t\$(RCC) -fo \$@ \$**" | |
| 1236 | +writeln "\t\$(RCC) /fo \$@ \$**\n" | |
| 1200 | 1237 | |
| 1201 | 1238 | writeln "headers: makeheaders\$E page_index.h VERSION.h" |
| 1202 | 1239 | writeln -nonewline "\tmakeheaders\$E " |
| 1203 | 1240 | set i 0 |
| 1204 | 1241 | foreach s [lsort $src] { |
| 1205 | 1242 |
| --- src/makemake.tcl | |
| +++ src/makemake.tcl | |
| @@ -69,10 +69,11 @@ | |
| 69 | json_tag |
| 70 | json_timeline |
| 71 | json_user |
| 72 | json_wiki |
| 73 | leaf |
| 74 | login |
| 75 | lookslike |
| 76 | main |
| 77 | manifest |
| 78 | markdown |
| @@ -146,15 +147,18 @@ | |
| 146 | # Options used to compile the included SQLite shell. |
| 147 | # |
| 148 | set SHELL_OPTIONS { |
| 149 | -Dmain=sqlite3_shell |
| 150 | -DSQLITE_OMIT_LOAD_EXTENSION=1 |
| 151 | } |
| 152 | |
| 153 | # Options used to compile the included SQLite shell on Windows. |
| 154 | # |
| 155 | set SHELL_WIN32_OPTIONS $SHELL_OPTIONS |
| 156 | lappend SHELL_WIN32_OPTIONS -Dgetenv=fossil_getenv |
| 157 | lappend SHELL_WIN32_OPTIONS -Dfopen=fossil_fopen |
| 158 | |
| 159 | # Name of the final application |
| 160 | # |
| @@ -795,11 +799,11 @@ | |
| 795 | writeln "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c \$(OBJDIR)/${s}_.c\n" |
| 796 | writeln "\$(OBJDIR)/${s}.h:\t\$(OBJDIR)/headers\n" |
| 797 | } |
| 798 | |
| 799 | set MINGW_SQLITE_OPTIONS $SQLITE_OPTIONS |
| 800 | lappend MINGW_SQLITE_OPTIONS -D_HAVE_SQLITE_CONFIG_H |
| 801 | lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MALLOC_H |
| 802 | lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MSIZE |
| 803 | |
| 804 | set j " \\\n " |
| 805 | writeln "SQLITE_OPTIONS = [join $MINGW_SQLITE_OPTIONS $j]\n" |
| @@ -1015,54 +1019,78 @@ | |
| 1015 | # Uncomment to enable JSON API |
| 1016 | # FOSSIL_ENABLE_JSON = 1 |
| 1017 | |
| 1018 | # Uncomment to enable SSL support |
| 1019 | # FOSSIL_ENABLE_SSL = 1 |
| 1020 | |
| 1021 | !ifdef FOSSIL_ENABLE_SSL |
| 1022 | SSLINCDIR = $(B)\compat\openssl-1.0.1f\include |
| 1023 | SSLLIBDIR = $(B)\compat\openssl-1.0.1f\out32 |
| 1024 | SSLLIB = ssleay32.lib libeay32.lib user32.lib gdi32.lib |
| 1025 | !endif |
| 1026 | |
| 1027 | # zlib options |
| 1028 | ZINCDIR = $(B)\compat\zlib |
| 1029 | ZLIBDIR = $(B)\compat\zlib |
| 1030 | ZLIB = zlib.lib |
| 1031 | |
| 1032 | INCL = -I. -I$(SRCDIR) -I$B\win\include -I$(ZINCDIR) |
| 1033 | |
| 1034 | !ifdef FOSSIL_ENABLE_SSL |
| 1035 | INCL = $(INCL) -I$(SSLINCDIR) |
| 1036 | !endif |
| 1037 | |
| 1038 | CFLAGS = -nologo |
| 1039 | LDFLAGS = /NODEFAULTLIB:msvcrt /MANIFEST:NO |
| 1040 | |
| 1041 | !ifdef DEBUG |
| 1042 | CFLAGS = $(CFLAGS) -Zi -MTd -Od |
| 1043 | LDFLAGS = $(LDFLAGS) /DEBUG |
| 1044 | !else |
| 1045 | CFLAGS = $(CFLAGS) -MT -O2 |
| 1046 | !endif |
| 1047 | |
| 1048 | BCC = $(CC) $(CFLAGS) |
| 1049 | TCC = $(CC) -c $(CFLAGS) $(MSCDEF) $(INCL) |
| 1050 | RCC = rc -D_WIN32 -D_MSC_VER $(MSCDEF) $(INCL) |
| 1051 | LIBS = $(ZLIB) ws2_32.lib advapi32.lib |
| 1052 | LIBDIR = -LIBPATH:$(ZLIBDIR) |
| 1053 | |
| 1054 | !ifdef FOSSIL_ENABLE_JSON |
| 1055 | TCC = $(TCC) -DFOSSIL_ENABLE_JSON=1 |
| 1056 | RCC = $(RCC) -DFOSSIL_ENABLE_JSON=1 |
| 1057 | !endif |
| 1058 | |
| 1059 | !ifdef FOSSIL_ENABLE_SSL |
| 1060 | TCC = $(TCC) -DFOSSIL_ENABLE_SSL=1 |
| 1061 | RCC = $(RCC) -DFOSSIL_ENABLE_SSL=1 |
| 1062 | LIBS = $(LIBS) $(SSLLIB) |
| 1063 | LIBDIR = $(LIBDIR) -LIBPATH:$(SSLLIBDIR) |
| 1064 | !endif |
| 1065 | } |
| 1066 | regsub -all {[-]D} [join $SQLITE_OPTIONS { }] {/D} MSC_SQLITE_OPTIONS |
| 1067 | set j " \\\n " |
| 1068 | writeln "SQLITE_OPTIONS = [join $MSC_SQLITE_OPTIONS $j]\n" |
| @@ -1090,11 +1118,14 @@ | |
| 1090 | writeln -nonewline " " |
| 1091 | } |
| 1092 | writeln -nonewline "\$(OX)\\$s\$O"; incr i |
| 1093 | } |
| 1094 | writeln " \\" |
| 1095 | writeln -nonewline " \$(OX)\\fossil.res\n" |
| 1096 | writeln { |
| 1097 | APPNAME = $(OX)\fossil$(E) |
| 1098 | PDBNAME = $(OX)\fossil$(P) |
| 1099 | |
| 1100 | all: $(OX) $(APPNAME) |
| @@ -1103,22 +1134,24 @@ | |
| 1103 | @echo Building zlib from "$(ZLIBDIR)"... |
| 1104 | @pushd "$(ZLIBDIR)" && nmake /f win32\Makefile.msc $(ZLIB) && popd |
| 1105 | |
| 1106 | $(APPNAME) : translate$E mkindex$E headers $(OBJ) $(OX)\linkopts zlib |
| 1107 | cd $(OX) |
| 1108 | link $(LDFLAGS) -OUT:$@ $(LIBDIR) Wsetargv.obj fossil.res @linkopts |
| 1109 | |
| 1110 | $(OX)\linkopts: $B\win\Makefile.msc} |
| 1111 | set redir {>} |
| 1112 | foreach s [lsort [concat $src $AdditionalObj]] { |
| 1113 | writeln "\techo \$(OX)\\$s.obj $redir \$@" |
| 1114 | set redir {>>} |
| 1115 | } |
| 1116 | writeln "\techo \$(LIBS) >> \$@\n\n" |
| 1117 | |
| 1118 | writeln { |
| 1119 | |
| 1120 | $(OX): |
| 1121 | @-mkdir $@ |
| 1122 | |
| 1123 | translate$E: $(SRCDIR)\translate.c |
| 1124 | $(BCC) $** |
| @@ -1141,15 +1174,20 @@ | |
| 1141 | $(OX)\th$O : $(SRCDIR)\th.c |
| 1142 | $(TCC) /Fo$@ -c $** |
| 1143 | |
| 1144 | $(OX)\th_lang$O : $(SRCDIR)\th_lang.c |
| 1145 | $(TCC) /Fo$@ -c $** |
| 1146 | |
| 1147 | VERSION.h : mkversion$E $B\manifest.uuid $B\manifest $B\VERSION |
| 1148 | $** > $@ |
| 1149 | $(OX)\cson_amalgamation$O : $(SRCDIR)\cson_amalgamation.c |
| 1150 | $(TCC) /Fo$@ -c $** |
| 1151 | |
| 1152 | page_index.h: mkindex$E $(SRC) |
| 1153 | $** > $@ |
| 1154 | |
| 1155 | clean: |
| @@ -1184,21 +1222,20 @@ | |
| 1184 | $(OBJDIR)\json_status$O : $(SRCDIR)\json_detail.h |
| 1185 | $(OBJDIR)\json_tag$O : $(SRCDIR)\json_detail.h |
| 1186 | $(OBJDIR)\json_timeline$O : $(SRCDIR)\json_detail.h |
| 1187 | $(OBJDIR)\json_user$O : $(SRCDIR)\json_detail.h |
| 1188 | $(OBJDIR)\json_wiki$O : $(SRCDIR)\json_detail.h |
| 1189 | |
| 1190 | } |
| 1191 | foreach s [lsort $src] { |
| 1192 | writeln "\$(OX)\\$s\$O : ${s}_.c ${s}.h" |
| 1193 | writeln "\t\$(TCC) /Fo\$@ -c ${s}_.c\n" |
| 1194 | writeln "${s}_.c : \$(SRCDIR)\\$s.c" |
| 1195 | writeln "\ttranslate\$E \$** > \$@\n" |
| 1196 | } |
| 1197 | |
| 1198 | writeln "fossil.res : \$B\\win\\fossil.rc" |
| 1199 | writeln "\t\$(RCC) -fo \$@ \$**" |
| 1200 | |
| 1201 | writeln "headers: makeheaders\$E page_index.h VERSION.h" |
| 1202 | writeln -nonewline "\tmakeheaders\$E " |
| 1203 | set i 0 |
| 1204 | foreach s [lsort $src] { |
| 1205 |
| --- src/makemake.tcl | |
| +++ src/makemake.tcl | |
| @@ -69,10 +69,11 @@ | |
| 69 | json_tag |
| 70 | json_timeline |
| 71 | json_user |
| 72 | json_wiki |
| 73 | leaf |
| 74 | loadctrl |
| 75 | login |
| 76 | lookslike |
| 77 | main |
| 78 | manifest |
| 79 | markdown |
| @@ -146,15 +147,18 @@ | |
| 147 | # Options used to compile the included SQLite shell. |
| 148 | # |
| 149 | set SHELL_OPTIONS { |
| 150 | -Dmain=sqlite3_shell |
| 151 | -DSQLITE_OMIT_LOAD_EXTENSION=1 |
| 152 | -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) |
| 153 | -DSQLITE_SHELL_DBNAME_PROC=fossil_open |
| 154 | } |
| 155 | |
| 156 | # Options used to compile the included SQLite shell on Windows. |
| 157 | # |
| 158 | set SHELL_WIN32_OPTIONS $SHELL_OPTIONS |
| 159 | lappend SHELL_WIN32_OPTIONS -Daccess=win32_access |
| 160 | lappend SHELL_WIN32_OPTIONS -Dgetenv=fossil_getenv |
| 161 | lappend SHELL_WIN32_OPTIONS -Dfopen=fossil_fopen |
| 162 | |
| 163 | # Name of the final application |
| 164 | # |
| @@ -795,11 +799,11 @@ | |
| 799 | writeln "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c \$(OBJDIR)/${s}_.c\n" |
| 800 | writeln "\$(OBJDIR)/${s}.h:\t\$(OBJDIR)/headers\n" |
| 801 | } |
| 802 | |
| 803 | set MINGW_SQLITE_OPTIONS $SQLITE_OPTIONS |
| 804 | lappend MINGW_SQLITE_OPTIONS -D_HAVE__MINGW_H |
| 805 | lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MALLOC_H |
| 806 | lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MSIZE |
| 807 | |
| 808 | set j " \\\n " |
| 809 | writeln "SQLITE_OPTIONS = [join $MINGW_SQLITE_OPTIONS $j]\n" |
| @@ -1015,54 +1019,78 @@ | |
| 1019 | # Uncomment to enable JSON API |
| 1020 | # FOSSIL_ENABLE_JSON = 1 |
| 1021 | |
| 1022 | # Uncomment to enable SSL support |
| 1023 | # FOSSIL_ENABLE_SSL = 1 |
| 1024 | |
| 1025 | # Uncomment to enable Tcl support |
| 1026 | # FOSSIL_ENABLE_TCL = 1 |
| 1027 | |
| 1028 | !ifdef FOSSIL_ENABLE_SSL |
| 1029 | SSLINCDIR = $(B)\compat\openssl-1.0.1f\include |
| 1030 | SSLLIBDIR = $(B)\compat\openssl-1.0.1f\out32 |
| 1031 | SSLLIB = ssleay32.lib libeay32.lib user32.lib gdi32.lib |
| 1032 | !endif |
| 1033 | |
| 1034 | !ifdef FOSSIL_ENABLE_TCL |
| 1035 | TCLDIR = $(B)\compat\tcl-8.6 |
| 1036 | TCLSRCDIR = $(TCLDIR) |
| 1037 | TCLINCDIR = $(TCLSRCDIR)\generic |
| 1038 | !endif |
| 1039 | |
| 1040 | # zlib options |
| 1041 | ZINCDIR = $(B)\compat\zlib |
| 1042 | ZLIBDIR = $(B)\compat\zlib |
| 1043 | ZLIB = zlib.lib |
| 1044 | |
| 1045 | INCL = /I. /I$(SRCDIR) /I$B\win\include /I$(ZINCDIR) |
| 1046 | |
| 1047 | !ifdef FOSSIL_ENABLE_SSL |
| 1048 | INCL = $(INCL) /I$(SSLINCDIR) |
| 1049 | !endif |
| 1050 | |
| 1051 | !ifdef FOSSIL_ENABLE_TCL |
| 1052 | INCL = $(INCL) /I$(TCLINCDIR) |
| 1053 | !endif |
| 1054 | |
| 1055 | CFLAGS = /nologo |
| 1056 | LDFLAGS = /NODEFAULTLIB:msvcrt /MANIFEST:NO |
| 1057 | |
| 1058 | !ifdef DEBUG |
| 1059 | CFLAGS = $(CFLAGS) /Zi /MTd /Od |
| 1060 | LDFLAGS = $(LDFLAGS) /DEBUG |
| 1061 | !else |
| 1062 | CFLAGS = $(CFLAGS) /MT /O2 |
| 1063 | !endif |
| 1064 | |
| 1065 | BCC = $(CC) $(CFLAGS) |
| 1066 | TCC = $(CC) /c $(CFLAGS) $(MSCDEF) $(INCL) |
| 1067 | RCC = rc /D_WIN32 /D_MSC_VER $(MSCDEF) $(INCL) |
| 1068 | LIBS = $(ZLIB) ws2_32.lib advapi32.lib |
| 1069 | LIBDIR = /LIBPATH:$(ZLIBDIR) |
| 1070 | |
| 1071 | !ifdef FOSSIL_ENABLE_JSON |
| 1072 | TCC = $(TCC) /DFOSSIL_ENABLE_JSON=1 |
| 1073 | RCC = $(RCC) /DFOSSIL_ENABLE_JSON=1 |
| 1074 | !endif |
| 1075 | |
| 1076 | !ifdef FOSSIL_ENABLE_SSL |
| 1077 | TCC = $(TCC) /DFOSSIL_ENABLE_SSL=1 |
| 1078 | RCC = $(RCC) /DFOSSIL_ENABLE_SSL=1 |
| 1079 | LIBS = $(LIBS) $(SSLLIB) |
| 1080 | LIBDIR = $(LIBDIR) /LIBPATH:$(SSLLIBDIR) |
| 1081 | !endif |
| 1082 | |
| 1083 | !ifdef FOSSIL_ENABLE_TCL |
| 1084 | TCC = $(TCC) /DFOSSIL_ENABLE_TCL=1 |
| 1085 | RCC = $(RCC) /DFOSSIL_ENABLE_TCL=1 |
| 1086 | TCC = $(TCC) /DFOSSIL_ENABLE_TCL_STUBS=1 |
| 1087 | RCC = $(RCC) /DFOSSIL_ENABLE_TCL_STUBS=1 |
| 1088 | TCC = $(TCC) /DFOSSIL_ENABLE_TCL_PRIVATE_STUBS=1 |
| 1089 | RCC = $(RCC) /DFOSSIL_ENABLE_TCL_PRIVATE_STUBS=1 |
| 1090 | TCC = $(TCC) /DUSE_TCL_STUBS=1 |
| 1091 | RCC = $(RCC) /DUSE_TCL_STUBS=1 |
| 1092 | !endif |
| 1093 | } |
| 1094 | regsub -all {[-]D} [join $SQLITE_OPTIONS { }] {/D} MSC_SQLITE_OPTIONS |
| 1095 | set j " \\\n " |
| 1096 | writeln "SQLITE_OPTIONS = [join $MSC_SQLITE_OPTIONS $j]\n" |
| @@ -1090,11 +1118,14 @@ | |
| 1118 | writeln -nonewline " " |
| 1119 | } |
| 1120 | writeln -nonewline "\$(OX)\\$s\$O"; incr i |
| 1121 | } |
| 1122 | writeln " \\" |
| 1123 | writeln -nonewline " \$(OX)\\fossil.res\n\n" |
| 1124 | writeln "!ifdef FOSSIL_ENABLE_TCL" |
| 1125 | writeln "OBJ = \$(OBJ) \$(OX)\\th_tcl\$O" |
| 1126 | writeln "!endif" |
| 1127 | writeln { |
| 1128 | APPNAME = $(OX)\fossil$(E) |
| 1129 | PDBNAME = $(OX)\fossil$(P) |
| 1130 | |
| 1131 | all: $(OX) $(APPNAME) |
| @@ -1103,22 +1134,24 @@ | |
| 1134 | @echo Building zlib from "$(ZLIBDIR)"... |
| 1135 | @pushd "$(ZLIBDIR)" && nmake /f win32\Makefile.msc $(ZLIB) && popd |
| 1136 | |
| 1137 | $(APPNAME) : translate$E mkindex$E headers $(OBJ) $(OX)\linkopts zlib |
| 1138 | cd $(OX) |
| 1139 | link $(LDFLAGS) /OUT:$@ $(LIBDIR) Wsetargv.obj fossil.res @linkopts |
| 1140 | |
| 1141 | $(OX)\linkopts: $B\win\Makefile.msc} |
| 1142 | set redir {>} |
| 1143 | foreach s [lsort [concat $src $AdditionalObj]] { |
| 1144 | writeln "\techo \$(OX)\\$s.obj $redir \$@" |
| 1145 | set redir {>>} |
| 1146 | } |
| 1147 | writeln "!ifdef FOSSIL_ENABLE_TCL" |
| 1148 | writeln "\techo \$(OX)\\th_tcl.obj $redir \$@" |
| 1149 | set redir {>>} |
| 1150 | writeln "!endif" |
| 1151 | writeln "\techo \$(LIBS) $redir \$@" |
| 1152 | writeln { |
| 1153 | $(OX): |
| 1154 | @-mkdir $@ |
| 1155 | |
| 1156 | translate$E: $(SRCDIR)\translate.c |
| 1157 | $(BCC) $** |
| @@ -1141,15 +1174,20 @@ | |
| 1174 | $(OX)\th$O : $(SRCDIR)\th.c |
| 1175 | $(TCC) /Fo$@ -c $** |
| 1176 | |
| 1177 | $(OX)\th_lang$O : $(SRCDIR)\th_lang.c |
| 1178 | $(TCC) /Fo$@ -c $** |
| 1179 | |
| 1180 | !ifdef FOSSIL_ENABLE_TCL |
| 1181 | $(OX)\th_tcl$O : $(SRCDIR)\th_tcl.c |
| 1182 | $(TCC) /Fo$@ -c $** |
| 1183 | !endif |
| 1184 | |
| 1185 | VERSION.h : mkversion$E $B\manifest.uuid $B\manifest $B\VERSION |
| 1186 | $** > $@ |
| 1187 | $(OX)\cson_amalgamation$O : $(SRCDIR)\cson_amalgamation.c |
| 1188 | $(TCC) /Fo$@ /c $** |
| 1189 | |
| 1190 | page_index.h: mkindex$E $(SRC) |
| 1191 | $** > $@ |
| 1192 | |
| 1193 | clean: |
| @@ -1184,21 +1222,20 @@ | |
| 1222 | $(OBJDIR)\json_status$O : $(SRCDIR)\json_detail.h |
| 1223 | $(OBJDIR)\json_tag$O : $(SRCDIR)\json_detail.h |
| 1224 | $(OBJDIR)\json_timeline$O : $(SRCDIR)\json_detail.h |
| 1225 | $(OBJDIR)\json_user$O : $(SRCDIR)\json_detail.h |
| 1226 | $(OBJDIR)\json_wiki$O : $(SRCDIR)\json_detail.h |
| 1227 | } |
| 1228 | foreach s [lsort $src] { |
| 1229 | writeln "\$(OX)\\$s\$O : ${s}_.c ${s}.h" |
| 1230 | writeln "\t\$(TCC) /Fo\$@ -c ${s}_.c\n" |
| 1231 | writeln "${s}_.c : \$(SRCDIR)\\$s.c" |
| 1232 | writeln "\ttranslate\$E \$** > \$@\n" |
| 1233 | } |
| 1234 | |
| 1235 | writeln "fossil.res : \$B\\win\\fossil.rc" |
| 1236 | writeln "\t\$(RCC) /fo \$@ \$**\n" |
| 1237 | |
| 1238 | writeln "headers: makeheaders\$E page_index.h VERSION.h" |
| 1239 | writeln -nonewline "\tmakeheaders\$E " |
| 1240 | set i 0 |
| 1241 | foreach s [lsort $src] { |
| 1242 |
+14
| --- src/mkversion.c | ||
| +++ src/mkversion.c | ||
| @@ -69,7 +69,21 @@ | ||
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | printf("#define RELEASE_RESOURCE_VERSION %s", vx); |
| 72 | 72 | while( d<3 ){ printf(",0"); d++; } |
| 73 | 73 | printf("\n"); |
| 74 | +#if defined(__DMC__) /* e.g. 0x857 */ | |
| 75 | + d = (__DMC__ & 0xF00) >> 8; /* major */ | |
| 76 | + x = (__DMC__ & 0x0F0) >> 4; /* minor */ | |
| 77 | + i = (__DMC__ & 0x00F); /* revision */ | |
| 78 | + printf("#define COMPILER_VERSION \"%d.%d.%d\"\n", d, x, i); | |
| 79 | +#elif defined(__POCC__) /* e.g. 700 */ | |
| 80 | + d = (__POCC__ / 100); /* major */ | |
| 81 | + x = (__POCC__ % 100); /* minor */ | |
| 82 | + printf("#define COMPILER_VERSION \"%d.%02d\"\n", d, x); | |
| 83 | +#elif defined(_MSC_VER) /* e.g. 1800 */ | |
| 84 | + d = (_MSC_VER / 100); /* major */ | |
| 85 | + x = (_MSC_VER % 100); /* minor */ | |
| 86 | + printf("#define COMPILER_VERSION \"%d.%02d\"\n", d, x); | |
| 87 | +#endif | |
| 74 | 88 | return 0; |
| 75 | 89 | } |
| 76 | 90 |
| --- src/mkversion.c | |
| +++ src/mkversion.c | |
| @@ -69,7 +69,21 @@ | |
| 69 | } |
| 70 | } |
| 71 | printf("#define RELEASE_RESOURCE_VERSION %s", vx); |
| 72 | while( d<3 ){ printf(",0"); d++; } |
| 73 | printf("\n"); |
| 74 | return 0; |
| 75 | } |
| 76 |
| --- src/mkversion.c | |
| +++ src/mkversion.c | |
| @@ -69,7 +69,21 @@ | |
| 69 | } |
| 70 | } |
| 71 | printf("#define RELEASE_RESOURCE_VERSION %s", vx); |
| 72 | while( d<3 ){ printf(",0"); d++; } |
| 73 | printf("\n"); |
| 74 | #if defined(__DMC__) /* e.g. 0x857 */ |
| 75 | d = (__DMC__ & 0xF00) >> 8; /* major */ |
| 76 | x = (__DMC__ & 0x0F0) >> 4; /* minor */ |
| 77 | i = (__DMC__ & 0x00F); /* revision */ |
| 78 | printf("#define COMPILER_VERSION \"%d.%d.%d\"\n", d, x, i); |
| 79 | #elif defined(__POCC__) /* e.g. 700 */ |
| 80 | d = (__POCC__ / 100); /* major */ |
| 81 | x = (__POCC__ % 100); /* minor */ |
| 82 | printf("#define COMPILER_VERSION \"%d.%02d\"\n", d, x); |
| 83 | #elif defined(_MSC_VER) /* e.g. 1800 */ |
| 84 | d = (_MSC_VER / 100); /* major */ |
| 85 | x = (_MSC_VER % 100); /* minor */ |
| 86 | printf("#define COMPILER_VERSION \"%d.%02d\"\n", d, x); |
| 87 | #endif |
| 88 | return 0; |
| 89 | } |
| 90 |
+7
-2
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -793,11 +793,10 @@ | ||
| 793 | 793 | db_close(1); |
| 794 | 794 | db_open_repository(g.zRepositoryName); |
| 795 | 795 | if( !bForce ){ |
| 796 | 796 | Blob ans; |
| 797 | 797 | char cReply; |
| 798 | - blob_zero(&ans); | |
| 799 | 798 | prompt_user( |
| 800 | 799 | "Scrubbing the repository will permanently delete information.\n" |
| 801 | 800 | "Changes cannot be undone. Continue (y/N)? ", &ans); |
| 802 | 801 | cReply = blob_str(&ans)[0]; |
| 803 | 802 | if( cReply!='y' && cReply!='Y' ){ |
| @@ -859,11 +858,17 @@ | ||
| 859 | 858 | continue; |
| 860 | 859 | } |
| 861 | 860 | zUtf8Name = fossil_filename_to_utf8(pEntry->d_name); |
| 862 | 861 | zSubpath = mprintf("%s/%s", zPath, zUtf8Name); |
| 863 | 862 | fossil_filename_free(zUtf8Name); |
| 864 | - if( file_isdir(zSubpath)==1 ){ | |
| 863 | +#ifdef _DIRENT_HAVE_D_TYPE | |
| 864 | + if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) | |
| 865 | + ? (file_isdir(zSubpath)==1) : (pEntry->d_type==DT_DIR) ) | |
| 866 | +#else | |
| 867 | + if( file_isdir(zSubpath)==1 ) | |
| 868 | +#endif | |
| 869 | + { | |
| 865 | 870 | recon_read_dir(zSubpath); |
| 866 | 871 | }else{ |
| 867 | 872 | blob_init(&path, 0, 0); |
| 868 | 873 | blob_appendf(&path, "%s", zSubpath); |
| 869 | 874 | if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){ |
| 870 | 875 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -793,11 +793,10 @@ | |
| 793 | db_close(1); |
| 794 | db_open_repository(g.zRepositoryName); |
| 795 | if( !bForce ){ |
| 796 | Blob ans; |
| 797 | char cReply; |
| 798 | blob_zero(&ans); |
| 799 | prompt_user( |
| 800 | "Scrubbing the repository will permanently delete information.\n" |
| 801 | "Changes cannot be undone. Continue (y/N)? ", &ans); |
| 802 | cReply = blob_str(&ans)[0]; |
| 803 | if( cReply!='y' && cReply!='Y' ){ |
| @@ -859,11 +858,17 @@ | |
| 859 | continue; |
| 860 | } |
| 861 | zUtf8Name = fossil_filename_to_utf8(pEntry->d_name); |
| 862 | zSubpath = mprintf("%s/%s", zPath, zUtf8Name); |
| 863 | fossil_filename_free(zUtf8Name); |
| 864 | if( file_isdir(zSubpath)==1 ){ |
| 865 | recon_read_dir(zSubpath); |
| 866 | }else{ |
| 867 | blob_init(&path, 0, 0); |
| 868 | blob_appendf(&path, "%s", zSubpath); |
| 869 | if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){ |
| 870 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -793,11 +793,10 @@ | |
| 793 | db_close(1); |
| 794 | db_open_repository(g.zRepositoryName); |
| 795 | if( !bForce ){ |
| 796 | Blob ans; |
| 797 | char cReply; |
| 798 | prompt_user( |
| 799 | "Scrubbing the repository will permanently delete information.\n" |
| 800 | "Changes cannot be undone. Continue (y/N)? ", &ans); |
| 801 | cReply = blob_str(&ans)[0]; |
| 802 | if( cReply!='y' && cReply!='Y' ){ |
| @@ -859,11 +858,17 @@ | |
| 858 | continue; |
| 859 | } |
| 860 | zUtf8Name = fossil_filename_to_utf8(pEntry->d_name); |
| 861 | zSubpath = mprintf("%s/%s", zPath, zUtf8Name); |
| 862 | fossil_filename_free(zUtf8Name); |
| 863 | #ifdef _DIRENT_HAVE_D_TYPE |
| 864 | if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) |
| 865 | ? (file_isdir(zSubpath)==1) : (pEntry->d_type==DT_DIR) ) |
| 866 | #else |
| 867 | if( file_isdir(zSubpath)==1 ) |
| 868 | #endif |
| 869 | { |
| 870 | recon_read_dir(zSubpath); |
| 871 | }else{ |
| 872 | blob_init(&path, 0, 0); |
| 873 | blob_appendf(&path, "%s", zSubpath); |
| 874 | if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){ |
| 875 |
+1
-1
| --- src/report.c | ||
| +++ src/report.c | ||
| @@ -925,11 +925,11 @@ | ||
| 925 | 925 | if( xCallback(pArg, nCol, azVals, azCols) ){ |
| 926 | 926 | break; |
| 927 | 927 | } |
| 928 | 928 | } |
| 929 | 929 | rc = sqlite3_finalize(pStmt); |
| 930 | - fossil_free(azVals); | |
| 930 | + fossil_free((void *)azVals); | |
| 931 | 931 | return rc; |
| 932 | 932 | } |
| 933 | 933 | |
| 934 | 934 | /* |
| 935 | 935 | ** Output Javascript code that will enables sorting of the table with |
| 936 | 936 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -925,11 +925,11 @@ | |
| 925 | if( xCallback(pArg, nCol, azVals, azCols) ){ |
| 926 | break; |
| 927 | } |
| 928 | } |
| 929 | rc = sqlite3_finalize(pStmt); |
| 930 | fossil_free(azVals); |
| 931 | return rc; |
| 932 | } |
| 933 | |
| 934 | /* |
| 935 | ** Output Javascript code that will enables sorting of the table with |
| 936 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -925,11 +925,11 @@ | |
| 925 | if( xCallback(pArg, nCol, azVals, azCols) ){ |
| 926 | break; |
| 927 | } |
| 928 | } |
| 929 | rc = sqlite3_finalize(pStmt); |
| 930 | fossil_free((void *)azVals); |
| 931 | return rc; |
| 932 | } |
| 933 | |
| 934 | /* |
| 935 | ** Output Javascript code that will enables sorting of the table with |
| 936 |
+9
-9
| --- src/schema.c | ||
| +++ src/schema.c | ||
| @@ -21,11 +21,11 @@ | ||
| 21 | 21 | #include "schema.h" |
| 22 | 22 | |
| 23 | 23 | /* |
| 24 | 24 | ** The database schema for the ~/.fossil configuration database. |
| 25 | 25 | */ |
| 26 | -const char zConfigSchema[] = | |
| 26 | +const char zConfigSchema[] = | |
| 27 | 27 | @ -- This file contains the schema for the database that is kept in the |
| 28 | 28 | @ -- ~/.fossil file and that stores information about the users setup. |
| 29 | 29 | @ -- |
| 30 | 30 | @ CREATE TABLE global_config( |
| 31 | 31 | @ name TEXT PRIMARY KEY, |
| @@ -50,19 +50,19 @@ | ||
| 50 | 50 | |
| 51 | 51 | #endif /* INTERFACE */ |
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | /* |
| 55 | -** The schema for a repository database. | |
| 55 | +** The schema for a repository database. | |
| 56 | 56 | ** |
| 57 | 57 | ** Schema1[] contains parts of the schema that are fixed and unchanging |
| 58 | 58 | ** across versions. Schema2[] contains parts of the schema that can |
| 59 | 59 | ** change from one version to the next. The information in Schema2[] |
| 60 | 60 | ** is reconstructed from the information in Schema1[] by the "rebuild" |
| 61 | 61 | ** operation. |
| 62 | 62 | */ |
| 63 | -const char zRepositorySchema1[] = | |
| 63 | +const char zRepositorySchema1[] = | |
| 64 | 64 | @ -- The BLOB and DELTA tables contain all records held in the repository. |
| 65 | 65 | @ -- |
| 66 | 66 | @ -- The BLOB.CONTENT column is always compressed using zlib. This |
| 67 | 67 | @ -- column might hold the full text of the record or it might hold |
| 68 | 68 | @ -- a delta that is able to reconstruct the record from some other |
| @@ -69,11 +69,11 @@ | ||
| 69 | 69 | @ -- record. If BLOB.CONTENT holds a delta, then a DELTA table entry |
| 70 | 70 | @ -- will exist for the record and that entry will point to another |
| 71 | 71 | @ -- entry that holds the source of the delta. Deltas can be chained. |
| 72 | 72 | @ -- |
| 73 | 73 | @ -- The blob and delta tables collectively hold the "global state" of |
| 74 | -@ -- a Fossil repository. | |
| 74 | +@ -- a Fossil repository. | |
| 75 | 75 | @ -- |
| 76 | 76 | @ CREATE TABLE blob( |
| 77 | 77 | @ rid INTEGER PRIMARY KEY, -- Record ID |
| 78 | 78 | @ rcvid INTEGER, -- Origin of this record |
| 79 | 79 | @ size INTEGER, -- Size of content. -1 for a phantom. |
| @@ -89,11 +89,11 @@ | ||
| 89 | 89 | @ |
| 90 | 90 | @ ------------------------------------------------------------------------- |
| 91 | 91 | @ -- The BLOB and DELTA tables above hold the "global state" of a Fossil |
| 92 | 92 | @ -- project; the stuff that is normally exchanged during "sync". The |
| 93 | 93 | @ -- "local state" of a repository is contained in the remaining tables of |
| 94 | -@ -- the zRepositorySchema1 string. | |
| 94 | +@ -- the zRepositorySchema1 string. | |
| 95 | 95 | @ ------------------------------------------------------------------------- |
| 96 | 96 | @ |
| 97 | 97 | @ -- Whenever new blobs are received into the repository, an entry |
| 98 | 98 | @ -- in this table records the source of the blob. |
| 99 | 99 | @ -- |
| @@ -172,11 +172,11 @@ | ||
| 172 | 172 | @ ); |
| 173 | 173 | @ |
| 174 | 174 | @ -- Some ticket content (such as the originators email address or contact |
| 175 | 175 | @ -- information) needs to be obscured to protect privacy. This is achieved |
| 176 | 176 | @ -- 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. | |
| 178 | 178 | @ -- |
| 179 | 179 | @ -- This table contains sensitive information and should not be shared |
| 180 | 180 | @ -- with unauthorized users. |
| 181 | 181 | @ -- |
| 182 | 182 | @ CREATE TABLE concealed( |
| @@ -193,11 +193,11 @@ | ||
| 193 | 193 | /* |
| 194 | 194 | ** The default reportfmt entry for the schema. This is in an extra |
| 195 | 195 | ** script so that (configure reset) can install the default report. |
| 196 | 196 | */ |
| 197 | 197 | const char zRepositorySchemaDefaultReports[] = |
| 198 | -@ INSERT INTO reportfmt(title,mtime,cols,sqlcode) | |
| 198 | +@ INSERT INTO reportfmt(title,mtime,cols,sqlcode) | |
| 199 | 199 | @ VALUES('All Tickets',julianday('1970-01-01'),'#ffffff Key: |
| 200 | 200 | @ #f2dcdc Active |
| 201 | 201 | @ #e8e8e8 Review |
| 202 | 202 | @ #cfe8bd Fixed |
| 203 | 203 | @ #bde5d6 Tested |
| @@ -321,13 +321,13 @@ | ||
| 321 | 321 | @ rid INTEGER PRIMARY KEY -- Record ID of the phantom |
| 322 | 322 | @ ); |
| 323 | 323 | @ |
| 324 | 324 | @ -- Each baseline or manifest can have one or more tags. A tag |
| 325 | 325 | @ -- is defined by a row in the next table. |
| 326 | -@ -- | |
| 326 | +@ -- | |
| 327 | 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 | |
| 328 | +@ -- the wiki page. Tickets changes are tagged with "ticket-UUID" where | |
| 329 | 329 | @ -- UUID is the indentifier of the ticket. Tags used to assign symbolic |
| 330 | 330 | @ -- names to baselines are branches are of the form "sym-NAME" where |
| 331 | 331 | @ -- NAME is the symbolic name. |
| 332 | 332 | @ -- |
| 333 | 333 | @ CREATE TABLE tag( |
| 334 | 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 |
| --- src/schema.c | |
| +++ src/schema.c | |
| @@ -21,11 +21,11 @@ | |
| 21 | #include "schema.h" |
| 22 | |
| 23 | /* |
| 24 | ** The database schema for the ~/.fossil configuration database. |
| 25 | */ |
| 26 | const char zConfigSchema[] = |
| 27 | @ -- This file contains the schema for the database that is kept in the |
| 28 | @ -- ~/.fossil file and that stores information about the users setup. |
| 29 | @ -- |
| 30 | @ CREATE TABLE global_config( |
| 31 | @ name TEXT PRIMARY KEY, |
| @@ -50,19 +50,19 @@ | |
| 50 | |
| 51 | #endif /* INTERFACE */ |
| 52 | |
| 53 | |
| 54 | /* |
| 55 | ** The schema for a repository database. |
| 56 | ** |
| 57 | ** Schema1[] contains parts of the schema that are fixed and unchanging |
| 58 | ** across versions. Schema2[] contains parts of the schema that can |
| 59 | ** change from one version to the next. The information in Schema2[] |
| 60 | ** is reconstructed from the information in Schema1[] by the "rebuild" |
| 61 | ** operation. |
| 62 | */ |
| 63 | const char zRepositorySchema1[] = |
| 64 | @ -- The BLOB and DELTA tables contain all records held in the repository. |
| 65 | @ -- |
| 66 | @ -- The BLOB.CONTENT column is always compressed using zlib. This |
| 67 | @ -- column might hold the full text of the record or it might hold |
| 68 | @ -- a delta that is able to reconstruct the record from some other |
| @@ -69,11 +69,11 @@ | |
| 69 | @ -- record. If BLOB.CONTENT holds a delta, then a DELTA table entry |
| 70 | @ -- will exist for the record and that entry will point to another |
| 71 | @ -- entry that holds the source of the delta. Deltas can be chained. |
| 72 | @ -- |
| 73 | @ -- The blob and delta tables collectively hold the "global state" of |
| 74 | @ -- a Fossil repository. |
| 75 | @ -- |
| 76 | @ CREATE TABLE blob( |
| 77 | @ rid INTEGER PRIMARY KEY, -- Record ID |
| 78 | @ rcvid INTEGER, -- Origin of this record |
| 79 | @ size INTEGER, -- Size of content. -1 for a phantom. |
| @@ -89,11 +89,11 @@ | |
| 89 | @ |
| 90 | @ ------------------------------------------------------------------------- |
| 91 | @ -- The BLOB and DELTA tables above hold the "global state" of a Fossil |
| 92 | @ -- project; the stuff that is normally exchanged during "sync". The |
| 93 | @ -- "local state" of a repository is contained in the remaining tables of |
| 94 | @ -- the zRepositorySchema1 string. |
| 95 | @ ------------------------------------------------------------------------- |
| 96 | @ |
| 97 | @ -- Whenever new blobs are received into the repository, an entry |
| 98 | @ -- in this table records the source of the blob. |
| 99 | @ -- |
| @@ -172,11 +172,11 @@ | |
| 172 | @ ); |
| 173 | @ |
| 174 | @ -- Some ticket content (such as the originators email address or contact |
| 175 | @ -- information) needs to be obscured to protect privacy. This is achieved |
| 176 | @ -- by storing an SHA1 hash of the content. For display, the hash is |
| 177 | @ -- mapped back into the original text using this table. |
| 178 | @ -- |
| 179 | @ -- This table contains sensitive information and should not be shared |
| 180 | @ -- with unauthorized users. |
| 181 | @ -- |
| 182 | @ CREATE TABLE concealed( |
| @@ -193,11 +193,11 @@ | |
| 193 | /* |
| 194 | ** The default reportfmt entry for the schema. This is in an extra |
| 195 | ** script so that (configure reset) can install the default report. |
| 196 | */ |
| 197 | const char zRepositorySchemaDefaultReports[] = |
| 198 | @ INSERT INTO reportfmt(title,mtime,cols,sqlcode) |
| 199 | @ VALUES('All Tickets',julianday('1970-01-01'),'#ffffff Key: |
| 200 | @ #f2dcdc Active |
| 201 | @ #e8e8e8 Review |
| 202 | @ #cfe8bd Fixed |
| 203 | @ #bde5d6 Tested |
| @@ -321,13 +321,13 @@ | |
| 321 | @ rid INTEGER PRIMARY KEY -- Record ID of the phantom |
| 322 | @ ); |
| 323 | @ |
| 324 | @ -- Each baseline or manifest can have one or more tags. A tag |
| 325 | @ -- is defined by a row in the next table. |
| 326 | @ -- |
| 327 | @ -- Wiki pages are tagged with "wiki-NAME" where NAME is the name of |
| 328 | @ -- the wiki page. Tickets changes are tagged with "ticket-UUID" where |
| 329 | @ -- UUID is the indentifier of the ticket. Tags used to assign symbolic |
| 330 | @ -- names to baselines are branches are of the form "sym-NAME" where |
| 331 | @ -- NAME is the symbolic name. |
| 332 | @ -- |
| 333 | @ CREATE TABLE tag( |
| 334 |
+27
-6
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -962,10 +962,21 @@ | ||
| 962 | 962 | @ <p>Fossil tries to spend less than this many seconds gathering |
| 963 | 963 | @ the out-bound data of sync, clone, and pull packets. |
| 964 | 964 | @ If the client request takes longer, a partial reply is given similar |
| 965 | 965 | @ to the download packet limit. 30s is a reasonable default.</p> |
| 966 | 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 | + | |
| 967 | 978 | @ <hr /> |
| 968 | 979 | onoff_attribute( |
| 969 | 980 | "Enable hyperlinks for \"nobody\" based on User-Agent and Javascript", |
| 970 | 981 | "auto-hyperlink", "autohyperlink", 1, 0); |
| 971 | 982 | @ <p>Enable hyperlinks (the equivalent of the "h" permission) for all users |
| @@ -973,11 +984,12 @@ | ||
| 973 | 984 | @ HTTP header indicates that the request is coming from an actual human |
| 974 | 985 | @ being and not a a robot or spider and (2) the user agent is able to |
| 975 | 986 | @ run Javascript in order to set the href= attribute of hyperlinks. Bots |
| 976 | 987 | @ and spiders can forge a User-Agent string that makes them seem to be a |
| 977 | 988 | @ 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> | |
| 979 | 991 | @ |
| 980 | 992 | @ <p>You do not normally want a bot to walk your entire repository because |
| 981 | 993 | @ if it does, your server will end up computing diffs and annotations for |
| 982 | 994 | @ every historical version of every file and creating ZIPs and tarballs of |
| 983 | 995 | @ every historical check-in, which can use a lot of CPU and bandwidth |
| @@ -1261,32 +1273,41 @@ | ||
| 1261 | 1273 | } else { |
| 1262 | 1274 | @ <br /> |
| 1263 | 1275 | } |
| 1264 | 1276 | } |
| 1265 | 1277 | } |
| 1278 | + @ <br /><input type="submit" name="submit" value="Apply Changes" /> | |
| 1266 | 1279 | @ </td><td style="width:50px;"></td><td valign="top"> |
| 1267 | 1280 | for(pSet=ctrlSettings; pSet->name!=0; pSet++){ |
| 1268 | - if( pSet->width!=0 && !pSet->versionable){ | |
| 1281 | + if( pSet->width!=0 && !pSet->versionable && !pSet->forceTextArea ){ | |
| 1269 | 1282 | entry_attribute(pSet->name, /*pSet->width*/ 25, pSet->name, |
| 1270 | 1283 | pSet->var!=0 ? pSet->var : pSet->name, |
| 1271 | 1284 | (char*)pSet->def, 0); |
| 1272 | 1285 | @ <br /> |
| 1273 | 1286 | } |
| 1287 | + } | |
| 1288 | + for(pSet=ctrlSettings; pSet->name!=0; pSet++){ | |
| 1289 | + if( pSet->width!=0 && !pSet->versionable && pSet->forceTextArea ){ | |
| 1290 | + @<b>%s(pSet->name)</b><br /> | |
| 1291 | + textarea_attribute("", /*rows*/ 3, /*cols*/ 50, pSet->name, | |
| 1292 | + pSet->var!=0 ? pSet->var : pSet->name, | |
| 1293 | + (char*)pSet->def, 0); | |
| 1294 | + @ <br /> | |
| 1295 | + } | |
| 1274 | 1296 | } |
| 1275 | 1297 | @ </td><td style="width:50px;"></td><td valign="top"> |
| 1276 | 1298 | for(pSet=ctrlSettings; pSet->name!=0; pSet++){ |
| 1277 | - int hasVersionableValue = db_get_do_versionable(pSet->name, NULL)!=0; | |
| 1278 | - if( pSet->width!=0 && pSet->versionable){ | |
| 1299 | + if( pSet->width!=0 && pSet->versionable ){ | |
| 1300 | + int hasVersionableValue = db_get_do_versionable(pSet->name, NULL)!=0; | |
| 1279 | 1301 | @<b>%s(pSet->name)</b> (v)<br /> |
| 1280 | 1302 | textarea_attribute("", /*rows*/ 3, /*cols*/ 20, pSet->name, |
| 1281 | 1303 | pSet->var!=0 ? pSet->var : pSet->name, |
| 1282 | 1304 | (char*)pSet->def, hasVersionableValue); |
| 1283 | 1305 | @<br /> |
| 1284 | 1306 | } |
| 1285 | 1307 | } |
| 1286 | 1308 | @ </td></tr></table> |
| 1287 | - @ <p><input type="submit" name="submit" value="Apply Changes" /></p> | |
| 1288 | 1309 | @ </div></form> |
| 1289 | 1310 | @ <p>Settings marked with (v) are 'versionable' and will be overridden |
| 1290 | 1311 | @ by the contents of files named <tt>.fossil-settings/PROPERTY</tt>. |
| 1291 | 1312 | @ If such a file is present, the corresponding field above is not |
| 1292 | 1313 | @ editable.</p><hr /><p> |
| @@ -1469,11 +1490,11 @@ | ||
| 1469 | 1490 | @ </div></form> |
| 1470 | 1491 | @ <hr /> |
| 1471 | 1492 | @ The default header is shown below for reference. Other examples |
| 1472 | 1493 | @ of headers can be seen on the <a href="setup_skin">skins page</a>. |
| 1473 | 1494 | @ See also the <a href="setup_editcss">CSS</a> and |
| 1474 | - @ <a href="setup_footer">footer</a> editing screeens. | |
| 1495 | + @ <a href="setup_footer">footer</a> editing screens. | |
| 1475 | 1496 | @ <blockquote><pre> |
| 1476 | 1497 | @ %h(zDefaultHeader) |
| 1477 | 1498 | @ </pre></blockquote> |
| 1478 | 1499 | style_footer(); |
| 1479 | 1500 | db_end_transaction(0); |
| 1480 | 1501 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -962,10 +962,21 @@ | |
| 962 | @ <p>Fossil tries to spend less than this many seconds gathering |
| 963 | @ the out-bound data of sync, clone, and pull packets. |
| 964 | @ If the client request takes longer, a partial reply is given similar |
| 965 | @ to the download packet limit. 30s is a reasonable default.</p> |
| 966 | |
| 967 | @ <hr /> |
| 968 | onoff_attribute( |
| 969 | "Enable hyperlinks for \"nobody\" based on User-Agent and Javascript", |
| 970 | "auto-hyperlink", "autohyperlink", 1, 0); |
| 971 | @ <p>Enable hyperlinks (the equivalent of the "h" permission) for all users |
| @@ -973,11 +984,12 @@ | |
| 973 | @ HTTP header indicates that the request is coming from an actual human |
| 974 | @ being and not a a robot or spider and (2) the user agent is able to |
| 975 | @ run Javascript in order to set the href= attribute of hyperlinks. Bots |
| 976 | @ and spiders can forge a User-Agent string that makes them seem to be a |
| 977 | @ normal browser and they can run javascript just like browsers. But most |
| 978 | @ bots do not go to that much trouble so this is normally an effective defense.</p> |
| 979 | @ |
| 980 | @ <p>You do not normally want a bot to walk your entire repository because |
| 981 | @ if it does, your server will end up computing diffs and annotations for |
| 982 | @ every historical version of every file and creating ZIPs and tarballs of |
| 983 | @ every historical check-in, which can use a lot of CPU and bandwidth |
| @@ -1261,32 +1273,41 @@ | |
| 1261 | } else { |
| 1262 | @ <br /> |
| 1263 | } |
| 1264 | } |
| 1265 | } |
| 1266 | @ </td><td style="width:50px;"></td><td valign="top"> |
| 1267 | for(pSet=ctrlSettings; pSet->name!=0; pSet++){ |
| 1268 | if( pSet->width!=0 && !pSet->versionable){ |
| 1269 | entry_attribute(pSet->name, /*pSet->width*/ 25, pSet->name, |
| 1270 | pSet->var!=0 ? pSet->var : pSet->name, |
| 1271 | (char*)pSet->def, 0); |
| 1272 | @ <br /> |
| 1273 | } |
| 1274 | } |
| 1275 | @ </td><td style="width:50px;"></td><td valign="top"> |
| 1276 | for(pSet=ctrlSettings; pSet->name!=0; pSet++){ |
| 1277 | int hasVersionableValue = db_get_do_versionable(pSet->name, NULL)!=0; |
| 1278 | if( pSet->width!=0 && pSet->versionable){ |
| 1279 | @<b>%s(pSet->name)</b> (v)<br /> |
| 1280 | textarea_attribute("", /*rows*/ 3, /*cols*/ 20, pSet->name, |
| 1281 | pSet->var!=0 ? pSet->var : pSet->name, |
| 1282 | (char*)pSet->def, hasVersionableValue); |
| 1283 | @<br /> |
| 1284 | } |
| 1285 | } |
| 1286 | @ </td></tr></table> |
| 1287 | @ <p><input type="submit" name="submit" value="Apply Changes" /></p> |
| 1288 | @ </div></form> |
| 1289 | @ <p>Settings marked with (v) are 'versionable' and will be overridden |
| 1290 | @ by the contents of files named <tt>.fossil-settings/PROPERTY</tt>. |
| 1291 | @ If such a file is present, the corresponding field above is not |
| 1292 | @ editable.</p><hr /><p> |
| @@ -1469,11 +1490,11 @@ | |
| 1469 | @ </div></form> |
| 1470 | @ <hr /> |
| 1471 | @ The default header is shown below for reference. Other examples |
| 1472 | @ of headers can be seen on the <a href="setup_skin">skins page</a>. |
| 1473 | @ See also the <a href="setup_editcss">CSS</a> and |
| 1474 | @ <a href="setup_footer">footer</a> editing screeens. |
| 1475 | @ <blockquote><pre> |
| 1476 | @ %h(zDefaultHeader) |
| 1477 | @ </pre></blockquote> |
| 1478 | style_footer(); |
| 1479 | db_end_transaction(0); |
| 1480 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -962,10 +962,21 @@ | |
| 962 | @ <p>Fossil tries to spend less than this many seconds gathering |
| 963 | @ the out-bound data of sync, clone, and pull packets. |
| 964 | @ If the client request takes longer, a partial reply is given similar |
| 965 | @ to the download packet limit. 30s is a reasonable default.</p> |
| 966 | |
| 967 | @ <hr /> |
| 968 | entry_attribute("Server Load Average Limit", 11, "max-loadavg", "mxldavg", |
| 969 | "0.0", 0); |
| 970 | @ <p>Some expensive operations (such as computing tarballs, zip archives, |
| 971 | @ or annotation/blame pages) are prohibited if the load average on the host |
| 972 | @ computer is too large. Set the threshold for disallowing expensive |
| 973 | @ computations here. Set this to 0.0 to disable the load average limit. |
| 974 | @ This limit is only enforced on Unix servers. On Linux systems, |
| 975 | @ access to the /proc virtual filesystem is required, which means this limit |
| 976 | @ might not work inside a chroot() jail.</p> |
| 977 | |
| 978 | @ <hr /> |
| 979 | onoff_attribute( |
| 980 | "Enable hyperlinks for \"nobody\" based on User-Agent and Javascript", |
| 981 | "auto-hyperlink", "autohyperlink", 1, 0); |
| 982 | @ <p>Enable hyperlinks (the equivalent of the "h" permission) for all users |
| @@ -973,11 +984,12 @@ | |
| 984 | @ HTTP header indicates that the request is coming from an actual human |
| 985 | @ being and not a a robot or spider and (2) the user agent is able to |
| 986 | @ run Javascript in order to set the href= attribute of hyperlinks. Bots |
| 987 | @ and spiders can forge a User-Agent string that makes them seem to be a |
| 988 | @ normal browser and they can run javascript just like browsers. But most |
| 989 | @ bots do not go to that much trouble so this is normally an effective |
| 990 | @ defense.</p> |
| 991 | @ |
| 992 | @ <p>You do not normally want a bot to walk your entire repository because |
| 993 | @ if it does, your server will end up computing diffs and annotations for |
| 994 | @ every historical version of every file and creating ZIPs and tarballs of |
| 995 | @ every historical check-in, which can use a lot of CPU and bandwidth |
| @@ -1261,32 +1273,41 @@ | |
| 1273 | } else { |
| 1274 | @ <br /> |
| 1275 | } |
| 1276 | } |
| 1277 | } |
| 1278 | @ <br /><input type="submit" name="submit" value="Apply Changes" /> |
| 1279 | @ </td><td style="width:50px;"></td><td valign="top"> |
| 1280 | for(pSet=ctrlSettings; pSet->name!=0; pSet++){ |
| 1281 | if( pSet->width!=0 && !pSet->versionable && !pSet->forceTextArea ){ |
| 1282 | entry_attribute(pSet->name, /*pSet->width*/ 25, pSet->name, |
| 1283 | pSet->var!=0 ? pSet->var : pSet->name, |
| 1284 | (char*)pSet->def, 0); |
| 1285 | @ <br /> |
| 1286 | } |
| 1287 | } |
| 1288 | for(pSet=ctrlSettings; pSet->name!=0; pSet++){ |
| 1289 | if( pSet->width!=0 && !pSet->versionable && pSet->forceTextArea ){ |
| 1290 | @<b>%s(pSet->name)</b><br /> |
| 1291 | textarea_attribute("", /*rows*/ 3, /*cols*/ 50, pSet->name, |
| 1292 | pSet->var!=0 ? pSet->var : pSet->name, |
| 1293 | (char*)pSet->def, 0); |
| 1294 | @ <br /> |
| 1295 | } |
| 1296 | } |
| 1297 | @ </td><td style="width:50px;"></td><td valign="top"> |
| 1298 | for(pSet=ctrlSettings; pSet->name!=0; pSet++){ |
| 1299 | if( pSet->width!=0 && pSet->versionable ){ |
| 1300 | int hasVersionableValue = db_get_do_versionable(pSet->name, NULL)!=0; |
| 1301 | @<b>%s(pSet->name)</b> (v)<br /> |
| 1302 | textarea_attribute("", /*rows*/ 3, /*cols*/ 20, pSet->name, |
| 1303 | pSet->var!=0 ? pSet->var : pSet->name, |
| 1304 | (char*)pSet->def, hasVersionableValue); |
| 1305 | @<br /> |
| 1306 | } |
| 1307 | } |
| 1308 | @ </td></tr></table> |
| 1309 | @ </div></form> |
| 1310 | @ <p>Settings marked with (v) are 'versionable' and will be overridden |
| 1311 | @ by the contents of files named <tt>.fossil-settings/PROPERTY</tt>. |
| 1312 | @ If such a file is present, the corresponding field above is not |
| 1313 | @ editable.</p><hr /><p> |
| @@ -1469,11 +1490,11 @@ | |
| 1490 | @ </div></form> |
| 1491 | @ <hr /> |
| 1492 | @ The default header is shown below for reference. Other examples |
| 1493 | @ of headers can be seen on the <a href="setup_skin">skins page</a>. |
| 1494 | @ See also the <a href="setup_editcss">CSS</a> and |
| 1495 | @ <a href="setup_footer">footer</a> editing screens. |
| 1496 | @ <blockquote><pre> |
| 1497 | @ %h(zDefaultHeader) |
| 1498 | @ </pre></blockquote> |
| 1499 | style_footer(); |
| 1500 | db_end_transaction(0); |
| 1501 |
+45
-15
| --- src/shell.c | ||
| +++ src/shell.c | ||
| @@ -63,11 +63,13 @@ | ||
| 63 | 63 | #endif |
| 64 | 64 | |
| 65 | 65 | #if defined(_WIN32) || defined(WIN32) |
| 66 | 66 | # include <io.h> |
| 67 | 67 | #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 | |
| 69 | 71 | #undef popen |
| 70 | 72 | #define popen _popen |
| 71 | 73 | #undef pclose |
| 72 | 74 | #define pclose _pclose |
| 73 | 75 | #else |
| @@ -442,10 +444,11 @@ | ||
| 442 | 444 | ** state and mode information. |
| 443 | 445 | */ |
| 444 | 446 | struct callback_data { |
| 445 | 447 | sqlite3 *db; /* The database */ |
| 446 | 448 | int echoOn; /* True to echo input commands */ |
| 449 | + int autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL statement */ | |
| 447 | 450 | int statsOn; /* True to display memory stats before each finalize */ |
| 448 | 451 | int cnt; /* Number of records displayed so far */ |
| 449 | 452 | FILE *out; /* Write results here */ |
| 450 | 453 | FILE *traceOut; /* Output for sqlite3_trace() */ |
| 451 | 454 | int nErr; /* Number of errors seen */ |
| @@ -1179,10 +1182,11 @@ | ||
| 1179 | 1182 | ** itself by 2 spaces. |
| 1180 | 1183 | ** |
| 1181 | 1184 | ** * For each "Goto", if the jump destination is earlier in the program |
| 1182 | 1185 | ** and ends on one of: |
| 1183 | 1186 | ** Yield SeekGt SeekLt RowSetRead Rewind |
| 1187 | +** or if the P1 parameter is one instead of zero, | |
| 1184 | 1188 | ** then indent all opcodes between the earlier instruction |
| 1185 | 1189 | ** and "Goto" by 2 spaces. |
| 1186 | 1190 | */ |
| 1187 | 1191 | static void explain_data_prepare(struct callback_data *p, sqlite3_stmt *pSql){ |
| 1188 | 1192 | const char *zSql; /* The text of the SQL statement */ |
| @@ -1226,11 +1230,13 @@ | ||
| 1226 | 1230 | p->nIndent = iOp+1; |
| 1227 | 1231 | |
| 1228 | 1232 | if( str_in_array(zOp, azNext) ){ |
| 1229 | 1233 | for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2; |
| 1230 | 1234 | } |
| 1231 | - if( str_in_array(zOp, azGoto) && p2op<p->nIndent && abYield[p2op] ){ | |
| 1235 | + if( str_in_array(zOp, azGoto) && p2op<p->nIndent | |
| 1236 | + && (abYield[p2op] || sqlite3_column_int(pSql, 2)) | |
| 1237 | + ){ | |
| 1232 | 1238 | for(i=p2op+1; i<iOp; i++) p->aiIndent[i] += 2; |
| 1233 | 1239 | } |
| 1234 | 1240 | } |
| 1235 | 1241 | |
| 1236 | 1242 | p->iIndent = 0; |
| @@ -1297,10 +1303,27 @@ | ||
| 1297 | 1303 | /* echo the sql statement if echo on */ |
| 1298 | 1304 | if( pArg && pArg->echoOn ){ |
| 1299 | 1305 | const char *zStmtSql = sqlite3_sql(pStmt); |
| 1300 | 1306 | fprintf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql); |
| 1301 | 1307 | } |
| 1308 | + | |
| 1309 | + /* Show the EXPLAIN QUERY PLAN if .eqp is on */ | |
| 1310 | + if( pArg && pArg->autoEQP ){ | |
| 1311 | + sqlite3_stmt *pExplain; | |
| 1312 | + char *zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", sqlite3_sql(pStmt)); | |
| 1313 | + rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0); | |
| 1314 | + if( rc==SQLITE_OK ){ | |
| 1315 | + while( sqlite3_step(pExplain)==SQLITE_ROW ){ | |
| 1316 | + fprintf(pArg->out,"--EQP-- %d,", sqlite3_column_int(pExplain, 0)); | |
| 1317 | + fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 1)); | |
| 1318 | + fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 2)); | |
| 1319 | + fprintf(pArg->out,"%s\n", sqlite3_column_text(pExplain, 3)); | |
| 1320 | + } | |
| 1321 | + } | |
| 1322 | + sqlite3_finalize(pExplain); | |
| 1323 | + sqlite3_free(zEQP); | |
| 1324 | + } | |
| 1302 | 1325 | |
| 1303 | 1326 | /* Output TESTCTRL_EXPLAIN text of requested */ |
| 1304 | 1327 | if( pArg && pArg->mode==MODE_Explain ){ |
| 1305 | 1328 | const char *zExplain = 0; |
| 1306 | 1329 | sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain); |
| @@ -1891,11 +1914,11 @@ | ||
| 1891 | 1914 | csv_append_char(p, c); |
| 1892 | 1915 | c = fgetc(p->in); |
| 1893 | 1916 | } |
| 1894 | 1917 | if( c=='\n' ){ |
| 1895 | 1918 | p->nLine++; |
| 1896 | - if( p->n>1 && p->z[p->n-1]=='\r' ) p->n--; | |
| 1919 | + if( p->n>0 && p->z[p->n-1]=='\r' ) p->n--; | |
| 1897 | 1920 | } |
| 1898 | 1921 | p->cTerm = c; |
| 1899 | 1922 | } |
| 1900 | 1923 | if( p->z ) p->z[p->n] = 0; |
| 1901 | 1924 | return p->z; |
| @@ -2296,10 +2319,14 @@ | ||
| 2296 | 2319 | }else |
| 2297 | 2320 | |
| 2298 | 2321 | if( c=='e' && strncmp(azArg[0], "echo", n)==0 && nArg>1 && nArg<3 ){ |
| 2299 | 2322 | p->echoOn = booleanValue(azArg[1]); |
| 2300 | 2323 | }else |
| 2324 | + | |
| 2325 | + if( c=='e' && strncmp(azArg[0], "eqp", n)==0 && nArg>1 && nArg<3 ){ | |
| 2326 | + p->autoEQP = booleanValue(azArg[1]); | |
| 2327 | + }else | |
| 2301 | 2328 | |
| 2302 | 2329 | if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){ |
| 2303 | 2330 | if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc); |
| 2304 | 2331 | rc = 2; |
| 2305 | 2332 | }else |
| @@ -2869,10 +2896,11 @@ | ||
| 2869 | 2896 | }else |
| 2870 | 2897 | |
| 2871 | 2898 | if( c=='s' && strncmp(azArg[0], "show", n)==0 && nArg==1 ){ |
| 2872 | 2899 | int i; |
| 2873 | 2900 | fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off"); |
| 2901 | + fprintf(p->out,"%9.9s: %s\n","eqp", p->autoEQP ? "on" : "off"); | |
| 2874 | 2902 | fprintf(p->out,"%9.9s: %s\n","explain", p->explainPrev.valid ? "on" :"off"); |
| 2875 | 2903 | fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off"); |
| 2876 | 2904 | fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]); |
| 2877 | 2905 | fprintf(p->out,"%9.9s: ", "nullvalue"); |
| 2878 | 2906 | output_c_string(p->out, p->nullvalue); |
| @@ -3546,15 +3574,17 @@ | ||
| 3546 | 3574 | char *zFirstCmd = 0; |
| 3547 | 3575 | int i; |
| 3548 | 3576 | int rc = 0; |
| 3549 | 3577 | int warnInmemoryDb = 0; |
| 3550 | 3578 | |
| 3551 | - if( sqlite3_libversion_number()<3008003 ){ | |
| 3552 | - fprintf(stderr, "Unsuitable SQLite version %s, must be at least 3.8.3", | |
| 3553 | - sqlite3_libversion()); | |
| 3579 | +#if USE_SYSTEM_SQLITE+0!=1 | |
| 3580 | + if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){ | |
| 3581 | + fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n", | |
| 3582 | + sqlite3_sourceid(), SQLITE_SOURCE_ID); | |
| 3554 | 3583 | exit(1); |
| 3555 | 3584 | } |
| 3585 | +#endif | |
| 3556 | 3586 | Argv0 = argv[0]; |
| 3557 | 3587 | main_init(&data); |
| 3558 | 3588 | stdin_is_interactive = isatty(0); |
| 3559 | 3589 | |
| 3560 | 3590 | /* Make sure we have a valid signal handler early, before anything |
| @@ -3644,17 +3674,15 @@ | ||
| 3644 | 3674 | warnInmemoryDb = argc==1; |
| 3645 | 3675 | #else |
| 3646 | 3676 | fprintf(stderr,"%s: Error: no database filename specified\n", Argv0); |
| 3647 | 3677 | return 1; |
| 3648 | 3678 | #endif |
| 3649 | - /***** Begin Fossil Patch *****/ | |
| 3650 | - { | |
| 3651 | - extern void fossil_open(const char **); | |
| 3652 | - fossil_open(&data.zDbFilename); | |
| 3653 | - warnInmemoryDb = 0; | |
| 3654 | - } | |
| 3655 | - /***** End Fossil Patch *****/ | |
| 3679 | +#ifdef SQLITE_SHELL_DBNAME_PROC | |
| 3680 | + { extern void SQLITE_SHELL_DBNAME_PROC(const char**); | |
| 3681 | + SQLITE_SHELL_DBNAME_PROC(&data.zDbFilename); | |
| 3682 | + warnInmemoryDb = 0; } | |
| 3683 | +#endif | |
| 3656 | 3684 | } |
| 3657 | 3685 | data.out = stdout; |
| 3658 | 3686 | |
| 3659 | 3687 | /* Go ahead and open the database file if it already exists. If the |
| 3660 | 3688 | ** file does not exist, delay opening it. This prevents empty database |
| @@ -3706,10 +3734,12 @@ | ||
| 3706 | 3734 | data.showHeader = 1; |
| 3707 | 3735 | }else if( strcmp(z,"-noheader")==0 ){ |
| 3708 | 3736 | data.showHeader = 0; |
| 3709 | 3737 | }else if( strcmp(z,"-echo")==0 ){ |
| 3710 | 3738 | data.echoOn = 1; |
| 3739 | + }else if( strcmp(z,"-eqp")==0 ){ | |
| 3740 | + data.autoEQP = 1; | |
| 3711 | 3741 | }else if( strcmp(z,"-stats")==0 ){ |
| 3712 | 3742 | data.statsOn = 1; |
| 3713 | 3743 | }else if( strcmp(z,"-bail")==0 ){ |
| 3714 | 3744 | bail_on_error = 1; |
| 3715 | 3745 | }else if( strcmp(z,"-version")==0 ){ |
| @@ -3788,12 +3818,12 @@ | ||
| 3788 | 3818 | "Enter \".help\" for usage hints.\n", |
| 3789 | 3819 | sqlite3_libversion(), sqlite3_sourceid() |
| 3790 | 3820 | ); |
| 3791 | 3821 | if( warnInmemoryDb ){ |
| 3792 | 3822 | printf("Connected to a "); |
| 3793 | - printBold("transient in-memory database."); | |
| 3794 | - printf("\nUse \".open FILENAME\" to reopen on a " | |
| 3823 | + printBold("transient in-memory database"); | |
| 3824 | + printf(".\nUse \".open FILENAME\" to reopen on a " | |
| 3795 | 3825 | "persistent database.\n"); |
| 3796 | 3826 | } |
| 3797 | 3827 | zHome = find_home_dir(); |
| 3798 | 3828 | if( zHome ){ |
| 3799 | 3829 | nHistory = strlen30(zHome) + 20; |
| 3800 | 3830 |
| --- src/shell.c | |
| +++ src/shell.c | |
| @@ -63,11 +63,13 @@ | |
| 63 | #endif |
| 64 | |
| 65 | #if defined(_WIN32) || defined(WIN32) |
| 66 | # include <io.h> |
| 67 | #define isatty(h) _isatty(h) |
| 68 | #define access(f,m) _access((f),(m)) |
| 69 | #undef popen |
| 70 | #define popen _popen |
| 71 | #undef pclose |
| 72 | #define pclose _pclose |
| 73 | #else |
| @@ -442,10 +444,11 @@ | |
| 442 | ** state and mode information. |
| 443 | */ |
| 444 | struct callback_data { |
| 445 | sqlite3 *db; /* The database */ |
| 446 | int echoOn; /* True to echo input commands */ |
| 447 | int statsOn; /* True to display memory stats before each finalize */ |
| 448 | int cnt; /* Number of records displayed so far */ |
| 449 | FILE *out; /* Write results here */ |
| 450 | FILE *traceOut; /* Output for sqlite3_trace() */ |
| 451 | int nErr; /* Number of errors seen */ |
| @@ -1179,10 +1182,11 @@ | |
| 1179 | ** itself by 2 spaces. |
| 1180 | ** |
| 1181 | ** * For each "Goto", if the jump destination is earlier in the program |
| 1182 | ** and ends on one of: |
| 1183 | ** Yield SeekGt SeekLt RowSetRead Rewind |
| 1184 | ** then indent all opcodes between the earlier instruction |
| 1185 | ** and "Goto" by 2 spaces. |
| 1186 | */ |
| 1187 | static void explain_data_prepare(struct callback_data *p, sqlite3_stmt *pSql){ |
| 1188 | const char *zSql; /* The text of the SQL statement */ |
| @@ -1226,11 +1230,13 @@ | |
| 1226 | p->nIndent = iOp+1; |
| 1227 | |
| 1228 | if( str_in_array(zOp, azNext) ){ |
| 1229 | for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2; |
| 1230 | } |
| 1231 | if( str_in_array(zOp, azGoto) && p2op<p->nIndent && abYield[p2op] ){ |
| 1232 | for(i=p2op+1; i<iOp; i++) p->aiIndent[i] += 2; |
| 1233 | } |
| 1234 | } |
| 1235 | |
| 1236 | p->iIndent = 0; |
| @@ -1297,10 +1303,27 @@ | |
| 1297 | /* echo the sql statement if echo on */ |
| 1298 | if( pArg && pArg->echoOn ){ |
| 1299 | const char *zStmtSql = sqlite3_sql(pStmt); |
| 1300 | fprintf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql); |
| 1301 | } |
| 1302 | |
| 1303 | /* Output TESTCTRL_EXPLAIN text of requested */ |
| 1304 | if( pArg && pArg->mode==MODE_Explain ){ |
| 1305 | const char *zExplain = 0; |
| 1306 | sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain); |
| @@ -1891,11 +1914,11 @@ | |
| 1891 | csv_append_char(p, c); |
| 1892 | c = fgetc(p->in); |
| 1893 | } |
| 1894 | if( c=='\n' ){ |
| 1895 | p->nLine++; |
| 1896 | if( p->n>1 && p->z[p->n-1]=='\r' ) p->n--; |
| 1897 | } |
| 1898 | p->cTerm = c; |
| 1899 | } |
| 1900 | if( p->z ) p->z[p->n] = 0; |
| 1901 | return p->z; |
| @@ -2296,10 +2319,14 @@ | |
| 2296 | }else |
| 2297 | |
| 2298 | if( c=='e' && strncmp(azArg[0], "echo", n)==0 && nArg>1 && nArg<3 ){ |
| 2299 | p->echoOn = booleanValue(azArg[1]); |
| 2300 | }else |
| 2301 | |
| 2302 | if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){ |
| 2303 | if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc); |
| 2304 | rc = 2; |
| 2305 | }else |
| @@ -2869,10 +2896,11 @@ | |
| 2869 | }else |
| 2870 | |
| 2871 | if( c=='s' && strncmp(azArg[0], "show", n)==0 && nArg==1 ){ |
| 2872 | int i; |
| 2873 | fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off"); |
| 2874 | fprintf(p->out,"%9.9s: %s\n","explain", p->explainPrev.valid ? "on" :"off"); |
| 2875 | fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off"); |
| 2876 | fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]); |
| 2877 | fprintf(p->out,"%9.9s: ", "nullvalue"); |
| 2878 | output_c_string(p->out, p->nullvalue); |
| @@ -3546,15 +3574,17 @@ | |
| 3546 | char *zFirstCmd = 0; |
| 3547 | int i; |
| 3548 | int rc = 0; |
| 3549 | int warnInmemoryDb = 0; |
| 3550 | |
| 3551 | if( sqlite3_libversion_number()<3008003 ){ |
| 3552 | fprintf(stderr, "Unsuitable SQLite version %s, must be at least 3.8.3", |
| 3553 | sqlite3_libversion()); |
| 3554 | exit(1); |
| 3555 | } |
| 3556 | Argv0 = argv[0]; |
| 3557 | main_init(&data); |
| 3558 | stdin_is_interactive = isatty(0); |
| 3559 | |
| 3560 | /* Make sure we have a valid signal handler early, before anything |
| @@ -3644,17 +3674,15 @@ | |
| 3644 | warnInmemoryDb = argc==1; |
| 3645 | #else |
| 3646 | fprintf(stderr,"%s: Error: no database filename specified\n", Argv0); |
| 3647 | return 1; |
| 3648 | #endif |
| 3649 | /***** Begin Fossil Patch *****/ |
| 3650 | { |
| 3651 | extern void fossil_open(const char **); |
| 3652 | fossil_open(&data.zDbFilename); |
| 3653 | warnInmemoryDb = 0; |
| 3654 | } |
| 3655 | /***** End Fossil Patch *****/ |
| 3656 | } |
| 3657 | data.out = stdout; |
| 3658 | |
| 3659 | /* Go ahead and open the database file if it already exists. If the |
| 3660 | ** file does not exist, delay opening it. This prevents empty database |
| @@ -3706,10 +3734,12 @@ | |
| 3706 | data.showHeader = 1; |
| 3707 | }else if( strcmp(z,"-noheader")==0 ){ |
| 3708 | data.showHeader = 0; |
| 3709 | }else if( strcmp(z,"-echo")==0 ){ |
| 3710 | data.echoOn = 1; |
| 3711 | }else if( strcmp(z,"-stats")==0 ){ |
| 3712 | data.statsOn = 1; |
| 3713 | }else if( strcmp(z,"-bail")==0 ){ |
| 3714 | bail_on_error = 1; |
| 3715 | }else if( strcmp(z,"-version")==0 ){ |
| @@ -3788,12 +3818,12 @@ | |
| 3788 | "Enter \".help\" for usage hints.\n", |
| 3789 | sqlite3_libversion(), sqlite3_sourceid() |
| 3790 | ); |
| 3791 | if( warnInmemoryDb ){ |
| 3792 | printf("Connected to a "); |
| 3793 | printBold("transient in-memory database."); |
| 3794 | printf("\nUse \".open FILENAME\" to reopen on a " |
| 3795 | "persistent database.\n"); |
| 3796 | } |
| 3797 | zHome = find_home_dir(); |
| 3798 | if( zHome ){ |
| 3799 | nHistory = strlen30(zHome) + 20; |
| 3800 |
| --- src/shell.c | |
| +++ src/shell.c | |
| @@ -63,11 +63,13 @@ | |
| 63 | #endif |
| 64 | |
| 65 | #if defined(_WIN32) || defined(WIN32) |
| 66 | # include <io.h> |
| 67 | #define isatty(h) _isatty(h) |
| 68 | #ifndef access |
| 69 | # define access(f,m) _access((f),(m)) |
| 70 | #endif |
| 71 | #undef popen |
| 72 | #define popen _popen |
| 73 | #undef pclose |
| 74 | #define pclose _pclose |
| 75 | #else |
| @@ -442,10 +444,11 @@ | |
| 444 | ** state and mode information. |
| 445 | */ |
| 446 | struct callback_data { |
| 447 | sqlite3 *db; /* The database */ |
| 448 | int echoOn; /* True to echo input commands */ |
| 449 | int autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL statement */ |
| 450 | int statsOn; /* True to display memory stats before each finalize */ |
| 451 | int cnt; /* Number of records displayed so far */ |
| 452 | FILE *out; /* Write results here */ |
| 453 | FILE *traceOut; /* Output for sqlite3_trace() */ |
| 454 | int nErr; /* Number of errors seen */ |
| @@ -1179,10 +1182,11 @@ | |
| 1182 | ** itself by 2 spaces. |
| 1183 | ** |
| 1184 | ** * For each "Goto", if the jump destination is earlier in the program |
| 1185 | ** and ends on one of: |
| 1186 | ** Yield SeekGt SeekLt RowSetRead Rewind |
| 1187 | ** or if the P1 parameter is one instead of zero, |
| 1188 | ** then indent all opcodes between the earlier instruction |
| 1189 | ** and "Goto" by 2 spaces. |
| 1190 | */ |
| 1191 | static void explain_data_prepare(struct callback_data *p, sqlite3_stmt *pSql){ |
| 1192 | const char *zSql; /* The text of the SQL statement */ |
| @@ -1226,11 +1230,13 @@ | |
| 1230 | p->nIndent = iOp+1; |
| 1231 | |
| 1232 | if( str_in_array(zOp, azNext) ){ |
| 1233 | for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2; |
| 1234 | } |
| 1235 | if( str_in_array(zOp, azGoto) && p2op<p->nIndent |
| 1236 | && (abYield[p2op] || sqlite3_column_int(pSql, 2)) |
| 1237 | ){ |
| 1238 | for(i=p2op+1; i<iOp; i++) p->aiIndent[i] += 2; |
| 1239 | } |
| 1240 | } |
| 1241 | |
| 1242 | p->iIndent = 0; |
| @@ -1297,10 +1303,27 @@ | |
| 1303 | /* echo the sql statement if echo on */ |
| 1304 | if( pArg && pArg->echoOn ){ |
| 1305 | const char *zStmtSql = sqlite3_sql(pStmt); |
| 1306 | fprintf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql); |
| 1307 | } |
| 1308 | |
| 1309 | /* Show the EXPLAIN QUERY PLAN if .eqp is on */ |
| 1310 | if( pArg && pArg->autoEQP ){ |
| 1311 | sqlite3_stmt *pExplain; |
| 1312 | char *zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", sqlite3_sql(pStmt)); |
| 1313 | rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0); |
| 1314 | if( rc==SQLITE_OK ){ |
| 1315 | while( sqlite3_step(pExplain)==SQLITE_ROW ){ |
| 1316 | fprintf(pArg->out,"--EQP-- %d,", sqlite3_column_int(pExplain, 0)); |
| 1317 | fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 1)); |
| 1318 | fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 2)); |
| 1319 | fprintf(pArg->out,"%s\n", sqlite3_column_text(pExplain, 3)); |
| 1320 | } |
| 1321 | } |
| 1322 | sqlite3_finalize(pExplain); |
| 1323 | sqlite3_free(zEQP); |
| 1324 | } |
| 1325 | |
| 1326 | /* Output TESTCTRL_EXPLAIN text of requested */ |
| 1327 | if( pArg && pArg->mode==MODE_Explain ){ |
| 1328 | const char *zExplain = 0; |
| 1329 | sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain); |
| @@ -1891,11 +1914,11 @@ | |
| 1914 | csv_append_char(p, c); |
| 1915 | c = fgetc(p->in); |
| 1916 | } |
| 1917 | if( c=='\n' ){ |
| 1918 | p->nLine++; |
| 1919 | if( p->n>0 && p->z[p->n-1]=='\r' ) p->n--; |
| 1920 | } |
| 1921 | p->cTerm = c; |
| 1922 | } |
| 1923 | if( p->z ) p->z[p->n] = 0; |
| 1924 | return p->z; |
| @@ -2296,10 +2319,14 @@ | |
| 2319 | }else |
| 2320 | |
| 2321 | if( c=='e' && strncmp(azArg[0], "echo", n)==0 && nArg>1 && nArg<3 ){ |
| 2322 | p->echoOn = booleanValue(azArg[1]); |
| 2323 | }else |
| 2324 | |
| 2325 | if( c=='e' && strncmp(azArg[0], "eqp", n)==0 && nArg>1 && nArg<3 ){ |
| 2326 | p->autoEQP = booleanValue(azArg[1]); |
| 2327 | }else |
| 2328 | |
| 2329 | if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){ |
| 2330 | if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc); |
| 2331 | rc = 2; |
| 2332 | }else |
| @@ -2869,10 +2896,11 @@ | |
| 2896 | }else |
| 2897 | |
| 2898 | if( c=='s' && strncmp(azArg[0], "show", n)==0 && nArg==1 ){ |
| 2899 | int i; |
| 2900 | fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off"); |
| 2901 | fprintf(p->out,"%9.9s: %s\n","eqp", p->autoEQP ? "on" : "off"); |
| 2902 | fprintf(p->out,"%9.9s: %s\n","explain", p->explainPrev.valid ? "on" :"off"); |
| 2903 | fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off"); |
| 2904 | fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]); |
| 2905 | fprintf(p->out,"%9.9s: ", "nullvalue"); |
| 2906 | output_c_string(p->out, p->nullvalue); |
| @@ -3546,15 +3574,17 @@ | |
| 3574 | char *zFirstCmd = 0; |
| 3575 | int i; |
| 3576 | int rc = 0; |
| 3577 | int warnInmemoryDb = 0; |
| 3578 | |
| 3579 | #if USE_SYSTEM_SQLITE+0!=1 |
| 3580 | if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){ |
| 3581 | fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n", |
| 3582 | sqlite3_sourceid(), SQLITE_SOURCE_ID); |
| 3583 | exit(1); |
| 3584 | } |
| 3585 | #endif |
| 3586 | Argv0 = argv[0]; |
| 3587 | main_init(&data); |
| 3588 | stdin_is_interactive = isatty(0); |
| 3589 | |
| 3590 | /* Make sure we have a valid signal handler early, before anything |
| @@ -3644,17 +3674,15 @@ | |
| 3674 | warnInmemoryDb = argc==1; |
| 3675 | #else |
| 3676 | fprintf(stderr,"%s: Error: no database filename specified\n", Argv0); |
| 3677 | return 1; |
| 3678 | #endif |
| 3679 | #ifdef SQLITE_SHELL_DBNAME_PROC |
| 3680 | { extern void SQLITE_SHELL_DBNAME_PROC(const char**); |
| 3681 | SQLITE_SHELL_DBNAME_PROC(&data.zDbFilename); |
| 3682 | warnInmemoryDb = 0; } |
| 3683 | #endif |
| 3684 | } |
| 3685 | data.out = stdout; |
| 3686 | |
| 3687 | /* Go ahead and open the database file if it already exists. If the |
| 3688 | ** file does not exist, delay opening it. This prevents empty database |
| @@ -3706,10 +3734,12 @@ | |
| 3734 | data.showHeader = 1; |
| 3735 | }else if( strcmp(z,"-noheader")==0 ){ |
| 3736 | data.showHeader = 0; |
| 3737 | }else if( strcmp(z,"-echo")==0 ){ |
| 3738 | data.echoOn = 1; |
| 3739 | }else if( strcmp(z,"-eqp")==0 ){ |
| 3740 | data.autoEQP = 1; |
| 3741 | }else if( strcmp(z,"-stats")==0 ){ |
| 3742 | data.statsOn = 1; |
| 3743 | }else if( strcmp(z,"-bail")==0 ){ |
| 3744 | bail_on_error = 1; |
| 3745 | }else if( strcmp(z,"-version")==0 ){ |
| @@ -3788,12 +3818,12 @@ | |
| 3818 | "Enter \".help\" for usage hints.\n", |
| 3819 | sqlite3_libversion(), sqlite3_sourceid() |
| 3820 | ); |
| 3821 | if( warnInmemoryDb ){ |
| 3822 | printf("Connected to a "); |
| 3823 | printBold("transient in-memory database"); |
| 3824 | printf(".\nUse \".open FILENAME\" to reopen on a " |
| 3825 | "persistent database.\n"); |
| 3826 | } |
| 3827 | zHome = find_home_dir(); |
| 3828 | if( zHome ){ |
| 3829 | nHistory = strlen30(zHome) + 20; |
| 3830 |
+7
-7
| --- src/shun.c | ||
| +++ src/shun.c | ||
| @@ -69,11 +69,11 @@ | ||
| 69 | 69 | style_header("Shunned Artifacts"); |
| 70 | 70 | if( zUuid && P("sub") ){ |
| 71 | 71 | login_verify_csrf_secret(); |
| 72 | 72 | db_multi_exec("DELETE FROM shun WHERE uuid='%s'", zUuid); |
| 73 | 73 | if( db_exists("SELECT 1 FROM blob WHERE uuid='%s'", zUuid) ){ |
| 74 | - @ <p class="noMoreShun">Artifact | |
| 74 | + @ <p class="noMoreShun">Artifact | |
| 75 | 75 | @ <a href="%s(g.zTop)/artifact/%s(zUuid)">%s(zUuid)</a> is no |
| 76 | 76 | @ longer being shunned.</p> |
| 77 | 77 | }else{ |
| 78 | 78 | @ <p class="noMoreShun">Artifact %s(zUuid) will no longer |
| 79 | 79 | @ be shunned. But it does not exist in the repository. It |
| @@ -107,11 +107,11 @@ | ||
| 107 | 107 | } |
| 108 | 108 | @ <p>A shunned artifact will not be pushed nor accepted in a pull and the |
| 109 | 109 | @ artifact content will be purged from the repository the next time the |
| 110 | 110 | @ repository is rebuilt. A list of shunned artifacts can be seen at the |
| 111 | 111 | @ bottom of this page.</p> |
| 112 | - @ | |
| 112 | + @ | |
| 113 | 113 | @ <a name="addshun"></a> |
| 114 | 114 | @ <p>To shun an artifact, enter its artifact ID (the 40-character SHA1 |
| 115 | 115 | @ hash of the artifact) in the |
| 116 | 116 | @ following box and press the "Shun" button. This will cause the artifact |
| 117 | 117 | @ to be removed from the repository and will prevent the artifact from being |
| @@ -124,11 +124,11 @@ | ||
| 124 | 124 | @ from the repository. Inappropriate content includes such things as |
| 125 | 125 | @ spam added to Wiki, files that violate copyright or patent agreements, |
| 126 | 126 | @ or artifacts that by design or accident interfere with the processing |
| 127 | 127 | @ of the repository. Do not shun artifacts merely to remove them from |
| 128 | 128 | @ sight - set the "hidden" tag on such artifacts instead.</p> |
| 129 | - @ | |
| 129 | + @ | |
| 130 | 130 | @ <blockquote> |
| 131 | 131 | @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div> |
| 132 | 132 | login_insert_csrf_secret(); |
| 133 | 133 | @ <input type="text" name="uuid" value="%h(PD("shun",""))" size="50" /> |
| 134 | 134 | @ <input type="submit" name="add" value="Shun" /> |
| @@ -159,14 +159,14 @@ | ||
| 159 | 159 | @ <form method="post" action="%s(g.zTop)/%s(g.zPath)"><div> |
| 160 | 160 | login_insert_csrf_secret(); |
| 161 | 161 | @ <input type="submit" name="rebuild" value="Rebuild" /> |
| 162 | 162 | @ </div></form> |
| 163 | 163 | @ </blockquote> |
| 164 | - @ | |
| 164 | + @ | |
| 165 | 165 | @ <hr /><p>Shunned Artifacts:</p> |
| 166 | 166 | @ <blockquote><p> |
| 167 | - db_prepare(&q, | |
| 167 | + db_prepare(&q, | |
| 168 | 168 | "SELECT uuid, EXISTS(SELECT 1 FROM blob WHERE blob.uuid=shun.uuid)" |
| 169 | 169 | " FROM shun ORDER BY uuid"); |
| 170 | 170 | while( db_step(&q)==SQLITE_ROW ){ |
| 171 | 171 | const char *zUuid = db_column_text(&q, 0); |
| 172 | 172 | int stillExists = db_column_int(&q, 1); |
| @@ -228,11 +228,11 @@ | ||
| 228 | 228 | style_header("Content Sources"); |
| 229 | 229 | if( ofst>0 ){ |
| 230 | 230 | style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d", |
| 231 | 231 | ofst>30 ? ofst-30 : 0); |
| 232 | 232 | } |
| 233 | - db_prepare(&q, | |
| 233 | + db_prepare(&q, | |
| 234 | 234 | "SELECT rcvid, login, datetime(rcvfrom.mtime), rcvfrom.ipaddr" |
| 235 | 235 | " FROM rcvfrom LEFT JOIN user USING(uid)" |
| 236 | 236 | " ORDER BY rcvid DESC LIMIT 31 OFFSET %d", |
| 237 | 237 | ofst |
| 238 | 238 | ); |
| @@ -287,11 +287,11 @@ | ||
| 287 | 287 | login_check_credentials(); |
| 288 | 288 | if( !g.perm.Admin ){ |
| 289 | 289 | login_needed(); |
| 290 | 290 | } |
| 291 | 291 | style_header("Content Source %d", rcvid); |
| 292 | - db_prepare(&q, | |
| 292 | + db_prepare(&q, | |
| 293 | 293 | "SELECT login, datetime(rcvfrom.mtime), rcvfrom.ipaddr" |
| 294 | 294 | " FROM rcvfrom LEFT JOIN user USING(uid)" |
| 295 | 295 | " WHERE rcvid=%d", |
| 296 | 296 | rcvid |
| 297 | 297 | ); |
| 298 | 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 |
| --- 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 @@ | ||
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | ** 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 | |
| 4 | 4 | ** single large file, the entire code can be compiled as a single translation |
| 5 | 5 | ** unit. This allows many compilers to do optimizations that would not be |
| 6 | 6 | ** possible if the files were compiled separately. Performance improvements |
| 7 | 7 | ** of 5% or more are commonly seen when SQLite is compiled as a single |
| 8 | 8 | ** translation unit. |
| @@ -23,10 +23,97 @@ | ||
| 23 | 23 | # define SQLITE_PRIVATE static |
| 24 | 24 | #endif |
| 25 | 25 | #ifndef SQLITE_API |
| 26 | 26 | # define SQLITE_API |
| 27 | 27 | #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 ***************/ | |
| 28 | 115 | /************** Begin file sqlite3.h *****************************************/ |
| 29 | 116 | /* |
| 30 | 117 | ** 2001 September 15 |
| 31 | 118 | ** |
| 32 | 119 | ** The author disclaims copyright to this source code. In place of |
| @@ -133,13 +220,13 @@ | ||
| 133 | 220 | ** |
| 134 | 221 | ** See also: [sqlite3_libversion()], |
| 135 | 222 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 136 | 223 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 137 | 224 | */ |
| 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" | |
| 141 | 228 | |
| 142 | 229 | /* |
| 143 | 230 | ** CAPI3REF: Run-Time Library Version Numbers |
| 144 | 231 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 145 | 232 | ** |
| @@ -6148,11 +6235,12 @@ | ||
| 6148 | 6235 | #define SQLITE_TESTCTRL_ISKEYWORD 16 |
| 6149 | 6236 | #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 |
| 6150 | 6237 | #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18 |
| 6151 | 6238 | #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 |
| 6152 | 6239 | #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 | |
| 6154 | 6242 | |
| 6155 | 6243 | /* |
| 6156 | 6244 | ** CAPI3REF: SQLite Runtime Status |
| 6157 | 6245 | ** |
| 6158 | 6246 | ** ^This interface is used to retrieve runtime status information |
| @@ -7411,54 +7499,11 @@ | ||
| 7411 | 7499 | |
| 7412 | 7500 | #endif /* ifndef _SQLITE3RTREE_H_ */ |
| 7413 | 7501 | |
| 7414 | 7502 | |
| 7415 | 7503 | /************** 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 ******************/ | |
| 7460 | 7505 | |
| 7461 | 7506 | /* |
| 7462 | 7507 | ** Include the configuration header output by 'configure' if we're using the |
| 7463 | 7508 | ** autoconf-based build |
| 7464 | 7509 | */ |
| @@ -8841,12 +8886,10 @@ | ||
| 8841 | 8886 | SQLITE_PRIVATE int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*); |
| 8842 | 8887 | SQLITE_PRIVATE const void *sqlite3BtreeKeyFetch(BtCursor*, u32 *pAmt); |
| 8843 | 8888 | SQLITE_PRIVATE const void *sqlite3BtreeDataFetch(BtCursor*, u32 *pAmt); |
| 8844 | 8889 | SQLITE_PRIVATE int sqlite3BtreeDataSize(BtCursor*, u32 *pSize); |
| 8845 | 8890 | 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*); | |
| 8848 | 8891 | |
| 8849 | 8892 | SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*); |
| 8850 | 8893 | SQLITE_PRIVATE struct Pager *sqlite3BtreePager(Btree*); |
| 8851 | 8894 | |
| 8852 | 8895 | SQLITE_PRIVATE int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*); |
| @@ -8982,13 +9025,16 @@ | ||
| 8982 | 9025 | } p4; |
| 8983 | 9026 | #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS |
| 8984 | 9027 | char *zComment; /* Comment to improve readability */ |
| 8985 | 9028 | #endif |
| 8986 | 9029 | #ifdef VDBE_PROFILE |
| 8987 | - int cnt; /* Number of times this instruction was executed */ | |
| 9030 | + u32 cnt; /* Number of times this instruction was executed */ | |
| 8988 | 9031 | u64 cycles; /* Total time spent executing this instruction */ |
| 8989 | 9032 | #endif |
| 9033 | +#ifdef SQLITE_VDBE_COVERAGE | |
| 9034 | + int iSrcLine; /* Source-code line that generated this opcode */ | |
| 9035 | +#endif | |
| 8990 | 9036 | }; |
| 8991 | 9037 | typedef struct VdbeOp VdbeOp; |
| 8992 | 9038 | |
| 8993 | 9039 | |
| 8994 | 9040 | /* |
| @@ -9094,75 +9140,75 @@ | ||
| 9094 | 9140 | #define OP_VUpdate 15 /* synopsis: data=r[P3@P2] */ |
| 9095 | 9141 | #define OP_Goto 16 |
| 9096 | 9142 | #define OP_Gosub 17 |
| 9097 | 9143 | #define OP_Return 18 |
| 9098 | 9144 | #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] */ | |
| 9150 | 9196 | #define OP_Or 71 /* same as TK_OR, synopsis: r[P3]=(r[P1] || r[P2]) */ |
| 9151 | 9197 | #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 | |
| 9155 | 9201 | #define OP_IsNull 76 /* same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */ |
| 9156 | 9202 | #define OP_NotNull 77 /* same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */ |
| 9157 | 9203 | #define OP_Ne 78 /* same as TK_NE, synopsis: if r[P1]!=r[P3] goto P2 */ |
| 9158 | 9204 | #define OP_Eq 79 /* same as TK_EQ, synopsis: if r[P1]==r[P3] goto P2 */ |
| 9159 | 9205 | #define OP_Gt 80 /* same as TK_GT, synopsis: if r[P1]>r[P3] goto P2 */ |
| 9160 | 9206 | #define OP_Le 81 /* same as TK_LE, synopsis: if r[P1]<=r[P3] goto P2 */ |
| 9161 | 9207 | #define OP_Lt 82 /* same as TK_LT, synopsis: if r[P1]<r[P3] goto P2 */ |
| 9162 | 9208 | #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 */ | |
| 9164 | 9210 | #define OP_BitAnd 85 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */ |
| 9165 | 9211 | #define OP_BitOr 86 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */ |
| 9166 | 9212 | #define OP_ShiftLeft 87 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */ |
| 9167 | 9213 | #define OP_ShiftRight 88 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */ |
| 9168 | 9214 | #define OP_Add 89 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */ |
| @@ -9169,68 +9215,72 @@ | ||
| 9169 | 9215 | #define OP_Subtract 90 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */ |
| 9170 | 9216 | #define OP_Multiply 91 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */ |
| 9171 | 9217 | #define OP_Divide 92 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */ |
| 9172 | 9218 | #define OP_Remainder 93 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */ |
| 9173 | 9219 | #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 */ | |
| 9175 | 9221 | #define OP_BitNot 96 /* same as TK_BITNOT, synopsis: r[P1]= ~r[P1] */ |
| 9176 | 9222 | #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 */ | |
| 9212 | 9258 | #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 | |
| 9222 | 9268 | #define OP_ToText 143 /* same as TK_TO_TEXT */ |
| 9223 | 9269 | #define OP_ToBlob 144 /* same as TK_TO_BLOB */ |
| 9224 | 9270 | #define OP_ToNumeric 145 /* same as TK_TO_NUMERIC */ |
| 9225 | 9271 | #define OP_ToInt 146 /* same as TK_TO_INT */ |
| 9226 | 9272 | #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 | |
| 9232 | 9282 | |
| 9233 | 9283 | |
| 9234 | 9284 | /* Properties such as "out2" or "jump" that are specified in |
| 9235 | 9285 | ** comments following the "case" for each opcode in the vdbe.c |
| 9236 | 9286 | ** are encoded into bitvectors as follows: |
| @@ -9243,28 +9293,28 @@ | ||
| 9243 | 9293 | #define OPFLG_OUT2 0x0020 /* out2: P2 is an output */ |
| 9244 | 9294 | #define OPFLG_OUT3 0x0040 /* out3: P3 is an output */ |
| 9245 | 9295 | #define OPFLG_INITIALIZER {\ |
| 9246 | 9296 | /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,\ |
| 9247 | 9297 | /* 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,\ | |
| 9255 | 9305 | /* 72 */ 0x4c, 0x00, 0x00, 0x00, 0x05, 0x05, 0x15, 0x15,\ |
| 9256 | 9306 | /* 80 */ 0x15, 0x15, 0x15, 0x15, 0x00, 0x4c, 0x4c, 0x4c,\ |
| 9257 | 9307 | /* 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,} | |
| 9266 | 9316 | |
| 9267 | 9317 | /************** End of opcodes.h *********************************************/ |
| 9268 | 9318 | /************** Continuing where we left off in vdbe.h ***********************/ |
| 9269 | 9319 | |
| 9270 | 9320 | /* |
| @@ -9276,11 +9326,11 @@ | ||
| 9276 | 9326 | SQLITE_PRIVATE int sqlite3VdbeAddOp1(Vdbe*,int,int); |
| 9277 | 9327 | SQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe*,int,int,int); |
| 9278 | 9328 | SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int); |
| 9279 | 9329 | SQLITE_PRIVATE int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int); |
| 9280 | 9330 | 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); | |
| 9282 | 9332 | SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*); |
| 9283 | 9333 | SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, u32 addr, int P1); |
| 9284 | 9334 | SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, u32 addr, int P2); |
| 9285 | 9335 | SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe*, u32 addr, int P3); |
| 9286 | 9336 | SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe*, u8 P5); |
| @@ -9317,12 +9367,15 @@ | ||
| 9317 | 9367 | #ifndef SQLITE_OMIT_TRACE |
| 9318 | 9368 | SQLITE_PRIVATE char *sqlite3VdbeExpandSql(Vdbe*, const char*); |
| 9319 | 9369 | #endif |
| 9320 | 9370 | |
| 9321 | 9371 | 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); | |
| 9323 | 9373 | 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*); | |
| 9324 | 9377 | |
| 9325 | 9378 | #ifndef SQLITE_OMIT_TRIGGER |
| 9326 | 9379 | SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *); |
| 9327 | 9380 | #endif |
| 9328 | 9381 | |
| @@ -9347,10 +9400,47 @@ | ||
| 9347 | 9400 | # define VdbeComment(X) |
| 9348 | 9401 | # define VdbeNoopComment(X) |
| 9349 | 9402 | # define VdbeModuleComment(X) |
| 9350 | 9403 | #endif |
| 9351 | 9404 | |
| 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 | + | |
| 9352 | 9442 | #endif |
| 9353 | 9443 | |
| 9354 | 9444 | /************** End of vdbe.h ************************************************/ |
| 9355 | 9445 | /************** Continuing where we left off in sqliteInt.h ******************/ |
| 9356 | 9446 | /************** Include pager.h in the middle of sqliteInt.h *****************/ |
| @@ -10404,12 +10494,11 @@ | ||
| 10404 | 10494 | |
| 10405 | 10495 | /* |
| 10406 | 10496 | ** Return true if it OK to factor constant expressions into the initialization |
| 10407 | 10497 | ** code. The argument is a Parse object for the code generator. |
| 10408 | 10498 | */ |
| 10409 | -#define ConstFactorOk(P) \ | |
| 10410 | - ((P)->cookieGoto>0 && OptimizationEnabled((P)->db,SQLITE_FactorOutConst)) | |
| 10499 | +#define ConstFactorOk(P) ((P)->okConstFactor) | |
| 10411 | 10500 | |
| 10412 | 10501 | /* |
| 10413 | 10502 | ** Possible values for the sqlite.magic field. |
| 10414 | 10503 | ** The numbers are obtained at random and have no special meaning, other |
| 10415 | 10504 | ** than being distinct from one another. |
| @@ -10631,14 +10720,20 @@ | ||
| 10631 | 10720 | #define SQLITE_AFF_MASK 0x67 |
| 10632 | 10721 | |
| 10633 | 10722 | /* |
| 10634 | 10723 | ** Additional bit values that can be ORed with an affinity without |
| 10635 | 10724 | ** 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. | |
| 10636 | 10730 | */ |
| 10637 | 10731 | #define SQLITE_JUMPIFNULL 0x08 /* jumps if either operand is NULL */ |
| 10638 | 10732 | #define SQLITE_STOREP2 0x10 /* Store result in reg[P2] rather than jump */ |
| 10639 | 10733 | #define SQLITE_NULLEQ 0x80 /* NULL=NULL */ |
| 10734 | +#define SQLITE_NOTNULL 0x88 /* Assert that operands are never NULL */ | |
| 10640 | 10735 | |
| 10641 | 10736 | /* |
| 10642 | 10737 | ** An object of this type is created for each virtual table present in |
| 10643 | 10738 | ** the database schema. |
| 10644 | 10739 | ** |
| @@ -10893,23 +10988,23 @@ | ||
| 10893 | 10988 | ** the OP_MakeRecord opcode of the VDBE and is disassembled by the |
| 10894 | 10989 | ** OP_Column opcode. |
| 10895 | 10990 | ** |
| 10896 | 10991 | ** This structure holds a record that has already been disassembled |
| 10897 | 10992 | ** into its constituent fields. |
| 10993 | +** | |
| 10994 | +** The r1 and r2 member variables are only used by the optimized comparison | |
| 10995 | +** functions vdbeRecordCompareInt() and vdbeRecordCompareString(). | |
| 10898 | 10996 | */ |
| 10899 | 10997 | struct UnpackedRecord { |
| 10900 | 10998 | KeyInfo *pKeyInfo; /* Collation and sort-order information */ |
| 10901 | 10999 | u16 nField; /* Number of entries in apMem[] */ |
| 10902 | - u8 flags; /* Boolean settings. UNPACKED_... below */ | |
| 11000 | + i8 default_rc; /* Comparison result if keys are equal */ | |
| 10903 | 11001 | Mem *aMem; /* Values */ |
| 11002 | + int r1; /* Value to return if (lhs > rhs) */ | |
| 11003 | + int r2; /* Value to return if (rhs < lhs) */ | |
| 10904 | 11004 | }; |
| 10905 | 11005 | |
| 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 */ | |
| 10911 | 11006 | |
| 10912 | 11007 | /* |
| 10913 | 11008 | ** Each SQL index is represented in memory by an |
| 10914 | 11009 | ** instance of the following structure. |
| 10915 | 11010 | ** |
| @@ -11325,21 +11420,22 @@ | ||
| 11325 | 11420 | ** |
| 11326 | 11421 | ** In the colUsed field, the high-order bit (bit 63) is set if the table |
| 11327 | 11422 | ** contains more than 63 columns and the 64-th or later column is used. |
| 11328 | 11423 | */ |
| 11329 | 11424 | 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 */ | |
| 11332 | 11427 | struct SrcList_item { |
| 11333 | 11428 | Schema *pSchema; /* Schema to which this item is fixed */ |
| 11334 | 11429 | char *zDatabase; /* Name of database holding this table */ |
| 11335 | 11430 | char *zName; /* Name of the table */ |
| 11336 | 11431 | char *zAlias; /* The "B" part of a "A AS B" phrase. zName is the "A" */ |
| 11337 | 11432 | Table *pTab; /* An SQL table corresponding to zName */ |
| 11338 | 11433 | Select *pSelect; /* A SELECT statement used in place of a table name */ |
| 11339 | 11434 | int addrFillSub; /* Address of subroutine to manifest a subquery */ |
| 11340 | 11435 | int regReturn; /* Register holding return address of addrFillSub */ |
| 11436 | + int regResult; /* Registers holding results of a co-routine */ | |
| 11341 | 11437 | u8 jointype; /* Type of join between this able and the previous */ |
| 11342 | 11438 | unsigned notIndexed :1; /* True if there is a NOT INDEXED clause */ |
| 11343 | 11439 | unsigned isCorrelated :1; /* True if sub-query is correlated */ |
| 11344 | 11440 | unsigned viaCoroutine :1; /* Implemented as a co-routine */ |
| 11345 | 11441 | unsigned isRecursive :1; /* True for recursive reference in WITH */ |
| @@ -11464,11 +11560,10 @@ | ||
| 11464 | 11560 | ExprList *pGroupBy; /* The GROUP BY clause */ |
| 11465 | 11561 | Expr *pHaving; /* The HAVING clause */ |
| 11466 | 11562 | ExprList *pOrderBy; /* The ORDER BY clause */ |
| 11467 | 11563 | Select *pPrior; /* Prior select in a compound select statement */ |
| 11468 | 11564 | Select *pNext; /* Next select to the left in a compound */ |
| 11469 | - Select *pRightmost; /* Right-most select in a compound select statement */ | |
| 11470 | 11565 | Expr *pLimit; /* LIMIT expression. NULL means not used. */ |
| 11471 | 11566 | Expr *pOffset; /* OFFSET expression. NULL means not used. */ |
| 11472 | 11567 | With *pWith; /* WITH clause attached to this select. Or NULL. */ |
| 11473 | 11568 | }; |
| 11474 | 11569 | |
| @@ -11482,14 +11577,15 @@ | ||
| 11482 | 11577 | #define SF_UsesEphemeral 0x0008 /* Uses the OpenEphemeral opcode */ |
| 11483 | 11578 | #define SF_Expanded 0x0010 /* sqlite3SelectExpand() called on this */ |
| 11484 | 11579 | #define SF_HasTypeInfo 0x0020 /* FROM subqueries have Table metadata */ |
| 11485 | 11580 | #define SF_UseSorter 0x0040 /* Sort using a sorter */ |
| 11486 | 11581 | #define SF_Values 0x0080 /* Synthesized from VALUES clause */ |
| 11487 | -#define SF_Materialize 0x0100 /* Force materialization of views */ | |
| 11582 | +#define SF_Materialize 0x0100 /* NOT USED */ | |
| 11488 | 11583 | #define SF_NestedFrom 0x0200 /* Part of a parenthesized FROM clause */ |
| 11489 | 11584 | #define SF_MaybeConvert 0x0400 /* Need convertCompoundSelectToSubquery() */ |
| 11490 | 11585 | #define SF_Recursive 0x0800 /* The recursive part of a recursive CTE */ |
| 11586 | +#define SF_Compound 0x1000 /* Part of a compound query */ | |
| 11491 | 11587 | |
| 11492 | 11588 | |
| 11493 | 11589 | /* |
| 11494 | 11590 | ** The results of a SELECT can be distributed in several ways, as defined |
| 11495 | 11591 | ** by one of the following macros. The "SRT" prefix means "SELECT Result |
| @@ -11664,49 +11760,48 @@ | ||
| 11664 | 11760 | int rc; /* Return code from execution */ |
| 11665 | 11761 | u8 colNamesSet; /* TRUE after OP_ColumnName has been issued to pVdbe */ |
| 11666 | 11762 | u8 checkSchema; /* Causes schema cookie check after an error */ |
| 11667 | 11763 | u8 nested; /* Number of nested calls to the parser/code generator */ |
| 11668 | 11764 | u8 nTempReg; /* Number of temporary registers in aTempReg[] */ |
| 11669 | - u8 nTempInUse; /* Number of aTempReg[] currently checked out */ | |
| 11670 | 11765 | u8 nColCache; /* Number of entries in aColCache[] */ |
| 11671 | 11766 | u8 iColCache; /* Next entry in aColCache[] to replace */ |
| 11672 | 11767 | u8 isMultiWrite; /* True if statement may modify/insert multiple rows */ |
| 11673 | 11768 | u8 mayAbort; /* True if statement may throw an ABORT exception */ |
| 11674 | 11769 | u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */ |
| 11770 | + u8 okConstFactor; /* OK to factor out constants */ | |
| 11675 | 11771 | int aTempReg[8]; /* Holding area for temporary registers */ |
| 11676 | 11772 | int nRangeReg; /* Size of the temporary register block */ |
| 11677 | 11773 | int iRangeReg; /* First register in temporary register block */ |
| 11678 | 11774 | int nErr; /* Number of errors seen */ |
| 11679 | 11775 | int nTab; /* Number of previously allocated VDBE cursors */ |
| 11680 | 11776 | int nMem; /* Number of memory cells used so far */ |
| 11681 | 11777 | int nSet; /* Number of sets used so far */ |
| 11682 | 11778 | int nOnce; /* Number of OP_Once instructions so far */ |
| 11683 | 11779 | int nOpAlloc; /* Number of slots allocated for Vdbe.aOp[] */ |
| 11684 | - int nLabel; /* Number of labels used */ | |
| 11685 | - int *aLabel; /* Space to hold the labels */ | |
| 11686 | 11780 | int iFixedOp; /* Never back out opcodes iFixedOp-1 or earlier */ |
| 11687 | 11781 | int ckBase; /* Base register of data during check constraints */ |
| 11688 | 11782 | int iPartIdxTab; /* Table corresponding to a partial index */ |
| 11689 | 11783 | int iCacheLevel; /* ColCache valid when aColCache[].iLevel<=iCacheLevel */ |
| 11690 | 11784 | int iCacheCnt; /* Counter used to generate aColCache[].lru values */ |
| 11785 | + int nLabel; /* Number of labels used */ | |
| 11786 | + int *aLabel; /* Space to hold the labels */ | |
| 11691 | 11787 | struct yColCache { |
| 11692 | 11788 | int iTable; /* Table cursor number */ |
| 11693 | - int iColumn; /* Table column number */ | |
| 11789 | + i16 iColumn; /* Table column number */ | |
| 11694 | 11790 | u8 tempReg; /* iReg is a temp register that needs to be freed */ |
| 11695 | 11791 | int iLevel; /* Nesting level */ |
| 11696 | 11792 | int iReg; /* Reg with value of this column. 0 means none. */ |
| 11697 | 11793 | int lru; /* Least recently used entry has the smallest value */ |
| 11698 | 11794 | } aColCache[SQLITE_N_COLCACHE]; /* One for each column cache entry */ |
| 11699 | 11795 | ExprList *pConstExpr;/* Constant expressions */ |
| 11796 | + Token constraintName;/* Name of the constraint currently being parsed */ | |
| 11700 | 11797 | yDbMask writeMask; /* Start a write transaction on these databases */ |
| 11701 | 11798 | yDbMask cookieMask; /* Bitmask of schema verified databases */ |
| 11702 | - int cookieGoto; /* Address of OP_Goto to cookie verifier subroutine */ | |
| 11703 | 11799 | int cookieValue[SQLITE_MAX_ATTACHED+2]; /* Values of cookies to verify */ |
| 11704 | 11800 | int regRowid; /* Register holding rowid of CREATE TABLE entry */ |
| 11705 | 11801 | int regRoot; /* Register holding root page number for new objects */ |
| 11706 | 11802 | int nMaxArg; /* Max args passed to user function by sub-program */ |
| 11707 | - Token constraintName;/* Name of the constraint currently being parsed */ | |
| 11708 | 11803 | #ifndef SQLITE_OMIT_SHARED_CACHE |
| 11709 | 11804 | int nTableLock; /* Number of locks in aTableLock */ |
| 11710 | 11805 | TableLock *aTableLock; /* Required table locks for shared-cache mode */ |
| 11711 | 11806 | #endif |
| 11712 | 11807 | AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */ |
| @@ -11721,16 +11816,21 @@ | ||
| 11721 | 11816 | u32 newmask; /* Mask of new.* columns referenced */ |
| 11722 | 11817 | u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */ |
| 11723 | 11818 | u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */ |
| 11724 | 11819 | u8 disableTriggers; /* True to disable triggers */ |
| 11725 | 11820 | |
| 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 | + ************************************************************************/ | |
| 11728 | 11827 | |
| 11729 | 11828 | int nVar; /* Number of '?' variables seen in the SQL so far */ |
| 11730 | 11829 | int nzVar; /* Number of available slots in azVar[] */ |
| 11731 | 11830 | u8 iPkSortOrder; /* ASC or DESC for INTEGER PRIMARY KEY */ |
| 11831 | + u8 bFreeWith; /* True if pWith should be freed with parser */ | |
| 11732 | 11832 | u8 explain; /* True if the EXPLAIN flag is found on the query */ |
| 11733 | 11833 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 11734 | 11834 | u8 declareVtab; /* True if inside sqlite3_declare_vtab() */ |
| 11735 | 11835 | int nVtabLock; /* Number of virtual tables to lock */ |
| 11736 | 11836 | #endif |
| @@ -11753,11 +11853,10 @@ | ||
| 11753 | 11853 | Table **apVtabLock; /* Pointer to virtual tables needing locking */ |
| 11754 | 11854 | #endif |
| 11755 | 11855 | Table *pZombieTab; /* List of Table objects to delete after code gen */ |
| 11756 | 11856 | TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */ |
| 11757 | 11857 | With *pWith; /* Current WITH clause, or NULL */ |
| 11758 | - u8 bFreeWith; /* True if pWith should be freed with parser */ | |
| 11759 | 11858 | }; |
| 11760 | 11859 | |
| 11761 | 11860 | /* |
| 11762 | 11861 | ** Return true if currently inside an sqlite3_declare_vtab() call. |
| 11763 | 11862 | */ |
| @@ -11969,10 +12068,17 @@ | ||
| 11969 | 12068 | int bLocaltimeFault; /* True to fail localtime() calls */ |
| 11970 | 12069 | #ifdef SQLITE_ENABLE_SQLLOG |
| 11971 | 12070 | void(*xSqllog)(void*,sqlite3*,const char*, int); |
| 11972 | 12071 | void *pSqllogArg; |
| 11973 | 12072 | #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 | |
| 11974 | 12080 | }; |
| 11975 | 12081 | |
| 11976 | 12082 | /* |
| 11977 | 12083 | ** This macro is used inside of assert() statements to indicate that |
| 11978 | 12084 | ** the assert is only valid on a well-formed database. Instead of: |
| @@ -12302,11 +12408,10 @@ | ||
| 12302 | 12408 | SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse); |
| 12303 | 12409 | #else |
| 12304 | 12410 | # define sqlite3AutoincrementBegin(X) |
| 12305 | 12411 | # define sqlite3AutoincrementEnd(X) |
| 12306 | 12412 | #endif |
| 12307 | -SQLITE_PRIVATE int sqlite3CodeCoroutine(Parse*, Select*, SelectDest*); | |
| 12308 | 12413 | SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int); |
| 12309 | 12414 | SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*); |
| 12310 | 12415 | SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*); |
| 12311 | 12416 | SQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*); |
| 12312 | 12417 | SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int); |
| @@ -12350,15 +12455,16 @@ | ||
| 12350 | 12455 | SQLITE_PRIVATE void sqlite3ExprCachePush(Parse*); |
| 12351 | 12456 | SQLITE_PRIVATE void sqlite3ExprCachePop(Parse*, int); |
| 12352 | 12457 | SQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse*, int, int); |
| 12353 | 12458 | SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse*); |
| 12354 | 12459 | 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); | |
| 12356 | 12462 | SQLITE_PRIVATE void sqlite3ExprCodeAtInit(Parse*, Expr*, int, u8); |
| 12357 | 12463 | SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*); |
| 12358 | 12464 | SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse*, Expr*, int); |
| 12359 | -SQLITE_PRIVATE int sqlite3ExprCodeAndCache(Parse*, Expr*, int); | |
| 12465 | +SQLITE_PRIVATE void sqlite3ExprCodeAndCache(Parse*, Expr*, int); | |
| 12360 | 12466 | SQLITE_PRIVATE int sqlite3ExprCodeExprList(Parse*, ExprList*, int, u8); |
| 12361 | 12467 | #define SQLITE_ECEL_DUP 0x01 /* Deep, not shallow copies */ |
| 12362 | 12468 | #define SQLITE_ECEL_FACTOR 0x02 /* Factor out constant terms */ |
| 12363 | 12469 | SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse*, Expr*, int, int); |
| 12364 | 12470 | SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse*, Expr*, int, int); |
| @@ -12392,11 +12498,10 @@ | ||
| 12392 | 12498 | SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*); |
| 12393 | 12499 | SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*); |
| 12394 | 12500 | SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*); |
| 12395 | 12501 | SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr*, int*); |
| 12396 | 12502 | SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr*); |
| 12397 | -SQLITE_PRIVATE void sqlite3ExprCodeIsNullJump(Vdbe*, const Expr*, int, int); | |
| 12398 | 12503 | SQLITE_PRIVATE int sqlite3ExprNeedsNoAffinityChange(const Expr*, char); |
| 12399 | 12504 | SQLITE_PRIVATE int sqlite3IsRowid(const char*); |
| 12400 | 12505 | SQLITE_PRIVATE void sqlite3GenerateRowDelete(Parse*,Table*,Trigger*,int,int,int,i16,u8,u8,u8); |
| 12401 | 12506 | SQLITE_PRIVATE void sqlite3GenerateRowIndexDelete(Parse*, Table*, int, int, int*); |
| 12402 | 12507 | SQLITE_PRIVATE int sqlite3GenerateIndexKey(Parse*, Index*, int, int, int, int*,Index*,int); |
| @@ -12536,11 +12641,11 @@ | ||
| 12536 | 12641 | #define getVarint sqlite3GetVarint |
| 12537 | 12642 | #define putVarint sqlite3PutVarint |
| 12538 | 12643 | |
| 12539 | 12644 | |
| 12540 | 12645 | SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(Vdbe *, Index *); |
| 12541 | -SQLITE_PRIVATE void sqlite3TableAffinityStr(Vdbe *, Table *); | |
| 12646 | +SQLITE_PRIVATE void sqlite3TableAffinity(Vdbe*, Table*, int); | |
| 12542 | 12647 | SQLITE_PRIVATE char sqlite3CompareAffinity(Expr *pExpr, char aff2); |
| 12543 | 12648 | SQLITE_PRIVATE int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity); |
| 12544 | 12649 | SQLITE_PRIVATE char sqlite3ExprAffinity(Expr *pExpr); |
| 12545 | 12650 | SQLITE_PRIVATE int sqlite3Atoi64(const char*, i64*, int, u8); |
| 12546 | 12651 | SQLITE_PRIVATE void sqlite3Error(sqlite3*, int, const char*,...); |
| @@ -13348,10 +13453,13 @@ | ||
| 13348 | 13453 | #ifdef SQLITE_OMIT_COMPLETE |
| 13349 | 13454 | "OMIT_COMPLETE", |
| 13350 | 13455 | #endif |
| 13351 | 13456 | #ifdef SQLITE_OMIT_COMPOUND_SELECT |
| 13352 | 13457 | "OMIT_COMPOUND_SELECT", |
| 13458 | +#endif | |
| 13459 | +#ifdef SQLITE_OMIT_CTE | |
| 13460 | + "OMIT_CTE", | |
| 13353 | 13461 | #endif |
| 13354 | 13462 | #ifdef SQLITE_OMIT_DATETIME_FUNCS |
| 13355 | 13463 | "OMIT_DATETIME_FUNCS", |
| 13356 | 13464 | #endif |
| 13357 | 13465 | #ifdef SQLITE_OMIT_DECLTYPE |
| @@ -13640,11 +13748,10 @@ | ||
| 13640 | 13748 | u8 rowidIsValid; /* True if lastRowid is valid */ |
| 13641 | 13749 | u8 deferredMoveto; /* A call to sqlite3BtreeMoveto() is needed */ |
| 13642 | 13750 | Bool useRandomRowid:1;/* Generate new record numbers semi-randomly */ |
| 13643 | 13751 | Bool isTable:1; /* True if a table requiring integer keys */ |
| 13644 | 13752 | Bool isOrdered:1; /* True if the underlying table is BTREE_UNORDERED */ |
| 13645 | - Bool multiPseudo:1; /* Multi-register pseudo-cursor */ | |
| 13646 | 13753 | sqlite3_vtab_cursor *pVtabCursor; /* The cursor for a virtual table */ |
| 13647 | 13754 | i64 seqCount; /* Sequence counter */ |
| 13648 | 13755 | i64 movetoTarget; /* Argument to the deferred sqlite3BtreeMoveto() */ |
| 13649 | 13756 | i64 lastRowid; /* Rowid being deleted by OP_Delete */ |
| 13650 | 13757 | VdbeSorter *pSorter; /* Sorter object for OP_SorterOpen cursors */ |
| @@ -13734,11 +13841,10 @@ | ||
| 13734 | 13841 | RowSet *pRowSet; /* Used only when flags==MEM_RowSet */ |
| 13735 | 13842 | VdbeFrame *pFrame; /* Used when flags==MEM_Frame */ |
| 13736 | 13843 | } u; |
| 13737 | 13844 | int n; /* Number of characters in string value, excluding '\0' */ |
| 13738 | 13845 | u16 flags; /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */ |
| 13739 | - u8 type; /* One of SQLITE_NULL, SQLITE_TEXT, SQLITE_INTEGER, etc */ | |
| 13740 | 13846 | u8 enc; /* SQLITE_UTF8, SQLITE_UTF16BE, SQLITE_UTF16LE */ |
| 13741 | 13847 | #ifdef SQLITE_DEBUG |
| 13742 | 13848 | Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */ |
| 13743 | 13849 | void *pFiller; /* So that sizeof(Mem) is a multiple of 8 */ |
| 13744 | 13850 | #endif |
| @@ -13761,13 +13867,14 @@ | ||
| 13761 | 13867 | #define MEM_Null 0x0001 /* Value is NULL */ |
| 13762 | 13868 | #define MEM_Str 0x0002 /* Value is a string */ |
| 13763 | 13869 | #define MEM_Int 0x0004 /* Value is an integer */ |
| 13764 | 13870 | #define MEM_Real 0x0008 /* Value is a real number */ |
| 13765 | 13871 | #define MEM_Blob 0x0010 /* Value is a BLOB */ |
| 13872 | +#define MEM_AffMask 0x001f /* Mask of affinity bits */ | |
| 13766 | 13873 | #define MEM_RowSet 0x0020 /* Value is a RowSet object */ |
| 13767 | 13874 | #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 */ | |
| 13769 | 13876 | #define MEM_Cleared 0x0100 /* NULL set by OP_Null, not from data */ |
| 13770 | 13877 | #define MEM_TypeMask 0x01ff /* Mask of type bits */ |
| 13771 | 13878 | |
| 13772 | 13879 | |
| 13773 | 13880 | /* Whenever Mem contains a valid string or blob representation, one of |
| @@ -13774,11 +13881,11 @@ | ||
| 13774 | 13881 | ** the following flags must be set to determine the memory management |
| 13775 | 13882 | ** policy for Mem.z. The MEM_Term flag tells us whether or not the |
| 13776 | 13883 | ** string is \000 or \u0000 terminated |
| 13777 | 13884 | */ |
| 13778 | 13885 | #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 */ | |
| 13780 | 13887 | #define MEM_Static 0x0800 /* Mem.z points to a static string */ |
| 13781 | 13888 | #define MEM_Ephem 0x1000 /* Mem.z points to an ephemeral string */ |
| 13782 | 13889 | #define MEM_Agg 0x2000 /* Mem.z points to an agg function context */ |
| 13783 | 13890 | #define MEM_Zero 0x4000 /* Mem.i contains count of 0s appended to blob */ |
| 13784 | 13891 | #ifdef SQLITE_OMIT_INCRBLOB |
| @@ -13795,11 +13902,11 @@ | ||
| 13795 | 13902 | /* |
| 13796 | 13903 | ** Return true if a memory cell is not marked as invalid. This macro |
| 13797 | 13904 | ** is for use inside assert() statements only. |
| 13798 | 13905 | */ |
| 13799 | 13906 | #ifdef SQLITE_DEBUG |
| 13800 | -#define memIsValid(M) ((M)->flags & MEM_Invalid)==0 | |
| 13907 | +#define memIsValid(M) ((M)->flags & MEM_Undefined)==0 | |
| 13801 | 13908 | #endif |
| 13802 | 13909 | |
| 13803 | 13910 | /* |
| 13804 | 13911 | ** Each auxilliary data pointer stored by a user defined function |
| 13805 | 13912 | ** implementation calling sqlite3_set_auxdata() is stored in an instance |
| @@ -13957,11 +14064,11 @@ | ||
| 13957 | 14064 | SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32); |
| 13958 | 14065 | SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*); |
| 13959 | 14066 | SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(Vdbe*, int, int); |
| 13960 | 14067 | |
| 13961 | 14068 | 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*); | |
| 13963 | 14070 | SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3*, BtCursor *, i64 *); |
| 13964 | 14071 | SQLITE_PRIVATE int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*); |
| 13965 | 14072 | SQLITE_PRIVATE int sqlite3VdbeExec(Vdbe*); |
| 13966 | 14073 | SQLITE_PRIVATE int sqlite3VdbeList(Vdbe*); |
| 13967 | 14074 | SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe*); |
| @@ -13990,20 +14097,20 @@ | ||
| 13990 | 14097 | SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem*); |
| 13991 | 14098 | SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem*); |
| 13992 | 14099 | SQLITE_PRIVATE int sqlite3VdbeMemFromBtree(BtCursor*,u32,u32,int,Mem*); |
| 13993 | 14100 | SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p); |
| 13994 | 14101 | SQLITE_PRIVATE void sqlite3VdbeMemReleaseExternal(Mem *p); |
| 14102 | +#define VdbeMemDynamic(X) \ | |
| 14103 | + (((X)->flags&(MEM_Agg|MEM_Dyn|MEM_RowSet|MEM_Frame))!=0) | |
| 13995 | 14104 | #define VdbeMemRelease(X) \ |
| 13996 | - if((X)->flags&(MEM_Agg|MEM_Dyn|MEM_RowSet|MEM_Frame)) \ | |
| 13997 | - sqlite3VdbeMemReleaseExternal(X); | |
| 14105 | + if( VdbeMemDynamic(X) ) sqlite3VdbeMemReleaseExternal(X); | |
| 13998 | 14106 | SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem*, FuncDef*); |
| 13999 | 14107 | SQLITE_PRIVATE const char *sqlite3OpcodeName(int); |
| 14000 | 14108 | SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve); |
| 14001 | 14109 | SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int); |
| 14002 | 14110 | SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame*); |
| 14003 | 14111 | SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *); |
| 14004 | -SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem); | |
| 14005 | 14112 | SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p); |
| 14006 | 14113 | |
| 14007 | 14114 | SQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *, VdbeCursor *); |
| 14008 | 14115 | SQLITE_PRIVATE void sqlite3VdbeSorterClose(sqlite3 *, VdbeCursor *); |
| 14009 | 14116 | SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(const VdbeCursor *, Mem *); |
| @@ -14020,10 +14127,11 @@ | ||
| 14020 | 14127 | # define sqlite3VdbeLeave(X) |
| 14021 | 14128 | #endif |
| 14022 | 14129 | |
| 14023 | 14130 | #ifdef SQLITE_DEBUG |
| 14024 | 14131 | SQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe*,Mem*); |
| 14132 | +SQLITE_PRIVATE int sqlite3VdbeCheckMemInvariants(Mem*); | |
| 14025 | 14133 | #endif |
| 14026 | 14134 | |
| 14027 | 14135 | #ifndef SQLITE_OMIT_FOREIGN_KEY |
| 14028 | 14136 | SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *, int); |
| 14029 | 14137 | #else |
| @@ -17767,10 +17875,16 @@ | ||
| 17767 | 17875 | mem5.totalExcess += iFullSz - nByte; |
| 17768 | 17876 | mem5.currentCount++; |
| 17769 | 17877 | mem5.currentOut += iFullSz; |
| 17770 | 17878 | if( mem5.maxCount<mem5.currentCount ) mem5.maxCount = mem5.currentCount; |
| 17771 | 17879 | 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 | |
| 17772 | 17886 | |
| 17773 | 17887 | /* Return a pointer to the allocated memory. */ |
| 17774 | 17888 | return (void*)&mem5.zPool[i*mem5.szAtom]; |
| 17775 | 17889 | } |
| 17776 | 17890 | |
| @@ -17825,10 +17939,17 @@ | ||
| 17825 | 17939 | mem5.aCtrl[iBlock] = CTRL_FREE | iLogsize; |
| 17826 | 17940 | mem5.aCtrl[iBuddy] = 0; |
| 17827 | 17941 | } |
| 17828 | 17942 | size *= 2; |
| 17829 | 17943 | } |
| 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 | + | |
| 17830 | 17951 | memsys5Link(iBlock, iLogsize); |
| 17831 | 17952 | } |
| 17832 | 17953 | |
| 17833 | 17954 | /* |
| 17834 | 17955 | ** Allocate nBytes of memory. |
| @@ -21390,11 +21511,11 @@ | ||
| 21390 | 21511 | assert( (pMem->n+(desiredEnc==SQLITE_UTF8?1:2))<=len ); |
| 21391 | 21512 | |
| 21392 | 21513 | sqlite3VdbeMemRelease(pMem); |
| 21393 | 21514 | pMem->flags &= ~(MEM_Static|MEM_Dyn|MEM_Ephem); |
| 21394 | 21515 | pMem->enc = desiredEnc; |
| 21395 | - pMem->flags |= (MEM_Term|MEM_Dyn); | |
| 21516 | + pMem->flags |= (MEM_Term); | |
| 21396 | 21517 | pMem->z = (char*)zOut; |
| 21397 | 21518 | pMem->zMalloc = pMem->z; |
| 21398 | 21519 | |
| 21399 | 21520 | translate_out: |
| 21400 | 21521 | #if defined(TRANSLATE_TRACE) && defined(SQLITE_DEBUG) |
| @@ -21518,11 +21639,10 @@ | ||
| 21518 | 21639 | sqlite3VdbeMemRelease(&m); |
| 21519 | 21640 | m.z = 0; |
| 21520 | 21641 | } |
| 21521 | 21642 | assert( (m.flags & MEM_Term)!=0 || db->mallocFailed ); |
| 21522 | 21643 | assert( (m.flags & MEM_Str)!=0 || db->mallocFailed ); |
| 21523 | - assert( (m.flags & MEM_Dyn)!=0 || db->mallocFailed ); | |
| 21524 | 21644 | assert( m.z || db->mallocFailed ); |
| 21525 | 21645 | return m.z; |
| 21526 | 21646 | } |
| 21527 | 21647 | |
| 21528 | 21648 | /* |
| @@ -22728,17 +22848,16 @@ | ||
| 22728 | 22848 | testcase( iB==-1 ); testcase( iB==0 ); |
| 22729 | 22849 | if( iB>=0 ){ |
| 22730 | 22850 | testcase( iA>0 && LARGEST_INT64 - iA == iB ); |
| 22731 | 22851 | testcase( iA>0 && LARGEST_INT64 - iA == iB - 1 ); |
| 22732 | 22852 | if( iA>0 && LARGEST_INT64 - iA < iB ) return 1; |
| 22733 | - *pA += iB; | |
| 22734 | 22853 | }else{ |
| 22735 | 22854 | testcase( iA<0 && -(iA + LARGEST_INT64) == iB + 1 ); |
| 22736 | 22855 | testcase( iA<0 && -(iA + LARGEST_INT64) == iB + 2 ); |
| 22737 | 22856 | if( iA<0 && -(iA + LARGEST_INT64) > iB + 1 ) return 1; |
| 22738 | - *pA += iB; | |
| 22739 | 22857 | } |
| 22858 | + *pA += iB; | |
| 22740 | 22859 | return 0; |
| 22741 | 22860 | } |
| 22742 | 22861 | SQLITE_PRIVATE int sqlite3SubInt64(i64 *pA, i64 iB){ |
| 22743 | 22862 | testcase( iB==SMALLEST_INT64+1 ); |
| 22744 | 22863 | if( iB==SMALLEST_INT64 ){ |
| @@ -22758,13 +22877,22 @@ | ||
| 22758 | 22877 | |
| 22759 | 22878 | iA1 = iA/TWOPOWER32; |
| 22760 | 22879 | iA0 = iA % TWOPOWER32; |
| 22761 | 22880 | iB1 = iB/TWOPOWER32; |
| 22762 | 22881 | 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 | + } | |
| 22766 | 22894 | testcase( r==(-TWOPOWER31)-1 ); |
| 22767 | 22895 | testcase( r==(-TWOPOWER31) ); |
| 22768 | 22896 | testcase( r==TWOPOWER31 ); |
| 22769 | 22897 | testcase( r==TWOPOWER31-1 ); |
| 22770 | 22898 | if( r<(-TWOPOWER31) || r>=TWOPOWER31 ) return 1; |
| @@ -23206,75 +23334,75 @@ | ||
| 23206 | 23334 | /* 15 */ "VUpdate" OpHelp("data=r[P3@P2]"), |
| 23207 | 23335 | /* 16 */ "Goto" OpHelp(""), |
| 23208 | 23336 | /* 17 */ "Gosub" OpHelp(""), |
| 23209 | 23337 | /* 18 */ "Return" OpHelp(""), |
| 23210 | 23338 | /* 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]"), | |
| 23262 | 23390 | /* 71 */ "Or" OpHelp("r[P3]=(r[P1] || r[P2])"), |
| 23263 | 23391 | /* 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(""), | |
| 23267 | 23395 | /* 76 */ "IsNull" OpHelp("if r[P1]==NULL goto P2"), |
| 23268 | 23396 | /* 77 */ "NotNull" OpHelp("if r[P1]!=NULL goto P2"), |
| 23269 | 23397 | /* 78 */ "Ne" OpHelp("if r[P1]!=r[P3] goto P2"), |
| 23270 | 23398 | /* 79 */ "Eq" OpHelp("if r[P1]==r[P3] goto P2"), |
| 23271 | 23399 | /* 80 */ "Gt" OpHelp("if r[P1]>r[P3] goto P2"), |
| 23272 | 23400 | /* 81 */ "Le" OpHelp("if r[P1]<=r[P3] goto P2"), |
| 23273 | 23401 | /* 82 */ "Lt" OpHelp("if r[P1]<r[P3] goto P2"), |
| 23274 | 23402 | /* 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"), | |
| 23276 | 23404 | /* 85 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"), |
| 23277 | 23405 | /* 86 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"), |
| 23278 | 23406 | /* 87 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"), |
| 23279 | 23407 | /* 88 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"), |
| 23280 | 23408 | /* 89 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"), |
| @@ -23281,68 +23409,72 @@ | ||
| 23281 | 23409 | /* 90 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"), |
| 23282 | 23410 | /* 91 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"), |
| 23283 | 23411 | /* 92 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"), |
| 23284 | 23412 | /* 93 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"), |
| 23285 | 23413 | /* 94 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"), |
| 23286 | - /* 95 */ "RowData" OpHelp("r[P2]=data"), | |
| 23414 | + /* 95 */ "SorterData" OpHelp("r[P2]=data"), | |
| 23287 | 23415 | /* 96 */ "BitNot" OpHelp("r[P1]= ~r[P1]"), |
| 23288 | 23416 | /* 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 |