Fossil SCM
merge trunk
Commit
d7f04ea46fbf65b4e323e2e98f7225a9225bf4d2
Parent
f93b4b4db4a7ebc…
72 files changed
+2
-2
+12
-12
+4
-2
+8
+18
-1
+2
-2
+7
-38
+1
-1
+11
-5
+1
-2
+1
-1
+5
-5
+5
-5
+3
-3
+51
+1
+11
-1
+9
-5
+180
-75
+94
-32
+10
-10
+68
-5
+92
-9
+122
-98
+3
-3
+1
-1
+1
+14
+6
-9
+14
-2
+5
-1
+173
-68
+1
-2
+7
-1
-13
+9
-9
+13
-1
+47
-16
+7
-7
+2505
-1860
+5
-4
+6
-1
+7
-3
+5
+1
-1
+1
+24
-24
+31
-31
+11
-13
+24
-5
+20
+12
-12
+118
-96
+2
-1
+1
+5
+3
-21
+66
-55
+48
+1
-1
+1
-1
+1
-1
+11
-5
+16
-1
+16
-1
+13
+1
+12
-2
+21
-21
+1
-1
+23
+67
~
BUILD.txt
~
COPYRIGHT-BSD2.txt
~
Makefile.Cygwin.in
~
src/add.c
~
src/allrepo.c
~
src/attach.c
~
src/blob.c
~
src/branch.c
~
src/browse.c
~
src/captcha.c
~
src/cgi.c
~
src/checkin.c
~
src/checkin.c
~
src/checkout.c
~
src/clone.c
~
src/comformat.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_timeline.c
~
src/json_wiki.c
~
src/loadctrl.c
~
src/login.c
~
src/main.c
~
src/main.mk
~
src/makemake.tcl
~
src/name.c
~
src/popen.c
~
src/rebuild.c
~
src/report.c
~
src/schema.c
~
src/setup.c
~
src/shell.c
~
src/shun.c
~
src/sqlite3.c
~
src/sqlite3.h
~
src/stash.c
~
src/style.c
~
src/sync.c
~
src/tag.c
~
src/tar.c
~
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/merge_renames.test
~
test/revert.test
~
test/tester.tcl
~
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/quickstart.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 |
+4
-2
| --- Makefile.Cygwin.in | ||
| +++ Makefile.Cygwin.in | ||
| @@ -36,17 +36,19 @@ | ||
| 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 | -SQLITE_CFLAGS += -DSQLITE_WIN32_NO_ANSI -DSQLITE_WINNT_MAX_PATH_CHARS=4096 | |
| 47 | +SQLITE_CFLAGS += -DSQLITE_WIN32_NO_ANSI | |
| 48 | +SQLITE_CFLAGS += -DSQLITE_WIN32_MAX_PATH_BYTES=4096 | |
| 49 | +SQLITE_CFLAGS += -DSQLITE_MAX_MMAP_SIZE=0x7fff0000 | |
| 48 | 50 | |
| 49 | 51 | include $(SRCDIR)/main.mk |
| 50 | 52 | |
| 51 | 53 | distclean: clean |
| 52 | 54 | rm -f autoconfig.h config.log Makefile |
| 53 | 55 |
| --- Makefile.Cygwin.in | |
| +++ Makefile.Cygwin.in | |
| @@ -36,17 +36,19 @@ | |
| 36 | # care about testing the end result, this can be blank. |
| 37 | # |
| 38 | TCLSH = tclsh |
| 39 | |
| 40 | LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@ |
| 41 | TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H |
| 42 | INSTALLDIR =$(DESTDIR)@prefix@/bin |
| 43 | USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@ |
| 44 | FOSSIL_ENABLE_TCL = @FOSSIL_ENABLE_TCL@ |
| 45 | FOSSIL_ENABLE_TCL_STUBS = @FOSSIL_ENABLE_TCL_STUBS@ |
| 46 | FOSSIL_ENABLE_TCL_PRIVATE_STUBS = @FOSSIL_ENABLE_TCL_PRIVATE_STUBS@ |
| 47 | SQLITE_CFLAGS += -DSQLITE_WIN32_NO_ANSI -DSQLITE_WINNT_MAX_PATH_CHARS=4096 |
| 48 | |
| 49 | include $(SRCDIR)/main.mk |
| 50 | |
| 51 | distclean: clean |
| 52 | rm -f autoconfig.h config.log Makefile |
| 53 |
| --- Makefile.Cygwin.in | |
| +++ Makefile.Cygwin.in | |
| @@ -36,17 +36,19 @@ | |
| 36 | # care about testing the end result, this can be blank. |
| 37 | # |
| 38 | TCLSH = tclsh |
| 39 | |
| 40 | LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@ |
| 41 | TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H -DFOSSIL_OMIT_LOAD_AVERAGE |
| 42 | INSTALLDIR =$(DESTDIR)@prefix@/bin |
| 43 | USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@ |
| 44 | FOSSIL_ENABLE_TCL = @FOSSIL_ENABLE_TCL@ |
| 45 | FOSSIL_ENABLE_TCL_STUBS = @FOSSIL_ENABLE_TCL_STUBS@ |
| 46 | FOSSIL_ENABLE_TCL_PRIVATE_STUBS = @FOSSIL_ENABLE_TCL_PRIVATE_STUBS@ |
| 47 | SQLITE_CFLAGS += -DSQLITE_WIN32_NO_ANSI |
| 48 | SQLITE_CFLAGS += -DSQLITE_WIN32_MAX_PATH_BYTES=4096 |
| 49 | SQLITE_CFLAGS += -DSQLITE_MAX_MMAP_SIZE=0x7fff0000 |
| 50 | |
| 51 | include $(SRCDIR)/main.mk |
| 52 | |
| 53 | distclean: clean |
| 54 | rm -f autoconfig.h config.log Makefile |
| 55 |
+8
| --- src/add.c | ||
| +++ src/add.c | ||
| @@ -692,5 +692,13 @@ | ||
| 692 | 692 | mv_one_file(vid, zFrom, zTo); |
| 693 | 693 | } |
| 694 | 694 | db_finalize(&q); |
| 695 | 695 | db_end_transaction(0); |
| 696 | 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 | +} | |
| 697 | 705 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -692,5 +692,13 @@ | |
| 692 | mv_one_file(vid, zFrom, zTo); |
| 693 | } |
| 694 | db_finalize(&q); |
| 695 | db_end_transaction(0); |
| 696 | } |
| 697 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -692,5 +692,13 @@ | |
| 692 | mv_one_file(vid, zFrom, zTo); |
| 693 | } |
| 694 | db_finalize(&q); |
| 695 | db_end_transaction(0); |
| 696 | } |
| 697 | |
| 698 | /* |
| 699 | ** Function for stash_apply to be able to restore a file and indicate |
| 700 | ** newly ADDED state. |
| 701 | */ |
| 702 | int stash_add_files_in_sfile(int vid){ |
| 703 | return add_files_in_sfile(vid); |
| 704 | } |
| 705 |
+18
-1
| --- src/allrepo.c | ||
| +++ src/allrepo.c | ||
| @@ -65,10 +65,16 @@ | ||
| 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
-1
| --- src/branch.c | ||
| +++ src/branch.c | ||
| @@ -134,11 +134,11 @@ | ||
| 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 | 145 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -134,11 +134,11 @@ | |
| 134 | const char *zTag = db_column_text(&q, 0); |
| 135 | blob_appendf(&branch, "T -%F *\n", zTag); |
| 136 | } |
| 137 | db_finalize(&q); |
| 138 | |
| 139 | blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin); |
| 140 | md5sum_blob(&branch, &mcksum); |
| 141 | blob_appendf(&branch, "Z %b\n", &mcksum); |
| 142 | if( !noSign && clearsign(&branch, &branch) ){ |
| 143 | Blob ans; |
| 144 | char cReply; |
| 145 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -134,11 +134,11 @@ | |
| 134 | const char *zTag = db_column_text(&q, 0); |
| 135 | blob_appendf(&branch, "T -%F *\n", zTag); |
| 136 | } |
| 137 | db_finalize(&q); |
| 138 | |
| 139 | blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : login_name()); |
| 140 | md5sum_blob(&branch, &mcksum); |
| 141 | blob_appendf(&branch, "Z %b\n", &mcksum); |
| 142 | if( !noSign && clearsign(&branch, &branch) ){ |
| 143 | Blob ans; |
| 144 | char cReply; |
| 145 |
+11
-5
| --- src/browse.c | ||
| +++ src/browse.c | ||
| @@ -732,20 +732,22 @@ | ||
| 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 |
+1
-1
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -874,11 +874,11 @@ | ||
| 874 | 874 | char *z; |
| 875 | 875 | const char *zType; |
| 876 | 876 | int len; |
| 877 | 877 | const char *zRequestUri = cgi_parameter("REQUEST_URI",0); |
| 878 | 878 | const char *zScriptName = cgi_parameter("SCRIPT_NAME",0); |
| 879 | - const char *zPathInfo = cgi_parameter("PATH_INFO",""); | |
| 879 | + const char *zPathInfo = cgi_parameter("PATH_INFO",0); | |
| 880 | 880 | |
| 881 | 881 | #ifdef FOSSIL_ENABLE_JSON |
| 882 | 882 | json_main_bootstrap(); |
| 883 | 883 | #endif |
| 884 | 884 | g.isHTTP = 1; |
| 885 | 885 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -874,11 +874,11 @@ | |
| 874 | char *z; |
| 875 | const char *zType; |
| 876 | int len; |
| 877 | const char *zRequestUri = cgi_parameter("REQUEST_URI",0); |
| 878 | const char *zScriptName = cgi_parameter("SCRIPT_NAME",0); |
| 879 | const char *zPathInfo = cgi_parameter("PATH_INFO",""); |
| 880 | |
| 881 | #ifdef FOSSIL_ENABLE_JSON |
| 882 | json_main_bootstrap(); |
| 883 | #endif |
| 884 | g.isHTTP = 1; |
| 885 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -874,11 +874,11 @@ | |
| 874 | char *z; |
| 875 | const char *zType; |
| 876 | int len; |
| 877 | const char *zRequestUri = cgi_parameter("REQUEST_URI",0); |
| 878 | const char *zScriptName = cgi_parameter("SCRIPT_NAME",0); |
| 879 | const char *zPathInfo = cgi_parameter("PATH_INFO",0); |
| 880 | |
| 881 | #ifdef FOSSIL_ENABLE_JSON |
| 882 | json_main_bootstrap(); |
| 883 | #endif |
| 884 | g.isHTTP = 1; |
| 885 |
+5
-5
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -843,11 +843,11 @@ | ||
| 843 | 843 | blob_append(&prompt, |
| 844 | 844 | "\n" |
| 845 | 845 | "# Enter commit message for this check-in. Lines beginning with # are ignored.\n" |
| 846 | 846 | "#\n", -1 |
| 847 | 847 | ); |
| 848 | - blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin); | |
| 848 | + blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : login_name()); | |
| 849 | 849 | if( p->zBranch && p->zBranch[0] ){ |
| 850 | 850 | blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch); |
| 851 | 851 | }else{ |
| 852 | 852 | char *zTags = info_tags_of_checkin(parent_rid, 1); |
| 853 | 853 | if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags); |
| @@ -1005,11 +1005,11 @@ | ||
| 1005 | 1005 | int verifyDate; /* Verify that child is younger */ |
| 1006 | 1006 | int closeFlag; /* Close the branch being committed */ |
| 1007 | 1007 | int integrateFlag; /* Close merged-in branches */ |
| 1008 | 1008 | Blob *pCksum; /* Repository checksum. May be 0 */ |
| 1009 | 1009 | const char *zDateOvrd; /* Date override. If 0 then use 'now' */ |
| 1010 | - const char *zUserOvrd; /* User override. If 0 then use g.zLogin */ | |
| 1010 | + const char *zUserOvrd; /* User override. If 0 then use login_name() */ | |
| 1011 | 1011 | const char *zBranch; /* Branch name. May be 0 */ |
| 1012 | 1012 | const char *zColor; /* One-time background color. May be 0 */ |
| 1013 | 1013 | const char *zBrClr; /* Persistent branch color. May be 0 */ |
| 1014 | 1014 | const char **azTag; /* Tags to apply to this check-in */ |
| 1015 | 1015 | }; |
| @@ -1231,11 +1231,11 @@ | ||
| 1231 | 1231 | const char *zBrTag = db_column_text(&q, 0); |
| 1232 | 1232 | blob_appendf(pOut, "T -%F *\n", zBrTag); |
| 1233 | 1233 | } |
| 1234 | 1234 | db_finalize(&q); |
| 1235 | 1235 | } |
| 1236 | - blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin); | |
| 1236 | + blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : login_name()); | |
| 1237 | 1237 | md5sum_blob(pOut, &mcksum); |
| 1238 | 1238 | blob_appendf(pOut, "Z %b\n", &mcksum); |
| 1239 | 1239 | if( pnFBcard ) *pnFBcard = nFBcard; |
| 1240 | 1240 | } |
| 1241 | 1241 | |
| @@ -1602,11 +1602,11 @@ | ||
| 1602 | 1602 | ** should be committed. |
| 1603 | 1603 | */ |
| 1604 | 1604 | if( select_commit_files() ){ |
| 1605 | 1605 | prompt_user("continue (y/N)? ", &ans); |
| 1606 | 1606 | cReply = blob_str(&ans)[0]; |
| 1607 | - if( cReply!='y' && cReply!='Y' ) fossil_exit(1);; | |
| 1607 | + if( cReply!='y' && cReply!='Y' ) fossil_exit(1); | |
| 1608 | 1608 | } |
| 1609 | 1609 | isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2"); |
| 1610 | 1610 | if( g.aCommitFile && isAMerge ){ |
| 1611 | 1611 | fossil_fatal("cannot do a partial commit of a merge"); |
| 1612 | 1612 | } |
| @@ -1702,11 +1702,11 @@ | ||
| 1702 | 1702 | char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'"); |
| 1703 | 1703 | prepare_commit_comment(&comment, zInit, &sCiInfo, vid); |
| 1704 | 1704 | if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){ |
| 1705 | 1705 | prompt_user("unchanged check-in comment. continue (y/N)? ", &ans); |
| 1706 | 1706 | cReply = blob_str(&ans)[0]; |
| 1707 | - if( cReply!='y' && cReply!='Y' ) fossil_exit(1);; | |
| 1707 | + if( cReply!='y' && cReply!='Y' ) fossil_exit(1); | |
| 1708 | 1708 | } |
| 1709 | 1709 | free(zInit); |
| 1710 | 1710 | } |
| 1711 | 1711 | if( blob_size(&comment)==0 ){ |
| 1712 | 1712 | if( !dryRunFlag ){ |
| 1713 | 1713 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -843,11 +843,11 @@ | |
| 843 | blob_append(&prompt, |
| 844 | "\n" |
| 845 | "# Enter commit message for this check-in. Lines beginning with # are ignored.\n" |
| 846 | "#\n", -1 |
| 847 | ); |
| 848 | blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin); |
| 849 | if( p->zBranch && p->zBranch[0] ){ |
| 850 | blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch); |
| 851 | }else{ |
| 852 | char *zTags = info_tags_of_checkin(parent_rid, 1); |
| 853 | if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags); |
| @@ -1005,11 +1005,11 @@ | |
| 1005 | int verifyDate; /* Verify that child is younger */ |
| 1006 | int closeFlag; /* Close the branch being committed */ |
| 1007 | int integrateFlag; /* Close merged-in branches */ |
| 1008 | Blob *pCksum; /* Repository checksum. May be 0 */ |
| 1009 | const char *zDateOvrd; /* Date override. If 0 then use 'now' */ |
| 1010 | const char *zUserOvrd; /* User override. If 0 then use g.zLogin */ |
| 1011 | const char *zBranch; /* Branch name. May be 0 */ |
| 1012 | const char *zColor; /* One-time background color. May be 0 */ |
| 1013 | const char *zBrClr; /* Persistent branch color. May be 0 */ |
| 1014 | const char **azTag; /* Tags to apply to this check-in */ |
| 1015 | }; |
| @@ -1231,11 +1231,11 @@ | |
| 1231 | const char *zBrTag = db_column_text(&q, 0); |
| 1232 | blob_appendf(pOut, "T -%F *\n", zBrTag); |
| 1233 | } |
| 1234 | db_finalize(&q); |
| 1235 | } |
| 1236 | blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin); |
| 1237 | md5sum_blob(pOut, &mcksum); |
| 1238 | blob_appendf(pOut, "Z %b\n", &mcksum); |
| 1239 | if( pnFBcard ) *pnFBcard = nFBcard; |
| 1240 | } |
| 1241 | |
| @@ -1602,11 +1602,11 @@ | |
| 1602 | ** should be committed. |
| 1603 | */ |
| 1604 | if( select_commit_files() ){ |
| 1605 | prompt_user("continue (y/N)? ", &ans); |
| 1606 | cReply = blob_str(&ans)[0]; |
| 1607 | if( cReply!='y' && cReply!='Y' ) fossil_exit(1);; |
| 1608 | } |
| 1609 | isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2"); |
| 1610 | if( g.aCommitFile && isAMerge ){ |
| 1611 | fossil_fatal("cannot do a partial commit of a merge"); |
| 1612 | } |
| @@ -1702,11 +1702,11 @@ | |
| 1702 | char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'"); |
| 1703 | prepare_commit_comment(&comment, zInit, &sCiInfo, vid); |
| 1704 | if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){ |
| 1705 | prompt_user("unchanged check-in comment. continue (y/N)? ", &ans); |
| 1706 | cReply = blob_str(&ans)[0]; |
| 1707 | if( cReply!='y' && cReply!='Y' ) fossil_exit(1);; |
| 1708 | } |
| 1709 | free(zInit); |
| 1710 | } |
| 1711 | if( blob_size(&comment)==0 ){ |
| 1712 | if( !dryRunFlag ){ |
| 1713 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -843,11 +843,11 @@ | |
| 843 | blob_append(&prompt, |
| 844 | "\n" |
| 845 | "# Enter commit message for this check-in. Lines beginning with # are ignored.\n" |
| 846 | "#\n", -1 |
| 847 | ); |
| 848 | blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : login_name()); |
| 849 | if( p->zBranch && p->zBranch[0] ){ |
| 850 | blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch); |
| 851 | }else{ |
| 852 | char *zTags = info_tags_of_checkin(parent_rid, 1); |
| 853 | if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags); |
| @@ -1005,11 +1005,11 @@ | |
| 1005 | int verifyDate; /* Verify that child is younger */ |
| 1006 | int closeFlag; /* Close the branch being committed */ |
| 1007 | int integrateFlag; /* Close merged-in branches */ |
| 1008 | Blob *pCksum; /* Repository checksum. May be 0 */ |
| 1009 | const char *zDateOvrd; /* Date override. If 0 then use 'now' */ |
| 1010 | const char *zUserOvrd; /* User override. If 0 then use login_name() */ |
| 1011 | const char *zBranch; /* Branch name. May be 0 */ |
| 1012 | const char *zColor; /* One-time background color. May be 0 */ |
| 1013 | const char *zBrClr; /* Persistent branch color. May be 0 */ |
| 1014 | const char **azTag; /* Tags to apply to this check-in */ |
| 1015 | }; |
| @@ -1231,11 +1231,11 @@ | |
| 1231 | const char *zBrTag = db_column_text(&q, 0); |
| 1232 | blob_appendf(pOut, "T -%F *\n", zBrTag); |
| 1233 | } |
| 1234 | db_finalize(&q); |
| 1235 | } |
| 1236 | blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : login_name()); |
| 1237 | md5sum_blob(pOut, &mcksum); |
| 1238 | blob_appendf(pOut, "Z %b\n", &mcksum); |
| 1239 | if( pnFBcard ) *pnFBcard = nFBcard; |
| 1240 | } |
| 1241 | |
| @@ -1602,11 +1602,11 @@ | |
| 1602 | ** should be committed. |
| 1603 | */ |
| 1604 | if( select_commit_files() ){ |
| 1605 | prompt_user("continue (y/N)? ", &ans); |
| 1606 | cReply = blob_str(&ans)[0]; |
| 1607 | if( cReply!='y' && cReply!='Y' ) fossil_exit(1); |
| 1608 | } |
| 1609 | isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2"); |
| 1610 | if( g.aCommitFile && isAMerge ){ |
| 1611 | fossil_fatal("cannot do a partial commit of a merge"); |
| 1612 | } |
| @@ -1702,11 +1702,11 @@ | |
| 1702 | char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'"); |
| 1703 | prepare_commit_comment(&comment, zInit, &sCiInfo, vid); |
| 1704 | if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){ |
| 1705 | prompt_user("unchanged check-in comment. continue (y/N)? ", &ans); |
| 1706 | cReply = blob_str(&ans)[0]; |
| 1707 | if( cReply!='y' && cReply!='Y' ) fossil_exit(1); |
| 1708 | } |
| 1709 | free(zInit); |
| 1710 | } |
| 1711 | if( blob_size(&comment)==0 ){ |
| 1712 | if( !dryRunFlag ){ |
| 1713 |
+5
-5
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -843,11 +843,11 @@ | ||
| 843 | 843 | blob_append(&prompt, |
| 844 | 844 | "\n" |
| 845 | 845 | "# Enter commit message for this check-in. Lines beginning with # are ignored.\n" |
| 846 | 846 | "#\n", -1 |
| 847 | 847 | ); |
| 848 | - blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin); | |
| 848 | + blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : login_name()); | |
| 849 | 849 | if( p->zBranch && p->zBranch[0] ){ |
| 850 | 850 | blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch); |
| 851 | 851 | }else{ |
| 852 | 852 | char *zTags = info_tags_of_checkin(parent_rid, 1); |
| 853 | 853 | if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags); |
| @@ -1005,11 +1005,11 @@ | ||
| 1005 | 1005 | int verifyDate; /* Verify that child is younger */ |
| 1006 | 1006 | int closeFlag; /* Close the branch being committed */ |
| 1007 | 1007 | int integrateFlag; /* Close merged-in branches */ |
| 1008 | 1008 | Blob *pCksum; /* Repository checksum. May be 0 */ |
| 1009 | 1009 | const char *zDateOvrd; /* Date override. If 0 then use 'now' */ |
| 1010 | - const char *zUserOvrd; /* User override. If 0 then use g.zLogin */ | |
| 1010 | + const char *zUserOvrd; /* User override. If 0 then use login_name() */ | |
| 1011 | 1011 | const char *zBranch; /* Branch name. May be 0 */ |
| 1012 | 1012 | const char *zColor; /* One-time background color. May be 0 */ |
| 1013 | 1013 | const char *zBrClr; /* Persistent branch color. May be 0 */ |
| 1014 | 1014 | const char **azTag; /* Tags to apply to this check-in */ |
| 1015 | 1015 | }; |
| @@ -1231,11 +1231,11 @@ | ||
| 1231 | 1231 | const char *zBrTag = db_column_text(&q, 0); |
| 1232 | 1232 | blob_appendf(pOut, "T -%F *\n", zBrTag); |
| 1233 | 1233 | } |
| 1234 | 1234 | db_finalize(&q); |
| 1235 | 1235 | } |
| 1236 | - blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin); | |
| 1236 | + blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : login_name()); | |
| 1237 | 1237 | md5sum_blob(pOut, &mcksum); |
| 1238 | 1238 | blob_appendf(pOut, "Z %b\n", &mcksum); |
| 1239 | 1239 | if( pnFBcard ) *pnFBcard = nFBcard; |
| 1240 | 1240 | } |
| 1241 | 1241 | |
| @@ -1602,11 +1602,11 @@ | ||
| 1602 | 1602 | ** should be committed. |
| 1603 | 1603 | */ |
| 1604 | 1604 | if( select_commit_files() ){ |
| 1605 | 1605 | prompt_user("continue (y/N)? ", &ans); |
| 1606 | 1606 | cReply = blob_str(&ans)[0]; |
| 1607 | - if( cReply!='y' && cReply!='Y' ) fossil_exit(1);; | |
| 1607 | + if( cReply!='y' && cReply!='Y' ) fossil_exit(1); | |
| 1608 | 1608 | } |
| 1609 | 1609 | isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2"); |
| 1610 | 1610 | if( g.aCommitFile && isAMerge ){ |
| 1611 | 1611 | fossil_fatal("cannot do a partial commit of a merge"); |
| 1612 | 1612 | } |
| @@ -1702,11 +1702,11 @@ | ||
| 1702 | 1702 | char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'"); |
| 1703 | 1703 | prepare_commit_comment(&comment, zInit, &sCiInfo, vid); |
| 1704 | 1704 | if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){ |
| 1705 | 1705 | prompt_user("unchanged check-in comment. continue (y/N)? ", &ans); |
| 1706 | 1706 | cReply = blob_str(&ans)[0]; |
| 1707 | - if( cReply!='y' && cReply!='Y' ) fossil_exit(1);; | |
| 1707 | + if( cReply!='y' && cReply!='Y' ) fossil_exit(1); | |
| 1708 | 1708 | } |
| 1709 | 1709 | free(zInit); |
| 1710 | 1710 | } |
| 1711 | 1711 | if( blob_size(&comment)==0 ){ |
| 1712 | 1712 | if( !dryRunFlag ){ |
| 1713 | 1713 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -843,11 +843,11 @@ | |
| 843 | blob_append(&prompt, |
| 844 | "\n" |
| 845 | "# Enter commit message for this check-in. Lines beginning with # are ignored.\n" |
| 846 | "#\n", -1 |
| 847 | ); |
| 848 | blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin); |
| 849 | if( p->zBranch && p->zBranch[0] ){ |
| 850 | blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch); |
| 851 | }else{ |
| 852 | char *zTags = info_tags_of_checkin(parent_rid, 1); |
| 853 | if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags); |
| @@ -1005,11 +1005,11 @@ | |
| 1005 | int verifyDate; /* Verify that child is younger */ |
| 1006 | int closeFlag; /* Close the branch being committed */ |
| 1007 | int integrateFlag; /* Close merged-in branches */ |
| 1008 | Blob *pCksum; /* Repository checksum. May be 0 */ |
| 1009 | const char *zDateOvrd; /* Date override. If 0 then use 'now' */ |
| 1010 | const char *zUserOvrd; /* User override. If 0 then use g.zLogin */ |
| 1011 | const char *zBranch; /* Branch name. May be 0 */ |
| 1012 | const char *zColor; /* One-time background color. May be 0 */ |
| 1013 | const char *zBrClr; /* Persistent branch color. May be 0 */ |
| 1014 | const char **azTag; /* Tags to apply to this check-in */ |
| 1015 | }; |
| @@ -1231,11 +1231,11 @@ | |
| 1231 | const char *zBrTag = db_column_text(&q, 0); |
| 1232 | blob_appendf(pOut, "T -%F *\n", zBrTag); |
| 1233 | } |
| 1234 | db_finalize(&q); |
| 1235 | } |
| 1236 | blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin); |
| 1237 | md5sum_blob(pOut, &mcksum); |
| 1238 | blob_appendf(pOut, "Z %b\n", &mcksum); |
| 1239 | if( pnFBcard ) *pnFBcard = nFBcard; |
| 1240 | } |
| 1241 | |
| @@ -1602,11 +1602,11 @@ | |
| 1602 | ** should be committed. |
| 1603 | */ |
| 1604 | if( select_commit_files() ){ |
| 1605 | prompt_user("continue (y/N)? ", &ans); |
| 1606 | cReply = blob_str(&ans)[0]; |
| 1607 | if( cReply!='y' && cReply!='Y' ) fossil_exit(1);; |
| 1608 | } |
| 1609 | isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2"); |
| 1610 | if( g.aCommitFile && isAMerge ){ |
| 1611 | fossil_fatal("cannot do a partial commit of a merge"); |
| 1612 | } |
| @@ -1702,11 +1702,11 @@ | |
| 1702 | char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'"); |
| 1703 | prepare_commit_comment(&comment, zInit, &sCiInfo, vid); |
| 1704 | if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){ |
| 1705 | prompt_user("unchanged check-in comment. continue (y/N)? ", &ans); |
| 1706 | cReply = blob_str(&ans)[0]; |
| 1707 | if( cReply!='y' && cReply!='Y' ) fossil_exit(1);; |
| 1708 | } |
| 1709 | free(zInit); |
| 1710 | } |
| 1711 | if( blob_size(&comment)==0 ){ |
| 1712 | if( !dryRunFlag ){ |
| 1713 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -843,11 +843,11 @@ | |
| 843 | blob_append(&prompt, |
| 844 | "\n" |
| 845 | "# Enter commit message for this check-in. Lines beginning with # are ignored.\n" |
| 846 | "#\n", -1 |
| 847 | ); |
| 848 | blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : login_name()); |
| 849 | if( p->zBranch && p->zBranch[0] ){ |
| 850 | blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch); |
| 851 | }else{ |
| 852 | char *zTags = info_tags_of_checkin(parent_rid, 1); |
| 853 | if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags); |
| @@ -1005,11 +1005,11 @@ | |
| 1005 | int verifyDate; /* Verify that child is younger */ |
| 1006 | int closeFlag; /* Close the branch being committed */ |
| 1007 | int integrateFlag; /* Close merged-in branches */ |
| 1008 | Blob *pCksum; /* Repository checksum. May be 0 */ |
| 1009 | const char *zDateOvrd; /* Date override. If 0 then use 'now' */ |
| 1010 | const char *zUserOvrd; /* User override. If 0 then use login_name() */ |
| 1011 | const char *zBranch; /* Branch name. May be 0 */ |
| 1012 | const char *zColor; /* One-time background color. May be 0 */ |
| 1013 | const char *zBrClr; /* Persistent branch color. May be 0 */ |
| 1014 | const char **azTag; /* Tags to apply to this check-in */ |
| 1015 | }; |
| @@ -1231,11 +1231,11 @@ | |
| 1231 | const char *zBrTag = db_column_text(&q, 0); |
| 1232 | blob_appendf(pOut, "T -%F *\n", zBrTag); |
| 1233 | } |
| 1234 | db_finalize(&q); |
| 1235 | } |
| 1236 | blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : login_name()); |
| 1237 | md5sum_blob(pOut, &mcksum); |
| 1238 | blob_appendf(pOut, "Z %b\n", &mcksum); |
| 1239 | if( pnFBcard ) *pnFBcard = nFBcard; |
| 1240 | } |
| 1241 | |
| @@ -1602,11 +1602,11 @@ | |
| 1602 | ** should be committed. |
| 1603 | */ |
| 1604 | if( select_commit_files() ){ |
| 1605 | prompt_user("continue (y/N)? ", &ans); |
| 1606 | cReply = blob_str(&ans)[0]; |
| 1607 | if( cReply!='y' && cReply!='Y' ) fossil_exit(1); |
| 1608 | } |
| 1609 | isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2"); |
| 1610 | if( g.aCommitFile && isAMerge ){ |
| 1611 | fossil_fatal("cannot do a partial commit of a merge"); |
| 1612 | } |
| @@ -1702,11 +1702,11 @@ | |
| 1702 | char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'"); |
| 1703 | prepare_commit_comment(&comment, zInit, &sCiInfo, vid); |
| 1704 | if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){ |
| 1705 | prompt_user("unchanged check-in comment. continue (y/N)? ", &ans); |
| 1706 | cReply = blob_str(&ans)[0]; |
| 1707 | if( cReply!='y' && cReply!='Y' ) fossil_exit(1); |
| 1708 | } |
| 1709 | free(zInit); |
| 1710 | } |
| 1711 | if( blob_size(&comment)==0 ){ |
| 1712 | if( !dryRunFlag ){ |
| 1713 |
+3
-3
| --- src/checkout.c | ||
| +++ src/checkout.c | ||
| @@ -157,11 +157,11 @@ | ||
| 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 |
+1
| --- src/comformat.c | ||
| +++ src/comformat.c | ||
| @@ -36,10 +36,11 @@ | ||
| 36 | 36 | int doIndent = 0; |
| 37 | 37 | char *zBuf; |
| 38 | 38 | char zBuffer[400]; |
| 39 | 39 | int lineCnt = 0; |
| 40 | 40 | |
| 41 | + if( zText==0 ) zText = "(NULL)"; | |
| 41 | 42 | if( tlen<=0 ){ |
| 42 | 43 | tlen = strlen(zText); |
| 43 | 44 | } |
| 44 | 45 | if( tlen >= (sizeof(zBuffer)) ){ |
| 45 | 46 | zBuf = fossil_malloc(tlen+1); |
| 46 | 47 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -36,10 +36,11 @@ | |
| 36 | int doIndent = 0; |
| 37 | char *zBuf; |
| 38 | char zBuffer[400]; |
| 39 | int lineCnt = 0; |
| 40 | |
| 41 | if( tlen<=0 ){ |
| 42 | tlen = strlen(zText); |
| 43 | } |
| 44 | if( tlen >= (sizeof(zBuffer)) ){ |
| 45 | zBuf = fossil_malloc(tlen+1); |
| 46 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -36,10 +36,11 @@ | |
| 36 | int doIndent = 0; |
| 37 | char *zBuf; |
| 38 | char zBuffer[400]; |
| 39 | int lineCnt = 0; |
| 40 | |
| 41 | if( zText==0 ) zText = "(NULL)"; |
| 42 | if( tlen<=0 ){ |
| 43 | tlen = strlen(zText); |
| 44 | } |
| 45 | if( tlen >= (sizeof(zBuffer)) ){ |
| 46 | zBuf = fossil_malloc(tlen+1); |
| 47 |
+11
-1
| --- src/config.h | ||
| +++ src/config.h | ||
| @@ -105,11 +105,21 @@ | ||
| 105 | 105 | # else |
| 106 | 106 | # define COMPILER_NAME "msc" |
| 107 | 107 | # endif |
| 108 | 108 | # elif defined(__MINGW32__) |
| 109 | 109 | # if !defined(COMPILER_VERSION) |
| 110 | -# if defined(__MINGW32_VERSION) | |
| 110 | +# if defined(__MINGW_VERSION) | |
| 111 | +# if defined(__GNUC__) | |
| 112 | +# if defined(__VERSION__) | |
| 113 | +# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW_VERSION) "-gcc-" __VERSION__ | |
| 114 | +# else | |
| 115 | +# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW_VERSION) "-gcc" | |
| 116 | +# endif | |
| 117 | +# else | |
| 118 | +# define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW_VERSION) | |
| 119 | +# endif | |
| 120 | +# elif defined(__MINGW32_VERSION) | |
| 111 | 121 | # if defined(__GNUC__) |
| 112 | 122 | # if defined(__VERSION__) |
| 113 | 123 | # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc-" __VERSION__ |
| 114 | 124 | # else |
| 115 | 125 | # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc" |
| 116 | 126 |
| --- src/config.h | |
| +++ src/config.h | |
| @@ -105,11 +105,21 @@ | |
| 105 | # else |
| 106 | # define COMPILER_NAME "msc" |
| 107 | # endif |
| 108 | # elif defined(__MINGW32__) |
| 109 | # if !defined(COMPILER_VERSION) |
| 110 | # if defined(__MINGW32_VERSION) |
| 111 | # if defined(__GNUC__) |
| 112 | # if defined(__VERSION__) |
| 113 | # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc-" __VERSION__ |
| 114 | # else |
| 115 | # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc" |
| 116 |
| --- src/config.h | |
| +++ src/config.h | |
| @@ -105,11 +105,21 @@ | |
| 105 | # else |
| 106 | # define COMPILER_NAME "msc" |
| 107 | # endif |
| 108 | # elif defined(__MINGW32__) |
| 109 | # if !defined(COMPILER_VERSION) |
| 110 | # if defined(__MINGW_VERSION) |
| 111 | # if defined(__GNUC__) |
| 112 | # if defined(__VERSION__) |
| 113 | # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW_VERSION) "-gcc-" __VERSION__ |
| 114 | # else |
| 115 | # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW_VERSION) "-gcc" |
| 116 | # endif |
| 117 | # else |
| 118 | # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW_VERSION) |
| 119 | # endif |
| 120 | # elif defined(__MINGW32_VERSION) |
| 121 | # if defined(__GNUC__) |
| 122 | # if defined(__VERSION__) |
| 123 | # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc-" __VERSION__ |
| 124 | # else |
| 125 | # define COMPILER_VERSION COMPILER_STRINGIFY(__MINGW32_VERSION) "-gcc" |
| 126 |
M
src/db.c
+9
-5
| --- 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__) && USE_SYSTEM_SQLITE+0!=1 | |
| 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, |
| @@ -1022,15 +1022,11 @@ | ||
| 1022 | 1022 | g.json.resultCode = FSL_JSON_E_DB_NOT_VALID; |
| 1023 | 1023 | #endif |
| 1024 | 1024 | fossil_panic("not a valid repository: %s", zDbName); |
| 1025 | 1025 | } |
| 1026 | 1026 | } |
| 1027 | -#if defined(__CYGWIN__) | |
| 1028 | - g.zRepositoryName = fossil_utf8_to_filename(zDbName); | |
| 1029 | -#else | |
| 1030 | 1027 | g.zRepositoryName = mprintf("%s", zDbName); |
| 1031 | -#endif | |
| 1032 | 1028 | db_open_or_attach(g.zRepositoryName, "repository", 0); |
| 1033 | 1029 | g.repositoryOpen = 1; |
| 1034 | 1030 | /* Cache "allow-symlinks" option, because we'll need it on every stat call */ |
| 1035 | 1031 | g.allowSymlinks = db_get_boolean("allow-symlinks", 0); |
| 1036 | 1032 | } |
| @@ -2147,10 +2143,11 @@ | ||
| 2147 | 2143 | { "ignore-glob", 0, 40, 1, 0, "" }, |
| 2148 | 2144 | { "keep-glob", 0, 40, 1, 0, "" }, |
| 2149 | 2145 | { "localauth", 0, 0, 0, 0, "off" }, |
| 2150 | 2146 | { "main-branch", 0, 40, 0, 0, "trunk" }, |
| 2151 | 2147 | { "manifest", 0, 0, 1, 0, "off" }, |
| 2148 | + { "max-loadavg", 0, 25, 0, 0, "0.0" }, | |
| 2152 | 2149 | { "max-upload", 0, 25, 0, 0, "250000" }, |
| 2153 | 2150 | { "mtime-changes", 0, 0, 0, 0, "on" }, |
| 2154 | 2151 | { "pgp-command", 0, 40, 0, 0, "gpg --clearsign -o " }, |
| 2155 | 2152 | { "proxy", 0, 32, 0, 0, "off" }, |
| 2156 | 2153 | { "relative-paths", 0, 0, 0, 0, "on" }, |
| @@ -2296,10 +2293,17 @@ | ||
| 2296 | 2293 | ** main-branch The primary branch for the project. Default: trunk |
| 2297 | 2294 | ** |
| 2298 | 2295 | ** manifest If enabled, automatically create files "manifest" and |
| 2299 | 2296 | ** (versionable) "manifest.uuid" in every checkout. The SQLite and |
| 2300 | 2297 | ** Fossil repositories both require this. Default: off. |
| 2298 | +** | |
| 2299 | +** max-loadavg Some CPU-intensive web pages (ex: /zip, /tarball, /blame) | |
| 2300 | +** are disallowed if the system load average goes above this | |
| 2301 | +** value. "0.0" means no limit. This only works on unix. | |
| 2302 | +** Only local settings of this value make a difference since | |
| 2303 | +** when running as a web-server, Fossil does not open the | |
| 2304 | +** global configuration database. | |
| 2301 | 2305 | ** |
| 2302 | 2306 | ** max-upload A limit on the size of uplink HTTP requests. The |
| 2303 | 2307 | ** default is 250000 bytes. |
| 2304 | 2308 | ** |
| 2305 | 2309 | ** mtime-changes Use file modification times (mtimes) to detect when |
| 2306 | 2310 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -715,11 +715,11 @@ | |
| 715 | */ |
| 716 | LOCAL sqlite3 *db_open(const char *zDbName){ |
| 717 | int rc; |
| 718 | sqlite3 *db; |
| 719 | |
| 720 | #if defined(__CYGWIN__) |
| 721 | zDbName = fossil_utf8_to_filename(zDbName); |
| 722 | #endif |
| 723 | if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName); |
| 724 | rc = sqlite3_open_v2( |
| 725 | zDbName, &db, |
| @@ -1022,15 +1022,11 @@ | |
| 1022 | g.json.resultCode = FSL_JSON_E_DB_NOT_VALID; |
| 1023 | #endif |
| 1024 | fossil_panic("not a valid repository: %s", zDbName); |
| 1025 | } |
| 1026 | } |
| 1027 | #if defined(__CYGWIN__) |
| 1028 | g.zRepositoryName = fossil_utf8_to_filename(zDbName); |
| 1029 | #else |
| 1030 | g.zRepositoryName = mprintf("%s", zDbName); |
| 1031 | #endif |
| 1032 | db_open_or_attach(g.zRepositoryName, "repository", 0); |
| 1033 | g.repositoryOpen = 1; |
| 1034 | /* Cache "allow-symlinks" option, because we'll need it on every stat call */ |
| 1035 | g.allowSymlinks = db_get_boolean("allow-symlinks", 0); |
| 1036 | } |
| @@ -2147,10 +2143,11 @@ | |
| 2147 | { "ignore-glob", 0, 40, 1, 0, "" }, |
| 2148 | { "keep-glob", 0, 40, 1, 0, "" }, |
| 2149 | { "localauth", 0, 0, 0, 0, "off" }, |
| 2150 | { "main-branch", 0, 40, 0, 0, "trunk" }, |
| 2151 | { "manifest", 0, 0, 1, 0, "off" }, |
| 2152 | { "max-upload", 0, 25, 0, 0, "250000" }, |
| 2153 | { "mtime-changes", 0, 0, 0, 0, "on" }, |
| 2154 | { "pgp-command", 0, 40, 0, 0, "gpg --clearsign -o " }, |
| 2155 | { "proxy", 0, 32, 0, 0, "off" }, |
| 2156 | { "relative-paths", 0, 0, 0, 0, "on" }, |
| @@ -2296,10 +2293,17 @@ | |
| 2296 | ** main-branch The primary branch for the project. Default: trunk |
| 2297 | ** |
| 2298 | ** manifest If enabled, automatically create files "manifest" and |
| 2299 | ** (versionable) "manifest.uuid" in every checkout. The SQLite and |
| 2300 | ** Fossil repositories both require this. Default: off. |
| 2301 | ** |
| 2302 | ** max-upload A limit on the size of uplink HTTP requests. The |
| 2303 | ** default is 250000 bytes. |
| 2304 | ** |
| 2305 | ** mtime-changes Use file modification times (mtimes) to detect when |
| 2306 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -715,11 +715,11 @@ | |
| 715 | */ |
| 716 | LOCAL sqlite3 *db_open(const char *zDbName){ |
| 717 | int rc; |
| 718 | sqlite3 *db; |
| 719 | |
| 720 | #if defined(__CYGWIN__) && USE_SYSTEM_SQLITE+0!=1 |
| 721 | zDbName = fossil_utf8_to_filename(zDbName); |
| 722 | #endif |
| 723 | if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName); |
| 724 | rc = sqlite3_open_v2( |
| 725 | zDbName, &db, |
| @@ -1022,15 +1022,11 @@ | |
| 1022 | g.json.resultCode = FSL_JSON_E_DB_NOT_VALID; |
| 1023 | #endif |
| 1024 | fossil_panic("not a valid repository: %s", zDbName); |
| 1025 | } |
| 1026 | } |
| 1027 | g.zRepositoryName = mprintf("%s", zDbName); |
| 1028 | db_open_or_attach(g.zRepositoryName, "repository", 0); |
| 1029 | g.repositoryOpen = 1; |
| 1030 | /* Cache "allow-symlinks" option, because we'll need it on every stat call */ |
| 1031 | g.allowSymlinks = db_get_boolean("allow-symlinks", 0); |
| 1032 | } |
| @@ -2147,10 +2143,11 @@ | |
| 2143 | { "ignore-glob", 0, 40, 1, 0, "" }, |
| 2144 | { "keep-glob", 0, 40, 1, 0, "" }, |
| 2145 | { "localauth", 0, 0, 0, 0, "off" }, |
| 2146 | { "main-branch", 0, 40, 0, 0, "trunk" }, |
| 2147 | { "manifest", 0, 0, 1, 0, "off" }, |
| 2148 | { "max-loadavg", 0, 25, 0, 0, "0.0" }, |
| 2149 | { "max-upload", 0, 25, 0, 0, "250000" }, |
| 2150 | { "mtime-changes", 0, 0, 0, 0, "on" }, |
| 2151 | { "pgp-command", 0, 40, 0, 0, "gpg --clearsign -o " }, |
| 2152 | { "proxy", 0, 32, 0, 0, "off" }, |
| 2153 | { "relative-paths", 0, 0, 0, 0, "on" }, |
| @@ -2296,10 +2293,17 @@ | |
| 2293 | ** main-branch The primary branch for the project. Default: trunk |
| 2294 | ** |
| 2295 | ** manifest If enabled, automatically create files "manifest" and |
| 2296 | ** (versionable) "manifest.uuid" in every checkout. The SQLite and |
| 2297 | ** Fossil repositories both require this. Default: off. |
| 2298 | ** |
| 2299 | ** max-loadavg Some CPU-intensive web pages (ex: /zip, /tarball, /blame) |
| 2300 | ** are disallowed if the system load average goes above this |
| 2301 | ** value. "0.0" means no limit. This only works on unix. |
| 2302 | ** Only local settings of this value make a difference since |
| 2303 | ** when running as a web-server, Fossil does not open the |
| 2304 | ** global configuration database. |
| 2305 | ** |
| 2306 | ** max-upload A limit on the size of uplink HTTP requests. The |
| 2307 | ** default is 250000 bytes. |
| 2308 | ** |
| 2309 | ** mtime-changes Use file modification times (mtimes) to detect when |
| 2310 |
+180
-75
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -29,21 +29,21 @@ | ||
| 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 */ | |
| 37 | -#define DIFF_INLINE ((u64)0x00000000) /* Inline (not side-by-side) diff */ | |
| 38 | -#define DIFF_HTML ((u64)0x10000000) /* Render for HTML */ | |
| 39 | -#define DIFF_LINENO ((u64)0x20000000) /* Show line numbers */ | |
| 40 | -#define DIFF_WS_WARNING ((u64)0x40000000) /* Warn about whitespace */ | |
| 34 | +#define DIFF_IGNORE_ALLWS ((u64)0x03000000) /* Ignore all whitespace */ | |
| 35 | +#define DIFF_SIDEBYSIDE ((u64)0x04000000) /* Generate a side-by-side diff */ | |
| 36 | +#define DIFF_VERBOSE ((u64)0x08000000) /* Missing shown as empty files */ | |
| 37 | +#define DIFF_BRIEF ((u64)0x10000000) /* Show filenames only */ | |
| 38 | +#define DIFF_HTML ((u64)0x20000000) /* Render for HTML */ | |
| 39 | +#define DIFF_LINENO ((u64)0x40000000) /* Show line numbers */ | |
| 41 | 40 | #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */ |
| 42 | 41 | #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */ |
| 43 | 42 | #define DIFF_CONTEXT_EX (((u64)0x04)<<32) /* Use context even if zero */ |
| 44 | 43 | #define DIFF_NOTTOOBIG (((u64)0x08)<<32) /* Only display if not too big */ |
| 44 | +#define DIFF_STRIP_EOLCR (((u64)0x10)<<32) /* Strip trailing CR */ | |
| 45 | 45 | |
| 46 | 46 | /* |
| 47 | 47 | ** These error messages are shared in multiple locations. They are defined |
| 48 | 48 | ** here for consistency. |
| 49 | 49 | */ |
| @@ -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: */ |
| @@ -84,11 +89,11 @@ | ||
| 84 | 89 | }; |
| 85 | 90 | |
| 86 | 91 | /* |
| 87 | 92 | ** Length of a dline |
| 88 | 93 | */ |
| 89 | -#define LENGTH(X) ((X)->h & LENGTH_MASK) | |
| 94 | +#define LENGTH(X) ((X)->n) | |
| 90 | 95 | |
| 91 | 96 | /* |
| 92 | 97 | ** A context for running a raw diff. |
| 93 | 98 | ** |
| 94 | 99 | ** The aEdit[] array describes the raw diff. Each triple of integers in |
| @@ -108,10 +113,11 @@ | ||
| 108 | 113 | int nEditAlloc; /* Space allocated for aEdit[] */ |
| 109 | 114 | DLine *aFrom; /* File on left side of the diff */ |
| 110 | 115 | int nFrom; /* Number of lines in aFrom[] */ |
| 111 | 116 | DLine *aTo; /* File on right side of the diff */ |
| 112 | 117 | int nTo; /* Number of lines in aTo[] */ |
| 118 | + int (*same_fn)(const DLine *, const DLine *); /* Function to be used for comparing */ | |
| 113 | 119 | }; |
| 114 | 120 | |
| 115 | 121 | /* |
| 116 | 122 | ** Return an array of DLine objects containing a pointer to the |
| 117 | 123 | ** start of each line and a hash of that line. The lower |
| @@ -125,12 +131,12 @@ | ||
| 125 | 131 | ** too long. |
| 126 | 132 | ** |
| 127 | 133 | ** Profiling show that in most cases this routine consumes the bulk of |
| 128 | 134 | ** the CPU time on a diff. |
| 129 | 135 | */ |
| 130 | -static DLine *break_into_lines(const char *z, int n, int *pnLine, int ignoreWS){ | |
| 131 | - int nLine, i, j, k, x; | |
| 136 | +static DLine *break_into_lines(const char *z, int n, int *pnLine, u64 diffFlags){ | |
| 137 | + int nLine, i, j, k, s, x; | |
| 132 | 138 | unsigned int h, h2; |
| 133 | 139 | DLine *a; |
| 134 | 140 | |
| 135 | 141 | /* Count the number of lines. Allocate space to hold |
| 136 | 142 | ** the returned array. |
| @@ -158,18 +164,39 @@ | ||
| 158 | 164 | return a; |
| 159 | 165 | } |
| 160 | 166 | |
| 161 | 167 | /* Fill in the array */ |
| 162 | 168 | for(i=0; i<nLine; i++){ |
| 163 | - a[i].z = z; | |
| 164 | 169 | for(j=0; z[j] && z[j]!='\n'; j++){} |
| 170 | + a[i].z = z; | |
| 165 | 171 | k = j; |
| 166 | - while( ignoreWS && k>0 && fossil_isspace(z[k-1]) ){ k--; } | |
| 167 | - for(h=0, x=0; x<=k; x++){ | |
| 168 | - h = h ^ (h<<2) ^ z[x]; | |
| 172 | + if( diffFlags & DIFF_STRIP_EOLCR ){ | |
| 173 | + if( k>0 && z[k-1]=='\r' ){ k--; } | |
| 174 | + } | |
| 175 | + a[i].n = k; | |
| 176 | + s = 0; | |
| 177 | + if( diffFlags & DIFF_IGNORE_EOLWS ){ | |
| 178 | + while( k>0 && fossil_isspace(z[k-1]) ){ k--; } | |
| 179 | + } | |
| 180 | + if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){ | |
| 181 | + int numws = 0; | |
| 182 | + while( s<k && fossil_isspace(z[s]) ){ s++; } | |
| 183 | + for(h=0, x=s; x<k; x++){ | |
| 184 | + if( fossil_isspace(z[x]) ){ | |
| 185 | + ++numws; | |
| 186 | + }else{ | |
| 187 | + h = h ^ (h<<2) ^ z[x]; | |
| 188 | + } | |
| 189 | + } | |
| 190 | + k -= numws; | |
| 191 | + }else{ | |
| 192 | + for(h=0, x=s; x<k; x++){ | |
| 193 | + h = h ^ (h<<2) ^ z[x]; | |
| 194 | + } | |
| 169 | 195 | } |
| 170 | - a[i].h = h = (h<<LENGTH_MASK_SZ) | k;; | |
| 196 | + a[i].indent = s; | |
| 197 | + a[i].h = h = (h<<LENGTH_MASK_SZ) | (k-s); | |
| 171 | 198 | h2 = h % nLine; |
| 172 | 199 | a[i].iNext = a[h2].iHash; |
| 173 | 200 | a[h2].iHash = i+1; |
| 174 | 201 | z += j+1; |
| 175 | 202 | } |
| @@ -180,12 +207,31 @@ | ||
| 180 | 207 | } |
| 181 | 208 | |
| 182 | 209 | /* |
| 183 | 210 | ** Return true if two DLine elements are identical. |
| 184 | 211 | */ |
| 185 | -static int same_dline(DLine *pA, DLine *pB){ | |
| 186 | - return pA->h==pB->h && memcmp(pA->z,pB->z,pA->h & LENGTH_MASK)==0; | |
| 212 | +static int same_dline(const DLine *pA, const DLine *pB){ | |
| 213 | + return pA->h==pB->h && memcmp(pA->z,pB->z, pA->h&LENGTH_MASK)==0; | |
| 214 | +} | |
| 215 | + | |
| 216 | +/* | |
| 217 | +** Return true if two DLine elements are identical, ignoring | |
| 218 | +** all whitespace. The indent field of pA/pB already points | |
| 219 | +** to the first non-space character in the string. | |
| 220 | +*/ | |
| 221 | + | |
| 222 | +static int same_dline_ignore_allws(const DLine *pA, const DLine *pB){ | |
| 223 | + int a = pA->indent, b = pB->indent; | |
| 224 | + if( pA->h==pB->h ){ | |
| 225 | + while( a<pA->n && b<pB->n ){ | |
| 226 | + if( pA->z[a++] != pB->z[b++] ) return 0; | |
| 227 | + while( a<pA->n && fossil_isspace(pA->z[a])) ++a; | |
| 228 | + while( b<pB->n && fossil_isspace(pB->z[b])) ++b; | |
| 229 | + } | |
| 230 | + return pA->n-a == b<pB->n-b; | |
| 231 | + } | |
| 232 | + return 0; | |
| 187 | 233 | } |
| 188 | 234 | |
| 189 | 235 | /* |
| 190 | 236 | ** Return true if the regular expression *pRe matches any of the |
| 191 | 237 | ** N dlines |
| @@ -221,16 +267,16 @@ | ||
| 221 | 267 | }else if( cPrefix=='+' ){ |
| 222 | 268 | blob_append(pOut, "<span class=\"diffadd\">", -1); |
| 223 | 269 | }else if( cPrefix=='-' ){ |
| 224 | 270 | blob_append(pOut, "<span class=\"diffrm\">", -1); |
| 225 | 271 | } |
| 226 | - htmlize_to_blob(pOut, pLine->z, (pLine->h & LENGTH_MASK)); | |
| 272 | + htmlize_to_blob(pOut, pLine->z, pLine->n); | |
| 227 | 273 | if( cPrefix!=' ' ){ |
| 228 | 274 | blob_append(pOut, "</span>", -1); |
| 229 | 275 | } |
| 230 | 276 | }else{ |
| 231 | - blob_append(pOut, pLine->z, pLine->h & LENGTH_MASK); | |
| 277 | + blob_append(pOut, pLine->z, pLine->n); | |
| 232 | 278 | } |
| 233 | 279 | blob_append(pOut, "\n", 1); |
| 234 | 280 | } |
| 235 | 281 | |
| 236 | 282 | /* |
| @@ -402,11 +448,11 @@ | ||
| 402 | 448 | b += m; |
| 403 | 449 | if( i<nr-1 ){ |
| 404 | 450 | m = R[r+i*3+3]; |
| 405 | 451 | for(j=0; j<m; j++){ |
| 406 | 452 | if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html); |
| 407 | - appendDiffLine(pOut, ' ', &B[b+j], html, 0); | |
| 453 | + appendDiffLine(pOut, ' ', &A[a+j], html, 0); | |
| 408 | 454 | } |
| 409 | 455 | b += m; |
| 410 | 456 | a += m; |
| 411 | 457 | } |
| 412 | 458 | } |
| @@ -415,11 +461,11 @@ | ||
| 415 | 461 | assert( nr==i ); |
| 416 | 462 | m = R[r+nr*3]; |
| 417 | 463 | if( m>nContext ) m = nContext; |
| 418 | 464 | for(j=0; j<m; j++){ |
| 419 | 465 | if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html); |
| 420 | - appendDiffLine(pOut, ' ', &B[b+j], html, 0); | |
| 466 | + appendDiffLine(pOut, ' ', &A[a+j], html, 0); | |
| 421 | 467 | } |
| 422 | 468 | } |
| 423 | 469 | } |
| 424 | 470 | |
| 425 | 471 | /* |
| @@ -476,11 +522,11 @@ | ||
| 476 | 522 | ** This comment contains multibyte unicode characters (ü, Æ, ð) in order |
| 477 | 523 | ** to test the ability of the diff code to handle such characters. |
| 478 | 524 | */ |
| 479 | 525 | static void sbsWriteText(SbsLine *p, DLine *pLine, int col){ |
| 480 | 526 | Blob *pCol = p->apCols[col]; |
| 481 | - int n = pLine->h & LENGTH_MASK; | |
| 527 | + int n = pLine->n; | |
| 482 | 528 | int i; /* Number of input characters consumed */ |
| 483 | 529 | int k; /* Cursor position */ |
| 484 | 530 | int needEndSpan = 0; |
| 485 | 531 | const char *zIn = pLine->z; |
| 486 | 532 | int w = p->width; |
| @@ -1305,11 +1351,11 @@ | ||
| 1305 | 1351 | sbsWriteMarker(&s, " ", ""); |
| 1306 | 1352 | sbsWriteLineno(&s, b+j, SBS_LNB); |
| 1307 | 1353 | sbsWriteText(&s, &B[b+j], SBS_TXTB); |
| 1308 | 1354 | } |
| 1309 | 1355 | } |
| 1310 | - | |
| 1356 | + | |
| 1311 | 1357 | if( s.escHtml && blob_size(s.apCols[SBS_LNA])>0 ){ |
| 1312 | 1358 | blob_append(pOut, "<table class=\"sbsdiffcols\"><tr>\n", -1); |
| 1313 | 1359 | for(i=SBS_LNA; i<=SBS_TXTB; i++){ |
| 1314 | 1360 | sbsWriteColumn(pOut, s.apCols[i], i); |
| 1315 | 1361 | blob_reset(s.apCols[i]); |
| @@ -1337,16 +1383,16 @@ | ||
| 1337 | 1383 | int iSXb = iS1; /* Best match so far */ |
| 1338 | 1384 | int iSYb = iS2; /* Best match so far */ |
| 1339 | 1385 | |
| 1340 | 1386 | for(i=iS1; i<iE1-mxLength; i++){ |
| 1341 | 1387 | for(j=iS2; j<iE2-mxLength; j++){ |
| 1342 | - if( !same_dline(&p->aFrom[i], &p->aTo[j]) ) continue; | |
| 1343 | - if( mxLength && !same_dline(&p->aFrom[i+mxLength], &p->aTo[j+mxLength]) ){ | |
| 1388 | + if( !p->same_fn(&p->aFrom[i], &p->aTo[j]) ) continue; | |
| 1389 | + if( mxLength && !p->same_fn(&p->aFrom[i+mxLength], &p->aTo[j+mxLength]) ){ | |
| 1344 | 1390 | continue; |
| 1345 | 1391 | } |
| 1346 | 1392 | k = 1; |
| 1347 | - while( i+k<iE1 && j+k<iE2 && same_dline(&p->aFrom[i+k],&p->aTo[j+k]) ){ | |
| 1393 | + while( i+k<iE1 && j+k<iE2 && p->same_fn(&p->aFrom[i+k],&p->aTo[j+k]) ){ | |
| 1348 | 1394 | k++; |
| 1349 | 1395 | } |
| 1350 | 1396 | if( k>mxLength ){ |
| 1351 | 1397 | iSXb = i; |
| 1352 | 1398 | iSYb = j; |
| @@ -1408,11 +1454,11 @@ | ||
| 1408 | 1454 | mid = (iE1 + iS1)/2; |
| 1409 | 1455 | for(i=iS1; i<iE1; i++){ |
| 1410 | 1456 | int limit = 0; |
| 1411 | 1457 | j = p->aTo[p->aFrom[i].h % p->nTo].iHash; |
| 1412 | 1458 | while( j>0 |
| 1413 | - && (j-1<iS2 || j>=iE2 || !same_dline(&p->aFrom[i], &p->aTo[j-1])) | |
| 1459 | + && (j-1<iS2 || j>=iE2 || !p->same_fn(&p->aFrom[i], &p->aTo[j-1])) | |
| 1414 | 1460 | ){ |
| 1415 | 1461 | if( limit++ > 10 ){ |
| 1416 | 1462 | j = 0; |
| 1417 | 1463 | break; |
| 1418 | 1464 | } |
| @@ -1425,19 +1471,19 @@ | ||
| 1425 | 1471 | iSX = i; |
| 1426 | 1472 | iSY = j-1; |
| 1427 | 1473 | pA = &p->aFrom[iSX-1]; |
| 1428 | 1474 | pB = &p->aTo[iSY-1]; |
| 1429 | 1475 | n = minInt(iSX-iS1, iSY-iS2); |
| 1430 | - for(k=0; k<n && same_dline(pA,pB); k++, pA--, pB--){} | |
| 1476 | + for(k=0; k<n && p->same_fn(pA,pB); k++, pA--, pB--){} | |
| 1431 | 1477 | iSX -= k; |
| 1432 | 1478 | iSY -= k; |
| 1433 | 1479 | iEX = i+1; |
| 1434 | 1480 | iEY = j; |
| 1435 | 1481 | pA = &p->aFrom[iEX]; |
| 1436 | 1482 | pB = &p->aTo[iEY]; |
| 1437 | 1483 | n = minInt(iE1-iEX, iE2-iEY); |
| 1438 | - for(k=0; k<n && same_dline(pA,pB); k++, pA++, pB++){} | |
| 1484 | + for(k=0; k<n && p->same_fn(pA,pB); k++, pA++, pB++){} | |
| 1439 | 1485 | iEX += k; |
| 1440 | 1486 | iEY += k; |
| 1441 | 1487 | skew = (iSX-iS1) - (iSY-iS2); |
| 1442 | 1488 | if( skew<0 ) skew = -skew; |
| 1443 | 1489 | dist = (iSX+iEX)/2 - mid; |
| @@ -1574,16 +1620,16 @@ | ||
| 1574 | 1620 | int mnE, iS, iE1, iE2; |
| 1575 | 1621 | |
| 1576 | 1622 | /* Carve off the common header and footer */ |
| 1577 | 1623 | iE1 = p->nFrom; |
| 1578 | 1624 | iE2 = p->nTo; |
| 1579 | - while( iE1>0 && iE2>0 && same_dline(&p->aFrom[iE1-1], &p->aTo[iE2-1]) ){ | |
| 1625 | + while( iE1>0 && iE2>0 && p->same_fn(&p->aFrom[iE1-1], &p->aTo[iE2-1]) ){ | |
| 1580 | 1626 | iE1--; |
| 1581 | 1627 | iE2--; |
| 1582 | 1628 | } |
| 1583 | 1629 | mnE = iE1<iE2 ? iE1 : iE2; |
| 1584 | - for(iS=0; iS<mnE && same_dline(&p->aFrom[iS],&p->aTo[iS]); iS++){} | |
| 1630 | + for(iS=0; iS<mnE && p->same_fn(&p->aFrom[iS],&p->aTo[iS]); iS++){} | |
| 1585 | 1631 | |
| 1586 | 1632 | /* do the difference */ |
| 1587 | 1633 | if( iS>0 ){ |
| 1588 | 1634 | appendTriple(p, iS, 0, 0); |
| 1589 | 1635 | } |
| @@ -1648,11 +1694,11 @@ | ||
| 1648 | 1694 | |
| 1649 | 1695 | /* Shift insertions toward the beginning of the file */ |
| 1650 | 1696 | while( cpy>0 && del==0 && ins>0 ){ |
| 1651 | 1697 | DLine *pTop = &p->aFrom[lnFrom-1]; /* Line before start of insert */ |
| 1652 | 1698 | DLine *pBtm = &p->aTo[lnTo+ins-1]; /* Last line inserted */ |
| 1653 | - if( same_dline(pTop, pBtm)==0 ) break; | |
| 1699 | + if( p->same_fn(pTop, pBtm)==0 ) break; | |
| 1654 | 1700 | if( LENGTH(pTop+1)+LENGTH(pBtm)<=LENGTH(pTop)+LENGTH(pBtm-1) ) break; |
| 1655 | 1701 | lnFrom--; |
| 1656 | 1702 | lnTo--; |
| 1657 | 1703 | p->aEdit[r]--; |
| 1658 | 1704 | p->aEdit[r+3]++; |
| @@ -1661,11 +1707,11 @@ | ||
| 1661 | 1707 | |
| 1662 | 1708 | /* Shift insertions toward the end of the file */ |
| 1663 | 1709 | while( r+3<p->nEdit && p->aEdit[r+3]>0 && del==0 && ins>0 ){ |
| 1664 | 1710 | DLine *pTop = &p->aTo[lnTo]; /* First line inserted */ |
| 1665 | 1711 | DLine *pBtm = &p->aTo[lnTo+ins]; /* First line past end of insert */ |
| 1666 | - if( same_dline(pTop, pBtm)==0 ) break; | |
| 1712 | + if( p->same_fn(pTop, pBtm)==0 ) break; | |
| 1667 | 1713 | if( LENGTH(pTop)+LENGTH(pBtm-1)<=LENGTH(pTop+1)+LENGTH(pBtm) ) break; |
| 1668 | 1714 | lnFrom++; |
| 1669 | 1715 | lnTo++; |
| 1670 | 1716 | p->aEdit[r]++; |
| 1671 | 1717 | p->aEdit[r+3]--; |
| @@ -1674,11 +1720,11 @@ | ||
| 1674 | 1720 | |
| 1675 | 1721 | /* Shift deletions toward the beginning of the file */ |
| 1676 | 1722 | while( cpy>0 && del>0 && ins==0 ){ |
| 1677 | 1723 | DLine *pTop = &p->aFrom[lnFrom-1]; /* Line before start of delete */ |
| 1678 | 1724 | DLine *pBtm = &p->aFrom[lnFrom+del-1]; /* Last line deleted */ |
| 1679 | - if( same_dline(pTop, pBtm)==0 ) break; | |
| 1725 | + if( p->same_fn(pTop, pBtm)==0 ) break; | |
| 1680 | 1726 | if( LENGTH(pTop+1)+LENGTH(pBtm)<=LENGTH(pTop)+LENGTH(pBtm-1) ) break; |
| 1681 | 1727 | lnFrom--; |
| 1682 | 1728 | lnTo--; |
| 1683 | 1729 | p->aEdit[r]--; |
| 1684 | 1730 | p->aEdit[r+3]++; |
| @@ -1687,11 +1733,11 @@ | ||
| 1687 | 1733 | |
| 1688 | 1734 | /* Shift deletions toward the end of the file */ |
| 1689 | 1735 | while( r+3<p->nEdit && p->aEdit[r+3]>0 && del>0 && ins==0 ){ |
| 1690 | 1736 | DLine *pTop = &p->aFrom[lnFrom]; /* First line deleted */ |
| 1691 | 1737 | DLine *pBtm = &p->aFrom[lnFrom+del]; /* First line past end of delete */ |
| 1692 | - if( same_dline(pTop, pBtm)==0 ) break; | |
| 1738 | + if( p->same_fn(pTop, pBtm)==0 ) break; | |
| 1693 | 1739 | if( LENGTH(pTop)+LENGTH(pBtm-1)<=LENGTH(pTop)+LENGTH(pBtm) ) break; |
| 1694 | 1740 | lnFrom++; |
| 1695 | 1741 | lnTo++; |
| 1696 | 1742 | p->aEdit[r]++; |
| 1697 | 1743 | p->aEdit[r+3]--; |
| @@ -1753,28 +1799,33 @@ | ||
| 1753 | 1799 | Blob *pB_Blob, /* TO file */ |
| 1754 | 1800 | Blob *pOut, /* Write diff here if not NULL */ |
| 1755 | 1801 | ReCompiled *pRe, /* Only output changes where this Regexp matches */ |
| 1756 | 1802 | u64 diffFlags /* DIFF_* flags defined above */ |
| 1757 | 1803 | ){ |
| 1758 | - int ignoreEolWs; /* Ignore whitespace at the end of lines */ | |
| 1804 | + int ignoreWs; /* Ignore whitespace */ | |
| 1759 | 1805 | DContext c; |
| 1760 | 1806 | |
| 1761 | 1807 | if( diffFlags & DIFF_INVERT ){ |
| 1762 | 1808 | Blob *pTemp = pA_Blob; |
| 1763 | 1809 | pA_Blob = pB_Blob; |
| 1764 | 1810 | pB_Blob = pTemp; |
| 1765 | 1811 | } |
| 1766 | - ignoreEolWs = (diffFlags & DIFF_IGNORE_EOLWS)!=0; | |
| 1812 | + ignoreWs = (diffFlags & DIFF_IGNORE_ALLWS)!=0; | |
| 1767 | 1813 | blob_to_utf8_no_bom(pA_Blob, 0); |
| 1768 | 1814 | blob_to_utf8_no_bom(pB_Blob, 0); |
| 1769 | 1815 | |
| 1770 | 1816 | /* Prepare the input files */ |
| 1771 | 1817 | memset(&c, 0, sizeof(c)); |
| 1818 | + if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){ | |
| 1819 | + c.same_fn = same_dline_ignore_allws; | |
| 1820 | + }else{ | |
| 1821 | + c.same_fn = same_dline; | |
| 1822 | + } | |
| 1772 | 1823 | c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob), |
| 1773 | - &c.nFrom, ignoreEolWs); | |
| 1824 | + &c.nFrom, diffFlags); | |
| 1774 | 1825 | c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob), |
| 1775 | - &c.nTo, ignoreEolWs); | |
| 1826 | + &c.nTo, diffFlags); | |
| 1776 | 1827 | if( c.aFrom==0 || c.aTo==0 ){ |
| 1777 | 1828 | fossil_free(c.aFrom); |
| 1778 | 1829 | fossil_free(c.aTo); |
| 1779 | 1830 | if( pOut ){ |
| 1780 | 1831 | diff_errmsg(pOut, DIFF_CANNOT_COMPUTE_BINARY, diffFlags); |
| @@ -1782,20 +1833,27 @@ | ||
| 1782 | 1833 | return 0; |
| 1783 | 1834 | } |
| 1784 | 1835 | |
| 1785 | 1836 | /* Compute the difference */ |
| 1786 | 1837 | diff_all(&c); |
| 1838 | + if( ignoreWs && c.nEdit==6 && c.aEdit[1]==0 && c.aEdit[2]==0 ){ | |
| 1839 | + fossil_free(c.aFrom); | |
| 1840 | + fossil_free(c.aTo); | |
| 1841 | + fossil_free(c.aEdit); | |
| 1842 | + if( pOut ) diff_errmsg(pOut, DIFF_WHITESPACE_ONLY, diffFlags); | |
| 1843 | + return 0; | |
| 1844 | + } | |
| 1787 | 1845 | if( (diffFlags & DIFF_NOTTOOBIG)!=0 ){ |
| 1788 | 1846 | int i, m, n; |
| 1789 | 1847 | int *a = c.aEdit; |
| 1790 | 1848 | int mx = c.nEdit; |
| 1791 | 1849 | for(i=m=n=0; i<mx; i+=3){ m += a[i]; n += a[i+1]+a[i+2]; } |
| 1792 | 1850 | if( n>10000 ){ |
| 1793 | 1851 | fossil_free(c.aFrom); |
| 1794 | 1852 | fossil_free(c.aTo); |
| 1795 | 1853 | fossil_free(c.aEdit); |
| 1796 | - diff_errmsg(pOut, DIFF_TOO_MANY_CHANGES, diffFlags); | |
| 1854 | + if( pOut ) diff_errmsg(pOut, DIFF_TOO_MANY_CHANGES, diffFlags); | |
| 1797 | 1855 | return 0; |
| 1798 | 1856 | } |
| 1799 | 1857 | } |
| 1800 | 1858 | if( (diffFlags & DIFF_NOOPT)==0 ){ |
| 1801 | 1859 | diff_optimize(&c); |
| @@ -1824,24 +1882,36 @@ | ||
| 1824 | 1882 | |
| 1825 | 1883 | /* |
| 1826 | 1884 | ** Process diff-related command-line options and return an appropriate |
| 1827 | 1885 | ** "diffFlags" integer. |
| 1828 | 1886 | ** |
| 1829 | -** --brief Show filenames only DIFF_BRIEF | |
| 1830 | -** --context|-c N N lines of context. DIFF_CONTEXT_MASK | |
| 1831 | -** --html Format for HTML DIFF_HTML | |
| 1832 | -** --invert Invert the diff DIFF_INVERT | |
| 1833 | -** --linenum|-n Show line numbers DIFF_LINENO | |
| 1834 | -** --noopt Disable optimization DIFF_NOOPT | |
| 1835 | -** --side-by-side|-y Side-by-side diff. DIFF_SIDEBYSIDE | |
| 1836 | -** --unified Unified diff. ~DIFF_SIDEBYSIDE | |
| 1837 | -** --width|-W N N character lines. DIFF_WIDTH_MASK | |
| 1887 | +** --brief Show filenames only DIFF_BRIEF | |
| 1888 | +** -c|--context N N lines of context. DIFF_CONTEXT_MASK | |
| 1889 | +** --html Format for HTML DIFF_HTML | |
| 1890 | +** --invert Invert the diff DIFF_INVERT | |
| 1891 | +** -n|--linenum Show line numbers DIFF_LINENO | |
| 1892 | +** --noopt Disable optimization DIFF_NOOPT | |
| 1893 | +** --strip-trailing-cr Strip trailing CR DIFF_STRIP_EOLCR | |
| 1894 | +** --unified Unified diff. ~DIFF_SIDEBYSIDE | |
| 1895 | +** -w|--ignore-all-space Ignore all whitespaces DIFF_IGNORE_ALLWS | |
| 1896 | +** -W|--width N N character lines. DIFF_WIDTH_MASK | |
| 1897 | +** -y|--side-by-side Side-by-side diff. DIFF_SIDEBYSIDE | |
| 1898 | +** -Z|--ignore-trailing-space Ignore eol-whitespaces DIFF_IGNORE_EOLWS | |
| 1838 | 1899 | */ |
| 1839 | 1900 | u64 diff_options(void){ |
| 1840 | 1901 | u64 diffFlags = 0; |
| 1841 | 1902 | const char *z; |
| 1842 | 1903 | int f; |
| 1904 | + if( find_option("ignore-trailing-space","Z",0)!=0 ){ | |
| 1905 | + diffFlags = DIFF_IGNORE_EOLWS; | |
| 1906 | + } | |
| 1907 | + if( find_option("ignore-all-space","w",0)!=0 ){ | |
| 1908 | + diffFlags = DIFF_IGNORE_ALLWS; /* stronger than DIFF_IGNORE_EOLWS */ | |
| 1909 | + } | |
| 1910 | + if( find_option("strip-trailing-cr",0,0)!=0 ){ | |
| 1911 | + diffFlags |= DIFF_STRIP_EOLCR; | |
| 1912 | + } | |
| 1843 | 1913 | if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE; |
| 1844 | 1914 | if( find_option("unified",0,0)!=0 ) diffFlags &= ~DIFF_SIDEBYSIDE; |
| 1845 | 1915 | if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>=0 ){ |
| 1846 | 1916 | if( f > DIFF_CONTEXT_MASK ) f = DIFF_CONTEXT_MASK; |
| 1847 | 1917 | diffFlags |= f + DIFF_CONTEXT_EX; |
| @@ -1930,11 +2000,11 @@ | ||
| 1930 | 2000 | typedef struct Annotator Annotator; |
| 1931 | 2001 | struct Annotator { |
| 1932 | 2002 | DContext c; /* The diff-engine context */ |
| 1933 | 2003 | struct AnnLine { /* Lines of the original files... */ |
| 1934 | 2004 | const char *z; /* The text of the line */ |
| 1935 | - short int n; /* Number of bytes (omitting trailing space and \n) */ | |
| 2005 | + short int n; /* Number of bytes (omitting trailing \n) */ | |
| 1936 | 2006 | short int iVers; /* Level at which tag was set */ |
| 1937 | 2007 | } *aOrig; |
| 1938 | 2008 | int nOrig; /* Number of elements in aOrig[] */ |
| 1939 | 2009 | int nVers; /* Number of versions analyzed */ |
| 1940 | 2010 | int bLimit; /* True if the iLimit was reached */ |
| @@ -1952,22 +2022,28 @@ | ||
| 1952 | 2022 | /* |
| 1953 | 2023 | ** Initialize the annotation process by specifying the file that is |
| 1954 | 2024 | ** to be annotated. The annotator takes control of the input Blob and |
| 1955 | 2025 | ** will release it when it is finished with it. |
| 1956 | 2026 | */ |
| 1957 | -static int annotation_start(Annotator *p, Blob *pInput){ | |
| 2027 | +static int annotation_start(Annotator *p, Blob *pInput, u64 diffFlags){ | |
| 1958 | 2028 | int i; |
| 1959 | 2029 | |
| 1960 | 2030 | memset(p, 0, sizeof(*p)); |
| 1961 | - p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo,1); | |
| 2031 | + if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){ | |
| 2032 | + p->c.same_fn = same_dline_ignore_allws; | |
| 2033 | + }else{ | |
| 2034 | + p->c.same_fn = same_dline; | |
| 2035 | + } | |
| 2036 | + p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo, | |
| 2037 | + diffFlags); | |
| 1962 | 2038 | if( p->c.aTo==0 ){ |
| 1963 | 2039 | return 1; |
| 1964 | 2040 | } |
| 1965 | 2041 | p->aOrig = fossil_malloc( sizeof(p->aOrig[0])*p->c.nTo ); |
| 1966 | 2042 | for(i=0; i<p->c.nTo; i++){ |
| 1967 | 2043 | p->aOrig[i].z = p->c.aTo[i].z; |
| 1968 | - p->aOrig[i].n = p->c.aTo[i].h & LENGTH_MASK; | |
| 2044 | + p->aOrig[i].n = p->c.aTo[i].n; | |
| 1969 | 2045 | p->aOrig[i].iVers = -1; |
| 1970 | 2046 | } |
| 1971 | 2047 | p->nOrig = p->c.nTo; |
| 1972 | 2048 | return 0; |
| 1973 | 2049 | } |
| @@ -1977,17 +2053,17 @@ | ||
| 1977 | 2053 | ** being annotated. Do another step of the annotation. Return true |
| 1978 | 2054 | ** if additional annotation is required. zPName is the tag to insert |
| 1979 | 2055 | ** on each line of the file being annotated that was contributed by |
| 1980 | 2056 | ** pParent. Memory to hold zPName is leaked. |
| 1981 | 2057 | */ |
| 1982 | -static int annotation_step(Annotator *p, Blob *pParent, int iVers){ | |
| 2058 | +static int annotation_step(Annotator *p, Blob *pParent, int iVers, u64 diffFlags){ | |
| 1983 | 2059 | int i, j; |
| 1984 | 2060 | int lnTo; |
| 1985 | 2061 | |
| 1986 | 2062 | /* Prepare the parent file to be diffed */ |
| 1987 | 2063 | p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent), |
| 1988 | - &p->c.nFrom, 1); | |
| 2064 | + &p->c.nFrom, diffFlags); | |
| 1989 | 2065 | if( p->c.aFrom==0 ){ |
| 1990 | 2066 | return 1; |
| 1991 | 2067 | } |
| 1992 | 2068 | |
| 1993 | 2069 | /* Compute the differences going from pParent to the file being |
| @@ -2020,13 +2096,13 @@ | ||
| 2020 | 2096 | /* Return no errors */ |
| 2021 | 2097 | return 0; |
| 2022 | 2098 | } |
| 2023 | 2099 | |
| 2024 | 2100 | |
| 2025 | -/* Annotation flags */ | |
| 2026 | -#define ANN_FILE_VERS 0x01 /* Show file vers rather than commit vers */ | |
| 2027 | -#define ANN_FILE_ANCEST 0x02 /* Prefer check-ins in the ANCESTOR table */ | |
| 2101 | +/* Annotation flags (any DIFF flag can be used as Annotation flag as well) */ | |
| 2102 | +#define ANN_FILE_VERS (((u64)0x20)<<32) /* Show file vers rather than commit vers */ | |
| 2103 | +#define ANN_FILE_ANCEST (((u64)0x40)<<32) /* Prefer check-ins in the ANCESTOR table */ | |
| 2028 | 2104 | |
| 2029 | 2105 | /* |
| 2030 | 2106 | ** Compute a complete annotation on a file. The file is identified |
| 2031 | 2107 | ** by its filename number (filename.fnid) and the baseline in which |
| 2032 | 2108 | ** it was checked in (mlink.mid). |
| @@ -2034,11 +2110,11 @@ | ||
| 2034 | 2110 | static void annotate_file( |
| 2035 | 2111 | Annotator *p, /* The annotator */ |
| 2036 | 2112 | int fnid, /* The name of the file to be annotated */ |
| 2037 | 2113 | int mid, /* Use the version of the file in this check-in */ |
| 2038 | 2114 | int iLimit, /* Limit the number of levels if greater than zero */ |
| 2039 | - int annFlags /* Flags to alter the annotation */ | |
| 2115 | + u64 annFlags /* Flags to alter the annotation */ | |
| 2040 | 2116 | ){ |
| 2041 | 2117 | Blob toAnnotate; /* Text of the final (mid) version of the file */ |
| 2042 | 2118 | Blob step; /* Text of previous revision */ |
| 2043 | 2119 | int rid; /* Artifact ID of the file being annotated */ |
| 2044 | 2120 | Stmt q; /* Query returning all ancestor versions */ |
| @@ -2052,11 +2128,12 @@ | ||
| 2052 | 2128 | } |
| 2053 | 2129 | if( !content_get(rid, &toAnnotate) ){ |
| 2054 | 2130 | fossil_fatal("unable to retrieve content of artifact #%d", rid); |
| 2055 | 2131 | } |
| 2056 | 2132 | if( iLimit<=0 ) iLimit = 1000000000; |
| 2057 | - annotation_start(p, &toAnnotate); | |
| 2133 | + blob_to_utf8_no_bom(&toAnnotate, 0); | |
| 2134 | + annotation_start(p, &toAnnotate, annFlags); | |
| 2058 | 2135 | db_begin_transaction(); |
| 2059 | 2136 | db_multi_exec( |
| 2060 | 2137 | "CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);" |
| 2061 | 2138 | "DELETE FROM vseen;" |
| 2062 | 2139 | ); |
| @@ -2086,11 +2163,12 @@ | ||
| 2086 | 2163 | p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1)); |
| 2087 | 2164 | p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2)); |
| 2088 | 2165 | p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3)); |
| 2089 | 2166 | if( p->nVers ){ |
| 2090 | 2167 | content_get(rid, &step); |
| 2091 | - annotation_step(p, &step, p->nVers-1); | |
| 2168 | + blob_to_utf8_no_bom(&step, 0); | |
| 2169 | + annotation_step(p, &step, p->nVers-1, annFlags); | |
| 2092 | 2170 | blob_reset(&step); |
| 2093 | 2171 | } |
| 2094 | 2172 | p->nVers++; |
| 2095 | 2173 | db_bind_int(&ins, ":rid", rid); |
| 2096 | 2174 | db_step(&ins); |
| @@ -2111,10 +2189,11 @@ | ||
| 2111 | 2189 | */ |
| 2112 | 2190 | unsigned gradient_color(unsigned c1, unsigned c2, int n, int i){ |
| 2113 | 2191 | unsigned c; /* Result color */ |
| 2114 | 2192 | unsigned x1, x2; |
| 2115 | 2193 | if( i==0 || n==0 ) return c1; |
| 2194 | + else if(i>=n) return c2; | |
| 2116 | 2195 | x1 = (c1>>16)&0xff; |
| 2117 | 2196 | x2 = (c2>>16)&0xff; |
| 2118 | 2197 | c = (x1*(n-i) + x2*i)/n<<16 & 0xff0000; |
| 2119 | 2198 | x1 = (c1>>8)&0xff; |
| 2120 | 2199 | x2 = (c2>>8)&0xff; |
| @@ -2126,10 +2205,11 @@ | ||
| 2126 | 2205 | } |
| 2127 | 2206 | |
| 2128 | 2207 | /* |
| 2129 | 2208 | ** WEBPAGE: annotate |
| 2130 | 2209 | ** WEBPAGE: blame |
| 2210 | +** WEBPAGE: praise | |
| 2131 | 2211 | ** |
| 2132 | 2212 | ** Query parameters: |
| 2133 | 2213 | ** |
| 2134 | 2214 | ** checkin=ID The manifest ID at which to start the annotation |
| 2135 | 2215 | ** filename=FILENAME The filename. |
| @@ -2140,31 +2220,35 @@ | ||
| 2140 | 2220 | void annotation_page(void){ |
| 2141 | 2221 | int mid; |
| 2142 | 2222 | int fnid; |
| 2143 | 2223 | int i; |
| 2144 | 2224 | int iLimit; /* Depth limit */ |
| 2145 | - int annFlags = ANN_FILE_ANCEST; | |
| 2225 | + u64 annFlags = (ANN_FILE_ANCEST|DIFF_STRIP_EOLCR); | |
| 2146 | 2226 | int showLog = 0; /* True to display the log */ |
| 2227 | + int ignoreWs = 0; /* Ignore whitespace */ | |
| 2147 | 2228 | const char *zFilename; /* Name of file to annotate */ |
| 2148 | 2229 | const char *zCI; /* The check-in containing zFilename */ |
| 2149 | 2230 | Annotator ann; |
| 2150 | 2231 | HQuery url; |
| 2151 | 2232 | struct AnnVers *p; |
| 2152 | 2233 | unsigned clr1, clr2, clr; |
| 2153 | - int bBlame = g.zPath[0]=='b';/* True for BLAME output. False for ANNOTATE. */ | |
| 2234 | + int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */ | |
| 2154 | 2235 | |
| 2155 | 2236 | /* Gather query parameters */ |
| 2156 | 2237 | showLog = atoi(PD("log","1")); |
| 2157 | 2238 | login_check_credentials(); |
| 2158 | 2239 | if( !g.perm.Read ){ login_needed(); return; } |
| 2159 | 2240 | if( exclude_spiders("annotate") ) return; |
| 2241 | + load_control(); | |
| 2160 | 2242 | mid = name_to_typed_rid(PD("checkin","0"),"ci"); |
| 2161 | 2243 | zFilename = P("filename"); |
| 2162 | 2244 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); |
| 2163 | 2245 | if( mid==0 || fnid==0 ){ fossil_redirect_home(); } |
| 2164 | 2246 | iLimit = atoi(PD("limit","20")); |
| 2165 | 2247 | if( P("filevers") ) annFlags |= ANN_FILE_VERS; |
| 2248 | + ignoreWs = P("w")!=0; | |
| 2249 | + if( ignoreWs ) annFlags |= DIFF_IGNORE_ALLWS; | |
| 2166 | 2250 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ |
| 2167 | 2251 | fossil_redirect_home(); |
| 2168 | 2252 | } |
| 2169 | 2253 | |
| 2170 | 2254 | /* compute the annotation */ |
| @@ -2172,17 +2256,29 @@ | ||
| 2172 | 2256 | annotate_file(&ann, fnid, mid, iLimit, annFlags); |
| 2173 | 2257 | zCI = ann.aVers[0].zMUuid; |
| 2174 | 2258 | |
| 2175 | 2259 | /* generate the web page */ |
| 2176 | 2260 | style_header("Annotation For %h", zFilename); |
| 2177 | - url_initialize(&url, "annotate"); | |
| 2261 | + if( bBlame ){ | |
| 2262 | + url_initialize(&url, "blame"); | |
| 2263 | + }else{ | |
| 2264 | + url_initialize(&url, "annotate"); | |
| 2265 | + } | |
| 2178 | 2266 | url_add_parameter(&url, "checkin", P("checkin")); |
| 2179 | 2267 | url_add_parameter(&url, "filename", zFilename); |
| 2180 | 2268 | if( iLimit!=20 ){ |
| 2181 | 2269 | url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit)); |
| 2182 | 2270 | } |
| 2183 | 2271 | url_add_parameter(&url, "log", showLog ? "1" : "0"); |
| 2272 | + if( ignoreWs ){ | |
| 2273 | + url_add_parameter(&url, "w", ""); | |
| 2274 | + style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes", | |
| 2275 | + "%s", url_render(&url, "w", 0, 0, 0)); | |
| 2276 | + }else{ | |
| 2277 | + style_submenu_element("Ignore Whitespace", "Ignore Whitespace", | |
| 2278 | + "%s", url_render(&url, "w", "", 0, 0)); | |
| 2279 | + } | |
| 2184 | 2280 | if( showLog ){ |
| 2185 | 2281 | style_submenu_element("Hide Log", "Hide Log", |
| 2186 | 2282 | "%s", url_render(&url, "log", "0", 0, 0)); |
| 2187 | 2283 | }else{ |
| 2188 | 2284 | style_submenu_element("Show Log", "Show Log", |
| @@ -2208,11 +2304,11 @@ | ||
| 2208 | 2304 | clr2 = 0xb5e0ff; /* Older changes: blue (cold) */ |
| 2209 | 2305 | } |
| 2210 | 2306 | for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){ |
| 2211 | 2307 | clr = gradient_color(clr1, clr2, ann.nVers-1, i); |
| 2212 | 2308 | ann.aVers[i].zBgColor = mprintf("#%06x", clr); |
| 2213 | - } | |
| 2309 | + } | |
| 2214 | 2310 | |
| 2215 | 2311 | if( showLog ){ |
| 2216 | 2312 | char *zLink = href("%R/finfo?name=%t&ci=%S",zFilename,zCI); |
| 2217 | 2313 | @ <h2>Ancestors of %z(zLink)%h(zFilename)</a> analyzed:</h2> |
| 2218 | 2314 | @ <ol> |
| @@ -2238,11 +2334,11 @@ | ||
| 2238 | 2334 | } |
| 2239 | 2335 | @ </ol> |
| 2240 | 2336 | @ <hr> |
| 2241 | 2337 | } |
| 2242 | 2338 | if( !ann.bLimit ){ |
| 2243 | - @ <h2>Origin for each line in | |
| 2339 | + @ <h2>Origin for each line in | |
| 2244 | 2340 | @ %z(href("%R/finfo?name=%h&ci=%S", zFilename, zCI))%h(zFilename)</a> |
| 2245 | 2341 | @ from check-in %z(href("%R/info/%S",zCI))%S(zCI)</a>:</h2> |
| 2246 | 2342 | iLimit = ann.nVers+10; |
| 2247 | 2343 | }else{ |
| 2248 | 2344 | @ <h2>Lines added by the %d(iLimit) most recent ancestors of |
| @@ -2291,22 +2387,25 @@ | ||
| 2291 | 2387 | } |
| 2292 | 2388 | |
| 2293 | 2389 | /* |
| 2294 | 2390 | ** COMMAND: annotate |
| 2295 | 2391 | ** COMMAND: blame |
| 2392 | +** COMMAND: praise | |
| 2296 | 2393 | ** |
| 2297 | -** %fossil (annotate|blame) ?OPTIONS? FILENAME | |
| 2394 | +** %fossil (annotate|blame|praise) ?OPTIONS? FILENAME | |
| 2298 | 2395 | ** |
| 2299 | 2396 | ** Output the text of a file with markings to show when each line of |
| 2300 | 2397 | ** the file was last modified. The "annotate" command shows line numbers |
| 2301 | -** and omits the username. The "blame" command shows the user who made each | |
| 2302 | -** checkin and omits the line number. | |
| 2398 | +** and omits the username. The "blame" and "praise" commands show the user | |
| 2399 | +** who made each checkin and omits the line number. | |
| 2303 | 2400 | ** |
| 2304 | 2401 | ** Options: |
| 2305 | -** --filevers Show file version numbers rather than check-in versions | |
| 2306 | -** -l|--log List all versions analyzed | |
| 2307 | -** -n|--limit N Only look backwards in time by N versions | |
| 2402 | +** --filevers Show file version numbers rather than check-in versions | |
| 2403 | +** -l|--log List all versions analyzed | |
| 2404 | +** -n|--limit N Only look backwards in time by N versions | |
| 2405 | +** -w|--ignore-all-space Ignore white space when comparing lines | |
| 2406 | +** -Z|--ignore-trailing-space Ignore whitespace at line end | |
| 2308 | 2407 | ** |
| 2309 | 2408 | ** See also: info, finfo, timeline |
| 2310 | 2409 | */ |
| 2311 | 2410 | void annotate_cmd(void){ |
| 2312 | 2411 | int fnid; /* Filename ID */ |
| @@ -2319,18 +2418,24 @@ | ||
| 2319 | 2418 | int i; /* Loop counter */ |
| 2320 | 2419 | const char *zLimit; /* The value to the -n|--limit option */ |
| 2321 | 2420 | int iLimit; /* How far back in time to look */ |
| 2322 | 2421 | int showLog; /* True to show the log */ |
| 2323 | 2422 | int fileVers; /* Show file version instead of check-in versions */ |
| 2324 | - int annFlags = 0; /* Flags to control annotation properties */ | |
| 2423 | + u64 annFlags = 0; /* Flags to control annotation properties */ | |
| 2325 | 2424 | int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */ |
| 2326 | 2425 | |
| 2327 | - bBlame = g.argv[1][0]=='b'; | |
| 2426 | + bBlame = g.argv[1][0]!='a'; | |
| 2328 | 2427 | zLimit = find_option("limit","n",1); |
| 2329 | 2428 | if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1"; |
| 2330 | 2429 | iLimit = atoi(zLimit); |
| 2331 | 2430 | showLog = find_option("log","l",0)!=0; |
| 2431 | + if( find_option("ignore-trailing-space","Z",0)!=0 ){ | |
| 2432 | + annFlags = DIFF_IGNORE_EOLWS; | |
| 2433 | + } | |
| 2434 | + if( find_option("ignore-all-space","w",0)!=0 ){ | |
| 2435 | + annFlags = DIFF_IGNORE_ALLWS; /* stronger than DIFF_IGNORE_EOLWS */ | |
| 2436 | + } | |
| 2332 | 2437 | fileVers = find_option("filevers",0,0)!=0; |
| 2333 | 2438 | db_must_be_within_tree(); |
| 2334 | 2439 | if( g.argc<3 ) { |
| 2335 | 2440 | usage("FILENAME"); |
| 2336 | 2441 | } |
| @@ -2355,11 +2460,11 @@ | ||
| 2355 | 2460 | " ORDER BY ancestor.generation ASC LIMIT 1", |
| 2356 | 2461 | fid, fnid); |
| 2357 | 2462 | if( mid==0 ){ |
| 2358 | 2463 | fossil_fatal("unable to find manifest"); |
| 2359 | 2464 | } |
| 2360 | - annFlags |= ANN_FILE_ANCEST; | |
| 2465 | + annFlags |= (ANN_FILE_ANCEST|DIFF_STRIP_EOLCR); | |
| 2361 | 2466 | annotate_file(&ann, fnid, mid, iLimit, annFlags); |
| 2362 | 2467 | if( showLog ){ |
| 2363 | 2468 | struct AnnVers *p; |
| 2364 | 2469 | for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){ |
| 2365 | 2470 | fossil_print("version %3d: %s %.10s file %.10s\n", |
| 2366 | 2471 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -29,21 +29,21 @@ | |
| 29 | ** of the diff output. |
| 30 | */ |
| 31 | #define DIFF_CONTEXT_MASK ((u64)0x0000ffff) /* Lines of context. Default if 0 */ |
| 32 | #define DIFF_WIDTH_MASK ((u64)0x00ff0000) /* side-by-side column width */ |
| 33 | #define DIFF_IGNORE_EOLWS ((u64)0x01000000) /* Ignore end-of-line whitespace */ |
| 34 | #define DIFF_SIDEBYSIDE ((u64)0x02000000) /* Generate a side-by-side diff */ |
| 35 | #define DIFF_VERBOSE ((u64)0x04000000) /* Missing shown as empty files */ |
| 36 | #define DIFF_BRIEF ((u64)0x08000000) /* Show filenames only */ |
| 37 | #define DIFF_INLINE ((u64)0x00000000) /* Inline (not side-by-side) diff */ |
| 38 | #define DIFF_HTML ((u64)0x10000000) /* Render for HTML */ |
| 39 | #define DIFF_LINENO ((u64)0x20000000) /* Show line numbers */ |
| 40 | #define DIFF_WS_WARNING ((u64)0x40000000) /* Warn about whitespace */ |
| 41 | #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */ |
| 42 | #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */ |
| 43 | #define DIFF_CONTEXT_EX (((u64)0x04)<<32) /* Use context even if zero */ |
| 44 | #define DIFF_NOTTOOBIG (((u64)0x08)<<32) /* Only display if not too big */ |
| 45 | |
| 46 | /* |
| 47 | ** These error messages are shared in multiple locations. They are defined |
| 48 | ** here for consistency. |
| 49 | */ |
| @@ -54,10 +54,13 @@ | |
| 54 | "cannot compute difference between symlink and regular file\n" |
| 55 | |
| 56 | #define DIFF_TOO_MANY_CHANGES \ |
| 57 | "more than 10,000 changes\n" |
| 58 | |
| 59 | /* |
| 60 | ** Maximum length of a line in a text file, in bytes. (2**13 = 8192 bytes) |
| 61 | */ |
| 62 | #define LENGTH_MASK_SZ 13 |
| 63 | #define LENGTH_MASK ((1<<LENGTH_MASK_SZ)-1) |
| @@ -73,10 +76,12 @@ | |
| 73 | */ |
| 74 | typedef struct DLine DLine; |
| 75 | struct DLine { |
| 76 | const char *z; /* The text of the line */ |
| 77 | unsigned int h; /* Hash of the line */ |
| 78 | unsigned int iNext; /* 1+(Index of next line with same the same hash) */ |
| 79 | |
| 80 | /* an array of DLine elements serves two purposes. The fields |
| 81 | ** above are one per line of input text. But each entry is also |
| 82 | ** a bucket in a hash table, as follows: */ |
| @@ -84,11 +89,11 @@ | |
| 84 | }; |
| 85 | |
| 86 | /* |
| 87 | ** Length of a dline |
| 88 | */ |
| 89 | #define LENGTH(X) ((X)->h & LENGTH_MASK) |
| 90 | |
| 91 | /* |
| 92 | ** A context for running a raw diff. |
| 93 | ** |
| 94 | ** The aEdit[] array describes the raw diff. Each triple of integers in |
| @@ -108,10 +113,11 @@ | |
| 108 | int nEditAlloc; /* Space allocated for aEdit[] */ |
| 109 | DLine *aFrom; /* File on left side of the diff */ |
| 110 | int nFrom; /* Number of lines in aFrom[] */ |
| 111 | DLine *aTo; /* File on right side of the diff */ |
| 112 | int nTo; /* Number of lines in aTo[] */ |
| 113 | }; |
| 114 | |
| 115 | /* |
| 116 | ** Return an array of DLine objects containing a pointer to the |
| 117 | ** start of each line and a hash of that line. The lower |
| @@ -125,12 +131,12 @@ | |
| 125 | ** too long. |
| 126 | ** |
| 127 | ** Profiling show that in most cases this routine consumes the bulk of |
| 128 | ** the CPU time on a diff. |
| 129 | */ |
| 130 | static DLine *break_into_lines(const char *z, int n, int *pnLine, int ignoreWS){ |
| 131 | int nLine, i, j, k, x; |
| 132 | unsigned int h, h2; |
| 133 | DLine *a; |
| 134 | |
| 135 | /* Count the number of lines. Allocate space to hold |
| 136 | ** the returned array. |
| @@ -158,18 +164,39 @@ | |
| 158 | return a; |
| 159 | } |
| 160 | |
| 161 | /* Fill in the array */ |
| 162 | for(i=0; i<nLine; i++){ |
| 163 | a[i].z = z; |
| 164 | for(j=0; z[j] && z[j]!='\n'; j++){} |
| 165 | k = j; |
| 166 | while( ignoreWS && k>0 && fossil_isspace(z[k-1]) ){ k--; } |
| 167 | for(h=0, x=0; x<=k; x++){ |
| 168 | h = h ^ (h<<2) ^ z[x]; |
| 169 | } |
| 170 | a[i].h = h = (h<<LENGTH_MASK_SZ) | k;; |
| 171 | h2 = h % nLine; |
| 172 | a[i].iNext = a[h2].iHash; |
| 173 | a[h2].iHash = i+1; |
| 174 | z += j+1; |
| 175 | } |
| @@ -180,12 +207,31 @@ | |
| 180 | } |
| 181 | |
| 182 | /* |
| 183 | ** Return true if two DLine elements are identical. |
| 184 | */ |
| 185 | static int same_dline(DLine *pA, DLine *pB){ |
| 186 | return pA->h==pB->h && memcmp(pA->z,pB->z,pA->h & LENGTH_MASK)==0; |
| 187 | } |
| 188 | |
| 189 | /* |
| 190 | ** Return true if the regular expression *pRe matches any of the |
| 191 | ** N dlines |
| @@ -221,16 +267,16 @@ | |
| 221 | }else if( cPrefix=='+' ){ |
| 222 | blob_append(pOut, "<span class=\"diffadd\">", -1); |
| 223 | }else if( cPrefix=='-' ){ |
| 224 | blob_append(pOut, "<span class=\"diffrm\">", -1); |
| 225 | } |
| 226 | htmlize_to_blob(pOut, pLine->z, (pLine->h & LENGTH_MASK)); |
| 227 | if( cPrefix!=' ' ){ |
| 228 | blob_append(pOut, "</span>", -1); |
| 229 | } |
| 230 | }else{ |
| 231 | blob_append(pOut, pLine->z, pLine->h & LENGTH_MASK); |
| 232 | } |
| 233 | blob_append(pOut, "\n", 1); |
| 234 | } |
| 235 | |
| 236 | /* |
| @@ -402,11 +448,11 @@ | |
| 402 | b += m; |
| 403 | if( i<nr-1 ){ |
| 404 | m = R[r+i*3+3]; |
| 405 | for(j=0; j<m; j++){ |
| 406 | if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html); |
| 407 | appendDiffLine(pOut, ' ', &B[b+j], html, 0); |
| 408 | } |
| 409 | b += m; |
| 410 | a += m; |
| 411 | } |
| 412 | } |
| @@ -415,11 +461,11 @@ | |
| 415 | assert( nr==i ); |
| 416 | m = R[r+nr*3]; |
| 417 | if( m>nContext ) m = nContext; |
| 418 | for(j=0; j<m; j++){ |
| 419 | if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html); |
| 420 | appendDiffLine(pOut, ' ', &B[b+j], html, 0); |
| 421 | } |
| 422 | } |
| 423 | } |
| 424 | |
| 425 | /* |
| @@ -476,11 +522,11 @@ | |
| 476 | ** This comment contains multibyte unicode characters (ü, Æ, ð) in order |
| 477 | ** to test the ability of the diff code to handle such characters. |
| 478 | */ |
| 479 | static void sbsWriteText(SbsLine *p, DLine *pLine, int col){ |
| 480 | Blob *pCol = p->apCols[col]; |
| 481 | int n = pLine->h & LENGTH_MASK; |
| 482 | int i; /* Number of input characters consumed */ |
| 483 | int k; /* Cursor position */ |
| 484 | int needEndSpan = 0; |
| 485 | const char *zIn = pLine->z; |
| 486 | int w = p->width; |
| @@ -1305,11 +1351,11 @@ | |
| 1305 | sbsWriteMarker(&s, " ", ""); |
| 1306 | sbsWriteLineno(&s, b+j, SBS_LNB); |
| 1307 | sbsWriteText(&s, &B[b+j], SBS_TXTB); |
| 1308 | } |
| 1309 | } |
| 1310 | |
| 1311 | if( s.escHtml && blob_size(s.apCols[SBS_LNA])>0 ){ |
| 1312 | blob_append(pOut, "<table class=\"sbsdiffcols\"><tr>\n", -1); |
| 1313 | for(i=SBS_LNA; i<=SBS_TXTB; i++){ |
| 1314 | sbsWriteColumn(pOut, s.apCols[i], i); |
| 1315 | blob_reset(s.apCols[i]); |
| @@ -1337,16 +1383,16 @@ | |
| 1337 | int iSXb = iS1; /* Best match so far */ |
| 1338 | int iSYb = iS2; /* Best match so far */ |
| 1339 | |
| 1340 | for(i=iS1; i<iE1-mxLength; i++){ |
| 1341 | for(j=iS2; j<iE2-mxLength; j++){ |
| 1342 | if( !same_dline(&p->aFrom[i], &p->aTo[j]) ) continue; |
| 1343 | if( mxLength && !same_dline(&p->aFrom[i+mxLength], &p->aTo[j+mxLength]) ){ |
| 1344 | continue; |
| 1345 | } |
| 1346 | k = 1; |
| 1347 | while( i+k<iE1 && j+k<iE2 && same_dline(&p->aFrom[i+k],&p->aTo[j+k]) ){ |
| 1348 | k++; |
| 1349 | } |
| 1350 | if( k>mxLength ){ |
| 1351 | iSXb = i; |
| 1352 | iSYb = j; |
| @@ -1408,11 +1454,11 @@ | |
| 1408 | mid = (iE1 + iS1)/2; |
| 1409 | for(i=iS1; i<iE1; i++){ |
| 1410 | int limit = 0; |
| 1411 | j = p->aTo[p->aFrom[i].h % p->nTo].iHash; |
| 1412 | while( j>0 |
| 1413 | && (j-1<iS2 || j>=iE2 || !same_dline(&p->aFrom[i], &p->aTo[j-1])) |
| 1414 | ){ |
| 1415 | if( limit++ > 10 ){ |
| 1416 | j = 0; |
| 1417 | break; |
| 1418 | } |
| @@ -1425,19 +1471,19 @@ | |
| 1425 | iSX = i; |
| 1426 | iSY = j-1; |
| 1427 | pA = &p->aFrom[iSX-1]; |
| 1428 | pB = &p->aTo[iSY-1]; |
| 1429 | n = minInt(iSX-iS1, iSY-iS2); |
| 1430 | for(k=0; k<n && same_dline(pA,pB); k++, pA--, pB--){} |
| 1431 | iSX -= k; |
| 1432 | iSY -= k; |
| 1433 | iEX = i+1; |
| 1434 | iEY = j; |
| 1435 | pA = &p->aFrom[iEX]; |
| 1436 | pB = &p->aTo[iEY]; |
| 1437 | n = minInt(iE1-iEX, iE2-iEY); |
| 1438 | for(k=0; k<n && same_dline(pA,pB); k++, pA++, pB++){} |
| 1439 | iEX += k; |
| 1440 | iEY += k; |
| 1441 | skew = (iSX-iS1) - (iSY-iS2); |
| 1442 | if( skew<0 ) skew = -skew; |
| 1443 | dist = (iSX+iEX)/2 - mid; |
| @@ -1574,16 +1620,16 @@ | |
| 1574 | int mnE, iS, iE1, iE2; |
| 1575 | |
| 1576 | /* Carve off the common header and footer */ |
| 1577 | iE1 = p->nFrom; |
| 1578 | iE2 = p->nTo; |
| 1579 | while( iE1>0 && iE2>0 && same_dline(&p->aFrom[iE1-1], &p->aTo[iE2-1]) ){ |
| 1580 | iE1--; |
| 1581 | iE2--; |
| 1582 | } |
| 1583 | mnE = iE1<iE2 ? iE1 : iE2; |
| 1584 | for(iS=0; iS<mnE && same_dline(&p->aFrom[iS],&p->aTo[iS]); iS++){} |
| 1585 | |
| 1586 | /* do the difference */ |
| 1587 | if( iS>0 ){ |
| 1588 | appendTriple(p, iS, 0, 0); |
| 1589 | } |
| @@ -1648,11 +1694,11 @@ | |
| 1648 | |
| 1649 | /* Shift insertions toward the beginning of the file */ |
| 1650 | while( cpy>0 && del==0 && ins>0 ){ |
| 1651 | DLine *pTop = &p->aFrom[lnFrom-1]; /* Line before start of insert */ |
| 1652 | DLine *pBtm = &p->aTo[lnTo+ins-1]; /* Last line inserted */ |
| 1653 | if( same_dline(pTop, pBtm)==0 ) break; |
| 1654 | if( LENGTH(pTop+1)+LENGTH(pBtm)<=LENGTH(pTop)+LENGTH(pBtm-1) ) break; |
| 1655 | lnFrom--; |
| 1656 | lnTo--; |
| 1657 | p->aEdit[r]--; |
| 1658 | p->aEdit[r+3]++; |
| @@ -1661,11 +1707,11 @@ | |
| 1661 | |
| 1662 | /* Shift insertions toward the end of the file */ |
| 1663 | while( r+3<p->nEdit && p->aEdit[r+3]>0 && del==0 && ins>0 ){ |
| 1664 | DLine *pTop = &p->aTo[lnTo]; /* First line inserted */ |
| 1665 | DLine *pBtm = &p->aTo[lnTo+ins]; /* First line past end of insert */ |
| 1666 | if( same_dline(pTop, pBtm)==0 ) break; |
| 1667 | if( LENGTH(pTop)+LENGTH(pBtm-1)<=LENGTH(pTop+1)+LENGTH(pBtm) ) break; |
| 1668 | lnFrom++; |
| 1669 | lnTo++; |
| 1670 | p->aEdit[r]++; |
| 1671 | p->aEdit[r+3]--; |
| @@ -1674,11 +1720,11 @@ | |
| 1674 | |
| 1675 | /* Shift deletions toward the beginning of the file */ |
| 1676 | while( cpy>0 && del>0 && ins==0 ){ |
| 1677 | DLine *pTop = &p->aFrom[lnFrom-1]; /* Line before start of delete */ |
| 1678 | DLine *pBtm = &p->aFrom[lnFrom+del-1]; /* Last line deleted */ |
| 1679 | if( same_dline(pTop, pBtm)==0 ) break; |
| 1680 | if( LENGTH(pTop+1)+LENGTH(pBtm)<=LENGTH(pTop)+LENGTH(pBtm-1) ) break; |
| 1681 | lnFrom--; |
| 1682 | lnTo--; |
| 1683 | p->aEdit[r]--; |
| 1684 | p->aEdit[r+3]++; |
| @@ -1687,11 +1733,11 @@ | |
| 1687 | |
| 1688 | /* Shift deletions toward the end of the file */ |
| 1689 | while( r+3<p->nEdit && p->aEdit[r+3]>0 && del>0 && ins==0 ){ |
| 1690 | DLine *pTop = &p->aFrom[lnFrom]; /* First line deleted */ |
| 1691 | DLine *pBtm = &p->aFrom[lnFrom+del]; /* First line past end of delete */ |
| 1692 | if( same_dline(pTop, pBtm)==0 ) break; |
| 1693 | if( LENGTH(pTop)+LENGTH(pBtm-1)<=LENGTH(pTop)+LENGTH(pBtm) ) break; |
| 1694 | lnFrom++; |
| 1695 | lnTo++; |
| 1696 | p->aEdit[r]++; |
| 1697 | p->aEdit[r+3]--; |
| @@ -1753,28 +1799,33 @@ | |
| 1753 | Blob *pB_Blob, /* TO file */ |
| 1754 | Blob *pOut, /* Write diff here if not NULL */ |
| 1755 | ReCompiled *pRe, /* Only output changes where this Regexp matches */ |
| 1756 | u64 diffFlags /* DIFF_* flags defined above */ |
| 1757 | ){ |
| 1758 | int ignoreEolWs; /* Ignore whitespace at the end of lines */ |
| 1759 | DContext c; |
| 1760 | |
| 1761 | if( diffFlags & DIFF_INVERT ){ |
| 1762 | Blob *pTemp = pA_Blob; |
| 1763 | pA_Blob = pB_Blob; |
| 1764 | pB_Blob = pTemp; |
| 1765 | } |
| 1766 | ignoreEolWs = (diffFlags & DIFF_IGNORE_EOLWS)!=0; |
| 1767 | blob_to_utf8_no_bom(pA_Blob, 0); |
| 1768 | blob_to_utf8_no_bom(pB_Blob, 0); |
| 1769 | |
| 1770 | /* Prepare the input files */ |
| 1771 | memset(&c, 0, sizeof(c)); |
| 1772 | c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob), |
| 1773 | &c.nFrom, ignoreEolWs); |
| 1774 | c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob), |
| 1775 | &c.nTo, ignoreEolWs); |
| 1776 | if( c.aFrom==0 || c.aTo==0 ){ |
| 1777 | fossil_free(c.aFrom); |
| 1778 | fossil_free(c.aTo); |
| 1779 | if( pOut ){ |
| 1780 | diff_errmsg(pOut, DIFF_CANNOT_COMPUTE_BINARY, diffFlags); |
| @@ -1782,20 +1833,27 @@ | |
| 1782 | return 0; |
| 1783 | } |
| 1784 | |
| 1785 | /* Compute the difference */ |
| 1786 | diff_all(&c); |
| 1787 | if( (diffFlags & DIFF_NOTTOOBIG)!=0 ){ |
| 1788 | int i, m, n; |
| 1789 | int *a = c.aEdit; |
| 1790 | int mx = c.nEdit; |
| 1791 | for(i=m=n=0; i<mx; i+=3){ m += a[i]; n += a[i+1]+a[i+2]; } |
| 1792 | if( n>10000 ){ |
| 1793 | fossil_free(c.aFrom); |
| 1794 | fossil_free(c.aTo); |
| 1795 | fossil_free(c.aEdit); |
| 1796 | diff_errmsg(pOut, DIFF_TOO_MANY_CHANGES, diffFlags); |
| 1797 | return 0; |
| 1798 | } |
| 1799 | } |
| 1800 | if( (diffFlags & DIFF_NOOPT)==0 ){ |
| 1801 | diff_optimize(&c); |
| @@ -1824,24 +1882,36 @@ | |
| 1824 | |
| 1825 | /* |
| 1826 | ** Process diff-related command-line options and return an appropriate |
| 1827 | ** "diffFlags" integer. |
| 1828 | ** |
| 1829 | ** --brief Show filenames only DIFF_BRIEF |
| 1830 | ** --context|-c N N lines of context. DIFF_CONTEXT_MASK |
| 1831 | ** --html Format for HTML DIFF_HTML |
| 1832 | ** --invert Invert the diff DIFF_INVERT |
| 1833 | ** --linenum|-n Show line numbers DIFF_LINENO |
| 1834 | ** --noopt Disable optimization DIFF_NOOPT |
| 1835 | ** --side-by-side|-y Side-by-side diff. DIFF_SIDEBYSIDE |
| 1836 | ** --unified Unified diff. ~DIFF_SIDEBYSIDE |
| 1837 | ** --width|-W N N character lines. DIFF_WIDTH_MASK |
| 1838 | */ |
| 1839 | u64 diff_options(void){ |
| 1840 | u64 diffFlags = 0; |
| 1841 | const char *z; |
| 1842 | int f; |
| 1843 | if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE; |
| 1844 | if( find_option("unified",0,0)!=0 ) diffFlags &= ~DIFF_SIDEBYSIDE; |
| 1845 | if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>=0 ){ |
| 1846 | if( f > DIFF_CONTEXT_MASK ) f = DIFF_CONTEXT_MASK; |
| 1847 | diffFlags |= f + DIFF_CONTEXT_EX; |
| @@ -1930,11 +2000,11 @@ | |
| 1930 | typedef struct Annotator Annotator; |
| 1931 | struct Annotator { |
| 1932 | DContext c; /* The diff-engine context */ |
| 1933 | struct AnnLine { /* Lines of the original files... */ |
| 1934 | const char *z; /* The text of the line */ |
| 1935 | short int n; /* Number of bytes (omitting trailing space and \n) */ |
| 1936 | short int iVers; /* Level at which tag was set */ |
| 1937 | } *aOrig; |
| 1938 | int nOrig; /* Number of elements in aOrig[] */ |
| 1939 | int nVers; /* Number of versions analyzed */ |
| 1940 | int bLimit; /* True if the iLimit was reached */ |
| @@ -1952,22 +2022,28 @@ | |
| 1952 | /* |
| 1953 | ** Initialize the annotation process by specifying the file that is |
| 1954 | ** to be annotated. The annotator takes control of the input Blob and |
| 1955 | ** will release it when it is finished with it. |
| 1956 | */ |
| 1957 | static int annotation_start(Annotator *p, Blob *pInput){ |
| 1958 | int i; |
| 1959 | |
| 1960 | memset(p, 0, sizeof(*p)); |
| 1961 | p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo,1); |
| 1962 | if( p->c.aTo==0 ){ |
| 1963 | return 1; |
| 1964 | } |
| 1965 | p->aOrig = fossil_malloc( sizeof(p->aOrig[0])*p->c.nTo ); |
| 1966 | for(i=0; i<p->c.nTo; i++){ |
| 1967 | p->aOrig[i].z = p->c.aTo[i].z; |
| 1968 | p->aOrig[i].n = p->c.aTo[i].h & LENGTH_MASK; |
| 1969 | p->aOrig[i].iVers = -1; |
| 1970 | } |
| 1971 | p->nOrig = p->c.nTo; |
| 1972 | return 0; |
| 1973 | } |
| @@ -1977,17 +2053,17 @@ | |
| 1977 | ** being annotated. Do another step of the annotation. Return true |
| 1978 | ** if additional annotation is required. zPName is the tag to insert |
| 1979 | ** on each line of the file being annotated that was contributed by |
| 1980 | ** pParent. Memory to hold zPName is leaked. |
| 1981 | */ |
| 1982 | static int annotation_step(Annotator *p, Blob *pParent, int iVers){ |
| 1983 | int i, j; |
| 1984 | int lnTo; |
| 1985 | |
| 1986 | /* Prepare the parent file to be diffed */ |
| 1987 | p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent), |
| 1988 | &p->c.nFrom, 1); |
| 1989 | if( p->c.aFrom==0 ){ |
| 1990 | return 1; |
| 1991 | } |
| 1992 | |
| 1993 | /* Compute the differences going from pParent to the file being |
| @@ -2020,13 +2096,13 @@ | |
| 2020 | /* Return no errors */ |
| 2021 | return 0; |
| 2022 | } |
| 2023 | |
| 2024 | |
| 2025 | /* Annotation flags */ |
| 2026 | #define ANN_FILE_VERS 0x01 /* Show file vers rather than commit vers */ |
| 2027 | #define ANN_FILE_ANCEST 0x02 /* Prefer check-ins in the ANCESTOR table */ |
| 2028 | |
| 2029 | /* |
| 2030 | ** Compute a complete annotation on a file. The file is identified |
| 2031 | ** by its filename number (filename.fnid) and the baseline in which |
| 2032 | ** it was checked in (mlink.mid). |
| @@ -2034,11 +2110,11 @@ | |
| 2034 | static void annotate_file( |
| 2035 | Annotator *p, /* The annotator */ |
| 2036 | int fnid, /* The name of the file to be annotated */ |
| 2037 | int mid, /* Use the version of the file in this check-in */ |
| 2038 | int iLimit, /* Limit the number of levels if greater than zero */ |
| 2039 | int annFlags /* Flags to alter the annotation */ |
| 2040 | ){ |
| 2041 | Blob toAnnotate; /* Text of the final (mid) version of the file */ |
| 2042 | Blob step; /* Text of previous revision */ |
| 2043 | int rid; /* Artifact ID of the file being annotated */ |
| 2044 | Stmt q; /* Query returning all ancestor versions */ |
| @@ -2052,11 +2128,12 @@ | |
| 2052 | } |
| 2053 | if( !content_get(rid, &toAnnotate) ){ |
| 2054 | fossil_fatal("unable to retrieve content of artifact #%d", rid); |
| 2055 | } |
| 2056 | if( iLimit<=0 ) iLimit = 1000000000; |
| 2057 | annotation_start(p, &toAnnotate); |
| 2058 | db_begin_transaction(); |
| 2059 | db_multi_exec( |
| 2060 | "CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);" |
| 2061 | "DELETE FROM vseen;" |
| 2062 | ); |
| @@ -2086,11 +2163,12 @@ | |
| 2086 | p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1)); |
| 2087 | p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2)); |
| 2088 | p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3)); |
| 2089 | if( p->nVers ){ |
| 2090 | content_get(rid, &step); |
| 2091 | annotation_step(p, &step, p->nVers-1); |
| 2092 | blob_reset(&step); |
| 2093 | } |
| 2094 | p->nVers++; |
| 2095 | db_bind_int(&ins, ":rid", rid); |
| 2096 | db_step(&ins); |
| @@ -2111,10 +2189,11 @@ | |
| 2111 | */ |
| 2112 | unsigned gradient_color(unsigned c1, unsigned c2, int n, int i){ |
| 2113 | unsigned c; /* Result color */ |
| 2114 | unsigned x1, x2; |
| 2115 | if( i==0 || n==0 ) return c1; |
| 2116 | x1 = (c1>>16)&0xff; |
| 2117 | x2 = (c2>>16)&0xff; |
| 2118 | c = (x1*(n-i) + x2*i)/n<<16 & 0xff0000; |
| 2119 | x1 = (c1>>8)&0xff; |
| 2120 | x2 = (c2>>8)&0xff; |
| @@ -2126,10 +2205,11 @@ | |
| 2126 | } |
| 2127 | |
| 2128 | /* |
| 2129 | ** WEBPAGE: annotate |
| 2130 | ** WEBPAGE: blame |
| 2131 | ** |
| 2132 | ** Query parameters: |
| 2133 | ** |
| 2134 | ** checkin=ID The manifest ID at which to start the annotation |
| 2135 | ** filename=FILENAME The filename. |
| @@ -2140,31 +2220,35 @@ | |
| 2140 | void annotation_page(void){ |
| 2141 | int mid; |
| 2142 | int fnid; |
| 2143 | int i; |
| 2144 | int iLimit; /* Depth limit */ |
| 2145 | int annFlags = ANN_FILE_ANCEST; |
| 2146 | int showLog = 0; /* True to display the log */ |
| 2147 | const char *zFilename; /* Name of file to annotate */ |
| 2148 | const char *zCI; /* The check-in containing zFilename */ |
| 2149 | Annotator ann; |
| 2150 | HQuery url; |
| 2151 | struct AnnVers *p; |
| 2152 | unsigned clr1, clr2, clr; |
| 2153 | int bBlame = g.zPath[0]=='b';/* True for BLAME output. False for ANNOTATE. */ |
| 2154 | |
| 2155 | /* Gather query parameters */ |
| 2156 | showLog = atoi(PD("log","1")); |
| 2157 | login_check_credentials(); |
| 2158 | if( !g.perm.Read ){ login_needed(); return; } |
| 2159 | if( exclude_spiders("annotate") ) return; |
| 2160 | mid = name_to_typed_rid(PD("checkin","0"),"ci"); |
| 2161 | zFilename = P("filename"); |
| 2162 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); |
| 2163 | if( mid==0 || fnid==0 ){ fossil_redirect_home(); } |
| 2164 | iLimit = atoi(PD("limit","20")); |
| 2165 | if( P("filevers") ) annFlags |= ANN_FILE_VERS; |
| 2166 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ |
| 2167 | fossil_redirect_home(); |
| 2168 | } |
| 2169 | |
| 2170 | /* compute the annotation */ |
| @@ -2172,17 +2256,29 @@ | |
| 2172 | annotate_file(&ann, fnid, mid, iLimit, annFlags); |
| 2173 | zCI = ann.aVers[0].zMUuid; |
| 2174 | |
| 2175 | /* generate the web page */ |
| 2176 | style_header("Annotation For %h", zFilename); |
| 2177 | url_initialize(&url, "annotate"); |
| 2178 | url_add_parameter(&url, "checkin", P("checkin")); |
| 2179 | url_add_parameter(&url, "filename", zFilename); |
| 2180 | if( iLimit!=20 ){ |
| 2181 | url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit)); |
| 2182 | } |
| 2183 | url_add_parameter(&url, "log", showLog ? "1" : "0"); |
| 2184 | if( showLog ){ |
| 2185 | style_submenu_element("Hide Log", "Hide Log", |
| 2186 | "%s", url_render(&url, "log", "0", 0, 0)); |
| 2187 | }else{ |
| 2188 | style_submenu_element("Show Log", "Show Log", |
| @@ -2208,11 +2304,11 @@ | |
| 2208 | clr2 = 0xb5e0ff; /* Older changes: blue (cold) */ |
| 2209 | } |
| 2210 | for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){ |
| 2211 | clr = gradient_color(clr1, clr2, ann.nVers-1, i); |
| 2212 | ann.aVers[i].zBgColor = mprintf("#%06x", clr); |
| 2213 | } |
| 2214 | |
| 2215 | if( showLog ){ |
| 2216 | char *zLink = href("%R/finfo?name=%t&ci=%S",zFilename,zCI); |
| 2217 | @ <h2>Ancestors of %z(zLink)%h(zFilename)</a> analyzed:</h2> |
| 2218 | @ <ol> |
| @@ -2238,11 +2334,11 @@ | |
| 2238 | } |
| 2239 | @ </ol> |
| 2240 | @ <hr> |
| 2241 | } |
| 2242 | if( !ann.bLimit ){ |
| 2243 | @ <h2>Origin for each line in |
| 2244 | @ %z(href("%R/finfo?name=%h&ci=%S", zFilename, zCI))%h(zFilename)</a> |
| 2245 | @ from check-in %z(href("%R/info/%S",zCI))%S(zCI)</a>:</h2> |
| 2246 | iLimit = ann.nVers+10; |
| 2247 | }else{ |
| 2248 | @ <h2>Lines added by the %d(iLimit) most recent ancestors of |
| @@ -2291,22 +2387,25 @@ | |
| 2291 | } |
| 2292 | |
| 2293 | /* |
| 2294 | ** COMMAND: annotate |
| 2295 | ** COMMAND: blame |
| 2296 | ** |
| 2297 | ** %fossil (annotate|blame) ?OPTIONS? FILENAME |
| 2298 | ** |
| 2299 | ** Output the text of a file with markings to show when each line of |
| 2300 | ** the file was last modified. The "annotate" command shows line numbers |
| 2301 | ** and omits the username. The "blame" command shows the user who made each |
| 2302 | ** checkin and omits the line number. |
| 2303 | ** |
| 2304 | ** Options: |
| 2305 | ** --filevers Show file version numbers rather than check-in versions |
| 2306 | ** -l|--log List all versions analyzed |
| 2307 | ** -n|--limit N Only look backwards in time by N versions |
| 2308 | ** |
| 2309 | ** See also: info, finfo, timeline |
| 2310 | */ |
| 2311 | void annotate_cmd(void){ |
| 2312 | int fnid; /* Filename ID */ |
| @@ -2319,18 +2418,24 @@ | |
| 2319 | int i; /* Loop counter */ |
| 2320 | const char *zLimit; /* The value to the -n|--limit option */ |
| 2321 | int iLimit; /* How far back in time to look */ |
| 2322 | int showLog; /* True to show the log */ |
| 2323 | int fileVers; /* Show file version instead of check-in versions */ |
| 2324 | int annFlags = 0; /* Flags to control annotation properties */ |
| 2325 | int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */ |
| 2326 | |
| 2327 | bBlame = g.argv[1][0]=='b'; |
| 2328 | zLimit = find_option("limit","n",1); |
| 2329 | if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1"; |
| 2330 | iLimit = atoi(zLimit); |
| 2331 | showLog = find_option("log","l",0)!=0; |
| 2332 | fileVers = find_option("filevers",0,0)!=0; |
| 2333 | db_must_be_within_tree(); |
| 2334 | if( g.argc<3 ) { |
| 2335 | usage("FILENAME"); |
| 2336 | } |
| @@ -2355,11 +2460,11 @@ | |
| 2355 | " ORDER BY ancestor.generation ASC LIMIT 1", |
| 2356 | fid, fnid); |
| 2357 | if( mid==0 ){ |
| 2358 | fossil_fatal("unable to find manifest"); |
| 2359 | } |
| 2360 | annFlags |= ANN_FILE_ANCEST; |
| 2361 | annotate_file(&ann, fnid, mid, iLimit, annFlags); |
| 2362 | if( showLog ){ |
| 2363 | struct AnnVers *p; |
| 2364 | for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){ |
| 2365 | fossil_print("version %3d: %s %.10s file %.10s\n", |
| 2366 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -29,21 +29,21 @@ | |
| 29 | ** of the diff output. |
| 30 | */ |
| 31 | #define DIFF_CONTEXT_MASK ((u64)0x0000ffff) /* Lines of context. Default if 0 */ |
| 32 | #define DIFF_WIDTH_MASK ((u64)0x00ff0000) /* side-by-side column width */ |
| 33 | #define DIFF_IGNORE_EOLWS ((u64)0x01000000) /* Ignore end-of-line whitespace */ |
| 34 | #define DIFF_IGNORE_ALLWS ((u64)0x03000000) /* Ignore all whitespace */ |
| 35 | #define DIFF_SIDEBYSIDE ((u64)0x04000000) /* Generate a side-by-side diff */ |
| 36 | #define DIFF_VERBOSE ((u64)0x08000000) /* Missing shown as empty files */ |
| 37 | #define DIFF_BRIEF ((u64)0x10000000) /* Show filenames only */ |
| 38 | #define DIFF_HTML ((u64)0x20000000) /* Render for HTML */ |
| 39 | #define DIFF_LINENO ((u64)0x40000000) /* Show line numbers */ |
| 40 | #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */ |
| 41 | #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */ |
| 42 | #define DIFF_CONTEXT_EX (((u64)0x04)<<32) /* Use context even if zero */ |
| 43 | #define DIFF_NOTTOOBIG (((u64)0x08)<<32) /* Only display if not too big */ |
| 44 | #define DIFF_STRIP_EOLCR (((u64)0x10)<<32) /* Strip trailing CR */ |
| 45 | |
| 46 | /* |
| 47 | ** These error messages are shared in multiple locations. They are defined |
| 48 | ** here for consistency. |
| 49 | */ |
| @@ -54,10 +54,13 @@ | |
| 54 | "cannot compute difference between symlink and regular file\n" |
| 55 | |
| 56 | #define DIFF_TOO_MANY_CHANGES \ |
| 57 | "more than 10,000 changes\n" |
| 58 | |
| 59 | #define DIFF_WHITESPACE_ONLY \ |
| 60 | "whitespace changes only\n" |
| 61 | |
| 62 | /* |
| 63 | ** Maximum length of a line in a text file, in bytes. (2**13 = 8192 bytes) |
| 64 | */ |
| 65 | #define LENGTH_MASK_SZ 13 |
| 66 | #define LENGTH_MASK ((1<<LENGTH_MASK_SZ)-1) |
| @@ -73,10 +76,12 @@ | |
| 76 | */ |
| 77 | typedef struct DLine DLine; |
| 78 | struct DLine { |
| 79 | const char *z; /* The text of the line */ |
| 80 | unsigned int h; /* Hash of the line */ |
| 81 | unsigned short indent; /* Indent of the line. Only !=0 with -w/-Z option */ |
| 82 | unsigned short n; /* number of bytes */ |
| 83 | unsigned int iNext; /* 1+(Index of next line with same the same hash) */ |
| 84 | |
| 85 | /* an array of DLine elements serves two purposes. The fields |
| 86 | ** above are one per line of input text. But each entry is also |
| 87 | ** a bucket in a hash table, as follows: */ |
| @@ -84,11 +89,11 @@ | |
| 89 | }; |
| 90 | |
| 91 | /* |
| 92 | ** Length of a dline |
| 93 | */ |
| 94 | #define LENGTH(X) ((X)->n) |
| 95 | |
| 96 | /* |
| 97 | ** A context for running a raw diff. |
| 98 | ** |
| 99 | ** The aEdit[] array describes the raw diff. Each triple of integers in |
| @@ -108,10 +113,11 @@ | |
| 113 | int nEditAlloc; /* Space allocated for aEdit[] */ |
| 114 | DLine *aFrom; /* File on left side of the diff */ |
| 115 | int nFrom; /* Number of lines in aFrom[] */ |
| 116 | DLine *aTo; /* File on right side of the diff */ |
| 117 | int nTo; /* Number of lines in aTo[] */ |
| 118 | int (*same_fn)(const DLine *, const DLine *); /* Function to be used for comparing */ |
| 119 | }; |
| 120 | |
| 121 | /* |
| 122 | ** Return an array of DLine objects containing a pointer to the |
| 123 | ** start of each line and a hash of that line. The lower |
| @@ -125,12 +131,12 @@ | |
| 131 | ** too long. |
| 132 | ** |
| 133 | ** Profiling show that in most cases this routine consumes the bulk of |
| 134 | ** the CPU time on a diff. |
| 135 | */ |
| 136 | static DLine *break_into_lines(const char *z, int n, int *pnLine, u64 diffFlags){ |
| 137 | int nLine, i, j, k, s, x; |
| 138 | unsigned int h, h2; |
| 139 | DLine *a; |
| 140 | |
| 141 | /* Count the number of lines. Allocate space to hold |
| 142 | ** the returned array. |
| @@ -158,18 +164,39 @@ | |
| 164 | return a; |
| 165 | } |
| 166 | |
| 167 | /* Fill in the array */ |
| 168 | for(i=0; i<nLine; i++){ |
| 169 | for(j=0; z[j] && z[j]!='\n'; j++){} |
| 170 | a[i].z = z; |
| 171 | k = j; |
| 172 | if( diffFlags & DIFF_STRIP_EOLCR ){ |
| 173 | if( k>0 && z[k-1]=='\r' ){ k--; } |
| 174 | } |
| 175 | a[i].n = k; |
| 176 | s = 0; |
| 177 | if( diffFlags & DIFF_IGNORE_EOLWS ){ |
| 178 | while( k>0 && fossil_isspace(z[k-1]) ){ k--; } |
| 179 | } |
| 180 | if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){ |
| 181 | int numws = 0; |
| 182 | while( s<k && fossil_isspace(z[s]) ){ s++; } |
| 183 | for(h=0, x=s; x<k; x++){ |
| 184 | if( fossil_isspace(z[x]) ){ |
| 185 | ++numws; |
| 186 | }else{ |
| 187 | h = h ^ (h<<2) ^ z[x]; |
| 188 | } |
| 189 | } |
| 190 | k -= numws; |
| 191 | }else{ |
| 192 | for(h=0, x=s; x<k; x++){ |
| 193 | h = h ^ (h<<2) ^ z[x]; |
| 194 | } |
| 195 | } |
| 196 | a[i].indent = s; |
| 197 | a[i].h = h = (h<<LENGTH_MASK_SZ) | (k-s); |
| 198 | h2 = h % nLine; |
| 199 | a[i].iNext = a[h2].iHash; |
| 200 | a[h2].iHash = i+1; |
| 201 | z += j+1; |
| 202 | } |
| @@ -180,12 +207,31 @@ | |
| 207 | } |
| 208 | |
| 209 | /* |
| 210 | ** Return true if two DLine elements are identical. |
| 211 | */ |
| 212 | static int same_dline(const DLine *pA, const DLine *pB){ |
| 213 | return pA->h==pB->h && memcmp(pA->z,pB->z, pA->h&LENGTH_MASK)==0; |
| 214 | } |
| 215 | |
| 216 | /* |
| 217 | ** Return true if two DLine elements are identical, ignoring |
| 218 | ** all whitespace. The indent field of pA/pB already points |
| 219 | ** to the first non-space character in the string. |
| 220 | */ |
| 221 | |
| 222 | static int same_dline_ignore_allws(const DLine *pA, const DLine *pB){ |
| 223 | int a = pA->indent, b = pB->indent; |
| 224 | if( pA->h==pB->h ){ |
| 225 | while( a<pA->n && b<pB->n ){ |
| 226 | if( pA->z[a++] != pB->z[b++] ) return 0; |
| 227 | while( a<pA->n && fossil_isspace(pA->z[a])) ++a; |
| 228 | while( b<pB->n && fossil_isspace(pB->z[b])) ++b; |
| 229 | } |
| 230 | return pA->n-a == b<pB->n-b; |
| 231 | } |
| 232 | return 0; |
| 233 | } |
| 234 | |
| 235 | /* |
| 236 | ** Return true if the regular expression *pRe matches any of the |
| 237 | ** N dlines |
| @@ -221,16 +267,16 @@ | |
| 267 | }else if( cPrefix=='+' ){ |
| 268 | blob_append(pOut, "<span class=\"diffadd\">", -1); |
| 269 | }else if( cPrefix=='-' ){ |
| 270 | blob_append(pOut, "<span class=\"diffrm\">", -1); |
| 271 | } |
| 272 | htmlize_to_blob(pOut, pLine->z, pLine->n); |
| 273 | if( cPrefix!=' ' ){ |
| 274 | blob_append(pOut, "</span>", -1); |
| 275 | } |
| 276 | }else{ |
| 277 | blob_append(pOut, pLine->z, pLine->n); |
| 278 | } |
| 279 | blob_append(pOut, "\n", 1); |
| 280 | } |
| 281 | |
| 282 | /* |
| @@ -402,11 +448,11 @@ | |
| 448 | b += m; |
| 449 | if( i<nr-1 ){ |
| 450 | m = R[r+i*3+3]; |
| 451 | for(j=0; j<m; j++){ |
| 452 | if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html); |
| 453 | appendDiffLine(pOut, ' ', &A[a+j], html, 0); |
| 454 | } |
| 455 | b += m; |
| 456 | a += m; |
| 457 | } |
| 458 | } |
| @@ -415,11 +461,11 @@ | |
| 461 | assert( nr==i ); |
| 462 | m = R[r+nr*3]; |
| 463 | if( m>nContext ) m = nContext; |
| 464 | for(j=0; j<m; j++){ |
| 465 | if( showLn ) appendDiffLineno(pOut, a+j+1, b+j+1, html); |
| 466 | appendDiffLine(pOut, ' ', &A[a+j], html, 0); |
| 467 | } |
| 468 | } |
| 469 | } |
| 470 | |
| 471 | /* |
| @@ -476,11 +522,11 @@ | |
| 522 | ** This comment contains multibyte unicode characters (ü, Æ, ð) in order |
| 523 | ** to test the ability of the diff code to handle such characters. |
| 524 | */ |
| 525 | static void sbsWriteText(SbsLine *p, DLine *pLine, int col){ |
| 526 | Blob *pCol = p->apCols[col]; |
| 527 | int n = pLine->n; |
| 528 | int i; /* Number of input characters consumed */ |
| 529 | int k; /* Cursor position */ |
| 530 | int needEndSpan = 0; |
| 531 | const char *zIn = pLine->z; |
| 532 | int w = p->width; |
| @@ -1305,11 +1351,11 @@ | |
| 1351 | sbsWriteMarker(&s, " ", ""); |
| 1352 | sbsWriteLineno(&s, b+j, SBS_LNB); |
| 1353 | sbsWriteText(&s, &B[b+j], SBS_TXTB); |
| 1354 | } |
| 1355 | } |
| 1356 | |
| 1357 | if( s.escHtml && blob_size(s.apCols[SBS_LNA])>0 ){ |
| 1358 | blob_append(pOut, "<table class=\"sbsdiffcols\"><tr>\n", -1); |
| 1359 | for(i=SBS_LNA; i<=SBS_TXTB; i++){ |
| 1360 | sbsWriteColumn(pOut, s.apCols[i], i); |
| 1361 | blob_reset(s.apCols[i]); |
| @@ -1337,16 +1383,16 @@ | |
| 1383 | int iSXb = iS1; /* Best match so far */ |
| 1384 | int iSYb = iS2; /* Best match so far */ |
| 1385 | |
| 1386 | for(i=iS1; i<iE1-mxLength; i++){ |
| 1387 | for(j=iS2; j<iE2-mxLength; j++){ |
| 1388 | if( !p->same_fn(&p->aFrom[i], &p->aTo[j]) ) continue; |
| 1389 | if( mxLength && !p->same_fn(&p->aFrom[i+mxLength], &p->aTo[j+mxLength]) ){ |
| 1390 | continue; |
| 1391 | } |
| 1392 | k = 1; |
| 1393 | while( i+k<iE1 && j+k<iE2 && p->same_fn(&p->aFrom[i+k],&p->aTo[j+k]) ){ |
| 1394 | k++; |
| 1395 | } |
| 1396 | if( k>mxLength ){ |
| 1397 | iSXb = i; |
| 1398 | iSYb = j; |
| @@ -1408,11 +1454,11 @@ | |
| 1454 | mid = (iE1 + iS1)/2; |
| 1455 | for(i=iS1; i<iE1; i++){ |
| 1456 | int limit = 0; |
| 1457 | j = p->aTo[p->aFrom[i].h % p->nTo].iHash; |
| 1458 | while( j>0 |
| 1459 | && (j-1<iS2 || j>=iE2 || !p->same_fn(&p->aFrom[i], &p->aTo[j-1])) |
| 1460 | ){ |
| 1461 | if( limit++ > 10 ){ |
| 1462 | j = 0; |
| 1463 | break; |
| 1464 | } |
| @@ -1425,19 +1471,19 @@ | |
| 1471 | iSX = i; |
| 1472 | iSY = j-1; |
| 1473 | pA = &p->aFrom[iSX-1]; |
| 1474 | pB = &p->aTo[iSY-1]; |
| 1475 | n = minInt(iSX-iS1, iSY-iS2); |
| 1476 | for(k=0; k<n && p->same_fn(pA,pB); k++, pA--, pB--){} |
| 1477 | iSX -= k; |
| 1478 | iSY -= k; |
| 1479 | iEX = i+1; |
| 1480 | iEY = j; |
| 1481 | pA = &p->aFrom[iEX]; |
| 1482 | pB = &p->aTo[iEY]; |
| 1483 | n = minInt(iE1-iEX, iE2-iEY); |
| 1484 | for(k=0; k<n && p->same_fn(pA,pB); k++, pA++, pB++){} |
| 1485 | iEX += k; |
| 1486 | iEY += k; |
| 1487 | skew = (iSX-iS1) - (iSY-iS2); |
| 1488 | if( skew<0 ) skew = -skew; |
| 1489 | dist = (iSX+iEX)/2 - mid; |
| @@ -1574,16 +1620,16 @@ | |
| 1620 | int mnE, iS, iE1, iE2; |
| 1621 | |
| 1622 | /* Carve off the common header and footer */ |
| 1623 | iE1 = p->nFrom; |
| 1624 | iE2 = p->nTo; |
| 1625 | while( iE1>0 && iE2>0 && p->same_fn(&p->aFrom[iE1-1], &p->aTo[iE2-1]) ){ |
| 1626 | iE1--; |
| 1627 | iE2--; |
| 1628 | } |
| 1629 | mnE = iE1<iE2 ? iE1 : iE2; |
| 1630 | for(iS=0; iS<mnE && p->same_fn(&p->aFrom[iS],&p->aTo[iS]); iS++){} |
| 1631 | |
| 1632 | /* do the difference */ |
| 1633 | if( iS>0 ){ |
| 1634 | appendTriple(p, iS, 0, 0); |
| 1635 | } |
| @@ -1648,11 +1694,11 @@ | |
| 1694 | |
| 1695 | /* Shift insertions toward the beginning of the file */ |
| 1696 | while( cpy>0 && del==0 && ins>0 ){ |
| 1697 | DLine *pTop = &p->aFrom[lnFrom-1]; /* Line before start of insert */ |
| 1698 | DLine *pBtm = &p->aTo[lnTo+ins-1]; /* Last line inserted */ |
| 1699 | if( p->same_fn(pTop, pBtm)==0 ) break; |
| 1700 | if( LENGTH(pTop+1)+LENGTH(pBtm)<=LENGTH(pTop)+LENGTH(pBtm-1) ) break; |
| 1701 | lnFrom--; |
| 1702 | lnTo--; |
| 1703 | p->aEdit[r]--; |
| 1704 | p->aEdit[r+3]++; |
| @@ -1661,11 +1707,11 @@ | |
| 1707 | |
| 1708 | /* Shift insertions toward the end of the file */ |
| 1709 | while( r+3<p->nEdit && p->aEdit[r+3]>0 && del==0 && ins>0 ){ |
| 1710 | DLine *pTop = &p->aTo[lnTo]; /* First line inserted */ |
| 1711 | DLine *pBtm = &p->aTo[lnTo+ins]; /* First line past end of insert */ |
| 1712 | if( p->same_fn(pTop, pBtm)==0 ) break; |
| 1713 | if( LENGTH(pTop)+LENGTH(pBtm-1)<=LENGTH(pTop+1)+LENGTH(pBtm) ) break; |
| 1714 | lnFrom++; |
| 1715 | lnTo++; |
| 1716 | p->aEdit[r]++; |
| 1717 | p->aEdit[r+3]--; |
| @@ -1674,11 +1720,11 @@ | |
| 1720 | |
| 1721 | /* Shift deletions toward the beginning of the file */ |
| 1722 | while( cpy>0 && del>0 && ins==0 ){ |
| 1723 | DLine *pTop = &p->aFrom[lnFrom-1]; /* Line before start of delete */ |
| 1724 | DLine *pBtm = &p->aFrom[lnFrom+del-1]; /* Last line deleted */ |
| 1725 | if( p->same_fn(pTop, pBtm)==0 ) break; |
| 1726 | if( LENGTH(pTop+1)+LENGTH(pBtm)<=LENGTH(pTop)+LENGTH(pBtm-1) ) break; |
| 1727 | lnFrom--; |
| 1728 | lnTo--; |
| 1729 | p->aEdit[r]--; |
| 1730 | p->aEdit[r+3]++; |
| @@ -1687,11 +1733,11 @@ | |
| 1733 | |
| 1734 | /* Shift deletions toward the end of the file */ |
| 1735 | while( r+3<p->nEdit && p->aEdit[r+3]>0 && del>0 && ins==0 ){ |
| 1736 | DLine *pTop = &p->aFrom[lnFrom]; /* First line deleted */ |
| 1737 | DLine *pBtm = &p->aFrom[lnFrom+del]; /* First line past end of delete */ |
| 1738 | if( p->same_fn(pTop, pBtm)==0 ) break; |
| 1739 | if( LENGTH(pTop)+LENGTH(pBtm-1)<=LENGTH(pTop)+LENGTH(pBtm) ) break; |
| 1740 | lnFrom++; |
| 1741 | lnTo++; |
| 1742 | p->aEdit[r]++; |
| 1743 | p->aEdit[r+3]--; |
| @@ -1753,28 +1799,33 @@ | |
| 1799 | Blob *pB_Blob, /* TO file */ |
| 1800 | Blob *pOut, /* Write diff here if not NULL */ |
| 1801 | ReCompiled *pRe, /* Only output changes where this Regexp matches */ |
| 1802 | u64 diffFlags /* DIFF_* flags defined above */ |
| 1803 | ){ |
| 1804 | int ignoreWs; /* Ignore whitespace */ |
| 1805 | DContext c; |
| 1806 | |
| 1807 | if( diffFlags & DIFF_INVERT ){ |
| 1808 | Blob *pTemp = pA_Blob; |
| 1809 | pA_Blob = pB_Blob; |
| 1810 | pB_Blob = pTemp; |
| 1811 | } |
| 1812 | ignoreWs = (diffFlags & DIFF_IGNORE_ALLWS)!=0; |
| 1813 | blob_to_utf8_no_bom(pA_Blob, 0); |
| 1814 | blob_to_utf8_no_bom(pB_Blob, 0); |
| 1815 | |
| 1816 | /* Prepare the input files */ |
| 1817 | memset(&c, 0, sizeof(c)); |
| 1818 | if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){ |
| 1819 | c.same_fn = same_dline_ignore_allws; |
| 1820 | }else{ |
| 1821 | c.same_fn = same_dline; |
| 1822 | } |
| 1823 | c.aFrom = break_into_lines(blob_str(pA_Blob), blob_size(pA_Blob), |
| 1824 | &c.nFrom, diffFlags); |
| 1825 | c.aTo = break_into_lines(blob_str(pB_Blob), blob_size(pB_Blob), |
| 1826 | &c.nTo, diffFlags); |
| 1827 | if( c.aFrom==0 || c.aTo==0 ){ |
| 1828 | fossil_free(c.aFrom); |
| 1829 | fossil_free(c.aTo); |
| 1830 | if( pOut ){ |
| 1831 | diff_errmsg(pOut, DIFF_CANNOT_COMPUTE_BINARY, diffFlags); |
| @@ -1782,20 +1833,27 @@ | |
| 1833 | return 0; |
| 1834 | } |
| 1835 | |
| 1836 | /* Compute the difference */ |
| 1837 | diff_all(&c); |
| 1838 | if( ignoreWs && c.nEdit==6 && c.aEdit[1]==0 && c.aEdit[2]==0 ){ |
| 1839 | fossil_free(c.aFrom); |
| 1840 | fossil_free(c.aTo); |
| 1841 | fossil_free(c.aEdit); |
| 1842 | if( pOut ) diff_errmsg(pOut, DIFF_WHITESPACE_ONLY, diffFlags); |
| 1843 | return 0; |
| 1844 | } |
| 1845 | if( (diffFlags & DIFF_NOTTOOBIG)!=0 ){ |
| 1846 | int i, m, n; |
| 1847 | int *a = c.aEdit; |
| 1848 | int mx = c.nEdit; |
| 1849 | for(i=m=n=0; i<mx; i+=3){ m += a[i]; n += a[i+1]+a[i+2]; } |
| 1850 | if( n>10000 ){ |
| 1851 | fossil_free(c.aFrom); |
| 1852 | fossil_free(c.aTo); |
| 1853 | fossil_free(c.aEdit); |
| 1854 | if( pOut ) diff_errmsg(pOut, DIFF_TOO_MANY_CHANGES, diffFlags); |
| 1855 | return 0; |
| 1856 | } |
| 1857 | } |
| 1858 | if( (diffFlags & DIFF_NOOPT)==0 ){ |
| 1859 | diff_optimize(&c); |
| @@ -1824,24 +1882,36 @@ | |
| 1882 | |
| 1883 | /* |
| 1884 | ** Process diff-related command-line options and return an appropriate |
| 1885 | ** "diffFlags" integer. |
| 1886 | ** |
| 1887 | ** --brief Show filenames only DIFF_BRIEF |
| 1888 | ** -c|--context N N lines of context. DIFF_CONTEXT_MASK |
| 1889 | ** --html Format for HTML DIFF_HTML |
| 1890 | ** --invert Invert the diff DIFF_INVERT |
| 1891 | ** -n|--linenum Show line numbers DIFF_LINENO |
| 1892 | ** --noopt Disable optimization DIFF_NOOPT |
| 1893 | ** --strip-trailing-cr Strip trailing CR DIFF_STRIP_EOLCR |
| 1894 | ** --unified Unified diff. ~DIFF_SIDEBYSIDE |
| 1895 | ** -w|--ignore-all-space Ignore all whitespaces DIFF_IGNORE_ALLWS |
| 1896 | ** -W|--width N N character lines. DIFF_WIDTH_MASK |
| 1897 | ** -y|--side-by-side Side-by-side diff. DIFF_SIDEBYSIDE |
| 1898 | ** -Z|--ignore-trailing-space Ignore eol-whitespaces DIFF_IGNORE_EOLWS |
| 1899 | */ |
| 1900 | u64 diff_options(void){ |
| 1901 | u64 diffFlags = 0; |
| 1902 | const char *z; |
| 1903 | int f; |
| 1904 | if( find_option("ignore-trailing-space","Z",0)!=0 ){ |
| 1905 | diffFlags = DIFF_IGNORE_EOLWS; |
| 1906 | } |
| 1907 | if( find_option("ignore-all-space","w",0)!=0 ){ |
| 1908 | diffFlags = DIFF_IGNORE_ALLWS; /* stronger than DIFF_IGNORE_EOLWS */ |
| 1909 | } |
| 1910 | if( find_option("strip-trailing-cr",0,0)!=0 ){ |
| 1911 | diffFlags |= DIFF_STRIP_EOLCR; |
| 1912 | } |
| 1913 | if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE; |
| 1914 | if( find_option("unified",0,0)!=0 ) diffFlags &= ~DIFF_SIDEBYSIDE; |
| 1915 | if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>=0 ){ |
| 1916 | if( f > DIFF_CONTEXT_MASK ) f = DIFF_CONTEXT_MASK; |
| 1917 | diffFlags |= f + DIFF_CONTEXT_EX; |
| @@ -1930,11 +2000,11 @@ | |
| 2000 | typedef struct Annotator Annotator; |
| 2001 | struct Annotator { |
| 2002 | DContext c; /* The diff-engine context */ |
| 2003 | struct AnnLine { /* Lines of the original files... */ |
| 2004 | const char *z; /* The text of the line */ |
| 2005 | short int n; /* Number of bytes (omitting trailing \n) */ |
| 2006 | short int iVers; /* Level at which tag was set */ |
| 2007 | } *aOrig; |
| 2008 | int nOrig; /* Number of elements in aOrig[] */ |
| 2009 | int nVers; /* Number of versions analyzed */ |
| 2010 | int bLimit; /* True if the iLimit was reached */ |
| @@ -1952,22 +2022,28 @@ | |
| 2022 | /* |
| 2023 | ** Initialize the annotation process by specifying the file that is |
| 2024 | ** to be annotated. The annotator takes control of the input Blob and |
| 2025 | ** will release it when it is finished with it. |
| 2026 | */ |
| 2027 | static int annotation_start(Annotator *p, Blob *pInput, u64 diffFlags){ |
| 2028 | int i; |
| 2029 | |
| 2030 | memset(p, 0, sizeof(*p)); |
| 2031 | if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){ |
| 2032 | p->c.same_fn = same_dline_ignore_allws; |
| 2033 | }else{ |
| 2034 | p->c.same_fn = same_dline; |
| 2035 | } |
| 2036 | p->c.aTo = break_into_lines(blob_str(pInput), blob_size(pInput),&p->c.nTo, |
| 2037 | diffFlags); |
| 2038 | if( p->c.aTo==0 ){ |
| 2039 | return 1; |
| 2040 | } |
| 2041 | p->aOrig = fossil_malloc( sizeof(p->aOrig[0])*p->c.nTo ); |
| 2042 | for(i=0; i<p->c.nTo; i++){ |
| 2043 | p->aOrig[i].z = p->c.aTo[i].z; |
| 2044 | p->aOrig[i].n = p->c.aTo[i].n; |
| 2045 | p->aOrig[i].iVers = -1; |
| 2046 | } |
| 2047 | p->nOrig = p->c.nTo; |
| 2048 | return 0; |
| 2049 | } |
| @@ -1977,17 +2053,17 @@ | |
| 2053 | ** being annotated. Do another step of the annotation. Return true |
| 2054 | ** if additional annotation is required. zPName is the tag to insert |
| 2055 | ** on each line of the file being annotated that was contributed by |
| 2056 | ** pParent. Memory to hold zPName is leaked. |
| 2057 | */ |
| 2058 | static int annotation_step(Annotator *p, Blob *pParent, int iVers, u64 diffFlags){ |
| 2059 | int i, j; |
| 2060 | int lnTo; |
| 2061 | |
| 2062 | /* Prepare the parent file to be diffed */ |
| 2063 | p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent), |
| 2064 | &p->c.nFrom, diffFlags); |
| 2065 | if( p->c.aFrom==0 ){ |
| 2066 | return 1; |
| 2067 | } |
| 2068 | |
| 2069 | /* Compute the differences going from pParent to the file being |
| @@ -2020,13 +2096,13 @@ | |
| 2096 | /* Return no errors */ |
| 2097 | return 0; |
| 2098 | } |
| 2099 | |
| 2100 | |
| 2101 | /* Annotation flags (any DIFF flag can be used as Annotation flag as well) */ |
| 2102 | #define ANN_FILE_VERS (((u64)0x20)<<32) /* Show file vers rather than commit vers */ |
| 2103 | #define ANN_FILE_ANCEST (((u64)0x40)<<32) /* Prefer check-ins in the ANCESTOR table */ |
| 2104 | |
| 2105 | /* |
| 2106 | ** Compute a complete annotation on a file. The file is identified |
| 2107 | ** by its filename number (filename.fnid) and the baseline in which |
| 2108 | ** it was checked in (mlink.mid). |
| @@ -2034,11 +2110,11 @@ | |
| 2110 | static void annotate_file( |
| 2111 | Annotator *p, /* The annotator */ |
| 2112 | int fnid, /* The name of the file to be annotated */ |
| 2113 | int mid, /* Use the version of the file in this check-in */ |
| 2114 | int iLimit, /* Limit the number of levels if greater than zero */ |
| 2115 | u64 annFlags /* Flags to alter the annotation */ |
| 2116 | ){ |
| 2117 | Blob toAnnotate; /* Text of the final (mid) version of the file */ |
| 2118 | Blob step; /* Text of previous revision */ |
| 2119 | int rid; /* Artifact ID of the file being annotated */ |
| 2120 | Stmt q; /* Query returning all ancestor versions */ |
| @@ -2052,11 +2128,12 @@ | |
| 2128 | } |
| 2129 | if( !content_get(rid, &toAnnotate) ){ |
| 2130 | fossil_fatal("unable to retrieve content of artifact #%d", rid); |
| 2131 | } |
| 2132 | if( iLimit<=0 ) iLimit = 1000000000; |
| 2133 | blob_to_utf8_no_bom(&toAnnotate, 0); |
| 2134 | annotation_start(p, &toAnnotate, annFlags); |
| 2135 | db_begin_transaction(); |
| 2136 | db_multi_exec( |
| 2137 | "CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);" |
| 2138 | "DELETE FROM vseen;" |
| 2139 | ); |
| @@ -2086,11 +2163,12 @@ | |
| 2163 | p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1)); |
| 2164 | p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2)); |
| 2165 | p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3)); |
| 2166 | if( p->nVers ){ |
| 2167 | content_get(rid, &step); |
| 2168 | blob_to_utf8_no_bom(&step, 0); |
| 2169 | annotation_step(p, &step, p->nVers-1, annFlags); |
| 2170 | blob_reset(&step); |
| 2171 | } |
| 2172 | p->nVers++; |
| 2173 | db_bind_int(&ins, ":rid", rid); |
| 2174 | db_step(&ins); |
| @@ -2111,10 +2189,11 @@ | |
| 2189 | */ |
| 2190 | unsigned gradient_color(unsigned c1, unsigned c2, int n, int i){ |
| 2191 | unsigned c; /* Result color */ |
| 2192 | unsigned x1, x2; |
| 2193 | if( i==0 || n==0 ) return c1; |
| 2194 | else if(i>=n) return c2; |
| 2195 | x1 = (c1>>16)&0xff; |
| 2196 | x2 = (c2>>16)&0xff; |
| 2197 | c = (x1*(n-i) + x2*i)/n<<16 & 0xff0000; |
| 2198 | x1 = (c1>>8)&0xff; |
| 2199 | x2 = (c2>>8)&0xff; |
| @@ -2126,10 +2205,11 @@ | |
| 2205 | } |
| 2206 | |
| 2207 | /* |
| 2208 | ** WEBPAGE: annotate |
| 2209 | ** WEBPAGE: blame |
| 2210 | ** WEBPAGE: praise |
| 2211 | ** |
| 2212 | ** Query parameters: |
| 2213 | ** |
| 2214 | ** checkin=ID The manifest ID at which to start the annotation |
| 2215 | ** filename=FILENAME The filename. |
| @@ -2140,31 +2220,35 @@ | |
| 2220 | void annotation_page(void){ |
| 2221 | int mid; |
| 2222 | int fnid; |
| 2223 | int i; |
| 2224 | int iLimit; /* Depth limit */ |
| 2225 | u64 annFlags = (ANN_FILE_ANCEST|DIFF_STRIP_EOLCR); |
| 2226 | int showLog = 0; /* True to display the log */ |
| 2227 | int ignoreWs = 0; /* Ignore whitespace */ |
| 2228 | const char *zFilename; /* Name of file to annotate */ |
| 2229 | const char *zCI; /* The check-in containing zFilename */ |
| 2230 | Annotator ann; |
| 2231 | HQuery url; |
| 2232 | struct AnnVers *p; |
| 2233 | unsigned clr1, clr2, clr; |
| 2234 | int bBlame = g.zPath[0]!='a';/* True for BLAME output. False for ANNOTATE. */ |
| 2235 | |
| 2236 | /* Gather query parameters */ |
| 2237 | showLog = atoi(PD("log","1")); |
| 2238 | login_check_credentials(); |
| 2239 | if( !g.perm.Read ){ login_needed(); return; } |
| 2240 | if( exclude_spiders("annotate") ) return; |
| 2241 | load_control(); |
| 2242 | mid = name_to_typed_rid(PD("checkin","0"),"ci"); |
| 2243 | zFilename = P("filename"); |
| 2244 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); |
| 2245 | if( mid==0 || fnid==0 ){ fossil_redirect_home(); } |
| 2246 | iLimit = atoi(PD("limit","20")); |
| 2247 | if( P("filevers") ) annFlags |= ANN_FILE_VERS; |
| 2248 | ignoreWs = P("w")!=0; |
| 2249 | if( ignoreWs ) annFlags |= DIFF_IGNORE_ALLWS; |
| 2250 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ |
| 2251 | fossil_redirect_home(); |
| 2252 | } |
| 2253 | |
| 2254 | /* compute the annotation */ |
| @@ -2172,17 +2256,29 @@ | |
| 2256 | annotate_file(&ann, fnid, mid, iLimit, annFlags); |
| 2257 | zCI = ann.aVers[0].zMUuid; |
| 2258 | |
| 2259 | /* generate the web page */ |
| 2260 | style_header("Annotation For %h", zFilename); |
| 2261 | if( bBlame ){ |
| 2262 | url_initialize(&url, "blame"); |
| 2263 | }else{ |
| 2264 | url_initialize(&url, "annotate"); |
| 2265 | } |
| 2266 | url_add_parameter(&url, "checkin", P("checkin")); |
| 2267 | url_add_parameter(&url, "filename", zFilename); |
| 2268 | if( iLimit!=20 ){ |
| 2269 | url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit)); |
| 2270 | } |
| 2271 | url_add_parameter(&url, "log", showLog ? "1" : "0"); |
| 2272 | if( ignoreWs ){ |
| 2273 | url_add_parameter(&url, "w", ""); |
| 2274 | style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes", |
| 2275 | "%s", url_render(&url, "w", 0, 0, 0)); |
| 2276 | }else{ |
| 2277 | style_submenu_element("Ignore Whitespace", "Ignore Whitespace", |
| 2278 | "%s", url_render(&url, "w", "", 0, 0)); |
| 2279 | } |
| 2280 | if( showLog ){ |
| 2281 | style_submenu_element("Hide Log", "Hide Log", |
| 2282 | "%s", url_render(&url, "log", "0", 0, 0)); |
| 2283 | }else{ |
| 2284 | style_submenu_element("Show Log", "Show Log", |
| @@ -2208,11 +2304,11 @@ | |
| 2304 | clr2 = 0xb5e0ff; /* Older changes: blue (cold) */ |
| 2305 | } |
| 2306 | for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){ |
| 2307 | clr = gradient_color(clr1, clr2, ann.nVers-1, i); |
| 2308 | ann.aVers[i].zBgColor = mprintf("#%06x", clr); |
| 2309 | } |
| 2310 | |
| 2311 | if( showLog ){ |
| 2312 | char *zLink = href("%R/finfo?name=%t&ci=%S",zFilename,zCI); |
| 2313 | @ <h2>Ancestors of %z(zLink)%h(zFilename)</a> analyzed:</h2> |
| 2314 | @ <ol> |
| @@ -2238,11 +2334,11 @@ | |
| 2334 | } |
| 2335 | @ </ol> |
| 2336 | @ <hr> |
| 2337 | } |
| 2338 | if( !ann.bLimit ){ |
| 2339 | @ <h2>Origin for each line in |
| 2340 | @ %z(href("%R/finfo?name=%h&ci=%S", zFilename, zCI))%h(zFilename)</a> |
| 2341 | @ from check-in %z(href("%R/info/%S",zCI))%S(zCI)</a>:</h2> |
| 2342 | iLimit = ann.nVers+10; |
| 2343 | }else{ |
| 2344 | @ <h2>Lines added by the %d(iLimit) most recent ancestors of |
| @@ -2291,22 +2387,25 @@ | |
| 2387 | } |
| 2388 | |
| 2389 | /* |
| 2390 | ** COMMAND: annotate |
| 2391 | ** COMMAND: blame |
| 2392 | ** COMMAND: praise |
| 2393 | ** |
| 2394 | ** %fossil (annotate|blame|praise) ?OPTIONS? FILENAME |
| 2395 | ** |
| 2396 | ** Output the text of a file with markings to show when each line of |
| 2397 | ** the file was last modified. The "annotate" command shows line numbers |
| 2398 | ** and omits the username. The "blame" and "praise" commands show the user |
| 2399 | ** who made each checkin and omits the line number. |
| 2400 | ** |
| 2401 | ** Options: |
| 2402 | ** --filevers Show file version numbers rather than check-in versions |
| 2403 | ** -l|--log List all versions analyzed |
| 2404 | ** -n|--limit N Only look backwards in time by N versions |
| 2405 | ** -w|--ignore-all-space Ignore white space when comparing lines |
| 2406 | ** -Z|--ignore-trailing-space Ignore whitespace at line end |
| 2407 | ** |
| 2408 | ** See also: info, finfo, timeline |
| 2409 | */ |
| 2410 | void annotate_cmd(void){ |
| 2411 | int fnid; /* Filename ID */ |
| @@ -2319,18 +2418,24 @@ | |
| 2418 | int i; /* Loop counter */ |
| 2419 | const char *zLimit; /* The value to the -n|--limit option */ |
| 2420 | int iLimit; /* How far back in time to look */ |
| 2421 | int showLog; /* True to show the log */ |
| 2422 | int fileVers; /* Show file version instead of check-in versions */ |
| 2423 | u64 annFlags = 0; /* Flags to control annotation properties */ |
| 2424 | int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */ |
| 2425 | |
| 2426 | bBlame = g.argv[1][0]!='a'; |
| 2427 | zLimit = find_option("limit","n",1); |
| 2428 | if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1"; |
| 2429 | iLimit = atoi(zLimit); |
| 2430 | showLog = find_option("log","l",0)!=0; |
| 2431 | if( find_option("ignore-trailing-space","Z",0)!=0 ){ |
| 2432 | annFlags = DIFF_IGNORE_EOLWS; |
| 2433 | } |
| 2434 | if( find_option("ignore-all-space","w",0)!=0 ){ |
| 2435 | annFlags = DIFF_IGNORE_ALLWS; /* stronger than DIFF_IGNORE_EOLWS */ |
| 2436 | } |
| 2437 | fileVers = find_option("filevers",0,0)!=0; |
| 2438 | db_must_be_within_tree(); |
| 2439 | if( g.argc<3 ) { |
| 2440 | usage("FILENAME"); |
| 2441 | } |
| @@ -2355,11 +2460,11 @@ | |
| 2460 | " ORDER BY ancestor.generation ASC LIMIT 1", |
| 2461 | fid, fnid); |
| 2462 | if( mid==0 ){ |
| 2463 | fossil_fatal("unable to find manifest"); |
| 2464 | } |
| 2465 | annFlags |= (ANN_FILE_ANCEST|DIFF_STRIP_EOLCR); |
| 2466 | annotate_file(&ann, fnid, mid, iLimit, annFlags); |
| 2467 | if( showLog ){ |
| 2468 | struct AnnVers *p; |
| 2469 | for(p=ann.aVers, i=0; i<ann.nVers; i++, p++){ |
| 2470 | fossil_print("version %3d: %s %.10s file %.10s\n", |
| 2471 |
+94
-32
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -49,15 +49,25 @@ | ||
| 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 | +** --strip-trailing-cr Strip trailing CR | |
| 1103 | +** --tk Launch a Tcl/Tk GUI for display | |
| 1104 | +** --to VERSION select VERSION as target for the diff | |
| 1105 | +** --unified unified diff | |
| 1106 | +** -v|--verbose output complete text of added or deleted files | |
| 1107 | +** -w|--ignore-all-space Ignore white space when comparing lines | |
| 1108 | +** -W|--width <num> Width of lines in side-by-side diff | |
| 1109 | +** -Z|--ignore-trailing-space Ignore changes to end-of-line whitespace | |
| 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 | ** --strip-trailing-cr Strip trailing CR |
| 1103 | ** --tk Launch a Tcl/Tk GUI for display |
| 1104 | ** --to VERSION select VERSION as target for the diff |
| 1105 | ** --unified unified diff |
| 1106 | ** -v|--verbose output complete text of added or deleted files |
| 1107 | ** -w|--ignore-all-space Ignore white space when comparing lines |
| 1108 | ** -W|--width <num> Width of lines in side-by-side diff |
| 1109 | ** -Z|--ignore-trailing-space Ignore changes to end-of-line whitespace |
| 1110 | */ |
| 1111 | void diff_cmd(void){ |
| 1112 | int isGDiff; /* True for gdiff. False for normal diff */ |
| 1113 | int isInternDiff; /* True for internal diff */ |
| 1114 | int verboseFlag; /* True if -v or --verbose flag is used */ |
| @@ -1071,11 +1134,10 @@ | |
| 1134 | verboseFlag = find_option("verbose","v",0)!=0; |
| 1135 | if( !verboseFlag ){ |
| 1136 | verboseFlag = find_option("new-file","N",0)!=0; /* deprecated */ |
| 1137 | } |
| 1138 | if( verboseFlag ) diffFlags |= DIFF_VERBOSE; |
| 1139 | if( zBranch ){ |
| 1140 | if( zTo || zFrom ){ |
| 1141 | fossil_fatal("cannot use --from or --to with --branch"); |
| 1142 | } |
| 1143 | zTo = zBranch; |
| 1144 |
+10
-10
| --- src/event.c | ||
| +++ src/event.c | ||
| @@ -185,11 +185,11 @@ | ||
| 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 0; | |
| 153 | + prompt_user("Remember Basic Authorization credentials (Y/n)? ", &x); | |
| 154 | + c = blob_str(&x)[0]; | |
| 155 | + blob_reset(&x); | |
| 156 | + return ( c!='n' && c!='N' ); | |
| 157 | +} | |
| 158 | + | |
| 159 | +/* | |
| 160 | +** Get the HTTP Basic Authorization credentials from the user | |
| 161 | +** when 401 is received. | |
| 162 | +*/ | |
| 163 | +char *prompt_for_httpauth_creds(void){ | |
| 164 | + Blob x; | |
| 165 | + char *zUser; | |
| 166 | + char *zPw; | |
| 167 | + char *zPrompt; | |
| 168 | + char *zHttpAuth = 0; | |
| 169 | + if( !isatty(fileno(stdin)) ) return 0; | |
| 170 | + zPrompt = mprintf("\n%s authorization required by\n%s\n", | |
| 171 | + g.urlIsHttps==1 ? "Encrypted HTTPS" : "Unencrypted HTTP", g.urlCanonical); | |
| 172 | + fossil_print(zPrompt); | |
| 173 | + free(zPrompt); | |
| 174 | + if ( g.urlUser && g.urlPasswd && use_fossil_creds_for_httpauth_prompt() ){ | |
| 175 | + zHttpAuth = mprintf("%s:%s", g.urlUser, g.urlPasswd); | |
| 176 | + }else{ | |
| 177 | + prompt_user("Basic Authorization user: ", &x); | |
| 178 | + zUser = mprintf("%b", &x); | |
| 179 | + zPrompt = mprintf("HTTP password for %b: ", &x); | |
| 180 | + blob_reset(&x); | |
| 181 | + prompt_for_password(zPrompt, &x, 1); | |
| 182 | + zPw = mprintf("%b", &x); | |
| 183 | + zHttpAuth = mprintf("%s:%s", zUser, zPw); | |
| 184 | + free(zUser); | |
| 185 | + free(zPw); | |
| 186 | + free(zPrompt); | |
| 187 | + blob_reset(&x); | |
| 188 | + } | |
| 189 | + if( save_httpauth_prompt() ){ | |
| 190 | + set_httpauth(zHttpAuth); | |
| 191 | + } | |
| 192 | + return zHttpAuth; | |
| 193 | +} | |
| 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 0; |
| 153 | prompt_user("Remember Basic Authorization credentials (Y/n)? ", &x); |
| 154 | c = blob_str(&x)[0]; |
| 155 | blob_reset(&x); |
| 156 | return ( c!='n' && c!='N' ); |
| 157 | } |
| 158 | |
| 159 | /* |
| 160 | ** Get the HTTP Basic Authorization credentials from the user |
| 161 | ** when 401 is received. |
| 162 | */ |
| 163 | char *prompt_for_httpauth_creds(void){ |
| 164 | Blob x; |
| 165 | char *zUser; |
| 166 | char *zPw; |
| 167 | char *zPrompt; |
| 168 | char *zHttpAuth = 0; |
| 169 | if( !isatty(fileno(stdin)) ) return 0; |
| 170 | zPrompt = mprintf("\n%s authorization required by\n%s\n", |
| 171 | g.urlIsHttps==1 ? "Encrypted HTTPS" : "Unencrypted HTTP", g.urlCanonical); |
| 172 | fossil_print(zPrompt); |
| 173 | free(zPrompt); |
| 174 | if ( g.urlUser && g.urlPasswd && use_fossil_creds_for_httpauth_prompt() ){ |
| 175 | zHttpAuth = mprintf("%s:%s", g.urlUser, g.urlPasswd); |
| 176 | }else{ |
| 177 | prompt_user("Basic Authorization user: ", &x); |
| 178 | zUser = mprintf("%b", &x); |
| 179 | zPrompt = mprintf("HTTP password for %b: ", &x); |
| 180 | blob_reset(&x); |
| 181 | prompt_for_password(zPrompt, &x, 1); |
| 182 | zPw = mprintf("%b", &x); |
| 183 | zHttpAuth = mprintf("%s:%s", zUser, zPw); |
| 184 | free(zUser); |
| 185 | free(zPw); |
| 186 | free(zPrompt); |
| 187 | blob_reset(&x); |
| 188 | } |
| 189 | if( save_httpauth_prompt() ){ |
| 190 | set_httpauth(zHttpAuth); |
| 191 | } |
| 192 | return zHttpAuth; |
| 193 | } |
| 194 | |
| 195 | /* |
| 196 | ** Sign the content in pSend, compress it, and send it to the server |
| 197 | ** via HTTP or HTTPS. Get a reply, uncompress the reply, and store the reply |
| 198 | ** in pRecv. pRecv is assumed to be uninitialized when |
| @@ -205,10 +275,20 @@ | |
| 275 | iLength = -1; |
| 276 | while( (zLine = transport_receive_line(GLOBAL_URL()))!=0 && zLine[0]!=0 ){ |
| 277 | /* printf("[%s]\n", zLine); fflush(stdout); */ |
| 278 | if( fossil_strnicmp(zLine, "http/1.", 7)==0 ){ |
| 279 | if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err; |
| 280 | if( rc==401 ){ |
| 281 | if( fSeenHttpAuth++ < MAX_HTTP_AUTH ){ |
| 282 | if( g.zHttpAuth ){ |
| 283 | if( g.zHttpAuth ) free(g.zHttpAuth); |
| 284 | } |
| 285 | g.zHttpAuth = prompt_for_httpauth_creds(); |
| 286 | transport_close(GLOBAL_URL()); |
| 287 | return http_exchange(pSend, pReply, useLogin, maxRedirect); |
| 288 | } |
| 289 | } |
| 290 | if( rc!=200 && rc!=302 ){ |
| 291 | int ii; |
| 292 | for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){} |
| 293 | while( zLine[ii]==' ' ) ii++; |
| 294 | fossil_warning("server says: %s", &zLine[ii]); |
| @@ -254,10 +334,13 @@ | |
| 334 | j -= 4; |
| 335 | zLine[j] = 0; |
| 336 | } |
| 337 | fossil_print("redirect to %s\n", &zLine[i]); |
| 338 | url_parse(&zLine[i], 0); |
| 339 | fSeenHttpAuth = 0; |
| 340 | if( g.zHttpAuth ) free(g.zHttpAuth); |
| 341 | g.zHttpAuth = get_httpauth(); |
| 342 | transport_close(GLOBAL_URL()); |
| 343 | return http_exchange(pSend, pReply, useLogin, maxRedirect); |
| 344 | }else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){ |
| 345 | if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){ |
| 346 | isCompressed = 0; |
| 347 |
+122
-98
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -443,37 +443,36 @@ | ||
| 443 | 443 | /* |
| 444 | 444 | ** Construct an appropriate diffFlag for text_diff() based on query |
| 445 | 445 | ** parameters and the to boolean arguments. |
| 446 | 446 | */ |
| 447 | 447 | u64 construct_diff_flags(int verboseFlag, int sideBySide){ |
| 448 | - u64 diffFlags; | |
| 449 | - if( verboseFlag==0 ){ | |
| 450 | - diffFlags = 0; /* Zero means do not show any diff */ | |
| 451 | - }else{ | |
| 448 | + u64 diffFlags = 0; /* Zero means do not show any diff */ | |
| 449 | + if( verboseFlag!=0 ){ | |
| 452 | 450 | int x; |
| 453 | 451 | if( sideBySide ){ |
| 454 | - diffFlags = DIFF_SIDEBYSIDE | DIFF_IGNORE_EOLWS; | |
| 452 | + diffFlags = DIFF_SIDEBYSIDE; | |
| 455 | 453 | |
| 456 | 454 | /* "dw" query parameter determines width of each column */ |
| 457 | 455 | x = atoi(PD("dw","80"))*(DIFF_CONTEXT_MASK+1); |
| 458 | 456 | if( x<0 || x>DIFF_WIDTH_MASK ) x = DIFF_WIDTH_MASK; |
| 459 | 457 | diffFlags += x; |
| 460 | - }else{ | |
| 461 | - diffFlags = DIFF_INLINE | DIFF_IGNORE_EOLWS; | |
| 462 | 458 | } |
| 463 | 459 | |
| 460 | + if( P("w") ){ | |
| 461 | + diffFlags |= DIFF_IGNORE_ALLWS; | |
| 462 | + } | |
| 464 | 463 | /* "dc" query parameter determines lines of context */ |
| 465 | 464 | x = atoi(PD("dc","7")); |
| 466 | 465 | if( x<0 || x>DIFF_CONTEXT_MASK ) x = DIFF_CONTEXT_MASK; |
| 467 | 466 | diffFlags += x; |
| 468 | 467 | |
| 469 | 468 | /* The "noopt" parameter disables diff optimization */ |
| 470 | 469 | if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT; |
| 470 | + diffFlags |= DIFF_STRIP_EOLCR; | |
| 471 | 471 | } |
| 472 | 472 | return diffFlags; |
| 473 | 473 | } |
| 474 | - | |
| 475 | 474 | |
| 476 | 475 | /* |
| 477 | 476 | ** WEBPAGE: vinfo |
| 478 | 477 | ** WEBPAGE: ci |
| 479 | 478 | ** URL: /ci?name=RID|ARTIFACTID |
| @@ -498,10 +497,13 @@ | ||
| 498 | 497 | const char *zName; /* Name of the checkin to be displayed */ |
| 499 | 498 | const char *zUuid; /* UUID of zName */ |
| 500 | 499 | const char *zParent; /* UUID of the parent checkin (if any) */ |
| 501 | 500 | const char *zRe; /* regex parameter */ |
| 502 | 501 | ReCompiled *pRe = 0; /* regex */ |
| 502 | + const char *zW; /* URL param for ignoring whitespace */ | |
| 503 | + const char *zPage = "vinfo"; /* Page that shows diffs */ | |
| 504 | + const char *zPageHide = "ci"; /* Page that hides diffs */ | |
| 503 | 505 | |
| 504 | 506 | login_check_credentials(); |
| 505 | 507 | if( !g.perm.Read ){ login_needed(); return; } |
| 506 | 508 | zName = P("name"); |
| 507 | 509 | rid = name_to_rid_www("name"); |
| @@ -663,79 +665,74 @@ | ||
| 663 | 665 | style_header("Check-in Information"); |
| 664 | 666 | login_anonymous_available(); |
| 665 | 667 | } |
| 666 | 668 | db_finalize(&q1); |
| 667 | 669 | 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 | - } | |
| 670 | + @ <div class="section">Changes</div> | |
| 671 | + @ <div class="sectionmenu"> | |
| 672 | + verboseFlag = g.zPath[0]!='c'; | |
| 673 | + if( db_get_boolean("show-version-diffs", 0)==0 ){ | |
| 674 | + verboseFlag = !verboseFlag; | |
| 675 | + zPage = "ci"; | |
| 676 | + zPageHide = "vinfo"; | |
| 677 | + } | |
| 678 | + diffFlags = construct_diff_flags(verboseFlag, sideBySide); | |
| 679 | + zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; | |
| 680 | + if( verboseFlag ){ | |
| 681 | + @ %z(xhref("class='button'","%R/%s/%T",zPageHide,zName)) | |
| 682 | + @ Hide Diffs</a> | |
| 683 | + if( sideBySide ){ | |
| 684 | + @ %z(xhref("class='button'","%R/%s/%T?sbs=0%s",zPage,zName,zW)) | |
| 685 | + @ Unified Diffs</a> | |
| 686 | + }else{ | |
| 687 | + @ %z(xhref("class='button'","%R/%s/%T?sbs=1%s",zPage,zName,zW)) | |
| 688 | + @ Side-by-Side Diffs</a> | |
| 689 | + } | |
| 690 | + if( *zW ){ | |
| 691 | + @ %z(xhref("class='button'","%R/%s/%T?sbs=%d",zPage,zName,sideBySide)) | |
| 692 | + @ Show Whitespace Changes</a> | |
| 693 | + }else{ | |
| 694 | + @ %z(xhref("class='button'","%R/%s/%T?sbs=%d&w",zPage,zName,sideBySide)) | |
| 695 | + @ Ignore Whitespace</a> | |
| 696 | + } | |
| 697 | + }else{ | |
| 698 | + @ %z(xhref("class='button'","%R/%s/%T?sbs=0",zPage,zName)) | |
| 699 | + @ Show Unified Diffs</a> | |
| 700 | + @ %z(xhref("class='button'","%R/%s/%T?sbs=1",zPage,zName)) | |
| 701 | + @ Show Side-by-Side Diffs</a> | |
| 702 | + } | |
| 703 | + if( zParent ){ | |
| 707 | 704 | @ %z(xhref("class='button'","%R/vpatch?from=%S&to=%S",zParent,zUuid)) |
| 708 | - @ patch</a></div> | |
| 709 | - if( pRe ){ | |
| 710 | - @ <p><b>Only differences that match regular expression "%h(zRe)" | |
| 711 | - @ are shown.</b></p> | |
| 712 | - } | |
| 713 | - db_prepare(&q3, | |
| 714 | - "SELECT name," | |
| 715 | - " mperm," | |
| 716 | - " (SELECT uuid FROM blob WHERE rid=mlink.pid)," | |
| 717 | - " (SELECT uuid FROM blob WHERE rid=mlink.fid)," | |
| 718 | - " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)" | |
| 719 | - " FROM mlink JOIN filename ON filename.fnid=mlink.fnid" | |
| 720 | - " WHERE mlink.mid=%d" | |
| 721 | - " AND (mlink.fid>0" | |
| 722 | - " OR mlink.fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=%d))" | |
| 723 | - " ORDER BY name /*sort*/", | |
| 724 | - rid, rid | |
| 725 | - ); | |
| 726 | - diffFlags = construct_diff_flags(verboseFlag, sideBySide); | |
| 727 | - while( db_step(&q3)==SQLITE_ROW ){ | |
| 728 | - const char *zName = db_column_text(&q3,0); | |
| 729 | - int mperm = db_column_int(&q3, 1); | |
| 730 | - const char *zOld = db_column_text(&q3,2); | |
| 731 | - const char *zNew = db_column_text(&q3,3); | |
| 732 | - const char *zOldName = db_column_text(&q3, 4); | |
| 733 | - append_file_change_line(zName, zOld, zNew, zOldName, diffFlags,pRe,mperm); | |
| 734 | - } | |
| 735 | - db_finalize(&q3); | |
| 736 | - } | |
| 705 | + @ Patch</a> | |
| 706 | + } | |
| 707 | + @</div> | |
| 708 | + if( pRe ){ | |
| 709 | + @ <p><b>Only differences that match regular expression "%h(zRe)" | |
| 710 | + @ are shown.</b></p> | |
| 711 | + } | |
| 712 | + db_prepare(&q3, | |
| 713 | + "SELECT name," | |
| 714 | + " mperm," | |
| 715 | + " (SELECT uuid FROM blob WHERE rid=mlink.pid)," | |
| 716 | + " (SELECT uuid FROM blob WHERE rid=mlink.fid)," | |
| 717 | + " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)" | |
| 718 | + " FROM mlink JOIN filename ON filename.fnid=mlink.fnid" | |
| 719 | + " WHERE mlink.mid=%d" | |
| 720 | + " AND (mlink.fid>0" | |
| 721 | + " OR mlink.fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=%d))" | |
| 722 | + " ORDER BY name /*sort*/", | |
| 723 | + rid, rid | |
| 724 | + ); | |
| 725 | + while( db_step(&q3)==SQLITE_ROW ){ | |
| 726 | + const char *zName = db_column_text(&q3,0); | |
| 727 | + int mperm = db_column_int(&q3, 1); | |
| 728 | + const char *zOld = db_column_text(&q3,2); | |
| 729 | + const char *zNew = db_column_text(&q3,3); | |
| 730 | + const char *zOldName = db_column_text(&q3, 4); | |
| 731 | + append_file_change_line(zName, zOld, zNew, zOldName, diffFlags,pRe,mperm); | |
| 732 | + } | |
| 733 | + db_finalize(&q3); | |
| 737 | 734 | append_diff_javascript(sideBySide); |
| 738 | 735 | style_footer(); |
| 739 | 736 | } |
| 740 | 737 | |
| 741 | 738 | /* |
| @@ -954,10 +951,11 @@ | ||
| 954 | 951 | ManifestFile *pFileFrom, *pFileTo; |
| 955 | 952 | const char *zBranch; |
| 956 | 953 | const char *zFrom; |
| 957 | 954 | const char *zTo; |
| 958 | 955 | const char *zRe; |
| 956 | + const char *zW; | |
| 959 | 957 | const char *zVerbose; |
| 960 | 958 | const char *zGlob; |
| 961 | 959 | ReCompiled *pRe = 0; |
| 962 | 960 | login_check_credentials(); |
| 963 | 961 | if( !g.perm.Read ){ login_needed(); return; } |
| @@ -987,39 +985,54 @@ | ||
| 987 | 985 | zFrom = P("from"); |
| 988 | 986 | zTo = P("to"); |
| 989 | 987 | if(zGlob && !*zGlob){ |
| 990 | 988 | zGlob = NULL; |
| 991 | 989 | } |
| 990 | + diffFlags = construct_diff_flags(verboseFlag, sideBySide); | |
| 991 | + zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; | |
| 992 | 992 | if( sideBySide || verboseFlag ){ |
| 993 | 993 | style_submenu_element("Hide Diff", "hidediff", |
| 994 | - "%R/vdiff?from=%T&to=%T&sbs=0%s%T", | |
| 994 | + "%R/vdiff?from=%T&to=%T&sbs=0%s%T%s", | |
| 995 | 995 | zFrom, zTo, |
| 996 | - zGlob ? "&glob=" : "", zGlob ? zGlob : ""); | |
| 996 | + zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); | |
| 997 | 997 | } |
| 998 | 998 | if( !sideBySide ){ |
| 999 | - style_submenu_element("Side-by-side Diff", "sbsdiff", | |
| 1000 | - "%R/vdiff?from=%T&to=%T&sbs=1%s%T", | |
| 999 | + style_submenu_element("Side-by-Side Diff", "sbsdiff", | |
| 1000 | + "%R/vdiff?from=%T&to=%T&sbs=1%s%T%s", | |
| 1001 | 1001 | zFrom, zTo, |
| 1002 | - zGlob ? "&glob=" : "", zGlob ? zGlob : ""); | |
| 1002 | + zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); | |
| 1003 | 1003 | } |
| 1004 | 1004 | if( sideBySide || !verboseFlag ) { |
| 1005 | 1005 | style_submenu_element("Unified Diff", "udiff", |
| 1006 | - "%R/vdiff?from=%T&to=%T&sbs=0&v%s%T", | |
| 1006 | + "%R/vdiff?from=%T&to=%T&sbs=0&v%s%T%s", | |
| 1007 | 1007 | zFrom, zTo, |
| 1008 | - zGlob ? "&glob=" : "", zGlob ? zGlob : ""); | |
| 1008 | + zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); | |
| 1009 | 1009 | } |
| 1010 | 1010 | style_submenu_element("Invert", "invert", |
| 1011 | - "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T", zTo, zFrom, | |
| 1011 | + "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T%s", zTo, zFrom, | |
| 1012 | 1012 | sideBySide, (verboseFlag && !sideBySide)?"&v":"", |
| 1013 | - zGlob ? "&glob=" : "", zGlob ? zGlob : ""); | |
| 1013 | + zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); | |
| 1014 | 1014 | if( zGlob ){ |
| 1015 | 1015 | style_submenu_element("Clear glob", "clearglob", |
| 1016 | - "%R/vdiff?from=%T&to=%T&sbs=%d%s", zFrom, zTo, | |
| 1017 | - sideBySide, (verboseFlag && !sideBySide)?"&v":""); | |
| 1016 | + "%R/vdiff?from=%T&to=%T&sbs=%d%s%s", zFrom, zTo, | |
| 1017 | + sideBySide, (verboseFlag && !sideBySide)?"&v":"", zW); | |
| 1018 | 1018 | }else{ |
| 1019 | 1019 | style_submenu_element("Patch", "patch", |
| 1020 | - "%R/vpatch?from=%T&to=%T", zFrom, zTo); | |
| 1020 | + "%R/vpatch?from=%T&to=%T%s", zFrom, zTo, zW); | |
| 1021 | + } | |
| 1022 | + if( sideBySide || verboseFlag ){ | |
| 1023 | + if( *zW ){ | |
| 1024 | + style_submenu_element("Show Whitespace Differences", "whitespace", | |
| 1025 | + "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T", zFrom, zTo, | |
| 1026 | + sideBySide, (verboseFlag && !sideBySide)?"&v":"", | |
| 1027 | + zGlob ? "&glob=" : "", zGlob ? zGlob : ""); | |
| 1028 | + }else{ | |
| 1029 | + style_submenu_element("Ignore Whitespace", "ignorews", | |
| 1030 | + "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T&w", zFrom, zTo, | |
| 1031 | + sideBySide, (verboseFlag && !sideBySide)?"&v":"", | |
| 1032 | + zGlob ? "&glob=" : "", zGlob ? zGlob : ""); | |
| 1033 | + } | |
| 1021 | 1034 | } |
| 1022 | 1035 | style_header("Check-in Differences"); |
| 1023 | 1036 | @ <h2>Difference From:</h2><blockquote> |
| 1024 | 1037 | checkin_description(ridFrom); |
| 1025 | 1038 | @ </blockquote><h2>To:</h2><blockquote> |
| @@ -1036,11 +1049,10 @@ | ||
| 1036 | 1049 | |
| 1037 | 1050 | manifest_file_rewind(pFrom); |
| 1038 | 1051 | pFileFrom = manifest_file_next(pFrom, 0); |
| 1039 | 1052 | manifest_file_rewind(pTo); |
| 1040 | 1053 | pFileTo = manifest_file_next(pTo, 0); |
| 1041 | - diffFlags = construct_diff_flags(verboseFlag, sideBySide); | |
| 1042 | 1054 | while( pFileFrom || pFileTo ){ |
| 1043 | 1055 | int cmp; |
| 1044 | 1056 | if( pFileFrom==0 ){ |
| 1045 | 1057 | cmp = +1; |
| 1046 | 1058 | }else if( pFileTo==0 ){ |
| @@ -1337,10 +1349,11 @@ | ||
| 1337 | 1349 | int isPatch; |
| 1338 | 1350 | int sideBySide; |
| 1339 | 1351 | char *zV1; |
| 1340 | 1352 | char *zV2; |
| 1341 | 1353 | const char *zRe; |
| 1354 | + const char *zW; /* URL param for ignoring whitespace */ | |
| 1342 | 1355 | ReCompiled *pRe = 0; |
| 1343 | 1356 | u64 diffFlags; |
| 1344 | 1357 | |
| 1345 | 1358 | login_check_credentials(); |
| 1346 | 1359 | if( !g.perm.Read ){ login_needed(); return; } |
| @@ -1367,20 +1380,30 @@ | ||
| 1367 | 1380 | zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1); |
| 1368 | 1381 | zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2); |
| 1369 | 1382 | diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML; |
| 1370 | 1383 | |
| 1371 | 1384 | style_header("Diff"); |
| 1385 | + zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; | |
| 1386 | + if( *zW ){ | |
| 1387 | + style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes", | |
| 1388 | + "%s/fdiff?v1=%T&v2=%T&sbs=%d", | |
| 1389 | + g.zTop, P("v1"), P("v2"), sideBySide); | |
| 1390 | + }else{ | |
| 1391 | + style_submenu_element("Ignore Whitespace", "Ignore Whitespace", | |
| 1392 | + "%s/fdiff?v1=%T&v2=%T&sbs=%d&w", | |
| 1393 | + g.zTop, P("v1"), P("v2"), sideBySide); | |
| 1394 | + } | |
| 1372 | 1395 | style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch", |
| 1373 | 1396 | g.zTop, P("v1"), P("v2")); |
| 1374 | 1397 | if( !sideBySide ){ |
| 1375 | - style_submenu_element("Side-by-side Diff", "sbsdiff", | |
| 1376 | - "%s/fdiff?v1=%T&v2=%T&sbs=1", | |
| 1377 | - g.zTop, P("v1"), P("v2")); | |
| 1398 | + style_submenu_element("Side-by-Side Diff", "sbsdiff", | |
| 1399 | + "%s/fdiff?v1=%T&v2=%T&sbs=1%s", | |
| 1400 | + g.zTop, P("v1"), P("v2"), zW); | |
| 1378 | 1401 | }else{ |
| 1379 | 1402 | style_submenu_element("Unified Diff", "udiff", |
| 1380 | - "%s/fdiff?v1=%T&v2=%T&sbs=0", | |
| 1381 | - g.zTop, P("v1"), P("v2")); | |
| 1403 | + "%s/fdiff?v1=%T&v2=%T&sbs=0%s", | |
| 1404 | + g.zTop, P("v1"), P("v2"), zW); | |
| 1382 | 1405 | } |
| 1383 | 1406 | |
| 1384 | 1407 | if( P("smhdr")!=0 ){ |
| 1385 | 1408 | @ <h2>Differences From Artifact |
| 1386 | 1409 | @ %z(href("%R/artifact/%S",zV1))[%S(zV1)]</a> To |
| @@ -1418,11 +1441,11 @@ | ||
| 1418 | 1441 | rid = name_to_rid_www("name"); |
| 1419 | 1442 | login_check_credentials(); |
| 1420 | 1443 | if( !g.perm.Read ){ login_needed(); return; } |
| 1421 | 1444 | if( rid==0 ) fossil_redirect_home(); |
| 1422 | 1445 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1423 | - if( fossil_strcmp(P("name"), zUuid)==0 ){ | |
| 1446 | + if( fossil_strcmp(P("name"), zUuid)==0 && login_is_nobody() ){ | |
| 1424 | 1447 | g.isConst = 1; |
| 1425 | 1448 | } |
| 1426 | 1449 | free(zUuid); |
| 1427 | 1450 | zMime = P("m"); |
| 1428 | 1451 | if( zMime==0 ){ |
| @@ -1696,11 +1719,12 @@ | ||
| 1696 | 1719 | }else{ |
| 1697 | 1720 | renderAsHtml = 1; |
| 1698 | 1721 | style_submenu_element("Text", "Text", |
| 1699 | 1722 | "%s/artifact/%s?txt=1", g.zTop, zUuid); |
| 1700 | 1723 | } |
| 1701 | - }else if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0 ){ | |
| 1724 | + }else if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0 | |
| 1725 | + || fossil_strcmp(zMime, "text/x-markdown")==0 ){ | |
| 1702 | 1726 | if( asText ){ |
| 1703 | 1727 | style_submenu_element("Wiki", "Wiki", |
| 1704 | 1728 | "%s/artifact/%s", g.zTop, zUuid); |
| 1705 | 1729 | }else{ |
| 1706 | 1730 | renderAsWiki = 1; |
| @@ -1713,11 +1737,11 @@ | ||
| 1713 | 1737 | style_submenu_element("Parsed", "Parsed", "%R/info/%s", zUuid); |
| 1714 | 1738 | } |
| 1715 | 1739 | @ <hr /> |
| 1716 | 1740 | content_get(rid, &content); |
| 1717 | 1741 | if( renderAsWiki ){ |
| 1718 | - wiki_convert(&content, 0, 0); | |
| 1742 | + wiki_render_by_mimetype(&content, zMime); | |
| 1719 | 1743 | }else if( renderAsHtml ){ |
| 1720 | 1744 | @ <iframe src="%R/raw/%T(blob_str(&downloadName))?name=%s(zUuid)" |
| 1721 | 1745 | @ width="100%%" frameborder="0" marginwidth="0" marginheight="0" |
| 1722 | 1746 | @ sandbox="allow-same-origin" |
| 1723 | 1747 | @ onload="this.height = this.contentDocument.documentElement.scrollHeight;"> |
| @@ -2237,11 +2261,11 @@ | ||
| 2237 | 2261 | } |
| 2238 | 2262 | db_finalize(&q); |
| 2239 | 2263 | if( nChng>0 ){ |
| 2240 | 2264 | int nrid; |
| 2241 | 2265 | Blob cksum; |
| 2242 | - blob_appendf(&ctrl, "U %F\n", g.zLogin); | |
| 2266 | + blob_appendf(&ctrl, "U %F\n", login_name()); | |
| 2243 | 2267 | md5sum_blob(&ctrl, &cksum); |
| 2244 | 2268 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 2245 | 2269 | db_begin_transaction(); |
| 2246 | 2270 | g.markPrivate = content_is_private(rid); |
| 2247 | 2271 | nrid = content_put(&ctrl); |
| 2248 | 2272 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -443,37 +443,36 @@ | |
| 443 | /* |
| 444 | ** Construct an appropriate diffFlag for text_diff() based on query |
| 445 | ** parameters and the to boolean arguments. |
| 446 | */ |
| 447 | u64 construct_diff_flags(int verboseFlag, int sideBySide){ |
| 448 | u64 diffFlags; |
| 449 | if( verboseFlag==0 ){ |
| 450 | diffFlags = 0; /* Zero means do not show any diff */ |
| 451 | }else{ |
| 452 | int x; |
| 453 | if( sideBySide ){ |
| 454 | diffFlags = DIFF_SIDEBYSIDE | DIFF_IGNORE_EOLWS; |
| 455 | |
| 456 | /* "dw" query parameter determines width of each column */ |
| 457 | x = atoi(PD("dw","80"))*(DIFF_CONTEXT_MASK+1); |
| 458 | if( x<0 || x>DIFF_WIDTH_MASK ) x = DIFF_WIDTH_MASK; |
| 459 | diffFlags += x; |
| 460 | }else{ |
| 461 | diffFlags = DIFF_INLINE | DIFF_IGNORE_EOLWS; |
| 462 | } |
| 463 | |
| 464 | /* "dc" query parameter determines lines of context */ |
| 465 | x = atoi(PD("dc","7")); |
| 466 | if( x<0 || x>DIFF_CONTEXT_MASK ) x = DIFF_CONTEXT_MASK; |
| 467 | diffFlags += x; |
| 468 | |
| 469 | /* The "noopt" parameter disables diff optimization */ |
| 470 | if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT; |
| 471 | } |
| 472 | return diffFlags; |
| 473 | } |
| 474 | |
| 475 | |
| 476 | /* |
| 477 | ** WEBPAGE: vinfo |
| 478 | ** WEBPAGE: ci |
| 479 | ** URL: /ci?name=RID|ARTIFACTID |
| @@ -498,10 +497,13 @@ | |
| 498 | const char *zName; /* Name of the checkin to be displayed */ |
| 499 | const char *zUuid; /* UUID of zName */ |
| 500 | const char *zParent; /* UUID of the parent checkin (if any) */ |
| 501 | const char *zRe; /* regex parameter */ |
| 502 | ReCompiled *pRe = 0; /* regex */ |
| 503 | |
| 504 | login_check_credentials(); |
| 505 | if( !g.perm.Read ){ login_needed(); return; } |
| 506 | zName = P("name"); |
| 507 | rid = name_to_rid_www("name"); |
| @@ -663,79 +665,74 @@ | |
| 663 | style_header("Check-in Information"); |
| 664 | login_anonymous_available(); |
| 665 | } |
| 666 | db_finalize(&q1); |
| 667 | showTags(rid, ""); |
| 668 | if( zParent ){ |
| 669 | @ <div class="section">Changes</div> |
| 670 | @ <div class="sectionmenu"> |
| 671 | verboseFlag = g.zPath[0]!='c'; |
| 672 | if( db_get_boolean("show-version-diffs", 0)==0 ){ |
| 673 | verboseFlag = !verboseFlag; |
| 674 | if( verboseFlag ){ |
| 675 | @ %z(xhref("class='button'","%R/vinfo/%T",zName)) |
| 676 | @ hide 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 +951,11 @@ | |
| 954 | ManifestFile *pFileFrom, *pFileTo; |
| 955 | const char *zBranch; |
| 956 | const char *zFrom; |
| 957 | const char *zTo; |
| 958 | const char *zRe; |
| 959 | const char *zVerbose; |
| 960 | const char *zGlob; |
| 961 | ReCompiled *pRe = 0; |
| 962 | login_check_credentials(); |
| 963 | if( !g.perm.Read ){ login_needed(); return; } |
| @@ -987,39 +985,54 @@ | |
| 987 | zFrom = P("from"); |
| 988 | zTo = P("to"); |
| 989 | if(zGlob && !*zGlob){ |
| 990 | zGlob = NULL; |
| 991 | } |
| 992 | if( sideBySide || verboseFlag ){ |
| 993 | style_submenu_element("Hide Diff", "hidediff", |
| 994 | "%R/vdiff?from=%T&to=%T&sbs=0%s%T", |
| 995 | zFrom, zTo, |
| 996 | zGlob ? "&glob=" : "", zGlob ? zGlob : ""); |
| 997 | } |
| 998 | if( !sideBySide ){ |
| 999 | style_submenu_element("Side-by-side Diff", "sbsdiff", |
| 1000 | "%R/vdiff?from=%T&to=%T&sbs=1%s%T", |
| 1001 | zFrom, zTo, |
| 1002 | zGlob ? "&glob=" : "", zGlob ? zGlob : ""); |
| 1003 | } |
| 1004 | if( sideBySide || !verboseFlag ) { |
| 1005 | style_submenu_element("Unified Diff", "udiff", |
| 1006 | "%R/vdiff?from=%T&to=%T&sbs=0&v%s%T", |
| 1007 | zFrom, zTo, |
| 1008 | zGlob ? "&glob=" : "", zGlob ? zGlob : ""); |
| 1009 | } |
| 1010 | style_submenu_element("Invert", "invert", |
| 1011 | "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T", zTo, zFrom, |
| 1012 | sideBySide, (verboseFlag && !sideBySide)?"&v":"", |
| 1013 | zGlob ? "&glob=" : "", zGlob ? zGlob : ""); |
| 1014 | if( zGlob ){ |
| 1015 | style_submenu_element("Clear glob", "clearglob", |
| 1016 | "%R/vdiff?from=%T&to=%T&sbs=%d%s", zFrom, zTo, |
| 1017 | sideBySide, (verboseFlag && !sideBySide)?"&v":""); |
| 1018 | }else{ |
| 1019 | style_submenu_element("Patch", "patch", |
| 1020 | "%R/vpatch?from=%T&to=%T", zFrom, zTo); |
| 1021 | } |
| 1022 | style_header("Check-in Differences"); |
| 1023 | @ <h2>Difference From:</h2><blockquote> |
| 1024 | checkin_description(ridFrom); |
| 1025 | @ </blockquote><h2>To:</h2><blockquote> |
| @@ -1036,11 +1049,10 @@ | |
| 1036 | |
| 1037 | manifest_file_rewind(pFrom); |
| 1038 | pFileFrom = manifest_file_next(pFrom, 0); |
| 1039 | manifest_file_rewind(pTo); |
| 1040 | pFileTo = manifest_file_next(pTo, 0); |
| 1041 | diffFlags = construct_diff_flags(verboseFlag, sideBySide); |
| 1042 | while( pFileFrom || pFileTo ){ |
| 1043 | int cmp; |
| 1044 | if( pFileFrom==0 ){ |
| 1045 | cmp = +1; |
| 1046 | }else if( pFileTo==0 ){ |
| @@ -1337,10 +1349,11 @@ | |
| 1337 | int isPatch; |
| 1338 | int sideBySide; |
| 1339 | char *zV1; |
| 1340 | char *zV2; |
| 1341 | const char *zRe; |
| 1342 | ReCompiled *pRe = 0; |
| 1343 | u64 diffFlags; |
| 1344 | |
| 1345 | login_check_credentials(); |
| 1346 | if( !g.perm.Read ){ login_needed(); return; } |
| @@ -1367,20 +1380,30 @@ | |
| 1367 | zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1); |
| 1368 | zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2); |
| 1369 | diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML; |
| 1370 | |
| 1371 | style_header("Diff"); |
| 1372 | style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch", |
| 1373 | g.zTop, P("v1"), P("v2")); |
| 1374 | if( !sideBySide ){ |
| 1375 | style_submenu_element("Side-by-side Diff", "sbsdiff", |
| 1376 | "%s/fdiff?v1=%T&v2=%T&sbs=1", |
| 1377 | g.zTop, P("v1"), P("v2")); |
| 1378 | }else{ |
| 1379 | style_submenu_element("Unified Diff", "udiff", |
| 1380 | "%s/fdiff?v1=%T&v2=%T&sbs=0", |
| 1381 | g.zTop, P("v1"), P("v2")); |
| 1382 | } |
| 1383 | |
| 1384 | if( P("smhdr")!=0 ){ |
| 1385 | @ <h2>Differences From Artifact |
| 1386 | @ %z(href("%R/artifact/%S",zV1))[%S(zV1)]</a> To |
| @@ -1418,11 +1441,11 @@ | |
| 1418 | rid = name_to_rid_www("name"); |
| 1419 | login_check_credentials(); |
| 1420 | if( !g.perm.Read ){ login_needed(); return; } |
| 1421 | if( rid==0 ) fossil_redirect_home(); |
| 1422 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1423 | if( fossil_strcmp(P("name"), zUuid)==0 ){ |
| 1424 | g.isConst = 1; |
| 1425 | } |
| 1426 | free(zUuid); |
| 1427 | zMime = P("m"); |
| 1428 | if( zMime==0 ){ |
| @@ -1696,11 +1719,12 @@ | |
| 1696 | }else{ |
| 1697 | renderAsHtml = 1; |
| 1698 | style_submenu_element("Text", "Text", |
| 1699 | "%s/artifact/%s?txt=1", g.zTop, zUuid); |
| 1700 | } |
| 1701 | }else if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0 ){ |
| 1702 | if( asText ){ |
| 1703 | style_submenu_element("Wiki", "Wiki", |
| 1704 | "%s/artifact/%s", g.zTop, zUuid); |
| 1705 | }else{ |
| 1706 | renderAsWiki = 1; |
| @@ -1713,11 +1737,11 @@ | |
| 1713 | style_submenu_element("Parsed", "Parsed", "%R/info/%s", zUuid); |
| 1714 | } |
| 1715 | @ <hr /> |
| 1716 | content_get(rid, &content); |
| 1717 | if( renderAsWiki ){ |
| 1718 | wiki_convert(&content, 0, 0); |
| 1719 | }else if( renderAsHtml ){ |
| 1720 | @ <iframe src="%R/raw/%T(blob_str(&downloadName))?name=%s(zUuid)" |
| 1721 | @ width="100%%" frameborder="0" marginwidth="0" marginheight="0" |
| 1722 | @ sandbox="allow-same-origin" |
| 1723 | @ onload="this.height = this.contentDocument.documentElement.scrollHeight;"> |
| @@ -2237,11 +2261,11 @@ | |
| 2237 | } |
| 2238 | db_finalize(&q); |
| 2239 | if( nChng>0 ){ |
| 2240 | int nrid; |
| 2241 | Blob cksum; |
| 2242 | blob_appendf(&ctrl, "U %F\n", g.zLogin); |
| 2243 | md5sum_blob(&ctrl, &cksum); |
| 2244 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 2245 | db_begin_transaction(); |
| 2246 | g.markPrivate = content_is_private(rid); |
| 2247 | nrid = content_put(&ctrl); |
| 2248 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -443,37 +443,36 @@ | |
| 443 | /* |
| 444 | ** Construct an appropriate diffFlag for text_diff() based on query |
| 445 | ** parameters and the to boolean arguments. |
| 446 | */ |
| 447 | u64 construct_diff_flags(int verboseFlag, int sideBySide){ |
| 448 | u64 diffFlags = 0; /* Zero means do not show any diff */ |
| 449 | if( verboseFlag!=0 ){ |
| 450 | int x; |
| 451 | if( sideBySide ){ |
| 452 | diffFlags = DIFF_SIDEBYSIDE; |
| 453 | |
| 454 | /* "dw" query parameter determines width of each column */ |
| 455 | x = atoi(PD("dw","80"))*(DIFF_CONTEXT_MASK+1); |
| 456 | if( x<0 || x>DIFF_WIDTH_MASK ) x = DIFF_WIDTH_MASK; |
| 457 | diffFlags += x; |
| 458 | } |
| 459 | |
| 460 | if( P("w") ){ |
| 461 | diffFlags |= DIFF_IGNORE_ALLWS; |
| 462 | } |
| 463 | /* "dc" query parameter determines lines of context */ |
| 464 | x = atoi(PD("dc","7")); |
| 465 | if( x<0 || x>DIFF_CONTEXT_MASK ) x = DIFF_CONTEXT_MASK; |
| 466 | diffFlags += x; |
| 467 | |
| 468 | /* The "noopt" parameter disables diff optimization */ |
| 469 | if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT; |
| 470 | diffFlags |= DIFF_STRIP_EOLCR; |
| 471 | } |
| 472 | return diffFlags; |
| 473 | } |
| 474 | |
| 475 | /* |
| 476 | ** WEBPAGE: vinfo |
| 477 | ** WEBPAGE: ci |
| 478 | ** URL: /ci?name=RID|ARTIFACTID |
| @@ -498,10 +497,13 @@ | |
| 497 | const char *zName; /* Name of the checkin to be displayed */ |
| 498 | const char *zUuid; /* UUID of zName */ |
| 499 | const char *zParent; /* UUID of the parent checkin (if any) */ |
| 500 | const char *zRe; /* regex parameter */ |
| 501 | ReCompiled *pRe = 0; /* regex */ |
| 502 | const char *zW; /* URL param for ignoring whitespace */ |
| 503 | const char *zPage = "vinfo"; /* Page that shows diffs */ |
| 504 | const char *zPageHide = "ci"; /* Page that hides diffs */ |
| 505 | |
| 506 | login_check_credentials(); |
| 507 | if( !g.perm.Read ){ login_needed(); return; } |
| 508 | zName = P("name"); |
| 509 | rid = name_to_rid_www("name"); |
| @@ -663,79 +665,74 @@ | |
| 665 | style_header("Check-in Information"); |
| 666 | login_anonymous_available(); |
| 667 | } |
| 668 | db_finalize(&q1); |
| 669 | showTags(rid, ""); |
| 670 | @ <div class="section">Changes</div> |
| 671 | @ <div class="sectionmenu"> |
| 672 | verboseFlag = g.zPath[0]!='c'; |
| 673 | if( db_get_boolean("show-version-diffs", 0)==0 ){ |
| 674 | verboseFlag = !verboseFlag; |
| 675 | zPage = "ci"; |
| 676 | zPageHide = "vinfo"; |
| 677 | } |
| 678 | diffFlags = construct_diff_flags(verboseFlag, sideBySide); |
| 679 | zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; |
| 680 | if( verboseFlag ){ |
| 681 | @ %z(xhref("class='button'","%R/%s/%T",zPageHide,zName)) |
| 682 | @ Hide Diffs</a> |
| 683 | if( sideBySide ){ |
| 684 | @ %z(xhref("class='button'","%R/%s/%T?sbs=0%s",zPage,zName,zW)) |
| 685 | @ Unified Diffs</a> |
| 686 | }else{ |
| 687 | @ %z(xhref("class='button'","%R/%s/%T?sbs=1%s",zPage,zName,zW)) |
| 688 | @ Side-by-Side Diffs</a> |
| 689 | } |
| 690 | if( *zW ){ |
| 691 | @ %z(xhref("class='button'","%R/%s/%T?sbs=%d",zPage,zName,sideBySide)) |
| 692 | @ Show Whitespace Changes</a> |
| 693 | }else{ |
| 694 | @ %z(xhref("class='button'","%R/%s/%T?sbs=%d&w",zPage,zName,sideBySide)) |
| 695 | @ Ignore Whitespace</a> |
| 696 | } |
| 697 | }else{ |
| 698 | @ %z(xhref("class='button'","%R/%s/%T?sbs=0",zPage,zName)) |
| 699 | @ Show Unified Diffs</a> |
| 700 | @ %z(xhref("class='button'","%R/%s/%T?sbs=1",zPage,zName)) |
| 701 | @ Show Side-by-Side Diffs</a> |
| 702 | } |
| 703 | if( zParent ){ |
| 704 | @ %z(xhref("class='button'","%R/vpatch?from=%S&to=%S",zParent,zUuid)) |
| 705 | @ Patch</a> |
| 706 | } |
| 707 | @</div> |
| 708 | if( pRe ){ |
| 709 | @ <p><b>Only differences that match regular expression "%h(zRe)" |
| 710 | @ are shown.</b></p> |
| 711 | } |
| 712 | db_prepare(&q3, |
| 713 | "SELECT name," |
| 714 | " mperm," |
| 715 | " (SELECT uuid FROM blob WHERE rid=mlink.pid)," |
| 716 | " (SELECT uuid FROM blob WHERE rid=mlink.fid)," |
| 717 | " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)" |
| 718 | " FROM mlink JOIN filename ON filename.fnid=mlink.fnid" |
| 719 | " WHERE mlink.mid=%d" |
| 720 | " AND (mlink.fid>0" |
| 721 | " OR mlink.fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=%d))" |
| 722 | " ORDER BY name /*sort*/", |
| 723 | rid, rid |
| 724 | ); |
| 725 | while( db_step(&q3)==SQLITE_ROW ){ |
| 726 | const char *zName = db_column_text(&q3,0); |
| 727 | int mperm = db_column_int(&q3, 1); |
| 728 | const char *zOld = db_column_text(&q3,2); |
| 729 | const char *zNew = db_column_text(&q3,3); |
| 730 | const char *zOldName = db_column_text(&q3, 4); |
| 731 | append_file_change_line(zName, zOld, zNew, zOldName, diffFlags,pRe,mperm); |
| 732 | } |
| 733 | db_finalize(&q3); |
| 734 | append_diff_javascript(sideBySide); |
| 735 | style_footer(); |
| 736 | } |
| 737 | |
| 738 | /* |
| @@ -954,10 +951,11 @@ | |
| 951 | ManifestFile *pFileFrom, *pFileTo; |
| 952 | const char *zBranch; |
| 953 | const char *zFrom; |
| 954 | const char *zTo; |
| 955 | const char *zRe; |
| 956 | const char *zW; |
| 957 | const char *zVerbose; |
| 958 | const char *zGlob; |
| 959 | ReCompiled *pRe = 0; |
| 960 | login_check_credentials(); |
| 961 | if( !g.perm.Read ){ login_needed(); return; } |
| @@ -987,39 +985,54 @@ | |
| 985 | zFrom = P("from"); |
| 986 | zTo = P("to"); |
| 987 | if(zGlob && !*zGlob){ |
| 988 | zGlob = NULL; |
| 989 | } |
| 990 | diffFlags = construct_diff_flags(verboseFlag, sideBySide); |
| 991 | zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; |
| 992 | if( sideBySide || verboseFlag ){ |
| 993 | style_submenu_element("Hide Diff", "hidediff", |
| 994 | "%R/vdiff?from=%T&to=%T&sbs=0%s%T%s", |
| 995 | zFrom, zTo, |
| 996 | zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); |
| 997 | } |
| 998 | if( !sideBySide ){ |
| 999 | style_submenu_element("Side-by-Side Diff", "sbsdiff", |
| 1000 | "%R/vdiff?from=%T&to=%T&sbs=1%s%T%s", |
| 1001 | zFrom, zTo, |
| 1002 | zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); |
| 1003 | } |
| 1004 | if( sideBySide || !verboseFlag ) { |
| 1005 | style_submenu_element("Unified Diff", "udiff", |
| 1006 | "%R/vdiff?from=%T&to=%T&sbs=0&v%s%T%s", |
| 1007 | zFrom, zTo, |
| 1008 | zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); |
| 1009 | } |
| 1010 | style_submenu_element("Invert", "invert", |
| 1011 | "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T%s", zTo, zFrom, |
| 1012 | sideBySide, (verboseFlag && !sideBySide)?"&v":"", |
| 1013 | zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); |
| 1014 | if( zGlob ){ |
| 1015 | style_submenu_element("Clear glob", "clearglob", |
| 1016 | "%R/vdiff?from=%T&to=%T&sbs=%d%s%s", zFrom, zTo, |
| 1017 | sideBySide, (verboseFlag && !sideBySide)?"&v":"", zW); |
| 1018 | }else{ |
| 1019 | style_submenu_element("Patch", "patch", |
| 1020 | "%R/vpatch?from=%T&to=%T%s", zFrom, zTo, zW); |
| 1021 | } |
| 1022 | if( sideBySide || verboseFlag ){ |
| 1023 | if( *zW ){ |
| 1024 | style_submenu_element("Show Whitespace Differences", "whitespace", |
| 1025 | "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T", zFrom, zTo, |
| 1026 | sideBySide, (verboseFlag && !sideBySide)?"&v":"", |
| 1027 | zGlob ? "&glob=" : "", zGlob ? zGlob : ""); |
| 1028 | }else{ |
| 1029 | style_submenu_element("Ignore Whitespace", "ignorews", |
| 1030 | "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T&w", zFrom, zTo, |
| 1031 | sideBySide, (verboseFlag && !sideBySide)?"&v":"", |
| 1032 | zGlob ? "&glob=" : "", zGlob ? zGlob : ""); |
| 1033 | } |
| 1034 | } |
| 1035 | style_header("Check-in Differences"); |
| 1036 | @ <h2>Difference From:</h2><blockquote> |
| 1037 | checkin_description(ridFrom); |
| 1038 | @ </blockquote><h2>To:</h2><blockquote> |
| @@ -1036,11 +1049,10 @@ | |
| 1049 | |
| 1050 | manifest_file_rewind(pFrom); |
| 1051 | pFileFrom = manifest_file_next(pFrom, 0); |
| 1052 | manifest_file_rewind(pTo); |
| 1053 | pFileTo = manifest_file_next(pTo, 0); |
| 1054 | while( pFileFrom || pFileTo ){ |
| 1055 | int cmp; |
| 1056 | if( pFileFrom==0 ){ |
| 1057 | cmp = +1; |
| 1058 | }else if( pFileTo==0 ){ |
| @@ -1337,10 +1349,11 @@ | |
| 1349 | int isPatch; |
| 1350 | int sideBySide; |
| 1351 | char *zV1; |
| 1352 | char *zV2; |
| 1353 | const char *zRe; |
| 1354 | const char *zW; /* URL param for ignoring whitespace */ |
| 1355 | ReCompiled *pRe = 0; |
| 1356 | u64 diffFlags; |
| 1357 | |
| 1358 | login_check_credentials(); |
| 1359 | if( !g.perm.Read ){ login_needed(); return; } |
| @@ -1367,20 +1380,30 @@ | |
| 1380 | zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1); |
| 1381 | zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2); |
| 1382 | diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML; |
| 1383 | |
| 1384 | style_header("Diff"); |
| 1385 | zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; |
| 1386 | if( *zW ){ |
| 1387 | style_submenu_element("Show Whitespace Changes", "Show Whitespace Changes", |
| 1388 | "%s/fdiff?v1=%T&v2=%T&sbs=%d", |
| 1389 | g.zTop, P("v1"), P("v2"), sideBySide); |
| 1390 | }else{ |
| 1391 | style_submenu_element("Ignore Whitespace", "Ignore Whitespace", |
| 1392 | "%s/fdiff?v1=%T&v2=%T&sbs=%d&w", |
| 1393 | g.zTop, P("v1"), P("v2"), sideBySide); |
| 1394 | } |
| 1395 | style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch", |
| 1396 | g.zTop, P("v1"), P("v2")); |
| 1397 | if( !sideBySide ){ |
| 1398 | style_submenu_element("Side-by-Side Diff", "sbsdiff", |
| 1399 | "%s/fdiff?v1=%T&v2=%T&sbs=1%s", |
| 1400 | g.zTop, P("v1"), P("v2"), zW); |
| 1401 | }else{ |
| 1402 | style_submenu_element("Unified Diff", "udiff", |
| 1403 | "%s/fdiff?v1=%T&v2=%T&sbs=0%s", |
| 1404 | g.zTop, P("v1"), P("v2"), zW); |
| 1405 | } |
| 1406 | |
| 1407 | if( P("smhdr")!=0 ){ |
| 1408 | @ <h2>Differences From Artifact |
| 1409 | @ %z(href("%R/artifact/%S",zV1))[%S(zV1)]</a> To |
| @@ -1418,11 +1441,11 @@ | |
| 1441 | rid = name_to_rid_www("name"); |
| 1442 | login_check_credentials(); |
| 1443 | if( !g.perm.Read ){ login_needed(); return; } |
| 1444 | if( rid==0 ) fossil_redirect_home(); |
| 1445 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1446 | if( fossil_strcmp(P("name"), zUuid)==0 && login_is_nobody() ){ |
| 1447 | g.isConst = 1; |
| 1448 | } |
| 1449 | free(zUuid); |
| 1450 | zMime = P("m"); |
| 1451 | if( zMime==0 ){ |
| @@ -1696,11 +1719,12 @@ | |
| 1719 | }else{ |
| 1720 | renderAsHtml = 1; |
| 1721 | style_submenu_element("Text", "Text", |
| 1722 | "%s/artifact/%s?txt=1", g.zTop, zUuid); |
| 1723 | } |
| 1724 | }else if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0 |
| 1725 | || fossil_strcmp(zMime, "text/x-markdown")==0 ){ |
| 1726 | if( asText ){ |
| 1727 | style_submenu_element("Wiki", "Wiki", |
| 1728 | "%s/artifact/%s", g.zTop, zUuid); |
| 1729 | }else{ |
| 1730 | renderAsWiki = 1; |
| @@ -1713,11 +1737,11 @@ | |
| 1737 | style_submenu_element("Parsed", "Parsed", "%R/info/%s", zUuid); |
| 1738 | } |
| 1739 | @ <hr /> |
| 1740 | content_get(rid, &content); |
| 1741 | if( renderAsWiki ){ |
| 1742 | wiki_render_by_mimetype(&content, zMime); |
| 1743 | }else if( renderAsHtml ){ |
| 1744 | @ <iframe src="%R/raw/%T(blob_str(&downloadName))?name=%s(zUuid)" |
| 1745 | @ width="100%%" frameborder="0" marginwidth="0" marginheight="0" |
| 1746 | @ sandbox="allow-same-origin" |
| 1747 | @ onload="this.height = this.contentDocument.documentElement.scrollHeight;"> |
| @@ -2237,11 +2261,11 @@ | |
| 2261 | } |
| 2262 | db_finalize(&q); |
| 2263 | if( nChng>0 ){ |
| 2264 | int nrid; |
| 2265 | Blob cksum; |
| 2266 | blob_appendf(&ctrl, "U %F\n", login_name()); |
| 2267 | md5sum_blob(&ctrl, &cksum); |
| 2268 | blob_appendf(&ctrl, "Z %b\n", &cksum); |
| 2269 | db_begin_transaction(); |
| 2270 | g.markPrivate = content_is_private(rid); |
| 2271 | nrid = content_put(&ctrl); |
| 2272 |
+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 |
| --- src/json_timeline.c | |
| +++ src/json_timeline.c | |
| @@ -66,11 +66,11 @@ | |
| 66 | /* |
| 67 | ** Create a temporary table suitable for storing timeline data. |
| 68 | */ |
| 69 | static void json_timeline_temp_table(void){ |
| 70 | /* Field order MUST match that from json_timeline_query()!!! */ |
| 71 | static const char zSql[] = |
| 72 | @ CREATE TEMP TABLE IF NOT EXISTS json_timeline( |
| 73 | @ sortId INTEGER PRIMARY KEY, |
| 74 | @ rid INTEGER, |
| 75 | @ uuid TEXT, |
| 76 | @ mtime INTEGER, |
| @@ -109,11 +109,11 @@ | |
| 109 | @ (SELECT group_concat(substr(tagname,5), ',') FROM tag, tagxref |
| 110 | @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid |
| 111 | @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0) as tags, |
| 112 | @ tagid as tagId, |
| 113 | @ brief as brief |
| 114 | @ FROM event JOIN blob |
| 115 | @ WHERE blob.rid=event.objid |
| 116 | ; |
| 117 | return zBaseSql; |
| 118 | } |
| 119 | |
| @@ -316,11 +316,11 @@ | |
| 316 | */ |
| 317 | cson_value * json_get_changed_files(int rid, int flags){ |
| 318 | cson_value * rowsV = NULL; |
| 319 | cson_array * rows = NULL; |
| 320 | Stmt q = empty_Stmt; |
| 321 | db_prepare(&q, |
| 322 | "SELECT (pid==0) AS isnew," |
| 323 | " (fid==0) AS isdel," |
| 324 | " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name," |
| 325 | " blob.uuid as uuid," |
| 326 | " (SELECT uuid FROM blob WHERE rid=pid) as parent," |
| 327 |
| --- src/json_timeline.c | |
| +++ src/json_timeline.c | |
| @@ -66,11 +66,11 @@ | |
| 66 | /* |
| 67 | ** Create a temporary table suitable for storing timeline data. |
| 68 | */ |
| 69 | static void json_timeline_temp_table(void){ |
| 70 | /* Field order MUST match that from json_timeline_query()!!! */ |
| 71 | static const char zSql[] = |
| 72 | @ CREATE TEMP TABLE IF NOT EXISTS json_timeline( |
| 73 | @ sortId INTEGER PRIMARY KEY, |
| 74 | @ rid INTEGER, |
| 75 | @ uuid TEXT, |
| 76 | @ mtime INTEGER, |
| @@ -109,11 +109,11 @@ | |
| 109 | @ (SELECT group_concat(substr(tagname,5), ',') FROM tag, tagxref |
| 110 | @ WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid |
| 111 | @ AND tagxref.rid=blob.rid AND tagxref.tagtype>0) as tags, |
| 112 | @ tagid as tagId, |
| 113 | @ brief as brief |
| 114 | @ FROM event JOIN blob |
| 115 | @ WHERE blob.rid=event.objid |
| 116 | ; |
| 117 | return zBaseSql; |
| 118 | } |
| 119 | |
| @@ -316,11 +316,11 @@ | |
| 316 | */ |
| 317 | cson_value * json_get_changed_files(int rid, int flags){ |
| 318 | cson_value * rowsV = NULL; |
| 319 | cson_array * rows = NULL; |
| 320 | Stmt q = empty_Stmt; |
| 321 | db_prepare(&q, |
| 322 | "SELECT (pid==0) AS isnew," |
| 323 | " (fid==0) AS isdel," |
| 324 | " (SELECT name FROM filename WHERE fnid=mlink.fnid) AS name," |
| 325 | " blob.uuid as uuid," |
| 326 | " (SELECT uuid FROM blob WHERE rid=pid) as parent," |
| 327 |
+1
-1
| --- src/json_wiki.c | ||
| +++ src/json_wiki.c | ||
| @@ -542,11 +542,11 @@ | ||
| 542 | 542 | |
| 543 | 543 | blob_init(&w1, pW1->zWiki, -1); |
| 544 | 544 | blob_zero(&w2); |
| 545 | 545 | blob_init(&w2, pW2->zWiki, -1); |
| 546 | 546 | blob_zero(&d); |
| 547 | - diffFlags = DIFF_IGNORE_EOLWS | DIFF_INLINE; | |
| 547 | + diffFlags = DIFF_IGNORE_EOLWS | DIFF_STRIP_EOLCR; | |
| 548 | 548 | text_diff(&w2, &w1, &d, 0, diffFlags); |
| 549 | 549 | blob_reset(&w1); |
| 550 | 550 | blob_reset(&w2); |
| 551 | 551 | |
| 552 | 552 | pay = cson_new_object(); |
| 553 | 553 | |
| 554 | 554 | ADDED src/loadctrl.c |
| --- src/json_wiki.c | |
| +++ src/json_wiki.c | |
| @@ -542,11 +542,11 @@ | |
| 542 | |
| 543 | blob_init(&w1, pW1->zWiki, -1); |
| 544 | blob_zero(&w2); |
| 545 | blob_init(&w2, pW2->zWiki, -1); |
| 546 | blob_zero(&d); |
| 547 | diffFlags = DIFF_IGNORE_EOLWS | DIFF_INLINE; |
| 548 | text_diff(&w2, &w1, &d, 0, diffFlags); |
| 549 | blob_reset(&w1); |
| 550 | blob_reset(&w2); |
| 551 | |
| 552 | pay = cson_new_object(); |
| 553 | |
| 554 | DDED src/loadctrl.c |
| --- src/json_wiki.c | |
| +++ src/json_wiki.c | |
| @@ -542,11 +542,11 @@ | |
| 542 | |
| 543 | blob_init(&w1, pW1->zWiki, -1); |
| 544 | blob_zero(&w2); |
| 545 | blob_init(&w2, pW2->zWiki, -1); |
| 546 | blob_zero(&d); |
| 547 | diffFlags = DIFF_IGNORE_EOLWS | DIFF_STRIP_EOLCR; |
| 548 | text_diff(&w2, &w1, &d, 0, diffFlags); |
| 549 | blob_reset(&w1); |
| 550 | blob_reset(&w2); |
| 551 | |
| 552 | pay = cson_new_object(); |
| 553 | |
| 554 | DDED src/loadctrl.c |
+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
-9
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -121,11 +121,11 @@ | ||
| 121 | 121 | |
| 122 | 122 | struct Global { |
| 123 | 123 | int argc; char **argv; /* Command-line arguments to the program */ |
| 124 | 124 | char *nameOfExe; /* Full path of executable. */ |
| 125 | 125 | const char *zErrlog; /* Log errors to this file, if not NULL */ |
| 126 | - int isConst; /* True if the output is unchanging */ | |
| 126 | + int isConst; /* True if the output is unchanging & cacheable */ | |
| 127 | 127 | const char *zVfsName; /* The VFS to use for database connections */ |
| 128 | 128 | sqlite3 *db; /* The connection to the databases */ |
| 129 | 129 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 130 | 130 | int useAttach; /* True if global_config is attached to repository */ |
| 131 | 131 | const char *zConfigDbName;/* Path of the config database. NULL if not open */ |
| @@ -140,10 +140,11 @@ | ||
| 140 | 140 | int fSqlTrace; /* True if --sqltrace flag is present */ |
| 141 | 141 | int fSqlStats; /* True if --sqltrace or --sqlstats are present */ |
| 142 | 142 | int fSqlPrint; /* True if -sqlprint flag is present */ |
| 143 | 143 | int fQuiet; /* True if -quiet flag is present */ |
| 144 | 144 | int fHttpTrace; /* Trace outbound HTTP requests */ |
| 145 | + char *zHttpAuth; /* HTTP Authorization user:pass information */ | |
| 145 | 146 | int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */ |
| 146 | 147 | int fSshTrace; /* Trace the SSH setup traffic */ |
| 147 | 148 | int fSshClient; /* HTTP client flags for SSH client */ |
| 148 | 149 | char *zSshCmd; /* SSH command string */ |
| 149 | 150 | int fNoSync; /* Do not do an autosync ever. --nosync */ |
| @@ -193,11 +194,11 @@ | ||
| 193 | 194 | char *urlFossil; /* The fossil query parameter on ssh: */ |
| 194 | 195 | unsigned urlFlags; /* Boolean flags controlling URL processing */ |
| 195 | 196 | int useProxy; /* Used to remember that a proxy is in use */ |
| 196 | 197 | char *proxyUrlPath; |
| 197 | 198 | int proxyOrigPort; /* Tunneled port number for https through proxy */ |
| 198 | - const char *zLogin; /* Login name. "" if not logged in. */ | |
| 199 | + const char *zLogin; /* Login name. NULL or "" if not logged in. */ | |
| 199 | 200 | const char *zSSLIdentity; /* Value of --ssl-identity option, filename of |
| 200 | 201 | ** SSL client identity */ |
| 201 | 202 | int useLocalauth; /* No login required if from 127.0.0.1 */ |
| 202 | 203 | int noPswd; /* Logged in without password (on 127.0.0.1) */ |
| 203 | 204 | int userUid; /* Integer user id */ |
| @@ -603,15 +604,10 @@ | ||
| 603 | 604 | #endif |
| 604 | 605 | g.mainTimerId = fossil_timer_start(); |
| 605 | 606 | g.zVfsName = find_option("vfs",0,1); |
| 606 | 607 | if( g.zVfsName==0 ){ |
| 607 | 608 | g.zVfsName = fossil_getenv("FOSSIL_VFS"); |
| 608 | -#if defined(__CYGWIN__) | |
| 609 | - if( g.zVfsName==0 ){ | |
| 610 | - g.zVfsName = "win32-longpath"; | |
| 611 | - } | |
| 612 | -#endif | |
| 613 | 609 | } |
| 614 | 610 | if( g.zVfsName ){ |
| 615 | 611 | sqlite3_vfs *pVfs = sqlite3_vfs_find(g.zVfsName); |
| 616 | 612 | if( pVfs ){ |
| 617 | 613 | sqlite3_vfs_register(pVfs, 1); |
| @@ -651,10 +647,11 @@ | ||
| 651 | 647 | g.fSshClient = 0; |
| 652 | 648 | g.zSshCmd = 0; |
| 653 | 649 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| 654 | 650 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 655 | 651 | g.fHttpTrace = find_option("httptrace", 0, 0)!=0; |
| 652 | + g.zHttpAuth = 0; | |
| 656 | 653 | g.zLogin = find_option("user", "U", 1); |
| 657 | 654 | g.zSSLIdentity = find_option("ssl-identity", 0, 1); |
| 658 | 655 | g.zErrlog = find_option("errorlog", 0, 1); |
| 659 | 656 | if( find_option("utc",0,0) ) g.fTimeFormat = 1; |
| 660 | 657 | if( find_option("localtime",0,0) ) g.fTimeFormat = 2; |
| @@ -1068,11 +1065,11 @@ | ||
| 1068 | 1065 | if( j>0 ){ |
| 1069 | 1066 | @ </ul></td> |
| 1070 | 1067 | } |
| 1071 | 1068 | @ </tr></table> |
| 1072 | 1069 | |
| 1073 | - @ <h1>Available pages:</h1> | |
| 1070 | + @ <h1>Available web UI pages:</h1> | |
| 1074 | 1071 | @ (Only pages with help text are linked.) |
| 1075 | 1072 | @ <table border="0"><tr> |
| 1076 | 1073 | for(i=j=0; i<count(aCommand); i++){ |
| 1077 | 1074 | const char *z = aCommand[i].zName; |
| 1078 | 1075 | if( '/'!=*z ) continue; |
| @@ -1457,11 +1454,11 @@ | ||
| 1457 | 1454 | zAltRepo[jj] = 0; |
| 1458 | 1455 | zAltRepo += jj+1; |
| 1459 | 1456 | }else{ |
| 1460 | 1457 | zUser = "nobody"; |
| 1461 | 1458 | } |
| 1462 | - if( g.zLogin==0 ) zUser = "nobody"; | |
| 1459 | + if( g.zLogin==0 || g.zLogin[0]==0 ) zUser = "nobody"; | |
| 1463 | 1460 | if( zAltRepo[0]!='/' ){ |
| 1464 | 1461 | zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo); |
| 1465 | 1462 | file_simplify_name(zAltRepo, -1, 0); |
| 1466 | 1463 | } |
| 1467 | 1464 | db_close(1); |
| 1468 | 1465 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -121,11 +121,11 @@ | |
| 121 | |
| 122 | struct Global { |
| 123 | int argc; char **argv; /* Command-line arguments to the program */ |
| 124 | char *nameOfExe; /* Full path of executable. */ |
| 125 | const char *zErrlog; /* Log errors to this file, if not NULL */ |
| 126 | int isConst; /* True if the output is unchanging */ |
| 127 | const char *zVfsName; /* The VFS to use for database connections */ |
| 128 | sqlite3 *db; /* The connection to the databases */ |
| 129 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 130 | int useAttach; /* True if global_config is attached to repository */ |
| 131 | const char *zConfigDbName;/* Path of the config database. NULL if not open */ |
| @@ -140,10 +140,11 @@ | |
| 140 | int fSqlTrace; /* True if --sqltrace flag is present */ |
| 141 | int fSqlStats; /* True if --sqltrace or --sqlstats are present */ |
| 142 | int fSqlPrint; /* True if -sqlprint flag is present */ |
| 143 | int fQuiet; /* True if -quiet flag is present */ |
| 144 | int fHttpTrace; /* Trace outbound HTTP requests */ |
| 145 | int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */ |
| 146 | int fSshTrace; /* Trace the SSH setup traffic */ |
| 147 | int fSshClient; /* HTTP client flags for SSH client */ |
| 148 | char *zSshCmd; /* SSH command string */ |
| 149 | int fNoSync; /* Do not do an autosync ever. --nosync */ |
| @@ -193,11 +194,11 @@ | |
| 193 | char *urlFossil; /* The fossil query parameter on ssh: */ |
| 194 | unsigned urlFlags; /* Boolean flags controlling URL processing */ |
| 195 | int useProxy; /* Used to remember that a proxy is in use */ |
| 196 | char *proxyUrlPath; |
| 197 | int proxyOrigPort; /* Tunneled port number for https through proxy */ |
| 198 | const char *zLogin; /* Login name. "" if not logged in. */ |
| 199 | const char *zSSLIdentity; /* Value of --ssl-identity option, filename of |
| 200 | ** SSL client identity */ |
| 201 | int useLocalauth; /* No login required if from 127.0.0.1 */ |
| 202 | int noPswd; /* Logged in without password (on 127.0.0.1) */ |
| 203 | int userUid; /* Integer user id */ |
| @@ -603,15 +604,10 @@ | |
| 603 | #endif |
| 604 | g.mainTimerId = fossil_timer_start(); |
| 605 | g.zVfsName = find_option("vfs",0,1); |
| 606 | if( g.zVfsName==0 ){ |
| 607 | g.zVfsName = fossil_getenv("FOSSIL_VFS"); |
| 608 | #if defined(__CYGWIN__) |
| 609 | if( g.zVfsName==0 ){ |
| 610 | g.zVfsName = "win32-longpath"; |
| 611 | } |
| 612 | #endif |
| 613 | } |
| 614 | if( g.zVfsName ){ |
| 615 | sqlite3_vfs *pVfs = sqlite3_vfs_find(g.zVfsName); |
| 616 | if( pVfs ){ |
| 617 | sqlite3_vfs_register(pVfs, 1); |
| @@ -651,10 +647,11 @@ | |
| 651 | g.fSshClient = 0; |
| 652 | g.zSshCmd = 0; |
| 653 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| 654 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 655 | g.fHttpTrace = find_option("httptrace", 0, 0)!=0; |
| 656 | g.zLogin = find_option("user", "U", 1); |
| 657 | g.zSSLIdentity = find_option("ssl-identity", 0, 1); |
| 658 | g.zErrlog = find_option("errorlog", 0, 1); |
| 659 | if( find_option("utc",0,0) ) g.fTimeFormat = 1; |
| 660 | if( find_option("localtime",0,0) ) g.fTimeFormat = 2; |
| @@ -1068,11 +1065,11 @@ | |
| 1068 | if( j>0 ){ |
| 1069 | @ </ul></td> |
| 1070 | } |
| 1071 | @ </tr></table> |
| 1072 | |
| 1073 | @ <h1>Available pages:</h1> |
| 1074 | @ (Only pages with help text are linked.) |
| 1075 | @ <table border="0"><tr> |
| 1076 | for(i=j=0; i<count(aCommand); i++){ |
| 1077 | const char *z = aCommand[i].zName; |
| 1078 | if( '/'!=*z ) continue; |
| @@ -1457,11 +1454,11 @@ | |
| 1457 | zAltRepo[jj] = 0; |
| 1458 | zAltRepo += jj+1; |
| 1459 | }else{ |
| 1460 | zUser = "nobody"; |
| 1461 | } |
| 1462 | if( g.zLogin==0 ) zUser = "nobody"; |
| 1463 | if( zAltRepo[0]!='/' ){ |
| 1464 | zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo); |
| 1465 | file_simplify_name(zAltRepo, -1, 0); |
| 1466 | } |
| 1467 | db_close(1); |
| 1468 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -121,11 +121,11 @@ | |
| 121 | |
| 122 | struct Global { |
| 123 | int argc; char **argv; /* Command-line arguments to the program */ |
| 124 | char *nameOfExe; /* Full path of executable. */ |
| 125 | const char *zErrlog; /* Log errors to this file, if not NULL */ |
| 126 | int isConst; /* True if the output is unchanging & cacheable */ |
| 127 | const char *zVfsName; /* The VFS to use for database connections */ |
| 128 | sqlite3 *db; /* The connection to the databases */ |
| 129 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 130 | int useAttach; /* True if global_config is attached to repository */ |
| 131 | const char *zConfigDbName;/* Path of the config database. NULL if not open */ |
| @@ -140,10 +140,11 @@ | |
| 140 | int fSqlTrace; /* True if --sqltrace flag is present */ |
| 141 | int fSqlStats; /* True if --sqltrace or --sqlstats are present */ |
| 142 | int fSqlPrint; /* True if -sqlprint flag is present */ |
| 143 | int fQuiet; /* True if -quiet flag is present */ |
| 144 | int fHttpTrace; /* Trace outbound HTTP requests */ |
| 145 | char *zHttpAuth; /* HTTP Authorization user:pass information */ |
| 146 | int fSystemTrace; /* Trace calls to fossil_system(), --systemtrace */ |
| 147 | int fSshTrace; /* Trace the SSH setup traffic */ |
| 148 | int fSshClient; /* HTTP client flags for SSH client */ |
| 149 | char *zSshCmd; /* SSH command string */ |
| 150 | int fNoSync; /* Do not do an autosync ever. --nosync */ |
| @@ -193,11 +194,11 @@ | |
| 194 | char *urlFossil; /* The fossil query parameter on ssh: */ |
| 195 | unsigned urlFlags; /* Boolean flags controlling URL processing */ |
| 196 | int useProxy; /* Used to remember that a proxy is in use */ |
| 197 | char *proxyUrlPath; |
| 198 | int proxyOrigPort; /* Tunneled port number for https through proxy */ |
| 199 | const char *zLogin; /* Login name. NULL or "" if not logged in. */ |
| 200 | const char *zSSLIdentity; /* Value of --ssl-identity option, filename of |
| 201 | ** SSL client identity */ |
| 202 | int useLocalauth; /* No login required if from 127.0.0.1 */ |
| 203 | int noPswd; /* Logged in without password (on 127.0.0.1) */ |
| 204 | int userUid; /* Integer user id */ |
| @@ -603,15 +604,10 @@ | |
| 604 | #endif |
| 605 | g.mainTimerId = fossil_timer_start(); |
| 606 | g.zVfsName = find_option("vfs",0,1); |
| 607 | if( g.zVfsName==0 ){ |
| 608 | g.zVfsName = fossil_getenv("FOSSIL_VFS"); |
| 609 | } |
| 610 | if( g.zVfsName ){ |
| 611 | sqlite3_vfs *pVfs = sqlite3_vfs_find(g.zVfsName); |
| 612 | if( pVfs ){ |
| 613 | sqlite3_vfs_register(pVfs, 1); |
| @@ -651,10 +647,11 @@ | |
| 647 | g.fSshClient = 0; |
| 648 | g.zSshCmd = 0; |
| 649 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| 650 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 651 | g.fHttpTrace = find_option("httptrace", 0, 0)!=0; |
| 652 | g.zHttpAuth = 0; |
| 653 | g.zLogin = find_option("user", "U", 1); |
| 654 | g.zSSLIdentity = find_option("ssl-identity", 0, 1); |
| 655 | g.zErrlog = find_option("errorlog", 0, 1); |
| 656 | if( find_option("utc",0,0) ) g.fTimeFormat = 1; |
| 657 | if( find_option("localtime",0,0) ) g.fTimeFormat = 2; |
| @@ -1068,11 +1065,11 @@ | |
| 1065 | if( j>0 ){ |
| 1066 | @ </ul></td> |
| 1067 | } |
| 1068 | @ </tr></table> |
| 1069 | |
| 1070 | @ <h1>Available web UI pages:</h1> |
| 1071 | @ (Only pages with help text are linked.) |
| 1072 | @ <table border="0"><tr> |
| 1073 | for(i=j=0; i<count(aCommand); i++){ |
| 1074 | const char *z = aCommand[i].zName; |
| 1075 | if( '/'!=*z ) continue; |
| @@ -1457,11 +1454,11 @@ | |
| 1454 | zAltRepo[jj] = 0; |
| 1455 | zAltRepo += jj+1; |
| 1456 | }else{ |
| 1457 | zUser = "nobody"; |
| 1458 | } |
| 1459 | if( g.zLogin==0 || g.zLogin[0]==0 ) zUser = "nobody"; |
| 1460 | if( zAltRepo[0]!='/' ){ |
| 1461 | zAltRepo = mprintf("%s/../%s", g.zRepositoryName, zAltRepo); |
| 1462 | file_simplify_name(zAltRepo, -1, 0); |
| 1463 | } |
| 1464 | db_close(1); |
| 1465 |
+14
-2
| --- src/main.mk | ||
| +++ src/main.mk | ||
| @@ -66,10 +66,11 @@ | ||
| 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 |
+5
-1
| --- 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" |
| 806 | 810 |
| --- src/makemake.tcl | |
| +++ src/makemake.tcl | |
| @@ -69,10 +69,11 @@ | |
| 69 | json_tag |
| 70 | json_timeline |
| 71 | json_user |
| 72 | json_wiki |
| 73 | leaf |
| 74 | login |
| 75 | lookslike |
| 76 | main |
| 77 | manifest |
| 78 | markdown |
| @@ -146,15 +147,18 @@ | |
| 146 | # Options used to compile the included SQLite shell. |
| 147 | # |
| 148 | set SHELL_OPTIONS { |
| 149 | -Dmain=sqlite3_shell |
| 150 | -DSQLITE_OMIT_LOAD_EXTENSION=1 |
| 151 | } |
| 152 | |
| 153 | # Options used to compile the included SQLite shell on Windows. |
| 154 | # |
| 155 | set SHELL_WIN32_OPTIONS $SHELL_OPTIONS |
| 156 | lappend SHELL_WIN32_OPTIONS -Dgetenv=fossil_getenv |
| 157 | lappend SHELL_WIN32_OPTIONS -Dfopen=fossil_fopen |
| 158 | |
| 159 | # Name of the final application |
| 160 | # |
| @@ -795,11 +799,11 @@ | |
| 795 | writeln "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c \$(OBJDIR)/${s}_.c\n" |
| 796 | writeln "\$(OBJDIR)/${s}.h:\t\$(OBJDIR)/headers\n" |
| 797 | } |
| 798 | |
| 799 | set MINGW_SQLITE_OPTIONS $SQLITE_OPTIONS |
| 800 | lappend MINGW_SQLITE_OPTIONS -D_HAVE_SQLITE_CONFIG_H |
| 801 | lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MALLOC_H |
| 802 | lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MSIZE |
| 803 | |
| 804 | set j " \\\n " |
| 805 | writeln "SQLITE_OPTIONS = [join $MINGW_SQLITE_OPTIONS $j]\n" |
| 806 |
| --- src/makemake.tcl | |
| +++ src/makemake.tcl | |
| @@ -69,10 +69,11 @@ | |
| 69 | json_tag |
| 70 | json_timeline |
| 71 | json_user |
| 72 | json_wiki |
| 73 | leaf |
| 74 | loadctrl |
| 75 | login |
| 76 | lookslike |
| 77 | main |
| 78 | manifest |
| 79 | markdown |
| @@ -146,15 +147,18 @@ | |
| 147 | # Options used to compile the included SQLite shell. |
| 148 | # |
| 149 | set SHELL_OPTIONS { |
| 150 | -Dmain=sqlite3_shell |
| 151 | -DSQLITE_OMIT_LOAD_EXTENSION=1 |
| 152 | -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) |
| 153 | -DSQLITE_SHELL_DBNAME_PROC=fossil_open |
| 154 | } |
| 155 | |
| 156 | # Options used to compile the included SQLite shell on Windows. |
| 157 | # |
| 158 | set SHELL_WIN32_OPTIONS $SHELL_OPTIONS |
| 159 | lappend SHELL_WIN32_OPTIONS -Daccess=win32_access |
| 160 | lappend SHELL_WIN32_OPTIONS -Dgetenv=fossil_getenv |
| 161 | lappend SHELL_WIN32_OPTIONS -Dfopen=fossil_fopen |
| 162 | |
| 163 | # Name of the final application |
| 164 | # |
| @@ -795,11 +799,11 @@ | |
| 799 | writeln "\t\$(XTCC) -o \$(OBJDIR)/$s.o -c \$(OBJDIR)/${s}_.c\n" |
| 800 | writeln "\$(OBJDIR)/${s}.h:\t\$(OBJDIR)/headers\n" |
| 801 | } |
| 802 | |
| 803 | set MINGW_SQLITE_OPTIONS $SQLITE_OPTIONS |
| 804 | lappend MINGW_SQLITE_OPTIONS -D_HAVE__MINGW_H |
| 805 | lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MALLOC_H |
| 806 | lappend MINGW_SQLITE_OPTIONS -DSQLITE_USE_MSIZE |
| 807 | |
| 808 | set j " \\\n " |
| 809 | writeln "SQLITE_OPTIONS = [join $MINGW_SQLITE_OPTIONS $j]\n" |
| 810 |
+173
-68
| --- src/name.c | ||
| +++ src/name.c | ||
| @@ -433,10 +433,152 @@ | ||
| 433 | 433 | cgi_redirectf("%s/ambiguous/%T?src=%t", g.zTop, zName, g.zPath); |
| 434 | 434 | rid = 0; |
| 435 | 435 | } |
| 436 | 436 | return rid; |
| 437 | 437 | } |
| 438 | + | |
| 439 | +/* | |
| 440 | +** Generate a description of artifact "rid" | |
| 441 | +*/ | |
| 442 | +static void whatis_rid(int rid, int verboseFlag){ | |
| 443 | + Stmt q; | |
| 444 | + int cnt; | |
| 445 | + | |
| 446 | + /* Basic information about the object. */ | |
| 447 | + db_prepare(&q, | |
| 448 | + "SELECT uuid, size, datetime(mtime%s), ipaddr" | |
| 449 | + " FROM blob, rcvfrom" | |
| 450 | + " WHERE rid=%d" | |
| 451 | + " AND rcvfrom.rcvid=blob.rcvid", | |
| 452 | + timeline_utc(), rid); | |
| 453 | + if( db_step(&q)==SQLITE_ROW ){ | |
| 454 | + if( verboseFlag ){ | |
| 455 | + fossil_print("artifact: %s (%d)\n", db_column_text(&q,0), rid); | |
| 456 | + fossil_print("size: %d bytes\n", db_column_int(&q,1)); | |
| 457 | + fossil_print("received: %s from %s\n", | |
| 458 | + db_column_text(&q, 2), | |
| 459 | + db_column_text(&q, 3)); | |
| 460 | + }else{ | |
| 461 | + fossil_print("artifact: %s\n", db_column_text(&q,0)); | |
| 462 | + fossil_print("size: %d bytes\n", db_column_int(&q,1)); | |
| 463 | + } | |
| 464 | + } | |
| 465 | + db_finalize(&q); | |
| 466 | + | |
| 467 | + /* Report any symbolic tags on this artifact */ | |
| 468 | + db_prepare(&q, | |
| 469 | + "SELECT substr(tagname,5)" | |
| 470 | + " FROM tag JOIN tagxref ON tag.tagid=tagxref.tagid" | |
| 471 | + " WHERE tagxref.rid=%d" | |
| 472 | + " AND tagname GLOB 'sym-*'" | |
| 473 | + " ORDER BY 1", | |
| 474 | + rid | |
| 475 | + ); | |
| 476 | + cnt = 0; | |
| 477 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 478 | + const char *zPrefix = cnt++ ? ", " : "tags: "; | |
| 479 | + fossil_print("%s%s", zPrefix, db_column_text(&q,0)); | |
| 480 | + } | |
| 481 | + if( cnt ) fossil_print("\n"); | |
| 482 | + db_finalize(&q); | |
| 483 | + | |
| 484 | + /* Report any HIDDEN, PRIVATE, CLUSTER, or CLOSED tags on this artifact */ | |
| 485 | + db_prepare(&q, | |
| 486 | + "SELECT tagname" | |
| 487 | + " FROM tag JOIN tagxref ON tag.tagid=tagxref.tagid" | |
| 488 | + " WHERE tagxref.rid=%d" | |
| 489 | + " AND tag.tagid IN (5,6,7,9)" | |
| 490 | + " ORDER BY 1", | |
| 491 | + rid, rid | |
| 492 | + ); | |
| 493 | + cnt = 0; | |
| 494 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 495 | + const char *zPrefix = cnt++ ? ", " : "raw-tags: "; | |
| 496 | + fossil_print("%s%s", zPrefix, db_column_text(&q,0)); | |
| 497 | + } | |
| 498 | + if( cnt ) fossil_print("\n"); | |
| 499 | + db_finalize(&q); | |
| 500 | + | |
| 501 | + /* Check for entries on the timeline that reference this object */ | |
| 502 | + db_prepare(&q, | |
| 503 | + "SELECT type, datetime(mtime%s)," | |
| 504 | + " coalesce(euser,user), coalesce(ecomment,comment)" | |
| 505 | + " FROM event WHERE objid=%d", timeline_utc(), rid); | |
| 506 | + if( db_step(&q)==SQLITE_ROW ){ | |
| 507 | + const char *zType; | |
| 508 | + switch( db_column_text(&q,0)[0] ){ | |
| 509 | + case 'c': zType = "Check-in"; break; | |
| 510 | + case 'w': zType = "Wiki-edit"; break; | |
| 511 | + case 'e': zType = "Event"; break; | |
| 512 | + case 't': zType = "Ticket-change"; break; | |
| 513 | + case 'g': zType = "Tag-change"; break; | |
| 514 | + default: zType = "Unknown"; break; | |
| 515 | + } | |
| 516 | + fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2), | |
| 517 | + db_column_text(&q, 1)); | |
| 518 | + fossil_print("comment: "); | |
| 519 | + comment_print(db_column_text(&q,3), 12, 78); | |
| 520 | + } | |
| 521 | + db_finalize(&q); | |
| 522 | + | |
| 523 | + /* Check to see if this object is used as a file in a check-in */ | |
| 524 | + db_prepare(&q, | |
| 525 | + "SELECT filename.name, blob.uuid, datetime(event.mtime%s)," | |
| 526 | + " coalesce(euser,user), coalesce(ecomment,comment)" | |
| 527 | + " FROM mlink, filename, blob, event" | |
| 528 | + " WHERE mlink.fid=%d" | |
| 529 | + " AND filename.fnid=mlink.fnid" | |
| 530 | + " AND event.objid=mlink.mid" | |
| 531 | + " AND blob.rid=mlink.mid" | |
| 532 | + " ORDER BY event.mtime DESC /*sort*/", | |
| 533 | + timeline_utc(), rid); | |
| 534 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 535 | + fossil_print("file: %s\n", db_column_text(&q,0)); | |
| 536 | + fossil_print(" part of [%.10s] by %s on %s\n", | |
| 537 | + db_column_text(&q, 1), | |
| 538 | + db_column_text(&q, 3), | |
| 539 | + db_column_text(&q, 2)); | |
| 540 | + fossil_print(" "); | |
| 541 | + comment_print(db_column_text(&q,4), 12, 78); | |
| 542 | + } | |
| 543 | + db_finalize(&q); | |
| 544 | + | |
| 545 | + /* Check to see if this object is used as an attachment */ | |
| 546 | + db_prepare(&q, | |
| 547 | + "SELECT attachment.filename," | |
| 548 | + " attachment.comment," | |
| 549 | + " attachment.user," | |
| 550 | + " datetime(attachment.mtime%s)," | |
| 551 | + " attachment.target," | |
| 552 | + " CASE WHEN EXISTS(SELECT 1 FROM tag WHERE tagname=('tkt-'||target))" | |
| 553 | + " THEN 'ticket'" | |
| 554 | + " WHEN EXISTS(SELECT 1 FROM tag WHERE tagname=('wiki-'||target))" | |
| 555 | + " THEN 'wiki' END," | |
| 556 | + " attachment.attachid," | |
| 557 | + " (SELECT uuid FROM blob WHERE rid=attachid)" | |
| 558 | + " FROM attachment JOIN blob ON attachment.src=blob.uuid" | |
| 559 | + " WHERE blob.rid=%d", | |
| 560 | + timeline_utc(), rid | |
| 561 | + ); | |
| 562 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 563 | + fossil_print("attachment: %s\n", db_column_text(&q,0)); | |
| 564 | + fossil_print(" attached to %s %s\n", | |
| 565 | + db_column_text(&q,5), db_column_text(&q,4)); | |
| 566 | + if( verboseFlag ){ | |
| 567 | + fossil_print(" via %s (%d)\n", | |
| 568 | + db_column_text(&q,7), db_column_int(&q,6)); | |
| 569 | + }else{ | |
| 570 | + fossil_print(" via %s\n", | |
| 571 | + db_column_text(&q,7)); | |
| 572 | + } | |
| 573 | + fossil_print(" by user %s on %s\n", | |
| 574 | + db_column_text(&q,2), db_column_text(&q,3)); | |
| 575 | + fossil_print(" "); | |
| 576 | + comment_print(db_column_text(&q,1), 12, 78); | |
| 577 | + } | |
| 578 | + db_finalize(&q); | |
| 579 | +} | |
| 438 | 580 | |
| 439 | 581 | /* |
| 440 | 582 | ** COMMAND: whatis* |
| 441 | 583 | ** Usage: %fossil whatis NAME |
| 442 | 584 | ** |
| @@ -452,78 +594,41 @@ | ||
| 452 | 594 | verboseFlag = find_option("verbose","v",0)!=0; |
| 453 | 595 | if( g.argc!=3 ) usage("whatis NAME"); |
| 454 | 596 | zName = g.argv[2]; |
| 455 | 597 | rid = symbolic_name_to_rid(zName, 0); |
| 456 | 598 | if( rid<0 ){ |
| 599 | + Stmt q; | |
| 600 | + int cnt = 0; | |
| 457 | 601 | fossil_print("Ambiguous artifact name prefix: %s\n", zName); |
| 602 | + db_prepare(&q, | |
| 603 | + "SELECT rid FROM blob WHERE uuid>=lower(%Q) AND uuid<(lower(%Q)||'z')", | |
| 604 | + zName, zName | |
| 605 | + ); | |
| 606 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 607 | + if( cnt++ ) fossil_print("%.79c\n", '-'); | |
| 608 | + whatis_rid(db_column_int(&q, 0), verboseFlag); | |
| 609 | + } | |
| 610 | + db_finalize(&q); | |
| 458 | 611 | }else if( rid==0 ){ |
| 459 | 612 | fossil_print("Unknown artifact: %s\n", zName); |
| 460 | 613 | }else{ |
| 461 | - Stmt q; | |
| 462 | - db_prepare(&q, | |
| 463 | - "SELECT uuid, size, datetime(mtime%s), ipaddr," | |
| 464 | - " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref" | |
| 465 | - " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid" | |
| 466 | - " AND tagxref.rid=blob.rid AND tagxref.tagtype>0)" | |
| 467 | - " FROM blob, rcvfrom" | |
| 468 | - " WHERE rid=%d" | |
| 469 | - " AND rcvfrom.rcvid=blob.rcvid", | |
| 470 | - timeline_utc(), rid); | |
| 471 | - if( db_step(&q)==SQLITE_ROW ){ | |
| 472 | - const char *zTagList = db_column_text(&q, 4); | |
| 473 | - if( verboseFlag ){ | |
| 474 | - fossil_print("artifact: %s (%d)\n", db_column_text(&q,0), rid); | |
| 475 | - fossil_print("size: %d bytes\n", db_column_int(&q,1)); | |
| 476 | - fossil_print("received: %s from %s\n", | |
| 477 | - db_column_text(&q, 2), | |
| 478 | - db_column_text(&q, 3)); | |
| 479 | - }else{ | |
| 480 | - fossil_print("artifact: %s\n", db_column_text(&q,0)); | |
| 481 | - fossil_print("size: %d bytes\n", db_column_int(&q,1)); | |
| 482 | - } | |
| 483 | - if( zTagList && zTagList[0] ){ | |
| 484 | - fossil_print("tags: %s\n", zTagList); | |
| 485 | - } | |
| 486 | - } | |
| 487 | - db_finalize(&q); | |
| 488 | - db_prepare(&q, | |
| 489 | - "SELECT type, datetime(mtime%s)," | |
| 490 | - " coalesce(euser,user), coalesce(ecomment,comment)" | |
| 491 | - " FROM event WHERE objid=%d", timeline_utc(), rid); | |
| 492 | - if( db_step(&q)==SQLITE_ROW ){ | |
| 493 | - const char *zType; | |
| 494 | - switch( db_column_text(&q,0)[0] ){ | |
| 495 | - case 'c': zType = "Check-in"; break; | |
| 496 | - case 'w': zType = "Wiki-edit"; break; | |
| 497 | - case 'e': zType = "Event"; break; | |
| 498 | - case 't': zType = "Ticket-change"; break; | |
| 499 | - case 'g': zType = "Tag-change"; break; | |
| 500 | - default: zType = "Unknown"; break; | |
| 501 | - } | |
| 502 | - fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2), | |
| 503 | - db_column_text(&q, 1)); | |
| 504 | - fossil_print("comment: "); | |
| 505 | - comment_print(db_column_text(&q,3), 10, 78); | |
| 506 | - } | |
| 507 | - db_finalize(&q); | |
| 508 | - db_prepare(&q, | |
| 509 | - "SELECT filename.name, blob.uuid, datetime(event.mtime%s)," | |
| 510 | - " coalesce(euser,user), coalesce(ecomment,comment)" | |
| 511 | - " FROM mlink, filename, blob, event" | |
| 512 | - " WHERE mlink.fid=%d" | |
| 513 | - " AND filename.fnid=mlink.fnid" | |
| 514 | - " AND event.objid=mlink.mid" | |
| 515 | - " AND blob.rid=mlink.mid" | |
| 516 | - " ORDER BY event.mtime DESC /*sort*/", | |
| 517 | - timeline_utc(), rid); | |
| 518 | - while( db_step(&q)==SQLITE_ROW ){ | |
| 519 | - fossil_print("file: %s\n", db_column_text(&q,0)); | |
| 520 | - fossil_print(" part of [%.10s] by %s on %s\n", | |
| 521 | - db_column_text(&q, 1), | |
| 522 | - db_column_text(&q, 3), | |
| 523 | - db_column_text(&q, 2)); | |
| 524 | - fossil_print(" "); | |
| 525 | - comment_print(db_column_text(&q,4), 10, 78); | |
| 526 | - } | |
| 527 | - db_finalize(&q); | |
| 528 | - } | |
| 614 | + whatis_rid(rid, verboseFlag); | |
| 615 | + } | |
| 616 | +} | |
| 617 | + | |
| 618 | +/* | |
| 619 | +** COMMAND: test-whatis-all | |
| 620 | +** Usage: %fossil test-whatis-all | |
| 621 | +** | |
| 622 | +** Show "whatis" information about every artifact in the repository | |
| 623 | +*/ | |
| 624 | +void test_whatis_all_cmd(void){ | |
| 625 | + Stmt q; | |
| 626 | + int cnt = 0; | |
| 627 | + db_find_and_open_repository(0,0); | |
| 628 | + db_prepare(&q, "SELECT rid FROM blob ORDER BY rid"); | |
| 629 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 630 | + if( cnt++ ) fossil_print("%.79c\n", '-'); | |
| 631 | + whatis_rid(db_column_int(&q,0), 1); | |
| 632 | + } | |
| 633 | + db_finalize(&q); | |
| 529 | 634 | } |
| 530 | 635 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -433,10 +433,152 @@ | |
| 433 | cgi_redirectf("%s/ambiguous/%T?src=%t", g.zTop, zName, g.zPath); |
| 434 | rid = 0; |
| 435 | } |
| 436 | return rid; |
| 437 | } |
| 438 | |
| 439 | /* |
| 440 | ** COMMAND: whatis* |
| 441 | ** Usage: %fossil whatis NAME |
| 442 | ** |
| @@ -452,78 +594,41 @@ | |
| 452 | verboseFlag = find_option("verbose","v",0)!=0; |
| 453 | if( g.argc!=3 ) usage("whatis NAME"); |
| 454 | zName = g.argv[2]; |
| 455 | rid = symbolic_name_to_rid(zName, 0); |
| 456 | if( rid<0 ){ |
| 457 | fossil_print("Ambiguous artifact name prefix: %s\n", zName); |
| 458 | }else if( rid==0 ){ |
| 459 | fossil_print("Unknown artifact: %s\n", zName); |
| 460 | }else{ |
| 461 | Stmt q; |
| 462 | db_prepare(&q, |
| 463 | "SELECT uuid, size, datetime(mtime%s), ipaddr," |
| 464 | " (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref" |
| 465 | " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid" |
| 466 | " AND tagxref.rid=blob.rid AND tagxref.tagtype>0)" |
| 467 | " FROM blob, rcvfrom" |
| 468 | " WHERE rid=%d" |
| 469 | " AND rcvfrom.rcvid=blob.rcvid", |
| 470 | timeline_utc(), rid); |
| 471 | if( db_step(&q)==SQLITE_ROW ){ |
| 472 | const char *zTagList = db_column_text(&q, 4); |
| 473 | if( verboseFlag ){ |
| 474 | fossil_print("artifact: %s (%d)\n", db_column_text(&q,0), rid); |
| 475 | fossil_print("size: %d bytes\n", db_column_int(&q,1)); |
| 476 | fossil_print("received: %s from %s\n", |
| 477 | db_column_text(&q, 2), |
| 478 | db_column_text(&q, 3)); |
| 479 | }else{ |
| 480 | fossil_print("artifact: %s\n", db_column_text(&q,0)); |
| 481 | fossil_print("size: %d bytes\n", db_column_int(&q,1)); |
| 482 | } |
| 483 | if( zTagList && zTagList[0] ){ |
| 484 | fossil_print("tags: %s\n", zTagList); |
| 485 | } |
| 486 | } |
| 487 | db_finalize(&q); |
| 488 | db_prepare(&q, |
| 489 | "SELECT type, datetime(mtime%s)," |
| 490 | " coalesce(euser,user), coalesce(ecomment,comment)" |
| 491 | " FROM event WHERE objid=%d", timeline_utc(), rid); |
| 492 | if( db_step(&q)==SQLITE_ROW ){ |
| 493 | const char *zType; |
| 494 | switch( db_column_text(&q,0)[0] ){ |
| 495 | case 'c': zType = "Check-in"; break; |
| 496 | case 'w': zType = "Wiki-edit"; break; |
| 497 | case 'e': zType = "Event"; break; |
| 498 | case 't': zType = "Ticket-change"; break; |
| 499 | case 'g': zType = "Tag-change"; break; |
| 500 | default: zType = "Unknown"; break; |
| 501 | } |
| 502 | fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2), |
| 503 | db_column_text(&q, 1)); |
| 504 | fossil_print("comment: "); |
| 505 | comment_print(db_column_text(&q,3), 10, 78); |
| 506 | } |
| 507 | db_finalize(&q); |
| 508 | db_prepare(&q, |
| 509 | "SELECT filename.name, blob.uuid, datetime(event.mtime%s)," |
| 510 | " coalesce(euser,user), coalesce(ecomment,comment)" |
| 511 | " FROM mlink, filename, blob, event" |
| 512 | " WHERE mlink.fid=%d" |
| 513 | " AND filename.fnid=mlink.fnid" |
| 514 | " AND event.objid=mlink.mid" |
| 515 | " AND blob.rid=mlink.mid" |
| 516 | " ORDER BY event.mtime DESC /*sort*/", |
| 517 | timeline_utc(), rid); |
| 518 | while( db_step(&q)==SQLITE_ROW ){ |
| 519 | fossil_print("file: %s\n", db_column_text(&q,0)); |
| 520 | fossil_print(" part of [%.10s] by %s on %s\n", |
| 521 | db_column_text(&q, 1), |
| 522 | db_column_text(&q, 3), |
| 523 | db_column_text(&q, 2)); |
| 524 | fossil_print(" "); |
| 525 | comment_print(db_column_text(&q,4), 10, 78); |
| 526 | } |
| 527 | db_finalize(&q); |
| 528 | } |
| 529 | } |
| 530 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -433,10 +433,152 @@ | |
| 433 | cgi_redirectf("%s/ambiguous/%T?src=%t", g.zTop, zName, g.zPath); |
| 434 | rid = 0; |
| 435 | } |
| 436 | return rid; |
| 437 | } |
| 438 | |
| 439 | /* |
| 440 | ** Generate a description of artifact "rid" |
| 441 | */ |
| 442 | static void whatis_rid(int rid, int verboseFlag){ |
| 443 | Stmt q; |
| 444 | int cnt; |
| 445 | |
| 446 | /* Basic information about the object. */ |
| 447 | db_prepare(&q, |
| 448 | "SELECT uuid, size, datetime(mtime%s), ipaddr" |
| 449 | " FROM blob, rcvfrom" |
| 450 | " WHERE rid=%d" |
| 451 | " AND rcvfrom.rcvid=blob.rcvid", |
| 452 | timeline_utc(), rid); |
| 453 | if( db_step(&q)==SQLITE_ROW ){ |
| 454 | if( verboseFlag ){ |
| 455 | fossil_print("artifact: %s (%d)\n", db_column_text(&q,0), rid); |
| 456 | fossil_print("size: %d bytes\n", db_column_int(&q,1)); |
| 457 | fossil_print("received: %s from %s\n", |
| 458 | db_column_text(&q, 2), |
| 459 | db_column_text(&q, 3)); |
| 460 | }else{ |
| 461 | fossil_print("artifact: %s\n", db_column_text(&q,0)); |
| 462 | fossil_print("size: %d bytes\n", db_column_int(&q,1)); |
| 463 | } |
| 464 | } |
| 465 | db_finalize(&q); |
| 466 | |
| 467 | /* Report any symbolic tags on this artifact */ |
| 468 | db_prepare(&q, |
| 469 | "SELECT substr(tagname,5)" |
| 470 | " FROM tag JOIN tagxref ON tag.tagid=tagxref.tagid" |
| 471 | " WHERE tagxref.rid=%d" |
| 472 | " AND tagname GLOB 'sym-*'" |
| 473 | " ORDER BY 1", |
| 474 | rid |
| 475 | ); |
| 476 | cnt = 0; |
| 477 | while( db_step(&q)==SQLITE_ROW ){ |
| 478 | const char *zPrefix = cnt++ ? ", " : "tags: "; |
| 479 | fossil_print("%s%s", zPrefix, db_column_text(&q,0)); |
| 480 | } |
| 481 | if( cnt ) fossil_print("\n"); |
| 482 | db_finalize(&q); |
| 483 | |
| 484 | /* Report any HIDDEN, PRIVATE, CLUSTER, or CLOSED tags on this artifact */ |
| 485 | db_prepare(&q, |
| 486 | "SELECT tagname" |
| 487 | " FROM tag JOIN tagxref ON tag.tagid=tagxref.tagid" |
| 488 | " WHERE tagxref.rid=%d" |
| 489 | " AND tag.tagid IN (5,6,7,9)" |
| 490 | " ORDER BY 1", |
| 491 | rid, rid |
| 492 | ); |
| 493 | cnt = 0; |
| 494 | while( db_step(&q)==SQLITE_ROW ){ |
| 495 | const char *zPrefix = cnt++ ? ", " : "raw-tags: "; |
| 496 | fossil_print("%s%s", zPrefix, db_column_text(&q,0)); |
| 497 | } |
| 498 | if( cnt ) fossil_print("\n"); |
| 499 | db_finalize(&q); |
| 500 | |
| 501 | /* Check for entries on the timeline that reference this object */ |
| 502 | db_prepare(&q, |
| 503 | "SELECT type, datetime(mtime%s)," |
| 504 | " coalesce(euser,user), coalesce(ecomment,comment)" |
| 505 | " FROM event WHERE objid=%d", timeline_utc(), rid); |
| 506 | if( db_step(&q)==SQLITE_ROW ){ |
| 507 | const char *zType; |
| 508 | switch( db_column_text(&q,0)[0] ){ |
| 509 | case 'c': zType = "Check-in"; break; |
| 510 | case 'w': zType = "Wiki-edit"; break; |
| 511 | case 'e': zType = "Event"; break; |
| 512 | case 't': zType = "Ticket-change"; break; |
| 513 | case 'g': zType = "Tag-change"; break; |
| 514 | default: zType = "Unknown"; break; |
| 515 | } |
| 516 | fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2), |
| 517 | db_column_text(&q, 1)); |
| 518 | fossil_print("comment: "); |
| 519 | comment_print(db_column_text(&q,3), 12, 78); |
| 520 | } |
| 521 | db_finalize(&q); |
| 522 | |
| 523 | /* Check to see if this object is used as a file in a check-in */ |
| 524 | db_prepare(&q, |
| 525 | "SELECT filename.name, blob.uuid, datetime(event.mtime%s)," |
| 526 | " coalesce(euser,user), coalesce(ecomment,comment)" |
| 527 | " FROM mlink, filename, blob, event" |
| 528 | " WHERE mlink.fid=%d" |
| 529 | " AND filename.fnid=mlink.fnid" |
| 530 | " AND event.objid=mlink.mid" |
| 531 | " AND blob.rid=mlink.mid" |
| 532 | " ORDER BY event.mtime DESC /*sort*/", |
| 533 | timeline_utc(), rid); |
| 534 | while( db_step(&q)==SQLITE_ROW ){ |
| 535 | fossil_print("file: %s\n", db_column_text(&q,0)); |
| 536 | fossil_print(" part of [%.10s] by %s on %s\n", |
| 537 | db_column_text(&q, 1), |
| 538 | db_column_text(&q, 3), |
| 539 | db_column_text(&q, 2)); |
| 540 | fossil_print(" "); |
| 541 | comment_print(db_column_text(&q,4), 12, 78); |
| 542 | } |
| 543 | db_finalize(&q); |
| 544 | |
| 545 | /* Check to see if this object is used as an attachment */ |
| 546 | db_prepare(&q, |
| 547 | "SELECT attachment.filename," |
| 548 | " attachment.comment," |
| 549 | " attachment.user," |
| 550 | " datetime(attachment.mtime%s)," |
| 551 | " attachment.target," |
| 552 | " CASE WHEN EXISTS(SELECT 1 FROM tag WHERE tagname=('tkt-'||target))" |
| 553 | " THEN 'ticket'" |
| 554 | " WHEN EXISTS(SELECT 1 FROM tag WHERE tagname=('wiki-'||target))" |
| 555 | " THEN 'wiki' END," |
| 556 | " attachment.attachid," |
| 557 | " (SELECT uuid FROM blob WHERE rid=attachid)" |
| 558 | " FROM attachment JOIN blob ON attachment.src=blob.uuid" |
| 559 | " WHERE blob.rid=%d", |
| 560 | timeline_utc(), rid |
| 561 | ); |
| 562 | while( db_step(&q)==SQLITE_ROW ){ |
| 563 | fossil_print("attachment: %s\n", db_column_text(&q,0)); |
| 564 | fossil_print(" attached to %s %s\n", |
| 565 | db_column_text(&q,5), db_column_text(&q,4)); |
| 566 | if( verboseFlag ){ |
| 567 | fossil_print(" via %s (%d)\n", |
| 568 | db_column_text(&q,7), db_column_int(&q,6)); |
| 569 | }else{ |
| 570 | fossil_print(" via %s\n", |
| 571 | db_column_text(&q,7)); |
| 572 | } |
| 573 | fossil_print(" by user %s on %s\n", |
| 574 | db_column_text(&q,2), db_column_text(&q,3)); |
| 575 | fossil_print(" "); |
| 576 | comment_print(db_column_text(&q,1), 12, 78); |
| 577 | } |
| 578 | db_finalize(&q); |
| 579 | } |
| 580 | |
| 581 | /* |
| 582 | ** COMMAND: whatis* |
| 583 | ** Usage: %fossil whatis NAME |
| 584 | ** |
| @@ -452,78 +594,41 @@ | |
| 594 | verboseFlag = find_option("verbose","v",0)!=0; |
| 595 | if( g.argc!=3 ) usage("whatis NAME"); |
| 596 | zName = g.argv[2]; |
| 597 | rid = symbolic_name_to_rid(zName, 0); |
| 598 | if( rid<0 ){ |
| 599 | Stmt q; |
| 600 | int cnt = 0; |
| 601 | fossil_print("Ambiguous artifact name prefix: %s\n", zName); |
| 602 | db_prepare(&q, |
| 603 | "SELECT rid FROM blob WHERE uuid>=lower(%Q) AND uuid<(lower(%Q)||'z')", |
| 604 | zName, zName |
| 605 | ); |
| 606 | while( db_step(&q)==SQLITE_ROW ){ |
| 607 | if( cnt++ ) fossil_print("%.79c\n", '-'); |
| 608 | whatis_rid(db_column_int(&q, 0), verboseFlag); |
| 609 | } |
| 610 | db_finalize(&q); |
| 611 | }else if( rid==0 ){ |
| 612 | fossil_print("Unknown artifact: %s\n", zName); |
| 613 | }else{ |
| 614 | whatis_rid(rid, verboseFlag); |
| 615 | } |
| 616 | } |
| 617 | |
| 618 | /* |
| 619 | ** COMMAND: test-whatis-all |
| 620 | ** Usage: %fossil test-whatis-all |
| 621 | ** |
| 622 | ** Show "whatis" information about every artifact in the repository |
| 623 | */ |
| 624 | void test_whatis_all_cmd(void){ |
| 625 | Stmt q; |
| 626 | int cnt = 0; |
| 627 | db_find_and_open_repository(0,0); |
| 628 | db_prepare(&q, "SELECT rid FROM blob ORDER BY rid"); |
| 629 | while( db_step(&q)==SQLITE_ROW ){ |
| 630 | if( cnt++ ) fossil_print("%.79c\n", '-'); |
| 631 | whatis_rid(db_column_int(&q,0), 1); |
| 632 | } |
| 633 | db_finalize(&q); |
| 634 | } |
| 635 |
+1
-2
| --- src/popen.c | ||
| +++ src/popen.c | ||
| @@ -204,19 +204,18 @@ | ||
| 204 | 204 | #endif |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /* |
| 208 | 208 | ** Close the connection to a child process previously created using |
| 209 | -** popen2(). Kill off the child process, then close the pipes. | |
| 209 | +** popen2(). | |
| 210 | 210 | */ |
| 211 | 211 | void pclose2(int fdIn, FILE *pOut, int childPid){ |
| 212 | 212 | #ifdef _WIN32 |
| 213 | 213 | /* Not implemented, yet */ |
| 214 | 214 | close(fdIn); |
| 215 | 215 | fclose(pOut); |
| 216 | 216 | #else |
| 217 | 217 | close(fdIn); |
| 218 | 218 | fclose(pOut); |
| 219 | - kill(childPid, SIGINT); | |
| 220 | 219 | while( waitpid(0, 0, WNOHANG)>0 ) {} |
| 221 | 220 | #endif |
| 222 | 221 | } |
| 223 | 222 |
| --- src/popen.c | |
| +++ src/popen.c | |
| @@ -204,19 +204,18 @@ | |
| 204 | #endif |
| 205 | } |
| 206 | |
| 207 | /* |
| 208 | ** Close the connection to a child process previously created using |
| 209 | ** popen2(). Kill off the child process, then close the pipes. |
| 210 | */ |
| 211 | void pclose2(int fdIn, FILE *pOut, int childPid){ |
| 212 | #ifdef _WIN32 |
| 213 | /* Not implemented, yet */ |
| 214 | close(fdIn); |
| 215 | fclose(pOut); |
| 216 | #else |
| 217 | close(fdIn); |
| 218 | fclose(pOut); |
| 219 | kill(childPid, SIGINT); |
| 220 | while( waitpid(0, 0, WNOHANG)>0 ) {} |
| 221 | #endif |
| 222 | } |
| 223 |
| --- src/popen.c | |
| +++ src/popen.c | |
| @@ -204,19 +204,18 @@ | |
| 204 | #endif |
| 205 | } |
| 206 | |
| 207 | /* |
| 208 | ** Close the connection to a child process previously created using |
| 209 | ** popen2(). |
| 210 | */ |
| 211 | void pclose2(int fdIn, FILE *pOut, int childPid){ |
| 212 | #ifdef _WIN32 |
| 213 | /* Not implemented, yet */ |
| 214 | close(fdIn); |
| 215 | fclose(pOut); |
| 216 | #else |
| 217 | close(fdIn); |
| 218 | fclose(pOut); |
| 219 | while( waitpid(0, 0, WNOHANG)>0 ) {} |
| 220 | #endif |
| 221 | } |
| 222 |
+7
-1
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -858,11 +858,17 @@ | ||
| 858 | 858 | continue; |
| 859 | 859 | } |
| 860 | 860 | zUtf8Name = fossil_filename_to_utf8(pEntry->d_name); |
| 861 | 861 | zSubpath = mprintf("%s/%s", zPath, zUtf8Name); |
| 862 | 862 | fossil_filename_free(zUtf8Name); |
| 863 | - if( file_isdir(zSubpath)==1 ){ | |
| 863 | +#ifdef _DIRENT_HAVE_D_TYPE | |
| 864 | + if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) | |
| 865 | + ? (file_isdir(zSubpath)==1) : (pEntry->d_type==DT_DIR) ) | |
| 866 | +#else | |
| 867 | + if( file_isdir(zSubpath)==1 ) | |
| 868 | +#endif | |
| 869 | + { | |
| 864 | 870 | recon_read_dir(zSubpath); |
| 865 | 871 | }else{ |
| 866 | 872 | blob_init(&path, 0, 0); |
| 867 | 873 | blob_appendf(&path, "%s", zSubpath); |
| 868 | 874 | if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){ |
| 869 | 875 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -858,11 +858,17 @@ | |
| 858 | continue; |
| 859 | } |
| 860 | zUtf8Name = fossil_filename_to_utf8(pEntry->d_name); |
| 861 | zSubpath = mprintf("%s/%s", zPath, zUtf8Name); |
| 862 | fossil_filename_free(zUtf8Name); |
| 863 | if( file_isdir(zSubpath)==1 ){ |
| 864 | recon_read_dir(zSubpath); |
| 865 | }else{ |
| 866 | blob_init(&path, 0, 0); |
| 867 | blob_appendf(&path, "%s", zSubpath); |
| 868 | if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){ |
| 869 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -858,11 +858,17 @@ | |
| 858 | continue; |
| 859 | } |
| 860 | zUtf8Name = fossil_filename_to_utf8(pEntry->d_name); |
| 861 | zSubpath = mprintf("%s/%s", zPath, zUtf8Name); |
| 862 | fossil_filename_free(zUtf8Name); |
| 863 | #ifdef _DIRENT_HAVE_D_TYPE |
| 864 | if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) |
| 865 | ? (file_isdir(zSubpath)==1) : (pEntry->d_type==DT_DIR) ) |
| 866 | #else |
| 867 | if( file_isdir(zSubpath)==1 ) |
| 868 | #endif |
| 869 | { |
| 870 | recon_read_dir(zSubpath); |
| 871 | }else{ |
| 872 | blob_init(&path, 0, 0); |
| 873 | blob_appendf(&path, "%s", zSubpath); |
| 874 | if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){ |
| 875 |
-13
| --- src/report.c | ||
| +++ src/report.c | ||
| @@ -612,23 +612,10 @@ | ||
| 612 | 612 | @ priority AS 'Pri', |
| 613 | 613 | @ title AS 'Title', |
| 614 | 614 | @ description AS '_Description', -- When the column name begins with '_' |
| 615 | 615 | @ remarks AS '_Remarks' -- content is rendered as wiki |
| 616 | 616 | @ FROM ticket |
| 617 | - @ </pre></blockquote> | |
| 618 | - @ | |
| 619 | - @ <p>Or, to see part of the description on the same row, use the | |
| 620 | - @ <b>wiki()</b> function with some string manipulation. Using the | |
| 621 | - @ <b>tkt()</b> function on the ticket number will also generate a linked | |
| 622 | - @ field, but without the extra <i>edit</i> column: | |
| 623 | - @ </p> | |
| 624 | - @ <blockquote><pre> | |
| 625 | - @ SELECT | |
| 626 | - @ tkt(tn) AS '', | |
| 627 | - @ title AS 'Title', | |
| 628 | - @ wiki(substr(description,0,80)) AS 'Description' | |
| 629 | - @ FROM ticket | |
| 630 | 617 | @ </pre></blockquote> |
| 631 | 618 | @ |
| 632 | 619 | } |
| 633 | 620 | |
| 634 | 621 | /* |
| 635 | 622 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -612,23 +612,10 @@ | |
| 612 | @ priority AS 'Pri', |
| 613 | @ title AS 'Title', |
| 614 | @ description AS '_Description', -- When the column name begins with '_' |
| 615 | @ remarks AS '_Remarks' -- content is rendered as wiki |
| 616 | @ FROM ticket |
| 617 | @ </pre></blockquote> |
| 618 | @ |
| 619 | @ <p>Or, to see part of the description on the same row, use the |
| 620 | @ <b>wiki()</b> function with some string manipulation. Using the |
| 621 | @ <b>tkt()</b> function on the ticket number will also generate a linked |
| 622 | @ field, but without the extra <i>edit</i> column: |
| 623 | @ </p> |
| 624 | @ <blockquote><pre> |
| 625 | @ SELECT |
| 626 | @ tkt(tn) AS '', |
| 627 | @ title AS 'Title', |
| 628 | @ wiki(substr(description,0,80)) AS 'Description' |
| 629 | @ FROM ticket |
| 630 | @ </pre></blockquote> |
| 631 | @ |
| 632 | } |
| 633 | |
| 634 | /* |
| 635 |
| --- src/report.c | |
| +++ src/report.c | |
| @@ -612,23 +612,10 @@ | |
| 612 | @ priority AS 'Pri', |
| 613 | @ title AS 'Title', |
| 614 | @ description AS '_Description', -- When the column name begins with '_' |
| 615 | @ remarks AS '_Remarks' -- content is rendered as wiki |
| 616 | @ FROM ticket |
| 617 | @ </pre></blockquote> |
| 618 | @ |
| 619 | } |
| 620 | |
| 621 | /* |
| 622 |
+9
-9
| --- src/schema.c | ||
| +++ src/schema.c | ||
| @@ -21,11 +21,11 @@ | ||
| 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 |
+13
-1
| --- 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 |
| 984 | 996 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -962,10 +962,21 @@ | |
| 962 | @ <p>Fossil tries to spend less than this many seconds gathering |
| 963 | @ the out-bound data of sync, clone, and pull packets. |
| 964 | @ If the client request takes longer, a partial reply is given similar |
| 965 | @ to the download packet limit. 30s is a reasonable default.</p> |
| 966 | |
| 967 | @ <hr /> |
| 968 | onoff_attribute( |
| 969 | "Enable hyperlinks for \"nobody\" based on User-Agent and Javascript", |
| 970 | "auto-hyperlink", "autohyperlink", 1, 0); |
| 971 | @ <p>Enable hyperlinks (the equivalent of the "h" permission) for all users |
| @@ -973,11 +984,12 @@ | |
| 973 | @ HTTP header indicates that the request is coming from an actual human |
| 974 | @ being and not a a robot or spider and (2) the user agent is able to |
| 975 | @ run Javascript in order to set the href= attribute of hyperlinks. Bots |
| 976 | @ and spiders can forge a User-Agent string that makes them seem to be a |
| 977 | @ normal browser and they can run javascript just like browsers. But most |
| 978 | @ bots do not go to that much trouble so this is normally an effective defense.</p> |
| 979 | @ |
| 980 | @ <p>You do not normally want a bot to walk your entire repository because |
| 981 | @ if it does, your server will end up computing diffs and annotations for |
| 982 | @ every historical version of every file and creating ZIPs and tarballs of |
| 983 | @ every historical check-in, which can use a lot of CPU and bandwidth |
| 984 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -962,10 +962,21 @@ | |
| 962 | @ <p>Fossil tries to spend less than this many seconds gathering |
| 963 | @ the out-bound data of sync, clone, and pull packets. |
| 964 | @ If the client request takes longer, a partial reply is given similar |
| 965 | @ to the download packet limit. 30s is a reasonable default.</p> |
| 966 | |
| 967 | @ <hr /> |
| 968 | entry_attribute("Server Load Average Limit", 11, "max-loadavg", "mxldavg", |
| 969 | "0.0", 0); |
| 970 | @ <p>Some expensive operations (such as computing tarballs, zip archives, |
| 971 | @ or annotation/blame pages) are prohibited if the load average on the host |
| 972 | @ computer is too large. Set the threshold for disallowing expensive |
| 973 | @ computations here. Set this to 0.0 to disable the load average limit. |
| 974 | @ This limit is only enforced on Unix servers. On Linux systems, |
| 975 | @ access to the /proc virtual filesystem is required, which means this limit |
| 976 | @ might not work inside a chroot() jail.</p> |
| 977 | |
| 978 | @ <hr /> |
| 979 | onoff_attribute( |
| 980 | "Enable hyperlinks for \"nobody\" based on User-Agent and Javascript", |
| 981 | "auto-hyperlink", "autohyperlink", 1, 0); |
| 982 | @ <p>Enable hyperlinks (the equivalent of the "h" permission) for all users |
| @@ -973,11 +984,12 @@ | |
| 984 | @ HTTP header indicates that the request is coming from an actual human |
| 985 | @ being and not a a robot or spider and (2) the user agent is able to |
| 986 | @ run Javascript in order to set the href= attribute of hyperlinks. Bots |
| 987 | @ and spiders can forge a User-Agent string that makes them seem to be a |
| 988 | @ normal browser and they can run javascript just like browsers. But most |
| 989 | @ bots do not go to that much trouble so this is normally an effective |
| 990 | @ defense.</p> |
| 991 | @ |
| 992 | @ <p>You do not normally want a bot to walk your entire repository because |
| 993 | @ if it does, your server will end up computing diffs and annotations for |
| 994 | @ every historical version of every file and creating ZIPs and tarballs of |
| 995 | @ every historical check-in, which can use a lot of CPU and bandwidth |
| 996 |
+47
-16
| --- src/shell.c | ||
| +++ src/shell.c | ||
| @@ -63,11 +63,13 @@ | ||
| 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 */ |
| @@ -1189,11 +1193,12 @@ | ||
| 1189 | 1193 | const char *z; /* Used to check if this is an EXPLAIN */ |
| 1190 | 1194 | int *abYield = 0; /* True if op is an OP_Yield */ |
| 1191 | 1195 | int nAlloc = 0; /* Allocated size of p->aiIndent[], abYield */ |
| 1192 | 1196 | int iOp; /* Index of operation in p->aiIndent[] */ |
| 1193 | 1197 | |
| 1194 | - const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext", 0 }; | |
| 1198 | + const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext", | |
| 1199 | + "NextIfOpen", "PrevIfOpen", 0 }; | |
| 1195 | 1200 | const char *azYield[] = { "Yield", "SeekLt", "SeekGt", "RowSetRead", "Rewind", 0 }; |
| 1196 | 1201 | const char *azGoto[] = { "Goto", 0 }; |
| 1197 | 1202 | |
| 1198 | 1203 | /* Try to figure out if this is really an EXPLAIN statement. If this |
| 1199 | 1204 | ** cannot be verified, return early. */ |
| @@ -1226,11 +1231,13 @@ | ||
| 1226 | 1231 | p->nIndent = iOp+1; |
| 1227 | 1232 | |
| 1228 | 1233 | if( str_in_array(zOp, azNext) ){ |
| 1229 | 1234 | for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2; |
| 1230 | 1235 | } |
| 1231 | - if( str_in_array(zOp, azGoto) && p2op<p->nIndent && abYield[p2op] ){ | |
| 1236 | + if( str_in_array(zOp, azGoto) && p2op<p->nIndent | |
| 1237 | + && (abYield[p2op] || sqlite3_column_int(pSql, 2)) | |
| 1238 | + ){ | |
| 1232 | 1239 | for(i=p2op+1; i<iOp; i++) p->aiIndent[i] += 2; |
| 1233 | 1240 | } |
| 1234 | 1241 | } |
| 1235 | 1242 | |
| 1236 | 1243 | p->iIndent = 0; |
| @@ -1297,10 +1304,27 @@ | ||
| 1297 | 1304 | /* echo the sql statement if echo on */ |
| 1298 | 1305 | if( pArg && pArg->echoOn ){ |
| 1299 | 1306 | const char *zStmtSql = sqlite3_sql(pStmt); |
| 1300 | 1307 | fprintf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql); |
| 1301 | 1308 | } |
| 1309 | + | |
| 1310 | + /* Show the EXPLAIN QUERY PLAN if .eqp is on */ | |
| 1311 | + if( pArg && pArg->autoEQP ){ | |
| 1312 | + sqlite3_stmt *pExplain; | |
| 1313 | + char *zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", sqlite3_sql(pStmt)); | |
| 1314 | + rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0); | |
| 1315 | + if( rc==SQLITE_OK ){ | |
| 1316 | + while( sqlite3_step(pExplain)==SQLITE_ROW ){ | |
| 1317 | + fprintf(pArg->out,"--EQP-- %d,", sqlite3_column_int(pExplain, 0)); | |
| 1318 | + fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 1)); | |
| 1319 | + fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 2)); | |
| 1320 | + fprintf(pArg->out,"%s\n", sqlite3_column_text(pExplain, 3)); | |
| 1321 | + } | |
| 1322 | + } | |
| 1323 | + sqlite3_finalize(pExplain); | |
| 1324 | + sqlite3_free(zEQP); | |
| 1325 | + } | |
| 1302 | 1326 | |
| 1303 | 1327 | /* Output TESTCTRL_EXPLAIN text of requested */ |
| 1304 | 1328 | if( pArg && pArg->mode==MODE_Explain ){ |
| 1305 | 1329 | const char *zExplain = 0; |
| 1306 | 1330 | sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain); |
| @@ -1891,11 +1915,11 @@ | ||
| 1891 | 1915 | csv_append_char(p, c); |
| 1892 | 1916 | c = fgetc(p->in); |
| 1893 | 1917 | } |
| 1894 | 1918 | if( c=='\n' ){ |
| 1895 | 1919 | p->nLine++; |
| 1896 | - if( p->n>1 && p->z[p->n-1]=='\r' ) p->n--; | |
| 1920 | + if( p->n>0 && p->z[p->n-1]=='\r' ) p->n--; | |
| 1897 | 1921 | } |
| 1898 | 1922 | p->cTerm = c; |
| 1899 | 1923 | } |
| 1900 | 1924 | if( p->z ) p->z[p->n] = 0; |
| 1901 | 1925 | return p->z; |
| @@ -2296,10 +2320,14 @@ | ||
| 2296 | 2320 | }else |
| 2297 | 2321 | |
| 2298 | 2322 | if( c=='e' && strncmp(azArg[0], "echo", n)==0 && nArg>1 && nArg<3 ){ |
| 2299 | 2323 | p->echoOn = booleanValue(azArg[1]); |
| 2300 | 2324 | }else |
| 2325 | + | |
| 2326 | + if( c=='e' && strncmp(azArg[0], "eqp", n)==0 && nArg>1 && nArg<3 ){ | |
| 2327 | + p->autoEQP = booleanValue(azArg[1]); | |
| 2328 | + }else | |
| 2301 | 2329 | |
| 2302 | 2330 | if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){ |
| 2303 | 2331 | if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc); |
| 2304 | 2332 | rc = 2; |
| 2305 | 2333 | }else |
| @@ -2869,10 +2897,11 @@ | ||
| 2869 | 2897 | }else |
| 2870 | 2898 | |
| 2871 | 2899 | if( c=='s' && strncmp(azArg[0], "show", n)==0 && nArg==1 ){ |
| 2872 | 2900 | int i; |
| 2873 | 2901 | fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off"); |
| 2902 | + fprintf(p->out,"%9.9s: %s\n","eqp", p->autoEQP ? "on" : "off"); | |
| 2874 | 2903 | fprintf(p->out,"%9.9s: %s\n","explain", p->explainPrev.valid ? "on" :"off"); |
| 2875 | 2904 | fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off"); |
| 2876 | 2905 | fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]); |
| 2877 | 2906 | fprintf(p->out,"%9.9s: ", "nullvalue"); |
| 2878 | 2907 | output_c_string(p->out, p->nullvalue); |
| @@ -3546,15 +3575,17 @@ | ||
| 3546 | 3575 | char *zFirstCmd = 0; |
| 3547 | 3576 | int i; |
| 3548 | 3577 | int rc = 0; |
| 3549 | 3578 | int warnInmemoryDb = 0; |
| 3550 | 3579 | |
| 3551 | - if( sqlite3_libversion_number()<3008003 ){ | |
| 3552 | - fprintf(stderr, "Unsuitable SQLite version %s, must be at least 3.8.3", | |
| 3553 | - sqlite3_libversion()); | |
| 3580 | +#if USE_SYSTEM_SQLITE+0!=1 | |
| 3581 | + if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){ | |
| 3582 | + fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n", | |
| 3583 | + sqlite3_sourceid(), SQLITE_SOURCE_ID); | |
| 3554 | 3584 | exit(1); |
| 3555 | 3585 | } |
| 3586 | +#endif | |
| 3556 | 3587 | Argv0 = argv[0]; |
| 3557 | 3588 | main_init(&data); |
| 3558 | 3589 | stdin_is_interactive = isatty(0); |
| 3559 | 3590 | |
| 3560 | 3591 | /* Make sure we have a valid signal handler early, before anything |
| @@ -3644,17 +3675,15 @@ | ||
| 3644 | 3675 | warnInmemoryDb = argc==1; |
| 3645 | 3676 | #else |
| 3646 | 3677 | fprintf(stderr,"%s: Error: no database filename specified\n", Argv0); |
| 3647 | 3678 | return 1; |
| 3648 | 3679 | #endif |
| 3649 | - /***** Begin Fossil Patch *****/ | |
| 3650 | - { | |
| 3651 | - extern void fossil_open(const char **); | |
| 3652 | - fossil_open(&data.zDbFilename); | |
| 3653 | - warnInmemoryDb = 0; | |
| 3654 | - } | |
| 3655 | - /***** End Fossil Patch *****/ | |
| 3680 | +#ifdef SQLITE_SHELL_DBNAME_PROC | |
| 3681 | + { extern void SQLITE_SHELL_DBNAME_PROC(const char**); | |
| 3682 | + SQLITE_SHELL_DBNAME_PROC(&data.zDbFilename); | |
| 3683 | + warnInmemoryDb = 0; } | |
| 3684 | +#endif | |
| 3656 | 3685 | } |
| 3657 | 3686 | data.out = stdout; |
| 3658 | 3687 | |
| 3659 | 3688 | /* Go ahead and open the database file if it already exists. If the |
| 3660 | 3689 | ** file does not exist, delay opening it. This prevents empty database |
| @@ -3706,10 +3735,12 @@ | ||
| 3706 | 3735 | data.showHeader = 1; |
| 3707 | 3736 | }else if( strcmp(z,"-noheader")==0 ){ |
| 3708 | 3737 | data.showHeader = 0; |
| 3709 | 3738 | }else if( strcmp(z,"-echo")==0 ){ |
| 3710 | 3739 | data.echoOn = 1; |
| 3740 | + }else if( strcmp(z,"-eqp")==0 ){ | |
| 3741 | + data.autoEQP = 1; | |
| 3711 | 3742 | }else if( strcmp(z,"-stats")==0 ){ |
| 3712 | 3743 | data.statsOn = 1; |
| 3713 | 3744 | }else if( strcmp(z,"-bail")==0 ){ |
| 3714 | 3745 | bail_on_error = 1; |
| 3715 | 3746 | }else if( strcmp(z,"-version")==0 ){ |
| @@ -3788,12 +3819,12 @@ | ||
| 3788 | 3819 | "Enter \".help\" for usage hints.\n", |
| 3789 | 3820 | sqlite3_libversion(), sqlite3_sourceid() |
| 3790 | 3821 | ); |
| 3791 | 3822 | if( warnInmemoryDb ){ |
| 3792 | 3823 | printf("Connected to a "); |
| 3793 | - printBold("transient in-memory database."); | |
| 3794 | - printf("\nUse \".open FILENAME\" to reopen on a " | |
| 3824 | + printBold("transient in-memory database"); | |
| 3825 | + printf(".\nUse \".open FILENAME\" to reopen on a " | |
| 3795 | 3826 | "persistent database.\n"); |
| 3796 | 3827 | } |
| 3797 | 3828 | zHome = find_home_dir(); |
| 3798 | 3829 | if( zHome ){ |
| 3799 | 3830 | nHistory = strlen30(zHome) + 20; |
| 3800 | 3831 |
| --- src/shell.c | |
| +++ src/shell.c | |
| @@ -63,11 +63,13 @@ | |
| 63 | #endif |
| 64 | |
| 65 | #if defined(_WIN32) || defined(WIN32) |
| 66 | # include <io.h> |
| 67 | #define isatty(h) _isatty(h) |
| 68 | #define access(f,m) _access((f),(m)) |
| 69 | #undef popen |
| 70 | #define popen _popen |
| 71 | #undef pclose |
| 72 | #define pclose _pclose |
| 73 | #else |
| @@ -442,10 +444,11 @@ | |
| 442 | ** state and mode information. |
| 443 | */ |
| 444 | struct callback_data { |
| 445 | sqlite3 *db; /* The database */ |
| 446 | int echoOn; /* True to echo input commands */ |
| 447 | int statsOn; /* True to display memory stats before each finalize */ |
| 448 | int cnt; /* Number of records displayed so far */ |
| 449 | FILE *out; /* Write results here */ |
| 450 | FILE *traceOut; /* Output for sqlite3_trace() */ |
| 451 | int nErr; /* Number of errors seen */ |
| @@ -1179,10 +1182,11 @@ | |
| 1179 | ** itself by 2 spaces. |
| 1180 | ** |
| 1181 | ** * For each "Goto", if the jump destination is earlier in the program |
| 1182 | ** and ends on one of: |
| 1183 | ** Yield SeekGt SeekLt RowSetRead Rewind |
| 1184 | ** then indent all opcodes between the earlier instruction |
| 1185 | ** and "Goto" by 2 spaces. |
| 1186 | */ |
| 1187 | static void explain_data_prepare(struct callback_data *p, sqlite3_stmt *pSql){ |
| 1188 | const char *zSql; /* The text of the SQL statement */ |
| @@ -1189,11 +1193,12 @@ | |
| 1189 | const char *z; /* Used to check if this is an EXPLAIN */ |
| 1190 | int *abYield = 0; /* True if op is an OP_Yield */ |
| 1191 | int nAlloc = 0; /* Allocated size of p->aiIndent[], abYield */ |
| 1192 | int iOp; /* Index of operation in p->aiIndent[] */ |
| 1193 | |
| 1194 | const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext", 0 }; |
| 1195 | const char *azYield[] = { "Yield", "SeekLt", "SeekGt", "RowSetRead", "Rewind", 0 }; |
| 1196 | const char *azGoto[] = { "Goto", 0 }; |
| 1197 | |
| 1198 | /* Try to figure out if this is really an EXPLAIN statement. If this |
| 1199 | ** cannot be verified, return early. */ |
| @@ -1226,11 +1231,13 @@ | |
| 1226 | p->nIndent = iOp+1; |
| 1227 | |
| 1228 | if( str_in_array(zOp, azNext) ){ |
| 1229 | for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2; |
| 1230 | } |
| 1231 | if( str_in_array(zOp, azGoto) && p2op<p->nIndent && abYield[p2op] ){ |
| 1232 | for(i=p2op+1; i<iOp; i++) p->aiIndent[i] += 2; |
| 1233 | } |
| 1234 | } |
| 1235 | |
| 1236 | p->iIndent = 0; |
| @@ -1297,10 +1304,27 @@ | |
| 1297 | /* echo the sql statement if echo on */ |
| 1298 | if( pArg && pArg->echoOn ){ |
| 1299 | const char *zStmtSql = sqlite3_sql(pStmt); |
| 1300 | fprintf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql); |
| 1301 | } |
| 1302 | |
| 1303 | /* Output TESTCTRL_EXPLAIN text of requested */ |
| 1304 | if( pArg && pArg->mode==MODE_Explain ){ |
| 1305 | const char *zExplain = 0; |
| 1306 | sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain); |
| @@ -1891,11 +1915,11 @@ | |
| 1891 | csv_append_char(p, c); |
| 1892 | c = fgetc(p->in); |
| 1893 | } |
| 1894 | if( c=='\n' ){ |
| 1895 | p->nLine++; |
| 1896 | if( p->n>1 && p->z[p->n-1]=='\r' ) p->n--; |
| 1897 | } |
| 1898 | p->cTerm = c; |
| 1899 | } |
| 1900 | if( p->z ) p->z[p->n] = 0; |
| 1901 | return p->z; |
| @@ -2296,10 +2320,14 @@ | |
| 2296 | }else |
| 2297 | |
| 2298 | if( c=='e' && strncmp(azArg[0], "echo", n)==0 && nArg>1 && nArg<3 ){ |
| 2299 | p->echoOn = booleanValue(azArg[1]); |
| 2300 | }else |
| 2301 | |
| 2302 | if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){ |
| 2303 | if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc); |
| 2304 | rc = 2; |
| 2305 | }else |
| @@ -2869,10 +2897,11 @@ | |
| 2869 | }else |
| 2870 | |
| 2871 | if( c=='s' && strncmp(azArg[0], "show", n)==0 && nArg==1 ){ |
| 2872 | int i; |
| 2873 | fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off"); |
| 2874 | fprintf(p->out,"%9.9s: %s\n","explain", p->explainPrev.valid ? "on" :"off"); |
| 2875 | fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off"); |
| 2876 | fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]); |
| 2877 | fprintf(p->out,"%9.9s: ", "nullvalue"); |
| 2878 | output_c_string(p->out, p->nullvalue); |
| @@ -3546,15 +3575,17 @@ | |
| 3546 | char *zFirstCmd = 0; |
| 3547 | int i; |
| 3548 | int rc = 0; |
| 3549 | int warnInmemoryDb = 0; |
| 3550 | |
| 3551 | if( sqlite3_libversion_number()<3008003 ){ |
| 3552 | fprintf(stderr, "Unsuitable SQLite version %s, must be at least 3.8.3", |
| 3553 | sqlite3_libversion()); |
| 3554 | exit(1); |
| 3555 | } |
| 3556 | Argv0 = argv[0]; |
| 3557 | main_init(&data); |
| 3558 | stdin_is_interactive = isatty(0); |
| 3559 | |
| 3560 | /* Make sure we have a valid signal handler early, before anything |
| @@ -3644,17 +3675,15 @@ | |
| 3644 | warnInmemoryDb = argc==1; |
| 3645 | #else |
| 3646 | fprintf(stderr,"%s: Error: no database filename specified\n", Argv0); |
| 3647 | return 1; |
| 3648 | #endif |
| 3649 | /***** Begin Fossil Patch *****/ |
| 3650 | { |
| 3651 | extern void fossil_open(const char **); |
| 3652 | fossil_open(&data.zDbFilename); |
| 3653 | warnInmemoryDb = 0; |
| 3654 | } |
| 3655 | /***** End Fossil Patch *****/ |
| 3656 | } |
| 3657 | data.out = stdout; |
| 3658 | |
| 3659 | /* Go ahead and open the database file if it already exists. If the |
| 3660 | ** file does not exist, delay opening it. This prevents empty database |
| @@ -3706,10 +3735,12 @@ | |
| 3706 | data.showHeader = 1; |
| 3707 | }else if( strcmp(z,"-noheader")==0 ){ |
| 3708 | data.showHeader = 0; |
| 3709 | }else if( strcmp(z,"-echo")==0 ){ |
| 3710 | data.echoOn = 1; |
| 3711 | }else if( strcmp(z,"-stats")==0 ){ |
| 3712 | data.statsOn = 1; |
| 3713 | }else if( strcmp(z,"-bail")==0 ){ |
| 3714 | bail_on_error = 1; |
| 3715 | }else if( strcmp(z,"-version")==0 ){ |
| @@ -3788,12 +3819,12 @@ | |
| 3788 | "Enter \".help\" for usage hints.\n", |
| 3789 | sqlite3_libversion(), sqlite3_sourceid() |
| 3790 | ); |
| 3791 | if( warnInmemoryDb ){ |
| 3792 | printf("Connected to a "); |
| 3793 | printBold("transient in-memory database."); |
| 3794 | printf("\nUse \".open FILENAME\" to reopen on a " |
| 3795 | "persistent database.\n"); |
| 3796 | } |
| 3797 | zHome = find_home_dir(); |
| 3798 | if( zHome ){ |
| 3799 | nHistory = strlen30(zHome) + 20; |
| 3800 |
| --- src/shell.c | |
| +++ src/shell.c | |
| @@ -63,11 +63,13 @@ | |
| 63 | #endif |
| 64 | |
| 65 | #if defined(_WIN32) || defined(WIN32) |
| 66 | # include <io.h> |
| 67 | #define isatty(h) _isatty(h) |
| 68 | #ifndef access |
| 69 | # define access(f,m) _access((f),(m)) |
| 70 | #endif |
| 71 | #undef popen |
| 72 | #define popen _popen |
| 73 | #undef pclose |
| 74 | #define pclose _pclose |
| 75 | #else |
| @@ -442,10 +444,11 @@ | |
| 444 | ** state and mode information. |
| 445 | */ |
| 446 | struct callback_data { |
| 447 | sqlite3 *db; /* The database */ |
| 448 | int echoOn; /* True to echo input commands */ |
| 449 | int autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL statement */ |
| 450 | int statsOn; /* True to display memory stats before each finalize */ |
| 451 | int cnt; /* Number of records displayed so far */ |
| 452 | FILE *out; /* Write results here */ |
| 453 | FILE *traceOut; /* Output for sqlite3_trace() */ |
| 454 | int nErr; /* Number of errors seen */ |
| @@ -1179,10 +1182,11 @@ | |
| 1182 | ** itself by 2 spaces. |
| 1183 | ** |
| 1184 | ** * For each "Goto", if the jump destination is earlier in the program |
| 1185 | ** and ends on one of: |
| 1186 | ** Yield SeekGt SeekLt RowSetRead Rewind |
| 1187 | ** or if the P1 parameter is one instead of zero, |
| 1188 | ** then indent all opcodes between the earlier instruction |
| 1189 | ** and "Goto" by 2 spaces. |
| 1190 | */ |
| 1191 | static void explain_data_prepare(struct callback_data *p, sqlite3_stmt *pSql){ |
| 1192 | const char *zSql; /* The text of the SQL statement */ |
| @@ -1189,11 +1193,12 @@ | |
| 1193 | const char *z; /* Used to check if this is an EXPLAIN */ |
| 1194 | int *abYield = 0; /* True if op is an OP_Yield */ |
| 1195 | int nAlloc = 0; /* Allocated size of p->aiIndent[], abYield */ |
| 1196 | int iOp; /* Index of operation in p->aiIndent[] */ |
| 1197 | |
| 1198 | const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext", |
| 1199 | "NextIfOpen", "PrevIfOpen", 0 }; |
| 1200 | const char *azYield[] = { "Yield", "SeekLt", "SeekGt", "RowSetRead", "Rewind", 0 }; |
| 1201 | const char *azGoto[] = { "Goto", 0 }; |
| 1202 | |
| 1203 | /* Try to figure out if this is really an EXPLAIN statement. If this |
| 1204 | ** cannot be verified, return early. */ |
| @@ -1226,11 +1231,13 @@ | |
| 1231 | p->nIndent = iOp+1; |
| 1232 | |
| 1233 | if( str_in_array(zOp, azNext) ){ |
| 1234 | for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2; |
| 1235 | } |
| 1236 | if( str_in_array(zOp, azGoto) && p2op<p->nIndent |
| 1237 | && (abYield[p2op] || sqlite3_column_int(pSql, 2)) |
| 1238 | ){ |
| 1239 | for(i=p2op+1; i<iOp; i++) p->aiIndent[i] += 2; |
| 1240 | } |
| 1241 | } |
| 1242 | |
| 1243 | p->iIndent = 0; |
| @@ -1297,10 +1304,27 @@ | |
| 1304 | /* echo the sql statement if echo on */ |
| 1305 | if( pArg && pArg->echoOn ){ |
| 1306 | const char *zStmtSql = sqlite3_sql(pStmt); |
| 1307 | fprintf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql); |
| 1308 | } |
| 1309 | |
| 1310 | /* Show the EXPLAIN QUERY PLAN if .eqp is on */ |
| 1311 | if( pArg && pArg->autoEQP ){ |
| 1312 | sqlite3_stmt *pExplain; |
| 1313 | char *zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", sqlite3_sql(pStmt)); |
| 1314 | rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0); |
| 1315 | if( rc==SQLITE_OK ){ |
| 1316 | while( sqlite3_step(pExplain)==SQLITE_ROW ){ |
| 1317 | fprintf(pArg->out,"--EQP-- %d,", sqlite3_column_int(pExplain, 0)); |
| 1318 | fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 1)); |
| 1319 | fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 2)); |
| 1320 | fprintf(pArg->out,"%s\n", sqlite3_column_text(pExplain, 3)); |
| 1321 | } |
| 1322 | } |
| 1323 | sqlite3_finalize(pExplain); |
| 1324 | sqlite3_free(zEQP); |
| 1325 | } |
| 1326 | |
| 1327 | /* Output TESTCTRL_EXPLAIN text of requested */ |
| 1328 | if( pArg && pArg->mode==MODE_Explain ){ |
| 1329 | const char *zExplain = 0; |
| 1330 | sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain); |
| @@ -1891,11 +1915,11 @@ | |
| 1915 | csv_append_char(p, c); |
| 1916 | c = fgetc(p->in); |
| 1917 | } |
| 1918 | if( c=='\n' ){ |
| 1919 | p->nLine++; |
| 1920 | if( p->n>0 && p->z[p->n-1]=='\r' ) p->n--; |
| 1921 | } |
| 1922 | p->cTerm = c; |
| 1923 | } |
| 1924 | if( p->z ) p->z[p->n] = 0; |
| 1925 | return p->z; |
| @@ -2296,10 +2320,14 @@ | |
| 2320 | }else |
| 2321 | |
| 2322 | if( c=='e' && strncmp(azArg[0], "echo", n)==0 && nArg>1 && nArg<3 ){ |
| 2323 | p->echoOn = booleanValue(azArg[1]); |
| 2324 | }else |
| 2325 | |
| 2326 | if( c=='e' && strncmp(azArg[0], "eqp", n)==0 && nArg>1 && nArg<3 ){ |
| 2327 | p->autoEQP = booleanValue(azArg[1]); |
| 2328 | }else |
| 2329 | |
| 2330 | if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){ |
| 2331 | if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc); |
| 2332 | rc = 2; |
| 2333 | }else |
| @@ -2869,10 +2897,11 @@ | |
| 2897 | }else |
| 2898 | |
| 2899 | if( c=='s' && strncmp(azArg[0], "show", n)==0 && nArg==1 ){ |
| 2900 | int i; |
| 2901 | fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off"); |
| 2902 | fprintf(p->out,"%9.9s: %s\n","eqp", p->autoEQP ? "on" : "off"); |
| 2903 | fprintf(p->out,"%9.9s: %s\n","explain", p->explainPrev.valid ? "on" :"off"); |
| 2904 | fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off"); |
| 2905 | fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]); |
| 2906 | fprintf(p->out,"%9.9s: ", "nullvalue"); |
| 2907 | output_c_string(p->out, p->nullvalue); |
| @@ -3546,15 +3575,17 @@ | |
| 3575 | char *zFirstCmd = 0; |
| 3576 | int i; |
| 3577 | int rc = 0; |
| 3578 | int warnInmemoryDb = 0; |
| 3579 | |
| 3580 | #if USE_SYSTEM_SQLITE+0!=1 |
| 3581 | if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){ |
| 3582 | fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n", |
| 3583 | sqlite3_sourceid(), SQLITE_SOURCE_ID); |
| 3584 | exit(1); |
| 3585 | } |
| 3586 | #endif |
| 3587 | Argv0 = argv[0]; |
| 3588 | main_init(&data); |
| 3589 | stdin_is_interactive = isatty(0); |
| 3590 | |
| 3591 | /* Make sure we have a valid signal handler early, before anything |
| @@ -3644,17 +3675,15 @@ | |
| 3675 | warnInmemoryDb = argc==1; |
| 3676 | #else |
| 3677 | fprintf(stderr,"%s: Error: no database filename specified\n", Argv0); |
| 3678 | return 1; |
| 3679 | #endif |
| 3680 | #ifdef SQLITE_SHELL_DBNAME_PROC |
| 3681 | { extern void SQLITE_SHELL_DBNAME_PROC(const char**); |
| 3682 | SQLITE_SHELL_DBNAME_PROC(&data.zDbFilename); |
| 3683 | warnInmemoryDb = 0; } |
| 3684 | #endif |
| 3685 | } |
| 3686 | data.out = stdout; |
| 3687 | |
| 3688 | /* Go ahead and open the database file if it already exists. If the |
| 3689 | ** file does not exist, delay opening it. This prevents empty database |
| @@ -3706,10 +3735,12 @@ | |
| 3735 | data.showHeader = 1; |
| 3736 | }else if( strcmp(z,"-noheader")==0 ){ |
| 3737 | data.showHeader = 0; |
| 3738 | }else if( strcmp(z,"-echo")==0 ){ |
| 3739 | data.echoOn = 1; |
| 3740 | }else if( strcmp(z,"-eqp")==0 ){ |
| 3741 | data.autoEQP = 1; |
| 3742 | }else if( strcmp(z,"-stats")==0 ){ |
| 3743 | data.statsOn = 1; |
| 3744 | }else if( strcmp(z,"-bail")==0 ){ |
| 3745 | bail_on_error = 1; |
| 3746 | }else if( strcmp(z,"-version")==0 ){ |
| @@ -3788,12 +3819,12 @@ | |
| 3819 | "Enter \".help\" for usage hints.\n", |
| 3820 | sqlite3_libversion(), sqlite3_sourceid() |
| 3821 | ); |
| 3822 | if( warnInmemoryDb ){ |
| 3823 | printf("Connected to a "); |
| 3824 | printBold("transient in-memory database"); |
| 3825 | printf(".\nUse \".open FILENAME\" to reopen on a " |
| 3826 | "persistent database.\n"); |
| 3827 | } |
| 3828 | zHome = find_home_dir(); |
| 3829 | if( zHome ){ |
| 3830 | nHistory = strlen30(zHome) + 20; |
| 3831 |
+7
-7
| --- src/shun.c | ||
| +++ src/shun.c | ||
| @@ -69,11 +69,11 @@ | ||
| 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 | - /* 129 */ "IfNeg" OpHelp("if r[P1]<0 goto P2"), | |
| 23321 | - /* 130 */ "IfZero" OpHelp("r[P1]+=P3, if r[P1]==0 goto P2"), | |
| 23322 | - /* 131 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), | |
| 23323 | - /* 132 */ "IncrVacuum" OpHelp(""), | |
| 23417 | + /* 98 */ "RowKey" OpHelp("r[P2]=key"), | |
| 23418 | + /* 99 */ "RowData" OpHelp("r[P2]=data"), | |
| 23419 | + /* 100 */ "Rowid" OpHelp("r[P2]=rowid"), | |
| 23420 | + /* 101 */ "NullRow" OpHelp(""), | |
| 23421 | + /* 102 */ "Last" OpHelp(""), | |
| 23422 | + /* 103 */ "SorterSort" OpHelp(""), | |
| 23423 | + /* 104 */ "Sort" OpHelp(""), | |
| 23424 | + /* 105 */ "Rewind" OpHelp(""), | |
| 23425 | + /* 106 */ "SorterInsert" OpHelp(""), | |
| 23426 | + /* 107 */ "IdxInsert" OpHelp("key=r[P2]"), | |
| 23427 | + /* 108 */ "IdxDelete" OpHelp("key=r[P2@P3]"), | |
| 23428 | + /* 109 */ "IdxRowid" OpHelp("r[P2]=rowid"), | |
| 23429 | + /* 110 */ "IdxLE" OpHelp("key=r[P3@P4]"), | |
| 23430 | + /* 111 */ "IdxGT" OpHelp("key=r[P3@P4]"), | |
| 23431 | + /* 112 */ "IdxLT" OpHelp("key=r[P3@P4]"), | |
| 23432 | + /* 113 */ "IdxGE" OpHelp("key=r[P3@P4]"), | |
| 23433 | + /* 114 */ "Destroy" OpHelp(""), | |
| 23434 | + /* 115 */ "Clear" OpHelp(""), | |
| 23435 | + /* 116 */ "CreateIndex" OpHelp("r[P2]=root iDb=P1"), | |
| 23436 | + /* 117 */ "CreateTable" OpHelp("r[P2]=root iDb=P1"), | |
| 23437 | + /* 118 */ "ParseSchema" OpHelp(""), | |
| 23438 | + /* 119 */ "LoadAnalysis" OpHelp(""), | |
| 23439 | + /* 120 */ "DropTable" OpHelp(""), | |
| 23440 | + /* 121 */ "DropIndex" OpHelp(""), | |
| 23441 |