Fossil SCM
Updating from trunk to keep up working in the branch with the most recent fossil code.
Commit
75aaf30aadc5cb32b00a5694e56a9216c07f09a5
Parent
281e5121e7e91bf…
83 files changed
+38
-16
-3
+3
+9
+1
+2
+35
+1
+15
+73
+35
+314
+307
+1
+9
+144
+2
+80
+21
+3
+74
-21
+1
-1
+73
-36
+2
-2
+24
-8
+92
-15
+1
+17
-3
+5
-1
+1
+201
-52
+2
-2
+22
-16
+151
-36
+32
-6
+9
+4
-4
+2
-1
+61
-1
+11
-5
+9
-3
+16
-7
+32
-25
+3
-4
+10
-2
+1
-6
+5
+6
-2
+1
-1
+1
-1
+1
-1
+12
-2
+3777
-1278
+50
-23
+4
-2
+2
-1
+2
-1
+1
-1
+280
-29
+136
-20
+1
-1
+58
-2
+8
-20
+644
-9
+7
-1
+3
-3
+4
-4
+5
-5
+5
-5
-10
+63
-26
+1
+80
-16
+60
+4
+21
-15
+11
-6
+11
-1
+15
-7
+3
+6
+21
~
BUILD.txt
-
Makefile
~
Makefile.classic
+
Makefile.classic
~
Makefile.in
~
VERSION
~
auto.def
~
autosetup/LICENSE
~
autosetup/README.autosetup
~
autosetup/autosetup
~
autosetup/cc-lib.tcl
~
autosetup/cc-shared.tcl
~
autosetup/cc.tcl
~
autosetup/config.guess
~
autosetup/config.sub
~
autosetup/find-tclsh
~
autosetup/jimsh0.c
~
autosetup/local.tcl
~
autosetup/system.tcl
~
autosetup/test-tclsh
~
configure
~
src/add.c
~
src/blob.c
~
src/branch.c
~
src/browse.c
~
src/cgi.c
~
src/checkin.c
~
src/checkout.c
~
src/clone.c
~
src/config.h
~
src/configure.c
~
src/db.c
~
src/descendants.c
~
src/diffcmd.c
~
src/export.c
~
src/file.c
~
src/finfo.c
~
src/glob.c
~
src/http.c
~
src/http_ssl.c
~
src/info.c
~
src/main.c
~
src/main.mk
~
src/makemake.tcl
~
src/manifest.c
~
src/merge.c
~
src/mkversion.c
+
src/mkversion.c
~
src/popen.c
~
src/printf.c
~
src/rebuild.c
~
src/search.c
~
src/setup.c
~
src/sqlite3.c
~
src/sqlite3.h
~
src/stash.c
~
src/stat.c
~
src/style.c
~
src/tag.c
~
src/tar.c
~
src/timeline.c
~
src/tkt.c
~
src/update.c
~
src/wiki.c
~
src/winhttp.c
~
test/release-checklist.wiki
~
win/Makefile.PellesCGMake
~
win/Makefile.dmc
~
win/Makefile.mingw
~
win/Makefile.msc
-
win/version.c
~
www/build.wiki
~
www/changes.wiki
~
www/checkin.wiki
~
www/foss-cklist.wiki
~
www/index.wiki
~
www/makefile.wiki
~
www/mkindex.tcl
~
www/permutedindex.wiki
~
www/quickstart.wiki
~
www/server.wiki
~
www/settings.wiki
~
www/ssl.wiki
+38
-16
| --- BUILD.txt | ||
| +++ BUILD.txt | ||
| @@ -1,41 +1,60 @@ | ||
| 1 | -All of the source code for fossil is contained in the src/ subdirectory. | |
| 2 | -But there is a lot of generated code, so you will probably want to | |
| 3 | -use the Makefile. To do a complete build on unix, just type: | |
| 1 | +To do a complete build, just type: | |
| 2 | + | |
| 3 | + ./configure; make | |
| 4 | + | |
| 5 | +The ./configure script builds Makefile from Makefile.in based on | |
| 6 | +your system and any options you select (run "./configure --help" | |
| 7 | +for a listing of the available options.) | |
| 8 | + | |
| 9 | +If you wish to use the original Makefile with no configuration, you can | |
| 10 | +instead use: | |
| 4 | 11 | |
| 5 | - make | |
| 12 | + make -f Makefile.classic | |
| 6 | 13 | |
| 7 | 14 | On a windows box, use one of the Makefiles in the win/ subdirectory, |
| 8 | -according to your compiler and environment. For example: | |
| 15 | +according to your compiler and environment. If you have GCC and MSYS | |
| 16 | +installed on your system, then consider: | |
| 17 | + | |
| 18 | + make -f win/Makefile.mingw | |
| 19 | + | |
| 20 | +If you have VC++ installed on your system, then consider: | |
| 9 | 21 | |
| 10 | - make -f win/Makefile.w32 | |
| 22 | + cd win; nmake /f Makefile.msc | |
| 11 | 23 | |
| 12 | 24 | If you have trouble, or you want to do something fancy, just look at |
| 13 | -top level makefile. There are 6 configuration options that are all well | |
| 14 | -commented. Instead of editing the Makefile, consider copying the Makefile | |
| 15 | -to an alternative name such as "GNUMakefile", "BSDMakefile", or "makefile" | |
| 16 | -and editing the copy. | |
| 25 | +Makefile.classic. There are 6 configuration options that are all well | |
| 26 | +commented. Instead of editing the Makefile.classic, consider copying | |
| 27 | +Makefile.classic to an alternative name such as "GNUMakefile", | |
| 28 | +"BSDMakefile", or "makefile" and editing the copy. | |
| 17 | 29 | |
| 18 | 30 | |
| 19 | 31 | BUILDING OUTSIDE THE SOURCE TREE |
| 20 | 32 | |
| 21 | 33 | An out of source build is pretty easy: |
| 22 | 34 | |
| 23 | - 1. Make a new directory to do the builds in. | |
| 24 | - 2. Copy "Makefile" from the source into the build directory and | |
| 25 | - modify the SRCDIR macro along the lines of: | |
| 35 | + 1. Make and change to a new directory to do the builds in. | |
| 36 | + 2. Run the "configure" script from this directory. | |
| 37 | + 3. Type: "make" | |
| 38 | + | |
| 39 | +For example: | |
| 26 | 40 | |
| 27 | - SRCDIR=../src | |
| 28 | - | |
| 29 | - 3. type: "make" | |
| 41 | + mkdir build | |
| 42 | + cd build | |
| 43 | + ../configure | |
| 44 | + make | |
| 30 | 45 | |
| 31 | 46 | This will now keep all generates files seperate from the maintained |
| 32 | 47 | source code. |
| 33 | 48 | |
| 34 | 49 | -------------------------------------------------------------------------- |
| 35 | 50 | |
| 36 | 51 | Here are some notes on what is happening behind the scenes: |
| 52 | + | |
| 53 | +* The configure script (if used) examines the options given | |
| 54 | + and runs various tests with the C compiler to create Makefile | |
| 55 | + from the Makefile.in template as well as autoconfig.h | |
| 37 | 56 | |
| 38 | 57 | * The Makefile just sets up a few macros and then invokes the |
| 39 | 58 | real makefile in src/main.mk. The src/main.mk makefile is |
| 40 | 59 | automatically generated by a TCL script found at src/makemake.tcl. |
| 41 | 60 | Do not edit src/main.mk directly. Update src/makemake.tcl and |
| @@ -51,5 +70,8 @@ | ||
| 51 | 70 | A header comment in src/translate.c explains in detail what it does. |
| 52 | 71 | |
| 53 | 72 | * The src/mkindex.c program generates some C code that implements |
| 54 | 73 | static lookup tables. See the header comment in the source code |
| 55 | 74 | for details on what it does. |
| 75 | + | |
| 76 | +Additional information on the build process is available from | |
| 77 | +http://www.fossil-scm.org/fossil/doc/trunk/www/makefile.wiki | |
| 56 | 78 | |
| 57 | 79 | DELETED Makefile |
| 58 | 80 | ADDED Makefile.classic |
| 59 | 81 | ADDED Makefile.in |
| 60 | 82 | ADDED VERSION |
| 61 | 83 | ADDED auto.def |
| 62 | 84 | ADDED autosetup/LICENSE |
| 63 | 85 | ADDED autosetup/README.autosetup |
| 64 | 86 | ADDED autosetup/autosetup |
| 65 | 87 | ADDED autosetup/cc-lib.tcl |
| 66 | 88 | ADDED autosetup/cc-shared.tcl |
| 67 | 89 | ADDED autosetup/cc.tcl |
| 68 | 90 | ADDED autosetup/config.guess |
| 69 | 91 | ADDED autosetup/config.sub |
| 70 | 92 | ADDED autosetup/find-tclsh |
| 71 | 93 | ADDED autosetup/jimsh0.c |
| 72 | 94 | ADDED autosetup/local.tcl |
| 73 | 95 | ADDED autosetup/system.tcl |
| 74 | 96 | ADDED autosetup/test-tclsh |
| 75 | 97 | ADDED configure |
| --- BUILD.txt | |
| +++ BUILD.txt | |
| @@ -1,41 +1,60 @@ | |
| 1 | All of the source code for fossil is contained in the src/ subdirectory. |
| 2 | But there is a lot of generated code, so you will probably want to |
| 3 | use the Makefile. To do a complete build on unix, just type: |
| 4 | |
| 5 | make |
| 6 | |
| 7 | On a windows box, use one of the Makefiles in the win/ subdirectory, |
| 8 | according to your compiler and environment. For example: |
| 9 | |
| 10 | make -f win/Makefile.w32 |
| 11 | |
| 12 | If you have trouble, or you want to do something fancy, just look at |
| 13 | top level makefile. There are 6 configuration options that are all well |
| 14 | commented. Instead of editing the Makefile, consider copying the Makefile |
| 15 | to an alternative name such as "GNUMakefile", "BSDMakefile", or "makefile" |
| 16 | and editing the copy. |
| 17 | |
| 18 | |
| 19 | BUILDING OUTSIDE THE SOURCE TREE |
| 20 | |
| 21 | An out of source build is pretty easy: |
| 22 | |
| 23 | 1. Make a new directory to do the builds in. |
| 24 | 2. Copy "Makefile" from the source into the build directory and |
| 25 | modify the SRCDIR macro along the lines of: |
| 26 | |
| 27 | SRCDIR=../src |
| 28 | |
| 29 | 3. type: "make" |
| 30 | |
| 31 | This will now keep all generates files seperate from the maintained |
| 32 | source code. |
| 33 | |
| 34 | -------------------------------------------------------------------------- |
| 35 | |
| 36 | Here are some notes on what is happening behind the scenes: |
| 37 | |
| 38 | * The Makefile just sets up a few macros and then invokes the |
| 39 | real makefile in src/main.mk. The src/main.mk makefile is |
| 40 | automatically generated by a TCL script found at src/makemake.tcl. |
| 41 | Do not edit src/main.mk directly. Update src/makemake.tcl and |
| @@ -51,5 +70,8 @@ | |
| 51 | A header comment in src/translate.c explains in detail what it does. |
| 52 | |
| 53 | * The src/mkindex.c program generates some C code that implements |
| 54 | static lookup tables. See the header comment in the source code |
| 55 | for details on what it does. |
| 56 | |
| 57 | ELETED Makefile |
| 58 | DDED Makefile.classic |
| 59 | DDED Makefile.in |
| 60 | DDED VERSION |
| 61 | DDED auto.def |
| 62 | DDED autosetup/LICENSE |
| 63 | DDED autosetup/README.autosetup |
| 64 | DDED autosetup/autosetup |
| 65 | DDED autosetup/cc-lib.tcl |
| 66 | DDED autosetup/cc-shared.tcl |
| 67 | DDED autosetup/cc.tcl |
| 68 | DDED autosetup/config.guess |
| 69 | DDED autosetup/config.sub |
| 70 | DDED autosetup/find-tclsh |
| 71 | DDED autosetup/jimsh0.c |
| 72 | DDED autosetup/local.tcl |
| 73 | DDED autosetup/system.tcl |
| 74 | DDED autosetup/test-tclsh |
| 75 | DDED configure |
| --- BUILD.txt | |
| +++ BUILD.txt | |
| @@ -1,41 +1,60 @@ | |
| 1 | To do a complete build, just type: |
| 2 | |
| 3 | ./configure; make |
| 4 | |
| 5 | The ./configure script builds Makefile from Makefile.in based on |
| 6 | your system and any options you select (run "./configure --help" |
| 7 | for a listing of the available options.) |
| 8 | |
| 9 | If you wish to use the original Makefile with no configuration, you can |
| 10 | instead use: |
| 11 | |
| 12 | make -f Makefile.classic |
| 13 | |
| 14 | On a windows box, use one of the Makefiles in the win/ subdirectory, |
| 15 | according to your compiler and environment. If you have GCC and MSYS |
| 16 | installed on your system, then consider: |
| 17 | |
| 18 | make -f win/Makefile.mingw |
| 19 | |
| 20 | If you have VC++ installed on your system, then consider: |
| 21 | |
| 22 | cd win; nmake /f Makefile.msc |
| 23 | |
| 24 | If you have trouble, or you want to do something fancy, just look at |
| 25 | Makefile.classic. There are 6 configuration options that are all well |
| 26 | commented. Instead of editing the Makefile.classic, consider copying |
| 27 | Makefile.classic to an alternative name such as "GNUMakefile", |
| 28 | "BSDMakefile", or "makefile" and editing the copy. |
| 29 | |
| 30 | |
| 31 | BUILDING OUTSIDE THE SOURCE TREE |
| 32 | |
| 33 | An out of source build is pretty easy: |
| 34 | |
| 35 | 1. Make and change to a new directory to do the builds in. |
| 36 | 2. Run the "configure" script from this directory. |
| 37 | 3. Type: "make" |
| 38 | |
| 39 | For example: |
| 40 | |
| 41 | mkdir build |
| 42 | cd build |
| 43 | ../configure |
| 44 | make |
| 45 | |
| 46 | This will now keep all generates files seperate from the maintained |
| 47 | source code. |
| 48 | |
| 49 | -------------------------------------------------------------------------- |
| 50 | |
| 51 | Here are some notes on what is happening behind the scenes: |
| 52 | |
| 53 | * The configure script (if used) examines the options given |
| 54 | and runs various tests with the C compiler to create Makefile |
| 55 | from the Makefile.in template as well as autoconfig.h |
| 56 | |
| 57 | * The Makefile just sets up a few macros and then invokes the |
| 58 | real makefile in src/main.mk. The src/main.mk makefile is |
| 59 | automatically generated by a TCL script found at src/makemake.tcl. |
| 60 | Do not edit src/main.mk directly. Update src/makemake.tcl and |
| @@ -51,5 +70,8 @@ | |
| 70 | A header comment in src/translate.c explains in detail what it does. |
| 71 | |
| 72 | * The src/mkindex.c program generates some C code that implements |
| 73 | static lookup tables. See the header comment in the source code |
| 74 | for details on what it does. |
| 75 | |
| 76 | Additional information on the build process is available from |
| 77 | http://www.fossil-scm.org/fossil/doc/trunk/www/makefile.wiki |
| 78 | |
| 79 | ELETED Makefile |
| 80 | DDED Makefile.classic |
| 81 | DDED Makefile.in |
| 82 | DDED VERSION |
| 83 | DDED auto.def |
| 84 | DDED autosetup/LICENSE |
| 85 | DDED autosetup/README.autosetup |
| 86 | DDED autosetup/autosetup |
| 87 | DDED autosetup/cc-lib.tcl |
| 88 | DDED autosetup/cc-shared.tcl |
| 89 | DDED autosetup/cc.tcl |
| 90 | DDED autosetup/config.guess |
| 91 | DDED autosetup/config.sub |
| 92 | DDED autosetup/find-tclsh |
| 93 | DDED autosetup/jimsh0.c |
| 94 | DDED autosetup/local.tcl |
| 95 | DDED autosetup/system.tcl |
| 96 | DDED autosetup/test-tclsh |
| 97 | DDED configure |
D
Makefile
-3
| --- a/Makefile | ||
| +++ b/Makefile | ||
| @@ -1,3 +0,0 @@ | ||
| 1 | -#!/usr/bin/make | |
| 2 | -# | |
| 3 | -# This is tg the build. This is used |
| --- a/Makefile | |
| +++ b/Makefile | |
| @@ -1,3 +0,0 @@ | |
| 1 | #!/usr/bin/make |
| 2 | # |
| 3 | # This is tg the build. This is used |
| --- a/Makefile | |
| +++ b/Makefile | |
| @@ -1,3 +0,0 @@ | |
No diff available
+3
| --- a/Makefile.classic | ||
| +++ b/Makefile.classic | ||
| @@ -0,0 +1,3 @@ | ||
| 1 | +#!/usr/bin/make | |
| 2 | +# | |
| 3 | +# This is tg the build. This is used |
| --- a/Makefile.classic | |
| +++ b/Makefile.classic | |
| @@ -0,0 +1,3 @@ | |
| --- a/Makefile.classic | |
| +++ b/Makefile.classic | |
| @@ -0,0 +1,3 @@ | |
| 1 | #!/usr/bin/make |
| 2 | # |
| 3 | # This is tg the build. This is used |
+9
| --- a/Makefile.in | ||
| +++ b/Makefile.in | ||
| @@ -0,0 +1,9 @@ | ||
| 1 | + -D_HAVE_SQLITE_ssil-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -D_HAVE_SQLITE_ssil-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -fuzz -D_HAVE_SQLITE_ssil-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -D_HAVE_SQLITE_ssil-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -fuzzSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -D_HAVE_SQLITE_ssitclsh -DFOSSIL_ENABLE_LEGACY_MV_RM=1@CFLAGS@@CFLAGS@Rdi make source | |
| 2 | +# | |
| 3 | +# | |
| 4 | +OBJDIR = ./@P@1BE,N:fossil:@FOSSIL_CI_PFX -fuzz -D_HAVE_SQLITE_ssil-@FOSSILendif | |
| 5 | +ifeq ($(findstriSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -fuzz -D_HAVE_SQLITE$(MAKE) reconfig | |
| 6 | +endif | |
| 7 | +@AUTOREMAKE@ && $(MAKE) | |
| 8 | +endif | |
| 9 | +FOSSIL_ENABLE_M + |
| --- a/Makefile.in | |
| +++ b/Makefile.in | |
| @@ -0,0 +1,9 @@ | |
| --- a/Makefile.in | |
| +++ b/Makefile.in | |
| @@ -0,0 +1,9 @@ | |
| 1 | -D_HAVE_SQLITE_ssil-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -D_HAVE_SQLITE_ssil-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -fuzz -D_HAVE_SQLITE_ssil-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -D_HAVE_SQLITE_ssil-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -fuzzSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX-@FOSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -D_HAVE_SQLITE_ssitclsh -DFOSSIL_ENABLE_LEGACY_MV_RM=1@CFLAGS@@CFLAGS@Rdi make source |
| 2 | # |
| 3 | # |
| 4 | OBJDIR = ./@P@1BE,N:fossil:@FOSSIL_CI_PFX -fuzz -D_HAVE_SQLITE_ssil-@FOSSILendif |
| 5 | ifeq ($(findstriSSIL_CI_PFX@P@1BE,N:fossil:@FOSSIL_CI_PFX -fuzz -D_HAVE_SQLITE$(MAKE) reconfig |
| 6 | endif |
| 7 | @AUTOREMAKE@ && $(MAKE) |
| 8 | endif |
| 9 | FOSSIL_ENABLE_M + |
M
VERSION
+1
| --- a/VERSION | ||
| +++ b/VERSION | ||
| @@ -0,0 +1 @@ | ||
| 1 | +1.19 |
| --- a/VERSION | |
| +++ b/VERSION | |
| @@ -0,0 +1 @@ | |
| --- a/VERSION | |
| +++ b/VERSION | |
| @@ -0,0 +1 @@ | |
| 1 | 1.19 |
M
auto.def
+2
| --- a/auto.def | ||
| +++ b/auto.def | ||
| @@ -0,0 +1,2 @@ | ||
| 1 | +D markdown=0 => {Build with markdown enginemarkdown]} { | |
| 2 | +MARKDOWMARKDOWipv6=1 => |
| --- a/auto.def | |
| +++ b/auto.def | |
| @@ -0,0 +1,2 @@ | |
| --- a/auto.def | |
| +++ b/auto.def | |
| @@ -0,0 +1,2 @@ | |
| 1 | D markdown=0 => {Build with markdown enginemarkdown]} { |
| 2 | MARKDOWMARKDOWipv6=1 => |
+35
| --- a/autosetup/LICENSE | ||
| +++ b/autosetup/LICENSE | ||
| @@ -0,0 +1,35 @@ | ||
| 1 | +Unless explicitly stated, all files which form part of autosetup | |
| 2 | +are released under the following license: | |
| 3 | + | |
| 4 | +--------------------------------------------------------------------- | |
| 5 | +autosetup - A build environment "autoconfigurator" | |
| 6 | + | |
| 7 | +Copyright (c) 2010-2011, WorkWare Systems <http://workware.net.au/> | |
| 8 | + | |
| 9 | +Redistribution and use in source and binary forms, with or without | |
| 10 | +modification, are permitted provided that the following conditions | |
| 11 | +are met: | |
| 12 | + | |
| 13 | +1. Redistributions of source code must retain the above copyright | |
| 14 | + notice, this list of conditions and the following disclaimer. | |
| 15 | +2. Redistributions in binary form must reproduce the above | |
| 16 | + copyright notice, this list of conditions and the following | |
| 17 | + disclaimer in the documentation and/or other materials | |
| 18 | + provided with the distribution. | |
| 19 | + | |
| 20 | +THIS SOFTWARE IS PROVIDED BY THE WORKWARE SYSTEMS ``AS IS'' AND ANY | |
| 21 | +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
| 22 | +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | |
| 23 | +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WORKWARE | |
| 24 | +SYSTEMS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
| 25 | +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 26 | +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 27 | +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 28 | +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
| 29 | +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 30 | +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | + | |
| 33 | +The views and conclusions contained in the software and documentation | |
| 34 | +are those of the authors and should not be interpreted as representing | |
| 35 | +official policies, either expressed or implied, of WorkWare Systems. |
| --- a/autosetup/LICENSE | |
| +++ b/autosetup/LICENSE | |
| @@ -0,0 +1,35 @@ | |
| --- a/autosetup/LICENSE | |
| +++ b/autosetup/LICENSE | |
| @@ -0,0 +1,35 @@ | |
| 1 | Unless explicitly stated, all files which form part of autosetup |
| 2 | are released under the following license: |
| 3 | |
| 4 | --------------------------------------------------------------------- |
| 5 | autosetup - A build environment "autoconfigurator" |
| 6 | |
| 7 | Copyright (c) 2010-2011, WorkWare Systems <http://workware.net.au/> |
| 8 | |
| 9 | Redistribution and use in source and binary forms, with or without |
| 10 | modification, are permitted provided that the following conditions |
| 11 | are met: |
| 12 | |
| 13 | 1. Redistributions of source code must retain the above copyright |
| 14 | notice, this list of conditions and the following disclaimer. |
| 15 | 2. Redistributions in binary form must reproduce the above |
| 16 | copyright notice, this list of conditions and the following |
| 17 | disclaimer in the documentation and/or other materials |
| 18 | provided with the distribution. |
| 19 | |
| 20 | THIS SOFTWARE IS PROVIDED BY THE WORKWARE SYSTEMS ``AS IS'' AND ANY |
| 21 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
| 23 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WORKWARE |
| 24 | SYSTEMS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
| 25 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 27 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 28 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 29 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 31 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 32 | |
| 33 | The views and conclusions contained in the software and documentation |
| 34 | are those of the authors and should not be interpreted as representing |
| 35 | official policies, either expressed or implied, of WorkWare Systems. |
| --- a/autosetup/README.autosetup | ||
| +++ b/autosetup/README.autosetup | ||
| @@ -0,0 +1 @@ | ||
| 1 | +This is autosetup v0.6.2. S |
| --- a/autosetup/README.autosetup | |
| +++ b/autosetup/README.autosetup | |
| @@ -0,0 +1 @@ | |
| --- a/autosetup/README.autosetup | |
| +++ b/autosetup/README.autosetup | |
| @@ -0,0 +1 @@ | |
| 1 | This is autosetup v0.6.2. S |
+15
| --- a/autosetup/autosetup | ||
| +++ b/autosetup/autosetup | ||
| @@ -0,0 +1,15 @@ | ||
| 1 | +#!/bin/sh | |
| 2 | +4 => "create an initial 'confbool init]$source#!/bin/sh | |
| 3 | +parray define | |
| 4 | + } else { | |
| 5 | + return $alias | |
| 6 | + }[error-location $msg]use cc cc-shareduplevel #0#!/bin/sh | |
| 7 | +${m}.tcl | |
| 8 | +uplevel #0 [list source $source]put2put3 "Looking for $source"![string m 2>/dev/null} { | |
| 9 | + set create_configure 1Use --initset cre#!/bin/sh | |
| 10 | +4 => "creat # Jim uses system() for exec under mingw, so | |
| 11 | + # we need to fetch the output ourselves | |
| 12 | + set tmpfile auto[format %04x [rand 10000]].tmp | |
| 13 | + set rc [catch [list exec {*}$readfile $tmpfile] | |
| 14 | + file delete $tmpfile | |
| 15 | + return -code $rc $result |
| --- a/autosetup/autosetup | |
| +++ b/autosetup/autosetup | |
| @@ -0,0 +1,15 @@ | |
| --- a/autosetup/autosetup | |
| +++ b/autosetup/autosetup | |
| @@ -0,0 +1,15 @@ | |
| 1 | #!/bin/sh |
| 2 | 4 => "create an initial 'confbool init]$source#!/bin/sh |
| 3 | parray define |
| 4 | } else { |
| 5 | return $alias |
| 6 | }[error-location $msg]use cc cc-shareduplevel #0#!/bin/sh |
| 7 | ${m}.tcl |
| 8 | uplevel #0 [list source $source]put2put3 "Looking for $source"![string m 2>/dev/null} { |
| 9 | set create_configure 1Use --initset cre#!/bin/sh |
| 10 | 4 => "creat # Jim uses system() for exec under mingw, so |
| 11 | # we need to fetch the output ourselves |
| 12 | set tmpfile auto[format %04x [rand 10000]].tmp |
| 13 | set rc [catch [list exec {*}$readfile $tmpfile] |
| 14 | file delete $tmpfile |
| 15 | return -code $rc $result |
+73
| --- a/autosetup/cc-lib.tcl | ||
| +++ b/autosetup/cc-lib.tcl | ||
| @@ -0,0 +1,73 @@ | ||
| 1 | +# Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/ | |
| 2 | +# All rights reserved | |
| 3 | + | |
| 4 | +# @synopsis: | |
| 5 | +# | |
| 6 | +# Provides a library of common tests on top ofmodule-options {}of the 'cc' module. | |
| 7 | + | |
| 8 | +use cc | |
| 9 | + | |
| 10 | +# @cc-check-lfsAC_SYS_LARGEFILE macro | |
| 11 | +# | |
| 12 | +# defines 'HAVE_LFS' if L S is available, | |
| 13 | +# and defines '_FILE_OFFSET_BITS=64' if necessary | |
| 14 | +# | |
| 15 | +# Returns 1 if 'LFS' is available or 0 otherwise | |
| 16 | +# | |
| 17 | +proc cc-check-lfs {} { | |
| 18 | + cc-check-includes sys/types.h | |
| 19 | + msg-checking "Checking if -D_FILE_OFFSET_BITS=64 is needed..." | |
| 20 | + set lfs 1 | |
| 21 | + if {[msg-quiet cc-with {-includes sys/types.h} {cc-check-sizeof off_t}] == 8} { | |
| 22 | + msg-result no | |
| 23 | + } elseif {[msg-quiet cc-with {-includes sys/types.h -cflags -D_FILE_OFFSET_BITS=64} {cc-check-sizeof off_t}] == 8} { | |
| 24 | + define _FILE_OFFSET_BITS 64 | |
| 25 | + msg-result yes | |
| 26 | + } else { | |
| 27 | + set lfs 0 | |
| 28 | + msg-result none | |
| 29 | + } | |
| 30 | + define-feature lfs $lfs | |
| 31 | + return $lfs | |
| 32 | +} | |
| 33 | + | |
| 34 | +# @cc-check-endian | |
| 35 | +# | |
| 36 | +# The equivalent of th eAC_C_BIGENDIAN macroth e 'AC_C_BIGENDIAN' macro. | |
| 37 | +# | |
| 38 | +# defines 'HAVE_BIG_ENDIAN' if endian is known to be big, | |
| 39 | +# or 'HAVE_LITTLE_ENDIAN' if endian is known to be little. | |
| 40 | +# | |
| 41 | +# Returns 1 if determined, or 0 if not. | |
| 42 | +# | |
| 43 | +proc cc-check-endian {} { | |
| 44 | + cc-check-includes sys/types.h sys/param.h | |
| 45 | + set rc 0 | |
| 46 | + msg-checking "Checking endian..." | |
| 47 | + cc-with {-includes {sys/types.h sys/param.h}} { | |
| 48 | + if {[cctest -code { | |
| 49 | + #if !defined(BIG_ENDIAN) || !defined(BYTE_ORDER) | |
| 50 | + #error unknown | |
| 51 | + #elif BYTE_ORDER != BIG_ENDIAN | |
| 52 | + #error little | |
| 53 | + #endif | |
| 54 | + }]} { | |
| 55 | + define-feature big-endian | |
| 56 | + msg-result "big" | |
| 57 | + set rc 1 | |
| 58 | + } elseif {[cctest -code { | |
| 59 | + #if !defined(LITTLE_ENDIAN) || !defined(BYTE_ORDER) | |
| 60 | + #error unknown | |
| 61 | + #elif BYTE_ORDER != LITTLE_ENDIAN | |
| 62 | + #error big | |
| 63 | + #endif | |
| 64 | + }]} { | |
| 65 | + define-feature little-endian | |
| 66 | + msg-result "little" | |
| 67 | + set rc 1 | |
| 68 | + } else { | |
| 69 | + msg-result "unknown" | |
| 70 | + } | |
| 71 | + } | |
| 72 | + return $rc | |
| 73 | +} |
| --- a/autosetup/cc-lib.tcl | |
| +++ b/autosetup/cc-lib.tcl | |
| @@ -0,0 +1,73 @@ | |
| --- a/autosetup/cc-lib.tcl | |
| +++ b/autosetup/cc-lib.tcl | |
| @@ -0,0 +1,73 @@ | |
| 1 | # Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/ |
| 2 | # All rights reserved |
| 3 | |
| 4 | # @synopsis: |
| 5 | # |
| 6 | # Provides a library of common tests on top ofmodule-options {}of the 'cc' module. |
| 7 | |
| 8 | use cc |
| 9 | |
| 10 | # @cc-check-lfsAC_SYS_LARGEFILE macro |
| 11 | # |
| 12 | # defines 'HAVE_LFS' if L S is available, |
| 13 | # and defines '_FILE_OFFSET_BITS=64' if necessary |
| 14 | # |
| 15 | # Returns 1 if 'LFS' is available or 0 otherwise |
| 16 | # |
| 17 | proc cc-check-lfs {} { |
| 18 | cc-check-includes sys/types.h |
| 19 | msg-checking "Checking if -D_FILE_OFFSET_BITS=64 is needed..." |
| 20 | set lfs 1 |
| 21 | if {[msg-quiet cc-with {-includes sys/types.h} {cc-check-sizeof off_t}] == 8} { |
| 22 | msg-result no |
| 23 | } elseif {[msg-quiet cc-with {-includes sys/types.h -cflags -D_FILE_OFFSET_BITS=64} {cc-check-sizeof off_t}] == 8} { |
| 24 | define _FILE_OFFSET_BITS 64 |
| 25 | msg-result yes |
| 26 | } else { |
| 27 | set lfs 0 |
| 28 | msg-result none |
| 29 | } |
| 30 | define-feature lfs $lfs |
| 31 | return $lfs |
| 32 | } |
| 33 | |
| 34 | # @cc-check-endian |
| 35 | # |
| 36 | # The equivalent of th eAC_C_BIGENDIAN macroth e 'AC_C_BIGENDIAN' macro. |
| 37 | # |
| 38 | # defines 'HAVE_BIG_ENDIAN' if endian is known to be big, |
| 39 | # or 'HAVE_LITTLE_ENDIAN' if endian is known to be little. |
| 40 | # |
| 41 | # Returns 1 if determined, or 0 if not. |
| 42 | # |
| 43 | proc cc-check-endian {} { |
| 44 | cc-check-includes sys/types.h sys/param.h |
| 45 | set rc 0 |
| 46 | msg-checking "Checking endian..." |
| 47 | cc-with {-includes {sys/types.h sys/param.h}} { |
| 48 | if {[cctest -code { |
| 49 | #if !defined(BIG_ENDIAN) || !defined(BYTE_ORDER) |
| 50 | #error unknown |
| 51 | #elif BYTE_ORDER != BIG_ENDIAN |
| 52 | #error little |
| 53 | #endif |
| 54 | }]} { |
| 55 | define-feature big-endian |
| 56 | msg-result "big" |
| 57 | set rc 1 |
| 58 | } elseif {[cctest -code { |
| 59 | #if !defined(LITTLE_ENDIAN) || !defined(BYTE_ORDER) |
| 60 | #error unknown |
| 61 | #elif BYTE_ORDER != LITTLE_ENDIAN |
| 62 | #error big |
| 63 | #endif |
| 64 | }]} { |
| 65 | define-feature little-endian |
| 66 | msg-result "little" |
| 67 | set rc 1 |
| 68 | } else { |
| 69 | msg-result "unknown" |
| 70 | } |
| 71 | } |
| 72 | return $rc |
| 73 | } |
+35
| --- a/autosetup/cc-shared.tcl | ||
| +++ b/autosetup/cc-shared.tcl | ||
| @@ -0,0 +1,35 @@ | ||
| 1 | +# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ | |
| 2 | +# All rights reserved | |
| 3 | + | |
| 4 | +# @synopsis: | |
| 5 | +# | |
| 6 | +# The 'cc-shared' module provides support for shared libraries and shared objects. | |
| 7 | +# It defines the following variables: | |
| 8 | +# | |
| 9 | +## SH_CFLAGS Flags to use compiling sources destined for a shared library | |
| 10 | +## SH_LDFLAGS Flags to use linking t the soname when cread libs - %s = version | |
| 11 | +## SHOBJ_CFLAGS Flags to use compiling sources destined for a shared object | |
| 12 | +## ll symbols table, %s = path | |
| 13 | +## SH_LINKFLAGS Flags to use linking an executable which will load shared objects | |
| 14 | +## LD_LIBRARY_PATH Environment variable which specifie | |
| 15 | +module-options {} | |
| 16 | + | |
| 17 | +foreach i {SH_LINKFLAGS SH_CFLAGS SH_LDFLAGS SHOBJ_CFLAGS SHOBJ_LLD_LIBRARY_PATH define SHOBJ_LDFLAGS_R -bobject | |
| 18 | +## SHOBJ_LDFLAGS Flags to are System# Copyright ( Flags to usDYLD_LIBRARY_PATH | |
| 19 | + } | |
| 20 | + *-*-ming* {sharedOBJ_LDFLAGSshared} | |
| 21 | + *-*-solaris* { | |
| 22 | +# Copyright (c) 20mwed | |
| 23 | +## SHOBJ_LD-Kpic Flags to us-Kpic"-G" | |
| 24 | +define LD_LIBthe toolch-strip-unneeded | |
| 25 | + | |
| 26 | +# Note: Thiain | |
| 27 | +# http://sourceforge sparc* { | |
| 28 | +AGS SHOBJ_LDFLAGS_rdynamicference for identify-fPICshared Flags to us-fPIC} | |
| 29 | + * { | |
| 30 | + # Generic Unix settingsstems http://www.workwa# Copyrigference for identifying the toolchain | |
| 31 | +# http://sourceforge.net/apps/mediawiki/predef/ define SHOBJ_LDFLAGS_R -bobject | |
| 32 | +## SHOBJ_LDFLAGS Flags to us-fpshared Flags to us-fpicf/ define SHOBJ_LDFLAGS_R -bobject | |
| 33 | +## SHOBJ_LDFLAGS Flags to us"-shared -nostartfiles" | |
| 34 | + } | |
| 35 | +} |
| --- a/autosetup/cc-shared.tcl | |
| +++ b/autosetup/cc-shared.tcl | |
| @@ -0,0 +1,35 @@ | |
| --- a/autosetup/cc-shared.tcl | |
| +++ b/autosetup/cc-shared.tcl | |
| @@ -0,0 +1,35 @@ | |
| 1 | # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ |
| 2 | # All rights reserved |
| 3 | |
| 4 | # @synopsis: |
| 5 | # |
| 6 | # The 'cc-shared' module provides support for shared libraries and shared objects. |
| 7 | # It defines the following variables: |
| 8 | # |
| 9 | ## SH_CFLAGS Flags to use compiling sources destined for a shared library |
| 10 | ## SH_LDFLAGS Flags to use linking t the soname when cread libs - %s = version |
| 11 | ## SHOBJ_CFLAGS Flags to use compiling sources destined for a shared object |
| 12 | ## ll symbols table, %s = path |
| 13 | ## SH_LINKFLAGS Flags to use linking an executable which will load shared objects |
| 14 | ## LD_LIBRARY_PATH Environment variable which specifie |
| 15 | module-options {} |
| 16 | |
| 17 | foreach i {SH_LINKFLAGS SH_CFLAGS SH_LDFLAGS SHOBJ_CFLAGS SHOBJ_LLD_LIBRARY_PATH define SHOBJ_LDFLAGS_R -bobject |
| 18 | ## SHOBJ_LDFLAGS Flags to are System# Copyright ( Flags to usDYLD_LIBRARY_PATH |
| 19 | } |
| 20 | *-*-ming* {sharedOBJ_LDFLAGSshared} |
| 21 | *-*-solaris* { |
| 22 | # Copyright (c) 20mwed |
| 23 | ## SHOBJ_LD-Kpic Flags to us-Kpic"-G" |
| 24 | define LD_LIBthe toolch-strip-unneeded |
| 25 | |
| 26 | # Note: Thiain |
| 27 | # http://sourceforge sparc* { |
| 28 | AGS SHOBJ_LDFLAGS_rdynamicference for identify-fPICshared Flags to us-fPIC} |
| 29 | * { |
| 30 | # Generic Unix settingsstems http://www.workwa# Copyrigference for identifying the toolchain |
| 31 | # http://sourceforge.net/apps/mediawiki/predef/ define SHOBJ_LDFLAGS_R -bobject |
| 32 | ## SHOBJ_LDFLAGS Flags to us-fpshared Flags to us-fpicf/ define SHOBJ_LDFLAGS_R -bobject |
| 33 | ## SHOBJ_LDFLAGS Flags to us"-shared -nostartfiles" |
| 34 | } |
| 35 | } |
+314
| --- a/autosetup/cc.tcl | ||
| +++ b/autosetup/cc.tcl | ||
| @@ -0,0 +1,314 @@ | ||
| 1 | +# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ | |
| 2 | +# All rights reserved | |
| 3 | + | |
| 4 | +# @synopsis: | |
| 5 | +# | |
| 6 | +# The 'cc' module supports checking various 'features' of the C or C++ | |
| 7 | +# compiler/linker environment. Common commands are , | |
| 8 | +# cc-check-types, cc-check-functions, cc-with, make-autoconf-h and make-templatement variables are used if set: | |
| 9 | +# | |
| 10 | +## CC - C compiler | |
| 11 | +## CXX - C++ compiler | |
| 12 | +## CPP - C preprocessor | |
| 13 | +##CACHE - Set to "none" to disable automatic use of ccache | |
| 14 | +## Ciler flags | |
| 15 | +## CXXFLAGS - Additional C++ compiler flags | |
| 16 | +## LDFLAGS - Additional compiler flags during linking | |
| 17 | +## LINKFLAGS - ?How is this diffes to use (for all tests) | |
| 18 | +## CROSS - Tool prefix for cross compilation | |
| 19 | +# | |
| 20 | +# The following variables are defined from the corresponding | |
| 21 | +# environment variables if set. | |
| 22 | +# | |
| 23 | +## CC_FOR_BUILD | |
| 24 | +## LD | |
| 25 | + | |
| 26 | +use systPPFLAGS | |
| 27 | +## LINKFLAGSmodule-options {} | |
| 28 | + | |
| 29 | +# Checks for the existence of the giveNote that the return code is not meaningful | |
| 30 | +proc cc-check-something {name code} { | |
| 31 | + uplevel 1 $codee given type/strunction {function} { | |
| 32 | + cctest -link 1 -declare "extern void $function\(void);" -code "$function\();" | |
| 33 | +} | |
| 34 | + | |
| 35 | +# Checks for the existence of the given type by compiling | |
| 36 | +proc cctest_type {type} { | |
| 37 | + cctest -code "$type _x;" | |
| 38 | +} | |
| 39 | + | |
| 40 | +# Checks for the existence of the given type/structure member. | |
| 41 | +# e.g. "struct stat.st_mtime" | |
| 42 | +proc cctest_member {struct_member} { | |
| 43 | + # split at the first dot | |
| 44 | + regexp {^([^.]+)[.](.*)$} $lassign me;\n#endif" | |
| 45 | +} | |
| 46 | + | |
| 47 | +# @cc-ch | |
| 48 | +# e.g. "struct stypeses a variable with the 4 8 1 2 16 32} { | |
| 49 | + if {[cctest -code "static int _x\[sizeof($type) == $i ? 1 : -1\] = { 1 };"]} { | |
| 50 | + set size $i | |
| 51 | + break | |
| 52 | + } | |
| 53 | + } | |
| 54 | + msg-result $size | |
| 55 | + set define [feature-define-name $type SIZEOF_] | |
| 56 | + define $define $size | |
| 57 | + } | |
| 58 | + # Return the last result | |
| 59 | + get-define $define | |
| 60 | +} | |
| 61 | + | |
| 62 | +# Checks for each feature in $list by using the given script. | |
| 63 | +# | |
| 64 | +# When the script is evaluated, $each is set to the feature | |
| 65 | +# being checked, and $extra is set to any additional cctest args. | |
| 66 | +# | |
| 67 | +# Returns 1 if all features were found, or 0 otherwise. | |
| 68 | +proc cc-check-some-feature {list script} { | |
| 69 | + set ret 1 | |
| 70 | + foreach each $list { | |
| 71 | + if {![check-feature $each $script]} { | |
| 72 | + set ret 0 | |
| 73 | + } | |
| 74 | + } | |
| 75 | + return $ret | |
| 76 | +} | |
| 77 | + | |
| 78 | +# @cc-check-includes includes ... | |
| 79 | +# | |
| 80 | +# Checks that the given include files can be used. | |
| 81 | +proc cc-check-includes {args} { | |
| 82 | + c | |
| 83 | +procproc cctest_define {cc-check-some-xp {^([^.]+)[.](.*)$} $struct_member -> struct member | |
| 84 | + cctest -code "static $struct _s; return sizeof(_s.$member);" | |
| 85 | +} | |
| 86 | + | |
| 87 | +# Checks for the existence of the given define by compiling | |
| 88 | +# | |
| 89 | +proc cctest_define {name} { | |
| 90 | + cctest -code "#ifndef $name\n#error not defined\n#endif" | |
| 91 | +} | |
| 92 | + | |
| 93 | +# Checks forcks that the given include files can be used. | |
| 94 | +proc cc-check-includes {args} { | |
| 95 | + cc-check-some-feature $args { | |
| 96 | + set with {} | |
| 97 | + if {[dict exists $::autosetup(cc-include-deps) $each]} { | |
| 98 | + set deps! cc-check-include$exeecks tha]} { | |
| 99 | + cc-with [list -includes $w } | |
| 100 | + define $TOOL $exeed if set: | |
| 101 | +# | |
| 102 | +## CC | |
| 103 | +# @synopsis: | |
| 104 | +# | |
| 105 | +# The 'cc' module supports checking various 'features' of the C or C++ | |
| 106 | +# compiler/linker environment. Common commands are , | |
| 107 | +# cc-check-types, cc-check-functions, cc-with, make-autoconf-h and make-templatement variables are used if set: | |
| 108 | +# | |
| 109 | +## CC - C compiler | |
| 110 | +## CXX - C++ compiler | |
| 111 | +## CPP - C preprocessor | |
| 112 | +##CACHE - Set to "none" to disable automatic use of ccache | |
| 113 | +## Ciler flags | |
| 114 | +## CXXFLAGS - Additional C++ compiler flags | |
| 115 | +## LDFLAGS - Additional compiler flags during linking | |
| 116 | +## LINKFLAGS - ?How is this diffes to use (for all tests) | |
| 117 | +## CROSS - Tool prefix for cross compilation | |
| 118 | +# | |
| 119 | +# The following variables are defined from the corresponding | |
| 120 | +# environment variables if set. | |
| 121 | +# | |
| 122 | +## CC_FOR_BUILD | |
| 123 | +## LD | |
| 124 | + | |
| 125 | +use systPPFLAGS | |
| 126 | +## LINKFLAGSmodule-options {} | |
| 127 | + | |
| 128 | +# Checks for the existence of the giveNote that the return code is not meaningful | |
| 129 | +proc cc-check-something {name code} { | |
| 130 | + uplevel 1 $codee given type/strunction {function} { | |
| 131 | + cctest -link 1 -declare "extern void $function\(void);" -code "$function\();" | |
| 132 | +} | |
| 133 | + | |
| 134 | +# Checks for the existence of the given type by compiling | |
| 135 | +proc cctest_type {type} { | |
| 136 | + cctest -code "$type _x;" | |
| 137 | +} | |
| 138 | + | |
| 139 | +# Checks for the existence of the given type/structure member. | |
| 140 | +# e.g. "struct stat.st_mtime" | |
| 141 | +proc cctest_member {struct_member} { | |
| 142 | + # split at the first dot | |
| 143 | + regexp {^([^.]+)[.](.*)$} $lassign [split $struct_member .]rn sizeof(_s.$member);" | |
| 144 | +} | |
| 145 | + | |
| 146 | +# Checks for the existence of the given define by compiling | |
| 147 | +# | |
| 148 | +proc cctest_define {name} { | |
| 149 | + cctest -code "#ifndef $name\n#error not defined\n#endif" | |
| 150 | +} | |
| 151 | + | |
| 152 | +# Checks for the existence of the given name either as | |
| 153 | +# a macro (#define) or an rvalue (such as an enum) | |
| 154 | +# | |
| 155 | +proc cctest_decl {name} { | |
| 156 | + cctest -code "#ifndef $name\n(void)$name;\n#endif" | |
| 157 | +} | |
| 158 | + | |
| 159 | +# @cc-check-sizeof type ... | |
| 160 | +# | |
| 161 | +# Checks the size of the given types (between 1 and 32, inclusive). | |
| 162 | +# Defines a variable with the size determined, or 'unknown'"unknown"ng', defines 'SIZEOF_LSIZEOF_LONG_LONGe. | |
| 163 | +# | |
| 164 | +proc cc-check-sizeof {args} { | |
| 165 | + foreach type $args { | |
| 166 | + msg-checking "Checking for sizeof $type..." | |
| 167 | + set size unknown | |
| 168 | + # Try the most common sizes first | |
| 169 | + foreach i {4 8 1 2 16 32} { | |
| 170 | + if {[cctest -code "static int _x\[sizeof($type) == $i ? 1 : -1\] = { 1 };"]} { | |
| 171 | + set size $i | |
| 172 | + break | |
| 173 | + } | |
| 174 | + } | |
| 175 | + msg-result $size | |
| 176 | + set define [feature-define-name $type SIZEOF_] | |
| 177 | + define $define $size | |
| 178 | + } | |
| 179 | + # Return the last result | |
| 180 | + get-define $define | |
| 181 | +} | |
| 182 | + | |
| 183 | +# Checks for each feature in $list by using the given script. | |
| 184 | +# | |
| 185 | +# When the script is evaluated, $each is set to the feature | |
| 186 | +# being checked, and $extra is set to any additional cctest args. | |
| 187 | +# | |
| 188 | +# Returns 1 if all features were found, or 0 otherwise. | |
| 189 | +proc cc-check-some-feature {list script} { | |
| 190 | + set ret 1 | |
| 191 | + foreach each $list { | |
| 192 | + if {![check-feature $each $script]} { | |
| 193 | + set ret 0 | |
| 194 | + } | |
| 195 | + } | |
| 196 | + return $ret | |
| 197 | +} | |
| 198 | + | |
| 199 | +# @cc-check-includes includes ... | |
| 200 | +# | |
| 201 | +# Checks that the given include files can be used. | |
| 202 | +proc cc-check-includes {args} { | |
| 203 | + c | |
| 204 | +procproc cctest_define {cc-check-some-xp {^([^.]+)[.](.*)$} $struct_member -> struct member | |
| 205 | + cctest -code "static $struct _s; return sizeof(_s.$member);" | |
| 206 | +} | |
| 207 | + | |
| 208 | +# Checks for the existence of the given define by compiling | |
| 209 | +# | |
| 210 | +proc cctest_define {name} { | |
| 211 | + cctest -code "#ifndef $name\n#error not defined\n#endif" | |
| 212 | +} | |
| 213 | + | |
| 214 | +# Checks for the existence of the given name either as | |
| 215 | +# a macro (#define) or an rvalue (such as an enum) | |
| 216 | +# | |
| 217 | +proc cctest_decl {name} { | |
| 218 | + cctest -code "#ifndef $name\n(void)$name;\n#endif" | |
| 219 | +} | |
| 220 | + given types (bet#includeddetermined, or 'unknown' otherwise. | |
| 221 | +# e.g. for type 'long long', defines 'SIZEOF_LONG_LONG'. | |
| 222 | +# Returns the size of the last type. | |
| 223 | +# | |
| 224 | +proc cc-check-sizeof {args} { | |
| 225 | + foreach type $adfirst dot | |
| 226 | + regexp {^([^.]+)[.](.*)$} $struct_member -> struct member | |
| 227 | + cctest -code "static $struct _s; return sizeof(_s.$member);" | |
| 228 | +} | |
| 229 | + | |
| 230 | +# Checks for the existence of the given define by compiling | |
| 231 | +# | |
| 232 | +proc cctest_define FLAGS - ?How is this di# @synopsis: | |
| 233 | +# | |
| 234 | +# The 'cc' module supports checking various 'features' of the C or C++ | |
| 235 | +# compiler/linker environment. Common commands are , | |
| 236 | +# cc-check-types, cc-check-functions, cc-with, make-autoconf-h and make-templatement variables are used if set: | |
| 237 | +# | |
| 238 | +## CC - C compiler | |
| 239 | +## CXX - C++ compiler | |
| 240 | +## CPP - C preprocessor | |
| 241 | +##CACHE - Set to "none" to disfor a declsable automatic use of ccache | |
| 242 | +## Ciler flags | |
| 243 | +## C# Copyright (c) 2010 Work foreach type $args { | |
| 244 | + msg-checking "Checking for sizeof $type..." | |
| 245 | + set size unknown | |
| 246 | + # Try the most common sizes first | |
| 247 | + foreach i {4 8 1 2 16 32} { | |
| 248 | + if {[cctest -code "static int _x\[sizeof($type) == $i ? 1 : -1\] = { 1 };"]} { | |
| 249 | + set size $i | |
| 250 | + break | |
| 251 | + } | |
| 252 | + } | |
| 253 | + msg-result $size | |
| 254 | + set define [feature-define-name $type SIZEOF_] | |
| 255 | + define $define $size | |
| 256 | + } | |
| 257 | + # Return the last result | |
| 258 | + get-define $define | |
| 259 | +} | |
| 260 | + | |
| 261 | +# Checks for each feature in $list by using the given script. | |
| 262 | +# | |
| 263 | +# When the script is evaluated, $each is set to the feature | |
| 264 | +# being checked, and $extra is set to any additional cctest args. | |
| 265 | +# | |
| 266 | +# Returns 1 if all features were found, or 0 otherwise. | |
| 267 | +proc cc-check-some-feature {list script} { | |
| 268 | + set ret 1ch $script]} { | |
| 269 | + set ret 0 | |
| 270 | + } | |
| 271 | + } | |
| 272 | + return $ret | |
| 273 | +} | |
| 274 | + | |
| 275 | +# @cc-check-includes includes ... | |
| 276 | +# | |
| 277 | +# Checks that the given include files can be used. | |
| 278 | +proc cc-check-includes {args} { | |
| 279 | + cc-check-some-feature $args { | |
| 280 | + set with {} | |
| 281 | + if {[dict exists $::autosetup(cc-include-deps) $each]} { | |
| 282 | + set deps [dict keys [dict get $::autosetup(cc-include-deps) $each]] | |
| 283 | + msg-quiet cc-check-includes {*}$deps | |
| 284 | + foreach i $deps { | |
| 285 | + if {[have-feature $i]} { | |
| 286 | + lappend with $i | |
| 287 | +ure $each $scriptargs { | |
| 288 | + set new($name) $value | |
| 289 | + } $i]} { | |
| 290 | + lappend$newme\n(void)$name;\n#th]} { | |
| 291 | + cc-with [list -includes $with] { | |
| 292 | + cctest -includes $each | |
| 293 | + } | |
| 294 | + } else { | |
| 295 | + cctest -includes $each | |
| 296 | + } | |
| 297 | + } | |
| 298 | +} | |
| 299 | + | |
| 300 | +# @cc-include-needs include required ... | |
| 301 | +# | |
| 302 | +# Ensures that when checking for '$include', a check is first | |
| 303 | +# made for eachtk is first | |
| 304 | +# made for each '$required' file, and if found, it is included with '#include'. | |
| 305 | +proc cc-include-needs {file args} { | |
| 306 | + foreach depfile $args { | |
| 307 | + dict set ::autosetup(cc-include-deps) $file $depfile 1 | |
| 308 | + } | |
| 309 | +} | |
| 310 | + | |
| 311 | +# C *-*-darwin* { | |
| 312 | + # Don't-gstabs | |
| 313 | + } | |
| 314 | + }$value$valuecc-check-tools ld |
| --- a/autosetup/cc.tcl | |
| +++ b/autosetup/cc.tcl | |
| @@ -0,0 +1,314 @@ | |
| --- a/autosetup/cc.tcl | |
| +++ b/autosetup/cc.tcl | |
| @@ -0,0 +1,314 @@ | |
| 1 | # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ |
| 2 | # All rights reserved |
| 3 | |
| 4 | # @synopsis: |
| 5 | # |
| 6 | # The 'cc' module supports checking various 'features' of the C or C++ |
| 7 | # compiler/linker environment. Common commands are , |
| 8 | # cc-check-types, cc-check-functions, cc-with, make-autoconf-h and make-templatement variables are used if set: |
| 9 | # |
| 10 | ## CC - C compiler |
| 11 | ## CXX - C++ compiler |
| 12 | ## CPP - C preprocessor |
| 13 | ##CACHE - Set to "none" to disable automatic use of ccache |
| 14 | ## Ciler flags |
| 15 | ## CXXFLAGS - Additional C++ compiler flags |
| 16 | ## LDFLAGS - Additional compiler flags during linking |
| 17 | ## LINKFLAGS - ?How is this diffes to use (for all tests) |
| 18 | ## CROSS - Tool prefix for cross compilation |
| 19 | # |
| 20 | # The following variables are defined from the corresponding |
| 21 | # environment variables if set. |
| 22 | # |
| 23 | ## CC_FOR_BUILD |
| 24 | ## LD |
| 25 | |
| 26 | use systPPFLAGS |
| 27 | ## LINKFLAGSmodule-options {} |
| 28 | |
| 29 | # Checks for the existence of the giveNote that the return code is not meaningful |
| 30 | proc cc-check-something {name code} { |
| 31 | uplevel 1 $codee given type/strunction {function} { |
| 32 | cctest -link 1 -declare "extern void $function\(void);" -code "$function\();" |
| 33 | } |
| 34 | |
| 35 | # Checks for the existence of the given type by compiling |
| 36 | proc cctest_type {type} { |
| 37 | cctest -code "$type _x;" |
| 38 | } |
| 39 | |
| 40 | # Checks for the existence of the given type/structure member. |
| 41 | # e.g. "struct stat.st_mtime" |
| 42 | proc cctest_member {struct_member} { |
| 43 | # split at the first dot |
| 44 | regexp {^([^.]+)[.](.*)$} $lassign me;\n#endif" |
| 45 | } |
| 46 | |
| 47 | # @cc-ch |
| 48 | # e.g. "struct stypeses a variable with the 4 8 1 2 16 32} { |
| 49 | if {[cctest -code "static int _x\[sizeof($type) == $i ? 1 : -1\] = { 1 };"]} { |
| 50 | set size $i |
| 51 | break |
| 52 | } |
| 53 | } |
| 54 | msg-result $size |
| 55 | set define [feature-define-name $type SIZEOF_] |
| 56 | define $define $size |
| 57 | } |
| 58 | # Return the last result |
| 59 | get-define $define |
| 60 | } |
| 61 | |
| 62 | # Checks for each feature in $list by using the given script. |
| 63 | # |
| 64 | # When the script is evaluated, $each is set to the feature |
| 65 | # being checked, and $extra is set to any additional cctest args. |
| 66 | # |
| 67 | # Returns 1 if all features were found, or 0 otherwise. |
| 68 | proc cc-check-some-feature {list script} { |
| 69 | set ret 1 |
| 70 | foreach each $list { |
| 71 | if {![check-feature $each $script]} { |
| 72 | set ret 0 |
| 73 | } |
| 74 | } |
| 75 | return $ret |
| 76 | } |
| 77 | |
| 78 | # @cc-check-includes includes ... |
| 79 | # |
| 80 | # Checks that the given include files can be used. |
| 81 | proc cc-check-includes {args} { |
| 82 | c |
| 83 | procproc cctest_define {cc-check-some-xp {^([^.]+)[.](.*)$} $struct_member -> struct member |
| 84 | cctest -code "static $struct _s; return sizeof(_s.$member);" |
| 85 | } |
| 86 | |
| 87 | # Checks for the existence of the given define by compiling |
| 88 | # |
| 89 | proc cctest_define {name} { |
| 90 | cctest -code "#ifndef $name\n#error not defined\n#endif" |
| 91 | } |
| 92 | |
| 93 | # Checks forcks that the given include files can be used. |
| 94 | proc cc-check-includes {args} { |
| 95 | cc-check-some-feature $args { |
| 96 | set with {} |
| 97 | if {[dict exists $::autosetup(cc-include-deps) $each]} { |
| 98 | set deps! cc-check-include$exeecks tha]} { |
| 99 | cc-with [list -includes $w } |
| 100 | define $TOOL $exeed if set: |
| 101 | # |
| 102 | ## CC |
| 103 | # @synopsis: |
| 104 | # |
| 105 | # The 'cc' module supports checking various 'features' of the C or C++ |
| 106 | # compiler/linker environment. Common commands are , |
| 107 | # cc-check-types, cc-check-functions, cc-with, make-autoconf-h and make-templatement variables are used if set: |
| 108 | # |
| 109 | ## CC - C compiler |
| 110 | ## CXX - C++ compiler |
| 111 | ## CPP - C preprocessor |
| 112 | ##CACHE - Set to "none" to disable automatic use of ccache |
| 113 | ## Ciler flags |
| 114 | ## CXXFLAGS - Additional C++ compiler flags |
| 115 | ## LDFLAGS - Additional compiler flags during linking |
| 116 | ## LINKFLAGS - ?How is this diffes to use (for all tests) |
| 117 | ## CROSS - Tool prefix for cross compilation |
| 118 | # |
| 119 | # The following variables are defined from the corresponding |
| 120 | # environment variables if set. |
| 121 | # |
| 122 | ## CC_FOR_BUILD |
| 123 | ## LD |
| 124 | |
| 125 | use systPPFLAGS |
| 126 | ## LINKFLAGSmodule-options {} |
| 127 | |
| 128 | # Checks for the existence of the giveNote that the return code is not meaningful |
| 129 | proc cc-check-something {name code} { |
| 130 | uplevel 1 $codee given type/strunction {function} { |
| 131 | cctest -link 1 -declare "extern void $function\(void);" -code "$function\();" |
| 132 | } |
| 133 | |
| 134 | # Checks for the existence of the given type by compiling |
| 135 | proc cctest_type {type} { |
| 136 | cctest -code "$type _x;" |
| 137 | } |
| 138 | |
| 139 | # Checks for the existence of the given type/structure member. |
| 140 | # e.g. "struct stat.st_mtime" |
| 141 | proc cctest_member {struct_member} { |
| 142 | # split at the first dot |
| 143 | regexp {^([^.]+)[.](.*)$} $lassign [split $struct_member .]rn sizeof(_s.$member);" |
| 144 | } |
| 145 | |
| 146 | # Checks for the existence of the given define by compiling |
| 147 | # |
| 148 | proc cctest_define {name} { |
| 149 | cctest -code "#ifndef $name\n#error not defined\n#endif" |
| 150 | } |
| 151 | |
| 152 | # Checks for the existence of the given name either as |
| 153 | # a macro (#define) or an rvalue (such as an enum) |
| 154 | # |
| 155 | proc cctest_decl {name} { |
| 156 | cctest -code "#ifndef $name\n(void)$name;\n#endif" |
| 157 | } |
| 158 | |
| 159 | # @cc-check-sizeof type ... |
| 160 | # |
| 161 | # Checks the size of the given types (between 1 and 32, inclusive). |
| 162 | # Defines a variable with the size determined, or 'unknown'"unknown"ng', defines 'SIZEOF_LSIZEOF_LONG_LONGe. |
| 163 | # |
| 164 | proc cc-check-sizeof {args} { |
| 165 | foreach type $args { |
| 166 | msg-checking "Checking for sizeof $type..." |
| 167 | set size unknown |
| 168 | # Try the most common sizes first |
| 169 | foreach i {4 8 1 2 16 32} { |
| 170 | if {[cctest -code "static int _x\[sizeof($type) == $i ? 1 : -1\] = { 1 };"]} { |
| 171 | set size $i |
| 172 | break |
| 173 | } |
| 174 | } |
| 175 | msg-result $size |
| 176 | set define [feature-define-name $type SIZEOF_] |
| 177 | define $define $size |
| 178 | } |
| 179 | # Return the last result |
| 180 | get-define $define |
| 181 | } |
| 182 | |
| 183 | # Checks for each feature in $list by using the given script. |
| 184 | # |
| 185 | # When the script is evaluated, $each is set to the feature |
| 186 | # being checked, and $extra is set to any additional cctest args. |
| 187 | # |
| 188 | # Returns 1 if all features were found, or 0 otherwise. |
| 189 | proc cc-check-some-feature {list script} { |
| 190 | set ret 1 |
| 191 | foreach each $list { |
| 192 | if {![check-feature $each $script]} { |
| 193 | set ret 0 |
| 194 | } |
| 195 | } |
| 196 | return $ret |
| 197 | } |
| 198 | |
| 199 | # @cc-check-includes includes ... |
| 200 | # |
| 201 | # Checks that the given include files can be used. |
| 202 | proc cc-check-includes {args} { |
| 203 | c |
| 204 | procproc cctest_define {cc-check-some-xp {^([^.]+)[.](.*)$} $struct_member -> struct member |
| 205 | cctest -code "static $struct _s; return sizeof(_s.$member);" |
| 206 | } |
| 207 | |
| 208 | # Checks for the existence of the given define by compiling |
| 209 | # |
| 210 | proc cctest_define {name} { |
| 211 | cctest -code "#ifndef $name\n#error not defined\n#endif" |
| 212 | } |
| 213 | |
| 214 | # Checks for the existence of the given name either as |
| 215 | # a macro (#define) or an rvalue (such as an enum) |
| 216 | # |
| 217 | proc cctest_decl {name} { |
| 218 | cctest -code "#ifndef $name\n(void)$name;\n#endif" |
| 219 | } |
| 220 | given types (bet#includeddetermined, or 'unknown' otherwise. |
| 221 | # e.g. for type 'long long', defines 'SIZEOF_LONG_LONG'. |
| 222 | # Returns the size of the last type. |
| 223 | # |
| 224 | proc cc-check-sizeof {args} { |
| 225 | foreach type $adfirst dot |
| 226 | regexp {^([^.]+)[.](.*)$} $struct_member -> struct member |
| 227 | cctest -code "static $struct _s; return sizeof(_s.$member);" |
| 228 | } |
| 229 | |
| 230 | # Checks for the existence of the given define by compiling |
| 231 | # |
| 232 | proc cctest_define FLAGS - ?How is this di# @synopsis: |
| 233 | # |
| 234 | # The 'cc' module supports checking various 'features' of the C or C++ |
| 235 | # compiler/linker environment. Common commands are , |
| 236 | # cc-check-types, cc-check-functions, cc-with, make-autoconf-h and make-templatement variables are used if set: |
| 237 | # |
| 238 | ## CC - C compiler |
| 239 | ## CXX - C++ compiler |
| 240 | ## CPP - C preprocessor |
| 241 | ##CACHE - Set to "none" to disfor a declsable automatic use of ccache |
| 242 | ## Ciler flags |
| 243 | ## C# Copyright (c) 2010 Work foreach type $args { |
| 244 | msg-checking "Checking for sizeof $type..." |
| 245 | set size unknown |
| 246 | # Try the most common sizes first |
| 247 | foreach i {4 8 1 2 16 32} { |
| 248 | if {[cctest -code "static int _x\[sizeof($type) == $i ? 1 : -1\] = { 1 };"]} { |
| 249 | set size $i |
| 250 | break |
| 251 | } |
| 252 | } |
| 253 | msg-result $size |
| 254 | set define [feature-define-name $type SIZEOF_] |
| 255 | define $define $size |
| 256 | } |
| 257 | # Return the last result |
| 258 | get-define $define |
| 259 | } |
| 260 | |
| 261 | # Checks for each feature in $list by using the given script. |
| 262 | # |
| 263 | # When the script is evaluated, $each is set to the feature |
| 264 | # being checked, and $extra is set to any additional cctest args. |
| 265 | # |
| 266 | # Returns 1 if all features were found, or 0 otherwise. |
| 267 | proc cc-check-some-feature {list script} { |
| 268 | set ret 1ch $script]} { |
| 269 | set ret 0 |
| 270 | } |
| 271 | } |
| 272 | return $ret |
| 273 | } |
| 274 | |
| 275 | # @cc-check-includes includes ... |
| 276 | # |
| 277 | # Checks that the given include files can be used. |
| 278 | proc cc-check-includes {args} { |
| 279 | cc-check-some-feature $args { |
| 280 | set with {} |
| 281 | if {[dict exists $::autosetup(cc-include-deps) $each]} { |
| 282 | set deps [dict keys [dict get $::autosetup(cc-include-deps) $each]] |
| 283 | msg-quiet cc-check-includes {*}$deps |
| 284 | foreach i $deps { |
| 285 | if {[have-feature $i]} { |
| 286 | lappend with $i |
| 287 | ure $each $scriptargs { |
| 288 | set new($name) $value |
| 289 | } $i]} { |
| 290 | lappend$newme\n(void)$name;\n#th]} { |
| 291 | cc-with [list -includes $with] { |
| 292 | cctest -includes $each |
| 293 | } |
| 294 | } else { |
| 295 | cctest -includes $each |
| 296 | } |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | # @cc-include-needs include required ... |
| 301 | # |
| 302 | # Ensures that when checking for '$include', a check is first |
| 303 | # made for eachtk is first |
| 304 | # made for each '$required' file, and if found, it is included with '#include'. |
| 305 | proc cc-include-needs {file args} { |
| 306 | foreach depfile $args { |
| 307 | dict set ::autosetup(cc-include-deps) $file $depfile 1 |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | # C *-*-darwin* { |
| 312 | # Don't-gstabs |
| 313 | } |
| 314 | }$value$valuecc-check-tools ld |
+307
| --- a/autosetup/config.guess | ||
| +++ b/autosetup/config.guess | ||
| @@ -0,0 +1,307 @@ | ||
| 1 | +03-23 the terms of the GNU General Public License as published by | |
| 2 | +# t(C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, | |
| 3 | +# 2000, 2001, 2002, 2003, 2004, 2005, 2006,oftware Foundation, 0-09-24r | |
| 4 | +# (at your option) any later version. | |
| 5 | +# | |
| 6 | +# This program is distributed in the hope that it will be useful, but | |
| 7 | +# WITHOUT ANY WARRANTY; without even the implied w2 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 8 | +# General Public License for more details. | |
| 9 | +# | |
| 10 | +# You should have received a copy of the GNU General Public License | |
| 11 | +# along with this program; if not, see <https://www.gnu.org/licenses/>. | |
| 12 | +# | |
| 13 | +# As a special exceptionto the GNU General Public License, if you | |
| 14 | +# distribute this file as part of a program that contains a | |
| 15 | +# configuration script generated by Autoconwrite to the Free Software | |
| 16 | +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Bmay include it under | |
| 17 | +# the same distribution terms that you use for the rest of that | |
| 18 | +# program. This Exception is an additional permission under section 7 | |
| 19 | +# of the GNU General Public License, version 3 ("GPLv3"). | |
| 20 | +# | |
| 21 | +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. | |
| 22 | +# | |
| 23 | +# You can ggnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc. | |
| 24 | + | |
| 25 | +$dummy.c$dummy.o $dummy.c{UNAME_SYSTEM} | |
| 26 | + cat <<-EOF > $dummy.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh | |
| 27 | +# Attempt to guess a canonical system name. | |
| 28 | +# Copyright 1992-2014 Free Software Found4-11-04it and/or modify it | |
| 29 | +# under the terms of the GNU General Public License as published by | |
| 30 | +# t;e Free Software Foundation, either version 3 of the L;cense, or | |
| 31 | +# (at your option) any later version. | |
| 32 | +# | |
| 33 | +# This program is distributed in the hope that it will be useful, but | |
| 34 | +# WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 35 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 36 | +# General Public License for more details. | |
| 37 | +# | |
| 38 | +# You should have received a copy of the GNU General Public License | |
| 39 | +# along with this program; if not, see <https://www.gnu.org/licenses/>. | |
| 40 | +# | |
| 41 | +# As a special exceptionto the GNU General Public License, if you | |
| 42 | +# distribute this file as part of a program that contains a | |
| 43 | +# configuration script generated by Autoconf, you may include it under | |
| 44 | +# the same distribution terms that you use for the rest of that | |
| 45 | +# program. This Exception is an additional permission under section 7 | |
| 46 | +# of the GNU General Public License, version 3 ("GPLv3"). | |
| 47 | +# | |
| 48 | +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. | |
| 49 | +# | |
| 50 | +# You can get the latest version of this script from: | |
| 51 | +# https://git.savannah.gnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc. | |
| 52 | + | |
| 53 | +$dummy.c$dummy.o $dummy.c{UNAME_SYSTEM} | |
| 54 | + cat <<-EOF > $dummy.c`$CC_FOR_BUILD -E $dummy.c'^LIBC' | sed 's, ,,g'`{UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}/sbin/$sysctl/usr/sbin/$sysctl | |
| 55 | +# Attempt to guess a canoniAttempt to g! /bin/sh | |
| 56 | +# Attemp#*) machine=${! /bin/sh | |
| 57 | +# Attemp#! /bin/sh | |
| 58 | +# Attempt to guess a canonical system name. | |
| 59 | +# Copyright 1992-2018canonical system name. | |
| 60 | +# Copyrig! /bin/sh | |
| 61 | +# Attemp#! /b{UNAME_VERSION}${UNAME_REL{machine}-${os}${release}${! /bin/sh | |
| 62 | +# Attemp#! /bin/sh | |
| 63 | +# Attempt to guess a ${! /bin/sh | |
| 64 | +# Attemp#! /bin/sh | |
| 65 | +# Attempt to guess a cekkoBSD:*:*) | |
| 66 | + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}SolidBSD:*:*) | |
| 67 | + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}${UNAME_RELEASE}${UNAME_MACHINE}-unk"alpha""alpha""alpha""alphaev5"A"alphaev56""alphapca56""alphapca57""alphaev6""alphaev67""alphaev68""alphaev68""alphaev68""alphaev69""alphaev7""alphaev79"${UNAME_MACHINE}-dec-osf`echo RELEASE}'' ''` /bin/sh | |
| 68 | +# Attempt to guess a canonical system name. | |
| 69 | +# Copyright 1992-2018 Free Software FouAttempt to guess a canonical system name. | |
| 70 | +# Copyright 1992-2018 Free Software Foundation, Inc. | |
| 71 | + | |
| 72 | +timestamp='2018-03-08it and/or modify it | |
| 73 | +# under the terms of the GNU General Public License as published by | |
| 74 | +# t;e Free Software Foundation, either version 3 of the L;cense, or | |
| 75 | +# (at your o program. | |
| 76 | + | |
| 77 | + | |
| 78 | +# neral Public License | |
| 79 | +# along with he GNU General Public03-23 the terms of the and include a ChangeLog | |
| 80 | +# entrhe GNU General Public License as published by | |
| 81 | +# t;e Free Software Foundation, either version 3 of the L;cense, or | |
| 82 | +# (at your option) any later version. | |
| 83 | +# | |
| 84 | +# This program is distributed in the hope that it will be useful, but | |
| 85 | +# WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 86 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 87 | +# General Public License for more details. | |
| 88 | +# | |
| 89 | +# You should have received a copy of the GNU General Public License | |
| 90 | +# along with this program; if not, see <https://www.gnu.org/licenses/>. | |
| 91 | +# | |
| 92 | +# As a special exceptionto the GNU General Public License, if you | |
| 93 | +# distribute this file as part of a program that contains a | |
| 94 | +# configuration script generated by Autoconf, you may include it under | |
| 95 | +# the same distribution terms that you use for the rest of that | |
| 96 | +# program. This Exception is an additional permission under section 7 | |
| 97 | +# of the GNU General Public License, version 3 ("GPLv3"). | |
| 98 | +# | |
| 99 | +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. | |
| 100 | +# | |
| 101 | +# You can ggnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc. | |
| 102 | + | |
| 103 | +$dummy.c$dummy.o $dummy.c{UNAME_SYSTEM} | |
| 104 | + cat <<-EOF > $dummy.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh | |
| 105 | +# Attempt to guess a canonical system name. | |
| 106 | +# Copyright 1992-2014 Free Software Found4-11-04it and/or modify it | |
| 107 | +# under the terms of the GNU General Public License as published by | |
| 108 | +# t;e Free Software Foundation, either version 3 of the L;cense, or | |
| 109 | +# (at your option) any later version. | |
| 110 | +# | |
| 111 | +# This program is distributed in the hope that it will be useful, but | |
| 112 | +# WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 113 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 114 | +# General Public License for more details. | |
| 115 | +# | |
| 116 | +# You should have received a copy of the GNU General Public License | |
| 117 | +# along with this program; if not, see <https://www.gnu.org/licenses/>. | |
| 118 | +# | |
| 119 | +# As a special exceptionto the GNU General Public License, if you | |
| 120 | +# distribute this file as part of a program that contains a | |
| 121 | +# configuration script generated by Autoconf, you may include it under | |
| 122 | +# the same distribution terms that you use for the rest of that | |
| 123 | +# program. This Exception is an additional permission under section 7 | |
| 124 | +# of the GNU General Public License, version 3 ("GPLv3"). | |
| 125 | +# | |
| 126 | +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. | |
| 127 | +# | |
| 128 | +# You can get the latest version of this script from: | |
| 129 | +# https://git.savannah.gnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc. | |
| 130 | + | |
| 131 | +$dummy.c$dummy.o $dummy.c{UNAME_SYSTEM} | |
| 132 | + cat <<-EOF > $dummy.c`$CC_FOR_BUILD -E $dummy.c'^LIBC' | sed 's, ,,g'`{UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}/sbin/$sysctl/usr/sbin/$sysctl | |
| 133 | +# Attempt to guess a canoniAttempt to g! /bin/sh | |
| 134 | +# Attemp#*) machine=${! /bin/sh | |
| 135 | +# Attemp#! /bin/sh | |
| 136 | +# Attempt to guess a canonical system name. | |
| 137 | +# Copyright 1992-2018canonical system name. | |
| 138 | +# Copyrig! /bin/sh | |
| 139 | +# Attemp#! /b{UNAME_VERSION}${UNAME_REL{machine}-${os}${release}${! /bin/sh | |
| 140 | +# Attemp#! /bin/sh | |
| 141 | +# Attempt to guess a ${! /bin/sh | |
| 142 | +# Attemp#! /bin/sh | |
| 143 | +# Attempt to guess a cekkoBSD:*:*) | |
| 144 | + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}SolidBSD:*:*) | |
| 145 | + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}${UNAME_RELEASE}${UNAME_MACHINE}-unk"alpha""alpha""alpha""alphaev5"A"alphaev56""alphapca56""alphapca57""alphaev6""alphaev67""alphaev68""alphaev68""alphaev68""alphaev69""alphaev7""alphaev79"${UNAME_MACHINE}-dec-osf`echo RELEASE}'' ''` /bin/sh | |
| 146 | +# Attempt to guess a canonical system name. | |
| 147 | +# Copyright 1992-2018 Free Software FouAttempt to guess a canonical system name. | |
| 148 | +# Copyright 1992-2018 Free Software Foundation, Inc. | |
| 149 | + | |
| 150 | +timestamp='2018-03-08it and/or modify it | |
| 151 | +# under the terms of the GNU General Public License as published by | |
| 152 | +# t;e Free Software Foundation, either version 3 of the L;cense, or | |
| 153 | +# (at your o.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh | |
| 154 | +# Attempt to guess a canonical system name. | |
| 155 | +# Copyright 1992-2014 Free Software Found4-11-04it and/or modify it | |
| 156 | +# under the terms of the GNU General Public License as published by | |
| 157 | +# t;e Free Software Foundation, either version 3 of the L;cense, or | |
| 158 | +# (at your option) any later version. | |
| 159 | +# | |
| 160 | +# This program is distributed in the hope that it will be useful, but | |
| 161 | +# WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 162 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 163 | +# General Public License for more details. | |
| 164 | +# | |
| 165 | +# You should have received a copy of the GNU General Public License | |
| 166 | +# along with this program; if not, see <https://www.gnu.org/licenses/>. | |
| 167 | +# | |
| 168 | +# As a special exceptionto the GNU General Public License, if you | |
| 169 | +# distribute this file as part of a program that contains a | |
| 170 | +# configuration script generated by Autoconf, you may include it under | |
| 171 | +# the same distribution terms that you use for the rest of that | |
| 172 | +# program. This Exception is an additional permission under section 7 | |
| 173 | +# of the GNU General Public License, version 3 ("GPLv3"). | |
| 174 | +# | |
| 175 | +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. | |
| 176 | +# | |
| 177 | +# You can get the latest version of this script from: | |
| 178 | +# https://git.savannah.gnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc. | |
| 179 | + | |
| 180 | +$dummy.c$dummy.o $dummy.c{UNAME_SYSTEM} | |
| 181 | + cat <<-EOF > $dummy.c`$CC_FOR_BUILD -E $dummy.c'^LIBC' | sed 's, ,,g'`{UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}/sbin/$sysctl/usr/sbin/$sysctl | |
| 182 | +# Attempt to guess a canoniAttempt to g! /bin/sh | |
| 183 | +# Attemp#*) machine=${! /bin/sh | |
| 184 | +# Attemp#! /bin/sh | |
| 185 | +# Attempt to guess a canonical system name. | |
| 186 | +# Copyright 1992-2018canonical system name. | |
| 187 | +# Copyrig! /bin/sh | |
| 188 | +# Attemp#! /b{UNAME_VERSION}${UNAME_REL{machine}-${os}${release}${! /bin/sh | |
| 189 | +# Attemp#! /bin/sh | |
| 190 | +# Attempt to guess a ${! /bin/sh | |
| 191 | +# Attemp#! /bin/sh | |
| 192 | +# Attempt to guess a cekkoBSD:*:*) | |
| 193 | + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}SolidBSD:*:*) | |
| 194 | + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}${UNAME_RELEASE}${UNAME_MACHINE}-unk"alpha""alpha""alpha""alphaev5"A"alphaev56""alphapca56""alphapca57""alphaev6""alphaev67""alphaev68""alphaev68""alphaev68""alphaev69""alphaev7""alphaev79"${UNAME_MACHINE}-dec-osf`echo RELEASE}'' ''` /bin/sh | |
| 195 | +# Attempt to guess a canonical system name. | |
| 196 | +# Copyright 1992-2018 Free Software FouAttempt to guess a canonical system name. | |
| 197 | +# Copyright 1992-2018 Free Software Foundation, Inc. | |
| 198 | + | |
| 199 | +timestamp='2018-03-08it and/or modify it | |
| 200 | +# under the terms of the GNU General Public License as published by | |
| 201 | +# t;e Free Software Foundation, either version 3 of the L;cense, or | |
| 202 | +# (at your oished by | |
| 203 | +# t;e Free Software Foundation, either version 3 of the L;cense, or | |
| 204 | +# (at your option) any later version. | |
| 205 | +# | |
| 206 | +# This program is distributed in the hope that it will be useful, but | |
| 207 | +# WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 208 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 209 | +# General Public License for more details. | |
| 210 | +# | |
| 211 | +# You should have received a copy of the GNU General Public License | |
| 212 | +# along with this progra(C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, | |
| 213 | +2001, 2002, 2003, 2004, 2005, 2006, 2implied warranty ofot, see <https://www.gnu.org/licenses/>. | |
| 214 | +# | |
| 215 | +# As a special exceptionto the GNU General Public License, if you | |
| 216 | +# distribute this file as part of a program that contains a | |
| 217 | +# configuration script generated by Autoconf, you may include it under | |
| 218 | +# the same distribution terms that you use for the rest of that | |
| 219 | +# program. This Exception is an additional permission under section 7 | |
| 220 | +# of the GNU General Public License, version 3 ("GPLv3"). | |
| 221 | +# | |
| 222 | +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. | |
| 223 | +# | |
| 224 | +# You can get the latest version of this script from: | |
| 225 | +# https://git.savannah.gnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc. | |
| 226 | + | |
| 227 | +$dummy.c$dummy.o $dummy.c{UNAME_SYSTEM} | |
| 228 | + cat <<-EOF > $dummy.c`$CC_FORHUP INT TERMneral Public License, version 3 ("GPLv3"). | |
| 229 | +# | |
| 230 | +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. | |
| 231 | +# | |
| 232 | +# You can ggnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc. | |
| 233 | + | |
| 234 | +$dummy.c$dummy.o $dummy.c{UNAME_SYSTEM} | |
| 235 | + cat <<-EOF > $dummy.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh | |
| 236 | +# Attempt to guess a canonical system name. | |
| 237 | +# Copyright 1992-2014 Free Software Found4-11-04it and/or modify it | |
| 238 | +# under the terms of the GNU General Public License as published by | |
| 239 | +# t;e Free Software Foundation, either version 3 of the L;cense, or | |
| 240 | +# (at your optionHUP INT PIPE TERM03-23 the terms of the GNU General Public License as published by | |
| 241 | +# t;e Free Software Foundation, either version 3 of the L;cense, or | |
| 242 | +# (at your option) any later version. | |
| 243 | +# | |
| 244 | +# This program is distributed in the hope tha03-23 the terms of the GNU General Public License as published by | |
| 245 | +# t;e Free Software Foundation, either version 3 of the L;cense, or | |
| 246 | +# (at your option) any later version. | |
| 247 | +# | |
| 248 | +# This program is distributed in the hope that it will be useful, but | |
| 249 | +# WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 250 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 251 | +# General Public License for more details. | |
| 252 | +# | |
| 253 | +# You should have received a copy of the GNU General Public License | |
| 254 | +# along with this program; if not, see <https://www.gnu.org/licenses/>. | |
| 255 | +# | |
| 256 | +# As a special exceptionto the GNU General Public License, if you | |
| 257 | +# distribute this file as part of a program that contains a | |
| 258 | +# configuration script generated by Autoconf, you may include it under | |
| 259 | +# the same distribution terms that you use for the rest of that | |
| 260 | +# program. This Exception is an additional permission under section 7 | |
| 261 | +# of the GNU General Public License, version 3 ("GPLv3"). | |
| 262 | +# | |
| 263 | +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. | |
| 264 | +# | |
| 265 | +# You can ggnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc. | |
| 266 | + | |
| 267 | +$dummy.c$dummy.o $dummy.c{UNAME_SYSTEM} | |
| 268 | + cat <<-EOF > $dummy.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh | |
| 269 | +# Attempt to guess a canonical system name. | |
| 270 | +# Open exit :riscos:*:*|arm t it will be useful, but | |
| 271 | +03-23 th 23 the terms of the GNU General Public License as published by | |
| 272 | +# t;e Free Software Foundation, either version 3 of the L;cense, or | |
| 273 | +# (at your option) any later version. | |
| 274 | +# | |
| 275 | +# This program is distributed in the hope that it will be useful, but | |
| 276 | +# WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 277 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 278 | +# General Public License for more details. | |
| 279 | +# | |
| 280 | +# You should have received a copy of the GNU General Public License | |
| 281 | +# along with this program; if not, see <https://www.gnu.org/licenses/>. | |
| 282 | +# | |
| 283 | +# As a special exceptionto the GNU General Public License, if you | |
| 284 | +# distribute this file as part of a program that contains a | |
| 285 | +# configuration script generated by Autoconf, you may include it under | |
| 286 | +# the same distribution terms that you use for the rest of that | |
| 287 | +# program. This Exception is an additional permission under section 7 | |
| 288 | +# of the GNU General Public License, version 3 ("GPLv3"). | |
| 289 | +# | |
| 290 | +# Originally written ms of the GNU Genera532)case "${sc_kernel_bits}" in | |
| 291 | + 32) HP_ARCH="hppa2.0n" ;; | |
| 292 | +esac ;; | |
| 293 | + | |
| 294 | + #include <stdlib.h> | |
| 295 | + #include <unistd.h> | |
| 296 | + | |
| 297 | + int main () | |
| 298 | + { | |
| 299 | + #if | |
| 300 | + #endif | |
| 301 | +switch (cpu) | |
| 302 | + "); break; | |
| 303 | + 2_0: | |
| 304 | + #if | |
| 305 | + switch (bits) | |
| 306 | + { | |
| 307 | + |
| --- a/autosetup/config.guess | |
| +++ b/autosetup/config.guess | |
| @@ -0,0 +1,307 @@ | |
| --- a/autosetup/config.guess | |
| +++ b/autosetup/config.guess | |
| @@ -0,0 +1,307 @@ | |
| 1 | 03-23 the terms of the GNU General Public License as published by |
| 2 | # t(C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
| 3 | # 2000, 2001, 2002, 2003, 2004, 2005, 2006,oftware Foundation, 0-09-24r |
| 4 | # (at your option) any later version. |
| 5 | # |
| 6 | # This program is distributed in the hope that it will be useful, but |
| 7 | # WITHOUT ANY WARRANTY; without even the implied w2 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 8 | # General Public License for more details. |
| 9 | # |
| 10 | # You should have received a copy of the GNU General Public License |
| 11 | # along with this program; if not, see <https://www.gnu.org/licenses/>. |
| 12 | # |
| 13 | # As a special exceptionto the GNU General Public License, if you |
| 14 | # distribute this file as part of a program that contains a |
| 15 | # configuration script generated by Autoconwrite to the Free Software |
| 16 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Bmay include it under |
| 17 | # the same distribution terms that you use for the rest of that |
| 18 | # program. This Exception is an additional permission under section 7 |
| 19 | # of the GNU General Public License, version 3 ("GPLv3"). |
| 20 | # |
| 21 | # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. |
| 22 | # |
| 23 | # You can ggnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc. |
| 24 | |
| 25 | $dummy.c$dummy.o $dummy.c{UNAME_SYSTEM} |
| 26 | cat <<-EOF > $dummy.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh |
| 27 | # Attempt to guess a canonical system name. |
| 28 | # Copyright 1992-2014 Free Software Found4-11-04it and/or modify it |
| 29 | # under the terms of the GNU General Public License as published by |
| 30 | # t;e Free Software Foundation, either version 3 of the L;cense, or |
| 31 | # (at your option) any later version. |
| 32 | # |
| 33 | # This program is distributed in the hope that it will be useful, but |
| 34 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 35 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 36 | # General Public License for more details. |
| 37 | # |
| 38 | # You should have received a copy of the GNU General Public License |
| 39 | # along with this program; if not, see <https://www.gnu.org/licenses/>. |
| 40 | # |
| 41 | # As a special exceptionto the GNU General Public License, if you |
| 42 | # distribute this file as part of a program that contains a |
| 43 | # configuration script generated by Autoconf, you may include it under |
| 44 | # the same distribution terms that you use for the rest of that |
| 45 | # program. This Exception is an additional permission under section 7 |
| 46 | # of the GNU General Public License, version 3 ("GPLv3"). |
| 47 | # |
| 48 | # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. |
| 49 | # |
| 50 | # You can get the latest version of this script from: |
| 51 | # https://git.savannah.gnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc. |
| 52 | |
| 53 | $dummy.c$dummy.o $dummy.c{UNAME_SYSTEM} |
| 54 | cat <<-EOF > $dummy.c`$CC_FOR_BUILD -E $dummy.c'^LIBC' | sed 's, ,,g'`{UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}/sbin/$sysctl/usr/sbin/$sysctl |
| 55 | # Attempt to guess a canoniAttempt to g! /bin/sh |
| 56 | # Attemp#*) machine=${! /bin/sh |
| 57 | # Attemp#! /bin/sh |
| 58 | # Attempt to guess a canonical system name. |
| 59 | # Copyright 1992-2018canonical system name. |
| 60 | # Copyrig! /bin/sh |
| 61 | # Attemp#! /b{UNAME_VERSION}${UNAME_REL{machine}-${os}${release}${! /bin/sh |
| 62 | # Attemp#! /bin/sh |
| 63 | # Attempt to guess a ${! /bin/sh |
| 64 | # Attemp#! /bin/sh |
| 65 | # Attempt to guess a cekkoBSD:*:*) |
| 66 | echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}SolidBSD:*:*) |
| 67 | echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}${UNAME_RELEASE}${UNAME_MACHINE}-unk"alpha""alpha""alpha""alphaev5"A"alphaev56""alphapca56""alphapca57""alphaev6""alphaev67""alphaev68""alphaev68""alphaev68""alphaev69""alphaev7""alphaev79"${UNAME_MACHINE}-dec-osf`echo RELEASE}'' ''` /bin/sh |
| 68 | # Attempt to guess a canonical system name. |
| 69 | # Copyright 1992-2018 Free Software FouAttempt to guess a canonical system name. |
| 70 | # Copyright 1992-2018 Free Software Foundation, Inc. |
| 71 | |
| 72 | timestamp='2018-03-08it and/or modify it |
| 73 | # under the terms of the GNU General Public License as published by |
| 74 | # t;e Free Software Foundation, either version 3 of the L;cense, or |
| 75 | # (at your o program. |
| 76 | |
| 77 | |
| 78 | # neral Public License |
| 79 | # along with he GNU General Public03-23 the terms of the and include a ChangeLog |
| 80 | # entrhe GNU General Public License as published by |
| 81 | # t;e Free Software Foundation, either version 3 of the L;cense, or |
| 82 | # (at your option) any later version. |
| 83 | # |
| 84 | # This program is distributed in the hope that it will be useful, but |
| 85 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 86 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 87 | # General Public License for more details. |
| 88 | # |
| 89 | # You should have received a copy of the GNU General Public License |
| 90 | # along with this program; if not, see <https://www.gnu.org/licenses/>. |
| 91 | # |
| 92 | # As a special exceptionto the GNU General Public License, if you |
| 93 | # distribute this file as part of a program that contains a |
| 94 | # configuration script generated by Autoconf, you may include it under |
| 95 | # the same distribution terms that you use for the rest of that |
| 96 | # program. This Exception is an additional permission under section 7 |
| 97 | # of the GNU General Public License, version 3 ("GPLv3"). |
| 98 | # |
| 99 | # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. |
| 100 | # |
| 101 | # You can ggnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc. |
| 102 | |
| 103 | $dummy.c$dummy.o $dummy.c{UNAME_SYSTEM} |
| 104 | cat <<-EOF > $dummy.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh |
| 105 | # Attempt to guess a canonical system name. |
| 106 | # Copyright 1992-2014 Free Software Found4-11-04it and/or modify it |
| 107 | # under the terms of the GNU General Public License as published by |
| 108 | # t;e Free Software Foundation, either version 3 of the L;cense, or |
| 109 | # (at your option) any later version. |
| 110 | # |
| 111 | # This program is distributed in the hope that it will be useful, but |
| 112 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 113 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 114 | # General Public License for more details. |
| 115 | # |
| 116 | # You should have received a copy of the GNU General Public License |
| 117 | # along with this program; if not, see <https://www.gnu.org/licenses/>. |
| 118 | # |
| 119 | # As a special exceptionto the GNU General Public License, if you |
| 120 | # distribute this file as part of a program that contains a |
| 121 | # configuration script generated by Autoconf, you may include it under |
| 122 | # the same distribution terms that you use for the rest of that |
| 123 | # program. This Exception is an additional permission under section 7 |
| 124 | # of the GNU General Public License, version 3 ("GPLv3"). |
| 125 | # |
| 126 | # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. |
| 127 | # |
| 128 | # You can get the latest version of this script from: |
| 129 | # https://git.savannah.gnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc. |
| 130 | |
| 131 | $dummy.c$dummy.o $dummy.c{UNAME_SYSTEM} |
| 132 | cat <<-EOF > $dummy.c`$CC_FOR_BUILD -E $dummy.c'^LIBC' | sed 's, ,,g'`{UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}/sbin/$sysctl/usr/sbin/$sysctl |
| 133 | # Attempt to guess a canoniAttempt to g! /bin/sh |
| 134 | # Attemp#*) machine=${! /bin/sh |
| 135 | # Attemp#! /bin/sh |
| 136 | # Attempt to guess a canonical system name. |
| 137 | # Copyright 1992-2018canonical system name. |
| 138 | # Copyrig! /bin/sh |
| 139 | # Attemp#! /b{UNAME_VERSION}${UNAME_REL{machine}-${os}${release}${! /bin/sh |
| 140 | # Attemp#! /bin/sh |
| 141 | # Attempt to guess a ${! /bin/sh |
| 142 | # Attemp#! /bin/sh |
| 143 | # Attempt to guess a cekkoBSD:*:*) |
| 144 | echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}SolidBSD:*:*) |
| 145 | echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}${UNAME_RELEASE}${UNAME_MACHINE}-unk"alpha""alpha""alpha""alphaev5"A"alphaev56""alphapca56""alphapca57""alphaev6""alphaev67""alphaev68""alphaev68""alphaev68""alphaev69""alphaev7""alphaev79"${UNAME_MACHINE}-dec-osf`echo RELEASE}'' ''` /bin/sh |
| 146 | # Attempt to guess a canonical system name. |
| 147 | # Copyright 1992-2018 Free Software FouAttempt to guess a canonical system name. |
| 148 | # Copyright 1992-2018 Free Software Foundation, Inc. |
| 149 | |
| 150 | timestamp='2018-03-08it and/or modify it |
| 151 | # under the terms of the GNU General Public License as published by |
| 152 | # t;e Free Software Foundation, either version 3 of the L;cense, or |
| 153 | # (at your o.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh |
| 154 | # Attempt to guess a canonical system name. |
| 155 | # Copyright 1992-2014 Free Software Found4-11-04it and/or modify it |
| 156 | # under the terms of the GNU General Public License as published by |
| 157 | # t;e Free Software Foundation, either version 3 of the L;cense, or |
| 158 | # (at your option) any later version. |
| 159 | # |
| 160 | # This program is distributed in the hope that it will be useful, but |
| 161 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 162 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 163 | # General Public License for more details. |
| 164 | # |
| 165 | # You should have received a copy of the GNU General Public License |
| 166 | # along with this program; if not, see <https://www.gnu.org/licenses/>. |
| 167 | # |
| 168 | # As a special exceptionto the GNU General Public License, if you |
| 169 | # distribute this file as part of a program that contains a |
| 170 | # configuration script generated by Autoconf, you may include it under |
| 171 | # the same distribution terms that you use for the rest of that |
| 172 | # program. This Exception is an additional permission under section 7 |
| 173 | # of the GNU General Public License, version 3 ("GPLv3"). |
| 174 | # |
| 175 | # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. |
| 176 | # |
| 177 | # You can get the latest version of this script from: |
| 178 | # https://git.savannah.gnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc. |
| 179 | |
| 180 | $dummy.c$dummy.o $dummy.c{UNAME_SYSTEM} |
| 181 | cat <<-EOF > $dummy.c`$CC_FOR_BUILD -E $dummy.c'^LIBC' | sed 's, ,,g'`{UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}/sbin/$sysctl/usr/sbin/$sysctl |
| 182 | # Attempt to guess a canoniAttempt to g! /bin/sh |
| 183 | # Attemp#*) machine=${! /bin/sh |
| 184 | # Attemp#! /bin/sh |
| 185 | # Attempt to guess a canonical system name. |
| 186 | # Copyright 1992-2018canonical system name. |
| 187 | # Copyrig! /bin/sh |
| 188 | # Attemp#! /b{UNAME_VERSION}${UNAME_REL{machine}-${os}${release}${! /bin/sh |
| 189 | # Attemp#! /bin/sh |
| 190 | # Attempt to guess a ${! /bin/sh |
| 191 | # Attemp#! /bin/sh |
| 192 | # Attempt to guess a cekkoBSD:*:*) |
| 193 | echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}SolidBSD:*:*) |
| 194 | echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}${UNAME_RELEASE}${UNAME_MACHINE}-unk"alpha""alpha""alpha""alphaev5"A"alphaev56""alphapca56""alphapca57""alphaev6""alphaev67""alphaev68""alphaev68""alphaev68""alphaev69""alphaev7""alphaev79"${UNAME_MACHINE}-dec-osf`echo RELEASE}'' ''` /bin/sh |
| 195 | # Attempt to guess a canonical system name. |
| 196 | # Copyright 1992-2018 Free Software FouAttempt to guess a canonical system name. |
| 197 | # Copyright 1992-2018 Free Software Foundation, Inc. |
| 198 | |
| 199 | timestamp='2018-03-08it and/or modify it |
| 200 | # under the terms of the GNU General Public License as published by |
| 201 | # t;e Free Software Foundation, either version 3 of the L;cense, or |
| 202 | # (at your oished by |
| 203 | # t;e Free Software Foundation, either version 3 of the L;cense, or |
| 204 | # (at your option) any later version. |
| 205 | # |
| 206 | # This program is distributed in the hope that it will be useful, but |
| 207 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 208 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 209 | # General Public License for more details. |
| 210 | # |
| 211 | # You should have received a copy of the GNU General Public License |
| 212 | # along with this progra(C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, |
| 213 | 2001, 2002, 2003, 2004, 2005, 2006, 2implied warranty ofot, see <https://www.gnu.org/licenses/>. |
| 214 | # |
| 215 | # As a special exceptionto the GNU General Public License, if you |
| 216 | # distribute this file as part of a program that contains a |
| 217 | # configuration script generated by Autoconf, you may include it under |
| 218 | # the same distribution terms that you use for the rest of that |
| 219 | # program. This Exception is an additional permission under section 7 |
| 220 | # of the GNU General Public License, version 3 ("GPLv3"). |
| 221 | # |
| 222 | # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. |
| 223 | # |
| 224 | # You can get the latest version of this script from: |
| 225 | # https://git.savannah.gnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc. |
| 226 | |
| 227 | $dummy.c$dummy.o $dummy.c{UNAME_SYSTEM} |
| 228 | cat <<-EOF > $dummy.c`$CC_FORHUP INT TERMneral Public License, version 3 ("GPLv3"). |
| 229 | # |
| 230 | # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. |
| 231 | # |
| 232 | # You can ggnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc. |
| 233 | |
| 234 | $dummy.c$dummy.o $dummy.c{UNAME_SYSTEM} |
| 235 | cat <<-EOF > $dummy.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh |
| 236 | # Attempt to guess a canonical system name. |
| 237 | # Copyright 1992-2014 Free Software Found4-11-04it and/or modify it |
| 238 | # under the terms of the GNU General Public License as published by |
| 239 | # t;e Free Software Foundation, either version 3 of the L;cense, or |
| 240 | # (at your optionHUP INT PIPE TERM03-23 the terms of the GNU General Public License as published by |
| 241 | # t;e Free Software Foundation, either version 3 of the L;cense, or |
| 242 | # (at your option) any later version. |
| 243 | # |
| 244 | # This program is distributed in the hope tha03-23 the terms of the GNU General Public License as published by |
| 245 | # t;e Free Software Foundation, either version 3 of the L;cense, or |
| 246 | # (at your option) any later version. |
| 247 | # |
| 248 | # This program is distributed in the hope that it will be useful, but |
| 249 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 250 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 251 | # General Public License for more details. |
| 252 | # |
| 253 | # You should have received a copy of the GNU General Public License |
| 254 | # along with this program; if not, see <https://www.gnu.org/licenses/>. |
| 255 | # |
| 256 | # As a special exceptionto the GNU General Public License, if you |
| 257 | # distribute this file as part of a program that contains a |
| 258 | # configuration script generated by Autoconf, you may include it under |
| 259 | # the same distribution terms that you use for the rest of that |
| 260 | # program. This Exception is an additional permission under section 7 |
| 261 | # of the GNU General Public License, version 3 ("GPLv3"). |
| 262 | # |
| 263 | # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. |
| 264 | # |
| 265 | # You can ggnu.org/guess;hb=HEADeration mode4 Free Software Foundation, Inc. |
| 266 | |
| 267 | $dummy.c$dummy.o $dummy.c{UNAME_SYSTEM} |
| 268 | cat <<-EOF > $dummy.c`$CC_FOR_BUILwith a ChangeLog entry to to guess a canonical s#! /bin/sh |
| 269 | # Attempt to guess a canonical system name. |
| 270 | # Open exit :riscos:*:*|arm t it will be useful, but |
| 271 | 03-23 th 23 the terms of the GNU General Public License as published by |
| 272 | # t;e Free Software Foundation, either version 3 of the L;cense, or |
| 273 | # (at your option) any later version. |
| 274 | # |
| 275 | # This program is distributed in the hope that it will be useful, but |
| 276 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 277 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 278 | # General Public License for more details. |
| 279 | # |
| 280 | # You should have received a copy of the GNU General Public License |
| 281 | # along with this program; if not, see <https://www.gnu.org/licenses/>. |
| 282 | # |
| 283 | # As a special exceptionto the GNU General Public License, if you |
| 284 | # distribute this file as part of a program that contains a |
| 285 | # configuration script generated by Autoconf, you may include it under |
| 286 | # the same distribution terms that you use for the rest of that |
| 287 | # program. This Exception is an additional permission under section 7 |
| 288 | # of the GNU General Public License, version 3 ("GPLv3"). |
| 289 | # |
| 290 | # Originally written ms of the GNU Genera532)case "${sc_kernel_bits}" in |
| 291 | 32) HP_ARCH="hppa2.0n" ;; |
| 292 | esac ;; |
| 293 | |
| 294 | #include <stdlib.h> |
| 295 | #include <unistd.h> |
| 296 | |
| 297 | int main () |
| 298 | { |
| 299 | #if |
| 300 | #endif |
| 301 | switch (cpu) |
| 302 | "); break; |
| 303 | 2_0: |
| 304 | #if |
| 305 | switch (bits) |
| 306 | { |
| 307 |
+1
| --- a/autosetup/config.sub | ||
| +++ b/autosetup/config.sub | ||
| @@ -0,0 +1 @@ | ||
| 1 | +#! /bin/ncr3#! /bin/ |
| --- a/autosetup/config.sub | |
| +++ b/autosetup/config.sub | |
| @@ -0,0 +1 @@ | |
| --- a/autosetup/config.sub | |
| +++ b/autosetup/config.sub | |
| @@ -0,0 +1 @@ | |
| 1 | #! /bin/ncr3#! /bin/ |
+9
| --- a/autosetup/find-tclsh | ||
| +++ b/autosetup/find-tclsh | ||
| @@ -0,0 +1,9 @@ | ||
| 1 | +#!/bin/sh | |
| 2 | +# Looks for a suitable tclsh or jimsh in the PATH | |
| 3 | +# If not foundstrap jimsh d=`dirname "$0"` | |
| 4 | +{ "$d/jimshd/${1-ac"; } 2>&imsh0" | |
| 5 | +for cc in tclsh8.7; do | |
| 6 | + jimsh0-tclsh}"; } 2>/devexit 0 | |
| 7 | +done | |
| 8 | +echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0" | |
| 9 | +for cc in ${CC_FOR_BUILD:-PATH="$PATH:$d2>/dev/null |
| --- a/autosetup/find-tclsh | |
| +++ b/autosetup/find-tclsh | |
| @@ -0,0 +1,9 @@ | |
| --- a/autosetup/find-tclsh | |
| +++ b/autosetup/find-tclsh | |
| @@ -0,0 +1,9 @@ | |
| 1 | #!/bin/sh |
| 2 | # Looks for a suitable tclsh or jimsh in the PATH |
| 3 | # If not foundstrap jimsh d=`dirname "$0"` |
| 4 | { "$d/jimshd/${1-ac"; } 2>&imsh0" |
| 5 | for cc in tclsh8.7; do |
| 6 | jimsh0-tclsh}"; } 2>/devexit 0 |
| 7 | done |
| 8 | echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0" |
| 9 | for cc in ${CC_FOR_BUILD:-PATH="$PATH:$d2>/dev/null |
+144
| --- a/autosetup/jimsh0.c | ||
| +++ b/autosetup/jimsh0.c | ||
| @@ -0,0 +1,144 @@ | ||
| 1 | +3cl. See http://jim.berlios.de/ */ | |
| 2 | +#define _GNU_SOURCEREFERENCES single source file,/* This is single source file, bootstrap version of Jim Tcl. See http://jim.tcl.tk/ */ | |
| 3 | +#define JIM_TCL_COMPAT_H | |
| 4 | +#define TCL_LIBRARY "." | |
| 5 | +#define jim_ext_stdlib | |
| 6 | +#define jimregexpxec | |
| 7 | +#define jim_efilexec | |
| 8 | +#define jim_eexecxec | |
| 9 | +#define jim_eclockxec | |
| 10 | +#define jim_ee TCL_PLATFORM_OS "windows" | |
| 11 | +#define TCL_PLATFORM_PLATFORM "windows" | |
| 12 | +#define TCL_PLATFORM_PATH_SEPARATOR ";" | |
| 13 | +#define HAVE_MKDIR_ONE_ARG | |
| 14 | +#define HAVE_SYSTEM | |
| 15 | +#elif defined(__MINGW32__) | |
| 16 | +#defi HAVE_DIRENT_H | |
| 17 | +#define HAVE_UNISTD_H | |
| 18 | +#define HAVE_UMASK | |
| 19 | +#include elseSEPARATOR ":" | |
| 20 | +#ifdef _ATFORM_PLATFORM "unix" | |
| 21 | +#define TCL_PLATFORM_PATH_SEPARMKSTEMP | |
| 22 | +#define HAVE_LINK | |
| 23 | +#define HAVE_SYS_TIME_H | |
| 24 | +#define HAVE_DITFORM "unix" | |
| 25 | +#define TCL_PLATFndif | |
| 26 | +#define JIM_VERS3cl. See http://jim.berlios.de/ */ | |
| 27 | +#define _GNU_SOURCEREFERENCES single source file,/* /** | |
| 28 | + * UTF-8 utility functions | |
| 29 | + * | |
| 30 | + * (c) 2010 Steve Bennett <[email protected]> | |
| 31 | + * | |
| 32 | + * See LICENCE for licence details. | |
| 33 | + */ | |
| 34 | + | |
| 35 | +/** | |
| 36 | + * Converts the given unicode codepoint (0 - 0xffff) to utf-8 | |
| 37 | + * and stores the result at 'p'. | |
| 38 | + * | |
| 39 | + * Returns the number of utf-8 characters (1-3). | |
| 40 | + */ | |
| 41 | +intJim Tcl. See http://jim.tcl.tk/ */ | |
| 42 | +#define JIM_TCL_COMPAT_H | |
| 43 | +#define/* No utf-8 support. 1 byte = 1 char */ | |
| 44 | +#define utf8_strlen(S, B) TCL_LIBRARY "." | |
| 45 | +#define j | |
| 46 | +#defineS, CP) (*(CP) = #define jim_eexecxec | |
| 47 | +#define jim_eclockxec | |
| 48 | +#define jim_ee TCL_PLATFORM_OS "windows" | |
| 49 | +#define TCL_PLATFORM_PLATFORM "windows" | |
| 50 | +#define TCL_PLAT/** | |
| 51 | + * Returns the length of the utf-8 sequence starting with 'c'. | |
| 52 | + * | |
| 53 | + * Returns 1-4, or -1 if this is not a valid start byte. | |
| 54 | + * | |
| 55 | + * Note that charlen=4 is not supported by the rest of the API. | |
| 56 | + */ | |
| 57 | +int utf8_charlen(int c); | |
| 58 | + | |
| 59 | +/** | |
| 60 | + * Returns the number of characters in the utf-8 | |
| 61 | + * string of the given byte length. | |
| 62 | + * | |
| 63 | + * Any bytes which are not part of an valid utf-8 | |
| 64 | + * sequence are treated as individual characters. | |
| 65 | + * | |
| 66 | + * The string *must* be null terminated. | |
| 67 | + * | |
| 68 | + * Does not support unicode code points > \uffff | |
| 69 | + */ | |
| 70 | +int utf8_strlen(bytelen); | |
| 71 | + | |
| 72 | +/** | |
| 73 | + * Returns the byte index of the given character in the utf-8 string. | |
| 74 | + * | |
| 75 | + * The string *must* be null terminated. | |
| 76 | + * | |
| 77 | + * This will return the byte length of a utf-8 string | |
| 78 | + * if given the char charindex); | |
| 79 | + | |
| 80 | +/** | |
| 81 | + * Returns the unicode codepoint corresponding to the | |
| 82 | + * utf-8 sequence 'str'. | |
| 83 | + * | |
| 84 | + * Stores the result in *uc and returns the number of bytes | |
| 85 | + * consumed. | |
| 86 | + * | |
| 87 | + * If 'str' is null terminated, then an invalid utf-8 sequence | |
| 88 | + * at the end of the string will be returned as individual bytes. | |
| 89 | + * | |
| 90 | + * If it is not null terminated, the length *must* be checked first. | |
| 91 | + * | |
| 92 | + * Does not support unicode c*uc); | |
| 93 | + | |
| 94 | +/** | |
| 95 | + * Returns the number of bytes before 'str' that the previous | |
| 96 | + * utf-8 character sequence starts (which may be the middle of a sequence). | |
| 97 | + * | |
| 98 | + * Looks back at most 'len' bytes backwards, which must be > 0. | |
| 99 | + * If no start char is found, returns -len | |
| 100 | + */ | |
| 101 | +int utf8_prev_len( | |
| 102 | +/** | |
| 103 | + * Returns the upper-case variant of the given unicode codepoint. | |
| 104 | + * | |
| 105 | + * Does not support unicode code points > \uffff | |
| 106 | + */ | |
| 107 | +int utf8_upper(int uc); | |
| 108 | + | |
| 109 | +/** | |
| 110 | + * Returns the lower-case variant of the given unicode codepoint. | |
| 111 | + * | |
| 112 | + * NOTE: Use utf8_upper() in preference for case-insensitive matching. | |
| 113 | + * | |
| 114 | + * Does not support unicode code points > \uffff | |
| 115 | + */ | |
| 116 | +int utf8_lower(int uc); | |
| 117 | + | |
| 118 | +#endif | |
| 119 | + | |
| 120 | +#endif | |
| 121 | +/* Jim - A small embeddable Tcl interpreter | |
| 122 | + * | |
| 123 | + * Copyright 2005 Salvatore Sanfilippo <[email protected]> | |
| 124 | + * Copyright 2005 Clemens Hintze <[email protected]> | |
| 125 | + * Copyright 2005 patthoyts - Pat Thoyts <[email protected]> | |
| 126 | + * Copyright 2008 oharboe - �yvind Harboe - [email protected] | |
| 127 | + * Copyright 2008 Andrew Lunn <[email protected]> | |
| 128 | + * Copyright 2008 Duane Ellis <[email protected]> | |
| 129 | + * Copyright 2008 Uwe Klein <[email protected]> | |
| 130 | + * | |
| 131 | + * Redistribution and use in source and binary forms, with or without | |
| 132 | + * modification, are permitted provided that the following conditions | |
| 133 | + * are met: | |
| 134 | + * | |
| 135 | + * 1. Redistributions of source code must retain the above copyright | |
| 136 | + * notice, this list of conditions and the following disclaimer. | |
| 137 | + * 2. Redistributions in binary form must reproduce the above | |
| 138 | + * copyright notice, this list of conditions and the following | |
| 139 | + * disclaimer in the documentation and/or other materials | |
| 140 | + * provided with the distribution. | |
| 141 | + * | |
| 142 | + * THIS SOFTWARE IS PROVIDED BY THE JIM TCL PROJECT ``AS IS'' AND ANY | |
| 143 | + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
| 144 | + * THE IMPLIED WARRANTIES OF MERCHANTABILI |
| --- a/autosetup/jimsh0.c | |
| +++ b/autosetup/jimsh0.c | |
| @@ -0,0 +1,144 @@ | |
| --- a/autosetup/jimsh0.c | |
| +++ b/autosetup/jimsh0.c | |
| @@ -0,0 +1,144 @@ | |
| 1 | 3cl. See http://jim.berlios.de/ */ |
| 2 | #define _GNU_SOURCEREFERENCES single source file,/* This is single source file, bootstrap version of Jim Tcl. See http://jim.tcl.tk/ */ |
| 3 | #define JIM_TCL_COMPAT_H |
| 4 | #define TCL_LIBRARY "." |
| 5 | #define jim_ext_stdlib |
| 6 | #define jimregexpxec |
| 7 | #define jim_efilexec |
| 8 | #define jim_eexecxec |
| 9 | #define jim_eclockxec |
| 10 | #define jim_ee TCL_PLATFORM_OS "windows" |
| 11 | #define TCL_PLATFORM_PLATFORM "windows" |
| 12 | #define TCL_PLATFORM_PATH_SEPARATOR ";" |
| 13 | #define HAVE_MKDIR_ONE_ARG |
| 14 | #define HAVE_SYSTEM |
| 15 | #elif defined(__MINGW32__) |
| 16 | #defi HAVE_DIRENT_H |
| 17 | #define HAVE_UNISTD_H |
| 18 | #define HAVE_UMASK |
| 19 | #include elseSEPARATOR ":" |
| 20 | #ifdef _ATFORM_PLATFORM "unix" |
| 21 | #define TCL_PLATFORM_PATH_SEPARMKSTEMP |
| 22 | #define HAVE_LINK |
| 23 | #define HAVE_SYS_TIME_H |
| 24 | #define HAVE_DITFORM "unix" |
| 25 | #define TCL_PLATFndif |
| 26 | #define JIM_VERS3cl. See http://jim.berlios.de/ */ |
| 27 | #define _GNU_SOURCEREFERENCES single source file,/* /** |
| 28 | * UTF-8 utility functions |
| 29 | * |
| 30 | * (c) 2010 Steve Bennett <[email protected]> |
| 31 | * |
| 32 | * See LICENCE for licence details. |
| 33 | */ |
| 34 | |
| 35 | /** |
| 36 | * Converts the given unicode codepoint (0 - 0xffff) to utf-8 |
| 37 | * and stores the result at 'p'. |
| 38 | * |
| 39 | * Returns the number of utf-8 characters (1-3). |
| 40 | */ |
| 41 | intJim Tcl. See http://jim.tcl.tk/ */ |
| 42 | #define JIM_TCL_COMPAT_H |
| 43 | #define/* No utf-8 support. 1 byte = 1 char */ |
| 44 | #define utf8_strlen(S, B) TCL_LIBRARY "." |
| 45 | #define j |
| 46 | #defineS, CP) (*(CP) = #define jim_eexecxec |
| 47 | #define jim_eclockxec |
| 48 | #define jim_ee TCL_PLATFORM_OS "windows" |
| 49 | #define TCL_PLATFORM_PLATFORM "windows" |
| 50 | #define TCL_PLAT/** |
| 51 | * Returns the length of the utf-8 sequence starting with 'c'. |
| 52 | * |
| 53 | * Returns 1-4, or -1 if this is not a valid start byte. |
| 54 | * |
| 55 | * Note that charlen=4 is not supported by the rest of the API. |
| 56 | */ |
| 57 | int utf8_charlen(int c); |
| 58 | |
| 59 | /** |
| 60 | * Returns the number of characters in the utf-8 |
| 61 | * string of the given byte length. |
| 62 | * |
| 63 | * Any bytes which are not part of an valid utf-8 |
| 64 | * sequence are treated as individual characters. |
| 65 | * |
| 66 | * The string *must* be null terminated. |
| 67 | * |
| 68 | * Does not support unicode code points > \uffff |
| 69 | */ |
| 70 | int utf8_strlen(bytelen); |
| 71 | |
| 72 | /** |
| 73 | * Returns the byte index of the given character in the utf-8 string. |
| 74 | * |
| 75 | * The string *must* be null terminated. |
| 76 | * |
| 77 | * This will return the byte length of a utf-8 string |
| 78 | * if given the char charindex); |
| 79 | |
| 80 | /** |
| 81 | * Returns the unicode codepoint corresponding to the |
| 82 | * utf-8 sequence 'str'. |
| 83 | * |
| 84 | * Stores the result in *uc and returns the number of bytes |
| 85 | * consumed. |
| 86 | * |
| 87 | * If 'str' is null terminated, then an invalid utf-8 sequence |
| 88 | * at the end of the string will be returned as individual bytes. |
| 89 | * |
| 90 | * If it is not null terminated, the length *must* be checked first. |
| 91 | * |
| 92 | * Does not support unicode c*uc); |
| 93 | |
| 94 | /** |
| 95 | * Returns the number of bytes before 'str' that the previous |
| 96 | * utf-8 character sequence starts (which may be the middle of a sequence). |
| 97 | * |
| 98 | * Looks back at most 'len' bytes backwards, which must be > 0. |
| 99 | * If no start char is found, returns -len |
| 100 | */ |
| 101 | int utf8_prev_len( |
| 102 | /** |
| 103 | * Returns the upper-case variant of the given unicode codepoint. |
| 104 | * |
| 105 | * Does not support unicode code points > \uffff |
| 106 | */ |
| 107 | int utf8_upper(int uc); |
| 108 | |
| 109 | /** |
| 110 | * Returns the lower-case variant of the given unicode codepoint. |
| 111 | * |
| 112 | * NOTE: Use utf8_upper() in preference for case-insensitive matching. |
| 113 | * |
| 114 | * Does not support unicode code points > \uffff |
| 115 | */ |
| 116 | int utf8_lower(int uc); |
| 117 | |
| 118 | #endif |
| 119 | |
| 120 | #endif |
| 121 | /* Jim - A small embeddable Tcl interpreter |
| 122 | * |
| 123 | * Copyright 2005 Salvatore Sanfilippo <[email protected]> |
| 124 | * Copyright 2005 Clemens Hintze <[email protected]> |
| 125 | * Copyright 2005 patthoyts - Pat Thoyts <[email protected]> |
| 126 | * Copyright 2008 oharboe - �yvind Harboe - [email protected] |
| 127 | * Copyright 2008 Andrew Lunn <[email protected]> |
| 128 | * Copyright 2008 Duane Ellis <[email protected]> |
| 129 | * Copyright 2008 Uwe Klein <[email protected]> |
| 130 | * |
| 131 | * Redistribution and use in source and binary forms, with or without |
| 132 | * modification, are permitted provided that the following conditions |
| 133 | * are met: |
| 134 | * |
| 135 | * 1. Redistributions of source code must retain the above copyright |
| 136 | * notice, this list of conditions and the following disclaimer. |
| 137 | * 2. Redistributions in binary form must reproduce the above |
| 138 | * copyright notice, this list of conditions and the following |
| 139 | * disclaimer in the documentation and/or other materials |
| 140 | * provided with the distribution. |
| 141 | * |
| 142 | * THIS SOFTWARE IS PROVIDED BY THE JIM TCL PROJECT ``AS IS'' AND ANY |
| 143 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 144 | * THE IMPLIED WARRANTIES OF MERCHANTABILI |
+2
| --- a/autosetup/local.tcl | ||
| +++ b/autosetup/local.tcl | ||
| @@ -0,0 +1,2 @@ | ||
| 1 | +# For this project, d | |
| 2 | +set useropts(nopager)tosetup(optdefault) nopager 1 |
| --- a/autosetup/local.tcl | |
| +++ b/autosetup/local.tcl | |
| @@ -0,0 +1,2 @@ | |
| --- a/autosetup/local.tcl | |
| +++ b/autosetup/local.tcl | |
| @@ -0,0 +1,2 @@ | |
| 1 | # For this project, d |
| 2 | set useropts(nopager)tosetup(optdefault) nopager 1 |
+80
| --- a/autosetup/system.tcl | ||
| +++ b/autosetup/system.tcl | ||
| @@ -0,0 +1,80 @@ | ||
| 1 | +# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ | |
| 2 | +# All rights reserved | |
| 3 | + | |
| 4 | +# @synopsis: | |
| 5 | +# | |
| 6 | +# This module supports common system interroga--host, --build, --prefix, and setting srcdir, builddir, and EXEXT. | |
| 7 | +# | |
| 8 | +# It naming convention, where searchisys/type.h defines HAVE_SYS_TYPES_H | |
| 9 | +# | |
| 10 | +# It defines the fol--prefix unless overridden by the module-optionsation and options | |
| 11 | +# such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'. | |
| 12 | +# | |
| 13 | +# It also support the "feature" naming convention, where searching | |
| 14 | +# for a feature such as 'sys/type => ines the followins to '$defaultprefix overridden by the user: | |
| 15 | +# | |
| 16 | +## datadir | |
| 17 | +## sysconfdir | |
| 18 | +## sharedstatedir | |
| 19 | +## localstatedir | |
| 20 | +## infodir | |
| 21 | +## mandir | |
| 22 | +## includedir | |
| 23 | +# | |
| 24 | +# If '--prefix' is not /usr/localaults to '/usr/local' unless 'options-defaults { prefix ... }'prefix ... }' # | |
| 25 | + program-transform-name: | |
| 26 | +} | |
| 27 | + | |
| 28 | +# @check-feature name { script } | |
| 29 | +# | |
| 30 | +# defines feature '$nReturns 1 if exists, or 0 if not | |
| 31 | +#ode} { | |
| 32 | + msg-checking "Checking for $name..." | |
| 33 | + set r [uplevel 1 $code | |
| 34 | + define-feature $name $r | |
| 35 | + if {$r} { | |
| 36 | + msg-result "ok" | |
| 37 | + } else { | |
| 38 | + msg-result "not found" | |
| 39 | + } | |
| 40 | + return $r | |
| 41 | +} | |
| 42 | + | |
| 43 | +# @have-feature name ?default=0? | |
| 44 | +# | |
| 45 | +# Returns the value of feature '$name' if defined,the feature if de | |
| 46 | +# is translated thehave-feature {name {defathe 0}. Use @top_sr# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ | |
| 47 | +# All rights reserved | |
| 48 | + | |
| 49 | +# @synopsis: | |
| 50 | +# | |
| 51 | +# This module supports common system interroga--host, --build, --prefix, and setting srcdir, builddir, and EXEXT. | |
| 52 | +# | |
| 53 | +# It naming convention, where searchisys/type.h defines HAVE_SYS_TYPES_H | |
| 54 | +# | |
| 55 | +# It defines the fol--prefix unless overridden by the module-optionsation and options | |
| 56 | +# such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'. | |
| 57 | +# | |
| 58 | +# It also support the "feature" naming convention, where searching | |
| 59 | +# for a feature such as 'sys/type => ines the followins to '$defaultprefix overridden by the user: | |
| 60 | +# | |
| 61 | +## datadir | |
| 62 | +## sysconfdir | |
| 63 | +## sharedstatedir | |
| 64 | +## localstatedir | |
| 65 | +## infodir | |
| 66 | +## mandir | |
| 67 | +## includedir | |
| 68 | +# | |
| 69 | +# If '--prefix' is not /usr/localaults to '/usr/local' unless 'options-defaults { prefix ... }'prefix ... }' # | |
| 70 | + program-transform-name: | |
| 71 | +} | |
| 72 | + | |
| 73 | +# @check-feature set prefixdefine[get-env exec-prefix \${prefix}]]\${exec_prefix}/bin | |
| 74 | + sbindir \${exec_prefix}/sbin | |
| 75 | + libexecdir \${exec_prefix}/libexec | |
| 76 | + libdir \${exec_prefix}/lib | |
| 77 | + datadir \${prefix}/share | |
| 78 | + sysconfdir \${prefix}/etc | |
| 79 | + sharedstatedir \${prefix}\${prefix}/var | |
| 80 | + infodir \${prefix}\${prefix}/share Copyright (c) ht (c) 2010 WorkWare Sys |
| --- a/autosetup/system.tcl | |
| +++ b/autosetup/system.tcl | |
| @@ -0,0 +1,80 @@ | |
| --- a/autosetup/system.tcl | |
| +++ b/autosetup/system.tcl | |
| @@ -0,0 +1,80 @@ | |
| 1 | # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ |
| 2 | # All rights reserved |
| 3 | |
| 4 | # @synopsis: |
| 5 | # |
| 6 | # This module supports common system interroga--host, --build, --prefix, and setting srcdir, builddir, and EXEXT. |
| 7 | # |
| 8 | # It naming convention, where searchisys/type.h defines HAVE_SYS_TYPES_H |
| 9 | # |
| 10 | # It defines the fol--prefix unless overridden by the module-optionsation and options |
| 11 | # such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'. |
| 12 | # |
| 13 | # It also support the "feature" naming convention, where searching |
| 14 | # for a feature such as 'sys/type => ines the followins to '$defaultprefix overridden by the user: |
| 15 | # |
| 16 | ## datadir |
| 17 | ## sysconfdir |
| 18 | ## sharedstatedir |
| 19 | ## localstatedir |
| 20 | ## infodir |
| 21 | ## mandir |
| 22 | ## includedir |
| 23 | # |
| 24 | # If '--prefix' is not /usr/localaults to '/usr/local' unless 'options-defaults { prefix ... }'prefix ... }' # |
| 25 | program-transform-name: |
| 26 | } |
| 27 | |
| 28 | # @check-feature name { script } |
| 29 | # |
| 30 | # defines feature '$nReturns 1 if exists, or 0 if not |
| 31 | #ode} { |
| 32 | msg-checking "Checking for $name..." |
| 33 | set r [uplevel 1 $code |
| 34 | define-feature $name $r |
| 35 | if {$r} { |
| 36 | msg-result "ok" |
| 37 | } else { |
| 38 | msg-result "not found" |
| 39 | } |
| 40 | return $r |
| 41 | } |
| 42 | |
| 43 | # @have-feature name ?default=0? |
| 44 | # |
| 45 | # Returns the value of feature '$name' if defined,the feature if de |
| 46 | # is translated thehave-feature {name {defathe 0}. Use @top_sr# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ |
| 47 | # All rights reserved |
| 48 | |
| 49 | # @synopsis: |
| 50 | # |
| 51 | # This module supports common system interroga--host, --build, --prefix, and setting srcdir, builddir, and EXEXT. |
| 52 | # |
| 53 | # It naming convention, where searchisys/type.h defines HAVE_SYS_TYPES_H |
| 54 | # |
| 55 | # It defines the fol--prefix unless overridden by the module-optionsation and options |
| 56 | # such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'. |
| 57 | # |
| 58 | # It also support the "feature" naming convention, where searching |
| 59 | # for a feature such as 'sys/type => ines the followins to '$defaultprefix overridden by the user: |
| 60 | # |
| 61 | ## datadir |
| 62 | ## sysconfdir |
| 63 | ## sharedstatedir |
| 64 | ## localstatedir |
| 65 | ## infodir |
| 66 | ## mandir |
| 67 | ## includedir |
| 68 | # |
| 69 | # If '--prefix' is not /usr/localaults to '/usr/local' unless 'options-defaults { prefix ... }'prefix ... }' # |
| 70 | program-transform-name: |
| 71 | } |
| 72 | |
| 73 | # @check-feature set prefixdefine[get-env exec-prefix \${prefix}]]\${exec_prefix}/bin |
| 74 | sbindir \${exec_prefix}/sbin |
| 75 | libexecdir \${exec_prefix}/libexec |
| 76 | libdir \${exec_prefix}/lib |
| 77 | datadir \${prefix}/share |
| 78 | sysconfdir \${prefix}/etc |
| 79 | sharedstatedir \${prefix}\${prefix}/var |
| 80 | infodir \${prefix}\${prefix}/share Copyright (c) ht (c) 2010 WorkWare Sys |
+21
| --- a/autosetup/test-tclsh | ||
| +++ b/autosetup/test-tclsh | ||
| @@ -0,0 +1,21 @@ | ||
| 1 | +# A small Tcl script to verify that the chosen | |
| 2 | +# interpreter works. Sometimes we might e.g. pick up | |
| 3 | +# an interpreter for a different arch. | |
| 4 | +# Outputs the full path to the interpreter | |
| 5 | + | |
| 6 | +if {[catch {info version} version] == 0} { | |
| 7 | + # This is Jim Tcl | |
| 8 | + if {$version >= 0.70} { | |
| 9 | + # Ensure that rege | |
| 10 | + # Older versions of jimsh mayinfo patchlevel]]} { | |
| 11 | + puts [info nameofexecutable] | |
| 12 | + exit 0 | |
| 13 | + } | |
| 14 | +} | |
| 15 | +exit 1 | |
| 16 | +puts [file join [p] | |
| 17 | + exit 0 | |
| 18 | + } | |
| 19 | +} elseif {[catch {info tclversion} version] == 0} { | |
| 20 | + if {$version >= 8.5 && ![string match 8.5a* [info patchlevel]]} { | |
| 21 | + puts [info nameofexecut |
| --- a/autosetup/test-tclsh | |
| +++ b/autosetup/test-tclsh | |
| @@ -0,0 +1,21 @@ | |
| --- a/autosetup/test-tclsh | |
| +++ b/autosetup/test-tclsh | |
| @@ -0,0 +1,21 @@ | |
| 1 | # A small Tcl script to verify that the chosen |
| 2 | # interpreter works. Sometimes we might e.g. pick up |
| 3 | # an interpreter for a different arch. |
| 4 | # Outputs the full path to the interpreter |
| 5 | |
| 6 | if {[catch {info version} version] == 0} { |
| 7 | # This is Jim Tcl |
| 8 | if {$version >= 0.70} { |
| 9 | # Ensure that rege |
| 10 | # Older versions of jimsh mayinfo patchlevel]]} { |
| 11 | puts [info nameofexecutable] |
| 12 | exit 0 |
| 13 | } |
| 14 | } |
| 15 | exit 1 |
| 16 | puts [file join [p] |
| 17 | exit 0 |
| 18 | } |
| 19 | } elseif {[catch {info tclversion} version] == 0} { |
| 20 | if {$version >= 8.5 && ![string match 8.5a* [info patchlevel]]} { |
| 21 | puts [info nameofexecut |
+3
| --- a/configure | ||
| +++ b/configure | ||
| @@ -0,0 +1,3 @@ | ||
| 1 | +#!/bin/sh | |
| 2 | +dir=autosetup" | |
| 3 | +#st -f "$ir/auhen exec |
| --- a/configure | |
| +++ b/configure | |
| @@ -0,0 +1,3 @@ | |
| --- a/configure | |
| +++ b/configure | |
| @@ -0,0 +1,3 @@ | |
| 1 | #!/bin/sh |
| 2 | dir=autosetup" |
| 3 | #st -f "$ir/auhen exec |
+74
-21
| --- src/add.c | ||
| +++ src/add.c | ||
| @@ -92,66 +92,76 @@ | ||
| 92 | 92 | ** |
| 93 | 93 | ** Omit any file whose name is pOmit. |
| 94 | 94 | */ |
| 95 | 95 | static int add_one_file( |
| 96 | 96 | const char *zPath, /* Tree-name of file to add. */ |
| 97 | - int vid /* Add to this VFILE */ | |
| 97 | + int vid, /* Add to this VFILE */ | |
| 98 | + int caseSensitive /* True if filenames are case sensitive */ | |
| 98 | 99 | ){ |
| 100 | + const char *zCollate = caseSensitive ? "binary" : "nocase"; | |
| 99 | 101 | if( !file_is_simple_pathname(zPath) ){ |
| 100 | 102 | fossil_fatal("filename contains illegal characters: %s", zPath); |
| 101 | 103 | } |
| 102 | -#if defined(_WIN32) | |
| 103 | 104 | if( db_exists("SELECT 1 FROM vfile" |
| 104 | - " WHERE pathname=%Q COLLATE nocase", zPath) ){ | |
| 105 | + " WHERE pathname=%Q COLLATE %s", zPath, zCollate) ){ | |
| 105 | 106 | db_multi_exec("UPDATE vfile SET deleted=0" |
| 106 | - " WHERE pathname=%Q COLLATE nocase", zPath); | |
| 107 | - } | |
| 108 | -#else | |
| 109 | - if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){ | |
| 110 | - db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath); | |
| 111 | - } | |
| 112 | -#endif | |
| 113 | - else{ | |
| 107 | + " WHERE pathname=%Q COLLATE %s", zPath, zCollate); | |
| 108 | + }else{ | |
| 114 | 109 | char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath); |
| 115 | 110 | db_multi_exec( |
| 116 | 111 | "INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe)" |
| 117 | 112 | "VALUES(%d,0,0,0,%Q,%d)", |
| 118 | 113 | vid, zPath, file_isexe(zFullname)); |
| 119 | 114 | fossil_free(zFullname); |
| 120 | 115 | } |
| 121 | - fossil_print("ADDED %s\n", zPath); | |
| 122 | - return 1; | |
| 116 | + if( db_changes() ){ | |
| 117 | + fossil_print("ADDED %s\n", zPath); | |
| 118 | + return 1; | |
| 119 | + }else{ | |
| 120 | + fossil_print("SKIP %s\n", zPath); | |
| 121 | + return 0; | |
| 122 | + } | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /* |
| 126 | 126 | ** Add all files in the sfile temp table. |
| 127 | 127 | ** |
| 128 | 128 | ** Automatically exclude the repository file. |
| 129 | 129 | */ |
| 130 | -static int add_files_in_sfile(int vid){ | |
| 130 | +static int add_files_in_sfile(int vid, int caseSensitive){ | |
| 131 | 131 | const char *zRepo; /* Name of the repository database file */ |
| 132 | 132 | int nAdd = 0; /* Number of files added */ |
| 133 | 133 | int i; /* Loop counter */ |
| 134 | 134 | const char *zReserved; /* Name of a reserved file */ |
| 135 | 135 | Blob repoName; /* Treename of the repository */ |
| 136 | 136 | Stmt loop; /* SQL to loop over all files to add */ |
| 137 | + int (*xCmp)(const char*,const char*); | |
| 137 | 138 | |
| 138 | 139 | if( !file_tree_name(g.zRepositoryName, &repoName, 0) ){ |
| 139 | 140 | blob_zero(&repoName); |
| 140 | 141 | zRepo = ""; |
| 141 | 142 | }else{ |
| 142 | 143 | zRepo = blob_str(&repoName); |
| 144 | + } | |
| 145 | + if( caseSensitive ){ | |
| 146 | + xCmp = fossil_strcmp; | |
| 147 | + }else{ | |
| 148 | + xCmp = fossil_stricmp; | |
| 149 | + db_multi_exec( | |
| 150 | + "CREATE INDEX IF NOT EXISTS vfile_nocase" | |
| 151 | + " ON vfile(pathname COLLATE nocase)" | |
| 152 | + ); | |
| 143 | 153 | } |
| 144 | 154 | db_prepare(&loop, "SELECT x FROM sfile ORDER BY x"); |
| 145 | 155 | while( db_step(&loop)==SQLITE_ROW ){ |
| 146 | 156 | const char *zToAdd = db_column_text(&loop, 0); |
| 147 | 157 | if( fossil_strcmp(zToAdd, zRepo)==0 ) continue; |
| 148 | 158 | for(i=0; (zReserved = fossil_reserved_name(i))!=0; i++){ |
| 149 | - if( fossil_strcmp(zToAdd, zReserved)==0 ) break; | |
| 159 | + if( xCmp(zToAdd, zReserved)==0 ) break; | |
| 150 | 160 | } |
| 151 | 161 | if( zReserved ) continue; |
| 152 | - nAdd += add_one_file(zToAdd, vid); | |
| 162 | + nAdd += add_one_file(zToAdd, vid, caseSensitive); | |
| 153 | 163 | } |
| 154 | 164 | db_finalize(&loop); |
| 155 | 165 | blob_reset(&repoName); |
| 156 | 166 | return nAdd; |
| 157 | 167 | } |
| @@ -180,14 +190,17 @@ | ||
| 180 | 190 | int i; /* Loop counter */ |
| 181 | 191 | int vid; /* Currently checked out version */ |
| 182 | 192 | int nRoot; /* Full path characters in g.zLocalRoot */ |
| 183 | 193 | const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */ |
| 184 | 194 | Glob *pIgnore; /* Ignore everything matching this glob pattern */ |
| 195 | + int caseSensitive; /* True if filenames are case sensitive */ | |
| 185 | 196 | |
| 186 | 197 | zIgnoreFlag = find_option("ignore",0,1); |
| 187 | 198 | includeDotFiles = find_option("dotfiles",0,0)!=0; |
| 199 | + capture_case_sensitive_option(); | |
| 188 | 200 | db_must_be_within_tree(); |
| 201 | + caseSensitive = filenames_are_case_sensitive(); | |
| 189 | 202 | if( zIgnoreFlag==0 ){ |
| 190 | 203 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 191 | 204 | } |
| 192 | 205 | vid = db_lget_int("checkout",0); |
| 193 | 206 | if( vid==0 ){ |
| @@ -229,11 +242,11 @@ | ||
| 229 | 242 | } |
| 230 | 243 | blob_reset(&fullName); |
| 231 | 244 | } |
| 232 | 245 | glob_free(pIgnore); |
| 233 | 246 | |
| 234 | - add_files_in_sfile(vid); | |
| 247 | + add_files_in_sfile(vid, caseSensitive); | |
| 235 | 248 | db_end_transaction(0); |
| 236 | 249 | } |
| 237 | 250 | |
| 238 | 251 | /* |
| 239 | 252 | ** COMMAND: rm |
| @@ -289,10 +302,48 @@ | ||
| 289 | 302 | "UPDATE vfile SET deleted=1 WHERE pathname IN sfile;" |
| 290 | 303 | "DELETE FROM vfile WHERE rid=0 AND deleted;" |
| 291 | 304 | ); |
| 292 | 305 | db_end_transaction(0); |
| 293 | 306 | } |
| 307 | + | |
| 308 | +/* | |
| 309 | +** Capture the command-line --case-sensitive option. | |
| 310 | +*/ | |
| 311 | +static const char *zCaseSensitive = 0; | |
| 312 | +void capture_case_sensitive_option(void){ | |
| 313 | + if( zCaseSensitive==0 ){ | |
| 314 | + zCaseSensitive = find_option("case-sensitive",0,1); | |
| 315 | + } | |
| 316 | +} | |
| 317 | + | |
| 318 | +/* | |
| 319 | +** This routine determines if files should be case-sensitive or not. | |
| 320 | +** In other words, this routine determines if two filenames that | |
| 321 | +** differ only in case should be considered the same name or not. | |
| 322 | +** | |
| 323 | +** The case-sensitive setting determines the default value. If | |
| 324 | +** the case-sensitive setting is undefined, then case sensitivity | |
| 325 | +** defaults on for Mac and Windows and off for all other unix. | |
| 326 | +** | |
| 327 | +** The --case-sensitive BOOLEAN command-line option overrides any | |
| 328 | +** setting. | |
| 329 | +*/ | |
| 330 | +int filenames_are_case_sensitive(void){ | |
| 331 | + int caseSensitive; | |
| 332 | + | |
| 333 | + if( zCaseSensitive ){ | |
| 334 | + caseSensitive = is_truth(zCaseSensitive); | |
| 335 | + }else{ | |
| 336 | +#if !defined(_WIN32) && !defined(__DARWIN__) && !defined(__APPLE__) | |
| 337 | + caseSensitive = 1; | |
| 338 | +#else | |
| 339 | + caseSensitive = 0; | |
| 340 | +#endif | |
| 341 | + caseSensitive = db_get_boolean("case-sensitive",caseSensitive); | |
| 342 | + } | |
| 343 | + return caseSensitive; | |
| 344 | +} | |
| 294 | 345 | |
| 295 | 346 | /* |
| 296 | 347 | ** COMMAND: addremove |
| 297 | 348 | ** |
| 298 | 349 | ** Usage: %fossil addremove ?--dotfiles? ?--ignore GLOBPATTERN? ?--test? |
| @@ -319,27 +370,29 @@ | ||
| 319 | 370 | ** |
| 320 | 371 | ** The --test option shows what would happen without actually doing anything. |
| 321 | 372 | ** |
| 322 | 373 | ** This command can be used to track third party software. |
| 323 | 374 | ** |
| 324 | -** | |
| 325 | 375 | ** SUMMARY: fossil addremove |
| 326 | -** Options: ?--dotfiles? ?--ignore GLOBPATTERN? ?--test? | |
| 376 | +** Options: ?--dotfiles? ?--ignore GLOB? ?--test? ?--case-sensitive BOOL? | |
| 327 | 377 | */ |
| 328 | -void import_cmd(void){ | |
| 378 | +void addremove_cmd(void){ | |
| 329 | 379 | Blob path; |
| 330 | 380 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 331 | 381 | int allFlag = find_option("dotfiles",0,0)!=0; |
| 332 | 382 | int isTest = find_option("test",0,0)!=0; |
| 383 | + int caseSensitive; | |
| 333 | 384 | int n; |
| 334 | 385 | Stmt q; |
| 335 | 386 | int vid; |
| 336 | 387 | int nAdd = 0; |
| 337 | 388 | int nDelete = 0; |
| 338 | 389 | Glob *pIgnore; |
| 339 | 390 | |
| 391 | + capture_case_sensitive_option(); | |
| 340 | 392 | db_must_be_within_tree(); |
| 393 | + caseSensitive = filenames_are_case_sensitive(); | |
| 341 | 394 | if( zIgnoreFlag==0 ){ |
| 342 | 395 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 343 | 396 | } |
| 344 | 397 | vid = db_lget_int("checkout",0); |
| 345 | 398 | if( vid==0 ){ |
| @@ -358,11 +411,11 @@ | ||
| 358 | 411 | blob_init(&path, g.zLocalRoot, n-1); |
| 359 | 412 | /* now we read the complete file structure into a temp table */ |
| 360 | 413 | pIgnore = glob_create(zIgnoreFlag); |
| 361 | 414 | vfile_scan(&path, blob_size(&path), allFlag, pIgnore); |
| 362 | 415 | glob_free(pIgnore); |
| 363 | - nAdd = add_files_in_sfile(vid); | |
| 416 | + nAdd = add_files_in_sfile(vid, caseSensitive); | |
| 364 | 417 | |
| 365 | 418 | /* step 2: search for missing files */ |
| 366 | 419 | db_prepare(&q, |
| 367 | 420 | "SELECT pathname, %Q || pathname, deleted FROM vfile" |
| 368 | 421 | " WHERE NOT deleted" |
| 369 | 422 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -92,66 +92,76 @@ | |
| 92 | ** |
| 93 | ** Omit any file whose name is pOmit. |
| 94 | */ |
| 95 | static int add_one_file( |
| 96 | const char *zPath, /* Tree-name of file to add. */ |
| 97 | int vid /* Add to this VFILE */ |
| 98 | ){ |
| 99 | if( !file_is_simple_pathname(zPath) ){ |
| 100 | fossil_fatal("filename contains illegal characters: %s", zPath); |
| 101 | } |
| 102 | #if defined(_WIN32) |
| 103 | if( db_exists("SELECT 1 FROM vfile" |
| 104 | " WHERE pathname=%Q COLLATE nocase", zPath) ){ |
| 105 | db_multi_exec("UPDATE vfile SET deleted=0" |
| 106 | " WHERE pathname=%Q COLLATE nocase", zPath); |
| 107 | } |
| 108 | #else |
| 109 | if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){ |
| 110 | db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath); |
| 111 | } |
| 112 | #endif |
| 113 | else{ |
| 114 | char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath); |
| 115 | db_multi_exec( |
| 116 | "INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe)" |
| 117 | "VALUES(%d,0,0,0,%Q,%d)", |
| 118 | vid, zPath, file_isexe(zFullname)); |
| 119 | fossil_free(zFullname); |
| 120 | } |
| 121 | fossil_print("ADDED %s\n", zPath); |
| 122 | return 1; |
| 123 | } |
| 124 | |
| 125 | /* |
| 126 | ** Add all files in the sfile temp table. |
| 127 | ** |
| 128 | ** Automatically exclude the repository file. |
| 129 | */ |
| 130 | static int add_files_in_sfile(int vid){ |
| 131 | const char *zRepo; /* Name of the repository database file */ |
| 132 | int nAdd = 0; /* Number of files added */ |
| 133 | int i; /* Loop counter */ |
| 134 | const char *zReserved; /* Name of a reserved file */ |
| 135 | Blob repoName; /* Treename of the repository */ |
| 136 | Stmt loop; /* SQL to loop over all files to add */ |
| 137 | |
| 138 | if( !file_tree_name(g.zRepositoryName, &repoName, 0) ){ |
| 139 | blob_zero(&repoName); |
| 140 | zRepo = ""; |
| 141 | }else{ |
| 142 | zRepo = blob_str(&repoName); |
| 143 | } |
| 144 | db_prepare(&loop, "SELECT x FROM sfile ORDER BY x"); |
| 145 | while( db_step(&loop)==SQLITE_ROW ){ |
| 146 | const char *zToAdd = db_column_text(&loop, 0); |
| 147 | if( fossil_strcmp(zToAdd, zRepo)==0 ) continue; |
| 148 | for(i=0; (zReserved = fossil_reserved_name(i))!=0; i++){ |
| 149 | if( fossil_strcmp(zToAdd, zReserved)==0 ) break; |
| 150 | } |
| 151 | if( zReserved ) continue; |
| 152 | nAdd += add_one_file(zToAdd, vid); |
| 153 | } |
| 154 | db_finalize(&loop); |
| 155 | blob_reset(&repoName); |
| 156 | return nAdd; |
| 157 | } |
| @@ -180,14 +190,17 @@ | |
| 180 | int i; /* Loop counter */ |
| 181 | int vid; /* Currently checked out version */ |
| 182 | int nRoot; /* Full path characters in g.zLocalRoot */ |
| 183 | const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */ |
| 184 | Glob *pIgnore; /* Ignore everything matching this glob pattern */ |
| 185 | |
| 186 | zIgnoreFlag = find_option("ignore",0,1); |
| 187 | includeDotFiles = find_option("dotfiles",0,0)!=0; |
| 188 | db_must_be_within_tree(); |
| 189 | if( zIgnoreFlag==0 ){ |
| 190 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 191 | } |
| 192 | vid = db_lget_int("checkout",0); |
| 193 | if( vid==0 ){ |
| @@ -229,11 +242,11 @@ | |
| 229 | } |
| 230 | blob_reset(&fullName); |
| 231 | } |
| 232 | glob_free(pIgnore); |
| 233 | |
| 234 | add_files_in_sfile(vid); |
| 235 | db_end_transaction(0); |
| 236 | } |
| 237 | |
| 238 | /* |
| 239 | ** COMMAND: rm |
| @@ -289,10 +302,48 @@ | |
| 289 | "UPDATE vfile SET deleted=1 WHERE pathname IN sfile;" |
| 290 | "DELETE FROM vfile WHERE rid=0 AND deleted;" |
| 291 | ); |
| 292 | db_end_transaction(0); |
| 293 | } |
| 294 | |
| 295 | /* |
| 296 | ** COMMAND: addremove |
| 297 | ** |
| 298 | ** Usage: %fossil addremove ?--dotfiles? ?--ignore GLOBPATTERN? ?--test? |
| @@ -319,27 +370,29 @@ | |
| 319 | ** |
| 320 | ** The --test option shows what would happen without actually doing anything. |
| 321 | ** |
| 322 | ** This command can be used to track third party software. |
| 323 | ** |
| 324 | ** |
| 325 | ** SUMMARY: fossil addremove |
| 326 | ** Options: ?--dotfiles? ?--ignore GLOBPATTERN? ?--test? |
| 327 | */ |
| 328 | void import_cmd(void){ |
| 329 | Blob path; |
| 330 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 331 | int allFlag = find_option("dotfiles",0,0)!=0; |
| 332 | int isTest = find_option("test",0,0)!=0; |
| 333 | int n; |
| 334 | Stmt q; |
| 335 | int vid; |
| 336 | int nAdd = 0; |
| 337 | int nDelete = 0; |
| 338 | Glob *pIgnore; |
| 339 | |
| 340 | db_must_be_within_tree(); |
| 341 | if( zIgnoreFlag==0 ){ |
| 342 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 343 | } |
| 344 | vid = db_lget_int("checkout",0); |
| 345 | if( vid==0 ){ |
| @@ -358,11 +411,11 @@ | |
| 358 | blob_init(&path, g.zLocalRoot, n-1); |
| 359 | /* now we read the complete file structure into a temp table */ |
| 360 | pIgnore = glob_create(zIgnoreFlag); |
| 361 | vfile_scan(&path, blob_size(&path), allFlag, pIgnore); |
| 362 | glob_free(pIgnore); |
| 363 | nAdd = add_files_in_sfile(vid); |
| 364 | |
| 365 | /* step 2: search for missing files */ |
| 366 | db_prepare(&q, |
| 367 | "SELECT pathname, %Q || pathname, deleted FROM vfile" |
| 368 | " WHERE NOT deleted" |
| 369 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -92,66 +92,76 @@ | |
| 92 | ** |
| 93 | ** Omit any file whose name is pOmit. |
| 94 | */ |
| 95 | static int add_one_file( |
| 96 | const char *zPath, /* Tree-name of file to add. */ |
| 97 | int vid, /* Add to this VFILE */ |
| 98 | int caseSensitive /* True if filenames are case sensitive */ |
| 99 | ){ |
| 100 | const char *zCollate = caseSensitive ? "binary" : "nocase"; |
| 101 | if( !file_is_simple_pathname(zPath) ){ |
| 102 | fossil_fatal("filename contains illegal characters: %s", zPath); |
| 103 | } |
| 104 | if( db_exists("SELECT 1 FROM vfile" |
| 105 | " WHERE pathname=%Q COLLATE %s", zPath, zCollate) ){ |
| 106 | db_multi_exec("UPDATE vfile SET deleted=0" |
| 107 | " WHERE pathname=%Q COLLATE %s", zPath, zCollate); |
| 108 | }else{ |
| 109 | char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath); |
| 110 | db_multi_exec( |
| 111 | "INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe)" |
| 112 | "VALUES(%d,0,0,0,%Q,%d)", |
| 113 | vid, zPath, file_isexe(zFullname)); |
| 114 | fossil_free(zFullname); |
| 115 | } |
| 116 | if( db_changes() ){ |
| 117 | fossil_print("ADDED %s\n", zPath); |
| 118 | return 1; |
| 119 | }else{ |
| 120 | fossil_print("SKIP %s\n", zPath); |
| 121 | return 0; |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | /* |
| 126 | ** Add all files in the sfile temp table. |
| 127 | ** |
| 128 | ** Automatically exclude the repository file. |
| 129 | */ |
| 130 | static int add_files_in_sfile(int vid, int caseSensitive){ |
| 131 | const char *zRepo; /* Name of the repository database file */ |
| 132 | int nAdd = 0; /* Number of files added */ |
| 133 | int i; /* Loop counter */ |
| 134 | const char *zReserved; /* Name of a reserved file */ |
| 135 | Blob repoName; /* Treename of the repository */ |
| 136 | Stmt loop; /* SQL to loop over all files to add */ |
| 137 | int (*xCmp)(const char*,const char*); |
| 138 | |
| 139 | if( !file_tree_name(g.zRepositoryName, &repoName, 0) ){ |
| 140 | blob_zero(&repoName); |
| 141 | zRepo = ""; |
| 142 | }else{ |
| 143 | zRepo = blob_str(&repoName); |
| 144 | } |
| 145 | if( caseSensitive ){ |
| 146 | xCmp = fossil_strcmp; |
| 147 | }else{ |
| 148 | xCmp = fossil_stricmp; |
| 149 | db_multi_exec( |
| 150 | "CREATE INDEX IF NOT EXISTS vfile_nocase" |
| 151 | " ON vfile(pathname COLLATE nocase)" |
| 152 | ); |
| 153 | } |
| 154 | db_prepare(&loop, "SELECT x FROM sfile ORDER BY x"); |
| 155 | while( db_step(&loop)==SQLITE_ROW ){ |
| 156 | const char *zToAdd = db_column_text(&loop, 0); |
| 157 | if( fossil_strcmp(zToAdd, zRepo)==0 ) continue; |
| 158 | for(i=0; (zReserved = fossil_reserved_name(i))!=0; i++){ |
| 159 | if( xCmp(zToAdd, zReserved)==0 ) break; |
| 160 | } |
| 161 | if( zReserved ) continue; |
| 162 | nAdd += add_one_file(zToAdd, vid, caseSensitive); |
| 163 | } |
| 164 | db_finalize(&loop); |
| 165 | blob_reset(&repoName); |
| 166 | return nAdd; |
| 167 | } |
| @@ -180,14 +190,17 @@ | |
| 190 | int i; /* Loop counter */ |
| 191 | int vid; /* Currently checked out version */ |
| 192 | int nRoot; /* Full path characters in g.zLocalRoot */ |
| 193 | const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */ |
| 194 | Glob *pIgnore; /* Ignore everything matching this glob pattern */ |
| 195 | int caseSensitive; /* True if filenames are case sensitive */ |
| 196 | |
| 197 | zIgnoreFlag = find_option("ignore",0,1); |
| 198 | includeDotFiles = find_option("dotfiles",0,0)!=0; |
| 199 | capture_case_sensitive_option(); |
| 200 | db_must_be_within_tree(); |
| 201 | caseSensitive = filenames_are_case_sensitive(); |
| 202 | if( zIgnoreFlag==0 ){ |
| 203 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 204 | } |
| 205 | vid = db_lget_int("checkout",0); |
| 206 | if( vid==0 ){ |
| @@ -229,11 +242,11 @@ | |
| 242 | } |
| 243 | blob_reset(&fullName); |
| 244 | } |
| 245 | glob_free(pIgnore); |
| 246 | |
| 247 | add_files_in_sfile(vid, caseSensitive); |
| 248 | db_end_transaction(0); |
| 249 | } |
| 250 | |
| 251 | /* |
| 252 | ** COMMAND: rm |
| @@ -289,10 +302,48 @@ | |
| 302 | "UPDATE vfile SET deleted=1 WHERE pathname IN sfile;" |
| 303 | "DELETE FROM vfile WHERE rid=0 AND deleted;" |
| 304 | ); |
| 305 | db_end_transaction(0); |
| 306 | } |
| 307 | |
| 308 | /* |
| 309 | ** Capture the command-line --case-sensitive option. |
| 310 | */ |
| 311 | static const char *zCaseSensitive = 0; |
| 312 | void capture_case_sensitive_option(void){ |
| 313 | if( zCaseSensitive==0 ){ |
| 314 | zCaseSensitive = find_option("case-sensitive",0,1); |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | /* |
| 319 | ** This routine determines if files should be case-sensitive or not. |
| 320 | ** In other words, this routine determines if two filenames that |
| 321 | ** differ only in case should be considered the same name or not. |
| 322 | ** |
| 323 | ** The case-sensitive setting determines the default value. If |
| 324 | ** the case-sensitive setting is undefined, then case sensitivity |
| 325 | ** defaults on for Mac and Windows and off for all other unix. |
| 326 | ** |
| 327 | ** The --case-sensitive BOOLEAN command-line option overrides any |
| 328 | ** setting. |
| 329 | */ |
| 330 | int filenames_are_case_sensitive(void){ |
| 331 | int caseSensitive; |
| 332 | |
| 333 | if( zCaseSensitive ){ |
| 334 | caseSensitive = is_truth(zCaseSensitive); |
| 335 | }else{ |
| 336 | #if !defined(_WIN32) && !defined(__DARWIN__) && !defined(__APPLE__) |
| 337 | caseSensitive = 1; |
| 338 | #else |
| 339 | caseSensitive = 0; |
| 340 | #endif |
| 341 | caseSensitive = db_get_boolean("case-sensitive",caseSensitive); |
| 342 | } |
| 343 | return caseSensitive; |
| 344 | } |
| 345 | |
| 346 | /* |
| 347 | ** COMMAND: addremove |
| 348 | ** |
| 349 | ** Usage: %fossil addremove ?--dotfiles? ?--ignore GLOBPATTERN? ?--test? |
| @@ -319,27 +370,29 @@ | |
| 370 | ** |
| 371 | ** The --test option shows what would happen without actually doing anything. |
| 372 | ** |
| 373 | ** This command can be used to track third party software. |
| 374 | ** |
| 375 | ** SUMMARY: fossil addremove |
| 376 | ** Options: ?--dotfiles? ?--ignore GLOB? ?--test? ?--case-sensitive BOOL? |
| 377 | */ |
| 378 | void addremove_cmd(void){ |
| 379 | Blob path; |
| 380 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 381 | int allFlag = find_option("dotfiles",0,0)!=0; |
| 382 | int isTest = find_option("test",0,0)!=0; |
| 383 | int caseSensitive; |
| 384 | int n; |
| 385 | Stmt q; |
| 386 | int vid; |
| 387 | int nAdd = 0; |
| 388 | int nDelete = 0; |
| 389 | Glob *pIgnore; |
| 390 | |
| 391 | capture_case_sensitive_option(); |
| 392 | db_must_be_within_tree(); |
| 393 | caseSensitive = filenames_are_case_sensitive(); |
| 394 | if( zIgnoreFlag==0 ){ |
| 395 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 396 | } |
| 397 | vid = db_lget_int("checkout",0); |
| 398 | if( vid==0 ){ |
| @@ -358,11 +411,11 @@ | |
| 411 | blob_init(&path, g.zLocalRoot, n-1); |
| 412 | /* now we read the complete file structure into a temp table */ |
| 413 | pIgnore = glob_create(zIgnoreFlag); |
| 414 | vfile_scan(&path, blob_size(&path), allFlag, pIgnore); |
| 415 | glob_free(pIgnore); |
| 416 | nAdd = add_files_in_sfile(vid, caseSensitive); |
| 417 | |
| 418 | /* step 2: search for missing files */ |
| 419 | db_prepare(&q, |
| 420 | "SELECT pathname, %Q || pathname, deleted FROM vfile" |
| 421 | " WHERE NOT deleted" |
| 422 |
+1
-1
| --- src/blob.c | ||
| +++ src/blob.c | ||
| @@ -120,11 +120,11 @@ | ||
| 120 | 120 | ** This routine is called if a blob operation fails because we |
| 121 | 121 | ** have run out of memory. |
| 122 | 122 | */ |
| 123 | 123 | static void blob_panic(void){ |
| 124 | 124 | static const char zErrMsg[] = "out of memory\n"; |
| 125 | - write(2, zErrMsg, sizeof(zErrMsg)-1); | |
| 125 | + fputs(zErrMsg, stderr); | |
| 126 | 126 | fossil_exit(1); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /* |
| 130 | 130 | ** A reallocation function that assumes that aData came from malloc(). |
| 131 | 131 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -120,11 +120,11 @@ | |
| 120 | ** This routine is called if a blob operation fails because we |
| 121 | ** have run out of memory. |
| 122 | */ |
| 123 | static void blob_panic(void){ |
| 124 | static const char zErrMsg[] = "out of memory\n"; |
| 125 | write(2, zErrMsg, sizeof(zErrMsg)-1); |
| 126 | fossil_exit(1); |
| 127 | } |
| 128 | |
| 129 | /* |
| 130 | ** A reallocation function that assumes that aData came from malloc(). |
| 131 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -120,11 +120,11 @@ | |
| 120 | ** This routine is called if a blob operation fails because we |
| 121 | ** have run out of memory. |
| 122 | */ |
| 123 | static void blob_panic(void){ |
| 124 | static const char zErrMsg[] = "out of memory\n"; |
| 125 | fputs(zErrMsg, stderr); |
| 126 | fossil_exit(1); |
| 127 | } |
| 128 | |
| 129 | /* |
| 130 | ** A reallocation function that assumes that aData came from malloc(). |
| 131 |
+73
-36
| --- src/branch.c | ||
| +++ src/branch.c | ||
| @@ -174,12 +174,49 @@ | ||
| 174 | 174 | |
| 175 | 175 | /* Commit */ |
| 176 | 176 | db_end_transaction(0); |
| 177 | 177 | |
| 178 | 178 | /* Do an autosync push, if requested */ |
| 179 | - autosync(AUTOSYNC_PUSH); | |
| 179 | + if( !isPrivate ) autosync(AUTOSYNC_PUSH); | |
| 180 | +} | |
| 181 | + | |
| 182 | +/* | |
| 183 | +** Prepare a query that will list all branches. | |
| 184 | +*/ | |
| 185 | +static void prepareBranchQuery(Stmt *pQuery, int showAll, int showClosed){ | |
| 186 | + if( showClosed ){ | |
| 187 | + db_prepare(pQuery, | |
| 188 | + "SELECT value FROM tagxref" | |
| 189 | + " WHERE tagid=%d AND value NOT NULL " | |
| 190 | + "EXCEPT " | |
| 191 | + "SELECT value FROM tagxref" | |
| 192 | + " WHERE tagid=%d" | |
| 193 | + " AND rid IN leaf" | |
| 194 | + " AND NOT %z" | |
| 195 | + " ORDER BY value COLLATE nocase /*sort*/", | |
| 196 | + TAG_BRANCH, TAG_BRANCH, leaf_is_closed_sql("tagxref.rid") | |
| 197 | + ); | |
| 198 | + }else if( showAll ){ | |
| 199 | + db_prepare(pQuery, | |
| 200 | + "SELECT DISTINCT value FROM tagxref" | |
| 201 | + " WHERE tagid=%d AND value NOT NULL" | |
| 202 | + " AND rid IN leaf" | |
| 203 | + " ORDER BY value COLLATE nocase /*sort*/", | |
| 204 | + TAG_BRANCH | |
| 205 | + ); | |
| 206 | + }else{ | |
| 207 | + db_prepare(pQuery, | |
| 208 | + "SELECT DISTINCT value FROM tagxref" | |
| 209 | + " WHERE tagid=%d AND value NOT NULL" | |
| 210 | + " AND rid IN leaf" | |
| 211 | + " AND NOT %z" | |
| 212 | + " ORDER BY value COLLATE nocase /*sort*/", | |
| 213 | + TAG_BRANCH, leaf_is_closed_sql("tagxref.rid") | |
| 214 | + ); | |
| 215 | + } | |
| 180 | 216 | } |
| 217 | + | |
| 181 | 218 | |
| 182 | 219 | /* |
| 183 | 220 | ** COMMAND: branch |
| 184 | 221 | ** |
| 185 | 222 | ** Usage: %fossil branch SUBCOMMAND ... ?-R|--repository FILE? |
| @@ -194,11 +231,12 @@ | ||
| 194 | 231 | ** --private option makes the branch private. |
| 195 | 232 | ** |
| 196 | 233 | ** %fossil branch list |
| 197 | 234 | ** %fossil branch ls |
| 198 | 235 | ** |
| 199 | -** List all branches | |
| 236 | +** List all branches. Use --all or --closed to list all branches | |
| 237 | +** or closed branches. The default is to show only open branches. | |
| 200 | 238 | ** |
| 201 | 239 | */ |
| 202 | 240 | void branch_cmd(void){ |
| 203 | 241 | int n; |
| 204 | 242 | const char *zCmd = "list"; |
| @@ -212,24 +250,19 @@ | ||
| 212 | 250 | branch_new(); |
| 213 | 251 | }else if( (strncmp(zCmd,"list",n)==0)||(strncmp(zCmd, "ls", n)==0) ){ |
| 214 | 252 | Stmt q; |
| 215 | 253 | int vid; |
| 216 | 254 | char *zCurrent = 0; |
| 255 | + int showAll = find_option("all",0,0)!=0; | |
| 256 | + int showClosed = find_option("closed",0,0)!=0; | |
| 217 | 257 | |
| 218 | 258 | if( g.localOpen ){ |
| 219 | 259 | vid = db_lget_int("checkout", 0); |
| 220 | 260 | zCurrent = db_text(0, "SELECT value FROM tagxref" |
| 221 | 261 | " WHERE rid=%d AND tagid=%d", vid, TAG_BRANCH); |
| 222 | 262 | } |
| 223 | - db_prepare(&q, | |
| 224 | - "SELECT DISTINCT value FROM tagxref" | |
| 225 | - " WHERE tagid=%d AND value NOT NULL" | |
| 226 | - " AND rid IN leaf" | |
| 227 | - " AND NOT %z" | |
| 228 | - " ORDER BY value /*sort*/", | |
| 229 | - TAG_BRANCH, leaf_is_closed_sql("tagxref.rid") | |
| 230 | - ); | |
| 263 | + prepareBranchQuery(&q, showAll, showClosed); | |
| 231 | 264 | while( db_step(&q)==SQLITE_ROW ){ |
| 232 | 265 | const char *zBr = db_column_text(&q, 0); |
| 233 | 266 | int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0; |
| 234 | 267 | fossil_print("%s%s\n", (isCur ? "* " : " "), zBr); |
| 235 | 268 | } |
| @@ -247,21 +280,38 @@ | ||
| 247 | 280 | */ |
| 248 | 281 | void brlist_page(void){ |
| 249 | 282 | Stmt q; |
| 250 | 283 | int cnt; |
| 251 | 284 | int showClosed = P("closed")!=0; |
| 285 | + int showAll = P("all")!=0; | |
| 286 | + int colorTest = P("colortest")!=0; | |
| 252 | 287 | |
| 253 | 288 | login_check_credentials(); |
| 254 | 289 | if( !g.okRead ){ login_needed(); return; } |
| 290 | + if( colorTest ){ | |
| 291 | + showClosed = 0; | |
| 292 | + showAll = 1; | |
| 293 | + } | |
| 255 | 294 | |
| 256 | - style_header(showClosed ? "Closed Branches" : "Open Branches"); | |
| 295 | + style_header(showClosed ? "Closed Branches" : | |
| 296 | + showAll ? "All Branches" : "Open Branches"); | |
| 257 | 297 | style_submenu_element("Timeline", "Timeline", "brtimeline"); |
| 258 | 298 | if( showClosed ){ |
| 299 | + style_submenu_element("All", "All", "brlist?all"); | |
| 300 | + style_submenu_element("Open","Open","brlist"); | |
| 301 | + }else if( showAll ){ | |
| 302 | + style_submenu_element("Closed", "Closed", "brlist?closed"); | |
| 259 | 303 | style_submenu_element("Open","Open","brlist"); |
| 260 | 304 | }else{ |
| 305 | + style_submenu_element("All", "All", "brlist?all"); | |
| 261 | 306 | style_submenu_element("Closed","Closed","brlist?closed"); |
| 262 | 307 | } |
| 308 | + if( !colorTest ){ | |
| 309 | + style_submenu_element("Color-Test", "Color-Test", "brlist?colortest"); | |
| 310 | + }else{ | |
| 311 | + style_submenu_element("All", "All", "brlist?all"); | |
| 312 | + } | |
| 263 | 313 | login_anonymous_available(); |
| 264 | 314 | style_sidebox_begin("Nomenclature:", "33%"); |
| 265 | 315 | @ <ol> |
| 266 | 316 | @ <li> An <div class="sideboxDescribed"><a href="brlist"> |
| 267 | 317 | @ open branch</a></div> is a branch that has one or |
| @@ -275,46 +325,33 @@ | ||
| 275 | 325 | @ Closed branches are fixed and do not change (unless they are first |
| 276 | 326 | @ reopened)</li> |
| 277 | 327 | @ </ol> |
| 278 | 328 | style_sidebox_end(); |
| 279 | 329 | |
| 330 | + prepareBranchQuery(&q, showAll, showClosed); | |
| 280 | 331 | cnt = 0; |
| 281 | - if( showClosed ){ | |
| 282 | - db_prepare(&q, | |
| 283 | - "SELECT value FROM tagxref" | |
| 284 | - " WHERE tagid=%d AND value NOT NULL " | |
| 285 | - "EXCEPT " | |
| 286 | - "SELECT value FROM tagxref" | |
| 287 | - " WHERE tagid=%d" | |
| 288 | - " AND rid IN leaf" | |
| 289 | - " AND NOT %z" | |
| 290 | - " ORDER BY value /*sort*/", | |
| 291 | - TAG_BRANCH, TAG_BRANCH, leaf_is_closed_sql("tagxref.rid") | |
| 292 | - ); | |
| 293 | - }else{ | |
| 294 | - db_prepare(&q, | |
| 295 | - "SELECT DISTINCT value FROM tagxref" | |
| 296 | - " WHERE tagid=%d AND value NOT NULL" | |
| 297 | - " AND rid IN leaf" | |
| 298 | - " AND NOT %z" | |
| 299 | - " ORDER BY value /*sort*/", | |
| 300 | - TAG_BRANCH, leaf_is_closed_sql("tagxref.rid") | |
| 301 | - ); | |
| 302 | - } | |
| 303 | 332 | while( db_step(&q)==SQLITE_ROW ){ |
| 304 | 333 | const char *zBr = db_column_text(&q, 0); |
| 305 | 334 | if( cnt==0 ){ |
| 306 | - if( showClosed ){ | |
| 335 | + if( colorTest ){ | |
| 336 | + @ <h2>Default background colors for all branches:</h2> | |
| 337 | + }else if( showAll ){ | |
| 338 | + @ <h2>All Branches:</h2> | |
| 339 | + }else if( showClosed ){ | |
| 307 | 340 | @ <h2>Closed Branches:</h2> |
| 308 | 341 | }else{ |
| 309 | 342 | @ <h2>Open Branches:</h2> |
| 310 | 343 | } |
| 311 | 344 | @ <ul> |
| 312 | 345 | cnt++; |
| 313 | 346 | } |
| 314 | - if( g.okHistory ){ | |
| 315 | - @ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)">%h(zBr)</a></li> | |
| 347 | + if( colorTest ){ | |
| 348 | + const char *zColor = hash_color(zBr); | |
| 349 | + @ <li><span style="background-color: %s(zColor)"> | |
| 350 | + @ %h(zBr) → %s(zColor)</span></li> | |
| 351 | + }else if( g.okHistory ){ | |
| 352 | + @ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)")>%h(zBr)</a></li> | |
| 316 | 353 | }else{ |
| 317 | 354 | @ <li><b>%h(zBr)</b></li> |
| 318 | 355 | } |
| 319 | 356 | } |
| 320 | 357 | if( cnt ){ |
| 321 | 358 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -174,12 +174,49 @@ | |
| 174 | |
| 175 | /* Commit */ |
| 176 | db_end_transaction(0); |
| 177 | |
| 178 | /* Do an autosync push, if requested */ |
| 179 | autosync(AUTOSYNC_PUSH); |
| 180 | } |
| 181 | |
| 182 | /* |
| 183 | ** COMMAND: branch |
| 184 | ** |
| 185 | ** Usage: %fossil branch SUBCOMMAND ... ?-R|--repository FILE? |
| @@ -194,11 +231,12 @@ | |
| 194 | ** --private option makes the branch private. |
| 195 | ** |
| 196 | ** %fossil branch list |
| 197 | ** %fossil branch ls |
| 198 | ** |
| 199 | ** List all branches |
| 200 | ** |
| 201 | */ |
| 202 | void branch_cmd(void){ |
| 203 | int n; |
| 204 | const char *zCmd = "list"; |
| @@ -212,24 +250,19 @@ | |
| 212 | branch_new(); |
| 213 | }else if( (strncmp(zCmd,"list",n)==0)||(strncmp(zCmd, "ls", n)==0) ){ |
| 214 | Stmt q; |
| 215 | int vid; |
| 216 | char *zCurrent = 0; |
| 217 | |
| 218 | if( g.localOpen ){ |
| 219 | vid = db_lget_int("checkout", 0); |
| 220 | zCurrent = db_text(0, "SELECT value FROM tagxref" |
| 221 | " WHERE rid=%d AND tagid=%d", vid, TAG_BRANCH); |
| 222 | } |
| 223 | db_prepare(&q, |
| 224 | "SELECT DISTINCT value FROM tagxref" |
| 225 | " WHERE tagid=%d AND value NOT NULL" |
| 226 | " AND rid IN leaf" |
| 227 | " AND NOT %z" |
| 228 | " ORDER BY value /*sort*/", |
| 229 | TAG_BRANCH, leaf_is_closed_sql("tagxref.rid") |
| 230 | ); |
| 231 | while( db_step(&q)==SQLITE_ROW ){ |
| 232 | const char *zBr = db_column_text(&q, 0); |
| 233 | int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0; |
| 234 | fossil_print("%s%s\n", (isCur ? "* " : " "), zBr); |
| 235 | } |
| @@ -247,21 +280,38 @@ | |
| 247 | */ |
| 248 | void brlist_page(void){ |
| 249 | Stmt q; |
| 250 | int cnt; |
| 251 | int showClosed = P("closed")!=0; |
| 252 | |
| 253 | login_check_credentials(); |
| 254 | if( !g.okRead ){ login_needed(); return; } |
| 255 | |
| 256 | style_header(showClosed ? "Closed Branches" : "Open Branches"); |
| 257 | style_submenu_element("Timeline", "Timeline", "brtimeline"); |
| 258 | if( showClosed ){ |
| 259 | style_submenu_element("Open","Open","brlist"); |
| 260 | }else{ |
| 261 | style_submenu_element("Closed","Closed","brlist?closed"); |
| 262 | } |
| 263 | login_anonymous_available(); |
| 264 | style_sidebox_begin("Nomenclature:", "33%"); |
| 265 | @ <ol> |
| 266 | @ <li> An <div class="sideboxDescribed"><a href="brlist"> |
| 267 | @ open branch</a></div> is a branch that has one or |
| @@ -275,46 +325,33 @@ | |
| 275 | @ Closed branches are fixed and do not change (unless they are first |
| 276 | @ reopened)</li> |
| 277 | @ </ol> |
| 278 | style_sidebox_end(); |
| 279 | |
| 280 | cnt = 0; |
| 281 | if( showClosed ){ |
| 282 | db_prepare(&q, |
| 283 | "SELECT value FROM tagxref" |
| 284 | " WHERE tagid=%d AND value NOT NULL " |
| 285 | "EXCEPT " |
| 286 | "SELECT value FROM tagxref" |
| 287 | " WHERE tagid=%d" |
| 288 | " AND rid IN leaf" |
| 289 | " AND NOT %z" |
| 290 | " ORDER BY value /*sort*/", |
| 291 | TAG_BRANCH, TAG_BRANCH, leaf_is_closed_sql("tagxref.rid") |
| 292 | ); |
| 293 | }else{ |
| 294 | db_prepare(&q, |
| 295 | "SELECT DISTINCT value FROM tagxref" |
| 296 | " WHERE tagid=%d AND value NOT NULL" |
| 297 | " AND rid IN leaf" |
| 298 | " AND NOT %z" |
| 299 | " ORDER BY value /*sort*/", |
| 300 | TAG_BRANCH, leaf_is_closed_sql("tagxref.rid") |
| 301 | ); |
| 302 | } |
| 303 | while( db_step(&q)==SQLITE_ROW ){ |
| 304 | const char *zBr = db_column_text(&q, 0); |
| 305 | if( cnt==0 ){ |
| 306 | if( showClosed ){ |
| 307 | @ <h2>Closed Branches:</h2> |
| 308 | }else{ |
| 309 | @ <h2>Open Branches:</h2> |
| 310 | } |
| 311 | @ <ul> |
| 312 | cnt++; |
| 313 | } |
| 314 | if( g.okHistory ){ |
| 315 | @ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)">%h(zBr)</a></li> |
| 316 | }else{ |
| 317 | @ <li><b>%h(zBr)</b></li> |
| 318 | } |
| 319 | } |
| 320 | if( cnt ){ |
| 321 |
| --- src/branch.c | |
| +++ src/branch.c | |
| @@ -174,12 +174,49 @@ | |
| 174 | |
| 175 | /* Commit */ |
| 176 | db_end_transaction(0); |
| 177 | |
| 178 | /* Do an autosync push, if requested */ |
| 179 | if( !isPrivate ) autosync(AUTOSYNC_PUSH); |
| 180 | } |
| 181 | |
| 182 | /* |
| 183 | ** Prepare a query that will list all branches. |
| 184 | */ |
| 185 | static void prepareBranchQuery(Stmt *pQuery, int showAll, int showClosed){ |
| 186 | if( showClosed ){ |
| 187 | db_prepare(pQuery, |
| 188 | "SELECT value FROM tagxref" |
| 189 | " WHERE tagid=%d AND value NOT NULL " |
| 190 | "EXCEPT " |
| 191 | "SELECT value FROM tagxref" |
| 192 | " WHERE tagid=%d" |
| 193 | " AND rid IN leaf" |
| 194 | " AND NOT %z" |
| 195 | " ORDER BY value COLLATE nocase /*sort*/", |
| 196 | TAG_BRANCH, TAG_BRANCH, leaf_is_closed_sql("tagxref.rid") |
| 197 | ); |
| 198 | }else if( showAll ){ |
| 199 | db_prepare(pQuery, |
| 200 | "SELECT DISTINCT value FROM tagxref" |
| 201 | " WHERE tagid=%d AND value NOT NULL" |
| 202 | " AND rid IN leaf" |
| 203 | " ORDER BY value COLLATE nocase /*sort*/", |
| 204 | TAG_BRANCH |
| 205 | ); |
| 206 | }else{ |
| 207 | db_prepare(pQuery, |
| 208 | "SELECT DISTINCT value FROM tagxref" |
| 209 | " WHERE tagid=%d AND value NOT NULL" |
| 210 | " AND rid IN leaf" |
| 211 | " AND NOT %z" |
| 212 | " ORDER BY value COLLATE nocase /*sort*/", |
| 213 | TAG_BRANCH, leaf_is_closed_sql("tagxref.rid") |
| 214 | ); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | |
| 219 | /* |
| 220 | ** COMMAND: branch |
| 221 | ** |
| 222 | ** Usage: %fossil branch SUBCOMMAND ... ?-R|--repository FILE? |
| @@ -194,11 +231,12 @@ | |
| 231 | ** --private option makes the branch private. |
| 232 | ** |
| 233 | ** %fossil branch list |
| 234 | ** %fossil branch ls |
| 235 | ** |
| 236 | ** List all branches. Use --all or --closed to list all branches |
| 237 | ** or closed branches. The default is to show only open branches. |
| 238 | ** |
| 239 | */ |
| 240 | void branch_cmd(void){ |
| 241 | int n; |
| 242 | const char *zCmd = "list"; |
| @@ -212,24 +250,19 @@ | |
| 250 | branch_new(); |
| 251 | }else if( (strncmp(zCmd,"list",n)==0)||(strncmp(zCmd, "ls", n)==0) ){ |
| 252 | Stmt q; |
| 253 | int vid; |
| 254 | char *zCurrent = 0; |
| 255 | int showAll = find_option("all",0,0)!=0; |
| 256 | int showClosed = find_option("closed",0,0)!=0; |
| 257 | |
| 258 | if( g.localOpen ){ |
| 259 | vid = db_lget_int("checkout", 0); |
| 260 | zCurrent = db_text(0, "SELECT value FROM tagxref" |
| 261 | " WHERE rid=%d AND tagid=%d", vid, TAG_BRANCH); |
| 262 | } |
| 263 | prepareBranchQuery(&q, showAll, showClosed); |
| 264 | while( db_step(&q)==SQLITE_ROW ){ |
| 265 | const char *zBr = db_column_text(&q, 0); |
| 266 | int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0; |
| 267 | fossil_print("%s%s\n", (isCur ? "* " : " "), zBr); |
| 268 | } |
| @@ -247,21 +280,38 @@ | |
| 280 | */ |
| 281 | void brlist_page(void){ |
| 282 | Stmt q; |
| 283 | int cnt; |
| 284 | int showClosed = P("closed")!=0; |
| 285 | int showAll = P("all")!=0; |
| 286 | int colorTest = P("colortest")!=0; |
| 287 | |
| 288 | login_check_credentials(); |
| 289 | if( !g.okRead ){ login_needed(); return; } |
| 290 | if( colorTest ){ |
| 291 | showClosed = 0; |
| 292 | showAll = 1; |
| 293 | } |
| 294 | |
| 295 | style_header(showClosed ? "Closed Branches" : |
| 296 | showAll ? "All Branches" : "Open Branches"); |
| 297 | style_submenu_element("Timeline", "Timeline", "brtimeline"); |
| 298 | if( showClosed ){ |
| 299 | style_submenu_element("All", "All", "brlist?all"); |
| 300 | style_submenu_element("Open","Open","brlist"); |
| 301 | }else if( showAll ){ |
| 302 | style_submenu_element("Closed", "Closed", "brlist?closed"); |
| 303 | style_submenu_element("Open","Open","brlist"); |
| 304 | }else{ |
| 305 | style_submenu_element("All", "All", "brlist?all"); |
| 306 | style_submenu_element("Closed","Closed","brlist?closed"); |
| 307 | } |
| 308 | if( !colorTest ){ |
| 309 | style_submenu_element("Color-Test", "Color-Test", "brlist?colortest"); |
| 310 | }else{ |
| 311 | style_submenu_element("All", "All", "brlist?all"); |
| 312 | } |
| 313 | login_anonymous_available(); |
| 314 | style_sidebox_begin("Nomenclature:", "33%"); |
| 315 | @ <ol> |
| 316 | @ <li> An <div class="sideboxDescribed"><a href="brlist"> |
| 317 | @ open branch</a></div> is a branch that has one or |
| @@ -275,46 +325,33 @@ | |
| 325 | @ Closed branches are fixed and do not change (unless they are first |
| 326 | @ reopened)</li> |
| 327 | @ </ol> |
| 328 | style_sidebox_end(); |
| 329 | |
| 330 | prepareBranchQuery(&q, showAll, showClosed); |
| 331 | cnt = 0; |
| 332 | while( db_step(&q)==SQLITE_ROW ){ |
| 333 | const char *zBr = db_column_text(&q, 0); |
| 334 | if( cnt==0 ){ |
| 335 | if( colorTest ){ |
| 336 | @ <h2>Default background colors for all branches:</h2> |
| 337 | }else if( showAll ){ |
| 338 | @ <h2>All Branches:</h2> |
| 339 | }else if( showClosed ){ |
| 340 | @ <h2>Closed Branches:</h2> |
| 341 | }else{ |
| 342 | @ <h2>Open Branches:</h2> |
| 343 | } |
| 344 | @ <ul> |
| 345 | cnt++; |
| 346 | } |
| 347 | if( colorTest ){ |
| 348 | const char *zColor = hash_color(zBr); |
| 349 | @ <li><span style="background-color: %s(zColor)"> |
| 350 | @ %h(zBr) → %s(zColor)</span></li> |
| 351 | }else if( g.okHistory ){ |
| 352 | @ <li><a href="%s(g.zTop)/timeline?r=%T(zBr)")>%h(zBr)</a></li> |
| 353 | }else{ |
| 354 | @ <li><b>%h(zBr)</b></li> |
| 355 | } |
| 356 | } |
| 357 | if( cnt ){ |
| 358 |
+2
-2
| --- src/browse.c | ||
| +++ src/browse.c | ||
| @@ -146,11 +146,11 @@ | ||
| 146 | 146 | /* Compute the title of the page */ |
| 147 | 147 | blob_zero(&dirname); |
| 148 | 148 | if( zD ){ |
| 149 | 149 | blob_append(&dirname, "in directory ", -1); |
| 150 | 150 | hyperlinked_path(zD, &dirname, zCI); |
| 151 | - zPrefix = mprintf("%h/", zD); | |
| 151 | + zPrefix = mprintf("%s/", zD); | |
| 152 | 152 | }else{ |
| 153 | 153 | blob_append(&dirname, "in the top-level directory", -1); |
| 154 | 154 | zPrefix = ""; |
| 155 | 155 | } |
| 156 | 156 | if( zCI ){ |
| @@ -267,11 +267,11 @@ | ||
| 267 | 267 | if( zFN[0]=='/' ){ |
| 268 | 268 | zFN++; |
| 269 | 269 | @ <li><a href="%s(zSubdirLink)%T(zFN)">%h(zFN)/</a></li> |
| 270 | 270 | }else if( zCI ){ |
| 271 | 271 | const char *zUuid = db_column_text(&q, 1); |
| 272 | - @ <li><a href="%s(g.zTop)/artifact?name=%s(zUuid)">%h(zFN)</a></li> | |
| 272 | + @ <li><a href="%s(g.zTop)/artifact/%s(zUuid)">%h(zFN)</a></li> | |
| 273 | 273 | }else{ |
| 274 | 274 | @ <li><a href="%s(g.zTop)/finfo?name=%T(zPrefix)%T(zFN)">%h(zFN) |
| 275 | 275 | @ </a></li> |
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 |
| --- src/browse.c | |
| +++ src/browse.c | |
| @@ -146,11 +146,11 @@ | |
| 146 | /* Compute the title of the page */ |
| 147 | blob_zero(&dirname); |
| 148 | if( zD ){ |
| 149 | blob_append(&dirname, "in directory ", -1); |
| 150 | hyperlinked_path(zD, &dirname, zCI); |
| 151 | zPrefix = mprintf("%h/", zD); |
| 152 | }else{ |
| 153 | blob_append(&dirname, "in the top-level directory", -1); |
| 154 | zPrefix = ""; |
| 155 | } |
| 156 | if( zCI ){ |
| @@ -267,11 +267,11 @@ | |
| 267 | if( zFN[0]=='/' ){ |
| 268 | zFN++; |
| 269 | @ <li><a href="%s(zSubdirLink)%T(zFN)">%h(zFN)/</a></li> |
| 270 | }else if( zCI ){ |
| 271 | const char *zUuid = db_column_text(&q, 1); |
| 272 | @ <li><a href="%s(g.zTop)/artifact?name=%s(zUuid)">%h(zFN)</a></li> |
| 273 | }else{ |
| 274 | @ <li><a href="%s(g.zTop)/finfo?name=%T(zPrefix)%T(zFN)">%h(zFN) |
| 275 | @ </a></li> |
| 276 | } |
| 277 | } |
| 278 |
| --- src/browse.c | |
| +++ src/browse.c | |
| @@ -146,11 +146,11 @@ | |
| 146 | /* Compute the title of the page */ |
| 147 | blob_zero(&dirname); |
| 148 | if( zD ){ |
| 149 | blob_append(&dirname, "in directory ", -1); |
| 150 | hyperlinked_path(zD, &dirname, zCI); |
| 151 | zPrefix = mprintf("%s/", zD); |
| 152 | }else{ |
| 153 | blob_append(&dirname, "in the top-level directory", -1); |
| 154 | zPrefix = ""; |
| 155 | } |
| 156 | if( zCI ){ |
| @@ -267,11 +267,11 @@ | |
| 267 | if( zFN[0]=='/' ){ |
| 268 | zFN++; |
| 269 | @ <li><a href="%s(zSubdirLink)%T(zFN)">%h(zFN)/</a></li> |
| 270 | }else if( zCI ){ |
| 271 | const char *zUuid = db_column_text(&q, 1); |
| 272 | @ <li><a href="%s(g.zTop)/artifact/%s(zUuid)">%h(zFN)</a></li> |
| 273 | }else{ |
| 274 | @ <li><a href="%s(g.zTop)/finfo?name=%T(zPrefix)%T(zFN)">%h(zFN) |
| 275 | @ </a></li> |
| 276 | } |
| 277 | } |
| 278 |
+24
-8
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -295,11 +295,11 @@ | ||
| 295 | 295 | if( blob_size(&extraHeader)>0 ){ |
| 296 | 296 | fprintf(g.httpOut, "%s", blob_buffer(&extraHeader)); |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | /* Add headers to turn on useful security options in browsers. */ |
| 300 | - fprintf(g.httpOut, "X-Frame-Options: DENY\r\n"); | |
| 300 | + fprintf(g.httpOut, "X-Frame-Options: SAMEORIGIN\r\n"); | |
| 301 | 301 | /* This stops fossil pages appearing in frames or iframes, preventing |
| 302 | 302 | ** click-jacking attacks on supporting browsers. |
| 303 | 303 | ** |
| 304 | 304 | ** Other good headers would be |
| 305 | 305 | ** Strict-Transport-Security: max-age=62208000 |
| @@ -353,10 +353,11 @@ | ||
| 353 | 353 | if( size>0 ){ |
| 354 | 354 | fwrite(blob_buffer(&cgiContent[i]), 1, size, g.httpOut); |
| 355 | 355 | } |
| 356 | 356 | } |
| 357 | 357 | } |
| 358 | + fflush(g.httpOut); | |
| 358 | 359 | CGIDEBUG(("DONE\n")); |
| 359 | 360 | } |
| 360 | 361 | |
| 361 | 362 | /* |
| 362 | 363 | ** Do a redirect request to the URL given in the argument. |
| @@ -887,17 +888,26 @@ | ||
| 887 | 888 | } |
| 888 | 889 | |
| 889 | 890 | /* |
| 890 | 891 | ** Print all query parameters on standard output. Format the |
| 891 | 892 | ** parameters as HTML. This is used for testing and debugging. |
| 893 | +** Release builds omit the values of the cookies to avoid defeating | |
| 894 | +** the purpose of setting HttpOnly cookies. | |
| 892 | 895 | */ |
| 893 | 896 | void cgi_print_all(void){ |
| 894 | 897 | int i; |
| 898 | + int showAll = 0; | |
| 899 | +#ifdef FOSSIL_DEBUG | |
| 900 | + /* Show the values of cookies in debug mode. */ | |
| 901 | + showAll = 1; | |
| 902 | +#endif | |
| 895 | 903 | cgi_parameter("",""); /* Force the parameters into sorted order */ |
| 896 | 904 | for(i=0; i<nUsedQP; i++){ |
| 897 | - cgi_printf("%s = %s <br />\n", | |
| 898 | - htmlize(aParamQP[i].zName, -1), htmlize(aParamQP[i].zValue, -1)); | |
| 905 | + if( showAll || (fossil_stricmp("HTTP_COOKIE",aParamQP[i].zName)!=0 && fossil_strnicmp("fossil-",aParamQP[i].zName,7)!=0) ){ | |
| 906 | + cgi_printf("%s = %s <br />\n", | |
| 907 | + htmlize(aParamQP[i].zName, -1), htmlize(aParamQP[i].zValue, -1)); | |
| 908 | + } | |
| 899 | 909 | } |
| 900 | 910 | } |
| 901 | 911 | |
| 902 | 912 | /* |
| 903 | 913 | ** This routine works like "printf" except that it has the |
| @@ -1143,11 +1153,13 @@ | ||
| 1143 | 1153 | fossil_print("Listening for HTTP requests on TCP port %d\n", iPort); |
| 1144 | 1154 | fflush(stdout); |
| 1145 | 1155 | } |
| 1146 | 1156 | if( zBrowser ){ |
| 1147 | 1157 | zBrowser = mprintf(zBrowser, iPort); |
| 1148 | - system(zBrowser); | |
| 1158 | + if( system(zBrowser)<0 ){ | |
| 1159 | + fossil_warning("cannot start browser: %s\n", zBrowser); | |
| 1160 | + } | |
| 1149 | 1161 | } |
| 1150 | 1162 | while( 1 ){ |
| 1151 | 1163 | if( nchildren>MAX_PARALLEL ){ |
| 1152 | 1164 | /* Slow down if connections are arriving too fast */ |
| 1153 | 1165 | sleep( nchildren-MAX_PARALLEL ); |
| @@ -1164,20 +1176,24 @@ | ||
| 1164 | 1176 | child = fork(); |
| 1165 | 1177 | if( child!=0 ){ |
| 1166 | 1178 | if( child>0 ) nchildren++; |
| 1167 | 1179 | close(connection); |
| 1168 | 1180 | }else{ |
| 1181 | + int nErr = 0, fd; | |
| 1169 | 1182 | close(0); |
| 1170 | - dup(connection); | |
| 1183 | + fd = dup(connection); | |
| 1184 | + if( fd!=0 ) nErr++; | |
| 1171 | 1185 | close(1); |
| 1172 | - dup(connection); | |
| 1186 | + fd = dup(connection); | |
| 1187 | + if( fd!=1 ) nErr++; | |
| 1173 | 1188 | if( !g.fHttpTrace && !g.fSqlTrace ){ |
| 1174 | 1189 | close(2); |
| 1175 | - dup(connection); | |
| 1190 | + fd = dup(connection); | |
| 1191 | + if( fd!=2 ) nErr++; | |
| 1176 | 1192 | } |
| 1177 | 1193 | close(connection); |
| 1178 | - return 0; | |
| 1194 | + return nErr; | |
| 1179 | 1195 | } |
| 1180 | 1196 | } |
| 1181 | 1197 | } |
| 1182 | 1198 | /* Bury dead children */ |
| 1183 | 1199 | while( waitpid(0, 0, WNOHANG)>0 ){ |
| 1184 | 1200 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -295,11 +295,11 @@ | |
| 295 | if( blob_size(&extraHeader)>0 ){ |
| 296 | fprintf(g.httpOut, "%s", blob_buffer(&extraHeader)); |
| 297 | } |
| 298 | |
| 299 | /* Add headers to turn on useful security options in browsers. */ |
| 300 | fprintf(g.httpOut, "X-Frame-Options: DENY\r\n"); |
| 301 | /* This stops fossil pages appearing in frames or iframes, preventing |
| 302 | ** click-jacking attacks on supporting browsers. |
| 303 | ** |
| 304 | ** Other good headers would be |
| 305 | ** Strict-Transport-Security: max-age=62208000 |
| @@ -353,10 +353,11 @@ | |
| 353 | if( size>0 ){ |
| 354 | fwrite(blob_buffer(&cgiContent[i]), 1, size, g.httpOut); |
| 355 | } |
| 356 | } |
| 357 | } |
| 358 | CGIDEBUG(("DONE\n")); |
| 359 | } |
| 360 | |
| 361 | /* |
| 362 | ** Do a redirect request to the URL given in the argument. |
| @@ -887,17 +888,26 @@ | |
| 887 | } |
| 888 | |
| 889 | /* |
| 890 | ** Print all query parameters on standard output. Format the |
| 891 | ** parameters as HTML. This is used for testing and debugging. |
| 892 | */ |
| 893 | void cgi_print_all(void){ |
| 894 | int i; |
| 895 | cgi_parameter("",""); /* Force the parameters into sorted order */ |
| 896 | for(i=0; i<nUsedQP; i++){ |
| 897 | cgi_printf("%s = %s <br />\n", |
| 898 | htmlize(aParamQP[i].zName, -1), htmlize(aParamQP[i].zValue, -1)); |
| 899 | } |
| 900 | } |
| 901 | |
| 902 | /* |
| 903 | ** This routine works like "printf" except that it has the |
| @@ -1143,11 +1153,13 @@ | |
| 1143 | fossil_print("Listening for HTTP requests on TCP port %d\n", iPort); |
| 1144 | fflush(stdout); |
| 1145 | } |
| 1146 | if( zBrowser ){ |
| 1147 | zBrowser = mprintf(zBrowser, iPort); |
| 1148 | system(zBrowser); |
| 1149 | } |
| 1150 | while( 1 ){ |
| 1151 | if( nchildren>MAX_PARALLEL ){ |
| 1152 | /* Slow down if connections are arriving too fast */ |
| 1153 | sleep( nchildren-MAX_PARALLEL ); |
| @@ -1164,20 +1176,24 @@ | |
| 1164 | child = fork(); |
| 1165 | if( child!=0 ){ |
| 1166 | if( child>0 ) nchildren++; |
| 1167 | close(connection); |
| 1168 | }else{ |
| 1169 | close(0); |
| 1170 | dup(connection); |
| 1171 | close(1); |
| 1172 | dup(connection); |
| 1173 | if( !g.fHttpTrace && !g.fSqlTrace ){ |
| 1174 | close(2); |
| 1175 | dup(connection); |
| 1176 | } |
| 1177 | close(connection); |
| 1178 | return 0; |
| 1179 | } |
| 1180 | } |
| 1181 | } |
| 1182 | /* Bury dead children */ |
| 1183 | while( waitpid(0, 0, WNOHANG)>0 ){ |
| 1184 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -295,11 +295,11 @@ | |
| 295 | if( blob_size(&extraHeader)>0 ){ |
| 296 | fprintf(g.httpOut, "%s", blob_buffer(&extraHeader)); |
| 297 | } |
| 298 | |
| 299 | /* Add headers to turn on useful security options in browsers. */ |
| 300 | fprintf(g.httpOut, "X-Frame-Options: SAMEORIGIN\r\n"); |
| 301 | /* This stops fossil pages appearing in frames or iframes, preventing |
| 302 | ** click-jacking attacks on supporting browsers. |
| 303 | ** |
| 304 | ** Other good headers would be |
| 305 | ** Strict-Transport-Security: max-age=62208000 |
| @@ -353,10 +353,11 @@ | |
| 353 | if( size>0 ){ |
| 354 | fwrite(blob_buffer(&cgiContent[i]), 1, size, g.httpOut); |
| 355 | } |
| 356 | } |
| 357 | } |
| 358 | fflush(g.httpOut); |
| 359 | CGIDEBUG(("DONE\n")); |
| 360 | } |
| 361 | |
| 362 | /* |
| 363 | ** Do a redirect request to the URL given in the argument. |
| @@ -887,17 +888,26 @@ | |
| 888 | } |
| 889 | |
| 890 | /* |
| 891 | ** Print all query parameters on standard output. Format the |
| 892 | ** parameters as HTML. This is used for testing and debugging. |
| 893 | ** Release builds omit the values of the cookies to avoid defeating |
| 894 | ** the purpose of setting HttpOnly cookies. |
| 895 | */ |
| 896 | void cgi_print_all(void){ |
| 897 | int i; |
| 898 | int showAll = 0; |
| 899 | #ifdef FOSSIL_DEBUG |
| 900 | /* Show the values of cookies in debug mode. */ |
| 901 | showAll = 1; |
| 902 | #endif |
| 903 | cgi_parameter("",""); /* Force the parameters into sorted order */ |
| 904 | for(i=0; i<nUsedQP; i++){ |
| 905 | if( showAll || (fossil_stricmp("HTTP_COOKIE",aParamQP[i].zName)!=0 && fossil_strnicmp("fossil-",aParamQP[i].zName,7)!=0) ){ |
| 906 | cgi_printf("%s = %s <br />\n", |
| 907 | htmlize(aParamQP[i].zName, -1), htmlize(aParamQP[i].zValue, -1)); |
| 908 | } |
| 909 | } |
| 910 | } |
| 911 | |
| 912 | /* |
| 913 | ** This routine works like "printf" except that it has the |
| @@ -1143,11 +1153,13 @@ | |
| 1153 | fossil_print("Listening for HTTP requests on TCP port %d\n", iPort); |
| 1154 | fflush(stdout); |
| 1155 | } |
| 1156 | if( zBrowser ){ |
| 1157 | zBrowser = mprintf(zBrowser, iPort); |
| 1158 | if( system(zBrowser)<0 ){ |
| 1159 | fossil_warning("cannot start browser: %s\n", zBrowser); |
| 1160 | } |
| 1161 | } |
| 1162 | while( 1 ){ |
| 1163 | if( nchildren>MAX_PARALLEL ){ |
| 1164 | /* Slow down if connections are arriving too fast */ |
| 1165 | sleep( nchildren-MAX_PARALLEL ); |
| @@ -1164,20 +1176,24 @@ | |
| 1176 | child = fork(); |
| 1177 | if( child!=0 ){ |
| 1178 | if( child>0 ) nchildren++; |
| 1179 | close(connection); |
| 1180 | }else{ |
| 1181 | int nErr = 0, fd; |
| 1182 | close(0); |
| 1183 | fd = dup(connection); |
| 1184 | if( fd!=0 ) nErr++; |
| 1185 | close(1); |
| 1186 | fd = dup(connection); |
| 1187 | if( fd!=1 ) nErr++; |
| 1188 | if( !g.fHttpTrace && !g.fSqlTrace ){ |
| 1189 | close(2); |
| 1190 | fd = dup(connection); |
| 1191 | if( fd!=2 ) nErr++; |
| 1192 | } |
| 1193 | close(connection); |
| 1194 | return nErr; |
| 1195 | } |
| 1196 | } |
| 1197 | } |
| 1198 | /* Bury dead children */ |
| 1199 | while( waitpid(0, 0, WNOHANG)>0 ){ |
| 1200 |
+92
-15
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -32,60 +32,72 @@ | ||
| 32 | 32 | ** are not true files results in a fatal error. |
| 33 | 33 | */ |
| 34 | 34 | static void status_report( |
| 35 | 35 | Blob *report, /* Append the status report here */ |
| 36 | 36 | const char *zPrefix, /* Prefix on each line of the report */ |
| 37 | - int missingIsFatal /* MISSING and NOT_A_FILE are fatal errors */ | |
| 37 | + int missingIsFatal, /* MISSING and NOT_A_FILE are fatal errors */ | |
| 38 | + int cwdRelative /* Report relative to the current working dir */ | |
| 38 | 39 | ){ |
| 39 | 40 | Stmt q; |
| 40 | 41 | int nPrefix = strlen(zPrefix); |
| 41 | 42 | int nErr = 0; |
| 43 | + Blob rewrittenPathname; | |
| 42 | 44 | db_prepare(&q, |
| 43 | 45 | "SELECT pathname, deleted, chnged, rid, coalesce(origname!=pathname,0)" |
| 44 | 46 | " FROM vfile " |
| 45 | 47 | " WHERE file_is_selected(id)" |
| 46 | 48 | " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1" |
| 47 | 49 | ); |
| 50 | + blob_zero(&rewrittenPathname); | |
| 48 | 51 | while( db_step(&q)==SQLITE_ROW ){ |
| 49 | 52 | const char *zPathname = db_column_text(&q,0); |
| 53 | + const char *zDisplayName = zPathname; | |
| 50 | 54 | int isDeleted = db_column_int(&q, 1); |
| 51 | 55 | int isChnged = db_column_int(&q,2); |
| 52 | 56 | int isNew = db_column_int(&q,3)==0; |
| 53 | 57 | int isRenamed = db_column_int(&q,4); |
| 54 | 58 | char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); |
| 59 | + if( cwdRelative ){ | |
| 60 | + file_relative_name(zFullName, &rewrittenPathname); | |
| 61 | + zDisplayName = blob_str(&rewrittenPathname); | |
| 62 | + if( zDisplayName[0]=='.' && zDisplayName[1]=='/' ){ | |
| 63 | + zDisplayName += 2; /* no unnecessary ./ prefix */ | |
| 64 | + } | |
| 65 | + } | |
| 55 | 66 | blob_append(report, zPrefix, nPrefix); |
| 56 | 67 | if( isDeleted ){ |
| 57 | - blob_appendf(report, "DELETED %s\n", zPathname); | |
| 68 | + blob_appendf(report, "DELETED %s\n", zDisplayName); | |
| 58 | 69 | }else if( !file_isfile(zFullName) ){ |
| 59 | 70 | if( file_access(zFullName, 0)==0 ){ |
| 60 | - blob_appendf(report, "NOT_A_FILE %s\n", zPathname); | |
| 71 | + blob_appendf(report, "NOT_A_FILE %s\n", zDisplayName); | |
| 61 | 72 | if( missingIsFatal ){ |
| 62 | - fossil_warning("not a file: %s", zPathname); | |
| 73 | + fossil_warning("not a file: %s", zDisplayName); | |
| 63 | 74 | nErr++; |
| 64 | 75 | } |
| 65 | 76 | }else{ |
| 66 | - blob_appendf(report, "MISSING %s\n", zPathname); | |
| 77 | + blob_appendf(report, "MISSING %s\n", zDisplayName); | |
| 67 | 78 | if( missingIsFatal ){ |
| 68 | - fossil_warning("missing file: %s", zPathname); | |
| 79 | + fossil_warning("missing file: %s", zDisplayName); | |
| 69 | 80 | nErr++; |
| 70 | 81 | } |
| 71 | 82 | } |
| 72 | 83 | }else if( isNew ){ |
| 73 | - blob_appendf(report, "ADDED %s\n", zPathname); | |
| 84 | + blob_appendf(report, "ADDED %s\n", zDisplayName); | |
| 74 | 85 | }else if( isDeleted ){ |
| 75 | - blob_appendf(report, "DELETED %s\n", zPathname); | |
| 86 | + blob_appendf(report, "DELETED %s\n", zDisplayName); | |
| 76 | 87 | }else if( isChnged==2 ){ |
| 77 | - blob_appendf(report, "UPDATED_BY_MERGE %s\n", zPathname); | |
| 88 | + blob_appendf(report, "UPDATED_BY_MERGE %s\n", zDisplayName); | |
| 78 | 89 | }else if( isChnged==3 ){ |
| 79 | - blob_appendf(report, "ADDED_BY_MERGE %s\n", zPathname); | |
| 90 | + blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName); | |
| 80 | 91 | }else if( isChnged==1 ){ |
| 81 | - blob_appendf(report, "EDITED %s\n", zPathname); | |
| 92 | + blob_appendf(report, "EDITED %s\n", zDisplayName); | |
| 82 | 93 | }else if( isRenamed ){ |
| 83 | - blob_appendf(report, "RENAMED %s\n", zPathname); | |
| 94 | + blob_appendf(report, "RENAMED %s\n", zDisplayName); | |
| 84 | 95 | } |
| 85 | 96 | free(zFullName); |
| 86 | 97 | } |
| 98 | + blob_reset(&rewrittenPathname); | |
| 87 | 99 | db_finalize(&q); |
| 88 | 100 | db_prepare(&q, "SELECT uuid FROM vmerge JOIN blob ON merge=rid" |
| 89 | 101 | " WHERE id=0"); |
| 90 | 102 | while( db_step(&q)==SQLITE_ROW ){ |
| 91 | 103 | blob_append(report, zPrefix, nPrefix); |
| @@ -94,33 +106,59 @@ | ||
| 94 | 106 | db_finalize(&q); |
| 95 | 107 | if( nErr ){ |
| 96 | 108 | fossil_fatal("aborting due to prior errors"); |
| 97 | 109 | } |
| 98 | 110 | } |
| 111 | + | |
| 112 | +/* | |
| 113 | +** Use the "relative-paths" setting and the --abs-paths and | |
| 114 | +** --rel-paths command line options to determine whether the | |
| 115 | +** status report should be shown relative to the current | |
| 116 | +** working directory. | |
| 117 | +*/ | |
| 118 | +static int determine_cwd_relative_option() | |
| 119 | +{ | |
| 120 | + int relativePaths = db_get_boolean("relative-paths", 1); | |
| 121 | + int absPathOption = find_option("abs-paths", 0, 0)!=0; | |
| 122 | + int relPathOption = find_option("rel-paths", 0, 0)!=0; | |
| 123 | + if( absPathOption ){ relativePaths = 0; } | |
| 124 | + if( relPathOption ){ relativePaths = 1; } | |
| 125 | + return relativePaths; | |
| 126 | +} | |
| 99 | 127 | |
| 100 | 128 | /* |
| 101 | 129 | ** COMMAND: changes |
| 102 | 130 | ** |
| 103 | 131 | ** Usage: %fossil changes |
| 104 | 132 | ** |
| 105 | 133 | ** Report on the edit status of all files in the current checkout. |
| 106 | 134 | ** See also the "status" and "extra" commands. |
| 107 | 135 | ** |
| 136 | +** Pathnames are displayed according to the "relative-paths" setting, | |
| 137 | +** unless overridden by the --abs-paths or --rel-paths options. | |
| 138 | +** | |
| 108 | 139 | ** Options: |
| 109 | 140 | ** |
| 110 | 141 | ** --sha1sum Verify file status using SHA1 hashing rather |
| 111 | 142 | ** than relying on file mtimes. |
| 143 | +** | |
| 144 | +** --abs-paths Display absolute pathnames. | |
| 145 | +** | |
| 146 | +** --rel-paths Display pathnames relative to the current working | |
| 147 | +** directory. | |
| 112 | 148 | */ |
| 113 | 149 | void changes_cmd(void){ |
| 114 | 150 | Blob report; |
| 115 | 151 | int vid; |
| 116 | 152 | int useSha1sum = find_option("sha1sum", 0, 0)!=0; |
| 153 | + int cwdRelative = 0; | |
| 117 | 154 | db_must_be_within_tree(); |
| 155 | + cwdRelative = determine_cwd_relative_option(); | |
| 118 | 156 | blob_zero(&report); |
| 119 | 157 | vid = db_lget_int("checkout", 0); |
| 120 | 158 | vfile_check_signature(vid, 0, useSha1sum); |
| 121 | - status_report(&report, "", 0); | |
| 159 | + status_report(&report, "", 0, cwdRelative); | |
| 122 | 160 | blob_write_to_file(&report, "-"); |
| 123 | 161 | } |
| 124 | 162 | |
| 125 | 163 | /* |
| 126 | 164 | ** COMMAND: status |
| @@ -127,14 +165,22 @@ | ||
| 127 | 165 | ** |
| 128 | 166 | ** Usage: %fossil status |
| 129 | 167 | ** |
| 130 | 168 | ** Report on the status of the current checkout. |
| 131 | 169 | ** |
| 170 | +** Pathnames are displayed according to the "relative-paths" setting, | |
| 171 | +** unless overridden by the --abs-paths or --rel-paths options. | |
| 172 | +** | |
| 132 | 173 | ** Options: |
| 133 | 174 | ** |
| 134 | 175 | ** --sha1sum Verify file status using SHA1 hashing rather |
| 135 | 176 | ** than relying on file mtimes. |
| 177 | +** | |
| 178 | +** --abs-paths Display absolute pathnames. | |
| 179 | +** | |
| 180 | +** --rel-paths Display pathnames relative to the current working | |
| 181 | +** directory. | |
| 136 | 182 | */ |
| 137 | 183 | void status_cmd(void){ |
| 138 | 184 | int vid; |
| 139 | 185 | db_must_be_within_tree(); |
| 140 | 186 | /* 012345678901234 */ |
| @@ -212,22 +258,41 @@ | ||
| 212 | 258 | ** ignored but can be included by adding the --dotfiles option. |
| 213 | 259 | ** |
| 214 | 260 | ** The GLOBPATTERN is a comma-separated list of GLOB expressions for |
| 215 | 261 | ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob" |
| 216 | 262 | ** is used if the --ignore option is omitted. |
| 263 | +** | |
| 264 | +** Pathnames are displayed according to the "relative-paths" setting, | |
| 265 | +** unless overridden by the --abs-paths or --rel-paths options. | |
| 266 | +** | |
| 267 | +** Options: | |
| 268 | +** | |
| 269 | +** --dotfiles Include files with names beginning with "." | |
| 270 | +** | |
| 271 | +** --ignore GLOBPATTERN | |
| 272 | +** Override the "ignore-glob" setting. | |
| 273 | +** | |
| 274 | +** --abs-paths Display absolute pathnames. | |
| 275 | +** | |
| 276 | +** --rel-paths Display pathnames relative to the current working | |
| 277 | +** directory. | |
| 217 | 278 | */ |
| 218 | 279 | void extra_cmd(void){ |
| 219 | 280 | Blob path; |
| 220 | 281 | Blob repo; |
| 221 | 282 | Stmt q; |
| 222 | 283 | int n; |
| 223 | 284 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 224 | 285 | int allFlag = find_option("dotfiles",0,0)!=0; |
| 286 | + int cwdRelative = 0; | |
| 225 | 287 | int outputManifest; |
| 226 | 288 | Glob *pIgnore; |
| 289 | + Blob rewrittenPathname; | |
| 290 | + const char *zPathname, *zDisplayName; | |
| 227 | 291 | |
| 228 | 292 | db_must_be_within_tree(); |
| 293 | + cwdRelative = determine_cwd_relative_option(); | |
| 229 | 294 | outputManifest = db_get_boolean("manifest",0); |
| 230 | 295 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)"); |
| 231 | 296 | n = strlen(g.zLocalRoot); |
| 232 | 297 | blob_init(&path, g.zLocalRoot, n-1); |
| 233 | 298 | if( zIgnoreFlag==0 ){ |
| @@ -243,13 +308,25 @@ | ||
| 243 | 308 | fossil_all_reserved_names() |
| 244 | 309 | ); |
| 245 | 310 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 246 | 311 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 247 | 312 | } |
| 313 | + blob_zero(&rewrittenPathname); | |
| 248 | 314 | while( db_step(&q)==SQLITE_ROW ){ |
| 249 | - fossil_print("%s\n", db_column_text(&q, 0)); | |
| 315 | + zDisplayName = zPathname = db_column_text(&q, 0); | |
| 316 | + if( cwdRelative ) { | |
| 317 | + char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); | |
| 318 | + file_relative_name(zFullName, &rewrittenPathname); | |
| 319 | + free(zFullName); | |
| 320 | + zDisplayName = blob_str(&rewrittenPathname); | |
| 321 | + if( zDisplayName[0]=='.' && zDisplayName[1]=='/' ){ | |
| 322 | + zDisplayName += 2; /* no unnecessary ./ prefix */ | |
| 323 | + } | |
| 324 | + } | |
| 325 | + fossil_print("%s\n", zDisplayName); | |
| 250 | 326 | } |
| 327 | + blob_reset(&rewrittenPathname); | |
| 251 | 328 | db_finalize(&q); |
| 252 | 329 | } |
| 253 | 330 | |
| 254 | 331 | /* |
| 255 | 332 | ** COMMAND: clean |
| @@ -367,11 +444,11 @@ | ||
| 367 | 444 | "# PRIVATE BRANCH: This check-in will be private and will not sync to\n" |
| 368 | 445 | "# repositories.\n" |
| 369 | 446 | "#\n", -1 |
| 370 | 447 | ); |
| 371 | 448 | } |
| 372 | - status_report(&text, "# ", 1); | |
| 449 | + status_report(&text, "# ", 1, 0); | |
| 373 | 450 | zEditor = db_get("editor", 0); |
| 374 | 451 | if( zEditor==0 ){ |
| 375 | 452 | zEditor = getenv("VISUAL"); |
| 376 | 453 | } |
| 377 | 454 | if( zEditor==0 ){ |
| 378 | 455 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -32,60 +32,72 @@ | |
| 32 | ** are not true files results in a fatal error. |
| 33 | */ |
| 34 | static void status_report( |
| 35 | Blob *report, /* Append the status report here */ |
| 36 | const char *zPrefix, /* Prefix on each line of the report */ |
| 37 | int missingIsFatal /* MISSING and NOT_A_FILE are fatal errors */ |
| 38 | ){ |
| 39 | Stmt q; |
| 40 | int nPrefix = strlen(zPrefix); |
| 41 | int nErr = 0; |
| 42 | db_prepare(&q, |
| 43 | "SELECT pathname, deleted, chnged, rid, coalesce(origname!=pathname,0)" |
| 44 | " FROM vfile " |
| 45 | " WHERE file_is_selected(id)" |
| 46 | " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1" |
| 47 | ); |
| 48 | while( db_step(&q)==SQLITE_ROW ){ |
| 49 | const char *zPathname = db_column_text(&q,0); |
| 50 | int isDeleted = db_column_int(&q, 1); |
| 51 | int isChnged = db_column_int(&q,2); |
| 52 | int isNew = db_column_int(&q,3)==0; |
| 53 | int isRenamed = db_column_int(&q,4); |
| 54 | char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); |
| 55 | blob_append(report, zPrefix, nPrefix); |
| 56 | if( isDeleted ){ |
| 57 | blob_appendf(report, "DELETED %s\n", zPathname); |
| 58 | }else if( !file_isfile(zFullName) ){ |
| 59 | if( file_access(zFullName, 0)==0 ){ |
| 60 | blob_appendf(report, "NOT_A_FILE %s\n", zPathname); |
| 61 | if( missingIsFatal ){ |
| 62 | fossil_warning("not a file: %s", zPathname); |
| 63 | nErr++; |
| 64 | } |
| 65 | }else{ |
| 66 | blob_appendf(report, "MISSING %s\n", zPathname); |
| 67 | if( missingIsFatal ){ |
| 68 | fossil_warning("missing file: %s", zPathname); |
| 69 | nErr++; |
| 70 | } |
| 71 | } |
| 72 | }else if( isNew ){ |
| 73 | blob_appendf(report, "ADDED %s\n", zPathname); |
| 74 | }else if( isDeleted ){ |
| 75 | blob_appendf(report, "DELETED %s\n", zPathname); |
| 76 | }else if( isChnged==2 ){ |
| 77 | blob_appendf(report, "UPDATED_BY_MERGE %s\n", zPathname); |
| 78 | }else if( isChnged==3 ){ |
| 79 | blob_appendf(report, "ADDED_BY_MERGE %s\n", zPathname); |
| 80 | }else if( isChnged==1 ){ |
| 81 | blob_appendf(report, "EDITED %s\n", zPathname); |
| 82 | }else if( isRenamed ){ |
| 83 | blob_appendf(report, "RENAMED %s\n", zPathname); |
| 84 | } |
| 85 | free(zFullName); |
| 86 | } |
| 87 | db_finalize(&q); |
| 88 | db_prepare(&q, "SELECT uuid FROM vmerge JOIN blob ON merge=rid" |
| 89 | " WHERE id=0"); |
| 90 | while( db_step(&q)==SQLITE_ROW ){ |
| 91 | blob_append(report, zPrefix, nPrefix); |
| @@ -94,33 +106,59 @@ | |
| 94 | db_finalize(&q); |
| 95 | if( nErr ){ |
| 96 | fossil_fatal("aborting due to prior errors"); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | /* |
| 101 | ** COMMAND: changes |
| 102 | ** |
| 103 | ** Usage: %fossil changes |
| 104 | ** |
| 105 | ** Report on the edit status of all files in the current checkout. |
| 106 | ** See also the "status" and "extra" commands. |
| 107 | ** |
| 108 | ** Options: |
| 109 | ** |
| 110 | ** --sha1sum Verify file status using SHA1 hashing rather |
| 111 | ** than relying on file mtimes. |
| 112 | */ |
| 113 | void changes_cmd(void){ |
| 114 | Blob report; |
| 115 | int vid; |
| 116 | int useSha1sum = find_option("sha1sum", 0, 0)!=0; |
| 117 | db_must_be_within_tree(); |
| 118 | blob_zero(&report); |
| 119 | vid = db_lget_int("checkout", 0); |
| 120 | vfile_check_signature(vid, 0, useSha1sum); |
| 121 | status_report(&report, "", 0); |
| 122 | blob_write_to_file(&report, "-"); |
| 123 | } |
| 124 | |
| 125 | /* |
| 126 | ** COMMAND: status |
| @@ -127,14 +165,22 @@ | |
| 127 | ** |
| 128 | ** Usage: %fossil status |
| 129 | ** |
| 130 | ** Report on the status of the current checkout. |
| 131 | ** |
| 132 | ** Options: |
| 133 | ** |
| 134 | ** --sha1sum Verify file status using SHA1 hashing rather |
| 135 | ** than relying on file mtimes. |
| 136 | */ |
| 137 | void status_cmd(void){ |
| 138 | int vid; |
| 139 | db_must_be_within_tree(); |
| 140 | /* 012345678901234 */ |
| @@ -212,22 +258,41 @@ | |
| 212 | ** ignored but can be included by adding the --dotfiles option. |
| 213 | ** |
| 214 | ** The GLOBPATTERN is a comma-separated list of GLOB expressions for |
| 215 | ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob" |
| 216 | ** is used if the --ignore option is omitted. |
| 217 | */ |
| 218 | void extra_cmd(void){ |
| 219 | Blob path; |
| 220 | Blob repo; |
| 221 | Stmt q; |
| 222 | int n; |
| 223 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 224 | int allFlag = find_option("dotfiles",0,0)!=0; |
| 225 | int outputManifest; |
| 226 | Glob *pIgnore; |
| 227 | |
| 228 | db_must_be_within_tree(); |
| 229 | outputManifest = db_get_boolean("manifest",0); |
| 230 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)"); |
| 231 | n = strlen(g.zLocalRoot); |
| 232 | blob_init(&path, g.zLocalRoot, n-1); |
| 233 | if( zIgnoreFlag==0 ){ |
| @@ -243,13 +308,25 @@ | |
| 243 | fossil_all_reserved_names() |
| 244 | ); |
| 245 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 246 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 247 | } |
| 248 | while( db_step(&q)==SQLITE_ROW ){ |
| 249 | fossil_print("%s\n", db_column_text(&q, 0)); |
| 250 | } |
| 251 | db_finalize(&q); |
| 252 | } |
| 253 | |
| 254 | /* |
| 255 | ** COMMAND: clean |
| @@ -367,11 +444,11 @@ | |
| 367 | "# PRIVATE BRANCH: This check-in will be private and will not sync to\n" |
| 368 | "# repositories.\n" |
| 369 | "#\n", -1 |
| 370 | ); |
| 371 | } |
| 372 | status_report(&text, "# ", 1); |
| 373 | zEditor = db_get("editor", 0); |
| 374 | if( zEditor==0 ){ |
| 375 | zEditor = getenv("VISUAL"); |
| 376 | } |
| 377 | if( zEditor==0 ){ |
| 378 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -32,60 +32,72 @@ | |
| 32 | ** are not true files results in a fatal error. |
| 33 | */ |
| 34 | static void status_report( |
| 35 | Blob *report, /* Append the status report here */ |
| 36 | const char *zPrefix, /* Prefix on each line of the report */ |
| 37 | int missingIsFatal, /* MISSING and NOT_A_FILE are fatal errors */ |
| 38 | int cwdRelative /* Report relative to the current working dir */ |
| 39 | ){ |
| 40 | Stmt q; |
| 41 | int nPrefix = strlen(zPrefix); |
| 42 | int nErr = 0; |
| 43 | Blob rewrittenPathname; |
| 44 | db_prepare(&q, |
| 45 | "SELECT pathname, deleted, chnged, rid, coalesce(origname!=pathname,0)" |
| 46 | " FROM vfile " |
| 47 | " WHERE file_is_selected(id)" |
| 48 | " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1" |
| 49 | ); |
| 50 | blob_zero(&rewrittenPathname); |
| 51 | while( db_step(&q)==SQLITE_ROW ){ |
| 52 | const char *zPathname = db_column_text(&q,0); |
| 53 | const char *zDisplayName = zPathname; |
| 54 | int isDeleted = db_column_int(&q, 1); |
| 55 | int isChnged = db_column_int(&q,2); |
| 56 | int isNew = db_column_int(&q,3)==0; |
| 57 | int isRenamed = db_column_int(&q,4); |
| 58 | char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); |
| 59 | if( cwdRelative ){ |
| 60 | file_relative_name(zFullName, &rewrittenPathname); |
| 61 | zDisplayName = blob_str(&rewrittenPathname); |
| 62 | if( zDisplayName[0]=='.' && zDisplayName[1]=='/' ){ |
| 63 | zDisplayName += 2; /* no unnecessary ./ prefix */ |
| 64 | } |
| 65 | } |
| 66 | blob_append(report, zPrefix, nPrefix); |
| 67 | if( isDeleted ){ |
| 68 | blob_appendf(report, "DELETED %s\n", zDisplayName); |
| 69 | }else if( !file_isfile(zFullName) ){ |
| 70 | if( file_access(zFullName, 0)==0 ){ |
| 71 | blob_appendf(report, "NOT_A_FILE %s\n", zDisplayName); |
| 72 | if( missingIsFatal ){ |
| 73 | fossil_warning("not a file: %s", zDisplayName); |
| 74 | nErr++; |
| 75 | } |
| 76 | }else{ |
| 77 | blob_appendf(report, "MISSING %s\n", zDisplayName); |
| 78 | if( missingIsFatal ){ |
| 79 | fossil_warning("missing file: %s", zDisplayName); |
| 80 | nErr++; |
| 81 | } |
| 82 | } |
| 83 | }else if( isNew ){ |
| 84 | blob_appendf(report, "ADDED %s\n", zDisplayName); |
| 85 | }else if( isDeleted ){ |
| 86 | blob_appendf(report, "DELETED %s\n", zDisplayName); |
| 87 | }else if( isChnged==2 ){ |
| 88 | blob_appendf(report, "UPDATED_BY_MERGE %s\n", zDisplayName); |
| 89 | }else if( isChnged==3 ){ |
| 90 | blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName); |
| 91 | }else if( isChnged==1 ){ |
| 92 | blob_appendf(report, "EDITED %s\n", zDisplayName); |
| 93 | }else if( isRenamed ){ |
| 94 | blob_appendf(report, "RENAMED %s\n", zDisplayName); |
| 95 | } |
| 96 | free(zFullName); |
| 97 | } |
| 98 | blob_reset(&rewrittenPathname); |
| 99 | db_finalize(&q); |
| 100 | db_prepare(&q, "SELECT uuid FROM vmerge JOIN blob ON merge=rid" |
| 101 | " WHERE id=0"); |
| 102 | while( db_step(&q)==SQLITE_ROW ){ |
| 103 | blob_append(report, zPrefix, nPrefix); |
| @@ -94,33 +106,59 @@ | |
| 106 | db_finalize(&q); |
| 107 | if( nErr ){ |
| 108 | fossil_fatal("aborting due to prior errors"); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | /* |
| 113 | ** Use the "relative-paths" setting and the --abs-paths and |
| 114 | ** --rel-paths command line options to determine whether the |
| 115 | ** status report should be shown relative to the current |
| 116 | ** working directory. |
| 117 | */ |
| 118 | static int determine_cwd_relative_option() |
| 119 | { |
| 120 | int relativePaths = db_get_boolean("relative-paths", 1); |
| 121 | int absPathOption = find_option("abs-paths", 0, 0)!=0; |
| 122 | int relPathOption = find_option("rel-paths", 0, 0)!=0; |
| 123 | if( absPathOption ){ relativePaths = 0; } |
| 124 | if( relPathOption ){ relativePaths = 1; } |
| 125 | return relativePaths; |
| 126 | } |
| 127 | |
| 128 | /* |
| 129 | ** COMMAND: changes |
| 130 | ** |
| 131 | ** Usage: %fossil changes |
| 132 | ** |
| 133 | ** Report on the edit status of all files in the current checkout. |
| 134 | ** See also the "status" and "extra" commands. |
| 135 | ** |
| 136 | ** Pathnames are displayed according to the "relative-paths" setting, |
| 137 | ** unless overridden by the --abs-paths or --rel-paths options. |
| 138 | ** |
| 139 | ** Options: |
| 140 | ** |
| 141 | ** --sha1sum Verify file status using SHA1 hashing rather |
| 142 | ** than relying on file mtimes. |
| 143 | ** |
| 144 | ** --abs-paths Display absolute pathnames. |
| 145 | ** |
| 146 | ** --rel-paths Display pathnames relative to the current working |
| 147 | ** directory. |
| 148 | */ |
| 149 | void changes_cmd(void){ |
| 150 | Blob report; |
| 151 | int vid; |
| 152 | int useSha1sum = find_option("sha1sum", 0, 0)!=0; |
| 153 | int cwdRelative = 0; |
| 154 | db_must_be_within_tree(); |
| 155 | cwdRelative = determine_cwd_relative_option(); |
| 156 | blob_zero(&report); |
| 157 | vid = db_lget_int("checkout", 0); |
| 158 | vfile_check_signature(vid, 0, useSha1sum); |
| 159 | status_report(&report, "", 0, cwdRelative); |
| 160 | blob_write_to_file(&report, "-"); |
| 161 | } |
| 162 | |
| 163 | /* |
| 164 | ** COMMAND: status |
| @@ -127,14 +165,22 @@ | |
| 165 | ** |
| 166 | ** Usage: %fossil status |
| 167 | ** |
| 168 | ** Report on the status of the current checkout. |
| 169 | ** |
| 170 | ** Pathnames are displayed according to the "relative-paths" setting, |
| 171 | ** unless overridden by the --abs-paths or --rel-paths options. |
| 172 | ** |
| 173 | ** Options: |
| 174 | ** |
| 175 | ** --sha1sum Verify file status using SHA1 hashing rather |
| 176 | ** than relying on file mtimes. |
| 177 | ** |
| 178 | ** --abs-paths Display absolute pathnames. |
| 179 | ** |
| 180 | ** --rel-paths Display pathnames relative to the current working |
| 181 | ** directory. |
| 182 | */ |
| 183 | void status_cmd(void){ |
| 184 | int vid; |
| 185 | db_must_be_within_tree(); |
| 186 | /* 012345678901234 */ |
| @@ -212,22 +258,41 @@ | |
| 258 | ** ignored but can be included by adding the --dotfiles option. |
| 259 | ** |
| 260 | ** The GLOBPATTERN is a comma-separated list of GLOB expressions for |
| 261 | ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob" |
| 262 | ** is used if the --ignore option is omitted. |
| 263 | ** |
| 264 | ** Pathnames are displayed according to the "relative-paths" setting, |
| 265 | ** unless overridden by the --abs-paths or --rel-paths options. |
| 266 | ** |
| 267 | ** Options: |
| 268 | ** |
| 269 | ** --dotfiles Include files with names beginning with "." |
| 270 | ** |
| 271 | ** --ignore GLOBPATTERN |
| 272 | ** Override the "ignore-glob" setting. |
| 273 | ** |
| 274 | ** --abs-paths Display absolute pathnames. |
| 275 | ** |
| 276 | ** --rel-paths Display pathnames relative to the current working |
| 277 | ** directory. |
| 278 | */ |
| 279 | void extra_cmd(void){ |
| 280 | Blob path; |
| 281 | Blob repo; |
| 282 | Stmt q; |
| 283 | int n; |
| 284 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 285 | int allFlag = find_option("dotfiles",0,0)!=0; |
| 286 | int cwdRelative = 0; |
| 287 | int outputManifest; |
| 288 | Glob *pIgnore; |
| 289 | Blob rewrittenPathname; |
| 290 | const char *zPathname, *zDisplayName; |
| 291 | |
| 292 | db_must_be_within_tree(); |
| 293 | cwdRelative = determine_cwd_relative_option(); |
| 294 | outputManifest = db_get_boolean("manifest",0); |
| 295 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)"); |
| 296 | n = strlen(g.zLocalRoot); |
| 297 | blob_init(&path, g.zLocalRoot, n-1); |
| 298 | if( zIgnoreFlag==0 ){ |
| @@ -243,13 +308,25 @@ | |
| 308 | fossil_all_reserved_names() |
| 309 | ); |
| 310 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 311 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 312 | } |
| 313 | blob_zero(&rewrittenPathname); |
| 314 | while( db_step(&q)==SQLITE_ROW ){ |
| 315 | zDisplayName = zPathname = db_column_text(&q, 0); |
| 316 | if( cwdRelative ) { |
| 317 | char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); |
| 318 | file_relative_name(zFullName, &rewrittenPathname); |
| 319 | free(zFullName); |
| 320 | zDisplayName = blob_str(&rewrittenPathname); |
| 321 | if( zDisplayName[0]=='.' && zDisplayName[1]=='/' ){ |
| 322 | zDisplayName += 2; /* no unnecessary ./ prefix */ |
| 323 | } |
| 324 | } |
| 325 | fossil_print("%s\n", zDisplayName); |
| 326 | } |
| 327 | blob_reset(&rewrittenPathname); |
| 328 | db_finalize(&q); |
| 329 | } |
| 330 | |
| 331 | /* |
| 332 | ** COMMAND: clean |
| @@ -367,11 +444,11 @@ | |
| 444 | "# PRIVATE BRANCH: This check-in will be private and will not sync to\n" |
| 445 | "# repositories.\n" |
| 446 | "#\n", -1 |
| 447 | ); |
| 448 | } |
| 449 | status_report(&text, "# ", 1, 0); |
| 450 | zEditor = db_get("editor", 0); |
| 451 | if( zEditor==0 ){ |
| 452 | zEditor = getenv("VISUAL"); |
| 453 | } |
| 454 | if( zEditor==0 ){ |
| 455 |
+1
| --- src/checkout.c | ||
| +++ src/checkout.c | ||
| @@ -232,10 +232,11 @@ | ||
| 232 | 232 | if( !keepFlag ){ |
| 233 | 233 | vfile_to_disk(vid, 0, 1, promptFlag); |
| 234 | 234 | } |
| 235 | 235 | checkout_set_all_exe(vid); |
| 236 | 236 | manifest_to_disk(vid); |
| 237 | + ensure_empty_dirs_created(); | |
| 237 | 238 | db_lset_int("checkout", vid); |
| 238 | 239 | undo_reset(); |
| 239 | 240 | db_multi_exec("DELETE FROM vmerge"); |
| 240 | 241 | if( !keepFlag && db_get_boolean("repo-cksum",1) ){ |
| 241 | 242 | vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b); |
| 242 | 243 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -232,10 +232,11 @@ | |
| 232 | if( !keepFlag ){ |
| 233 | vfile_to_disk(vid, 0, 1, promptFlag); |
| 234 | } |
| 235 | checkout_set_all_exe(vid); |
| 236 | manifest_to_disk(vid); |
| 237 | db_lset_int("checkout", vid); |
| 238 | undo_reset(); |
| 239 | db_multi_exec("DELETE FROM vmerge"); |
| 240 | if( !keepFlag && db_get_boolean("repo-cksum",1) ){ |
| 241 | vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b); |
| 242 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -232,10 +232,11 @@ | |
| 232 | if( !keepFlag ){ |
| 233 | vfile_to_disk(vid, 0, 1, promptFlag); |
| 234 | } |
| 235 | checkout_set_all_exe(vid); |
| 236 | manifest_to_disk(vid); |
| 237 | ensure_empty_dirs_created(); |
| 238 | db_lset_int("checkout", vid); |
| 239 | undo_reset(); |
| 240 | db_multi_exec("DELETE FROM vmerge"); |
| 241 | if( !keepFlag && db_get_boolean("repo-cksum",1) ){ |
| 242 | vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b); |
| 243 |
+17
-3
| --- src/clone.c | ||
| +++ src/clone.c | ||
| @@ -37,15 +37,17 @@ | ||
| 37 | 37 | ** |
| 38 | 38 | ** Options: |
| 39 | 39 | ** |
| 40 | 40 | ** --admin-user|-A USERNAME Make USERNAME the administrator |
| 41 | 41 | ** --private Also clone private branches |
| 42 | +** --ssl-identity=filename Use the SSL identity if requested by the server | |
| 42 | 43 | ** |
| 43 | 44 | */ |
| 44 | 45 | void clone_cmd(void){ |
| 45 | 46 | char *zPassword; |
| 46 | 47 | const char *zDefaultUser; /* Optional name of the default user */ |
| 48 | + const char *zPw; /* The user clone password */ | |
| 47 | 49 | int nErr = 0; |
| 48 | 50 | int bPrivate; /* Also clone private branches */ |
| 49 | 51 | |
| 50 | 52 | bPrivate = find_option("private",0,0)!=0; |
| 51 | 53 | url_proxy_options(); |
| @@ -76,13 +78,15 @@ | ||
| 76 | 78 | "DELETE FROM blob WHERE rid IN private;" |
| 77 | 79 | "DELETE FROM delta wHERE rid IN private;" |
| 78 | 80 | "DELETE FROM private;" |
| 79 | 81 | ); |
| 80 | 82 | shun_artifacts(); |
| 81 | - g.zLogin = db_text(0, "SELECT login FROM user WHERE cap LIKE '%%s%%'"); | |
| 82 | - if( g.zLogin==0 ){ | |
| 83 | - db_create_default_users(1,zDefaultUser); | |
| 83 | + db_create_default_users(1, zDefaultUser); | |
| 84 | + if( zDefaultUser ){ | |
| 85 | + g.zLogin = zDefaultUser; | |
| 86 | + }else{ | |
| 87 | + g.zLogin = db_text(0, "SELECT login FROM user WHERE cap LIKE '%%s%%'"); | |
| 84 | 88 | } |
| 85 | 89 | fossil_print("Repository cloned into %s\n", g.argv[3]); |
| 86 | 90 | }else{ |
| 87 | 91 | db_create_repository(g.argv[3]); |
| 88 | 92 | db_open_repository(g.argv[3]); |
| @@ -91,10 +95,18 @@ | ||
| 91 | 95 | db_initial_setup(0, zDefaultUser, 0); |
| 92 | 96 | user_select(); |
| 93 | 97 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 94 | 98 | db_set("aux-schema", AUX_SCHEMA, 0); |
| 95 | 99 | db_set("last-sync-url", g.argv[2], 0); |
| 100 | + if( g.zSSLIdentity!=0 ){ | |
| 101 | + /* If the --ssl-identity option was specified, store it as a setting */ | |
| 102 | + Blob fn; | |
| 103 | + blob_zero(&fn); | |
| 104 | + file_canonical_name(g.zSSLIdentity, &fn); | |
| 105 | + db_set("ssl-identity", blob_str(&fn), 0); | |
| 106 | + blob_reset(&fn); | |
| 107 | + } | |
| 96 | 108 | db_multi_exec( |
| 97 | 109 | "REPLACE INTO config(name,value,mtime)" |
| 98 | 110 | " VALUES('server-code', lower(hex(randomblob(20))), now());" |
| 99 | 111 | ); |
| 100 | 112 | url_enable_proxy(0); |
| @@ -116,7 +128,9 @@ | ||
| 116 | 128 | rebuild_db(0, 1, 0); |
| 117 | 129 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 118 | 130 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 119 | 131 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 120 | 132 | fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); |
| 133 | + zPw = g.urlPasswd; | |
| 134 | + if( !g.dontKeepUrl && zPw) db_set("last-sync-pw", obscure(zPw), 0); | |
| 121 | 135 | db_end_transaction(0); |
| 122 | 136 | } |
| 123 | 137 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -37,15 +37,17 @@ | |
| 37 | ** |
| 38 | ** Options: |
| 39 | ** |
| 40 | ** --admin-user|-A USERNAME Make USERNAME the administrator |
| 41 | ** --private Also clone private branches |
| 42 | ** |
| 43 | */ |
| 44 | void clone_cmd(void){ |
| 45 | char *zPassword; |
| 46 | const char *zDefaultUser; /* Optional name of the default user */ |
| 47 | int nErr = 0; |
| 48 | int bPrivate; /* Also clone private branches */ |
| 49 | |
| 50 | bPrivate = find_option("private",0,0)!=0; |
| 51 | url_proxy_options(); |
| @@ -76,13 +78,15 @@ | |
| 76 | "DELETE FROM blob WHERE rid IN private;" |
| 77 | "DELETE FROM delta wHERE rid IN private;" |
| 78 | "DELETE FROM private;" |
| 79 | ); |
| 80 | shun_artifacts(); |
| 81 | g.zLogin = db_text(0, "SELECT login FROM user WHERE cap LIKE '%%s%%'"); |
| 82 | if( g.zLogin==0 ){ |
| 83 | db_create_default_users(1,zDefaultUser); |
| 84 | } |
| 85 | fossil_print("Repository cloned into %s\n", g.argv[3]); |
| 86 | }else{ |
| 87 | db_create_repository(g.argv[3]); |
| 88 | db_open_repository(g.argv[3]); |
| @@ -91,10 +95,18 @@ | |
| 91 | db_initial_setup(0, zDefaultUser, 0); |
| 92 | user_select(); |
| 93 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 94 | db_set("aux-schema", AUX_SCHEMA, 0); |
| 95 | db_set("last-sync-url", g.argv[2], 0); |
| 96 | db_multi_exec( |
| 97 | "REPLACE INTO config(name,value,mtime)" |
| 98 | " VALUES('server-code', lower(hex(randomblob(20))), now());" |
| 99 | ); |
| 100 | url_enable_proxy(0); |
| @@ -116,7 +128,9 @@ | |
| 116 | rebuild_db(0, 1, 0); |
| 117 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 118 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 119 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 120 | fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); |
| 121 | db_end_transaction(0); |
| 122 | } |
| 123 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -37,15 +37,17 @@ | |
| 37 | ** |
| 38 | ** Options: |
| 39 | ** |
| 40 | ** --admin-user|-A USERNAME Make USERNAME the administrator |
| 41 | ** --private Also clone private branches |
| 42 | ** --ssl-identity=filename Use the SSL identity if requested by the server |
| 43 | ** |
| 44 | */ |
| 45 | void clone_cmd(void){ |
| 46 | char *zPassword; |
| 47 | const char *zDefaultUser; /* Optional name of the default user */ |
| 48 | const char *zPw; /* The user clone password */ |
| 49 | int nErr = 0; |
| 50 | int bPrivate; /* Also clone private branches */ |
| 51 | |
| 52 | bPrivate = find_option("private",0,0)!=0; |
| 53 | url_proxy_options(); |
| @@ -76,13 +78,15 @@ | |
| 78 | "DELETE FROM blob WHERE rid IN private;" |
| 79 | "DELETE FROM delta wHERE rid IN private;" |
| 80 | "DELETE FROM private;" |
| 81 | ); |
| 82 | shun_artifacts(); |
| 83 | db_create_default_users(1, zDefaultUser); |
| 84 | if( zDefaultUser ){ |
| 85 | g.zLogin = zDefaultUser; |
| 86 | }else{ |
| 87 | g.zLogin = db_text(0, "SELECT login FROM user WHERE cap LIKE '%%s%%'"); |
| 88 | } |
| 89 | fossil_print("Repository cloned into %s\n", g.argv[3]); |
| 90 | }else{ |
| 91 | db_create_repository(g.argv[3]); |
| 92 | db_open_repository(g.argv[3]); |
| @@ -91,10 +95,18 @@ | |
| 95 | db_initial_setup(0, zDefaultUser, 0); |
| 96 | user_select(); |
| 97 | db_set("content-schema", CONTENT_SCHEMA, 0); |
| 98 | db_set("aux-schema", AUX_SCHEMA, 0); |
| 99 | db_set("last-sync-url", g.argv[2], 0); |
| 100 | if( g.zSSLIdentity!=0 ){ |
| 101 | /* If the --ssl-identity option was specified, store it as a setting */ |
| 102 | Blob fn; |
| 103 | blob_zero(&fn); |
| 104 | file_canonical_name(g.zSSLIdentity, &fn); |
| 105 | db_set("ssl-identity", blob_str(&fn), 0); |
| 106 | blob_reset(&fn); |
| 107 | } |
| 108 | db_multi_exec( |
| 109 | "REPLACE INTO config(name,value,mtime)" |
| 110 | " VALUES('server-code', lower(hex(randomblob(20))), now());" |
| 111 | ); |
| 112 | url_enable_proxy(0); |
| @@ -116,7 +128,9 @@ | |
| 128 | rebuild_db(0, 1, 0); |
| 129 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 130 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 131 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 132 | fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword); |
| 133 | zPw = g.urlPasswd; |
| 134 | if( !g.dontKeepUrl && zPw) db_set("last-sync-pw", obscure(zPw), 0); |
| 135 | db_end_transaction(0); |
| 136 | } |
| 137 |
+5
-1
| --- src/config.h | ||
| +++ src/config.h | ||
| @@ -24,10 +24,14 @@ | ||
| 24 | 24 | #define _LARGE_FILE 1 |
| 25 | 25 | #ifndef _FILE_OFFSET_BITS |
| 26 | 26 | # define _FILE_OFFSET_BITS 64 |
| 27 | 27 | #endif |
| 28 | 28 | #define _LARGEFILE_SOURCE 1 |
| 29 | + | |
| 30 | +#ifdef HAVE_AUTOCONFIG_H | |
| 31 | +#include "autoconfig.h" | |
| 32 | +#endif | |
| 29 | 33 | |
| 30 | 34 | #ifndef _RC_COMPILE_ |
| 31 | 35 | |
| 32 | 36 | /* |
| 33 | 37 | ** System header files used by all modules |
| @@ -85,11 +89,11 @@ | ||
| 85 | 89 | #include "sqlite3.h" |
| 86 | 90 | |
| 87 | 91 | /* |
| 88 | 92 | ** On Solaris, getpass() will only return up to 8 characters. getpassphrase() returns up to 257. |
| 89 | 93 | */ |
| 90 | -#if defined(__sun__) || defined(sun) | |
| 94 | +#if HAVE_GETPASSPHRASE | |
| 91 | 95 | #define getpass getpassphrase |
| 92 | 96 | #endif |
| 93 | 97 | |
| 94 | 98 | /* |
| 95 | 99 | ** Typedef for a 64-bit integer |
| 96 | 100 |
| --- src/config.h | |
| +++ src/config.h | |
| @@ -24,10 +24,14 @@ | |
| 24 | #define _LARGE_FILE 1 |
| 25 | #ifndef _FILE_OFFSET_BITS |
| 26 | # define _FILE_OFFSET_BITS 64 |
| 27 | #endif |
| 28 | #define _LARGEFILE_SOURCE 1 |
| 29 | |
| 30 | #ifndef _RC_COMPILE_ |
| 31 | |
| 32 | /* |
| 33 | ** System header files used by all modules |
| @@ -85,11 +89,11 @@ | |
| 85 | #include "sqlite3.h" |
| 86 | |
| 87 | /* |
| 88 | ** On Solaris, getpass() will only return up to 8 characters. getpassphrase() returns up to 257. |
| 89 | */ |
| 90 | #if defined(__sun__) || defined(sun) |
| 91 | #define getpass getpassphrase |
| 92 | #endif |
| 93 | |
| 94 | /* |
| 95 | ** Typedef for a 64-bit integer |
| 96 |
| --- src/config.h | |
| +++ src/config.h | |
| @@ -24,10 +24,14 @@ | |
| 24 | #define _LARGE_FILE 1 |
| 25 | #ifndef _FILE_OFFSET_BITS |
| 26 | # define _FILE_OFFSET_BITS 64 |
| 27 | #endif |
| 28 | #define _LARGEFILE_SOURCE 1 |
| 29 | |
| 30 | #ifdef HAVE_AUTOCONFIG_H |
| 31 | #include "autoconfig.h" |
| 32 | #endif |
| 33 | |
| 34 | #ifndef _RC_COMPILE_ |
| 35 | |
| 36 | /* |
| 37 | ** System header files used by all modules |
| @@ -85,11 +89,11 @@ | |
| 89 | #include "sqlite3.h" |
| 90 | |
| 91 | /* |
| 92 | ** On Solaris, getpass() will only return up to 8 characters. getpassphrase() returns up to 257. |
| 93 | */ |
| 94 | #if HAVE_GETPASSPHRASE |
| 95 | #define getpass getpassphrase |
| 96 | #endif |
| 97 | |
| 98 | /* |
| 99 | ** Typedef for a 64-bit integer |
| 100 |
+1
| --- src/configure.c | ||
| +++ src/configure.c | ||
| @@ -81,10 +81,11 @@ | ||
| 81 | 81 | { "project-name", CONFIGSET_PROJ }, |
| 82 | 82 | { "project-description", CONFIGSET_PROJ }, |
| 83 | 83 | { "manifest", CONFIGSET_PROJ }, |
| 84 | 84 | { "ignore-glob", CONFIGSET_PROJ }, |
| 85 | 85 | { "crnl-glob", CONFIGSET_PROJ }, |
| 86 | + { "empty-dirs", CONFIGSET_PROJ }, | |
| 86 | 87 | { "index-page", CONFIGSET_SKIN }, |
| 87 | 88 | { "timeline-block-markup", CONFIGSET_SKIN }, |
| 88 | 89 | { "timeline-max-comment", CONFIGSET_SKIN }, |
| 89 | 90 | { "ticket-table", CONFIGSET_TKT }, |
| 90 | 91 | { "ticket-common", CONFIGSET_TKT }, |
| 91 | 92 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -81,10 +81,11 @@ | |
| 81 | { "project-name", CONFIGSET_PROJ }, |
| 82 | { "project-description", CONFIGSET_PROJ }, |
| 83 | { "manifest", CONFIGSET_PROJ }, |
| 84 | { "ignore-glob", CONFIGSET_PROJ }, |
| 85 | { "crnl-glob", CONFIGSET_PROJ }, |
| 86 | { "index-page", CONFIGSET_SKIN }, |
| 87 | { "timeline-block-markup", CONFIGSET_SKIN }, |
| 88 | { "timeline-max-comment", CONFIGSET_SKIN }, |
| 89 | { "ticket-table", CONFIGSET_TKT }, |
| 90 | { "ticket-common", CONFIGSET_TKT }, |
| 91 |
| --- src/configure.c | |
| +++ src/configure.c | |
| @@ -81,10 +81,11 @@ | |
| 81 | { "project-name", CONFIGSET_PROJ }, |
| 82 | { "project-description", CONFIGSET_PROJ }, |
| 83 | { "manifest", CONFIGSET_PROJ }, |
| 84 | { "ignore-glob", CONFIGSET_PROJ }, |
| 85 | { "crnl-glob", CONFIGSET_PROJ }, |
| 86 | { "empty-dirs", CONFIGSET_PROJ }, |
| 87 | { "index-page", CONFIGSET_SKIN }, |
| 88 | { "timeline-block-markup", CONFIGSET_SKIN }, |
| 89 | { "timeline-max-comment", CONFIGSET_SKIN }, |
| 90 | { "ticket-table", CONFIGSET_TKT }, |
| 91 | { "ticket-common", CONFIGSET_TKT }, |
| 92 |
M
src/db.c
+201
-52
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -153,13 +153,17 @@ | ||
| 153 | 153 | ** Force a rollback and shutdown the database |
| 154 | 154 | */ |
| 155 | 155 | void db_force_rollback(void){ |
| 156 | 156 | int i; |
| 157 | 157 | static int busy = 0; |
| 158 | + sqlite3_stmt *pStmt = 0; | |
| 158 | 159 | if( busy || g.db==0 ) return; |
| 159 | 160 | busy = 1; |
| 160 | 161 | undo_rollback(); |
| 162 | + while( (pStmt = sqlite3_next_stmt(g.db,pStmt))!=0 ){ | |
| 163 | + sqlite3_reset(pStmt); | |
| 164 | + } | |
| 161 | 165 | while( pAllStmt ){ |
| 162 | 166 | db_finalize(pAllStmt); |
| 163 | 167 | } |
| 164 | 168 | if( nBegin ){ |
| 165 | 169 | sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0); |
| @@ -809,10 +813,11 @@ | ||
| 809 | 813 | static const char *aDbName[] = { "/_FOSSIL_", "/.fos" }; |
| 810 | 814 | |
| 811 | 815 | if( g.localOpen) return 1; |
| 812 | 816 | file_getcwd(zPwd, sizeof(zPwd)-20); |
| 813 | 817 | n = strlen(zPwd); |
| 818 | + if( n==1 && zPwd[0]=='/' ) zPwd[0] = '.'; | |
| 814 | 819 | while( n>0 ){ |
| 815 | 820 | if( file_access(zPwd, W_OK) ) break; |
| 816 | 821 | for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){ |
| 817 | 822 | sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "%s", aDbName[i]); |
| 818 | 823 | if( isValidLocalDb(zPwd) ){ |
| @@ -1058,14 +1063,13 @@ | ||
| 1058 | 1063 | |
| 1059 | 1064 | /* |
| 1060 | 1065 | ** Create the default user accounts in the USER table. |
| 1061 | 1066 | */ |
| 1062 | 1067 | void db_create_default_users(int setupUserOnly, const char *zDefaultUser){ |
| 1063 | - const char *zUser; | |
| 1064 | - zUser = db_get("default-user", 0); | |
| 1068 | + const char *zUser = zDefaultUser; | |
| 1065 | 1069 | if( zUser==0 ){ |
| 1066 | - zUser = zDefaultUser; | |
| 1070 | + zUser = db_get("default-user", 0); | |
| 1067 | 1071 | } |
| 1068 | 1072 | if( zUser==0 ){ |
| 1069 | 1073 | #if defined(_WIN32) |
| 1070 | 1074 | zUser = getenv("USERNAME"); |
| 1071 | 1075 | #else |
| @@ -1074,12 +1078,15 @@ | ||
| 1074 | 1078 | } |
| 1075 | 1079 | if( zUser==0 ){ |
| 1076 | 1080 | zUser = "root"; |
| 1077 | 1081 | } |
| 1078 | 1082 | db_multi_exec( |
| 1079 | - "INSERT INTO user(login, pw, cap, info)" | |
| 1080 | - "VALUES(%Q,lower(hex(randomblob(3))),'s','')", zUser | |
| 1083 | + "INSERT OR IGNORE INTO user(login, info) VALUES(%Q,'')", zUser | |
| 1084 | + ); | |
| 1085 | + db_multi_exec( | |
| 1086 | + "UPDATE user SET cap='s', pw=lower(hex(randomblob(3)))" | |
| 1087 | + " WHERE login=%Q", zUser | |
| 1081 | 1088 | ); |
| 1082 | 1089 | if( !setupUserOnly ){ |
| 1083 | 1090 | db_multi_exec( |
| 1084 | 1091 | "INSERT INTO user(login,pw,cap,info)" |
| 1085 | 1092 | " VALUES('anonymous',hex(randomblob(8)),'hmncz','Anon');" |
| @@ -1363,19 +1370,19 @@ | ||
| 1363 | 1370 | */ |
| 1364 | 1371 | int is_truth(const char *zVal){ |
| 1365 | 1372 | static const char *azOn[] = { "on", "yes", "true", "1" }; |
| 1366 | 1373 | int i; |
| 1367 | 1374 | for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){ |
| 1368 | - if( fossil_strcmp(zVal,azOn[i])==0 ) return 1; | |
| 1375 | + if( fossil_stricmp(zVal,azOn[i])==0 ) return 1; | |
| 1369 | 1376 | } |
| 1370 | 1377 | return 0; |
| 1371 | 1378 | } |
| 1372 | 1379 | int is_false(const char *zVal){ |
| 1373 | 1380 | static const char *azOff[] = { "off", "no", "false", "0" }; |
| 1374 | 1381 | int i; |
| 1375 | 1382 | for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){ |
| 1376 | - if( fossil_strcmp(zVal,azOff[i])==0 ) return 1; | |
| 1383 | + if( fossil_stricmp(zVal,azOff[i])==0 ) return 1; | |
| 1377 | 1384 | } |
| 1378 | 1385 | return 0; |
| 1379 | 1386 | } |
| 1380 | 1387 | |
| 1381 | 1388 | /* |
| @@ -1392,24 +1399,114 @@ | ||
| 1392 | 1399 | sqlite3 *dbTemp = g.db; |
| 1393 | 1400 | g.db = g.dbConfig; |
| 1394 | 1401 | g.dbConfig = dbTemp; |
| 1395 | 1402 | } |
| 1396 | 1403 | } |
| 1404 | + | |
| 1405 | +/* | |
| 1406 | +** Logic for reading potentially versioned settings from | |
| 1407 | +** .fossil-settings/<name> , and emits warnings if necessary. | |
| 1408 | +** Returns the non-versioned value without modification if there is no | |
| 1409 | +** versioned value. | |
| 1410 | +*/ | |
| 1411 | +static char *db_get_do_versionable(const char *zName, char *zNonVersionedSetting){ | |
| 1412 | + char *zVersionedSetting = 0; | |
| 1413 | + int noWarn = 0; | |
| 1414 | + struct _cacheEntry { | |
| 1415 | + struct _cacheEntry *next; | |
| 1416 | + const char *zName, *zValue; | |
| 1417 | + } *cacheEntry = 0; | |
| 1418 | + static struct _cacheEntry *cache = 0; | |
| 1419 | + | |
| 1420 | + /* Look up name in cache */ | |
| 1421 | + cacheEntry = cache; | |
| 1422 | + while( cacheEntry!=0 ){ | |
| 1423 | + if( fossil_strcmp(cacheEntry->zName, zName)==0 ){ | |
| 1424 | + zVersionedSetting = fossil_strdup(cacheEntry->zValue); | |
| 1425 | + break; | |
| 1426 | + } | |
| 1427 | + cacheEntry = cacheEntry->next; | |
| 1428 | + } | |
| 1429 | + /* Attempt to read value from file in checkout if there wasn't a cache hit | |
| 1430 | + ** and a checkout is open. */ | |
| 1431 | + if( cacheEntry==0 ){ | |
| 1432 | + Blob versionedPathname; | |
| 1433 | + char *zVersionedPathname; | |
| 1434 | + blob_zero(&versionedPathname); | |
| 1435 | + blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", | |
| 1436 | + g.zLocalRoot, zName); | |
| 1437 | + zVersionedPathname = blob_str(&versionedPathname); | |
| 1438 | + if( file_size(zVersionedPathname)>=0 ){ | |
| 1439 | + /* File exists, and contains the value for this setting. Load from | |
| 1440 | + ** the file. */ | |
| 1441 | + Blob setting; | |
| 1442 | + blob_zero(&setting); | |
| 1443 | + if( blob_read_from_file(&setting, zVersionedPathname) >= 0 ){ | |
| 1444 | + blob_trim(&setting); /* Avoid non-obvious problems with line endings | |
| 1445 | + ** on boolean properties */ | |
| 1446 | + zVersionedSetting = strdup(blob_str(&setting)); | |
| 1447 | + } | |
| 1448 | + blob_reset(&setting); | |
| 1449 | + /* See if there's a no-warn flag */ | |
| 1450 | + blob_append(&versionedPathname, ".no-warn", -1); | |
| 1451 | + if( file_size(blob_str(&versionedPathname))>=0 ){ | |
| 1452 | + noWarn = 1; | |
| 1453 | + } | |
| 1454 | + } | |
| 1455 | + blob_reset(&versionedPathname); | |
| 1456 | + /* Store result in cache, which can be the value or 0 if not found */ | |
| 1457 | + cacheEntry = (struct _cacheEntry*)fossil_malloc(sizeof(struct _cacheEntry)); | |
| 1458 | + cacheEntry->next = cache; | |
| 1459 | + cacheEntry->zName = zName; | |
| 1460 | + cacheEntry->zValue = fossil_strdup(zVersionedSetting); | |
| 1461 | + cache = cacheEntry; | |
| 1462 | + } | |
| 1463 | + /* Display a warning? */ | |
| 1464 | + if( zVersionedSetting!=0 && zNonVersionedSetting!=0 | |
| 1465 | + && zNonVersionedSetting[0]!='\0' && !noWarn | |
| 1466 | + ){ | |
| 1467 | + /* There's a versioned setting, and a non-versioned setting. Tell | |
| 1468 | + ** the user about the conflict */ | |
| 1469 | + fossil_warning( | |
| 1470 | + "setting %s has both versioned and non-versioned values: using " | |
| 1471 | + "versioned value from file .fossil-settings/%s (to silence this " | |
| 1472 | + "warning, either create an empty file named " | |
| 1473 | + ".fossil-settings/%s.no-warn or delete the non-versioned setting " | |
| 1474 | + " with \"fossil unset %s\")", zName, zName, zName, zName | |
| 1475 | + ); | |
| 1476 | + } | |
| 1477 | + /* Prefer the versioned setting */ | |
| 1478 | + return ( zVersionedSetting!=0 ) ? zVersionedSetting : zNonVersionedSetting; | |
| 1479 | +} | |
| 1480 | + | |
| 1397 | 1481 | |
| 1398 | 1482 | /* |
| 1399 | 1483 | ** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the |
| 1400 | 1484 | ** repository and local databases. |
| 1401 | 1485 | */ |
| 1402 | 1486 | char *db_get(const char *zName, char *zDefault){ |
| 1403 | 1487 | char *z = 0; |
| 1488 | + int i; | |
| 1489 | + const struct stControlSettings *ctrlSetting = 0; | |
| 1490 | + /* Is this a setting? */ | |
| 1491 | + for(i=0; ctrlSettings[i].name; i++){ | |
| 1492 | + if( strcmp(ctrlSettings[i].name, zName)==0 ){ | |
| 1493 | + ctrlSetting = &(ctrlSettings[i]); | |
| 1494 | + break; | |
| 1495 | + } | |
| 1496 | + } | |
| 1404 | 1497 | if( g.repositoryOpen ){ |
| 1405 | 1498 | z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName); |
| 1406 | 1499 | } |
| 1407 | 1500 | if( z==0 && g.configOpen ){ |
| 1408 | 1501 | db_swap_connections(); |
| 1409 | 1502 | z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName); |
| 1410 | 1503 | db_swap_connections(); |
| 1504 | + } | |
| 1505 | + if( ctrlSetting!=0 && ctrlSetting->versionable && g.localOpen ){ | |
| 1506 | + /* This is a versionable setting, try and get the info from a checked out file */ | |
| 1507 | + z = db_get_do_versionable(zName, z); | |
| 1411 | 1508 | } |
| 1412 | 1509 | if( z==0 ){ |
| 1413 | 1510 | z = zDefault; |
| 1414 | 1511 | } |
| 1415 | 1512 | return z; |
| @@ -1596,30 +1693,39 @@ | ||
| 1596 | 1693 | } |
| 1597 | 1694 | |
| 1598 | 1695 | /* |
| 1599 | 1696 | ** Print the value of a setting named zName |
| 1600 | 1697 | */ |
| 1601 | -static void print_setting(const char *zName){ | |
| 1698 | +static void print_setting(const struct stControlSettings *ctrlSetting, int localOpen){ | |
| 1602 | 1699 | Stmt q; |
| 1603 | 1700 | if( g.repositoryOpen ){ |
| 1604 | 1701 | db_prepare(&q, |
| 1605 | 1702 | "SELECT '(local)', value FROM config WHERE name=%Q" |
| 1606 | 1703 | " UNION ALL " |
| 1607 | 1704 | "SELECT '(global)', value FROM global_config WHERE name=%Q", |
| 1608 | - zName, zName | |
| 1705 | + ctrlSetting->name, ctrlSetting->name | |
| 1609 | 1706 | ); |
| 1610 | 1707 | }else{ |
| 1611 | 1708 | db_prepare(&q, |
| 1612 | 1709 | "SELECT '(global)', value FROM global_config WHERE name=%Q", |
| 1613 | - zName | |
| 1710 | + ctrlSetting->name | |
| 1614 | 1711 | ); |
| 1615 | 1712 | } |
| 1616 | 1713 | if( db_step(&q)==SQLITE_ROW ){ |
| 1617 | - fossil_print("%-20s %-8s %s\n", zName, db_column_text(&q, 0), | |
| 1714 | + fossil_print("%-20s %-8s %s\n", ctrlSetting->name, db_column_text(&q, 0), | |
| 1618 | 1715 | db_column_text(&q, 1)); |
| 1619 | 1716 | }else{ |
| 1620 | - fossil_print("%-20s\n", zName); | |
| 1717 | + fossil_print("%-20s\n", ctrlSetting->name); | |
| 1718 | + } | |
| 1719 | + if( ctrlSetting->versionable && localOpen ){ | |
| 1720 | + /* Check to see if this is overridden by a versionable settings file */ | |
| 1721 | + Blob versionedPathname; | |
| 1722 | + blob_zero(&versionedPathname); | |
| 1723 | + blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", g.zLocalRoot, ctrlSetting->name); | |
| 1724 | + if( file_size(blob_str(&versionedPathname))>=0 ){ | |
| 1725 | + fossil_print(" (overridden by contents of file .fossil-settings/%s)\n", ctrlSetting->name); | |
| 1726 | + } | |
| 1621 | 1727 | } |
| 1622 | 1728 | db_finalize(&q); |
| 1623 | 1729 | } |
| 1624 | 1730 | |
| 1625 | 1731 | |
| @@ -1635,42 +1741,49 @@ | ||
| 1635 | 1741 | #if INTERFACE |
| 1636 | 1742 | struct stControlSettings { |
| 1637 | 1743 | char const *name; /* Name of the setting */ |
| 1638 | 1744 | char const *var; /* Internal variable name used by db_set() */ |
| 1639 | 1745 | int width; /* Width of display. 0 for boolean values */ |
| 1746 | + int versionable; /* Is this setting versionable? */ | |
| 1640 | 1747 | char const *def; /* Default value */ |
| 1641 | 1748 | }; |
| 1642 | 1749 | #endif /* INTERFACE */ |
| 1643 | 1750 | struct stControlSettings const ctrlSettings[] = { |
| 1644 | - { "access-log", 0, 0, "off" }, | |
| 1645 | - { "auto-captcha", "autocaptcha", 0, "on" }, | |
| 1646 | - { "auto-shun", 0, 0, "on" }, | |
| 1647 | - { "autosync", 0, 0, "on" }, | |
| 1648 | - { "binary-glob", 0, 32, "" }, | |
| 1649 | - { "clearsign", 0, 0, "off" }, | |
| 1650 | - { "crnl-glob", 0, 16, "" }, | |
| 1651 | - { "default-perms", 0, 16, "u" }, | |
| 1652 | - { "diff-command", 0, 16, "" }, | |
| 1653 | - { "dont-push", 0, 0, "off" }, | |
| 1654 | - { "editor", 0, 16, "" }, | |
| 1655 | - { "gdiff-command", 0, 16, "gdiff" }, | |
| 1656 | - { "gmerge-command",0, 40, "" }, | |
| 1657 | - { "https-login", 0, 0, "off" }, | |
| 1658 | - { "ignore-glob", 0, 40, "" }, | |
| 1659 | - { "http-port", 0, 16, "8080" }, | |
| 1660 | - { "localauth", 0, 0, "off" }, | |
| 1661 | - { "main-branch", 0, 40, "trunk" }, | |
| 1662 | - { "manifest", 0, 0, "off" }, | |
| 1663 | - { "max-upload", 0, 25, "250000" }, | |
| 1664 | - { "mtime-changes", 0, 0, "on" }, | |
| 1665 | - { "pgp-command", 0, 32, "gpg --clearsign -o " }, | |
| 1666 | - { "proxy", 0, 32, "off" }, | |
| 1667 | - { "repo-cksum", 0, 0, "on" }, | |
| 1668 | - { "self-register", 0, 0, "off" }, | |
| 1669 | - { "ssh-command", 0, 32, "" }, | |
| 1670 | - { "web-browser", 0, 32, "" }, | |
| 1671 | - { 0,0,0,0 } | |
| 1751 | + { "access-log", 0, 0, 0, "off" }, | |
| 1752 | + { "auto-captcha", "autocaptcha", 0, 0, "on" }, | |
| 1753 | + { "auto-shun", 0, 0, 0, "on" }, | |
| 1754 | + { "autosync", 0, 0, 0, "on" }, | |
| 1755 | + { "binary-glob", 0, 32, 1, "" }, | |
| 1756 | + { "clearsign", 0, 0, 0, "off" }, | |
| 1757 | + { "case-sensitive",0, 0, 0, "on" }, | |
| 1758 | + { "crnl-glob", 0, 16, 1, "" }, | |
| 1759 | + { "default-perms", 0, 16, 0, "u" }, | |
| 1760 | + { "diff-command", 0, 16, 0, "" }, | |
| 1761 | + { "dont-push", 0, 0, 0, "off" }, | |
| 1762 | + { "editor", 0, 16, 0, "" }, | |
| 1763 | + { "gdiff-command", 0, 16, 0, "gdiff" }, | |
| 1764 | + { "gmerge-command",0, 40, 0, "" }, | |
| 1765 | + { "https-login", 0, 0, 0, "off" }, | |
| 1766 | + { "ignore-glob", 0, 40, 1, "" }, | |
| 1767 | + { "empty-dirs", 0, 40, 1, "" }, | |
| 1768 | + { "http-port", 0, 16, 0, "8080" }, | |
| 1769 | + { "localauth", 0, 0, 0, "off" }, | |
| 1770 | + { "main-branch", 0, 40, 0, "trunk" }, | |
| 1771 | + { "manifest", 0, 0, 1, "off" }, | |
| 1772 | + { "max-upload", 0, 25, 0, "250000" }, | |
| 1773 | + { "mtime-changes", 0, 0, 0, "on" }, | |
| 1774 | + { "pgp-command", 0, 32, 0, "gpg --clearsign -o " }, | |
| 1775 | + { "proxy", 0, 32, 0, "off" }, | |
| 1776 | + { "relative-paths",0, 0, 0, "on" }, | |
| 1777 | + { "repo-cksum", 0, 0, 0, "on" }, | |
| 1778 | + { "self-register", 0, 0, 0, "off" }, | |
| 1779 | + { "ssl-ca-location",0, 40, 0, "" }, | |
| 1780 | + { "ssl-identity", 0, 40, 0, "" }, | |
| 1781 | + { "ssh-command", 0, 32, 0, "" }, | |
| 1782 | + { "web-browser", 0, 32, 0, "" }, | |
| 1783 | + { "white-foreground", 0, 0, 0, "off" }, | |
| 1784 | + { 0,0,0,0,0 } | |
| 1672 | 1785 | }; |
| 1673 | 1786 | |
| 1674 | 1787 | /* |
| 1675 | 1788 | ** COMMAND: settings |
| 1676 | 1789 | ** COMMAND: unset |
| @@ -1679,10 +1792,14 @@ | ||
| 1679 | 1792 | ** %fossil unset PROPERTY ?-global? |
| 1680 | 1793 | ** |
| 1681 | 1794 | ** The "settings" command with no arguments lists all properties and their |
| 1682 | 1795 | ** values. With just a property name it shows the value of that property. |
| 1683 | 1796 | ** With a value argument it changes the property for the current repository. |
| 1797 | +** | |
| 1798 | +** Settings marked as versionable are overridden by the contents of the | |
| 1799 | +** file named .fossil-settings/PROPERTY in the checked out files, if that | |
| 1800 | +** file exists. | |
| 1684 | 1801 | ** |
| 1685 | 1802 | ** The "unset" command clears a property setting. |
| 1686 | 1803 | ** |
| 1687 | 1804 | ** |
| 1688 | 1805 | ** auto-captcha If enabled, the Login page provides a button to |
| @@ -1696,20 +1813,25 @@ | ||
| 1696 | 1813 | ** or update and automatically push after commit or |
| 1697 | 1814 | ** tag or branch creation. If the value is "pullonly" |
| 1698 | 1815 | ** then only pull operations occur automatically. |
| 1699 | 1816 | ** Default: on |
| 1700 | 1817 | ** |
| 1701 | -** binary-glob The VALUE is a comma-separated list of GLOB patterns | |
| 1702 | -** that should be treated as binary files for merging | |
| 1703 | -** purposes. Example: *.xml | |
| 1818 | +** binary-glob The VALUE is a comma or newline-separated list of | |
| 1819 | +** (versionable) GLOB patterns that should be treated as binary files | |
| 1820 | +** for merging purposes. Example: *.xml | |
| 1821 | +** | |
| 1822 | +** case-sensitive If TRUE, the files whose names differ only in case | |
| 1823 | +** care considered distinct. If FALSE files whose names | |
| 1824 | +** differ only in case are the same file. Defaults to | |
| 1825 | +** TRUE for unix and FALSE for windows and mac. | |
| 1704 | 1826 | ** |
| 1705 | 1827 | ** clearsign When enabled, fossil will attempt to sign all commits |
| 1706 | 1828 | ** with gpg. When disabled (the default), commits will |
| 1707 | 1829 | ** be unsigned. Default: off |
| 1708 | 1830 | ** |
| 1709 | -** crnl-glob A comma-separated list of GLOB patterns for text files | |
| 1710 | -** in which it is ok to have CR+NL line endings. | |
| 1831 | +** crnl-glob A comma or newline-separated list of GLOB patterns for | |
| 1832 | +** (versionable) text files in which it is ok to have CR+NL line endings. | |
| 1711 | 1833 | ** Set to "*" to disable CR+NL checking. |
| 1712 | 1834 | ** |
| 1713 | 1835 | ** default-perms Permissions given automatically to new users. For more |
| 1714 | 1836 | ** information on permissions see Users page in Server |
| 1715 | 1837 | ** Administration of the HTTP UI. Default: u. |
| @@ -1717,10 +1839,15 @@ | ||
| 1717 | 1839 | ** diff-command External command to run when performing a diff. |
| 1718 | 1840 | ** If undefined, the internal text diff will be used. |
| 1719 | 1841 | ** |
| 1720 | 1842 | ** dont-push Prevent this repository from pushing from client to |
| 1721 | 1843 | ** server. Useful when setting up a private branch. |
| 1844 | +** | |
| 1845 | +** empty-dirs A comma or newline-separated list of pathnames. On | |
| 1846 | +** (versionable) update and checkout commands, if no file or directory | |
| 1847 | +** exists with that name, an empty directory will be | |
| 1848 | +** created. | |
| 1722 | 1849 | ** |
| 1723 | 1850 | ** editor Text editor command used for check-in comments. |
| 1724 | 1851 | ** |
| 1725 | 1852 | ** gdiff-command External command to run when performing a graphical |
| 1726 | 1853 | ** diff. If undefined, text diff will be used. |
| @@ -1735,23 +1862,23 @@ | ||
| 1735 | 1862 | ** and "ui" commands. Default: 8080 |
| 1736 | 1863 | ** |
| 1737 | 1864 | ** https-login Send login creditials using HTTPS instead of HTTP |
| 1738 | 1865 | ** even if the login page request came via HTTP. |
| 1739 | 1866 | ** |
| 1740 | -** ignore-glob The VALUE is a comma-separated list of GLOB patterns | |
| 1741 | -** specifying files that the "extra" command will ignore. | |
| 1742 | -** Example: *.o,*.obj,*.exe | |
| 1867 | +** ignore-glob The VALUE is a comma or newline-separated list of GLOB | |
| 1868 | +** (versionable) patterns specifying files that the "extra" command will | |
| 1869 | +** ignore. Example: *.o,*.obj,*.exe | |
| 1743 | 1870 | ** |
| 1744 | 1871 | ** localauth If enabled, require that HTTP connections from |
| 1745 | 1872 | ** 127.0.0.1 be authenticated by password. If |
| 1746 | 1873 | ** false, all HTTP requests from localhost have |
| 1747 | 1874 | ** unrestricted access to the repository. |
| 1748 | 1875 | ** |
| 1749 | 1876 | ** main-branch The primary branch for the project. Default: trunk |
| 1750 | 1877 | ** |
| 1751 | 1878 | ** manifest If enabled, automatically create files "manifest" and |
| 1752 | -** "manifest.uuid" in every checkout. The SQLite and | |
| 1879 | +** (versionable) "manifest.uuid" in every checkout. The SQLite and | |
| 1753 | 1880 | ** Fossil repositories both require this. Default: off. |
| 1754 | 1881 | ** |
| 1755 | 1882 | ** max-upload A limit on the size of uplink HTTP requests. The |
| 1756 | 1883 | ** default is 250000 bytes. |
| 1757 | 1884 | ** |
| @@ -1763,10 +1890,13 @@ | ||
| 1763 | 1890 | ** |
| 1764 | 1891 | ** proxy URL of the HTTP proxy. If undefined or "off" then |
| 1765 | 1892 | ** the "http_proxy" environment variable is consulted. |
| 1766 | 1893 | ** If the http_proxy environment variable is undefined |
| 1767 | 1894 | ** then a direct HTTP connection is used. |
| 1895 | +** | |
| 1896 | +** relative-paths When showing changes and extras, report paths relative | |
| 1897 | +** to the current working directory. Default: "on" | |
| 1768 | 1898 | ** |
| 1769 | 1899 | ** repo-cksum Compute checksums over all files in each checkout |
| 1770 | 1900 | ** as a double-check of correctness. Defaults to "on". |
| 1771 | 1901 | ** Disable on large repositories for a performance |
| 1772 | 1902 | ** improvement. |
| @@ -1773,10 +1903,28 @@ | ||
| 1773 | 1903 | ** |
| 1774 | 1904 | ** self-register Allow users to register themselves through the HTTP UI. |
| 1775 | 1905 | ** This is useful if you want to see other names than |
| 1776 | 1906 | ** "Anonymous" in e.g. ticketing system. On the other hand |
| 1777 | 1907 | ** users can not be deleted. Default: off. |
| 1908 | +** | |
| 1909 | +** ssl-ca-location The full pathname to a file containing PEM encoded | |
| 1910 | +** CA root certificates, or a directory of certificates | |
| 1911 | +** with filenames formed from the certificate hashes as | |
| 1912 | +** required by OpenSSL. | |
| 1913 | +** If set, this will override the OS default list of | |
| 1914 | +** OpenSSL CAs. If unset, the default list will be used. | |
| 1915 | +** Some platforms may add additional certificates. | |
| 1916 | +** Check your platform behaviour is as required if the | |
| 1917 | +** exact contents of the CA root is critical for your | |
| 1918 | +** application. | |
| 1919 | +** | |
| 1920 | +** ssl-identity The full pathname to a file containing a certificate | |
| 1921 | +** and private key in PEM format. Create by concatenating | |
| 1922 | +** the certificate and private key files. | |
| 1923 | +** This identity will be presented to SSL servers to | |
| 1924 | +** authenticate this client, in addition to the normal | |
| 1925 | +** password authentication. | |
| 1778 | 1926 | ** |
| 1779 | 1927 | ** ssh-command Command used to talk to a remote machine with |
| 1780 | 1928 | ** the "ssh://" protocol. |
| 1781 | 1929 | ** |
| 1782 | 1930 | ** web-browser A shell command used to launch your preferred |
| @@ -1797,12 +1945,13 @@ | ||
| 1797 | 1945 | } |
| 1798 | 1946 | if( unsetFlag && g.argc!=3 ){ |
| 1799 | 1947 | usage("PROPERTY ?-global?"); |
| 1800 | 1948 | } |
| 1801 | 1949 | if( g.argc==2 ){ |
| 1950 | + int openLocal = db_open_local(); | |
| 1802 | 1951 | for(i=0; ctrlSettings[i].name; i++){ |
| 1803 | - print_setting(ctrlSettings[i].name); | |
| 1952 | + print_setting(&ctrlSettings[i], openLocal); | |
| 1804 | 1953 | } |
| 1805 | 1954 | }else if( g.argc==3 || g.argc==4 ){ |
| 1806 | 1955 | const char *zName = g.argv[2]; |
| 1807 | 1956 | int isManifest; |
| 1808 | 1957 | int n = strlen(zName); |
| @@ -1820,13 +1969,13 @@ | ||
| 1820 | 1969 | db_unset(ctrlSettings[i].name, globalFlag); |
| 1821 | 1970 | }else if( g.argc==4 ){ |
| 1822 | 1971 | db_set(ctrlSettings[i].name, g.argv[3], globalFlag); |
| 1823 | 1972 | }else{ |
| 1824 | 1973 | isManifest = 0; |
| 1825 | - print_setting(ctrlSettings[i].name); | |
| 1974 | + print_setting(&ctrlSettings[i], db_open_local()); | |
| 1826 | 1975 | } |
| 1827 | - if( isManifest ){ | |
| 1976 | + if( isManifest && g.localOpen ){ | |
| 1828 | 1977 | manifest_to_disk(db_lget_int("checkout", 0)); |
| 1829 | 1978 | } |
| 1830 | 1979 | }else{ |
| 1831 | 1980 | usage("?PROPERTY? ?VALUE?"); |
| 1832 | 1981 | } |
| 1833 | 1982 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -153,13 +153,17 @@ | |
| 153 | ** Force a rollback and shutdown the database |
| 154 | */ |
| 155 | void db_force_rollback(void){ |
| 156 | int i; |
| 157 | static int busy = 0; |
| 158 | if( busy || g.db==0 ) return; |
| 159 | busy = 1; |
| 160 | undo_rollback(); |
| 161 | while( pAllStmt ){ |
| 162 | db_finalize(pAllStmt); |
| 163 | } |
| 164 | if( nBegin ){ |
| 165 | sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0); |
| @@ -809,10 +813,11 @@ | |
| 809 | static const char *aDbName[] = { "/_FOSSIL_", "/.fos" }; |
| 810 | |
| 811 | if( g.localOpen) return 1; |
| 812 | file_getcwd(zPwd, sizeof(zPwd)-20); |
| 813 | n = strlen(zPwd); |
| 814 | while( n>0 ){ |
| 815 | if( file_access(zPwd, W_OK) ) break; |
| 816 | for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){ |
| 817 | sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "%s", aDbName[i]); |
| 818 | if( isValidLocalDb(zPwd) ){ |
| @@ -1058,14 +1063,13 @@ | |
| 1058 | |
| 1059 | /* |
| 1060 | ** Create the default user accounts in the USER table. |
| 1061 | */ |
| 1062 | void db_create_default_users(int setupUserOnly, const char *zDefaultUser){ |
| 1063 | const char *zUser; |
| 1064 | zUser = db_get("default-user", 0); |
| 1065 | if( zUser==0 ){ |
| 1066 | zUser = zDefaultUser; |
| 1067 | } |
| 1068 | if( zUser==0 ){ |
| 1069 | #if defined(_WIN32) |
| 1070 | zUser = getenv("USERNAME"); |
| 1071 | #else |
| @@ -1074,12 +1078,15 @@ | |
| 1074 | } |
| 1075 | if( zUser==0 ){ |
| 1076 | zUser = "root"; |
| 1077 | } |
| 1078 | db_multi_exec( |
| 1079 | "INSERT INTO user(login, pw, cap, info)" |
| 1080 | "VALUES(%Q,lower(hex(randomblob(3))),'s','')", zUser |
| 1081 | ); |
| 1082 | if( !setupUserOnly ){ |
| 1083 | db_multi_exec( |
| 1084 | "INSERT INTO user(login,pw,cap,info)" |
| 1085 | " VALUES('anonymous',hex(randomblob(8)),'hmncz','Anon');" |
| @@ -1363,19 +1370,19 @@ | |
| 1363 | */ |
| 1364 | int is_truth(const char *zVal){ |
| 1365 | static const char *azOn[] = { "on", "yes", "true", "1" }; |
| 1366 | int i; |
| 1367 | for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){ |
| 1368 | if( fossil_strcmp(zVal,azOn[i])==0 ) return 1; |
| 1369 | } |
| 1370 | return 0; |
| 1371 | } |
| 1372 | int is_false(const char *zVal){ |
| 1373 | static const char *azOff[] = { "off", "no", "false", "0" }; |
| 1374 | int i; |
| 1375 | for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){ |
| 1376 | if( fossil_strcmp(zVal,azOff[i])==0 ) return 1; |
| 1377 | } |
| 1378 | return 0; |
| 1379 | } |
| 1380 | |
| 1381 | /* |
| @@ -1392,24 +1399,114 @@ | |
| 1392 | sqlite3 *dbTemp = g.db; |
| 1393 | g.db = g.dbConfig; |
| 1394 | g.dbConfig = dbTemp; |
| 1395 | } |
| 1396 | } |
| 1397 | |
| 1398 | /* |
| 1399 | ** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the |
| 1400 | ** repository and local databases. |
| 1401 | */ |
| 1402 | char *db_get(const char *zName, char *zDefault){ |
| 1403 | char *z = 0; |
| 1404 | if( g.repositoryOpen ){ |
| 1405 | z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName); |
| 1406 | } |
| 1407 | if( z==0 && g.configOpen ){ |
| 1408 | db_swap_connections(); |
| 1409 | z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName); |
| 1410 | db_swap_connections(); |
| 1411 | } |
| 1412 | if( z==0 ){ |
| 1413 | z = zDefault; |
| 1414 | } |
| 1415 | return z; |
| @@ -1596,30 +1693,39 @@ | |
| 1596 | } |
| 1597 | |
| 1598 | /* |
| 1599 | ** Print the value of a setting named zName |
| 1600 | */ |
| 1601 | static void print_setting(const char *zName){ |
| 1602 | Stmt q; |
| 1603 | if( g.repositoryOpen ){ |
| 1604 | db_prepare(&q, |
| 1605 | "SELECT '(local)', value FROM config WHERE name=%Q" |
| 1606 | " UNION ALL " |
| 1607 | "SELECT '(global)', value FROM global_config WHERE name=%Q", |
| 1608 | zName, zName |
| 1609 | ); |
| 1610 | }else{ |
| 1611 | db_prepare(&q, |
| 1612 | "SELECT '(global)', value FROM global_config WHERE name=%Q", |
| 1613 | zName |
| 1614 | ); |
| 1615 | } |
| 1616 | if( db_step(&q)==SQLITE_ROW ){ |
| 1617 | fossil_print("%-20s %-8s %s\n", zName, db_column_text(&q, 0), |
| 1618 | db_column_text(&q, 1)); |
| 1619 | }else{ |
| 1620 | fossil_print("%-20s\n", zName); |
| 1621 | } |
| 1622 | db_finalize(&q); |
| 1623 | } |
| 1624 | |
| 1625 | |
| @@ -1635,42 +1741,49 @@ | |
| 1635 | #if INTERFACE |
| 1636 | struct stControlSettings { |
| 1637 | char const *name; /* Name of the setting */ |
| 1638 | char const *var; /* Internal variable name used by db_set() */ |
| 1639 | int width; /* Width of display. 0 for boolean values */ |
| 1640 | char const *def; /* Default value */ |
| 1641 | }; |
| 1642 | #endif /* INTERFACE */ |
| 1643 | struct stControlSettings const ctrlSettings[] = { |
| 1644 | { "access-log", 0, 0, "off" }, |
| 1645 | { "auto-captcha", "autocaptcha", 0, "on" }, |
| 1646 | { "auto-shun", 0, 0, "on" }, |
| 1647 | { "autosync", 0, 0, "on" }, |
| 1648 | { "binary-glob", 0, 32, "" }, |
| 1649 | { "clearsign", 0, 0, "off" }, |
| 1650 | { "crnl-glob", 0, 16, "" }, |
| 1651 | { "default-perms", 0, 16, "u" }, |
| 1652 | { "diff-command", 0, 16, "" }, |
| 1653 | { "dont-push", 0, 0, "off" }, |
| 1654 | { "editor", 0, 16, "" }, |
| 1655 | { "gdiff-command", 0, 16, "gdiff" }, |
| 1656 | { "gmerge-command",0, 40, "" }, |
| 1657 | { "https-login", 0, 0, "off" }, |
| 1658 | { "ignore-glob", 0, 40, "" }, |
| 1659 | { "http-port", 0, 16, "8080" }, |
| 1660 | { "localauth", 0, 0, "off" }, |
| 1661 | { "main-branch", 0, 40, "trunk" }, |
| 1662 | { "manifest", 0, 0, "off" }, |
| 1663 | { "max-upload", 0, 25, "250000" }, |
| 1664 | { "mtime-changes", 0, 0, "on" }, |
| 1665 | { "pgp-command", 0, 32, "gpg --clearsign -o " }, |
| 1666 | { "proxy", 0, 32, "off" }, |
| 1667 | { "repo-cksum", 0, 0, "on" }, |
| 1668 | { "self-register", 0, 0, "off" }, |
| 1669 | { "ssh-command", 0, 32, "" }, |
| 1670 | { "web-browser", 0, 32, "" }, |
| 1671 | { 0,0,0,0 } |
| 1672 | }; |
| 1673 | |
| 1674 | /* |
| 1675 | ** COMMAND: settings |
| 1676 | ** COMMAND: unset |
| @@ -1679,10 +1792,14 @@ | |
| 1679 | ** %fossil unset PROPERTY ?-global? |
| 1680 | ** |
| 1681 | ** The "settings" command with no arguments lists all properties and their |
| 1682 | ** values. With just a property name it shows the value of that property. |
| 1683 | ** With a value argument it changes the property for the current repository. |
| 1684 | ** |
| 1685 | ** The "unset" command clears a property setting. |
| 1686 | ** |
| 1687 | ** |
| 1688 | ** auto-captcha If enabled, the Login page provides a button to |
| @@ -1696,20 +1813,25 @@ | |
| 1696 | ** or update and automatically push after commit or |
| 1697 | ** tag or branch creation. If the value is "pullonly" |
| 1698 | ** then only pull operations occur automatically. |
| 1699 | ** Default: on |
| 1700 | ** |
| 1701 | ** binary-glob The VALUE is a comma-separated list of GLOB patterns |
| 1702 | ** that should be treated as binary files for merging |
| 1703 | ** purposes. Example: *.xml |
| 1704 | ** |
| 1705 | ** clearsign When enabled, fossil will attempt to sign all commits |
| 1706 | ** with gpg. When disabled (the default), commits will |
| 1707 | ** be unsigned. Default: off |
| 1708 | ** |
| 1709 | ** crnl-glob A comma-separated list of GLOB patterns for text files |
| 1710 | ** in which it is ok to have CR+NL line endings. |
| 1711 | ** Set to "*" to disable CR+NL checking. |
| 1712 | ** |
| 1713 | ** default-perms Permissions given automatically to new users. For more |
| 1714 | ** information on permissions see Users page in Server |
| 1715 | ** Administration of the HTTP UI. Default: u. |
| @@ -1717,10 +1839,15 @@ | |
| 1717 | ** diff-command External command to run when performing a diff. |
| 1718 | ** If undefined, the internal text diff will be used. |
| 1719 | ** |
| 1720 | ** dont-push Prevent this repository from pushing from client to |
| 1721 | ** server. Useful when setting up a private branch. |
| 1722 | ** |
| 1723 | ** editor Text editor command used for check-in comments. |
| 1724 | ** |
| 1725 | ** gdiff-command External command to run when performing a graphical |
| 1726 | ** diff. If undefined, text diff will be used. |
| @@ -1735,23 +1862,23 @@ | |
| 1735 | ** and "ui" commands. Default: 8080 |
| 1736 | ** |
| 1737 | ** https-login Send login creditials using HTTPS instead of HTTP |
| 1738 | ** even if the login page request came via HTTP. |
| 1739 | ** |
| 1740 | ** ignore-glob The VALUE is a comma-separated list of GLOB patterns |
| 1741 | ** specifying files that the "extra" command will ignore. |
| 1742 | ** Example: *.o,*.obj,*.exe |
| 1743 | ** |
| 1744 | ** localauth If enabled, require that HTTP connections from |
| 1745 | ** 127.0.0.1 be authenticated by password. If |
| 1746 | ** false, all HTTP requests from localhost have |
| 1747 | ** unrestricted access to the repository. |
| 1748 | ** |
| 1749 | ** main-branch The primary branch for the project. Default: trunk |
| 1750 | ** |
| 1751 | ** manifest If enabled, automatically create files "manifest" and |
| 1752 | ** "manifest.uuid" in every checkout. The SQLite and |
| 1753 | ** Fossil repositories both require this. Default: off. |
| 1754 | ** |
| 1755 | ** max-upload A limit on the size of uplink HTTP requests. The |
| 1756 | ** default is 250000 bytes. |
| 1757 | ** |
| @@ -1763,10 +1890,13 @@ | |
| 1763 | ** |
| 1764 | ** proxy URL of the HTTP proxy. If undefined or "off" then |
| 1765 | ** the "http_proxy" environment variable is consulted. |
| 1766 | ** If the http_proxy environment variable is undefined |
| 1767 | ** then a direct HTTP connection is used. |
| 1768 | ** |
| 1769 | ** repo-cksum Compute checksums over all files in each checkout |
| 1770 | ** as a double-check of correctness. Defaults to "on". |
| 1771 | ** Disable on large repositories for a performance |
| 1772 | ** improvement. |
| @@ -1773,10 +1903,28 @@ | |
| 1773 | ** |
| 1774 | ** self-register Allow users to register themselves through the HTTP UI. |
| 1775 | ** This is useful if you want to see other names than |
| 1776 | ** "Anonymous" in e.g. ticketing system. On the other hand |
| 1777 | ** users can not be deleted. Default: off. |
| 1778 | ** |
| 1779 | ** ssh-command Command used to talk to a remote machine with |
| 1780 | ** the "ssh://" protocol. |
| 1781 | ** |
| 1782 | ** web-browser A shell command used to launch your preferred |
| @@ -1797,12 +1945,13 @@ | |
| 1797 | } |
| 1798 | if( unsetFlag && g.argc!=3 ){ |
| 1799 | usage("PROPERTY ?-global?"); |
| 1800 | } |
| 1801 | if( g.argc==2 ){ |
| 1802 | for(i=0; ctrlSettings[i].name; i++){ |
| 1803 | print_setting(ctrlSettings[i].name); |
| 1804 | } |
| 1805 | }else if( g.argc==3 || g.argc==4 ){ |
| 1806 | const char *zName = g.argv[2]; |
| 1807 | int isManifest; |
| 1808 | int n = strlen(zName); |
| @@ -1820,13 +1969,13 @@ | |
| 1820 | db_unset(ctrlSettings[i].name, globalFlag); |
| 1821 | }else if( g.argc==4 ){ |
| 1822 | db_set(ctrlSettings[i].name, g.argv[3], globalFlag); |
| 1823 | }else{ |
| 1824 | isManifest = 0; |
| 1825 | print_setting(ctrlSettings[i].name); |
| 1826 | } |
| 1827 | if( isManifest ){ |
| 1828 | manifest_to_disk(db_lget_int("checkout", 0)); |
| 1829 | } |
| 1830 | }else{ |
| 1831 | usage("?PROPERTY? ?VALUE?"); |
| 1832 | } |
| 1833 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -153,13 +153,17 @@ | |
| 153 | ** Force a rollback and shutdown the database |
| 154 | */ |
| 155 | void db_force_rollback(void){ |
| 156 | int i; |
| 157 | static int busy = 0; |
| 158 | sqlite3_stmt *pStmt = 0; |
| 159 | if( busy || g.db==0 ) return; |
| 160 | busy = 1; |
| 161 | undo_rollback(); |
| 162 | while( (pStmt = sqlite3_next_stmt(g.db,pStmt))!=0 ){ |
| 163 | sqlite3_reset(pStmt); |
| 164 | } |
| 165 | while( pAllStmt ){ |
| 166 | db_finalize(pAllStmt); |
| 167 | } |
| 168 | if( nBegin ){ |
| 169 | sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0); |
| @@ -809,10 +813,11 @@ | |
| 813 | static const char *aDbName[] = { "/_FOSSIL_", "/.fos" }; |
| 814 | |
| 815 | if( g.localOpen) return 1; |
| 816 | file_getcwd(zPwd, sizeof(zPwd)-20); |
| 817 | n = strlen(zPwd); |
| 818 | if( n==1 && zPwd[0]=='/' ) zPwd[0] = '.'; |
| 819 | while( n>0 ){ |
| 820 | if( file_access(zPwd, W_OK) ) break; |
| 821 | for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){ |
| 822 | sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "%s", aDbName[i]); |
| 823 | if( isValidLocalDb(zPwd) ){ |
| @@ -1058,14 +1063,13 @@ | |
| 1063 | |
| 1064 | /* |
| 1065 | ** Create the default user accounts in the USER table. |
| 1066 | */ |
| 1067 | void db_create_default_users(int setupUserOnly, const char *zDefaultUser){ |
| 1068 | const char *zUser = zDefaultUser; |
| 1069 | if( zUser==0 ){ |
| 1070 | zUser = db_get("default-user", 0); |
| 1071 | } |
| 1072 | if( zUser==0 ){ |
| 1073 | #if defined(_WIN32) |
| 1074 | zUser = getenv("USERNAME"); |
| 1075 | #else |
| @@ -1074,12 +1078,15 @@ | |
| 1078 | } |
| 1079 | if( zUser==0 ){ |
| 1080 | zUser = "root"; |
| 1081 | } |
| 1082 | db_multi_exec( |
| 1083 | "INSERT OR IGNORE INTO user(login, info) VALUES(%Q,'')", zUser |
| 1084 | ); |
| 1085 | db_multi_exec( |
| 1086 | "UPDATE user SET cap='s', pw=lower(hex(randomblob(3)))" |
| 1087 | " WHERE login=%Q", zUser |
| 1088 | ); |
| 1089 | if( !setupUserOnly ){ |
| 1090 | db_multi_exec( |
| 1091 | "INSERT INTO user(login,pw,cap,info)" |
| 1092 | " VALUES('anonymous',hex(randomblob(8)),'hmncz','Anon');" |
| @@ -1363,19 +1370,19 @@ | |
| 1370 | */ |
| 1371 | int is_truth(const char *zVal){ |
| 1372 | static const char *azOn[] = { "on", "yes", "true", "1" }; |
| 1373 | int i; |
| 1374 | for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){ |
| 1375 | if( fossil_stricmp(zVal,azOn[i])==0 ) return 1; |
| 1376 | } |
| 1377 | return 0; |
| 1378 | } |
| 1379 | int is_false(const char *zVal){ |
| 1380 | static const char *azOff[] = { "off", "no", "false", "0" }; |
| 1381 | int i; |
| 1382 | for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){ |
| 1383 | if( fossil_stricmp(zVal,azOff[i])==0 ) return 1; |
| 1384 | } |
| 1385 | return 0; |
| 1386 | } |
| 1387 | |
| 1388 | /* |
| @@ -1392,24 +1399,114 @@ | |
| 1399 | sqlite3 *dbTemp = g.db; |
| 1400 | g.db = g.dbConfig; |
| 1401 | g.dbConfig = dbTemp; |
| 1402 | } |
| 1403 | } |
| 1404 | |
| 1405 | /* |
| 1406 | ** Logic for reading potentially versioned settings from |
| 1407 | ** .fossil-settings/<name> , and emits warnings if necessary. |
| 1408 | ** Returns the non-versioned value without modification if there is no |
| 1409 | ** versioned value. |
| 1410 | */ |
| 1411 | static char *db_get_do_versionable(const char *zName, char *zNonVersionedSetting){ |
| 1412 | char *zVersionedSetting = 0; |
| 1413 | int noWarn = 0; |
| 1414 | struct _cacheEntry { |
| 1415 | struct _cacheEntry *next; |
| 1416 | const char *zName, *zValue; |
| 1417 | } *cacheEntry = 0; |
| 1418 | static struct _cacheEntry *cache = 0; |
| 1419 | |
| 1420 | /* Look up name in cache */ |
| 1421 | cacheEntry = cache; |
| 1422 | while( cacheEntry!=0 ){ |
| 1423 | if( fossil_strcmp(cacheEntry->zName, zName)==0 ){ |
| 1424 | zVersionedSetting = fossil_strdup(cacheEntry->zValue); |
| 1425 | break; |
| 1426 | } |
| 1427 | cacheEntry = cacheEntry->next; |
| 1428 | } |
| 1429 | /* Attempt to read value from file in checkout if there wasn't a cache hit |
| 1430 | ** and a checkout is open. */ |
| 1431 | if( cacheEntry==0 ){ |
| 1432 | Blob versionedPathname; |
| 1433 | char *zVersionedPathname; |
| 1434 | blob_zero(&versionedPathname); |
| 1435 | blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", |
| 1436 | g.zLocalRoot, zName); |
| 1437 | zVersionedPathname = blob_str(&versionedPathname); |
| 1438 | if( file_size(zVersionedPathname)>=0 ){ |
| 1439 | /* File exists, and contains the value for this setting. Load from |
| 1440 | ** the file. */ |
| 1441 | Blob setting; |
| 1442 | blob_zero(&setting); |
| 1443 | if( blob_read_from_file(&setting, zVersionedPathname) >= 0 ){ |
| 1444 | blob_trim(&setting); /* Avoid non-obvious problems with line endings |
| 1445 | ** on boolean properties */ |
| 1446 | zVersionedSetting = strdup(blob_str(&setting)); |
| 1447 | } |
| 1448 | blob_reset(&setting); |
| 1449 | /* See if there's a no-warn flag */ |
| 1450 | blob_append(&versionedPathname, ".no-warn", -1); |
| 1451 | if( file_size(blob_str(&versionedPathname))>=0 ){ |
| 1452 | noWarn = 1; |
| 1453 | } |
| 1454 | } |
| 1455 | blob_reset(&versionedPathname); |
| 1456 | /* Store result in cache, which can be the value or 0 if not found */ |
| 1457 | cacheEntry = (struct _cacheEntry*)fossil_malloc(sizeof(struct _cacheEntry)); |
| 1458 | cacheEntry->next = cache; |
| 1459 | cacheEntry->zName = zName; |
| 1460 | cacheEntry->zValue = fossil_strdup(zVersionedSetting); |
| 1461 | cache = cacheEntry; |
| 1462 | } |
| 1463 | /* Display a warning? */ |
| 1464 | if( zVersionedSetting!=0 && zNonVersionedSetting!=0 |
| 1465 | && zNonVersionedSetting[0]!='\0' && !noWarn |
| 1466 | ){ |
| 1467 | /* There's a versioned setting, and a non-versioned setting. Tell |
| 1468 | ** the user about the conflict */ |
| 1469 | fossil_warning( |
| 1470 | "setting %s has both versioned and non-versioned values: using " |
| 1471 | "versioned value from file .fossil-settings/%s (to silence this " |
| 1472 | "warning, either create an empty file named " |
| 1473 | ".fossil-settings/%s.no-warn or delete the non-versioned setting " |
| 1474 | " with \"fossil unset %s\")", zName, zName, zName, zName |
| 1475 | ); |
| 1476 | } |
| 1477 | /* Prefer the versioned setting */ |
| 1478 | return ( zVersionedSetting!=0 ) ? zVersionedSetting : zNonVersionedSetting; |
| 1479 | } |
| 1480 | |
| 1481 | |
| 1482 | /* |
| 1483 | ** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the |
| 1484 | ** repository and local databases. |
| 1485 | */ |
| 1486 | char *db_get(const char *zName, char *zDefault){ |
| 1487 | char *z = 0; |
| 1488 | int i; |
| 1489 | const struct stControlSettings *ctrlSetting = 0; |
| 1490 | /* Is this a setting? */ |
| 1491 | for(i=0; ctrlSettings[i].name; i++){ |
| 1492 | if( strcmp(ctrlSettings[i].name, zName)==0 ){ |
| 1493 | ctrlSetting = &(ctrlSettings[i]); |
| 1494 | break; |
| 1495 | } |
| 1496 | } |
| 1497 | if( g.repositoryOpen ){ |
| 1498 | z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName); |
| 1499 | } |
| 1500 | if( z==0 && g.configOpen ){ |
| 1501 | db_swap_connections(); |
| 1502 | z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName); |
| 1503 | db_swap_connections(); |
| 1504 | } |
| 1505 | if( ctrlSetting!=0 && ctrlSetting->versionable && g.localOpen ){ |
| 1506 | /* This is a versionable setting, try and get the info from a checked out file */ |
| 1507 | z = db_get_do_versionable(zName, z); |
| 1508 | } |
| 1509 | if( z==0 ){ |
| 1510 | z = zDefault; |
| 1511 | } |
| 1512 | return z; |
| @@ -1596,30 +1693,39 @@ | |
| 1693 | } |
| 1694 | |
| 1695 | /* |
| 1696 | ** Print the value of a setting named zName |
| 1697 | */ |
| 1698 | static void print_setting(const struct stControlSettings *ctrlSetting, int localOpen){ |
| 1699 | Stmt q; |
| 1700 | if( g.repositoryOpen ){ |
| 1701 | db_prepare(&q, |
| 1702 | "SELECT '(local)', value FROM config WHERE name=%Q" |
| 1703 | " UNION ALL " |
| 1704 | "SELECT '(global)', value FROM global_config WHERE name=%Q", |
| 1705 | ctrlSetting->name, ctrlSetting->name |
| 1706 | ); |
| 1707 | }else{ |
| 1708 | db_prepare(&q, |
| 1709 | "SELECT '(global)', value FROM global_config WHERE name=%Q", |
| 1710 | ctrlSetting->name |
| 1711 | ); |
| 1712 | } |
| 1713 | if( db_step(&q)==SQLITE_ROW ){ |
| 1714 | fossil_print("%-20s %-8s %s\n", ctrlSetting->name, db_column_text(&q, 0), |
| 1715 | db_column_text(&q, 1)); |
| 1716 | }else{ |
| 1717 | fossil_print("%-20s\n", ctrlSetting->name); |
| 1718 | } |
| 1719 | if( ctrlSetting->versionable && localOpen ){ |
| 1720 | /* Check to see if this is overridden by a versionable settings file */ |
| 1721 | Blob versionedPathname; |
| 1722 | blob_zero(&versionedPathname); |
| 1723 | blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", g.zLocalRoot, ctrlSetting->name); |
| 1724 | if( file_size(blob_str(&versionedPathname))>=0 ){ |
| 1725 | fossil_print(" (overridden by contents of file .fossil-settings/%s)\n", ctrlSetting->name); |
| 1726 | } |
| 1727 | } |
| 1728 | db_finalize(&q); |
| 1729 | } |
| 1730 | |
| 1731 | |
| @@ -1635,42 +1741,49 @@ | |
| 1741 | #if INTERFACE |
| 1742 | struct stControlSettings { |
| 1743 | char const *name; /* Name of the setting */ |
| 1744 | char const *var; /* Internal variable name used by db_set() */ |
| 1745 | int width; /* Width of display. 0 for boolean values */ |
| 1746 | int versionable; /* Is this setting versionable? */ |
| 1747 | char const *def; /* Default value */ |
| 1748 | }; |
| 1749 | #endif /* INTERFACE */ |
| 1750 | struct stControlSettings const ctrlSettings[] = { |
| 1751 | { "access-log", 0, 0, 0, "off" }, |
| 1752 | { "auto-captcha", "autocaptcha", 0, 0, "on" }, |
| 1753 | { "auto-shun", 0, 0, 0, "on" }, |
| 1754 | { "autosync", 0, 0, 0, "on" }, |
| 1755 | { "binary-glob", 0, 32, 1, "" }, |
| 1756 | { "clearsign", 0, 0, 0, "off" }, |
| 1757 | { "case-sensitive",0, 0, 0, "on" }, |
| 1758 | { "crnl-glob", 0, 16, 1, "" }, |
| 1759 | { "default-perms", 0, 16, 0, "u" }, |
| 1760 | { "diff-command", 0, 16, 0, "" }, |
| 1761 | { "dont-push", 0, 0, 0, "off" }, |
| 1762 | { "editor", 0, 16, 0, "" }, |
| 1763 | { "gdiff-command", 0, 16, 0, "gdiff" }, |
| 1764 | { "gmerge-command",0, 40, 0, "" }, |
| 1765 | { "https-login", 0, 0, 0, "off" }, |
| 1766 | { "ignore-glob", 0, 40, 1, "" }, |
| 1767 | { "empty-dirs", 0, 40, 1, "" }, |
| 1768 | { "http-port", 0, 16, 0, "8080" }, |
| 1769 | { "localauth", 0, 0, 0, "off" }, |
| 1770 | { "main-branch", 0, 40, 0, "trunk" }, |
| 1771 | { "manifest", 0, 0, 1, "off" }, |
| 1772 | { "max-upload", 0, 25, 0, "250000" }, |
| 1773 | { "mtime-changes", 0, 0, 0, "on" }, |
| 1774 | { "pgp-command", 0, 32, 0, "gpg --clearsign -o " }, |
| 1775 | { "proxy", 0, 32, 0, "off" }, |
| 1776 | { "relative-paths",0, 0, 0, "on" }, |
| 1777 | { "repo-cksum", 0, 0, 0, "on" }, |
| 1778 | { "self-register", 0, 0, 0, "off" }, |
| 1779 | { "ssl-ca-location",0, 40, 0, "" }, |
| 1780 | { "ssl-identity", 0, 40, 0, "" }, |
| 1781 | { "ssh-command", 0, 32, 0, "" }, |
| 1782 | { "web-browser", 0, 32, 0, "" }, |
| 1783 | { "white-foreground", 0, 0, 0, "off" }, |
| 1784 | { 0,0,0,0,0 } |
| 1785 | }; |
| 1786 | |
| 1787 | /* |
| 1788 | ** COMMAND: settings |
| 1789 | ** COMMAND: unset |
| @@ -1679,10 +1792,14 @@ | |
| 1792 | ** %fossil unset PROPERTY ?-global? |
| 1793 | ** |
| 1794 | ** The "settings" command with no arguments lists all properties and their |
| 1795 | ** values. With just a property name it shows the value of that property. |
| 1796 | ** With a value argument it changes the property for the current repository. |
| 1797 | ** |
| 1798 | ** Settings marked as versionable are overridden by the contents of the |
| 1799 | ** file named .fossil-settings/PROPERTY in the checked out files, if that |
| 1800 | ** file exists. |
| 1801 | ** |
| 1802 | ** The "unset" command clears a property setting. |
| 1803 | ** |
| 1804 | ** |
| 1805 | ** auto-captcha If enabled, the Login page provides a button to |
| @@ -1696,20 +1813,25 @@ | |
| 1813 | ** or update and automatically push after commit or |
| 1814 | ** tag or branch creation. If the value is "pullonly" |
| 1815 | ** then only pull operations occur automatically. |
| 1816 | ** Default: on |
| 1817 | ** |
| 1818 | ** binary-glob The VALUE is a comma or newline-separated list of |
| 1819 | ** (versionable) GLOB patterns that should be treated as binary files |
| 1820 | ** for merging purposes. Example: *.xml |
| 1821 | ** |
| 1822 | ** case-sensitive If TRUE, the files whose names differ only in case |
| 1823 | ** care considered distinct. If FALSE files whose names |
| 1824 | ** differ only in case are the same file. Defaults to |
| 1825 | ** TRUE for unix and FALSE for windows and mac. |
| 1826 | ** |
| 1827 | ** clearsign When enabled, fossil will attempt to sign all commits |
| 1828 | ** with gpg. When disabled (the default), commits will |
| 1829 | ** be unsigned. Default: off |
| 1830 | ** |
| 1831 | ** crnl-glob A comma or newline-separated list of GLOB patterns for |
| 1832 | ** (versionable) text files in which it is ok to have CR+NL line endings. |
| 1833 | ** Set to "*" to disable CR+NL checking. |
| 1834 | ** |
| 1835 | ** default-perms Permissions given automatically to new users. For more |
| 1836 | ** information on permissions see Users page in Server |
| 1837 | ** Administration of the HTTP UI. Default: u. |
| @@ -1717,10 +1839,15 @@ | |
| 1839 | ** diff-command External command to run when performing a diff. |
| 1840 | ** If undefined, the internal text diff will be used. |
| 1841 | ** |
| 1842 | ** dont-push Prevent this repository from pushing from client to |
| 1843 | ** server. Useful when setting up a private branch. |
| 1844 | ** |
| 1845 | ** empty-dirs A comma or newline-separated list of pathnames. On |
| 1846 | ** (versionable) update and checkout commands, if no file or directory |
| 1847 | ** exists with that name, an empty directory will be |
| 1848 | ** created. |
| 1849 | ** |
| 1850 | ** editor Text editor command used for check-in comments. |
| 1851 | ** |
| 1852 | ** gdiff-command External command to run when performing a graphical |
| 1853 | ** diff. If undefined, text diff will be used. |
| @@ -1735,23 +1862,23 @@ | |
| 1862 | ** and "ui" commands. Default: 8080 |
| 1863 | ** |
| 1864 | ** https-login Send login creditials using HTTPS instead of HTTP |
| 1865 | ** even if the login page request came via HTTP. |
| 1866 | ** |
| 1867 | ** ignore-glob The VALUE is a comma or newline-separated list of GLOB |
| 1868 | ** (versionable) patterns specifying files that the "extra" command will |
| 1869 | ** ignore. Example: *.o,*.obj,*.exe |
| 1870 | ** |
| 1871 | ** localauth If enabled, require that HTTP connections from |
| 1872 | ** 127.0.0.1 be authenticated by password. If |
| 1873 | ** false, all HTTP requests from localhost have |
| 1874 | ** unrestricted access to the repository. |
| 1875 | ** |
| 1876 | ** main-branch The primary branch for the project. Default: trunk |
| 1877 | ** |
| 1878 | ** manifest If enabled, automatically create files "manifest" and |
| 1879 | ** (versionable) "manifest.uuid" in every checkout. The SQLite and |
| 1880 | ** Fossil repositories both require this. Default: off. |
| 1881 | ** |
| 1882 | ** max-upload A limit on the size of uplink HTTP requests. The |
| 1883 | ** default is 250000 bytes. |
| 1884 | ** |
| @@ -1763,10 +1890,13 @@ | |
| 1890 | ** |
| 1891 | ** proxy URL of the HTTP proxy. If undefined or "off" then |
| 1892 | ** the "http_proxy" environment variable is consulted. |
| 1893 | ** If the http_proxy environment variable is undefined |
| 1894 | ** then a direct HTTP connection is used. |
| 1895 | ** |
| 1896 | ** relative-paths When showing changes and extras, report paths relative |
| 1897 | ** to the current working directory. Default: "on" |
| 1898 | ** |
| 1899 | ** repo-cksum Compute checksums over all files in each checkout |
| 1900 | ** as a double-check of correctness. Defaults to "on". |
| 1901 | ** Disable on large repositories for a performance |
| 1902 | ** improvement. |
| @@ -1773,10 +1903,28 @@ | |
| 1903 | ** |
| 1904 | ** self-register Allow users to register themselves through the HTTP UI. |
| 1905 | ** This is useful if you want to see other names than |
| 1906 | ** "Anonymous" in e.g. ticketing system. On the other hand |
| 1907 | ** users can not be deleted. Default: off. |
| 1908 | ** |
| 1909 | ** ssl-ca-location The full pathname to a file containing PEM encoded |
| 1910 | ** CA root certificates, or a directory of certificates |
| 1911 | ** with filenames formed from the certificate hashes as |
| 1912 | ** required by OpenSSL. |
| 1913 | ** If set, this will override the OS default list of |
| 1914 | ** OpenSSL CAs. If unset, the default list will be used. |
| 1915 | ** Some platforms may add additional certificates. |
| 1916 | ** Check your platform behaviour is as required if the |
| 1917 | ** exact contents of the CA root is critical for your |
| 1918 | ** application. |
| 1919 | ** |
| 1920 | ** ssl-identity The full pathname to a file containing a certificate |
| 1921 | ** and private key in PEM format. Create by concatenating |
| 1922 | ** the certificate and private key files. |
| 1923 | ** This identity will be presented to SSL servers to |
| 1924 | ** authenticate this client, in addition to the normal |
| 1925 | ** password authentication. |
| 1926 | ** |
| 1927 | ** ssh-command Command used to talk to a remote machine with |
| 1928 | ** the "ssh://" protocol. |
| 1929 | ** |
| 1930 | ** web-browser A shell command used to launch your preferred |
| @@ -1797,12 +1945,13 @@ | |
| 1945 | } |
| 1946 | if( unsetFlag && g.argc!=3 ){ |
| 1947 | usage("PROPERTY ?-global?"); |
| 1948 | } |
| 1949 | if( g.argc==2 ){ |
| 1950 | int openLocal = db_open_local(); |
| 1951 | for(i=0; ctrlSettings[i].name; i++){ |
| 1952 | print_setting(&ctrlSettings[i], openLocal); |
| 1953 | } |
| 1954 | }else if( g.argc==3 || g.argc==4 ){ |
| 1955 | const char *zName = g.argv[2]; |
| 1956 | int isManifest; |
| 1957 | int n = strlen(zName); |
| @@ -1820,13 +1969,13 @@ | |
| 1969 | db_unset(ctrlSettings[i].name, globalFlag); |
| 1970 | }else if( g.argc==4 ){ |
| 1971 | db_set(ctrlSettings[i].name, g.argv[3], globalFlag); |
| 1972 | }else{ |
| 1973 | isManifest = 0; |
| 1974 | print_setting(&ctrlSettings[i], db_open_local()); |
| 1975 | } |
| 1976 | if( isManifest && g.localOpen ){ |
| 1977 | manifest_to_disk(db_lget_int("checkout", 0)); |
| 1978 | } |
| 1979 | }else{ |
| 1980 | usage("?PROPERTY? ?VALUE?"); |
| 1981 | } |
| 1982 |
+2
-2
| --- src/descendants.c | ||
| +++ src/descendants.c | ||
| @@ -287,11 +287,11 @@ | ||
| 287 | 287 | "%s" |
| 288 | 288 | " AND event.objid IN (SELECT rid FROM leaves)" |
| 289 | 289 | " ORDER BY event.mtime DESC", |
| 290 | 290 | timeline_query_for_tty() |
| 291 | 291 | ); |
| 292 | - print_timeline(&q, 20); | |
| 292 | + print_timeline(&q, 20, 0); | |
| 293 | 293 | db_finalize(&q); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | /* |
| 297 | 297 | ** COMMAND: leaves |
| @@ -322,11 +322,11 @@ | ||
| 322 | 322 | }else if( !showAll ){ |
| 323 | 323 | blob_appendf(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid")); |
| 324 | 324 | } |
| 325 | 325 | db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_str(&sql)); |
| 326 | 326 | blob_reset(&sql); |
| 327 | - print_timeline(&q, 2000); | |
| 327 | + print_timeline(&q, 2000, 0); | |
| 328 | 328 | db_finalize(&q); |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /* |
| 332 | 332 | ** WEBPAGE: leaves |
| 333 | 333 |
| --- src/descendants.c | |
| +++ src/descendants.c | |
| @@ -287,11 +287,11 @@ | |
| 287 | "%s" |
| 288 | " AND event.objid IN (SELECT rid FROM leaves)" |
| 289 | " ORDER BY event.mtime DESC", |
| 290 | timeline_query_for_tty() |
| 291 | ); |
| 292 | print_timeline(&q, 20); |
| 293 | db_finalize(&q); |
| 294 | } |
| 295 | |
| 296 | /* |
| 297 | ** COMMAND: leaves |
| @@ -322,11 +322,11 @@ | |
| 322 | }else if( !showAll ){ |
| 323 | blob_appendf(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid")); |
| 324 | } |
| 325 | db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_str(&sql)); |
| 326 | blob_reset(&sql); |
| 327 | print_timeline(&q, 2000); |
| 328 | db_finalize(&q); |
| 329 | } |
| 330 | |
| 331 | /* |
| 332 | ** WEBPAGE: leaves |
| 333 |
| --- src/descendants.c | |
| +++ src/descendants.c | |
| @@ -287,11 +287,11 @@ | |
| 287 | "%s" |
| 288 | " AND event.objid IN (SELECT rid FROM leaves)" |
| 289 | " ORDER BY event.mtime DESC", |
| 290 | timeline_query_for_tty() |
| 291 | ); |
| 292 | print_timeline(&q, 20, 0); |
| 293 | db_finalize(&q); |
| 294 | } |
| 295 | |
| 296 | /* |
| 297 | ** COMMAND: leaves |
| @@ -322,11 +322,11 @@ | |
| 322 | }else if( !showAll ){ |
| 323 | blob_appendf(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid")); |
| 324 | } |
| 325 | db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_str(&sql)); |
| 326 | blob_reset(&sql); |
| 327 | print_timeline(&q, 2000, 0); |
| 328 | db_finalize(&q); |
| 329 | } |
| 330 | |
| 331 | /* |
| 332 | ** WEBPAGE: leaves |
| 333 |
+22
-16
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -175,23 +175,24 @@ | ||
| 175 | 175 | blob_reset(&cmd); |
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /* |
| 180 | -** Do a diff against a single file named in g.argv[2] from version zFrom | |
| 180 | +** Do a diff against a single file named in zFileTreeName from version zFrom | |
| 181 | 181 | ** against the same file on disk. |
| 182 | 182 | */ |
| 183 | 183 | static void diff_one_against_disk( |
| 184 | 184 | const char *zFrom, /* Name of file */ |
| 185 | 185 | const char *zDiffCmd, /* Use this "diff" command */ |
| 186 | - int ignoreEolWs /* Ignore whitespace changes at end of lines */ | |
| 186 | + int ignoreEolWs, /* Ignore whitespace changes at end of lines */ | |
| 187 | + const char *zFileTreeName | |
| 187 | 188 | ){ |
| 188 | 189 | Blob fname; |
| 189 | 190 | Blob content; |
| 190 | - file_tree_name(g.argv[2], &fname, 1); | |
| 191 | + file_tree_name(zFileTreeName, &fname, 1); | |
| 191 | 192 | historical_version_of_file(zFrom, blob_str(&fname), &content, 0, 0); |
| 192 | - diff_file(&content, g.argv[2], g.argv[2], zDiffCmd, ignoreEolWs); | |
| 193 | + diff_file(&content, zFileTreeName, zFileTreeName, zDiffCmd, ignoreEolWs); | |
| 193 | 194 | blob_reset(&content); |
| 194 | 195 | blob_reset(&fname); |
| 195 | 196 | } |
| 196 | 197 | |
| 197 | 198 | /* |
| @@ -295,22 +296,22 @@ | ||
| 295 | 296 | } |
| 296 | 297 | |
| 297 | 298 | /* |
| 298 | 299 | ** Output the differences between two versions of a single file. |
| 299 | 300 | ** zFrom and zTo are the check-ins containing the two file versions. |
| 300 | -** The filename is contained in g.argv[2]. | |
| 301 | 301 | */ |
| 302 | 302 | static void diff_one_two_versions( |
| 303 | 303 | const char *zFrom, |
| 304 | 304 | const char *zTo, |
| 305 | 305 | const char *zDiffCmd, |
| 306 | - int ignoreEolWs | |
| 306 | + int ignoreEolWs, | |
| 307 | + const char *zFileTreeName | |
| 307 | 308 | ){ |
| 308 | 309 | char *zName; |
| 309 | 310 | Blob fname; |
| 310 | 311 | Blob v1, v2; |
| 311 | - file_tree_name(g.argv[2], &fname, 1); | |
| 312 | + file_tree_name(zFileTreeName, &fname, 1); | |
| 312 | 313 | zName = blob_str(&fname); |
| 313 | 314 | historical_version_of_file(zFrom, zName, &v1, 0, 0); |
| 314 | 315 | historical_version_of_file(zTo, zName, &v2, 0, 0); |
| 315 | 316 | diff_file_mem(&v1, &v2, zName, zDiffCmd, ignoreEolWs); |
| 316 | 317 | blob_reset(&v1); |
| @@ -408,16 +409,16 @@ | ||
| 408 | 409 | |
| 409 | 410 | /* |
| 410 | 411 | ** COMMAND: diff |
| 411 | 412 | ** COMMAND: gdiff |
| 412 | 413 | ** |
| 413 | -** Usage: %fossil diff|gdiff ?options? ?FILE? | |
| 414 | +** Usage: %fossil diff|gdiff ?options? ?FILE1? ?FILE2 ...? | |
| 414 | 415 | ** |
| 415 | -** Show the difference between the current version of FILE (as it | |
| 416 | -** exists on disk) and that same file as it was checked out. Or | |
| 417 | -** if the FILE argument is omitted, show the unsaved changed currently | |
| 418 | -** in the working check-out. | |
| 416 | +** Show the difference between the current version of each of the FILEs | |
| 417 | +** specified (as they exist on disk) and that same file as it was checked | |
| 418 | +** out. Or if the FILE arguments are omitted, show the unsaved changed | |
| 419 | +** currently in the working check-out. | |
| 419 | 420 | ** |
| 420 | 421 | ** If the "--from VERSION" or "-r VERSION" option is used it specifies |
| 421 | 422 | ** the source check-in for the diff operation. If not specified, the |
| 422 | 423 | ** source check-in is the base check-in for the current check-out. |
| 423 | 424 | ** |
| @@ -440,10 +441,11 @@ | ||
| 440 | 441 | int hasNFlag; /* True if -N or --new-file flag is used */ |
| 441 | 442 | const char *zFrom; /* Source version number */ |
| 442 | 443 | const char *zTo; /* Target version number */ |
| 443 | 444 | const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */ |
| 444 | 445 | int diffFlags = 0; /* Flags to control the DIFF */ |
| 446 | + int f; | |
| 445 | 447 | |
| 446 | 448 | isGDiff = g.argv[1][0]=='g'; |
| 447 | 449 | isInternDiff = find_option("internal","i",0)!=0; |
| 448 | 450 | zFrom = find_option("from", "r", 1); |
| 449 | 451 | zTo = find_option("to", 0, 1); |
| @@ -455,12 +457,14 @@ | ||
| 455 | 457 | db_must_be_within_tree(); |
| 456 | 458 | verify_all_options(); |
| 457 | 459 | if( !isInternDiff ){ |
| 458 | 460 | zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0); |
| 459 | 461 | } |
| 460 | - if( g.argc==3 ){ | |
| 461 | - diff_one_against_disk(zFrom, zDiffCmd, 0); | |
| 462 | + if( g.argc>=3 ){ | |
| 463 | + for(f=2; f<g.argc; ++f){ | |
| 464 | + diff_one_against_disk(zFrom, zDiffCmd, 0, g.argv[f]); | |
| 465 | + } | |
| 462 | 466 | }else{ |
| 463 | 467 | diff_all_against_disk(zFrom, zDiffCmd, diffFlags); |
| 464 | 468 | } |
| 465 | 469 | }else if( zFrom==0 ){ |
| 466 | 470 | fossil_fatal("must use --from if --to is present"); |
| @@ -468,12 +472,14 @@ | ||
| 468 | 472 | db_find_and_open_repository(0, 0); |
| 469 | 473 | verify_all_options(); |
| 470 | 474 | if( !isInternDiff ){ |
| 471 | 475 | zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0); |
| 472 | 476 | } |
| 473 | - if( g.argc==3 ){ | |
| 474 | - diff_one_two_versions(zFrom, zTo, zDiffCmd, 0); | |
| 477 | + if( g.argc>=3 ){ | |
| 478 | + for(f=2; f<g.argc; ++f){ | |
| 479 | + diff_one_two_versions(zFrom, zTo, zDiffCmd, 0, g.argv[f]); | |
| 480 | + } | |
| 475 | 481 | }else{ |
| 476 | 482 | diff_all_two_versions(zFrom, zTo, zDiffCmd, diffFlags); |
| 477 | 483 | } |
| 478 | 484 | } |
| 479 | 485 | } |
| 480 | 486 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -175,23 +175,24 @@ | |
| 175 | blob_reset(&cmd); |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | /* |
| 180 | ** Do a diff against a single file named in g.argv[2] from version zFrom |
| 181 | ** against the same file on disk. |
| 182 | */ |
| 183 | static void diff_one_against_disk( |
| 184 | const char *zFrom, /* Name of file */ |
| 185 | const char *zDiffCmd, /* Use this "diff" command */ |
| 186 | int ignoreEolWs /* Ignore whitespace changes at end of lines */ |
| 187 | ){ |
| 188 | Blob fname; |
| 189 | Blob content; |
| 190 | file_tree_name(g.argv[2], &fname, 1); |
| 191 | historical_version_of_file(zFrom, blob_str(&fname), &content, 0, 0); |
| 192 | diff_file(&content, g.argv[2], g.argv[2], zDiffCmd, ignoreEolWs); |
| 193 | blob_reset(&content); |
| 194 | blob_reset(&fname); |
| 195 | } |
| 196 | |
| 197 | /* |
| @@ -295,22 +296,22 @@ | |
| 295 | } |
| 296 | |
| 297 | /* |
| 298 | ** Output the differences between two versions of a single file. |
| 299 | ** zFrom and zTo are the check-ins containing the two file versions. |
| 300 | ** The filename is contained in g.argv[2]. |
| 301 | */ |
| 302 | static void diff_one_two_versions( |
| 303 | const char *zFrom, |
| 304 | const char *zTo, |
| 305 | const char *zDiffCmd, |
| 306 | int ignoreEolWs |
| 307 | ){ |
| 308 | char *zName; |
| 309 | Blob fname; |
| 310 | Blob v1, v2; |
| 311 | file_tree_name(g.argv[2], &fname, 1); |
| 312 | zName = blob_str(&fname); |
| 313 | historical_version_of_file(zFrom, zName, &v1, 0, 0); |
| 314 | historical_version_of_file(zTo, zName, &v2, 0, 0); |
| 315 | diff_file_mem(&v1, &v2, zName, zDiffCmd, ignoreEolWs); |
| 316 | blob_reset(&v1); |
| @@ -408,16 +409,16 @@ | |
| 408 | |
| 409 | /* |
| 410 | ** COMMAND: diff |
| 411 | ** COMMAND: gdiff |
| 412 | ** |
| 413 | ** Usage: %fossil diff|gdiff ?options? ?FILE? |
| 414 | ** |
| 415 | ** Show the difference between the current version of FILE (as it |
| 416 | ** exists on disk) and that same file as it was checked out. Or |
| 417 | ** if the FILE argument is omitted, show the unsaved changed currently |
| 418 | ** in the working check-out. |
| 419 | ** |
| 420 | ** If the "--from VERSION" or "-r VERSION" option is used it specifies |
| 421 | ** the source check-in for the diff operation. If not specified, the |
| 422 | ** source check-in is the base check-in for the current check-out. |
| 423 | ** |
| @@ -440,10 +441,11 @@ | |
| 440 | int hasNFlag; /* True if -N or --new-file flag is used */ |
| 441 | const char *zFrom; /* Source version number */ |
| 442 | const char *zTo; /* Target version number */ |
| 443 | const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */ |
| 444 | int diffFlags = 0; /* Flags to control the DIFF */ |
| 445 | |
| 446 | isGDiff = g.argv[1][0]=='g'; |
| 447 | isInternDiff = find_option("internal","i",0)!=0; |
| 448 | zFrom = find_option("from", "r", 1); |
| 449 | zTo = find_option("to", 0, 1); |
| @@ -455,12 +457,14 @@ | |
| 455 | db_must_be_within_tree(); |
| 456 | verify_all_options(); |
| 457 | if( !isInternDiff ){ |
| 458 | zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0); |
| 459 | } |
| 460 | if( g.argc==3 ){ |
| 461 | diff_one_against_disk(zFrom, zDiffCmd, 0); |
| 462 | }else{ |
| 463 | diff_all_against_disk(zFrom, zDiffCmd, diffFlags); |
| 464 | } |
| 465 | }else if( zFrom==0 ){ |
| 466 | fossil_fatal("must use --from if --to is present"); |
| @@ -468,12 +472,14 @@ | |
| 468 | db_find_and_open_repository(0, 0); |
| 469 | verify_all_options(); |
| 470 | if( !isInternDiff ){ |
| 471 | zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0); |
| 472 | } |
| 473 | if( g.argc==3 ){ |
| 474 | diff_one_two_versions(zFrom, zTo, zDiffCmd, 0); |
| 475 | }else{ |
| 476 | diff_all_two_versions(zFrom, zTo, zDiffCmd, diffFlags); |
| 477 | } |
| 478 | } |
| 479 | } |
| 480 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -175,23 +175,24 @@ | |
| 175 | blob_reset(&cmd); |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | /* |
| 180 | ** Do a diff against a single file named in zFileTreeName from version zFrom |
| 181 | ** against the same file on disk. |
| 182 | */ |
| 183 | static void diff_one_against_disk( |
| 184 | const char *zFrom, /* Name of file */ |
| 185 | const char *zDiffCmd, /* Use this "diff" command */ |
| 186 | int ignoreEolWs, /* Ignore whitespace changes at end of lines */ |
| 187 | const char *zFileTreeName |
| 188 | ){ |
| 189 | Blob fname; |
| 190 | Blob content; |
| 191 | file_tree_name(zFileTreeName, &fname, 1); |
| 192 | historical_version_of_file(zFrom, blob_str(&fname), &content, 0, 0); |
| 193 | diff_file(&content, zFileTreeName, zFileTreeName, zDiffCmd, ignoreEolWs); |
| 194 | blob_reset(&content); |
| 195 | blob_reset(&fname); |
| 196 | } |
| 197 | |
| 198 | /* |
| @@ -295,22 +296,22 @@ | |
| 296 | } |
| 297 | |
| 298 | /* |
| 299 | ** Output the differences between two versions of a single file. |
| 300 | ** zFrom and zTo are the check-ins containing the two file versions. |
| 301 | */ |
| 302 | static void diff_one_two_versions( |
| 303 | const char *zFrom, |
| 304 | const char *zTo, |
| 305 | const char *zDiffCmd, |
| 306 | int ignoreEolWs, |
| 307 | const char *zFileTreeName |
| 308 | ){ |
| 309 | char *zName; |
| 310 | Blob fname; |
| 311 | Blob v1, v2; |
| 312 | file_tree_name(zFileTreeName, &fname, 1); |
| 313 | zName = blob_str(&fname); |
| 314 | historical_version_of_file(zFrom, zName, &v1, 0, 0); |
| 315 | historical_version_of_file(zTo, zName, &v2, 0, 0); |
| 316 | diff_file_mem(&v1, &v2, zName, zDiffCmd, ignoreEolWs); |
| 317 | blob_reset(&v1); |
| @@ -408,16 +409,16 @@ | |
| 409 | |
| 410 | /* |
| 411 | ** COMMAND: diff |
| 412 | ** COMMAND: gdiff |
| 413 | ** |
| 414 | ** Usage: %fossil diff|gdiff ?options? ?FILE1? ?FILE2 ...? |
| 415 | ** |
| 416 | ** Show the difference between the current version of each of the FILEs |
| 417 | ** specified (as they exist on disk) and that same file as it was checked |
| 418 | ** out. Or if the FILE arguments are omitted, show the unsaved changed |
| 419 | ** currently in the working check-out. |
| 420 | ** |
| 421 | ** If the "--from VERSION" or "-r VERSION" option is used it specifies |
| 422 | ** the source check-in for the diff operation. If not specified, the |
| 423 | ** source check-in is the base check-in for the current check-out. |
| 424 | ** |
| @@ -440,10 +441,11 @@ | |
| 441 | int hasNFlag; /* True if -N or --new-file flag is used */ |
| 442 | const char *zFrom; /* Source version number */ |
| 443 | const char *zTo; /* Target version number */ |
| 444 | const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */ |
| 445 | int diffFlags = 0; /* Flags to control the DIFF */ |
| 446 | int f; |
| 447 | |
| 448 | isGDiff = g.argv[1][0]=='g'; |
| 449 | isInternDiff = find_option("internal","i",0)!=0; |
| 450 | zFrom = find_option("from", "r", 1); |
| 451 | zTo = find_option("to", 0, 1); |
| @@ -455,12 +457,14 @@ | |
| 457 | db_must_be_within_tree(); |
| 458 | verify_all_options(); |
| 459 | if( !isInternDiff ){ |
| 460 | zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0); |
| 461 | } |
| 462 | if( g.argc>=3 ){ |
| 463 | for(f=2; f<g.argc; ++f){ |
| 464 | diff_one_against_disk(zFrom, zDiffCmd, 0, g.argv[f]); |
| 465 | } |
| 466 | }else{ |
| 467 | diff_all_against_disk(zFrom, zDiffCmd, diffFlags); |
| 468 | } |
| 469 | }else if( zFrom==0 ){ |
| 470 | fossil_fatal("must use --from if --to is present"); |
| @@ -468,12 +472,14 @@ | |
| 472 | db_find_and_open_repository(0, 0); |
| 473 | verify_all_options(); |
| 474 | if( !isInternDiff ){ |
| 475 | zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0); |
| 476 | } |
| 477 | if( g.argc>=3 ){ |
| 478 | for(f=2; f<g.argc; ++f){ |
| 479 | diff_one_two_versions(zFrom, zTo, zDiffCmd, 0, g.argv[f]); |
| 480 | } |
| 481 | }else{ |
| 482 | diff_all_two_versions(zFrom, zTo, zDiffCmd, diffFlags); |
| 483 | } |
| 484 | } |
| 485 | } |
| 486 |
+151
-36
| --- src/export.c | ||
| +++ src/export.c | ||
| @@ -78,15 +78,17 @@ | ||
| 78 | 78 | free(zName); |
| 79 | 79 | free(zEmail); |
| 80 | 80 | db_reset(&q); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | +#define BLOBMARK(rid) ((rid) * 2) | |
| 84 | +#define COMMITMARK(rid) ((rid) * 2 + 1) | |
| 83 | 85 | |
| 84 | 86 | /* |
| 85 | 87 | ** COMMAND: export |
| 86 | 88 | ** |
| 87 | -** Usage: %fossil export --git ?REPOSITORY? | |
| 89 | +** Usage: %fossil export --git ?options? ?REPOSITORY? | |
| 88 | 90 | ** |
| 89 | 91 | ** Write an export of all check-ins to standard output. The export is |
| 90 | 92 | ** written in the git-fast-export file format assuming the --git option is |
| 91 | 93 | ** provided. The git-fast-export format is currently the only VCS |
| 92 | 94 | ** interchange format supported, though other formats may be added in |
| @@ -95,98 +97,190 @@ | ||
| 95 | 97 | ** Run this command within a checkout. Or use the -R or --repository |
| 96 | 98 | ** option to specify a Fossil repository to be exported. |
| 97 | 99 | ** |
| 98 | 100 | ** Only check-ins are exported using --git. Git does not support tickets |
| 99 | 101 | ** or wiki or events or attachments, so none of those are exported. |
| 102 | +** | |
| 103 | +** If the "--import-marks FILE" option is used, it contains a list of | |
| 104 | +** rids to skip. | |
| 105 | +** | |
| 106 | +** If the "--export-marks FILE" option is used, the rid of all commits and | |
| 107 | +** blobs written on exit for use with "--import-marks" on the next run. | |
| 100 | 108 | */ |
| 101 | 109 | void export_cmd(void){ |
| 102 | - Stmt q; | |
| 110 | + Stmt q, q2, q3; | |
| 103 | 111 | int i; |
| 104 | - int firstCkin; /* Integer offset to check-in marks */ | |
| 105 | 112 | Bag blobs, vers; |
| 113 | + const char *markfile_in; | |
| 114 | + const char *markfile_out; | |
| 115 | + | |
| 106 | 116 | bag_init(&blobs); |
| 107 | 117 | bag_init(&vers); |
| 108 | 118 | |
| 109 | 119 | find_option("git", 0, 0); /* Ignore the --git option for now */ |
| 120 | + markfile_in = find_option("import-marks", 0, 1); | |
| 121 | + markfile_out = find_option("export-marks", 0, 1); | |
| 122 | + | |
| 110 | 123 | db_find_and_open_repository(0, 2); |
| 111 | 124 | verify_all_options(); |
| 112 | 125 | if( g.argc!=2 && g.argc!=3 ){ usage("--git ?REPOSITORY?"); } |
| 126 | + | |
| 127 | + db_multi_exec("CREATE TEMPORARY TABLE oldblob(rid INTEGER PRIMARY KEY)"); | |
| 128 | + db_multi_exec("CREATE TEMPORARY TABLE oldcommit(rid INTEGER PRIMARY KEY)"); | |
| 129 | + if( markfile_in!=0 ){ | |
| 130 | + Stmt qb,qc; | |
| 131 | + char line[100]; | |
| 132 | + FILE *f; | |
| 133 | + | |
| 134 | + f = fopen(markfile_in, "r"); | |
| 135 | + if( f==0 ){ | |
| 136 | + fossil_panic("cannot open %s for reading", markfile_in); | |
| 137 | + } | |
| 138 | + db_prepare(&qb, "INSERT OR IGNORE INTO oldblob VALUES (:rid)"); | |
| 139 | + db_prepare(&qc, "INSERT OR IGNORE INTO oldcommit VALUES (:rid)"); | |
| 140 | + while( fgets(line, sizeof(line), f)!=0 ){ | |
| 141 | + if( *line == 'b' ){ | |
| 142 | + db_bind_text(&qb, ":rid", line + 1); | |
| 143 | + db_step(&qb); | |
| 144 | + db_reset(&qb); | |
| 145 | + bag_insert(&blobs, atoi(line + 1)); | |
| 146 | + }else if( *line == 'c' ){ | |
| 147 | + db_bind_text(&qc, ":rid", line + 1); | |
| 148 | + db_step(&qc); | |
| 149 | + db_reset(&qc); | |
| 150 | + bag_insert(&vers, atoi(line + 1)); | |
| 151 | + }else{ | |
| 152 | + fossil_panic("bad input from %s: %s", markfile_in, line); | |
| 153 | + } | |
| 154 | + } | |
| 155 | + db_finalize(&qb); | |
| 156 | + db_finalize(&qc); | |
| 157 | + fclose(f); | |
| 158 | + } | |
| 113 | 159 | |
| 114 | 160 | /* Step 1: Generate "blob" records for every artifact that is part |
| 115 | 161 | ** of a check-in |
| 116 | 162 | */ |
| 117 | 163 | fossil_binary_mode(stdout); |
| 118 | - db_prepare(&q, "SELECT DISTINCT fid FROM mlink WHERE fid>0"); | |
| 164 | + db_multi_exec("CREATE TEMPORARY TABLE newblob(rid INTEGER KEY, srcid INTEGER)"); | |
| 165 | + db_multi_exec("CREATE INDEX newblob_src ON newblob(srcid)"); | |
| 166 | + db_multi_exec( | |
| 167 | + "INSERT INTO newblob" | |
| 168 | + " SELECT DISTINCT fid," | |
| 169 | + " CASE WHEN EXISTS(SELECT 1 FROM delta WHERE rid=fid AND NOT EXISTS(SELECT 1 FROM oldblob WHERE srcid=fid))" | |
| 170 | + " THEN (SELECT srcid FROM delta WHERE rid=fid)" | |
| 171 | + " ELSE 0" | |
| 172 | + " END" | |
| 173 | + " FROM mlink" | |
| 174 | + " WHERE fid>0 AND NOT EXISTS(SELECT 1 FROM oldblob WHERE rid=fid)"); | |
| 175 | + db_prepare(&q, | |
| 176 | + "SELECT DISTINCT fid FROM mlink" | |
| 177 | + " WHERE fid>0 AND NOT EXISTS(SELECT 1 FROM oldblob WHERE rid=fid)"); | |
| 178 | + db_prepare(&q2, "INSERT INTO oldblob VALUES (:rid)"); | |
| 179 | + db_prepare(&q3, "SELECT rid FROM newblob WHERE srcid= (:srcid)"); | |
| 119 | 180 | while( db_step(&q)==SQLITE_ROW ){ |
| 120 | 181 | int rid = db_column_int(&q, 0); |
| 121 | 182 | Blob content; |
| 122 | - content_get(rid, &content); | |
| 123 | - printf("blob\nmark :%d\ndata %d\n", rid, blob_size(&content)); | |
| 124 | - bag_insert(&blobs, rid); | |
| 125 | - fwrite(blob_buffer(&content), 1, blob_size(&content), stdout); | |
| 126 | - printf("\n"); | |
| 127 | - blob_reset(&content); | |
| 183 | + | |
| 184 | + while( !bag_find(&blobs, rid) ){ | |
| 185 | + content_get(rid, &content); | |
| 186 | + db_bind_int(&q2, ":rid", rid); | |
| 187 | + db_step(&q2); | |
| 188 | + db_reset(&q2); | |
| 189 | + printf("blob\nmark :%d\ndata %d\n", BLOBMARK(rid), blob_size(&content)); | |
| 190 | + bag_insert(&blobs, rid); | |
| 191 | + fwrite(blob_buffer(&content), 1, blob_size(&content), stdout); | |
| 192 | + printf("\n"); | |
| 193 | + blob_reset(&content); | |
| 194 | + | |
| 195 | + db_bind_int(&q3, ":srcid", rid); | |
| 196 | + if( db_step(&q3) != SQLITE_ROW ){ | |
| 197 | + db_reset(&q3); | |
| 198 | + break; | |
| 199 | + } | |
| 200 | + rid = db_column_int(&q3, 0); | |
| 201 | + db_reset(&q3); | |
| 202 | + } | |
| 128 | 203 | } |
| 129 | 204 | db_finalize(&q); |
| 205 | + db_finalize(&q2); | |
| 206 | + db_finalize(&q3); | |
| 130 | 207 | |
| 131 | 208 | /* Output the commit records. |
| 132 | 209 | */ |
| 133 | - firstCkin = db_int(0, "SELECT max(rid) FROM blob")+1; | |
| 134 | 210 | db_prepare(&q, |
| 135 | 211 | "SELECT strftime('%%s',mtime), objid, coalesce(comment,ecomment)," |
| 136 | 212 | " coalesce(user,euser)," |
| 137 | 213 | " (SELECT value FROM tagxref WHERE rid=objid AND tagid=%d)" |
| 138 | 214 | " FROM event" |
| 139 | - " WHERE type='ci'" | |
| 215 | + " WHERE type='ci' AND NOT EXISTS (SELECT 1 FROM oldcommit WHERE objid=rid)" | |
| 140 | 216 | " ORDER BY mtime ASC", |
| 141 | 217 | TAG_BRANCH |
| 142 | 218 | ); |
| 219 | + db_prepare(&q2, "INSERT INTO oldcommit VALUES (:rid)"); | |
| 143 | 220 | while( db_step(&q)==SQLITE_ROW ){ |
| 221 | + Stmt q4; | |
| 144 | 222 | const char *zSecondsSince1970 = db_column_text(&q, 0); |
| 145 | 223 | int ckinId = db_column_int(&q, 1); |
| 146 | 224 | const char *zComment = db_column_text(&q, 2); |
| 147 | 225 | const char *zUser = db_column_text(&q, 3); |
| 148 | 226 | const char *zBranch = db_column_text(&q, 4); |
| 149 | 227 | char *zBr; |
| 150 | - Manifest *p; | |
| 151 | - ManifestFile *pFile; | |
| 152 | - const char *zFromType; | |
| 153 | 228 | |
| 154 | 229 | bag_insert(&vers, ckinId); |
| 230 | + db_bind_int(&q2, ":rid", ckinId); | |
| 231 | + db_step(&q2); | |
| 232 | + db_reset(&q2); | |
| 155 | 233 | if( zBranch==0 ) zBranch = "trunk"; |
| 156 | 234 | zBr = mprintf("%s", zBranch); |
| 157 | 235 | for(i=0; zBr[i]; i++){ |
| 158 | 236 | if( !fossil_isalnum(zBr[i]) ) zBr[i] = '_'; |
| 159 | 237 | } |
| 160 | - printf("commit refs/heads/%s\nmark :%d\n", zBr, ckinId+firstCkin); | |
| 238 | + printf("commit refs/heads/%s\nmark :%d\n", zBr, COMMITMARK(ckinId)); | |
| 161 | 239 | free(zBr); |
| 162 | 240 | printf("committer"); |
| 163 | 241 | print_person(zUser); |
| 164 | 242 | printf(" %s +0000\n", zSecondsSince1970); |
| 165 | 243 | if( zComment==0 ) zComment = "null comment"; |
| 166 | 244 | printf("data %d\n%s\n", (int)strlen(zComment), zComment); |
| 167 | - p = manifest_get(ckinId, CFTYPE_ANY); | |
| 168 | - zFromType = "from"; | |
| 169 | - for(i=0; i<p->nParent; i++){ | |
| 170 | - int pid = fast_uuid_to_rid(p->azParent[i]); | |
| 171 | - if( pid==0 || !bag_find(&vers, pid) ) continue; | |
| 172 | - printf("%s :%d\n", zFromType, fast_uuid_to_rid(p->azParent[i])+firstCkin); | |
| 173 | - zFromType = "merge"; | |
| 174 | - } | |
| 175 | - printf("deleteall\n"); | |
| 176 | - manifest_file_rewind(p); | |
| 177 | - while( (pFile=manifest_file_next(p, 0))!=0 ){ | |
| 178 | - int fid = fast_uuid_to_rid(pFile->zUuid); | |
| 179 | - const char *zPerm = "100644"; | |
| 180 | - if( fid==0 ) continue; | |
| 181 | - if( pFile->zPerm && strstr(pFile->zPerm,"x") ) zPerm = "100755"; | |
| 182 | - if( !bag_find(&blobs, fid) ) continue; | |
| 183 | - printf("M %s :%d %s\n", zPerm, fid, pFile->zName); | |
| 184 | - } | |
| 185 | - manifest_cache_insert(p); | |
| 245 | + db_prepare(&q3, "SELECT pid FROM plink WHERE cid=%d AND isprim", ckinId); | |
| 246 | + if( db_step(&q3) == SQLITE_ROW ){ | |
| 247 | + printf("from :%d\n", COMMITMARK(db_column_int(&q3, 0))); | |
| 248 | + db_prepare(&q4, | |
| 249 | + "SELECT pid FROM plink" | |
| 250 | + " WHERE cid=%d AND NOT isprim" | |
| 251 | + " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)" | |
| 252 | + " ORDER BY pid", | |
| 253 | + ckinId); | |
| 254 | + while( db_step(&q4)==SQLITE_ROW ){ | |
| 255 | + printf("merge :%d\n", COMMITMARK(db_column_int(&q4,0))); | |
| 256 | + } | |
| 257 | + db_finalize(&q4); | |
| 258 | + }else{ | |
| 259 | + printf("deleteall\n"); | |
| 260 | + } | |
| 261 | + | |
| 262 | + db_prepare(&q4, | |
| 263 | + "SELECT filename.name, mlink.fid, mlink.mperm FROM mlink" | |
| 264 | + " JOIN filename ON filename.fnid=mlink.fnid" | |
| 265 | + " WHERE mlink.mid=%d", | |
| 266 | + ckinId | |
| 267 | + ); | |
| 268 | + while( db_step(&q4)==SQLITE_ROW ){ | |
| 269 | + const char *zName = db_column_text(&q4,0); | |
| 270 | + int zNew = db_column_int(&q4,1); | |
| 271 | + int mPerm = db_column_int(&q4,2); | |
| 272 | + if( zNew==0) | |
| 273 | + printf("D %s\n", zName); | |
| 274 | + else if( bag_find(&blobs, zNew) ) | |
| 275 | + printf("M %s :%d %s\n", mPerm ? "100755" : "100644", BLOBMARK(zNew), zName); | |
| 276 | + } | |
| 277 | + db_finalize(&q4); | |
| 278 | + db_finalize(&q3); | |
| 186 | 279 | printf("\n"); |
| 187 | 280 | } |
| 281 | + db_finalize(&q2); | |
| 188 | 282 | db_finalize(&q); |
| 189 | 283 | bag_clear(&blobs); |
| 190 | 284 | manifest_cache_clear(); |
| 191 | 285 | |
| 192 | 286 | |
| @@ -207,13 +301,34 @@ | ||
| 207 | 301 | zEncoded = mprintf("%s", zTagname); |
| 208 | 302 | for(i=0; zEncoded[i]; i++){ |
| 209 | 303 | if( !fossil_isalnum(zEncoded[i]) ) zEncoded[i] = '_'; |
| 210 | 304 | } |
| 211 | 305 | printf("tag %s\n", zEncoded); |
| 212 | - printf("from :%d\n", rid+firstCkin); | |
| 306 | + printf("from :%d\n", COMMITMARK(rid)); | |
| 213 | 307 | printf("tagger <tagger> %s +0000\n", zSecSince1970); |
| 214 | 308 | printf("data 0\n"); |
| 215 | 309 | fossil_free(zEncoded); |
| 216 | 310 | } |
| 217 | 311 | db_finalize(&q); |
| 218 | 312 | bag_clear(&vers); |
| 313 | + | |
| 314 | + if( markfile_out!=0 ){ | |
| 315 | + FILE *f; | |
| 316 | + f = fopen(markfile_out, "w"); | |
| 317 | + if( f == 0 ){ | |
| 318 | + fossil_panic("cannot open %s for writing", markfile_out); | |
| 319 | + } | |
| 320 | + db_prepare(&q, "SELECT rid FROM oldblob"); | |
| 321 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 322 | + fprintf(f, "b%d\n", db_column_int(&q, 0)); | |
| 323 | + } | |
| 324 | + db_finalize(&q); | |
| 325 | + db_prepare(&q, "SELECT rid FROM oldcommit"); | |
| 326 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 327 | + fprintf(f, "c%d\n", db_column_int(&q, 0)); | |
| 328 | + } | |
| 329 | + db_finalize(&q); | |
| 330 | + if( ferror(f)!=0 || fclose(f)!=0 ) { | |
| 331 | + fossil_panic("error while writing %s", markfile_out); | |
| 332 | + } | |
| 333 | + } | |
| 219 | 334 | } |
| 220 | 335 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -78,15 +78,17 @@ | |
| 78 | free(zName); |
| 79 | free(zEmail); |
| 80 | db_reset(&q); |
| 81 | } |
| 82 | |
| 83 | |
| 84 | /* |
| 85 | ** COMMAND: export |
| 86 | ** |
| 87 | ** Usage: %fossil export --git ?REPOSITORY? |
| 88 | ** |
| 89 | ** Write an export of all check-ins to standard output. The export is |
| 90 | ** written in the git-fast-export file format assuming the --git option is |
| 91 | ** provided. The git-fast-export format is currently the only VCS |
| 92 | ** interchange format supported, though other formats may be added in |
| @@ -95,98 +97,190 @@ | |
| 95 | ** Run this command within a checkout. Or use the -R or --repository |
| 96 | ** option to specify a Fossil repository to be exported. |
| 97 | ** |
| 98 | ** Only check-ins are exported using --git. Git does not support tickets |
| 99 | ** or wiki or events or attachments, so none of those are exported. |
| 100 | */ |
| 101 | void export_cmd(void){ |
| 102 | Stmt q; |
| 103 | int i; |
| 104 | int firstCkin; /* Integer offset to check-in marks */ |
| 105 | Bag blobs, vers; |
| 106 | bag_init(&blobs); |
| 107 | bag_init(&vers); |
| 108 | |
| 109 | find_option("git", 0, 0); /* Ignore the --git option for now */ |
| 110 | db_find_and_open_repository(0, 2); |
| 111 | verify_all_options(); |
| 112 | if( g.argc!=2 && g.argc!=3 ){ usage("--git ?REPOSITORY?"); } |
| 113 | |
| 114 | /* Step 1: Generate "blob" records for every artifact that is part |
| 115 | ** of a check-in |
| 116 | */ |
| 117 | fossil_binary_mode(stdout); |
| 118 | db_prepare(&q, "SELECT DISTINCT fid FROM mlink WHERE fid>0"); |
| 119 | while( db_step(&q)==SQLITE_ROW ){ |
| 120 | int rid = db_column_int(&q, 0); |
| 121 | Blob content; |
| 122 | content_get(rid, &content); |
| 123 | printf("blob\nmark :%d\ndata %d\n", rid, blob_size(&content)); |
| 124 | bag_insert(&blobs, rid); |
| 125 | fwrite(blob_buffer(&content), 1, blob_size(&content), stdout); |
| 126 | printf("\n"); |
| 127 | blob_reset(&content); |
| 128 | } |
| 129 | db_finalize(&q); |
| 130 | |
| 131 | /* Output the commit records. |
| 132 | */ |
| 133 | firstCkin = db_int(0, "SELECT max(rid) FROM blob")+1; |
| 134 | db_prepare(&q, |
| 135 | "SELECT strftime('%%s',mtime), objid, coalesce(comment,ecomment)," |
| 136 | " coalesce(user,euser)," |
| 137 | " (SELECT value FROM tagxref WHERE rid=objid AND tagid=%d)" |
| 138 | " FROM event" |
| 139 | " WHERE type='ci'" |
| 140 | " ORDER BY mtime ASC", |
| 141 | TAG_BRANCH |
| 142 | ); |
| 143 | while( db_step(&q)==SQLITE_ROW ){ |
| 144 | const char *zSecondsSince1970 = db_column_text(&q, 0); |
| 145 | int ckinId = db_column_int(&q, 1); |
| 146 | const char *zComment = db_column_text(&q, 2); |
| 147 | const char *zUser = db_column_text(&q, 3); |
| 148 | const char *zBranch = db_column_text(&q, 4); |
| 149 | char *zBr; |
| 150 | Manifest *p; |
| 151 | ManifestFile *pFile; |
| 152 | const char *zFromType; |
| 153 | |
| 154 | bag_insert(&vers, ckinId); |
| 155 | if( zBranch==0 ) zBranch = "trunk"; |
| 156 | zBr = mprintf("%s", zBranch); |
| 157 | for(i=0; zBr[i]; i++){ |
| 158 | if( !fossil_isalnum(zBr[i]) ) zBr[i] = '_'; |
| 159 | } |
| 160 | printf("commit refs/heads/%s\nmark :%d\n", zBr, ckinId+firstCkin); |
| 161 | free(zBr); |
| 162 | printf("committer"); |
| 163 | print_person(zUser); |
| 164 | printf(" %s +0000\n", zSecondsSince1970); |
| 165 | if( zComment==0 ) zComment = "null comment"; |
| 166 | printf("data %d\n%s\n", (int)strlen(zComment), zComment); |
| 167 | p = manifest_get(ckinId, CFTYPE_ANY); |
| 168 | zFromType = "from"; |
| 169 | for(i=0; i<p->nParent; i++){ |
| 170 | int pid = fast_uuid_to_rid(p->azParent[i]); |
| 171 | if( pid==0 || !bag_find(&vers, pid) ) continue; |
| 172 | printf("%s :%d\n", zFromType, fast_uuid_to_rid(p->azParent[i])+firstCkin); |
| 173 | zFromType = "merge"; |
| 174 | } |
| 175 | printf("deleteall\n"); |
| 176 | manifest_file_rewind(p); |
| 177 | while( (pFile=manifest_file_next(p, 0))!=0 ){ |
| 178 | int fid = fast_uuid_to_rid(pFile->zUuid); |
| 179 | const char *zPerm = "100644"; |
| 180 | if( fid==0 ) continue; |
| 181 | if( pFile->zPerm && strstr(pFile->zPerm,"x") ) zPerm = "100755"; |
| 182 | if( !bag_find(&blobs, fid) ) continue; |
| 183 | printf("M %s :%d %s\n", zPerm, fid, pFile->zName); |
| 184 | } |
| 185 | manifest_cache_insert(p); |
| 186 | printf("\n"); |
| 187 | } |
| 188 | db_finalize(&q); |
| 189 | bag_clear(&blobs); |
| 190 | manifest_cache_clear(); |
| 191 | |
| 192 | |
| @@ -207,13 +301,34 @@ | |
| 207 | zEncoded = mprintf("%s", zTagname); |
| 208 | for(i=0; zEncoded[i]; i++){ |
| 209 | if( !fossil_isalnum(zEncoded[i]) ) zEncoded[i] = '_'; |
| 210 | } |
| 211 | printf("tag %s\n", zEncoded); |
| 212 | printf("from :%d\n", rid+firstCkin); |
| 213 | printf("tagger <tagger> %s +0000\n", zSecSince1970); |
| 214 | printf("data 0\n"); |
| 215 | fossil_free(zEncoded); |
| 216 | } |
| 217 | db_finalize(&q); |
| 218 | bag_clear(&vers); |
| 219 | } |
| 220 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -78,15 +78,17 @@ | |
| 78 | free(zName); |
| 79 | free(zEmail); |
| 80 | db_reset(&q); |
| 81 | } |
| 82 | |
| 83 | #define BLOBMARK(rid) ((rid) * 2) |
| 84 | #define COMMITMARK(rid) ((rid) * 2 + 1) |
| 85 | |
| 86 | /* |
| 87 | ** COMMAND: export |
| 88 | ** |
| 89 | ** Usage: %fossil export --git ?options? ?REPOSITORY? |
| 90 | ** |
| 91 | ** Write an export of all check-ins to standard output. The export is |
| 92 | ** written in the git-fast-export file format assuming the --git option is |
| 93 | ** provided. The git-fast-export format is currently the only VCS |
| 94 | ** interchange format supported, though other formats may be added in |
| @@ -95,98 +97,190 @@ | |
| 97 | ** Run this command within a checkout. Or use the -R or --repository |
| 98 | ** option to specify a Fossil repository to be exported. |
| 99 | ** |
| 100 | ** Only check-ins are exported using --git. Git does not support tickets |
| 101 | ** or wiki or events or attachments, so none of those are exported. |
| 102 | ** |
| 103 | ** If the "--import-marks FILE" option is used, it contains a list of |
| 104 | ** rids to skip. |
| 105 | ** |
| 106 | ** If the "--export-marks FILE" option is used, the rid of all commits and |
| 107 | ** blobs written on exit for use with "--import-marks" on the next run. |
| 108 | */ |
| 109 | void export_cmd(void){ |
| 110 | Stmt q, q2, q3; |
| 111 | int i; |
| 112 | Bag blobs, vers; |
| 113 | const char *markfile_in; |
| 114 | const char *markfile_out; |
| 115 | |
| 116 | bag_init(&blobs); |
| 117 | bag_init(&vers); |
| 118 | |
| 119 | find_option("git", 0, 0); /* Ignore the --git option for now */ |
| 120 | markfile_in = find_option("import-marks", 0, 1); |
| 121 | markfile_out = find_option("export-marks", 0, 1); |
| 122 | |
| 123 | db_find_and_open_repository(0, 2); |
| 124 | verify_all_options(); |
| 125 | if( g.argc!=2 && g.argc!=3 ){ usage("--git ?REPOSITORY?"); } |
| 126 | |
| 127 | db_multi_exec("CREATE TEMPORARY TABLE oldblob(rid INTEGER PRIMARY KEY)"); |
| 128 | db_multi_exec("CREATE TEMPORARY TABLE oldcommit(rid INTEGER PRIMARY KEY)"); |
| 129 | if( markfile_in!=0 ){ |
| 130 | Stmt qb,qc; |
| 131 | char line[100]; |
| 132 | FILE *f; |
| 133 | |
| 134 | f = fopen(markfile_in, "r"); |
| 135 | if( f==0 ){ |
| 136 | fossil_panic("cannot open %s for reading", markfile_in); |
| 137 | } |
| 138 | db_prepare(&qb, "INSERT OR IGNORE INTO oldblob VALUES (:rid)"); |
| 139 | db_prepare(&qc, "INSERT OR IGNORE INTO oldcommit VALUES (:rid)"); |
| 140 | while( fgets(line, sizeof(line), f)!=0 ){ |
| 141 | if( *line == 'b' ){ |
| 142 | db_bind_text(&qb, ":rid", line + 1); |
| 143 | db_step(&qb); |
| 144 | db_reset(&qb); |
| 145 | bag_insert(&blobs, atoi(line + 1)); |
| 146 | }else if( *line == 'c' ){ |
| 147 | db_bind_text(&qc, ":rid", line + 1); |
| 148 | db_step(&qc); |
| 149 | db_reset(&qc); |
| 150 | bag_insert(&vers, atoi(line + 1)); |
| 151 | }else{ |
| 152 | fossil_panic("bad input from %s: %s", markfile_in, line); |
| 153 | } |
| 154 | } |
| 155 | db_finalize(&qb); |
| 156 | db_finalize(&qc); |
| 157 | fclose(f); |
| 158 | } |
| 159 | |
| 160 | /* Step 1: Generate "blob" records for every artifact that is part |
| 161 | ** of a check-in |
| 162 | */ |
| 163 | fossil_binary_mode(stdout); |
| 164 | db_multi_exec("CREATE TEMPORARY TABLE newblob(rid INTEGER KEY, srcid INTEGER)"); |
| 165 | db_multi_exec("CREATE INDEX newblob_src ON newblob(srcid)"); |
| 166 | db_multi_exec( |
| 167 | "INSERT INTO newblob" |
| 168 | " SELECT DISTINCT fid," |
| 169 | " CASE WHEN EXISTS(SELECT 1 FROM delta WHERE rid=fid AND NOT EXISTS(SELECT 1 FROM oldblob WHERE srcid=fid))" |
| 170 | " THEN (SELECT srcid FROM delta WHERE rid=fid)" |
| 171 | " ELSE 0" |
| 172 | " END" |
| 173 | " FROM mlink" |
| 174 | " WHERE fid>0 AND NOT EXISTS(SELECT 1 FROM oldblob WHERE rid=fid)"); |
| 175 | db_prepare(&q, |
| 176 | "SELECT DISTINCT fid FROM mlink" |
| 177 | " WHERE fid>0 AND NOT EXISTS(SELECT 1 FROM oldblob WHERE rid=fid)"); |
| 178 | db_prepare(&q2, "INSERT INTO oldblob VALUES (:rid)"); |
| 179 | db_prepare(&q3, "SELECT rid FROM newblob WHERE srcid= (:srcid)"); |
| 180 | while( db_step(&q)==SQLITE_ROW ){ |
| 181 | int rid = db_column_int(&q, 0); |
| 182 | Blob content; |
| 183 | |
| 184 | while( !bag_find(&blobs, rid) ){ |
| 185 | content_get(rid, &content); |
| 186 | db_bind_int(&q2, ":rid", rid); |
| 187 | db_step(&q2); |
| 188 | db_reset(&q2); |
| 189 | printf("blob\nmark :%d\ndata %d\n", BLOBMARK(rid), blob_size(&content)); |
| 190 | bag_insert(&blobs, rid); |
| 191 | fwrite(blob_buffer(&content), 1, blob_size(&content), stdout); |
| 192 | printf("\n"); |
| 193 | blob_reset(&content); |
| 194 | |
| 195 | db_bind_int(&q3, ":srcid", rid); |
| 196 | if( db_step(&q3) != SQLITE_ROW ){ |
| 197 | db_reset(&q3); |
| 198 | break; |
| 199 | } |
| 200 | rid = db_column_int(&q3, 0); |
| 201 | db_reset(&q3); |
| 202 | } |
| 203 | } |
| 204 | db_finalize(&q); |
| 205 | db_finalize(&q2); |
| 206 | db_finalize(&q3); |
| 207 | |
| 208 | /* Output the commit records. |
| 209 | */ |
| 210 | db_prepare(&q, |
| 211 | "SELECT strftime('%%s',mtime), objid, coalesce(comment,ecomment)," |
| 212 | " coalesce(user,euser)," |
| 213 | " (SELECT value FROM tagxref WHERE rid=objid AND tagid=%d)" |
| 214 | " FROM event" |
| 215 | " WHERE type='ci' AND NOT EXISTS (SELECT 1 FROM oldcommit WHERE objid=rid)" |
| 216 | " ORDER BY mtime ASC", |
| 217 | TAG_BRANCH |
| 218 | ); |
| 219 | db_prepare(&q2, "INSERT INTO oldcommit VALUES (:rid)"); |
| 220 | while( db_step(&q)==SQLITE_ROW ){ |
| 221 | Stmt q4; |
| 222 | const char *zSecondsSince1970 = db_column_text(&q, 0); |
| 223 | int ckinId = db_column_int(&q, 1); |
| 224 | const char *zComment = db_column_text(&q, 2); |
| 225 | const char *zUser = db_column_text(&q, 3); |
| 226 | const char *zBranch = db_column_text(&q, 4); |
| 227 | char *zBr; |
| 228 | |
| 229 | bag_insert(&vers, ckinId); |
| 230 | db_bind_int(&q2, ":rid", ckinId); |
| 231 | db_step(&q2); |
| 232 | db_reset(&q2); |
| 233 | if( zBranch==0 ) zBranch = "trunk"; |
| 234 | zBr = mprintf("%s", zBranch); |
| 235 | for(i=0; zBr[i]; i++){ |
| 236 | if( !fossil_isalnum(zBr[i]) ) zBr[i] = '_'; |
| 237 | } |
| 238 | printf("commit refs/heads/%s\nmark :%d\n", zBr, COMMITMARK(ckinId)); |
| 239 | free(zBr); |
| 240 | printf("committer"); |
| 241 | print_person(zUser); |
| 242 | printf(" %s +0000\n", zSecondsSince1970); |
| 243 | if( zComment==0 ) zComment = "null comment"; |
| 244 | printf("data %d\n%s\n", (int)strlen(zComment), zComment); |
| 245 | db_prepare(&q3, "SELECT pid FROM plink WHERE cid=%d AND isprim", ckinId); |
| 246 | if( db_step(&q3) == SQLITE_ROW ){ |
| 247 | printf("from :%d\n", COMMITMARK(db_column_int(&q3, 0))); |
| 248 | db_prepare(&q4, |
| 249 | "SELECT pid FROM plink" |
| 250 | " WHERE cid=%d AND NOT isprim" |
| 251 | " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)" |
| 252 | " ORDER BY pid", |
| 253 | ckinId); |
| 254 | while( db_step(&q4)==SQLITE_ROW ){ |
| 255 | printf("merge :%d\n", COMMITMARK(db_column_int(&q4,0))); |
| 256 | } |
| 257 | db_finalize(&q4); |
| 258 | }else{ |
| 259 | printf("deleteall\n"); |
| 260 | } |
| 261 | |
| 262 | db_prepare(&q4, |
| 263 | "SELECT filename.name, mlink.fid, mlink.mperm FROM mlink" |
| 264 | " JOIN filename ON filename.fnid=mlink.fnid" |
| 265 | " WHERE mlink.mid=%d", |
| 266 | ckinId |
| 267 | ); |
| 268 | while( db_step(&q4)==SQLITE_ROW ){ |
| 269 | const char *zName = db_column_text(&q4,0); |
| 270 | int zNew = db_column_int(&q4,1); |
| 271 | int mPerm = db_column_int(&q4,2); |
| 272 | if( zNew==0) |
| 273 | printf("D %s\n", zName); |
| 274 | else if( bag_find(&blobs, zNew) ) |
| 275 | printf("M %s :%d %s\n", mPerm ? "100755" : "100644", BLOBMARK(zNew), zName); |
| 276 | } |
| 277 | db_finalize(&q4); |
| 278 | db_finalize(&q3); |
| 279 | printf("\n"); |
| 280 | } |
| 281 | db_finalize(&q2); |
| 282 | db_finalize(&q); |
| 283 | bag_clear(&blobs); |
| 284 | manifest_cache_clear(); |
| 285 | |
| 286 | |
| @@ -207,13 +301,34 @@ | |
| 301 | zEncoded = mprintf("%s", zTagname); |
| 302 | for(i=0; zEncoded[i]; i++){ |
| 303 | if( !fossil_isalnum(zEncoded[i]) ) zEncoded[i] = '_'; |
| 304 | } |
| 305 | printf("tag %s\n", zEncoded); |
| 306 | printf("from :%d\n", COMMITMARK(rid)); |
| 307 | printf("tagger <tagger> %s +0000\n", zSecSince1970); |
| 308 | printf("data 0\n"); |
| 309 | fossil_free(zEncoded); |
| 310 | } |
| 311 | db_finalize(&q); |
| 312 | bag_clear(&vers); |
| 313 | |
| 314 | if( markfile_out!=0 ){ |
| 315 | FILE *f; |
| 316 | f = fopen(markfile_out, "w"); |
| 317 | if( f == 0 ){ |
| 318 | fossil_panic("cannot open %s for writing", markfile_out); |
| 319 | } |
| 320 | db_prepare(&q, "SELECT rid FROM oldblob"); |
| 321 | while( db_step(&q)==SQLITE_ROW ){ |
| 322 | fprintf(f, "b%d\n", db_column_int(&q, 0)); |
| 323 | } |
| 324 | db_finalize(&q); |
| 325 | db_prepare(&q, "SELECT rid FROM oldcommit"); |
| 326 | while( db_step(&q)==SQLITE_ROW ){ |
| 327 | fprintf(f, "c%d\n", db_column_int(&q, 0)); |
| 328 | } |
| 329 | db_finalize(&q); |
| 330 | if( ferror(f)!=0 || fclose(f)!=0 ) { |
| 331 | fossil_panic("error while writing %s", markfile_out); |
| 332 | } |
| 333 | } |
| 334 | } |
| 335 |
+32
-6
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -19,10 +19,12 @@ | ||
| 19 | 19 | */ |
| 20 | 20 | #include "config.h" |
| 21 | 21 | #include <sys/types.h> |
| 22 | 22 | #include <sys/stat.h> |
| 23 | 23 | #include <unistd.h> |
| 24 | +#include <string.h> | |
| 25 | +#include <errno.h> | |
| 24 | 26 | #include "file.h" |
| 25 | 27 | |
| 26 | 28 | /* |
| 27 | 29 | ** The file status information from the most recent stat() call. |
| 28 | 30 | ** |
| @@ -397,11 +399,11 @@ | ||
| 397 | 399 | char *zPwdUtf8; |
| 398 | 400 | int nPwd; |
| 399 | 401 | int i; |
| 400 | 402 | char zPwd[2000]; |
| 401 | 403 | if( getcwd(zPwd, sizeof(zPwd)-1)==0 ){ |
| 402 | - fossil_fatal("pwd too big: max %d\n", (int)sizeof(zPwd)-1); | |
| 404 | + fossil_fatal("cannot find the current working directory."); | |
| 403 | 405 | } |
| 404 | 406 | zPwdUtf8 = fossil_mbcs_to_utf8(zPwd); |
| 405 | 407 | nPwd = strlen(zPwdUtf8); |
| 406 | 408 | if( nPwd > nBuf-1 ){ |
| 407 | 409 | fossil_fatal("pwd too big: max %d\n", nBuf-1); |
| @@ -409,11 +411,16 @@ | ||
| 409 | 411 | for(i=0; zPwdUtf8[i]; i++) if( zPwdUtf8[i]=='\\' ) zPwdUtf8[i] = '/'; |
| 410 | 412 | memcpy(zBuf, zPwdUtf8, nPwd+1); |
| 411 | 413 | fossil_mbcs_free(zPwdUtf8); |
| 412 | 414 | #else |
| 413 | 415 | if( getcwd(zBuf, nBuf-1)==0 ){ |
| 414 | - fossil_fatal("pwd too big: max %d\n", nBuf-1); | |
| 416 | + if( errno==ERANGE ){ | |
| 417 | + fossil_fatal("pwd too big: max %d\n", nBuf-1); | |
| 418 | + }else{ | |
| 419 | + fossil_fatal("cannot find current working directory; %s", | |
| 420 | + strerror(errno)); | |
| 421 | + } | |
| 415 | 422 | } |
| 416 | 423 | #endif |
| 417 | 424 | } |
| 418 | 425 | |
| 419 | 426 | /* |
| @@ -492,26 +499,45 @@ | ||
| 492 | 499 | } |
| 493 | 500 | } |
| 494 | 501 | } |
| 495 | 502 | return 1; |
| 496 | 503 | } |
| 504 | + | |
| 505 | +/* | |
| 506 | +** Return a pointer to the first character in a pathname past the | |
| 507 | +** drive letter. This routine is a no-op on unix. | |
| 508 | +*/ | |
| 509 | +char *file_without_drive_letter(char *zIn){ | |
| 510 | +#ifdef _WIN32 | |
| 511 | + if( fossil_isalpha(zIn[0]) && zIn[1]==':' ) zIn += 2; | |
| 512 | +#endif | |
| 513 | + return zIn; | |
| 514 | +} | |
| 497 | 515 | |
| 498 | 516 | /* |
| 499 | 517 | ** Compute a pathname for a file or directory that is relative |
| 500 | 518 | ** to the current directory. |
| 501 | 519 | */ |
| 502 | 520 | void file_relative_name(const char *zOrigName, Blob *pOut){ |
| 503 | 521 | char *zPath; |
| 504 | 522 | blob_set(pOut, zOrigName); |
| 505 | 523 | blob_resize(pOut, file_simplify_name(blob_buffer(pOut), blob_size(pOut))); |
| 506 | - zPath = blob_buffer(pOut); | |
| 524 | + zPath = file_without_drive_letter(blob_buffer(pOut)); | |
| 507 | 525 | if( zPath[0]=='/' ){ |
| 508 | 526 | int i, j; |
| 509 | 527 | Blob tmp; |
| 510 | - char zPwd[2000]; | |
| 511 | - file_getcwd(zPwd, sizeof(zPwd)-20); | |
| 512 | - for(i=1; zPath[i] && zPwd[i]==zPath[i]; i++){} | |
| 528 | + char *zPwd; | |
| 529 | + char zBuf[2000]; | |
| 530 | + zPwd = zBuf; | |
| 531 | + file_getcwd(zBuf, sizeof(zBuf)-20); | |
| 532 | + zPwd = file_without_drive_letter(zBuf); | |
| 533 | + i = 1; | |
| 534 | +#ifdef _WIN32 | |
| 535 | + while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++; | |
| 536 | +#else | |
| 537 | + while( zPath[i] && zPwd[i]==zPath[i] ) i++; | |
| 538 | +#endif | |
| 513 | 539 | if( zPath[i]==0 ){ |
| 514 | 540 | blob_reset(pOut); |
| 515 | 541 | if( zPwd[i]==0 ){ |
| 516 | 542 | blob_append(pOut, ".", 1); |
| 517 | 543 | }else{ |
| 518 | 544 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -19,10 +19,12 @@ | |
| 19 | */ |
| 20 | #include "config.h" |
| 21 | #include <sys/types.h> |
| 22 | #include <sys/stat.h> |
| 23 | #include <unistd.h> |
| 24 | #include "file.h" |
| 25 | |
| 26 | /* |
| 27 | ** The file status information from the most recent stat() call. |
| 28 | ** |
| @@ -397,11 +399,11 @@ | |
| 397 | char *zPwdUtf8; |
| 398 | int nPwd; |
| 399 | int i; |
| 400 | char zPwd[2000]; |
| 401 | if( getcwd(zPwd, sizeof(zPwd)-1)==0 ){ |
| 402 | fossil_fatal("pwd too big: max %d\n", (int)sizeof(zPwd)-1); |
| 403 | } |
| 404 | zPwdUtf8 = fossil_mbcs_to_utf8(zPwd); |
| 405 | nPwd = strlen(zPwdUtf8); |
| 406 | if( nPwd > nBuf-1 ){ |
| 407 | fossil_fatal("pwd too big: max %d\n", nBuf-1); |
| @@ -409,11 +411,16 @@ | |
| 409 | for(i=0; zPwdUtf8[i]; i++) if( zPwdUtf8[i]=='\\' ) zPwdUtf8[i] = '/'; |
| 410 | memcpy(zBuf, zPwdUtf8, nPwd+1); |
| 411 | fossil_mbcs_free(zPwdUtf8); |
| 412 | #else |
| 413 | if( getcwd(zBuf, nBuf-1)==0 ){ |
| 414 | fossil_fatal("pwd too big: max %d\n", nBuf-1); |
| 415 | } |
| 416 | #endif |
| 417 | } |
| 418 | |
| 419 | /* |
| @@ -492,26 +499,45 @@ | |
| 492 | } |
| 493 | } |
| 494 | } |
| 495 | return 1; |
| 496 | } |
| 497 | |
| 498 | /* |
| 499 | ** Compute a pathname for a file or directory that is relative |
| 500 | ** to the current directory. |
| 501 | */ |
| 502 | void file_relative_name(const char *zOrigName, Blob *pOut){ |
| 503 | char *zPath; |
| 504 | blob_set(pOut, zOrigName); |
| 505 | blob_resize(pOut, file_simplify_name(blob_buffer(pOut), blob_size(pOut))); |
| 506 | zPath = blob_buffer(pOut); |
| 507 | if( zPath[0]=='/' ){ |
| 508 | int i, j; |
| 509 | Blob tmp; |
| 510 | char zPwd[2000]; |
| 511 | file_getcwd(zPwd, sizeof(zPwd)-20); |
| 512 | for(i=1; zPath[i] && zPwd[i]==zPath[i]; i++){} |
| 513 | if( zPath[i]==0 ){ |
| 514 | blob_reset(pOut); |
| 515 | if( zPwd[i]==0 ){ |
| 516 | blob_append(pOut, ".", 1); |
| 517 | }else{ |
| 518 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -19,10 +19,12 @@ | |
| 19 | */ |
| 20 | #include "config.h" |
| 21 | #include <sys/types.h> |
| 22 | #include <sys/stat.h> |
| 23 | #include <unistd.h> |
| 24 | #include <string.h> |
| 25 | #include <errno.h> |
| 26 | #include "file.h" |
| 27 | |
| 28 | /* |
| 29 | ** The file status information from the most recent stat() call. |
| 30 | ** |
| @@ -397,11 +399,11 @@ | |
| 399 | char *zPwdUtf8; |
| 400 | int nPwd; |
| 401 | int i; |
| 402 | char zPwd[2000]; |
| 403 | if( getcwd(zPwd, sizeof(zPwd)-1)==0 ){ |
| 404 | fossil_fatal("cannot find the current working directory."); |
| 405 | } |
| 406 | zPwdUtf8 = fossil_mbcs_to_utf8(zPwd); |
| 407 | nPwd = strlen(zPwdUtf8); |
| 408 | if( nPwd > nBuf-1 ){ |
| 409 | fossil_fatal("pwd too big: max %d\n", nBuf-1); |
| @@ -409,11 +411,16 @@ | |
| 411 | for(i=0; zPwdUtf8[i]; i++) if( zPwdUtf8[i]=='\\' ) zPwdUtf8[i] = '/'; |
| 412 | memcpy(zBuf, zPwdUtf8, nPwd+1); |
| 413 | fossil_mbcs_free(zPwdUtf8); |
| 414 | #else |
| 415 | if( getcwd(zBuf, nBuf-1)==0 ){ |
| 416 | if( errno==ERANGE ){ |
| 417 | fossil_fatal("pwd too big: max %d\n", nBuf-1); |
| 418 | }else{ |
| 419 | fossil_fatal("cannot find current working directory; %s", |
| 420 | strerror(errno)); |
| 421 | } |
| 422 | } |
| 423 | #endif |
| 424 | } |
| 425 | |
| 426 | /* |
| @@ -492,26 +499,45 @@ | |
| 499 | } |
| 500 | } |
| 501 | } |
| 502 | return 1; |
| 503 | } |
| 504 | |
| 505 | /* |
| 506 | ** Return a pointer to the first character in a pathname past the |
| 507 | ** drive letter. This routine is a no-op on unix. |
| 508 | */ |
| 509 | char *file_without_drive_letter(char *zIn){ |
| 510 | #ifdef _WIN32 |
| 511 | if( fossil_isalpha(zIn[0]) && zIn[1]==':' ) zIn += 2; |
| 512 | #endif |
| 513 | return zIn; |
| 514 | } |
| 515 | |
| 516 | /* |
| 517 | ** Compute a pathname for a file or directory that is relative |
| 518 | ** to the current directory. |
| 519 | */ |
| 520 | void file_relative_name(const char *zOrigName, Blob *pOut){ |
| 521 | char *zPath; |
| 522 | blob_set(pOut, zOrigName); |
| 523 | blob_resize(pOut, file_simplify_name(blob_buffer(pOut), blob_size(pOut))); |
| 524 | zPath = file_without_drive_letter(blob_buffer(pOut)); |
| 525 | if( zPath[0]=='/' ){ |
| 526 | int i, j; |
| 527 | Blob tmp; |
| 528 | char *zPwd; |
| 529 | char zBuf[2000]; |
| 530 | zPwd = zBuf; |
| 531 | file_getcwd(zBuf, sizeof(zBuf)-20); |
| 532 | zPwd = file_without_drive_letter(zBuf); |
| 533 | i = 1; |
| 534 | #ifdef _WIN32 |
| 535 | while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++; |
| 536 | #else |
| 537 | while( zPath[i] && zPwd[i]==zPath[i] ) i++; |
| 538 | #endif |
| 539 | if( zPath[i]==0 ){ |
| 540 | blob_reset(pOut); |
| 541 | if( zPwd[i]==0 ){ |
| 542 | blob_append(pOut, ".", 1); |
| 543 | }else{ |
| 544 |
+9
| --- src/finfo.c | ||
| +++ src/finfo.c | ||
| @@ -193,10 +193,12 @@ | ||
| 193 | 193 | ** Additional query parameters: |
| 194 | 194 | ** |
| 195 | 195 | ** a=DATE Only show changes after DATE |
| 196 | 196 | ** b=DATE Only show changes before DATE |
| 197 | 197 | ** n=NUM Show the first NUM changes only |
| 198 | +** brbg Background color by branch name | |
| 199 | +** ubg Background color by user name | |
| 198 | 200 | */ |
| 199 | 201 | void finfo_page(void){ |
| 200 | 202 | Stmt q; |
| 201 | 203 | const char *zFilename; |
| 202 | 204 | char zPrevDate[20]; |
| @@ -204,10 +206,12 @@ | ||
| 204 | 206 | const char *zB; |
| 205 | 207 | int n; |
| 206 | 208 | Blob title; |
| 207 | 209 | Blob sql; |
| 208 | 210 | GraphContext *pGraph; |
| 211 | + int brBg = P("brbg")!=0; | |
| 212 | + int uBg = P("ubg")!=0; | |
| 209 | 213 | |
| 210 | 214 | login_check_credentials(); |
| 211 | 215 | if( !g.okRead ){ login_needed(); return; } |
| 212 | 216 | style_header("File History"); |
| 213 | 217 | login_anonymous_available(); |
| @@ -268,10 +272,15 @@ | ||
| 268 | 272 | int gidx; |
| 269 | 273 | char zTime[10]; |
| 270 | 274 | char zShort[20]; |
| 271 | 275 | char zShortCkin[20]; |
| 272 | 276 | if( zBr==0 ) zBr = "trunk"; |
| 277 | + if( uBg ){ | |
| 278 | + zBgClr = hash_color(zUser); | |
| 279 | + }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){ | |
| 280 | + zBgClr = strcmp(zBr,"trunk")==0 ? "white" : hash_color(zBr); | |
| 281 | + } | |
| 273 | 282 | gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr, 0); |
| 274 | 283 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 275 | 284 | sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); |
| 276 | 285 | @ <tr><td> |
| 277 | 286 | @ <div class="divider">%s(zPrevDate)</div> |
| 278 | 287 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -193,10 +193,12 @@ | |
| 193 | ** Additional query parameters: |
| 194 | ** |
| 195 | ** a=DATE Only show changes after DATE |
| 196 | ** b=DATE Only show changes before DATE |
| 197 | ** n=NUM Show the first NUM changes only |
| 198 | */ |
| 199 | void finfo_page(void){ |
| 200 | Stmt q; |
| 201 | const char *zFilename; |
| 202 | char zPrevDate[20]; |
| @@ -204,10 +206,12 @@ | |
| 204 | const char *zB; |
| 205 | int n; |
| 206 | Blob title; |
| 207 | Blob sql; |
| 208 | GraphContext *pGraph; |
| 209 | |
| 210 | login_check_credentials(); |
| 211 | if( !g.okRead ){ login_needed(); return; } |
| 212 | style_header("File History"); |
| 213 | login_anonymous_available(); |
| @@ -268,10 +272,15 @@ | |
| 268 | int gidx; |
| 269 | char zTime[10]; |
| 270 | char zShort[20]; |
| 271 | char zShortCkin[20]; |
| 272 | if( zBr==0 ) zBr = "trunk"; |
| 273 | gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr, 0); |
| 274 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 275 | sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); |
| 276 | @ <tr><td> |
| 277 | @ <div class="divider">%s(zPrevDate)</div> |
| 278 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -193,10 +193,12 @@ | |
| 193 | ** Additional query parameters: |
| 194 | ** |
| 195 | ** a=DATE Only show changes after DATE |
| 196 | ** b=DATE Only show changes before DATE |
| 197 | ** n=NUM Show the first NUM changes only |
| 198 | ** brbg Background color by branch name |
| 199 | ** ubg Background color by user name |
| 200 | */ |
| 201 | void finfo_page(void){ |
| 202 | Stmt q; |
| 203 | const char *zFilename; |
| 204 | char zPrevDate[20]; |
| @@ -204,10 +206,12 @@ | |
| 206 | const char *zB; |
| 207 | int n; |
| 208 | Blob title; |
| 209 | Blob sql; |
| 210 | GraphContext *pGraph; |
| 211 | int brBg = P("brbg")!=0; |
| 212 | int uBg = P("ubg")!=0; |
| 213 | |
| 214 | login_check_credentials(); |
| 215 | if( !g.okRead ){ login_needed(); return; } |
| 216 | style_header("File History"); |
| 217 | login_anonymous_available(); |
| @@ -268,10 +272,15 @@ | |
| 272 | int gidx; |
| 273 | char zTime[10]; |
| 274 | char zShort[20]; |
| 275 | char zShortCkin[20]; |
| 276 | if( zBr==0 ) zBr = "trunk"; |
| 277 | if( uBg ){ |
| 278 | zBgClr = hash_color(zUser); |
| 279 | }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){ |
| 280 | zBgClr = strcmp(zBr,"trunk")==0 ? "white" : hash_color(zBr); |
| 281 | } |
| 282 | gidx = graph_add_row(pGraph, frid, fpid>0 ? 1 : 0, &fpid, zBr, zBgClr, 0); |
| 283 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 284 | sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); |
| 285 | @ <tr><td> |
| 286 | @ <div class="divider">%s(zPrevDate)</div> |
| 287 |
+4
-4
| --- src/glob.c | ||
| +++ src/glob.c | ||
| @@ -110,24 +110,24 @@ | ||
| 110 | 110 | p = fossil_malloc( sizeof(*p) + nList+1 ); |
| 111 | 111 | memset(p, 0, sizeof(*p)); |
| 112 | 112 | z = (char*)&p[1]; |
| 113 | 113 | memcpy(z, zPatternList, nList+1); |
| 114 | 114 | while( z[0] ){ |
| 115 | - while( z[0]==',' || z[0]==' ' ) z++; /* Skip leading spaces */ | |
| 115 | + while( z[0]==',' || z[0]==' ' || z[0]=='\n' || z[0]=='\r' ) z++; /* Skip leading spaces and newlines */ | |
| 116 | 116 | if( z[0]=='\'' || z[0]=='"' ){ |
| 117 | 117 | delimiter = z[0]; |
| 118 | 118 | z++; |
| 119 | 119 | }else{ |
| 120 | 120 | delimiter = ','; |
| 121 | 121 | } |
| 122 | 122 | if( z[0]==0 ) break; |
| 123 | 123 | p->azPattern = fossil_realloc(p->azPattern, (p->nPattern+1)*sizeof(char*) ); |
| 124 | 124 | p->azPattern[p->nPattern++] = z; |
| 125 | - for(i=0; z[i] && z[i]!=delimiter; i++){} | |
| 125 | + for(i=0; z[i] && z[i]!=delimiter && z[i]!='\n' && z[i]!='\r'; i++){} | |
| 126 | 126 | if( delimiter==',' ){ |
| 127 | - /* Remove trailing spaces on a comma-delimited pattern */ | |
| 128 | - for(j=i; j>1 && z[j-1]==' '; j--){} | |
| 127 | + /* Remove trailing spaces / newlines on a comma-delimited pattern */ | |
| 128 | + for(j=i; j>1 && (z[j-1]==' ' || z[j-1]=='\n' || z[j-1]=='\r'); j--){} | |
| 129 | 129 | if( j<i ) z[j] = 0; |
| 130 | 130 | } |
| 131 | 131 | if( z[i]==0 ) break; |
| 132 | 132 | z[i] = 0; |
| 133 | 133 | z += i+1; |
| 134 | 134 |
| --- src/glob.c | |
| +++ src/glob.c | |
| @@ -110,24 +110,24 @@ | |
| 110 | p = fossil_malloc( sizeof(*p) + nList+1 ); |
| 111 | memset(p, 0, sizeof(*p)); |
| 112 | z = (char*)&p[1]; |
| 113 | memcpy(z, zPatternList, nList+1); |
| 114 | while( z[0] ){ |
| 115 | while( z[0]==',' || z[0]==' ' ) z++; /* Skip leading spaces */ |
| 116 | if( z[0]=='\'' || z[0]=='"' ){ |
| 117 | delimiter = z[0]; |
| 118 | z++; |
| 119 | }else{ |
| 120 | delimiter = ','; |
| 121 | } |
| 122 | if( z[0]==0 ) break; |
| 123 | p->azPattern = fossil_realloc(p->azPattern, (p->nPattern+1)*sizeof(char*) ); |
| 124 | p->azPattern[p->nPattern++] = z; |
| 125 | for(i=0; z[i] && z[i]!=delimiter; i++){} |
| 126 | if( delimiter==',' ){ |
| 127 | /* Remove trailing spaces on a comma-delimited pattern */ |
| 128 | for(j=i; j>1 && z[j-1]==' '; j--){} |
| 129 | if( j<i ) z[j] = 0; |
| 130 | } |
| 131 | if( z[i]==0 ) break; |
| 132 | z[i] = 0; |
| 133 | z += i+1; |
| 134 |
| --- src/glob.c | |
| +++ src/glob.c | |
| @@ -110,24 +110,24 @@ | |
| 110 | p = fossil_malloc( sizeof(*p) + nList+1 ); |
| 111 | memset(p, 0, sizeof(*p)); |
| 112 | z = (char*)&p[1]; |
| 113 | memcpy(z, zPatternList, nList+1); |
| 114 | while( z[0] ){ |
| 115 | while( z[0]==',' || z[0]==' ' || z[0]=='\n' || z[0]=='\r' ) z++; /* Skip leading spaces and newlines */ |
| 116 | if( z[0]=='\'' || z[0]=='"' ){ |
| 117 | delimiter = z[0]; |
| 118 | z++; |
| 119 | }else{ |
| 120 | delimiter = ','; |
| 121 | } |
| 122 | if( z[0]==0 ) break; |
| 123 | p->azPattern = fossil_realloc(p->azPattern, (p->nPattern+1)*sizeof(char*) ); |
| 124 | p->azPattern[p->nPattern++] = z; |
| 125 | for(i=0; z[i] && z[i]!=delimiter && z[i]!='\n' && z[i]!='\r'; i++){} |
| 126 | if( delimiter==',' ){ |
| 127 | /* Remove trailing spaces / newlines on a comma-delimited pattern */ |
| 128 | for(j=i; j>1 && (z[j-1]==' ' || z[j-1]=='\n' || z[j-1]=='\r'); j--){} |
| 129 | if( j<i ) z[j] = 0; |
| 130 | } |
| 131 | if( z[i]==0 ) break; |
| 132 | z[i] = 0; |
| 133 | z += i+1; |
| 134 |
+2
-1
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -110,11 +110,12 @@ | ||
| 110 | 110 | blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded); |
| 111 | 111 | fossil_free(zEncoded); |
| 112 | 112 | fossil_free(zCredentials); |
| 113 | 113 | } |
| 114 | 114 | blob_appendf(pHdr, "Host: %s\r\n", g.urlHostname); |
| 115 | - blob_appendf(pHdr, "User-Agent: Fossil/" MANIFEST_VERSION "\r\n"); | |
| 115 | + blob_appendf(pHdr, "User-Agent: Fossil/" RELEASE_VERSION | |
| 116 | + "-" MANIFEST_VERSION "\r\n"); | |
| 116 | 117 | if( g.fHttpTrace ){ |
| 117 | 118 | blob_appendf(pHdr, "Content-Type: application/x-fossil-debug\r\n"); |
| 118 | 119 | }else{ |
| 119 | 120 | blob_appendf(pHdr, "Content-Type: application/x-fossil\r\n"); |
| 120 | 121 | } |
| 121 | 122 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -110,11 +110,12 @@ | |
| 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: Fossil/" MANIFEST_VERSION "\r\n"); |
| 116 | if( g.fHttpTrace ){ |
| 117 | blob_appendf(pHdr, "Content-Type: application/x-fossil-debug\r\n"); |
| 118 | }else{ |
| 119 | blob_appendf(pHdr, "Content-Type: application/x-fossil\r\n"); |
| 120 | } |
| 121 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -110,11 +110,12 @@ | |
| 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: Fossil/" RELEASE_VERSION |
| 116 | "-" MANIFEST_VERSION "\r\n"); |
| 117 | if( g.fHttpTrace ){ |
| 118 | blob_appendf(pHdr, "Content-Type: application/x-fossil-debug\r\n"); |
| 119 | }else{ |
| 120 | blob_appendf(pHdr, "Content-Type: application/x-fossil\r\n"); |
| 121 | } |
| 122 |
+61
-1
| --- src/http_ssl.c | ||
| +++ src/http_ssl.c | ||
| @@ -78,23 +78,76 @@ | ||
| 78 | 78 | ** Return the current SSL error message |
| 79 | 79 | */ |
| 80 | 80 | const char *ssl_errmsg(void){ |
| 81 | 81 | return sslErrMsg; |
| 82 | 82 | } |
| 83 | + | |
| 84 | +/* | |
| 85 | +** When a server requests a client certificate that hasn't been provided, | |
| 86 | +** display a warning message explaining what to do next. | |
| 87 | +*/ | |
| 88 | +static int ssl_client_cert_callback(SSL *ssl, X509 **x509, EVP_PKEY **pkey){ | |
| 89 | + fossil_warning("The remote server requested a client certificate for " | |
| 90 | + "authentication. Specify the pathname to a file containing the PEM " | |
| 91 | + "encoded certificate and private key with the --ssl-identity option " | |
| 92 | + "or the ssl-identity setting."); | |
| 93 | + return 0; /* no cert available */ | |
| 94 | +} | |
| 83 | 95 | |
| 84 | 96 | /* |
| 85 | 97 | ** Call this routine once before any other use of the SSL interface. |
| 86 | 98 | ** This routine does initial configuration of the SSL module. |
| 87 | 99 | */ |
| 88 | 100 | void ssl_global_init(void){ |
| 101 | + const char *zCaSetting = 0, *zCaFile = 0, *zCaDirectory = 0; | |
| 102 | + | |
| 89 | 103 | if( sslIsInit==0 ){ |
| 90 | 104 | SSL_library_init(); |
| 91 | 105 | SSL_load_error_strings(); |
| 92 | 106 | ERR_load_BIO_strings(); |
| 93 | 107 | OpenSSL_add_all_algorithms(); |
| 94 | 108 | sslCtx = SSL_CTX_new(SSLv23_client_method()); |
| 95 | - X509_STORE_set_default_paths(SSL_CTX_get_cert_store(sslCtx)); | |
| 109 | + | |
| 110 | + /* Set up acceptable CA root certificates */ | |
| 111 | + zCaSetting = db_get("ssl-ca-location", 0); | |
| 112 | + if( zCaSetting==0 || zCaSetting[0]=='\0' ){ | |
| 113 | + /* CA location not specified, use platform's default certificate store */ | |
| 114 | + X509_STORE_set_default_paths(SSL_CTX_get_cert_store(sslCtx)); | |
| 115 | + }else{ | |
| 116 | + /* User has specified a CA location, make sure it exists and use it */ | |
| 117 | + switch( file_isdir(zCaSetting) ){ | |
| 118 | + case 0: { /* doesn't exist */ | |
| 119 | + fossil_fatal("ssl-ca-location is set to '%s', " | |
| 120 | + "but is not a file or directory", zCaSetting); | |
| 121 | + break; | |
| 122 | + } | |
| 123 | + case 1: { /* directory */ | |
| 124 | + zCaDirectory = zCaSetting; | |
| 125 | + break; | |
| 126 | + } | |
| 127 | + case 2: { /* file */ | |
| 128 | + zCaFile = zCaSetting; | |
| 129 | + break; | |
| 130 | + } | |
| 131 | + } | |
| 132 | + if( SSL_CTX_load_verify_locations(sslCtx, zCaFile, zCaDirectory)==0 ){ | |
| 133 | + fossil_fatal("Failed to use CA root certificates from " | |
| 134 | + "ssl-ca-location '%s'", zCaSetting); | |
| 135 | + } | |
| 136 | + } | |
| 137 | + | |
| 138 | + /* Load client SSL identity, preferring the filename specified on the command line */ | |
| 139 | + const char *identityFile = ( g.zSSLIdentity!= 0) ? g.zSSLIdentity : db_get("ssl-identity", 0); | |
| 140 | + if( identityFile!=0 && identityFile[0]!='\0' ){ | |
| 141 | + if( SSL_CTX_use_certificate_file(sslCtx, identityFile, SSL_FILETYPE_PEM)!= 1 | |
| 142 | + || SSL_CTX_use_PrivateKey_file(sslCtx, identityFile, SSL_FILETYPE_PEM)!=1 ){ | |
| 143 | + fossil_fatal("Could not load SSL identity from %s", identityFile); | |
| 144 | + } | |
| 145 | + } | |
| 146 | + /* Register a callback to tell the user what to do when the server asks for a cert */ | |
| 147 | + SSL_CTX_set_client_cert_cb(sslCtx, ssl_client_cert_callback); | |
| 148 | + | |
| 96 | 149 | sslIsInit = 1; |
| 97 | 150 | } |
| 98 | 151 | } |
| 99 | 152 | |
| 100 | 153 | /* |
| @@ -204,10 +257,17 @@ | ||
| 204 | 257 | if( hasSavedCertificate ){ |
| 205 | 258 | warning = "WARNING: Certificate doesn't match the " |
| 206 | 259 | "saved certificate for this host!"; |
| 207 | 260 | } |
| 208 | 261 | prompt = mprintf("\nUnknown SSL certificate:\n\n%s\n\n%s\n" |
| 262 | + "Either:\n" | |
| 263 | + " * verify the certificate is correct using the " | |
| 264 | + "SHA1 fingerprint above\n" | |
| 265 | + " * use the global ssl-ca-location setting to specify your CA root\n" | |
| 266 | + " certificates list\n\n" | |
| 267 | + "If you are not expecting this message, answer no and " | |
| 268 | + "contact your server\nadministrator.\n\n" | |
| 209 | 269 | "Accept certificate [a=always/y/N]? ", desc, warning); |
| 210 | 270 | BIO_free(mem); |
| 211 | 271 | |
| 212 | 272 | prompt_user(prompt, &ans); |
| 213 | 273 | free(prompt); |
| 214 | 274 |
| --- src/http_ssl.c | |
| +++ src/http_ssl.c | |
| @@ -78,23 +78,76 @@ | |
| 78 | ** Return the current SSL error message |
| 79 | */ |
| 80 | const char *ssl_errmsg(void){ |
| 81 | return sslErrMsg; |
| 82 | } |
| 83 | |
| 84 | /* |
| 85 | ** Call this routine once before any other use of the SSL interface. |
| 86 | ** This routine does initial configuration of the SSL module. |
| 87 | */ |
| 88 | void ssl_global_init(void){ |
| 89 | if( sslIsInit==0 ){ |
| 90 | SSL_library_init(); |
| 91 | SSL_load_error_strings(); |
| 92 | ERR_load_BIO_strings(); |
| 93 | OpenSSL_add_all_algorithms(); |
| 94 | sslCtx = SSL_CTX_new(SSLv23_client_method()); |
| 95 | X509_STORE_set_default_paths(SSL_CTX_get_cert_store(sslCtx)); |
| 96 | sslIsInit = 1; |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | /* |
| @@ -204,10 +257,17 @@ | |
| 204 | if( hasSavedCertificate ){ |
| 205 | warning = "WARNING: Certificate doesn't match the " |
| 206 | "saved certificate for this host!"; |
| 207 | } |
| 208 | prompt = mprintf("\nUnknown SSL certificate:\n\n%s\n\n%s\n" |
| 209 | "Accept certificate [a=always/y/N]? ", desc, warning); |
| 210 | BIO_free(mem); |
| 211 | |
| 212 | prompt_user(prompt, &ans); |
| 213 | free(prompt); |
| 214 |
| --- src/http_ssl.c | |
| +++ src/http_ssl.c | |
| @@ -78,23 +78,76 @@ | |
| 78 | ** Return the current SSL error message |
| 79 | */ |
| 80 | const char *ssl_errmsg(void){ |
| 81 | return sslErrMsg; |
| 82 | } |
| 83 | |
| 84 | /* |
| 85 | ** When a server requests a client certificate that hasn't been provided, |
| 86 | ** display a warning message explaining what to do next. |
| 87 | */ |
| 88 | static int ssl_client_cert_callback(SSL *ssl, X509 **x509, EVP_PKEY **pkey){ |
| 89 | fossil_warning("The remote server requested a client certificate for " |
| 90 | "authentication. Specify the pathname to a file containing the PEM " |
| 91 | "encoded certificate and private key with the --ssl-identity option " |
| 92 | "or the ssl-identity setting."); |
| 93 | return 0; /* no cert available */ |
| 94 | } |
| 95 | |
| 96 | /* |
| 97 | ** Call this routine once before any other use of the SSL interface. |
| 98 | ** This routine does initial configuration of the SSL module. |
| 99 | */ |
| 100 | void ssl_global_init(void){ |
| 101 | const char *zCaSetting = 0, *zCaFile = 0, *zCaDirectory = 0; |
| 102 | |
| 103 | if( sslIsInit==0 ){ |
| 104 | SSL_library_init(); |
| 105 | SSL_load_error_strings(); |
| 106 | ERR_load_BIO_strings(); |
| 107 | OpenSSL_add_all_algorithms(); |
| 108 | sslCtx = SSL_CTX_new(SSLv23_client_method()); |
| 109 | |
| 110 | /* Set up acceptable CA root certificates */ |
| 111 | zCaSetting = db_get("ssl-ca-location", 0); |
| 112 | if( zCaSetting==0 || zCaSetting[0]=='\0' ){ |
| 113 | /* CA location not specified, use platform's default certificate store */ |
| 114 | X509_STORE_set_default_paths(SSL_CTX_get_cert_store(sslCtx)); |
| 115 | }else{ |
| 116 | /* User has specified a CA location, make sure it exists and use it */ |
| 117 | switch( file_isdir(zCaSetting) ){ |
| 118 | case 0: { /* doesn't exist */ |
| 119 | fossil_fatal("ssl-ca-location is set to '%s', " |
| 120 | "but is not a file or directory", zCaSetting); |
| 121 | break; |
| 122 | } |
| 123 | case 1: { /* directory */ |
| 124 | zCaDirectory = zCaSetting; |
| 125 | break; |
| 126 | } |
| 127 | case 2: { /* file */ |
| 128 | zCaFile = zCaSetting; |
| 129 | break; |
| 130 | } |
| 131 | } |
| 132 | if( SSL_CTX_load_verify_locations(sslCtx, zCaFile, zCaDirectory)==0 ){ |
| 133 | fossil_fatal("Failed to use CA root certificates from " |
| 134 | "ssl-ca-location '%s'", zCaSetting); |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | /* Load client SSL identity, preferring the filename specified on the command line */ |
| 139 | const char *identityFile = ( g.zSSLIdentity!= 0) ? g.zSSLIdentity : db_get("ssl-identity", 0); |
| 140 | if( identityFile!=0 && identityFile[0]!='\0' ){ |
| 141 | if( SSL_CTX_use_certificate_file(sslCtx, identityFile, SSL_FILETYPE_PEM)!= 1 |
| 142 | || SSL_CTX_use_PrivateKey_file(sslCtx, identityFile, SSL_FILETYPE_PEM)!=1 ){ |
| 143 | fossil_fatal("Could not load SSL identity from %s", identityFile); |
| 144 | } |
| 145 | } |
| 146 | /* Register a callback to tell the user what to do when the server asks for a cert */ |
| 147 | SSL_CTX_set_client_cert_cb(sslCtx, ssl_client_cert_callback); |
| 148 | |
| 149 | sslIsInit = 1; |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | /* |
| @@ -204,10 +257,17 @@ | |
| 257 | if( hasSavedCertificate ){ |
| 258 | warning = "WARNING: Certificate doesn't match the " |
| 259 | "saved certificate for this host!"; |
| 260 | } |
| 261 | prompt = mprintf("\nUnknown SSL certificate:\n\n%s\n\n%s\n" |
| 262 | "Either:\n" |
| 263 | " * verify the certificate is correct using the " |
| 264 | "SHA1 fingerprint above\n" |
| 265 | " * use the global ssl-ca-location setting to specify your CA root\n" |
| 266 | " certificates list\n\n" |
| 267 | "If you are not expecting this message, answer no and " |
| 268 | "contact your server\nadministrator.\n\n" |
| 269 | "Accept certificate [a=always/y/N]? ", desc, warning); |
| 270 | BIO_free(mem); |
| 271 | |
| 272 | prompt_user(prompt, &ans); |
| 273 | free(prompt); |
| 274 |
+11
-5
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -1213,12 +1213,18 @@ | ||
| 1213 | 1213 | } |
| 1214 | 1214 | |
| 1215 | 1215 | |
| 1216 | 1216 | /* |
| 1217 | 1217 | ** WEBPAGE: artifact |
| 1218 | -** URL: /artifact?name=ARTIFACTID | |
| 1218 | +** URL: /artifact/ARTIFACTID | |
| 1219 | 1219 | ** URL: /artifact?ci=CHECKIN&filename=PATH |
| 1220 | +** | |
| 1221 | +** Additional query parameters: | |
| 1222 | +** | |
| 1223 | +** ln - show line numbers | |
| 1224 | +** ln=N - highlight line number N | |
| 1225 | +** ln=M-N - highlight lines M through N inclusive | |
| 1220 | 1226 | ** |
| 1221 | 1227 | ** Show the complete content of a file identified by ARTIFACTID |
| 1222 | 1228 | ** as preformatted text. |
| 1223 | 1229 | */ |
| 1224 | 1230 | void artifact_page(void){ |
| @@ -1260,24 +1266,24 @@ | ||
| 1260 | 1266 | zMime = mimetype_from_name(blob_str(&downloadName)); |
| 1261 | 1267 | if( zMime ){ |
| 1262 | 1268 | if( fossil_strcmp(zMime, "text/html")==0 ){ |
| 1263 | 1269 | if( P("txt") ){ |
| 1264 | 1270 | style_submenu_element("Html", "Html", |
| 1265 | - "%s/artifact?name=%s", g.zTop, zUuid); | |
| 1271 | + "%s/artifact/%s", g.zTop, zUuid); | |
| 1266 | 1272 | }else{ |
| 1267 | 1273 | renderAsHtml = 1; |
| 1268 | 1274 | style_submenu_element("Text", "Text", |
| 1269 | - "%s/artifact?name=%s&txt=1", g.zTop, zUuid); | |
| 1275 | + "%s/artifact/%s?txt=1", g.zTop, zUuid); | |
| 1270 | 1276 | } |
| 1271 | 1277 | }else if( fossil_strcmp(zMime, "application/x-fossil-wiki")==0 ){ |
| 1272 | 1278 | if( P("txt") ){ |
| 1273 | 1279 | style_submenu_element("Wiki", "Wiki", |
| 1274 | - "%s/artifact?name=%s", g.zTop, zUuid); | |
| 1280 | + "%s/artifact/%s", g.zTop, zUuid); | |
| 1275 | 1281 | }else{ |
| 1276 | 1282 | renderAsWiki = 1; |
| 1277 | 1283 | style_submenu_element("Text", "Text", |
| 1278 | - "%s/artifact?name=%s&txt=1", g.zTop, zUuid); | |
| 1284 | + "%s/artifact/%s?txt=1", g.zTop, zUuid); | |
| 1279 | 1285 | } |
| 1280 | 1286 | } |
| 1281 | 1287 | } |
| 1282 | 1288 | @ </p></blockquote> |
| 1283 | 1289 | @ <hr /> |
| 1284 | 1290 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -1213,12 +1213,18 @@ | |
| 1213 | } |
| 1214 | |
| 1215 | |
| 1216 | /* |
| 1217 | ** WEBPAGE: artifact |
| 1218 | ** URL: /artifact?name=ARTIFACTID |
| 1219 | ** URL: /artifact?ci=CHECKIN&filename=PATH |
| 1220 | ** |
| 1221 | ** Show the complete content of a file identified by ARTIFACTID |
| 1222 | ** as preformatted text. |
| 1223 | */ |
| 1224 | void artifact_page(void){ |
| @@ -1260,24 +1266,24 @@ | |
| 1260 | zMime = mimetype_from_name(blob_str(&downloadName)); |
| 1261 | if( zMime ){ |
| 1262 | if( fossil_strcmp(zMime, "text/html")==0 ){ |
| 1263 | if( P("txt") ){ |
| 1264 | style_submenu_element("Html", "Html", |
| 1265 | "%s/artifact?name=%s", g.zTop, zUuid); |
| 1266 | }else{ |
| 1267 | renderAsHtml = 1; |
| 1268 | style_submenu_element("Text", "Text", |
| 1269 | "%s/artifact?name=%s&txt=1", g.zTop, zUuid); |
| 1270 | } |
| 1271 | }else if( fossil_strcmp(zMime, "application/x-fossil-wiki")==0 ){ |
| 1272 | if( P("txt") ){ |
| 1273 | style_submenu_element("Wiki", "Wiki", |
| 1274 | "%s/artifact?name=%s", g.zTop, zUuid); |
| 1275 | }else{ |
| 1276 | renderAsWiki = 1; |
| 1277 | style_submenu_element("Text", "Text", |
| 1278 | "%s/artifact?name=%s&txt=1", g.zTop, zUuid); |
| 1279 | } |
| 1280 | } |
| 1281 | } |
| 1282 | @ </p></blockquote> |
| 1283 | @ <hr /> |
| 1284 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -1213,12 +1213,18 @@ | |
| 1213 | } |
| 1214 | |
| 1215 | |
| 1216 | /* |
| 1217 | ** WEBPAGE: artifact |
| 1218 | ** URL: /artifact/ARTIFACTID |
| 1219 | ** URL: /artifact?ci=CHECKIN&filename=PATH |
| 1220 | ** |
| 1221 | ** Additional query parameters: |
| 1222 | ** |
| 1223 | ** ln - show line numbers |
| 1224 | ** ln=N - highlight line number N |
| 1225 | ** ln=M-N - highlight lines M through N inclusive |
| 1226 | ** |
| 1227 | ** Show the complete content of a file identified by ARTIFACTID |
| 1228 | ** as preformatted text. |
| 1229 | */ |
| 1230 | void artifact_page(void){ |
| @@ -1260,24 +1266,24 @@ | |
| 1266 | zMime = mimetype_from_name(blob_str(&downloadName)); |
| 1267 | if( zMime ){ |
| 1268 | if( fossil_strcmp(zMime, "text/html")==0 ){ |
| 1269 | if( P("txt") ){ |
| 1270 | style_submenu_element("Html", "Html", |
| 1271 | "%s/artifact/%s", g.zTop, zUuid); |
| 1272 | }else{ |
| 1273 | renderAsHtml = 1; |
| 1274 | style_submenu_element("Text", "Text", |
| 1275 | "%s/artifact/%s?txt=1", g.zTop, zUuid); |
| 1276 | } |
| 1277 | }else if( fossil_strcmp(zMime, "application/x-fossil-wiki")==0 ){ |
| 1278 | if( P("txt") ){ |
| 1279 | style_submenu_element("Wiki", "Wiki", |
| 1280 | "%s/artifact/%s", g.zTop, zUuid); |
| 1281 | }else{ |
| 1282 | renderAsWiki = 1; |
| 1283 | style_submenu_element("Text", "Text", |
| 1284 | "%s/artifact/%s?txt=1", g.zTop, zUuid); |
| 1285 | } |
| 1286 | } |
| 1287 | } |
| 1288 | @ </p></blockquote> |
| 1289 | @ <hr /> |
| 1290 |
+9
-3
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -105,10 +105,11 @@ | ||
| 105 | 105 | char *urlProxyAuth; /* Proxy-Authorizer: string */ |
| 106 | 106 | char *urlFossil; /* The path of the ?fossil=path suffix on ssh: */ |
| 107 | 107 | int dontKeepUrl; /* Do not persist the URL */ |
| 108 | 108 | |
| 109 | 109 | const char *zLogin; /* Login name. "" if not logged in. */ |
| 110 | + const char *zSSLIdentity; /* Value of --ssl-identity option, filename of SSL client identity */ | |
| 110 | 111 | int useLocalauth; /* No login required if from 127.0.0.1 */ |
| 111 | 112 | int noPswd; /* Logged in without password (on 127.0.0.1) */ |
| 112 | 113 | int userUid; /* Integer user id */ |
| 113 | 114 | |
| 114 | 115 | /* Information used to populate the RCVFROM table */ |
| @@ -251,10 +252,11 @@ | ||
| 251 | 252 | g.fSystemTrace = find_option("systemtrace", 0, 0)!=0; |
| 252 | 253 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| 253 | 254 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 254 | 255 | g.fHttpTrace = find_option("httptrace", 0, 0)!=0; |
| 255 | 256 | g.zLogin = find_option("user", "U", 1); |
| 257 | + g.zSSLIdentity = find_option("ssl-identity", 0, 1); | |
| 256 | 258 | if( find_option("help",0,0)!=0 ){ |
| 257 | 259 | /* --help anywhere on the command line is translated into |
| 258 | 260 | ** "fossil help argv[1] argv[2]..." */ |
| 259 | 261 | int i; |
| 260 | 262 | char **zNewArgv = fossil_malloc( sizeof(char*)*(g.argc+2) ); |
| @@ -644,11 +646,11 @@ | ||
| 644 | 646 | ** Usage: %fossil version |
| 645 | 647 | ** |
| 646 | 648 | ** Print the source code version number for the fossil executable. |
| 647 | 649 | */ |
| 648 | 650 | void version_cmd(void){ |
| 649 | - fossil_print("This is fossil version " | |
| 651 | + fossil_print("This is fossil version " RELEASE_VERSION " " | |
| 650 | 652 | MANIFEST_VERSION " " MANIFEST_DATE " UTC\n"); |
| 651 | 653 | } |
| 652 | 654 | |
| 653 | 655 | |
| 654 | 656 | /* |
| @@ -1102,11 +1104,12 @@ | ||
| 1102 | 1104 | if( blob_eq(&key, "HOME:") && blob_token(&line, &value) ){ |
| 1103 | 1105 | cgi_setenv("HOME", blob_str(&value)); |
| 1104 | 1106 | blob_reset(&value); |
| 1105 | 1107 | continue; |
| 1106 | 1108 | } |
| 1107 | - if( blob_eq(&key, "repository:") && blob_token(&line, &value) ){ | |
| 1109 | + if( blob_eq(&key, "repository:") && blob_tail(&line, &value) ){ | |
| 1110 | + blob_trim(&value); | |
| 1108 | 1111 | db_open_repository(blob_str(&value)); |
| 1109 | 1112 | blob_reset(&value); |
| 1110 | 1113 | continue; |
| 1111 | 1114 | } |
| 1112 | 1115 | if( blob_eq(&key, "directory:") && blob_token(&line, &value) ){ |
| @@ -1437,11 +1440,14 @@ | ||
| 1437 | 1440 | if( isUiCmd ){ |
| 1438 | 1441 | zBrowser = db_get("web-browser", "start"); |
| 1439 | 1442 | zBrowserCmd = mprintf("%s http://127.0.0.1:%%d/", zBrowser); |
| 1440 | 1443 | } |
| 1441 | 1444 | db_close(1); |
| 1442 | - win32_http_server(iPort, mxPort, zBrowserCmd, zStopperFile, zNotFound, flags); | |
| 1445 | + if( win32_http_service(iPort, zNotFound, flags) ){ | |
| 1446 | + win32_http_server(iPort, mxPort, zBrowserCmd, | |
| 1447 | + zStopperFile, zNotFound, flags); | |
| 1448 | + } | |
| 1443 | 1449 | #endif |
| 1444 | 1450 | } |
| 1445 | 1451 | |
| 1446 | 1452 | /* |
| 1447 | 1453 | ** COMMAND: test-echo |
| 1448 | 1454 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -105,10 +105,11 @@ | |
| 105 | char *urlProxyAuth; /* Proxy-Authorizer: string */ |
| 106 | char *urlFossil; /* The path of the ?fossil=path suffix on ssh: */ |
| 107 | int dontKeepUrl; /* Do not persist the URL */ |
| 108 | |
| 109 | const char *zLogin; /* Login name. "" if not logged in. */ |
| 110 | int useLocalauth; /* No login required if from 127.0.0.1 */ |
| 111 | int noPswd; /* Logged in without password (on 127.0.0.1) */ |
| 112 | int userUid; /* Integer user id */ |
| 113 | |
| 114 | /* Information used to populate the RCVFROM table */ |
| @@ -251,10 +252,11 @@ | |
| 251 | g.fSystemTrace = find_option("systemtrace", 0, 0)!=0; |
| 252 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| 253 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 254 | g.fHttpTrace = find_option("httptrace", 0, 0)!=0; |
| 255 | g.zLogin = find_option("user", "U", 1); |
| 256 | if( find_option("help",0,0)!=0 ){ |
| 257 | /* --help anywhere on the command line is translated into |
| 258 | ** "fossil help argv[1] argv[2]..." */ |
| 259 | int i; |
| 260 | char **zNewArgv = fossil_malloc( sizeof(char*)*(g.argc+2) ); |
| @@ -644,11 +646,11 @@ | |
| 644 | ** Usage: %fossil version |
| 645 | ** |
| 646 | ** Print the source code version number for the fossil executable. |
| 647 | */ |
| 648 | void version_cmd(void){ |
| 649 | fossil_print("This is fossil version " |
| 650 | MANIFEST_VERSION " " MANIFEST_DATE " UTC\n"); |
| 651 | } |
| 652 | |
| 653 | |
| 654 | /* |
| @@ -1102,11 +1104,12 @@ | |
| 1102 | if( blob_eq(&key, "HOME:") && blob_token(&line, &value) ){ |
| 1103 | cgi_setenv("HOME", blob_str(&value)); |
| 1104 | blob_reset(&value); |
| 1105 | continue; |
| 1106 | } |
| 1107 | if( blob_eq(&key, "repository:") && blob_token(&line, &value) ){ |
| 1108 | db_open_repository(blob_str(&value)); |
| 1109 | blob_reset(&value); |
| 1110 | continue; |
| 1111 | } |
| 1112 | if( blob_eq(&key, "directory:") && blob_token(&line, &value) ){ |
| @@ -1437,11 +1440,14 @@ | |
| 1437 | if( isUiCmd ){ |
| 1438 | zBrowser = db_get("web-browser", "start"); |
| 1439 | zBrowserCmd = mprintf("%s http://127.0.0.1:%%d/", zBrowser); |
| 1440 | } |
| 1441 | db_close(1); |
| 1442 | win32_http_server(iPort, mxPort, zBrowserCmd, zStopperFile, zNotFound, flags); |
| 1443 | #endif |
| 1444 | } |
| 1445 | |
| 1446 | /* |
| 1447 | ** COMMAND: test-echo |
| 1448 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -105,10 +105,11 @@ | |
| 105 | char *urlProxyAuth; /* Proxy-Authorizer: string */ |
| 106 | char *urlFossil; /* The path of the ?fossil=path suffix on ssh: */ |
| 107 | int dontKeepUrl; /* Do not persist the URL */ |
| 108 | |
| 109 | const char *zLogin; /* Login name. "" if not logged in. */ |
| 110 | const char *zSSLIdentity; /* Value of --ssl-identity option, filename of SSL client identity */ |
| 111 | int useLocalauth; /* No login required if from 127.0.0.1 */ |
| 112 | int noPswd; /* Logged in without password (on 127.0.0.1) */ |
| 113 | int userUid; /* Integer user id */ |
| 114 | |
| 115 | /* Information used to populate the RCVFROM table */ |
| @@ -251,10 +252,11 @@ | |
| 252 | g.fSystemTrace = find_option("systemtrace", 0, 0)!=0; |
| 253 | if( g.fSqlTrace ) g.fSqlStats = 1; |
| 254 | g.fSqlPrint = find_option("sqlprint", 0, 0)!=0; |
| 255 | g.fHttpTrace = find_option("httptrace", 0, 0)!=0; |
| 256 | g.zLogin = find_option("user", "U", 1); |
| 257 | g.zSSLIdentity = find_option("ssl-identity", 0, 1); |
| 258 | if( find_option("help",0,0)!=0 ){ |
| 259 | /* --help anywhere on the command line is translated into |
| 260 | ** "fossil help argv[1] argv[2]..." */ |
| 261 | int i; |
| 262 | char **zNewArgv = fossil_malloc( sizeof(char*)*(g.argc+2) ); |
| @@ -644,11 +646,11 @@ | |
| 646 | ** Usage: %fossil version |
| 647 | ** |
| 648 | ** Print the source code version number for the fossil executable. |
| 649 | */ |
| 650 | void version_cmd(void){ |
| 651 | fossil_print("This is fossil version " RELEASE_VERSION " " |
| 652 | MANIFEST_VERSION " " MANIFEST_DATE " UTC\n"); |
| 653 | } |
| 654 | |
| 655 | |
| 656 | /* |
| @@ -1102,11 +1104,12 @@ | |
| 1104 | if( blob_eq(&key, "HOME:") && blob_token(&line, &value) ){ |
| 1105 | cgi_setenv("HOME", blob_str(&value)); |
| 1106 | blob_reset(&value); |
| 1107 | continue; |
| 1108 | } |
| 1109 | if( blob_eq(&key, "repository:") && blob_tail(&line, &value) ){ |
| 1110 | blob_trim(&value); |
| 1111 | db_open_repository(blob_str(&value)); |
| 1112 | blob_reset(&value); |
| 1113 | continue; |
| 1114 | } |
| 1115 | if( blob_eq(&key, "directory:") && blob_token(&line, &value) ){ |
| @@ -1437,11 +1440,14 @@ | |
| 1440 | if( isUiCmd ){ |
| 1441 | zBrowser = db_get("web-browser", "start"); |
| 1442 | zBrowserCmd = mprintf("%s http://127.0.0.1:%%d/", zBrowser); |
| 1443 | } |
| 1444 | db_close(1); |
| 1445 | if( win32_http_service(iPort, zNotFound, flags) ){ |
| 1446 | win32_http_server(iPort, mxPort, zBrowserCmd, |
| 1447 | zStopperFile, zNotFound, flags); |
| 1448 | } |
| 1449 | #endif |
| 1450 | } |
| 1451 | |
| 1452 | /* |
| 1453 | ** COMMAND: test-echo |
| 1454 |
+16
-7
| --- src/main.mk | ||
| +++ src/main.mk | ||
| @@ -281,22 +281,31 @@ | ||
| 281 | 281 | $(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c |
| 282 | 282 | |
| 283 | 283 | $(OBJDIR)/mkindex: $(SRCDIR)/mkindex.c |
| 284 | 284 | $(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c |
| 285 | 285 | |
| 286 | +$(OBJDIR)/mkversion: $(SRCDIR)/mkversion.c | |
| 287 | + $(BCC) -o $(OBJDIR)/mkversion $(SRCDIR)/mkversion.c | |
| 288 | + | |
| 286 | 289 | # WARNING. DANGER. Running the testsuite modifies the repository the |
| 287 | 290 | # build is done from, i.e. the checkout belongs to. Do not sync/push |
| 288 | 291 | # the repository after running the tests. |
| 289 | 292 | test: $(APPNAME) |
| 290 | 293 | $(TCLSH) test/tester.tcl $(APPNAME) |
| 291 | 294 | |
| 292 | -$(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest | |
| 293 | - awk '{ printf "#define MANIFEST_UUID \"%s\"\n", $$1}' $(SRCDIR)/../manifest.uuid >$(OBJDIR)/VERSION.h | |
| 294 | - awk '{ printf "#define MANIFEST_VERSION \"[%.10s]\"\n", $$1}' $(SRCDIR)/../manifest.uuid >>$(OBJDIR)/VERSION.h | |
| 295 | - awk '$$1=="D"{printf "#define MANIFEST_DATE \"%s %s\"\n", substr($$2,1,10),substr($$2,12,8)}' $(SRCDIR)/../manifest >>$(OBJDIR)/VERSION.h | |
| 295 | +$(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION $(OBJDIR)/mkversion | |
| 296 | + $(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h | |
| 296 | 297 | |
| 297 | -EXTRAOBJ = $(OBJDIR)/sqlite3.o $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o | |
| 298 | +# The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set | |
| 299 | +# to 1. If it is set to 1, then there is no need to build or link | |
| 300 | +# the sqlite3.o object. Instead, the system sqlite will be linked | |
| 301 | +# using -lsqlite3. | |
| 302 | +SQLITE3_OBJ.1 = | |
| 303 | +SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o | |
| 304 | +SQLITE3_OBJ. = $(SQLITE3_OBJ.0) | |
| 305 | + | |
| 306 | +EXTRAOBJ = $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o | |
| 298 | 307 | |
| 299 | 308 | $(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) |
| 300 | 309 | $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) |
| 301 | 310 | |
| 302 | 311 | # This rule prevents make from using its default rules to try build |
| @@ -889,16 +898,16 @@ | ||
| 889 | 898 | $(OBJDIR)/zip.o: $(OBJDIR)/zip_.c $(OBJDIR)/zip.h $(SRCDIR)/config.h |
| 890 | 899 | $(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c |
| 891 | 900 | |
| 892 | 901 | $(OBJDIR)/zip.h: $(OBJDIR)/headers |
| 893 | 902 | $(OBJDIR)/sqlite3.o: $(SRCDIR)/sqlite3.c |
| 894 | - $(XTCC) -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_STAT2 -Dlocaltime=fossil_localtime -DSQLITE_ENABLE_LOCKING_STYLE=0 -c $(SRCDIR)/sqlite3.c -o $(OBJDIR)/sqlite3.o | |
| 903 | + $(XTCC) -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_STAT3 -Dlocaltime=fossil_localtime -DSQLITE_ENABLE_LOCKING_STYLE=0 -c $(SRCDIR)/sqlite3.c -o $(OBJDIR)/sqlite3.o | |
| 895 | 904 | |
| 896 | -$(OBJDIR)/shell.o: $(SRCDIR)/shell.c | |
| 905 | +$(OBJDIR)/shell.o: $(SRCDIR)/shell.c $(SRCDIR)/sqlite3.h | |
| 897 | 906 | $(XTCC) -Dmain=sqlite3_shell -DSQLITE_OMIT_LOAD_EXTENSION=1 -c $(SRCDIR)/shell.c -o $(OBJDIR)/shell.o |
| 898 | 907 | |
| 899 | 908 | $(OBJDIR)/th.o: $(SRCDIR)/th.c |
| 900 | 909 | $(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th.c -o $(OBJDIR)/th.o |
| 901 | 910 | |
| 902 | 911 | $(OBJDIR)/th_lang.o: $(SRCDIR)/th_lang.c |
| 903 | 912 | $(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th_lang.c -o $(OBJDIR)/th_lang.o |
| 904 | 913 | |
| 905 | 914 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -281,22 +281,31 @@ | |
| 281 | $(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c |
| 282 | |
| 283 | $(OBJDIR)/mkindex: $(SRCDIR)/mkindex.c |
| 284 | $(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c |
| 285 | |
| 286 | # WARNING. DANGER. Running the testsuite modifies the repository the |
| 287 | # build is done from, i.e. the checkout belongs to. Do not sync/push |
| 288 | # the repository after running the tests. |
| 289 | test: $(APPNAME) |
| 290 | $(TCLSH) test/tester.tcl $(APPNAME) |
| 291 | |
| 292 | $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest |
| 293 | awk '{ printf "#define MANIFEST_UUID \"%s\"\n", $$1}' $(SRCDIR)/../manifest.uuid >$(OBJDIR)/VERSION.h |
| 294 | awk '{ printf "#define MANIFEST_VERSION \"[%.10s]\"\n", $$1}' $(SRCDIR)/../manifest.uuid >>$(OBJDIR)/VERSION.h |
| 295 | awk '$$1=="D"{printf "#define MANIFEST_DATE \"%s %s\"\n", substr($$2,1,10),substr($$2,12,8)}' $(SRCDIR)/../manifest >>$(OBJDIR)/VERSION.h |
| 296 | |
| 297 | EXTRAOBJ = $(OBJDIR)/sqlite3.o $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o |
| 298 | |
| 299 | $(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) |
| 300 | $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) |
| 301 | |
| 302 | # This rule prevents make from using its default rules to try build |
| @@ -889,16 +898,16 @@ | |
| 889 | $(OBJDIR)/zip.o: $(OBJDIR)/zip_.c $(OBJDIR)/zip.h $(SRCDIR)/config.h |
| 890 | $(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c |
| 891 | |
| 892 | $(OBJDIR)/zip.h: $(OBJDIR)/headers |
| 893 | $(OBJDIR)/sqlite3.o: $(SRCDIR)/sqlite3.c |
| 894 | $(XTCC) -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_STAT2 -Dlocaltime=fossil_localtime -DSQLITE_ENABLE_LOCKING_STYLE=0 -c $(SRCDIR)/sqlite3.c -o $(OBJDIR)/sqlite3.o |
| 895 | |
| 896 | $(OBJDIR)/shell.o: $(SRCDIR)/shell.c |
| 897 | $(XTCC) -Dmain=sqlite3_shell -DSQLITE_OMIT_LOAD_EXTENSION=1 -c $(SRCDIR)/shell.c -o $(OBJDIR)/shell.o |
| 898 | |
| 899 | $(OBJDIR)/th.o: $(SRCDIR)/th.c |
| 900 | $(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th.c -o $(OBJDIR)/th.o |
| 901 | |
| 902 | $(OBJDIR)/th_lang.o: $(SRCDIR)/th_lang.c |
| 903 | $(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th_lang.c -o $(OBJDIR)/th_lang.o |
| 904 | |
| 905 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -281,22 +281,31 @@ | |
| 281 | $(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c |
| 282 | |
| 283 | $(OBJDIR)/mkindex: $(SRCDIR)/mkindex.c |
| 284 | $(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c |
| 285 | |
| 286 | $(OBJDIR)/mkversion: $(SRCDIR)/mkversion.c |
| 287 | $(BCC) -o $(OBJDIR)/mkversion $(SRCDIR)/mkversion.c |
| 288 | |
| 289 | # WARNING. DANGER. Running the testsuite modifies the repository the |
| 290 | # build is done from, i.e. the checkout belongs to. Do not sync/push |
| 291 | # the repository after running the tests. |
| 292 | test: $(APPNAME) |
| 293 | $(TCLSH) test/tester.tcl $(APPNAME) |
| 294 | |
| 295 | $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION $(OBJDIR)/mkversion |
| 296 | $(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h |
| 297 | |
| 298 | # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set |
| 299 | # to 1. If it is set to 1, then there is no need to build or link |
| 300 | # the sqlite3.o object. Instead, the system sqlite will be linked |
| 301 | # using -lsqlite3. |
| 302 | SQLITE3_OBJ.1 = |
| 303 | SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o |
| 304 | SQLITE3_OBJ. = $(SQLITE3_OBJ.0) |
| 305 | |
| 306 | EXTRAOBJ = $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o |
| 307 | |
| 308 | $(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) |
| 309 | $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) |
| 310 | |
| 311 | # This rule prevents make from using its default rules to try build |
| @@ -889,16 +898,16 @@ | |
| 898 | $(OBJDIR)/zip.o: $(OBJDIR)/zip_.c $(OBJDIR)/zip.h $(SRCDIR)/config.h |
| 899 | $(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c |
| 900 | |
| 901 | $(OBJDIR)/zip.h: $(OBJDIR)/headers |
| 902 | $(OBJDIR)/sqlite3.o: $(SRCDIR)/sqlite3.c |
| 903 | $(XTCC) -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_STAT3 -Dlocaltime=fossil_localtime -DSQLITE_ENABLE_LOCKING_STYLE=0 -c $(SRCDIR)/sqlite3.c -o $(OBJDIR)/sqlite3.o |
| 904 | |
| 905 | $(OBJDIR)/shell.o: $(SRCDIR)/shell.c $(SRCDIR)/sqlite3.h |
| 906 | $(XTCC) -Dmain=sqlite3_shell -DSQLITE_OMIT_LOAD_EXTENSION=1 -c $(SRCDIR)/shell.c -o $(OBJDIR)/shell.o |
| 907 | |
| 908 | $(OBJDIR)/th.o: $(SRCDIR)/th.c |
| 909 | $(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th.c -o $(OBJDIR)/th.o |
| 910 | |
| 911 | $(OBJDIR)/th_lang.o: $(SRCDIR)/th_lang.c |
| 912 | $(XTCC) -I$(SRCDIR) -c $(SRCDIR)/th_lang.c -o $(OBJDIR)/th_lang.o |
| 913 | |
| 914 |
+32
-25
| --- src/makemake.tcl | ||
| +++ src/makemake.tcl | ||
| @@ -176,27 +176,34 @@ | ||
| 176 | 176 | $(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c |
| 177 | 177 | |
| 178 | 178 | $(OBJDIR)/mkindex: $(SRCDIR)/mkindex.c |
| 179 | 179 | $(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c |
| 180 | 180 | |
| 181 | +$(OBJDIR)/mkversion: $(SRCDIR)/mkversion.c | |
| 182 | + $(BCC) -o $(OBJDIR)/mkversion $(SRCDIR)/mkversion.c | |
| 183 | + | |
| 181 | 184 | # WARNING. DANGER. Running the testsuite modifies the repository the |
| 182 | 185 | # build is done from, i.e. the checkout belongs to. Do not sync/push |
| 183 | 186 | # the repository after running the tests. |
| 184 | 187 | test: $(APPNAME) |
| 185 | 188 | $(TCLSH) test/tester.tcl $(APPNAME) |
| 186 | 189 | |
| 187 | -$(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest | |
| 188 | - awk '{ printf "#define MANIFEST_UUID \"%s\"\n", $$1}' \ | |
| 189 | - $(SRCDIR)/../manifest.uuid >$(OBJDIR)/VERSION.h | |
| 190 | - awk '{ printf "#define MANIFEST_VERSION \"[%.10s]\"\n", $$1}' \ | |
| 191 | - $(SRCDIR)/../manifest.uuid >>$(OBJDIR)/VERSION.h | |
| 192 | - awk '$$1=="D"{printf "#define MANIFEST_DATE \"%s %s\"\n",\ | |
| 193 | - substr($$2,1,10),substr($$2,12,8)}' \ | |
| 194 | - $(SRCDIR)/../manifest >>$(OBJDIR)/VERSION.h | |
| 190 | +$(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION $(OBJDIR)/mkversion | |
| 191 | + $(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid \ | |
| 192 | + $(SRCDIR)/../manifest \ | |
| 193 | + $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h | |
| 194 | + | |
| 195 | +# The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set | |
| 196 | +# to 1. If it is set to 1, then there is no need to build or link | |
| 197 | +# the sqlite3.o object. Instead, the system sqlite will be linked | |
| 198 | +# using -lsqlite3. | |
| 199 | +SQLITE3_OBJ.1 = | |
| 200 | +SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o | |
| 201 | +SQLITE3_OBJ. = $(SQLITE3_OBJ.0) | |
| 195 | 202 | |
| 196 | 203 | EXTRAOBJ = \ |
| 197 | - $(OBJDIR)/sqlite3.o \ | |
| 204 | + $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) \ | |
| 198 | 205 | $(OBJDIR)/shell.o \ |
| 199 | 206 | $(OBJDIR)/th.o \ |
| 200 | 207 | $(OBJDIR)/th_lang.o |
| 201 | 208 | |
| 202 | 209 | $(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) |
| @@ -241,17 +248,17 @@ | ||
| 241 | 248 | |
| 242 | 249 | writeln "\$(OBJDIR)/sqlite3.o:\t\$(SRCDIR)/sqlite3.c" |
| 243 | 250 | set opt {-DSQLITE_OMIT_LOAD_EXTENSION=1} |
| 244 | 251 | append opt " -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4" |
| 245 | 252 | #append opt " -DSQLITE_ENABLE_FTS3=1" |
| 246 | -append opt " -DSQLITE_ENABLE_STAT2" | |
| 253 | +append opt " -DSQLITE_ENABLE_STAT3" | |
| 247 | 254 | append opt " -Dlocaltime=fossil_localtime" |
| 248 | 255 | append opt " -DSQLITE_ENABLE_LOCKING_STYLE=0" |
| 249 | 256 | set SQLITE_OPTIONS $opt |
| 250 | 257 | writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/sqlite3.c -o \$(OBJDIR)/sqlite3.o\n" |
| 251 | 258 | |
| 252 | -writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c" | |
| 259 | +writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c \$(SRCDIR)/sqlite3.h" | |
| 253 | 260 | set opt {-Dmain=sqlite3_shell} |
| 254 | 261 | append opt " -DSQLITE_OMIT_LOAD_EXTENSION=1" |
| 255 | 262 | writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/shell.c -o \$(OBJDIR)/shell.o\n" |
| 256 | 263 | |
| 257 | 264 | writeln "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c" |
| @@ -389,21 +396,21 @@ | ||
| 389 | 396 | $(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c |
| 390 | 397 | |
| 391 | 398 | $(OBJDIR)/mkindex: $(SRCDIR)/mkindex.c |
| 392 | 399 | $(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c |
| 393 | 400 | |
| 394 | -$(VERSION): $(SRCDIR)/../win/version.c | |
| 395 | - $(BCC) -o $(OBJDIR)/version $(SRCDIR)/../win/version.c | |
| 401 | +$(VERSION): $(SRCDIR)/mkversion.c | |
| 402 | + $(BCC) -o $(OBJDIR)/version $(SRCDIR)/mkversion.c | |
| 396 | 403 | |
| 397 | 404 | # WARNING. DANGER. Running the testsuite modifies the repository the |
| 398 | 405 | # build is done from, i.e. the checkout belongs to. Do not sync/push |
| 399 | 406 | # the repository after running the tests. |
| 400 | 407 | test: $(APPNAME) |
| 401 | 408 | $(TCLSH) test/tester.tcl $(APPNAME) |
| 402 | 409 | |
| 403 | 410 | $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(VERSION) |
| 404 | - $(VERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest >$(OBJDIR)/VERSION.h | |
| 411 | + $(VERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h | |
| 405 | 412 | |
| 406 | 413 | EXTRAOBJ = \ |
| 407 | 414 | $(OBJDIR)/sqlite3.o \ |
| 408 | 415 | $(OBJDIR)/shell.o \ |
| 409 | 416 | $(OBJDIR)/th.o \ |
| @@ -459,11 +466,11 @@ | ||
| 459 | 466 | |
| 460 | 467 | writeln "\$(OBJDIR)/sqlite3.o:\t\$(SRCDIR)/sqlite3.c" |
| 461 | 468 | set opt $SQLITE_OPTIONS |
| 462 | 469 | writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/sqlite3.c -o \$(OBJDIR)/sqlite3.o\n" |
| 463 | 470 | |
| 464 | -writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c" | |
| 471 | +writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c \$(SRCDIR)/sqlite3.h" | |
| 465 | 472 | set opt {-Dmain=sqlite3_shell} |
| 466 | 473 | append opt " -DSQLITE_OMIT_LOAD_EXTENSION=1" |
| 467 | 474 | writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/shell.c -o \$(OBJDIR)/shell.o\n" |
| 468 | 475 | |
| 469 | 476 | writeln "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c" |
| @@ -556,11 +563,11 @@ | ||
| 556 | 563 | $(BCC) -o$@ $** |
| 557 | 564 | |
| 558 | 565 | mkindex$E: $(SRCDIR)\mkindex.c |
| 559 | 566 | $(BCC) -o$@ $** |
| 560 | 567 | |
| 561 | -version$E: $B\win\version.c | |
| 568 | +version$E: $B\src\mkversion.c | |
| 562 | 569 | $(BCC) -o$@ $** |
| 563 | 570 | |
| 564 | 571 | $(OBJDIR)\shell$O : $(SRCDIR)\shell.c |
| 565 | 572 | $(TCC) -o$@ -c -Dmain=sqlite3_shell $(SQLITE_OPTIONS) $** |
| 566 | 573 | |
| @@ -571,11 +578,11 @@ | ||
| 571 | 578 | $(TCC) -o$@ -c $** |
| 572 | 579 | |
| 573 | 580 | $(OBJDIR)\th_lang$O : $(SRCDIR)\th_lang.c |
| 574 | 581 | $(TCC) -o$@ -c $** |
| 575 | 582 | |
| 576 | -VERSION.h : version$E $B\manifest.uuid $B\manifest | |
| 583 | +VERSION.h : version$E $B\manifest.uuid $B\manifest $B\VERSION | |
| 577 | 584 | +$** > $@ |
| 578 | 585 | |
| 579 | 586 | page_index.h: mkindex$E $(SRC) |
| 580 | 587 | +$** > $@ |
| 581 | 588 | |
| @@ -582,11 +589,11 @@ | ||
| 582 | 589 | clean: |
| 583 | 590 | -del $(OBJDIR)\*.obj |
| 584 | 591 | -del *.obj *_.c *.h *.map |
| 585 | 592 | |
| 586 | 593 | realclean: |
| 587 | - -del $(APPNAME) translate$E mkindex$E makeheaders$E version$E | |
| 594 | + -del $(APPNAME) translate$E mkindex$E makeheaders$E mkversion$E | |
| 588 | 595 | |
| 589 | 596 | } |
| 590 | 597 | foreach s [lsort $src] { |
| 591 | 598 | writeln "\$(OBJDIR)\\$s\$O : ${s}_.c ${s}.h" |
| 592 | 599 | writeln "\t\$(TCC) -o\$@ -c ${s}_.c\n" |
| @@ -646,11 +653,11 @@ | ||
| 646 | 653 | INCL = -I. -I$(SRCDIR) -I$B\win\include -I$(MSCDIR)\extra\include -I$(ZINCDIR) |
| 647 | 654 | |
| 648 | 655 | CFLAGS = -nologo -MT -O2 |
| 649 | 656 | BCC = $(CC) $(CFLAGS) |
| 650 | 657 | TCC = $(CC) -c $(CFLAGS) $(MSCDEF) $(SSL) $(INCL) |
| 651 | -LIBS = $(ZLIB) ws2_32.lib $(SSLLIB) | |
| 658 | +LIBS = $(ZLIB) ws2_32.lib advapi32.lib $(SSLLIB) | |
| 652 | 659 | LIBDIR = -LIBPATH:$(MSCDIR)\extra\lib -LIBPATH:$(ZLIBDIR) |
| 653 | 660 | } |
| 654 | 661 | regsub -all {[-]D} $SQLITE_OPTIONS {/D} MSC_SQLITE_OPTIONS |
| 655 | 662 | writeln "SQLITE_OPTIONS = $MSC_SQLITE_OPTIONS\n" |
| 656 | 663 | writeln -nonewline "SRC = " |
| @@ -693,11 +700,11 @@ | ||
| 693 | 700 | $(BCC) $** |
| 694 | 701 | |
| 695 | 702 | mkindex$E: $(SRCDIR)\mkindex.c |
| 696 | 703 | $(BCC) $** |
| 697 | 704 | |
| 698 | -version$E: $B\win\version.c | |
| 705 | +mkversion$E: $B\src\mkversion.c | |
| 699 | 706 | $(BCC) $** |
| 700 | 707 | |
| 701 | 708 | $(OX)\shell$O : $(SRCDIR)\shell.c |
| 702 | 709 | $(TCC) /Fo$@ /Dmain=sqlite3_shell $(SQLITE_OPTIONS) -c $(SRCDIR)\shell.c |
| 703 | 710 | |
| @@ -708,11 +715,11 @@ | ||
| 708 | 715 | $(TCC) /Fo$@ -c $** |
| 709 | 716 | |
| 710 | 717 | $(OX)\th_lang$O : $(SRCDIR)\th_lang.c |
| 711 | 718 | $(TCC) /Fo$@ -c $** |
| 712 | 719 | |
| 713 | -VERSION.h : version$E $B\manifest.uuid $B\manifest | |
| 720 | +VERSION.h : mkversion$E $B\manifest.uuid $B\manifest $B\VERSION | |
| 714 | 721 | $** > $@ |
| 715 | 722 | |
| 716 | 723 | page_index.h: mkindex$E $(SRC) |
| 717 | 724 | $** > $@ |
| 718 | 725 | |
| @@ -720,11 +727,11 @@ | ||
| 720 | 727 | -del $(OX)\*.obj |
| 721 | 728 | -del *.obj *_.c *.h *.map |
| 722 | 729 | -del headers linkopts |
| 723 | 730 | |
| 724 | 731 | realclean: |
| 725 | - -del $(APPNAME) translate$E mkindex$E makeheaders$E version$E | |
| 732 | + -del $(APPNAME) translate$E mkindex$E makeheaders$E mkversion$E | |
| 726 | 733 | |
| 727 | 734 | } |
| 728 | 735 | foreach s [lsort $src] { |
| 729 | 736 | writeln "\$(OX)\\$s\$O : ${s}_.c ${s}.h" |
| 730 | 737 | writeln "\t\$(TCC) /Fo\$@ -c ${s}_.c\n" |
| @@ -880,11 +887,11 @@ | ||
| 880 | 887 | # compiling standard fossil utils |
| 881 | 888 | $(UTILS_OBJ): %.obj: $(SRCDIR)%.c |
| 882 | 889 | $(CC) $(CCFLAGS) $(INCLUDE) "$<" -Fo"$@" |
| 883 | 890 | |
| 884 | 891 | # compile special windows utils |
| 885 | -version.obj: $(WINDIR)version.c | |
| 892 | +version.obj: $(SRCDIR)mkversion.c | |
| 886 | 893 | $(CC) $(CCFLAGS) $(INCLUDE) "$<" -Fo"$@" |
| 887 | 894 | |
| 888 | 895 | # generate the translated c-source files |
| 889 | 896 | $(TRANSLATEDSRC): %_.c: $(SRCDIR)%.c translate.exe |
| 890 | 897 | translate.exe $< >$@ |
| @@ -892,12 +899,12 @@ | ||
| 892 | 899 | # generate the index source, containing all web references,.. |
| 893 | 900 | page_index.h: $(TRANSLATEDSRC) mkindex.exe |
| 894 | 901 | mkindex.exe $(TRANSLATEDSRC) >$@ |
| 895 | 902 | |
| 896 | 903 | # extracting version info from manifest |
| 897 | -VERSION.h: version.exe ..\manifest.uuid ..\manifest | |
| 898 | - version.exe ..\manifest.uuid ..\manifest > $@ | |
| 904 | +VERSION.h: version.exe ..\manifest.uuid ..\manifest ..\VERSION | |
| 905 | + version.exe ..\manifest.uuid ..\manifest ..\VERSION > $@ | |
| 899 | 906 | |
| 900 | 907 | # generate the simplified headers |
| 901 | 908 | headers: makeheaders.exe page_index.h VERSION.h ../src/sqlite3.h ../src/th.h VERSION.h |
| 902 | 909 | makeheaders.exe $(foreach ts,$(TRANSLATEDSRC),$(ts):$(ts:_.c=.h)) ../src/sqlite3.h ../src/th.h VERSION.h |
| 903 | 910 | echo Done >$@ |
| 904 | 911 |
| --- src/makemake.tcl | |
| +++ src/makemake.tcl | |
| @@ -176,27 +176,34 @@ | |
| 176 | $(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c |
| 177 | |
| 178 | $(OBJDIR)/mkindex: $(SRCDIR)/mkindex.c |
| 179 | $(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c |
| 180 | |
| 181 | # WARNING. DANGER. Running the testsuite modifies the repository the |
| 182 | # build is done from, i.e. the checkout belongs to. Do not sync/push |
| 183 | # the repository after running the tests. |
| 184 | test: $(APPNAME) |
| 185 | $(TCLSH) test/tester.tcl $(APPNAME) |
| 186 | |
| 187 | $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest |
| 188 | awk '{ printf "#define MANIFEST_UUID \"%s\"\n", $$1}' \ |
| 189 | $(SRCDIR)/../manifest.uuid >$(OBJDIR)/VERSION.h |
| 190 | awk '{ printf "#define MANIFEST_VERSION \"[%.10s]\"\n", $$1}' \ |
| 191 | $(SRCDIR)/../manifest.uuid >>$(OBJDIR)/VERSION.h |
| 192 | awk '$$1=="D"{printf "#define MANIFEST_DATE \"%s %s\"\n",\ |
| 193 | substr($$2,1,10),substr($$2,12,8)}' \ |
| 194 | $(SRCDIR)/../manifest >>$(OBJDIR)/VERSION.h |
| 195 | |
| 196 | EXTRAOBJ = \ |
| 197 | $(OBJDIR)/sqlite3.o \ |
| 198 | $(OBJDIR)/shell.o \ |
| 199 | $(OBJDIR)/th.o \ |
| 200 | $(OBJDIR)/th_lang.o |
| 201 | |
| 202 | $(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) |
| @@ -241,17 +248,17 @@ | |
| 241 | |
| 242 | writeln "\$(OBJDIR)/sqlite3.o:\t\$(SRCDIR)/sqlite3.c" |
| 243 | set opt {-DSQLITE_OMIT_LOAD_EXTENSION=1} |
| 244 | append opt " -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4" |
| 245 | #append opt " -DSQLITE_ENABLE_FTS3=1" |
| 246 | append opt " -DSQLITE_ENABLE_STAT2" |
| 247 | append opt " -Dlocaltime=fossil_localtime" |
| 248 | append opt " -DSQLITE_ENABLE_LOCKING_STYLE=0" |
| 249 | set SQLITE_OPTIONS $opt |
| 250 | writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/sqlite3.c -o \$(OBJDIR)/sqlite3.o\n" |
| 251 | |
| 252 | writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c" |
| 253 | set opt {-Dmain=sqlite3_shell} |
| 254 | append opt " -DSQLITE_OMIT_LOAD_EXTENSION=1" |
| 255 | writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/shell.c -o \$(OBJDIR)/shell.o\n" |
| 256 | |
| 257 | writeln "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c" |
| @@ -389,21 +396,21 @@ | |
| 389 | $(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c |
| 390 | |
| 391 | $(OBJDIR)/mkindex: $(SRCDIR)/mkindex.c |
| 392 | $(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c |
| 393 | |
| 394 | $(VERSION): $(SRCDIR)/../win/version.c |
| 395 | $(BCC) -o $(OBJDIR)/version $(SRCDIR)/../win/version.c |
| 396 | |
| 397 | # WARNING. DANGER. Running the testsuite modifies the repository the |
| 398 | # build is done from, i.e. the checkout belongs to. Do not sync/push |
| 399 | # the repository after running the tests. |
| 400 | test: $(APPNAME) |
| 401 | $(TCLSH) test/tester.tcl $(APPNAME) |
| 402 | |
| 403 | $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(VERSION) |
| 404 | $(VERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest >$(OBJDIR)/VERSION.h |
| 405 | |
| 406 | EXTRAOBJ = \ |
| 407 | $(OBJDIR)/sqlite3.o \ |
| 408 | $(OBJDIR)/shell.o \ |
| 409 | $(OBJDIR)/th.o \ |
| @@ -459,11 +466,11 @@ | |
| 459 | |
| 460 | writeln "\$(OBJDIR)/sqlite3.o:\t\$(SRCDIR)/sqlite3.c" |
| 461 | set opt $SQLITE_OPTIONS |
| 462 | writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/sqlite3.c -o \$(OBJDIR)/sqlite3.o\n" |
| 463 | |
| 464 | writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c" |
| 465 | set opt {-Dmain=sqlite3_shell} |
| 466 | append opt " -DSQLITE_OMIT_LOAD_EXTENSION=1" |
| 467 | writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/shell.c -o \$(OBJDIR)/shell.o\n" |
| 468 | |
| 469 | writeln "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c" |
| @@ -556,11 +563,11 @@ | |
| 556 | $(BCC) -o$@ $** |
| 557 | |
| 558 | mkindex$E: $(SRCDIR)\mkindex.c |
| 559 | $(BCC) -o$@ $** |
| 560 | |
| 561 | version$E: $B\win\version.c |
| 562 | $(BCC) -o$@ $** |
| 563 | |
| 564 | $(OBJDIR)\shell$O : $(SRCDIR)\shell.c |
| 565 | $(TCC) -o$@ -c -Dmain=sqlite3_shell $(SQLITE_OPTIONS) $** |
| 566 | |
| @@ -571,11 +578,11 @@ | |
| 571 | $(TCC) -o$@ -c $** |
| 572 | |
| 573 | $(OBJDIR)\th_lang$O : $(SRCDIR)\th_lang.c |
| 574 | $(TCC) -o$@ -c $** |
| 575 | |
| 576 | VERSION.h : version$E $B\manifest.uuid $B\manifest |
| 577 | +$** > $@ |
| 578 | |
| 579 | page_index.h: mkindex$E $(SRC) |
| 580 | +$** > $@ |
| 581 | |
| @@ -582,11 +589,11 @@ | |
| 582 | clean: |
| 583 | -del $(OBJDIR)\*.obj |
| 584 | -del *.obj *_.c *.h *.map |
| 585 | |
| 586 | realclean: |
| 587 | -del $(APPNAME) translate$E mkindex$E makeheaders$E version$E |
| 588 | |
| 589 | } |
| 590 | foreach s [lsort $src] { |
| 591 | writeln "\$(OBJDIR)\\$s\$O : ${s}_.c ${s}.h" |
| 592 | writeln "\t\$(TCC) -o\$@ -c ${s}_.c\n" |
| @@ -646,11 +653,11 @@ | |
| 646 | INCL = -I. -I$(SRCDIR) -I$B\win\include -I$(MSCDIR)\extra\include -I$(ZINCDIR) |
| 647 | |
| 648 | CFLAGS = -nologo -MT -O2 |
| 649 | BCC = $(CC) $(CFLAGS) |
| 650 | TCC = $(CC) -c $(CFLAGS) $(MSCDEF) $(SSL) $(INCL) |
| 651 | LIBS = $(ZLIB) ws2_32.lib $(SSLLIB) |
| 652 | LIBDIR = -LIBPATH:$(MSCDIR)\extra\lib -LIBPATH:$(ZLIBDIR) |
| 653 | } |
| 654 | regsub -all {[-]D} $SQLITE_OPTIONS {/D} MSC_SQLITE_OPTIONS |
| 655 | writeln "SQLITE_OPTIONS = $MSC_SQLITE_OPTIONS\n" |
| 656 | writeln -nonewline "SRC = " |
| @@ -693,11 +700,11 @@ | |
| 693 | $(BCC) $** |
| 694 | |
| 695 | mkindex$E: $(SRCDIR)\mkindex.c |
| 696 | $(BCC) $** |
| 697 | |
| 698 | version$E: $B\win\version.c |
| 699 | $(BCC) $** |
| 700 | |
| 701 | $(OX)\shell$O : $(SRCDIR)\shell.c |
| 702 | $(TCC) /Fo$@ /Dmain=sqlite3_shell $(SQLITE_OPTIONS) -c $(SRCDIR)\shell.c |
| 703 | |
| @@ -708,11 +715,11 @@ | |
| 708 | $(TCC) /Fo$@ -c $** |
| 709 | |
| 710 | $(OX)\th_lang$O : $(SRCDIR)\th_lang.c |
| 711 | $(TCC) /Fo$@ -c $** |
| 712 | |
| 713 | VERSION.h : version$E $B\manifest.uuid $B\manifest |
| 714 | $** > $@ |
| 715 | |
| 716 | page_index.h: mkindex$E $(SRC) |
| 717 | $** > $@ |
| 718 | |
| @@ -720,11 +727,11 @@ | |
| 720 | -del $(OX)\*.obj |
| 721 | -del *.obj *_.c *.h *.map |
| 722 | -del headers linkopts |
| 723 | |
| 724 | realclean: |
| 725 | -del $(APPNAME) translate$E mkindex$E makeheaders$E version$E |
| 726 | |
| 727 | } |
| 728 | foreach s [lsort $src] { |
| 729 | writeln "\$(OX)\\$s\$O : ${s}_.c ${s}.h" |
| 730 | writeln "\t\$(TCC) /Fo\$@ -c ${s}_.c\n" |
| @@ -880,11 +887,11 @@ | |
| 880 | # compiling standard fossil utils |
| 881 | $(UTILS_OBJ): %.obj: $(SRCDIR)%.c |
| 882 | $(CC) $(CCFLAGS) $(INCLUDE) "$<" -Fo"$@" |
| 883 | |
| 884 | # compile special windows utils |
| 885 | version.obj: $(WINDIR)version.c |
| 886 | $(CC) $(CCFLAGS) $(INCLUDE) "$<" -Fo"$@" |
| 887 | |
| 888 | # generate the translated c-source files |
| 889 | $(TRANSLATEDSRC): %_.c: $(SRCDIR)%.c translate.exe |
| 890 | translate.exe $< >$@ |
| @@ -892,12 +899,12 @@ | |
| 892 | # generate the index source, containing all web references,.. |
| 893 | page_index.h: $(TRANSLATEDSRC) mkindex.exe |
| 894 | mkindex.exe $(TRANSLATEDSRC) >$@ |
| 895 | |
| 896 | # extracting version info from manifest |
| 897 | VERSION.h: version.exe ..\manifest.uuid ..\manifest |
| 898 | version.exe ..\manifest.uuid ..\manifest > $@ |
| 899 | |
| 900 | # generate the simplified headers |
| 901 | headers: makeheaders.exe page_index.h VERSION.h ../src/sqlite3.h ../src/th.h VERSION.h |
| 902 | makeheaders.exe $(foreach ts,$(TRANSLATEDSRC),$(ts):$(ts:_.c=.h)) ../src/sqlite3.h ../src/th.h VERSION.h |
| 903 | echo Done >$@ |
| 904 |
| --- src/makemake.tcl | |
| +++ src/makemake.tcl | |
| @@ -176,27 +176,34 @@ | |
| 176 | $(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c |
| 177 | |
| 178 | $(OBJDIR)/mkindex: $(SRCDIR)/mkindex.c |
| 179 | $(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c |
| 180 | |
| 181 | $(OBJDIR)/mkversion: $(SRCDIR)/mkversion.c |
| 182 | $(BCC) -o $(OBJDIR)/mkversion $(SRCDIR)/mkversion.c |
| 183 | |
| 184 | # WARNING. DANGER. Running the testsuite modifies the repository the |
| 185 | # build is done from, i.e. the checkout belongs to. Do not sync/push |
| 186 | # the repository after running the tests. |
| 187 | test: $(APPNAME) |
| 188 | $(TCLSH) test/tester.tcl $(APPNAME) |
| 189 | |
| 190 | $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION $(OBJDIR)/mkversion |
| 191 | $(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid \ |
| 192 | $(SRCDIR)/../manifest \ |
| 193 | $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h |
| 194 | |
| 195 | # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set |
| 196 | # to 1. If it is set to 1, then there is no need to build or link |
| 197 | # the sqlite3.o object. Instead, the system sqlite will be linked |
| 198 | # using -lsqlite3. |
| 199 | SQLITE3_OBJ.1 = |
| 200 | SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o |
| 201 | SQLITE3_OBJ. = $(SQLITE3_OBJ.0) |
| 202 | |
| 203 | EXTRAOBJ = \ |
| 204 | $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) \ |
| 205 | $(OBJDIR)/shell.o \ |
| 206 | $(OBJDIR)/th.o \ |
| 207 | $(OBJDIR)/th_lang.o |
| 208 | |
| 209 | $(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) |
| @@ -241,17 +248,17 @@ | |
| 248 | |
| 249 | writeln "\$(OBJDIR)/sqlite3.o:\t\$(SRCDIR)/sqlite3.c" |
| 250 | set opt {-DSQLITE_OMIT_LOAD_EXTENSION=1} |
| 251 | append opt " -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4" |
| 252 | #append opt " -DSQLITE_ENABLE_FTS3=1" |
| 253 | append opt " -DSQLITE_ENABLE_STAT3" |
| 254 | append opt " -Dlocaltime=fossil_localtime" |
| 255 | append opt " -DSQLITE_ENABLE_LOCKING_STYLE=0" |
| 256 | set SQLITE_OPTIONS $opt |
| 257 | writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/sqlite3.c -o \$(OBJDIR)/sqlite3.o\n" |
| 258 | |
| 259 | writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c \$(SRCDIR)/sqlite3.h" |
| 260 | set opt {-Dmain=sqlite3_shell} |
| 261 | append opt " -DSQLITE_OMIT_LOAD_EXTENSION=1" |
| 262 | writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/shell.c -o \$(OBJDIR)/shell.o\n" |
| 263 | |
| 264 | writeln "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c" |
| @@ -389,21 +396,21 @@ | |
| 396 | $(BCC) -o $(OBJDIR)/makeheaders $(SRCDIR)/makeheaders.c |
| 397 | |
| 398 | $(OBJDIR)/mkindex: $(SRCDIR)/mkindex.c |
| 399 | $(BCC) -o $(OBJDIR)/mkindex $(SRCDIR)/mkindex.c |
| 400 | |
| 401 | $(VERSION): $(SRCDIR)/mkversion.c |
| 402 | $(BCC) -o $(OBJDIR)/version $(SRCDIR)/mkversion.c |
| 403 | |
| 404 | # WARNING. DANGER. Running the testsuite modifies the repository the |
| 405 | # build is done from, i.e. the checkout belongs to. Do not sync/push |
| 406 | # the repository after running the tests. |
| 407 | test: $(APPNAME) |
| 408 | $(TCLSH) test/tester.tcl $(APPNAME) |
| 409 | |
| 410 | $(OBJDIR)/VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(VERSION) |
| 411 | $(VERSION) $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h |
| 412 | |
| 413 | EXTRAOBJ = \ |
| 414 | $(OBJDIR)/sqlite3.o \ |
| 415 | $(OBJDIR)/shell.o \ |
| 416 | $(OBJDIR)/th.o \ |
| @@ -459,11 +466,11 @@ | |
| 466 | |
| 467 | writeln "\$(OBJDIR)/sqlite3.o:\t\$(SRCDIR)/sqlite3.c" |
| 468 | set opt $SQLITE_OPTIONS |
| 469 | writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/sqlite3.c -o \$(OBJDIR)/sqlite3.o\n" |
| 470 | |
| 471 | writeln "\$(OBJDIR)/shell.o:\t\$(SRCDIR)/shell.c \$(SRCDIR)/sqlite3.h" |
| 472 | set opt {-Dmain=sqlite3_shell} |
| 473 | append opt " -DSQLITE_OMIT_LOAD_EXTENSION=1" |
| 474 | writeln "\t\$(XTCC) $opt -c \$(SRCDIR)/shell.c -o \$(OBJDIR)/shell.o\n" |
| 475 | |
| 476 | writeln "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c" |
| @@ -556,11 +563,11 @@ | |
| 563 | $(BCC) -o$@ $** |
| 564 | |
| 565 | mkindex$E: $(SRCDIR)\mkindex.c |
| 566 | $(BCC) -o$@ $** |
| 567 | |
| 568 | version$E: $B\src\mkversion.c |
| 569 | $(BCC) -o$@ $** |
| 570 | |
| 571 | $(OBJDIR)\shell$O : $(SRCDIR)\shell.c |
| 572 | $(TCC) -o$@ -c -Dmain=sqlite3_shell $(SQLITE_OPTIONS) $** |
| 573 | |
| @@ -571,11 +578,11 @@ | |
| 578 | $(TCC) -o$@ -c $** |
| 579 | |
| 580 | $(OBJDIR)\th_lang$O : $(SRCDIR)\th_lang.c |
| 581 | $(TCC) -o$@ -c $** |
| 582 | |
| 583 | VERSION.h : version$E $B\manifest.uuid $B\manifest $B\VERSION |
| 584 | +$** > $@ |
| 585 | |
| 586 | page_index.h: mkindex$E $(SRC) |
| 587 | +$** > $@ |
| 588 | |
| @@ -582,11 +589,11 @@ | |
| 589 | clean: |
| 590 | -del $(OBJDIR)\*.obj |
| 591 | -del *.obj *_.c *.h *.map |
| 592 | |
| 593 | realclean: |
| 594 | -del $(APPNAME) translate$E mkindex$E makeheaders$E mkversion$E |
| 595 | |
| 596 | } |
| 597 | foreach s [lsort $src] { |
| 598 | writeln "\$(OBJDIR)\\$s\$O : ${s}_.c ${s}.h" |
| 599 | writeln "\t\$(TCC) -o\$@ -c ${s}_.c\n" |
| @@ -646,11 +653,11 @@ | |
| 653 | INCL = -I. -I$(SRCDIR) -I$B\win\include -I$(MSCDIR)\extra\include -I$(ZINCDIR) |
| 654 | |
| 655 | CFLAGS = -nologo -MT -O2 |
| 656 | BCC = $(CC) $(CFLAGS) |
| 657 | TCC = $(CC) -c $(CFLAGS) $(MSCDEF) $(SSL) $(INCL) |
| 658 | LIBS = $(ZLIB) ws2_32.lib advapi32.lib $(SSLLIB) |
| 659 | LIBDIR = -LIBPATH:$(MSCDIR)\extra\lib -LIBPATH:$(ZLIBDIR) |
| 660 | } |
| 661 | regsub -all {[-]D} $SQLITE_OPTIONS {/D} MSC_SQLITE_OPTIONS |
| 662 | writeln "SQLITE_OPTIONS = $MSC_SQLITE_OPTIONS\n" |
| 663 | writeln -nonewline "SRC = " |
| @@ -693,11 +700,11 @@ | |
| 700 | $(BCC) $** |
| 701 | |
| 702 | mkindex$E: $(SRCDIR)\mkindex.c |
| 703 | $(BCC) $** |
| 704 | |
| 705 | mkversion$E: $B\src\mkversion.c |
| 706 | $(BCC) $** |
| 707 | |
| 708 | $(OX)\shell$O : $(SRCDIR)\shell.c |
| 709 | $(TCC) /Fo$@ /Dmain=sqlite3_shell $(SQLITE_OPTIONS) -c $(SRCDIR)\shell.c |
| 710 | |
| @@ -708,11 +715,11 @@ | |
| 715 | $(TCC) /Fo$@ -c $** |
| 716 | |
| 717 | $(OX)\th_lang$O : $(SRCDIR)\th_lang.c |
| 718 | $(TCC) /Fo$@ -c $** |
| 719 | |
| 720 | VERSION.h : mkversion$E $B\manifest.uuid $B\manifest $B\VERSION |
| 721 | $** > $@ |
| 722 | |
| 723 | page_index.h: mkindex$E $(SRC) |
| 724 | $** > $@ |
| 725 | |
| @@ -720,11 +727,11 @@ | |
| 727 | -del $(OX)\*.obj |
| 728 | -del *.obj *_.c *.h *.map |
| 729 | -del headers linkopts |
| 730 | |
| 731 | realclean: |
| 732 | -del $(APPNAME) translate$E mkindex$E makeheaders$E mkversion$E |
| 733 | |
| 734 | } |
| 735 | foreach s [lsort $src] { |
| 736 | writeln "\$(OX)\\$s\$O : ${s}_.c ${s}.h" |
| 737 | writeln "\t\$(TCC) /Fo\$@ -c ${s}_.c\n" |
| @@ -880,11 +887,11 @@ | |
| 887 | # compiling standard fossil utils |
| 888 | $(UTILS_OBJ): %.obj: $(SRCDIR)%.c |
| 889 | $(CC) $(CCFLAGS) $(INCLUDE) "$<" -Fo"$@" |
| 890 | |
| 891 | # compile special windows utils |
| 892 | version.obj: $(SRCDIR)mkversion.c |
| 893 | $(CC) $(CCFLAGS) $(INCLUDE) "$<" -Fo"$@" |
| 894 | |
| 895 | # generate the translated c-source files |
| 896 | $(TRANSLATEDSRC): %_.c: $(SRCDIR)%.c translate.exe |
| 897 | translate.exe $< >$@ |
| @@ -892,12 +899,12 @@ | |
| 899 | # generate the index source, containing all web references,.. |
| 900 | page_index.h: $(TRANSLATEDSRC) mkindex.exe |
| 901 | mkindex.exe $(TRANSLATEDSRC) >$@ |
| 902 | |
| 903 | # extracting version info from manifest |
| 904 | VERSION.h: version.exe ..\manifest.uuid ..\manifest ..\VERSION |
| 905 | version.exe ..\manifest.uuid ..\manifest ..\VERSION > $@ |
| 906 | |
| 907 | # generate the simplified headers |
| 908 | headers: makeheaders.exe page_index.h VERSION.h ../src/sqlite3.h ../src/th.h VERSION.h |
| 909 | makeheaders.exe $(foreach ts,$(TRANSLATEDSRC),$(ts):$(ts:_.c=.h)) ../src/sqlite3.h ../src/th.h VERSION.h |
| 910 | echo Done >$@ |
| 911 |
+3
-4
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -1323,14 +1323,13 @@ | ||
| 1323 | 1323 | if( pChildFile ){ |
| 1324 | 1324 | add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0, |
| 1325 | 1325 | isPublic, manifest_file_mperm(pChildFile)); |
| 1326 | 1326 | } |
| 1327 | 1327 | } |
| 1328 | - }else if( pChild->zBaseline==0 && pParent->zBaseline!=0 ){ | |
| 1329 | - /* Parent is a delta but pChild is a baseline. Look for files that are | |
| 1330 | - ** present in pParent but which are missing from pChild and mark them | |
| 1331 | - ** has having been deleted. */ | |
| 1328 | + }else if( pChild->zBaseline==0 ){ | |
| 1329 | + /* pChild is a baseline. Look for files that are present in pParent | |
| 1330 | + ** but are missing from pChild and mark them as having been deleted. */ | |
| 1332 | 1331 | manifest_file_rewind(pParent); |
| 1333 | 1332 | while( (pParentFile = manifest_file_next(pParent,0))!=0 ){ |
| 1334 | 1333 | pChildFile = manifest_file_seek(pChild, pParentFile->zName); |
| 1335 | 1334 | if( pChildFile==0 && pParentFile->zUuid!=0 ){ |
| 1336 | 1335 | add_one_mlink(cid, pParentFile->zUuid, 0, pParentFile->zName, 0, |
| 1337 | 1336 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -1323,14 +1323,13 @@ | |
| 1323 | if( pChildFile ){ |
| 1324 | add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0, |
| 1325 | isPublic, manifest_file_mperm(pChildFile)); |
| 1326 | } |
| 1327 | } |
| 1328 | }else if( pChild->zBaseline==0 && pParent->zBaseline!=0 ){ |
| 1329 | /* Parent is a delta but pChild is a baseline. Look for files that are |
| 1330 | ** present in pParent but which are missing from pChild and mark them |
| 1331 | ** has having been deleted. */ |
| 1332 | manifest_file_rewind(pParent); |
| 1333 | while( (pParentFile = manifest_file_next(pParent,0))!=0 ){ |
| 1334 | pChildFile = manifest_file_seek(pChild, pParentFile->zName); |
| 1335 | if( pChildFile==0 && pParentFile->zUuid!=0 ){ |
| 1336 | add_one_mlink(cid, pParentFile->zUuid, 0, pParentFile->zName, 0, |
| 1337 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -1323,14 +1323,13 @@ | |
| 1323 | if( pChildFile ){ |
| 1324 | add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0, |
| 1325 | isPublic, manifest_file_mperm(pChildFile)); |
| 1326 | } |
| 1327 | } |
| 1328 | }else if( pChild->zBaseline==0 ){ |
| 1329 | /* pChild is a baseline. Look for files that are present in pParent |
| 1330 | ** but are missing from pChild and mark them as having been deleted. */ |
| 1331 | manifest_file_rewind(pParent); |
| 1332 | while( (pParentFile = manifest_file_next(pParent,0))!=0 ){ |
| 1333 | pChildFile = manifest_file_seek(pChild, pParentFile->zName); |
| 1334 | if( pChildFile==0 && pParentFile->zUuid!=0 ){ |
| 1335 | add_one_mlink(cid, pParentFile->zUuid, 0, pParentFile->zName, 0, |
| 1336 |
+10
-2
| --- src/merge.c | ||
| +++ src/merge.c | ||
| @@ -53,10 +53,14 @@ | ||
| 53 | 53 | ** and do not try to merge parallel changes. This |
| 54 | 54 | ** option overrides the "binary-glob" setting. |
| 55 | 55 | ** |
| 56 | 56 | ** --nochange | -n Dryrun: do not actually make any changes; just |
| 57 | 57 | ** show what would have happened. |
| 58 | +** | |
| 59 | +** --case-sensitive BOOL Overwrite the case-sensitive setting. If false, | |
| 60 | +** files whose names differ only in case are taken | |
| 61 | +** to be the same file. | |
| 58 | 62 | */ |
| 59 | 63 | void merge_cmd(void){ |
| 60 | 64 | int vid; /* Current version "V" */ |
| 61 | 65 | int mid; /* Version we are merging from "M" */ |
| 62 | 66 | int pid; /* The pivot version - most recent common ancestor P */ |
| @@ -69,10 +73,11 @@ | ||
| 69 | 73 | int debugFlag; /* True if --debug is present */ |
| 70 | 74 | int nChng; /* Number of file name changes */ |
| 71 | 75 | int *aChng; /* An array of file name changes */ |
| 72 | 76 | int i; /* Loop counter */ |
| 73 | 77 | int nConflict = 0; /* Number of conflicts seen */ |
| 78 | + int caseSensitive; /* True for case-sensitive filenames */ | |
| 74 | 79 | Stmt q; |
| 75 | 80 | |
| 76 | 81 | |
| 77 | 82 | /* Notation: |
| 78 | 83 | ** |
| @@ -87,14 +92,16 @@ | ||
| 87 | 92 | backoutFlag = find_option("backout",0,0)!=0; |
| 88 | 93 | debugFlag = find_option("debug",0,0)!=0; |
| 89 | 94 | zBinGlob = find_option("binary",0,1); |
| 90 | 95 | nochangeFlag = find_option("nochange","n",0)!=0; |
| 91 | 96 | zPivot = find_option("baseline",0,1); |
| 97 | + capture_case_sensitive_option(); | |
| 92 | 98 | if( g.argc!=3 ){ |
| 93 | 99 | usage("VERSION"); |
| 94 | 100 | } |
| 95 | 101 | db_must_be_within_tree(); |
| 102 | + caseSensitive = filenames_are_case_sensitive(); | |
| 96 | 103 | if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0); |
| 97 | 104 | vid = db_lget_int("checkout", 0); |
| 98 | 105 | if( vid==0 ){ |
| 99 | 106 | fossil_fatal("nothing is checked out"); |
| 100 | 107 | } |
| @@ -150,11 +157,11 @@ | ||
| 150 | 157 | ** in the current checkout, the pivot, and the version being merged. |
| 151 | 158 | */ |
| 152 | 159 | db_multi_exec( |
| 153 | 160 | "DROP TABLE IF EXISTS fv;" |
| 154 | 161 | "CREATE TEMP TABLE fv(" |
| 155 | - " fn TEXT PRIMARY KEY," /* The filename */ | |
| 162 | + " fn TEXT PRIMARY KEY COLLATE %s," /* The filename */ | |
| 156 | 163 | " idv INTEGER," /* VFILE entry for current version */ |
| 157 | 164 | " idp INTEGER," /* VFILE entry for the pivot */ |
| 158 | 165 | " idm INTEGER," /* VFILE entry for version merging in */ |
| 159 | 166 | " chnged BOOLEAN," /* True if current version has been edited */ |
| 160 | 167 | " ridv INTEGER," /* Record ID for current version */ |
| @@ -161,11 +168,12 @@ | ||
| 161 | 168 | " ridp INTEGER," /* Record ID for pivot */ |
| 162 | 169 | " ridm INTEGER," /* Record ID for merge */ |
| 163 | 170 | " isexe BOOLEAN," /* Execute permission enabled */ |
| 164 | 171 | " fnp TEXT," /* The filename in the pivot */ |
| 165 | 172 | " fnm TEXT" /* the filename in the merged version */ |
| 166 | - ");" | |
| 173 | + ");", | |
| 174 | + caseSensitive ? "binary" : "nocase" | |
| 167 | 175 | ); |
| 168 | 176 | |
| 169 | 177 | /* Add files found in V |
| 170 | 178 | */ |
| 171 | 179 | db_multi_exec( |
| 172 | 180 | |
| 173 | 181 | ADDED src/mkversion.c |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -53,10 +53,14 @@ | |
| 53 | ** and do not try to merge parallel changes. This |
| 54 | ** option overrides the "binary-glob" setting. |
| 55 | ** |
| 56 | ** --nochange | -n Dryrun: do not actually make any changes; just |
| 57 | ** show what would have happened. |
| 58 | */ |
| 59 | void merge_cmd(void){ |
| 60 | int vid; /* Current version "V" */ |
| 61 | int mid; /* Version we are merging from "M" */ |
| 62 | int pid; /* The pivot version - most recent common ancestor P */ |
| @@ -69,10 +73,11 @@ | |
| 69 | int debugFlag; /* True if --debug is present */ |
| 70 | int nChng; /* Number of file name changes */ |
| 71 | int *aChng; /* An array of file name changes */ |
| 72 | int i; /* Loop counter */ |
| 73 | int nConflict = 0; /* Number of conflicts seen */ |
| 74 | Stmt q; |
| 75 | |
| 76 | |
| 77 | /* Notation: |
| 78 | ** |
| @@ -87,14 +92,16 @@ | |
| 87 | backoutFlag = find_option("backout",0,0)!=0; |
| 88 | debugFlag = find_option("debug",0,0)!=0; |
| 89 | zBinGlob = find_option("binary",0,1); |
| 90 | nochangeFlag = find_option("nochange","n",0)!=0; |
| 91 | zPivot = find_option("baseline",0,1); |
| 92 | if( g.argc!=3 ){ |
| 93 | usage("VERSION"); |
| 94 | } |
| 95 | db_must_be_within_tree(); |
| 96 | if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0); |
| 97 | vid = db_lget_int("checkout", 0); |
| 98 | if( vid==0 ){ |
| 99 | fossil_fatal("nothing is checked out"); |
| 100 | } |
| @@ -150,11 +157,11 @@ | |
| 150 | ** in the current checkout, the pivot, and the version being merged. |
| 151 | */ |
| 152 | db_multi_exec( |
| 153 | "DROP TABLE IF EXISTS fv;" |
| 154 | "CREATE TEMP TABLE fv(" |
| 155 | " fn TEXT PRIMARY KEY," /* The filename */ |
| 156 | " idv INTEGER," /* VFILE entry for current version */ |
| 157 | " idp INTEGER," /* VFILE entry for the pivot */ |
| 158 | " idm INTEGER," /* VFILE entry for version merging in */ |
| 159 | " chnged BOOLEAN," /* True if current version has been edited */ |
| 160 | " ridv INTEGER," /* Record ID for current version */ |
| @@ -161,11 +168,12 @@ | |
| 161 | " ridp INTEGER," /* Record ID for pivot */ |
| 162 | " ridm INTEGER," /* Record ID for merge */ |
| 163 | " isexe BOOLEAN," /* Execute permission enabled */ |
| 164 | " fnp TEXT," /* The filename in the pivot */ |
| 165 | " fnm TEXT" /* the filename in the merged version */ |
| 166 | ");" |
| 167 | ); |
| 168 | |
| 169 | /* Add files found in V |
| 170 | */ |
| 171 | db_multi_exec( |
| 172 | |
| 173 | DDED src/mkversion.c |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -53,10 +53,14 @@ | |
| 53 | ** and do not try to merge parallel changes. This |
| 54 | ** option overrides the "binary-glob" setting. |
| 55 | ** |
| 56 | ** --nochange | -n Dryrun: do not actually make any changes; just |
| 57 | ** show what would have happened. |
| 58 | ** |
| 59 | ** --case-sensitive BOOL Overwrite the case-sensitive setting. If false, |
| 60 | ** files whose names differ only in case are taken |
| 61 | ** to be the same file. |
| 62 | */ |
| 63 | void merge_cmd(void){ |
| 64 | int vid; /* Current version "V" */ |
| 65 | int mid; /* Version we are merging from "M" */ |
| 66 | int pid; /* The pivot version - most recent common ancestor P */ |
| @@ -69,10 +73,11 @@ | |
| 73 | int debugFlag; /* True if --debug is present */ |
| 74 | int nChng; /* Number of file name changes */ |
| 75 | int *aChng; /* An array of file name changes */ |
| 76 | int i; /* Loop counter */ |
| 77 | int nConflict = 0; /* Number of conflicts seen */ |
| 78 | int caseSensitive; /* True for case-sensitive filenames */ |
| 79 | Stmt q; |
| 80 | |
| 81 | |
| 82 | /* Notation: |
| 83 | ** |
| @@ -87,14 +92,16 @@ | |
| 92 | backoutFlag = find_option("backout",0,0)!=0; |
| 93 | debugFlag = find_option("debug",0,0)!=0; |
| 94 | zBinGlob = find_option("binary",0,1); |
| 95 | nochangeFlag = find_option("nochange","n",0)!=0; |
| 96 | zPivot = find_option("baseline",0,1); |
| 97 | capture_case_sensitive_option(); |
| 98 | if( g.argc!=3 ){ |
| 99 | usage("VERSION"); |
| 100 | } |
| 101 | db_must_be_within_tree(); |
| 102 | caseSensitive = filenames_are_case_sensitive(); |
| 103 | if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0); |
| 104 | vid = db_lget_int("checkout", 0); |
| 105 | if( vid==0 ){ |
| 106 | fossil_fatal("nothing is checked out"); |
| 107 | } |
| @@ -150,11 +157,11 @@ | |
| 157 | ** in the current checkout, the pivot, and the version being merged. |
| 158 | */ |
| 159 | db_multi_exec( |
| 160 | "DROP TABLE IF EXISTS fv;" |
| 161 | "CREATE TEMP TABLE fv(" |
| 162 | " fn TEXT PRIMARY KEY COLLATE %s," /* The filename */ |
| 163 | " idv INTEGER," /* VFILE entry for current version */ |
| 164 | " idp INTEGER," /* VFILE entry for the pivot */ |
| 165 | " idm INTEGER," /* VFILE entry for version merging in */ |
| 166 | " chnged BOOLEAN," /* True if current version has been edited */ |
| 167 | " ridv INTEGER," /* Record ID for current version */ |
| @@ -161,11 +168,12 @@ | |
| 168 | " ridp INTEGER," /* Record ID for pivot */ |
| 169 | " ridm INTEGER," /* Record ID for merge */ |
| 170 | " isexe BOOLEAN," /* Execute permission enabled */ |
| 171 | " fnp TEXT," /* The filename in the pivot */ |
| 172 | " fnm TEXT" /* the filename in the merged version */ |
| 173 | ");", |
| 174 | caseSensitive ? "binary" : "nocase" |
| 175 | ); |
| 176 | |
| 177 | /* Add files found in V |
| 178 | */ |
| 179 | db_multi_exec( |
| 180 | |
| 181 | DDED src/mkversion.c |
+1
-6
| --- a/src/mkversion.c | ||
| +++ b/src/mkversion.c | ||
| @@ -1,10 +1,5 @@ | ||
| 1 | -fopen(argv[1],"gv[1],exists to do the job that AWK would do for the unix | |
| 2 | -** makefile - to extract information from the "mainfest" and "manifest.uuid" | |
| 3 | -** files for this p) | |
| 1 | +fopen(argv[1],"gv[1],"fMSC_VER) | |
| 4 | 2 | d = _MSC_VER / 1 return 0; |
| 5 | 3 | } |
| 6 | 4 | b2b2,0,sizeof(b2)strcpy(b2b2b2vx[1000]return 0; |
| 7 | 5 | } |
| 8 | -; | |
| 9 | - char b[1024b[strlen(b)-1] =0; return 0"gv[1],"fMSC_VER) | |
| 10 | - fopen(argv[1 |
| --- a/src/mkversion.c | |
| +++ b/src/mkversion.c | |
| @@ -1,10 +1,5 @@ | |
| 1 | fopen(argv[1],"gv[1],exists to do the job that AWK would do for the unix |
| 2 | ** makefile - to extract information from the "mainfest" and "manifest.uuid" |
| 3 | ** files for this p) |
| 4 | d = _MSC_VER / 1 return 0; |
| 5 | } |
| 6 | b2b2,0,sizeof(b2)strcpy(b2b2b2vx[1000]return 0; |
| 7 | } |
| 8 | ; |
| 9 | char b[1024b[strlen(b)-1] =0; return 0"gv[1],"fMSC_VER) |
| 10 | fopen(argv[1 |
| --- a/src/mkversion.c | |
| +++ b/src/mkversion.c | |
| @@ -1,10 +1,5 @@ | |
| 1 | fopen(argv[1],"gv[1],"fMSC_VER) |
| 2 | d = _MSC_VER / 1 return 0; |
| 3 | } |
| 4 | b2b2,0,sizeof(b2)strcpy(b2b2b2vx[1000]return 0; |
| 5 | } |
+5
| --- a/src/mkversion.c | ||
| +++ b/src/mkversion.c | ||
| @@ -0,0 +1,5 @@ | ||
| 1 | +fopen(argv[1],"gv[1],"fMSC_VER) | |
| 2 | + d = _MSC_VER / 1 return 0; | |
| 3 | +} | |
| 4 | +b2b2,0,sizeof(b2)strcpy(b2b2b2vx[1000]return 0; | |
| 5 | +} |
| --- a/src/mkversion.c | |
| +++ b/src/mkversion.c | |
| @@ -0,0 +1,5 @@ | |
| --- a/src/mkversion.c | |
| +++ b/src/mkversion.c | |
| @@ -0,0 +1,5 @@ | |
| 1 | fopen(argv[1],"gv[1],"fMSC_VER) |
| 2 | d = _MSC_VER / 1 return 0; |
| 3 | } |
| 4 | b2b2,0,sizeof(b2)strcpy(b2b2b2vx[1000]return 0; |
| 5 | } |
+6
-2
| --- src/popen.c | ||
| +++ src/popen.c | ||
| @@ -172,17 +172,21 @@ | ||
| 172 | 172 | close(pout[1]); |
| 173 | 173 | *pChildPid = 0; |
| 174 | 174 | return 1; |
| 175 | 175 | } |
| 176 | 176 | if( *pChildPid==0 ){ |
| 177 | + int fd; | |
| 178 | + int nErr = 0; | |
| 177 | 179 | /* This is the child process */ |
| 178 | 180 | close(0); |
| 179 | - dup(pout[0]); | |
| 181 | + fd = dup(pout[0]); | |
| 182 | + if( fd!=0 ) nErr++; | |
| 180 | 183 | close(pout[0]); |
| 181 | 184 | close(pout[1]); |
| 182 | 185 | close(1); |
| 183 | - dup(pin[1]); | |
| 186 | + fd = dup(pin[1]); | |
| 187 | + if( fd!=1 ) nErr++; | |
| 184 | 188 | close(pin[0]); |
| 185 | 189 | close(pin[1]); |
| 186 | 190 | execl("/bin/sh", "/bin/sh", "-c", zCmd, (char*)0); |
| 187 | 191 | return 1; |
| 188 | 192 | }else{ |
| 189 | 193 |
| --- src/popen.c | |
| +++ src/popen.c | |
| @@ -172,17 +172,21 @@ | |
| 172 | close(pout[1]); |
| 173 | *pChildPid = 0; |
| 174 | return 1; |
| 175 | } |
| 176 | if( *pChildPid==0 ){ |
| 177 | /* This is the child process */ |
| 178 | close(0); |
| 179 | dup(pout[0]); |
| 180 | close(pout[0]); |
| 181 | close(pout[1]); |
| 182 | close(1); |
| 183 | dup(pin[1]); |
| 184 | close(pin[0]); |
| 185 | close(pin[1]); |
| 186 | execl("/bin/sh", "/bin/sh", "-c", zCmd, (char*)0); |
| 187 | return 1; |
| 188 | }else{ |
| 189 |
| --- src/popen.c | |
| +++ src/popen.c | |
| @@ -172,17 +172,21 @@ | |
| 172 | close(pout[1]); |
| 173 | *pChildPid = 0; |
| 174 | return 1; |
| 175 | } |
| 176 | if( *pChildPid==0 ){ |
| 177 | int fd; |
| 178 | int nErr = 0; |
| 179 | /* This is the child process */ |
| 180 | close(0); |
| 181 | fd = dup(pout[0]); |
| 182 | if( fd!=0 ) nErr++; |
| 183 | close(pout[0]); |
| 184 | close(pout[1]); |
| 185 | close(1); |
| 186 | fd = dup(pin[1]); |
| 187 | if( fd!=1 ) nErr++; |
| 188 | close(pin[0]); |
| 189 | close(pin[1]); |
| 190 | execl("/bin/sh", "/bin/sh", "-c", zCmd, (char*)0); |
| 191 | return 1; |
| 192 | }else{ |
| 193 |
+1
-1
| --- src/printf.c | ||
| +++ src/printf.c | ||
| @@ -859,11 +859,11 @@ | ||
| 859 | 859 | int a, b; |
| 860 | 860 | do{ |
| 861 | 861 | a = *zA++; |
| 862 | 862 | b = *zB++; |
| 863 | 863 | }while( a==b && a!=0 ); |
| 864 | - return a - b; | |
| 864 | + return ((unsigned char)a) - (unsigned char)b; | |
| 865 | 865 | } |
| 866 | 866 | } |
| 867 | 867 | |
| 868 | 868 | /* |
| 869 | 869 | ** Case insensitive string comparison. |
| 870 | 870 |
| --- src/printf.c | |
| +++ src/printf.c | |
| @@ -859,11 +859,11 @@ | |
| 859 | int a, b; |
| 860 | do{ |
| 861 | a = *zA++; |
| 862 | b = *zB++; |
| 863 | }while( a==b && a!=0 ); |
| 864 | return a - b; |
| 865 | } |
| 866 | } |
| 867 | |
| 868 | /* |
| 869 | ** Case insensitive string comparison. |
| 870 |
| --- src/printf.c | |
| +++ src/printf.c | |
| @@ -859,11 +859,11 @@ | |
| 859 | int a, b; |
| 860 | do{ |
| 861 | a = *zA++; |
| 862 | b = *zB++; |
| 863 | }while( a==b && a!=0 ); |
| 864 | return ((unsigned char)a) - (unsigned char)b; |
| 865 | } |
| 866 | } |
| 867 | |
| 868 | /* |
| 869 | ** Case insensitive string comparison. |
| 870 |
+1
-1
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -882,11 +882,11 @@ | ||
| 882 | 882 | } |
| 883 | 883 | |
| 884 | 884 | /* |
| 885 | 885 | ** COMMAND: deconstruct |
| 886 | 886 | ** |
| 887 | -** Usage %fossil deconstruct ?OPTIONS? DESTIONATION | |
| 887 | +** Usage %fossil deconstruct ?OPTIONS? DESTINATION | |
| 888 | 888 | ** |
| 889 | 889 | ** Options: |
| 890 | 890 | ** -R|--repository REPOSITORY |
| 891 | 891 | ** -L|--prefixlength N |
| 892 | 892 | ** |
| 893 | 893 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -882,11 +882,11 @@ | |
| 882 | } |
| 883 | |
| 884 | /* |
| 885 | ** COMMAND: deconstruct |
| 886 | ** |
| 887 | ** Usage %fossil deconstruct ?OPTIONS? DESTIONATION |
| 888 | ** |
| 889 | ** Options: |
| 890 | ** -R|--repository REPOSITORY |
| 891 | ** -L|--prefixlength N |
| 892 | ** |
| 893 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -882,11 +882,11 @@ | |
| 882 | } |
| 883 | |
| 884 | /* |
| 885 | ** COMMAND: deconstruct |
| 886 | ** |
| 887 | ** Usage %fossil deconstruct ?OPTIONS? DESTINATION |
| 888 | ** |
| 889 | ** Options: |
| 890 | ** -R|--repository REPOSITORY |
| 891 | ** -L|--prefixlength N |
| 892 | ** |
| 893 |
+1
-1
| --- src/search.c | ||
| +++ src/search.c | ||
| @@ -203,8 +203,8 @@ | ||
| 203 | 203 | db_prepare(&q, |
| 204 | 204 | "SELECT rid, uuid, date, comment, 0, 0 FROM srch" |
| 205 | 205 | " WHERE x>%d ORDER BY x DESC, date DESC", |
| 206 | 206 | iBest/3 |
| 207 | 207 | ); |
| 208 | - print_timeline(&q, 1000); | |
| 208 | + print_timeline(&q, 1000, 0); | |
| 209 | 209 | db_finalize(&q); |
| 210 | 210 | } |
| 211 | 211 |
| --- src/search.c | |
| +++ src/search.c | |
| @@ -203,8 +203,8 @@ | |
| 203 | db_prepare(&q, |
| 204 | "SELECT rid, uuid, date, comment, 0, 0 FROM srch" |
| 205 | " WHERE x>%d ORDER BY x DESC, date DESC", |
| 206 | iBest/3 |
| 207 | ); |
| 208 | print_timeline(&q, 1000); |
| 209 | db_finalize(&q); |
| 210 | } |
| 211 |
| --- src/search.c | |
| +++ src/search.c | |
| @@ -203,8 +203,8 @@ | |
| 203 | db_prepare(&q, |
| 204 | "SELECT rid, uuid, date, comment, 0, 0 FROM srch" |
| 205 | " WHERE x>%d ORDER BY x DESC, date DESC", |
| 206 | iBest/3 |
| 207 | ); |
| 208 | print_timeline(&q, 1000, 0); |
| 209 | db_finalize(&q); |
| 210 | } |
| 211 |
+12
-2
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -1050,10 +1050,11 @@ | ||
| 1050 | 1050 | if( !g.okSetup ){ |
| 1051 | 1051 | login_needed(); |
| 1052 | 1052 | } |
| 1053 | 1053 | |
| 1054 | 1054 | style_header("Settings"); |
| 1055 | + db_open_local(); | |
| 1055 | 1056 | db_begin_transaction(); |
| 1056 | 1057 | @ <p>This page provides a simple interface to the "fossil setting" command. |
| 1057 | 1058 | @ See the "fossil help setting" output below for further information on |
| 1058 | 1059 | @ the meaning of each setting.</p><hr /> |
| 1059 | 1060 | @ <form action="%s(g.zTop)/setup_settings" method="post"><div> |
| @@ -1062,25 +1063,34 @@ | ||
| 1062 | 1063 | for(pSet=ctrlSettings; pSet->name!=0; pSet++){ |
| 1063 | 1064 | if( pSet->width==0 ){ |
| 1064 | 1065 | onoff_attribute(pSet->name, pSet->name, |
| 1065 | 1066 | pSet->var!=0 ? pSet->var : pSet->name, |
| 1066 | 1067 | is_truth(pSet->def)); |
| 1067 | - @ <br /> | |
| 1068 | + if( pSet->versionable ){ | |
| 1069 | + @ (v)<br /> | |
| 1070 | + } else { | |
| 1071 | + @ <br /> | |
| 1072 | + } | |
| 1068 | 1073 | } |
| 1069 | 1074 | } |
| 1070 | 1075 | @ </td><td style="width: 30;"></td><td valign="top"> |
| 1071 | 1076 | for(pSet=ctrlSettings; pSet->name!=0; pSet++){ |
| 1072 | 1077 | if( pSet->width!=0 ){ |
| 1073 | 1078 | entry_attribute(pSet->name, /*pSet->width*/ 40, pSet->name, |
| 1074 | 1079 | pSet->var!=0 ? pSet->var : pSet->name, |
| 1075 | 1080 | (char*)pSet->def); |
| 1076 | - @ <br /> | |
| 1081 | + if( pSet->versionable ){ | |
| 1082 | + @ (v)<br /> | |
| 1083 | + } else { | |
| 1084 | + @ <br /> | |
| 1085 | + } | |
| 1077 | 1086 | } |
| 1078 | 1087 | } |
| 1079 | 1088 | @ </td></tr></table> |
| 1080 | 1089 | @ <p><input type="submit" name="submit" value="Apply Changes" /></p> |
| 1081 | 1090 | @ </div></form> |
| 1091 | + @ <p>Settings marked with (v) are 'versionable' and will be overridden by the contents of files named <tt>.fossil-settings/PROPERTY</tt>.</p> | |
| 1082 | 1092 | @ <hr /><p> |
| 1083 | 1093 | @ These settings work in the same way, as the <kbd>set</kbd> commandline:<br /> |
| 1084 | 1094 | @ </p><pre>%s(zHelp_setting_cmd)</pre> |
| 1085 | 1095 | db_end_transaction(0); |
| 1086 | 1096 | style_footer(); |
| 1087 | 1097 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -1050,10 +1050,11 @@ | |
| 1050 | if( !g.okSetup ){ |
| 1051 | login_needed(); |
| 1052 | } |
| 1053 | |
| 1054 | style_header("Settings"); |
| 1055 | db_begin_transaction(); |
| 1056 | @ <p>This page provides a simple interface to the "fossil setting" command. |
| 1057 | @ See the "fossil help setting" output below for further information on |
| 1058 | @ the meaning of each setting.</p><hr /> |
| 1059 | @ <form action="%s(g.zTop)/setup_settings" method="post"><div> |
| @@ -1062,25 +1063,34 @@ | |
| 1062 | for(pSet=ctrlSettings; pSet->name!=0; pSet++){ |
| 1063 | if( pSet->width==0 ){ |
| 1064 | onoff_attribute(pSet->name, pSet->name, |
| 1065 | pSet->var!=0 ? pSet->var : pSet->name, |
| 1066 | is_truth(pSet->def)); |
| 1067 | @ <br /> |
| 1068 | } |
| 1069 | } |
| 1070 | @ </td><td style="width: 30;"></td><td valign="top"> |
| 1071 | for(pSet=ctrlSettings; pSet->name!=0; pSet++){ |
| 1072 | if( pSet->width!=0 ){ |
| 1073 | entry_attribute(pSet->name, /*pSet->width*/ 40, pSet->name, |
| 1074 | pSet->var!=0 ? pSet->var : pSet->name, |
| 1075 | (char*)pSet->def); |
| 1076 | @ <br /> |
| 1077 | } |
| 1078 | } |
| 1079 | @ </td></tr></table> |
| 1080 | @ <p><input type="submit" name="submit" value="Apply Changes" /></p> |
| 1081 | @ </div></form> |
| 1082 | @ <hr /><p> |
| 1083 | @ These settings work in the same way, as the <kbd>set</kbd> commandline:<br /> |
| 1084 | @ </p><pre>%s(zHelp_setting_cmd)</pre> |
| 1085 | db_end_transaction(0); |
| 1086 | style_footer(); |
| 1087 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -1050,10 +1050,11 @@ | |
| 1050 | if( !g.okSetup ){ |
| 1051 | login_needed(); |
| 1052 | } |
| 1053 | |
| 1054 | style_header("Settings"); |
| 1055 | db_open_local(); |
| 1056 | db_begin_transaction(); |
| 1057 | @ <p>This page provides a simple interface to the "fossil setting" command. |
| 1058 | @ See the "fossil help setting" output below for further information on |
| 1059 | @ the meaning of each setting.</p><hr /> |
| 1060 | @ <form action="%s(g.zTop)/setup_settings" method="post"><div> |
| @@ -1062,25 +1063,34 @@ | |
| 1063 | for(pSet=ctrlSettings; pSet->name!=0; pSet++){ |
| 1064 | if( pSet->width==0 ){ |
| 1065 | onoff_attribute(pSet->name, pSet->name, |
| 1066 | pSet->var!=0 ? pSet->var : pSet->name, |
| 1067 | is_truth(pSet->def)); |
| 1068 | if( pSet->versionable ){ |
| 1069 | @ (v)<br /> |
| 1070 | } else { |
| 1071 | @ <br /> |
| 1072 | } |
| 1073 | } |
| 1074 | } |
| 1075 | @ </td><td style="width: 30;"></td><td valign="top"> |
| 1076 | for(pSet=ctrlSettings; pSet->name!=0; pSet++){ |
| 1077 | if( pSet->width!=0 ){ |
| 1078 | entry_attribute(pSet->name, /*pSet->width*/ 40, pSet->name, |
| 1079 | pSet->var!=0 ? pSet->var : pSet->name, |
| 1080 | (char*)pSet->def); |
| 1081 | if( pSet->versionable ){ |
| 1082 | @ (v)<br /> |
| 1083 | } else { |
| 1084 | @ <br /> |
| 1085 | } |
| 1086 | } |
| 1087 | } |
| 1088 | @ </td></tr></table> |
| 1089 | @ <p><input type="submit" name="submit" value="Apply Changes" /></p> |
| 1090 | @ </div></form> |
| 1091 | @ <p>Settings marked with (v) are 'versionable' and will be overridden by the contents of files named <tt>.fossil-settings/PROPERTY</tt>.</p> |
| 1092 | @ <hr /><p> |
| 1093 | @ These settings work in the same way, as the <kbd>set</kbd> commandline:<br /> |
| 1094 | @ </p><pre>%s(zHelp_setting_cmd)</pre> |
| 1095 | db_end_transaction(0); |
| 1096 | style_footer(); |
| 1097 |
+3777
-1278
| --- 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.7.7. By combining all the individual C code files into this | |
| 3 | +** version 3.7.8. 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. |
| @@ -385,23 +385,29 @@ | ||
| 385 | 385 | /* |
| 386 | 386 | ** Exactly one of the following macros must be defined in order to |
| 387 | 387 | ** specify which memory allocation subsystem to use. |
| 388 | 388 | ** |
| 389 | 389 | ** SQLITE_SYSTEM_MALLOC // Use normal system malloc() |
| 390 | +** SQLITE_WIN32_MALLOC // Use Win32 native heap API | |
| 390 | 391 | ** SQLITE_MEMDEBUG // Debugging version of system malloc() |
| 392 | +** | |
| 393 | +** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the | |
| 394 | +** assert() macro is enabled, each call into the Win32 native heap subsystem | |
| 395 | +** will cause HeapValidate to be called. If heap validation should fail, an | |
| 396 | +** assertion will be triggered. | |
| 391 | 397 | ** |
| 392 | 398 | ** (Historical note: There used to be several other options, but we've |
| 393 | 399 | ** pared it down to just these two.) |
| 394 | 400 | ** |
| 395 | 401 | ** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as |
| 396 | 402 | ** the default. |
| 397 | 403 | */ |
| 398 | -#if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_MEMDEBUG)>1 | |
| 404 | +#if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_WIN32_MALLOC)+defined(SQLITE_MEMDEBUG)>1 | |
| 399 | 405 | # error "At most one of the following compile-time configuration options\ |
| 400 | - is allows: SQLITE_SYSTEM_MALLOC, SQLITE_MEMDEBUG" | |
| 406 | + is allows: SQLITE_SYSTEM_MALLOC, SQLITE_WIN32_MALLOC, SQLITE_MEMDEBUG" | |
| 401 | 407 | #endif |
| 402 | -#if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_MEMDEBUG)==0 | |
| 408 | +#if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_WIN32_MALLOC)+defined(SQLITE_MEMDEBUG)==0 | |
| 403 | 409 | # define SQLITE_SYSTEM_MALLOC 1 |
| 404 | 410 | #endif |
| 405 | 411 | |
| 406 | 412 | /* |
| 407 | 413 | ** If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the |
| @@ -648,13 +654,13 @@ | ||
| 648 | 654 | ** |
| 649 | 655 | ** See also: [sqlite3_libversion()], |
| 650 | 656 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 651 | 657 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 652 | 658 | */ |
| 653 | -#define SQLITE_VERSION "3.7.7" | |
| 654 | -#define SQLITE_VERSION_NUMBER 3007007 | |
| 655 | -#define SQLITE_SOURCE_ID "2011-06-15 13:11:06 f9750870ee04935f338e4d808900fee5a8b2b389" | |
| 659 | +#define SQLITE_VERSION "3.7.8" | |
| 660 | +#define SQLITE_VERSION_NUMBER 3007008 | |
| 661 | +#define SQLITE_SOURCE_ID "2011-08-29 11:56:14 639cc85a911454bffdcccb33f2976c683953ae64" | |
| 656 | 662 | |
| 657 | 663 | /* |
| 658 | 664 | ** CAPI3REF: Run-Time Library Version Numbers |
| 659 | 665 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 660 | 666 | ** |
| @@ -851,11 +857,11 @@ | ||
| 851 | 857 | ** semicolon-separate SQL statements passed into its 2nd argument, |
| 852 | 858 | ** in the context of the [database connection] passed in as its 1st |
| 853 | 859 | ** argument. ^If the callback function of the 3rd argument to |
| 854 | 860 | ** sqlite3_exec() is not NULL, then it is invoked for each result row |
| 855 | 861 | ** coming out of the evaluated SQL statements. ^The 4th argument to |
| 856 | -** to sqlite3_exec() is relayed through to the 1st argument of each | |
| 862 | +** sqlite3_exec() is relayed through to the 1st argument of each | |
| 857 | 863 | ** callback invocation. ^If the callback pointer to sqlite3_exec() |
| 858 | 864 | ** is NULL, then no callback is ever invoked and result rows are |
| 859 | 865 | ** ignored. |
| 860 | 866 | ** |
| 861 | 867 | ** ^If an error occurs while evaluating the SQL statements passed into |
| @@ -1282,20 +1288,52 @@ | ||
| 1282 | 1288 | ** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most |
| 1283 | 1289 | ** VFSes do not need this signal and should silently ignore this opcode. |
| 1284 | 1290 | ** Applications should not call [sqlite3_file_control()] with this |
| 1285 | 1291 | ** opcode as doing so may disrupt the operation of the specialized VFSes |
| 1286 | 1292 | ** that do require it. |
| 1293 | +** | |
| 1294 | +** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic | |
| 1295 | +** retry counts and intervals for certain disk I/O operations for the | |
| 1296 | +** windows [VFS] in order to work to provide robustness against | |
| 1297 | +** anti-virus programs. By default, the windows VFS will retry file read, | |
| 1298 | +** file write, and file delete opertions up to 10 times, with a delay | |
| 1299 | +** of 25 milliseconds before the first retry and with the delay increasing | |
| 1300 | +** by an additional 25 milliseconds with each subsequent retry. This | |
| 1301 | +** opcode allows those to values (10 retries and 25 milliseconds of delay) | |
| 1302 | +** to be adjusted. The values are changed for all database connections | |
| 1303 | +** within the same process. The argument is a pointer to an array of two | |
| 1304 | +** integers where the first integer i the new retry count and the second | |
| 1305 | +** integer is the delay. If either integer is negative, then the setting | |
| 1306 | +** is not changed but instead the prior value of that setting is written | |
| 1307 | +** into the array entry, allowing the current retry settings to be | |
| 1308 | +** interrogated. The zDbName parameter is ignored. | |
| 1309 | +** | |
| 1310 | +** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the | |
| 1311 | +** persistent [WAL | Write AHead Log] setting. By default, the auxiliary | |
| 1312 | +** write ahead log and shared memory files used for transaction control | |
| 1313 | +** are automatically deleted when the latest connection to the database | |
| 1314 | +** closes. Setting persistent WAL mode causes those files to persist after | |
| 1315 | +** close. Persisting the files is useful when other processes that do not | |
| 1316 | +** have write permission on the directory containing the database file want | |
| 1317 | +** to read the database file, as the WAL and shared memory files must exist | |
| 1318 | +** in order for the database to be readable. The fourth parameter to | |
| 1319 | +** [sqlite3_file_control()] for this opcode should be a pointer to an integer. | |
| 1320 | +** That integer is 0 to disable persistent WAL mode or 1 to enable persistent | |
| 1321 | +** WAL mode. If the integer is -1, then it is overwritten with the current | |
| 1322 | +** WAL persistence setting. | |
| 1323 | +** | |
| 1287 | 1324 | */ |
| 1288 | 1325 | #define SQLITE_FCNTL_LOCKSTATE 1 |
| 1289 | 1326 | #define SQLITE_GET_LOCKPROXYFILE 2 |
| 1290 | 1327 | #define SQLITE_SET_LOCKPROXYFILE 3 |
| 1291 | 1328 | #define SQLITE_LAST_ERRNO 4 |
| 1292 | 1329 | #define SQLITE_FCNTL_SIZE_HINT 5 |
| 1293 | 1330 | #define SQLITE_FCNTL_CHUNK_SIZE 6 |
| 1294 | 1331 | #define SQLITE_FCNTL_FILE_POINTER 7 |
| 1295 | 1332 | #define SQLITE_FCNTL_SYNC_OMITTED 8 |
| 1296 | - | |
| 1333 | +#define SQLITE_FCNTL_WIN32_AV_RETRY 9 | |
| 1334 | +#define SQLITE_FCNTL_PERSIST_WAL 10 | |
| 1297 | 1335 | |
| 1298 | 1336 | /* |
| 1299 | 1337 | ** CAPI3REF: Mutex Handle |
| 1300 | 1338 | ** |
| 1301 | 1339 | ** The mutex module within SQLite defines [sqlite3_mutex] to be an |
| @@ -1443,11 +1481,11 @@ | ||
| 1443 | 1481 | ** The xSleep() method causes the calling thread to sleep for at |
| 1444 | 1482 | ** least the number of microseconds given. ^The xCurrentTime() |
| 1445 | 1483 | ** method returns a Julian Day Number for the current date and time as |
| 1446 | 1484 | ** a floating point value. |
| 1447 | 1485 | ** ^The xCurrentTimeInt64() method returns, as an integer, the Julian |
| 1448 | -** Day Number multipled by 86400000 (the number of milliseconds in | |
| 1486 | +** Day Number multiplied by 86400000 (the number of milliseconds in | |
| 1449 | 1487 | ** a 24-hour day). |
| 1450 | 1488 | ** ^SQLite will use the xCurrentTimeInt64() method to get the current |
| 1451 | 1489 | ** date and time if that method is available (if iVersion is 2 or |
| 1452 | 1490 | ** greater and the function pointer is not NULL) and will fall back |
| 1453 | 1491 | ** to xCurrentTime() if xCurrentTimeInt64() is unavailable. |
| @@ -1719,20 +1757,14 @@ | ||
| 1719 | 1757 | ** also used during testing of SQLite in order to specify an alternative |
| 1720 | 1758 | ** memory allocator that simulates memory out-of-memory conditions in |
| 1721 | 1759 | ** order to verify that SQLite recovers gracefully from such |
| 1722 | 1760 | ** conditions. |
| 1723 | 1761 | ** |
| 1724 | -** The xMalloc and xFree methods must work like the | |
| 1725 | -** malloc() and free() functions from the standard C library. | |
| 1726 | -** The xRealloc method must work like realloc() from the standard C library | |
| 1727 | -** with the exception that if the second argument to xRealloc is zero, | |
| 1728 | -** xRealloc must be a no-op - it must not perform any allocation or | |
| 1729 | -** deallocation. ^SQLite guarantees that the second argument to | |
| 1762 | +** The xMalloc, xRealloc, and xFree methods must work like the | |
| 1763 | +** malloc(), realloc() and free() functions from the standard C library. | |
| 1764 | +** ^SQLite guarantees that the second argument to | |
| 1730 | 1765 | ** xRealloc is always a value returned by a prior call to xRoundup. |
| 1731 | -** And so in cases where xRoundup always returns a positive number, | |
| 1732 | -** xRealloc can perform exactly as the standard library realloc() and | |
| 1733 | -** still be in compliance with this specification. | |
| 1734 | 1766 | ** |
| 1735 | 1767 | ** xSize should return the allocated size of a memory allocation |
| 1736 | 1768 | ** previously obtained from xMalloc or xRealloc. The allocated size |
| 1737 | 1769 | ** is always at least as big as the requested size but may be larger. |
| 1738 | 1770 | ** |
| @@ -1881,11 +1913,11 @@ | ||
| 1881 | 1913 | ** scratch memory beyond what is provided by this configuration option, then |
| 1882 | 1914 | ** [sqlite3_malloc()] will be used to obtain the memory needed.</dd> |
| 1883 | 1915 | ** |
| 1884 | 1916 | ** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt> |
| 1885 | 1917 | ** <dd> ^This option specifies a static memory buffer that SQLite can use for |
| 1886 | -** the database page cache with the default page cache implemenation. | |
| 1918 | +** the database page cache with the default page cache implementation. | |
| 1887 | 1919 | ** This configuration should not be used if an application-define page |
| 1888 | 1920 | ** cache implementation is loaded using the SQLITE_CONFIG_PCACHE option. |
| 1889 | 1921 | ** There are three arguments to this option: A pointer to 8-byte aligned |
| 1890 | 1922 | ** memory, the size of each page buffer (sz), and the number of pages (N). |
| 1891 | 1923 | ** The sz argument should be the size of the largest database page |
| @@ -2979,16 +3011,16 @@ | ||
| 2979 | 3011 | ** [[URI filenames in sqlite3_open()]] <h3>URI Filenames</h3> |
| 2980 | 3012 | ** |
| 2981 | 3013 | ** ^If [URI filename] interpretation is enabled, and the filename argument |
| 2982 | 3014 | ** begins with "file:", then the filename is interpreted as a URI. ^URI |
| 2983 | 3015 | ** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is |
| 2984 | -** is set in the fourth argument to sqlite3_open_v2(), or if it has | |
| 3016 | +** set in the fourth argument to sqlite3_open_v2(), or if it has | |
| 2985 | 3017 | ** been enabled globally using the [SQLITE_CONFIG_URI] option with the |
| 2986 | 3018 | ** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option. |
| 2987 | 3019 | ** As of SQLite version 3.7.7, URI filename interpretation is turned off |
| 2988 | 3020 | ** by default, but future releases of SQLite might enable URI filename |
| 2989 | -** intepretation by default. See "[URI filenames]" for additional | |
| 3021 | +** interpretation by default. See "[URI filenames]" for additional | |
| 2990 | 3022 | ** information. |
| 2991 | 3023 | ** |
| 2992 | 3024 | ** URI filenames are parsed according to RFC 3986. ^If the URI contains an |
| 2993 | 3025 | ** authority, then it must be either an empty string or the string |
| 2994 | 3026 | ** "localhost". ^If the authority is not an empty string or "localhost", an |
| @@ -3803,11 +3835,11 @@ | ||
| 3803 | 3835 | ** [extended result codes] might be returned as well. |
| 3804 | 3836 | ** |
| 3805 | 3837 | ** ^[SQLITE_BUSY] means that the database engine was unable to acquire the |
| 3806 | 3838 | ** database locks it needs to do its job. ^If the statement is a [COMMIT] |
| 3807 | 3839 | ** or occurs outside of an explicit transaction, then you can retry the |
| 3808 | -** statement. If the statement is not a [COMMIT] and occurs within a | |
| 3840 | +** statement. If the statement is not a [COMMIT] and occurs within an | |
| 3809 | 3841 | ** explicit transaction then you should rollback the transaction before |
| 3810 | 3842 | ** continuing. |
| 3811 | 3843 | ** |
| 3812 | 3844 | ** ^[SQLITE_DONE] means that the statement has finished executing |
| 3813 | 3845 | ** successfully. sqlite3_step() should not be called again on this virtual |
| @@ -4082,11 +4114,11 @@ | ||
| 4082 | 4114 | |
| 4083 | 4115 | /* |
| 4084 | 4116 | ** CAPI3REF: Destroy A Prepared Statement Object |
| 4085 | 4117 | ** |
| 4086 | 4118 | ** ^The sqlite3_finalize() function is called to delete a [prepared statement]. |
| 4087 | -** ^If the most recent evaluation of the statement encountered no errors or | |
| 4119 | +** ^If the most recent evaluation of the statement encountered no errors | |
| 4088 | 4120 | ** or if the statement is never been evaluated, then sqlite3_finalize() returns |
| 4089 | 4121 | ** SQLITE_OK. ^If the most recent evaluation of statement S failed, then |
| 4090 | 4122 | ** sqlite3_finalize(S) returns the appropriate [error code] or |
| 4091 | 4123 | ** [extended error code]. |
| 4092 | 4124 | ** |
| @@ -5996,11 +6028,11 @@ | ||
| 5996 | 6028 | ** versions of these routines, it should at least provide stubs that always |
| 5997 | 6029 | ** return true so that one does not get spurious assertion failures. |
| 5998 | 6030 | ** |
| 5999 | 6031 | ** ^If the argument to sqlite3_mutex_held() is a NULL pointer then |
| 6000 | 6032 | ** the routine should return 1. This seems counter-intuitive since |
| 6001 | -** clearly the mutex cannot be held if it does not exist. But the | |
| 6033 | +** clearly the mutex cannot be held if it does not exist. But | |
| 6002 | 6034 | ** the reason the mutex does not exist is because the build is not |
| 6003 | 6035 | ** using mutexes. And we do not want the assert() containing the |
| 6004 | 6036 | ** call to sqlite3_mutex_held() to fail, so a non-zero return is |
| 6005 | 6037 | ** the appropriate thing to do. ^The sqlite3_mutex_notheld() |
| 6006 | 6038 | ** interface should also return 1 when given a NULL pointer. |
| @@ -6119,11 +6151,12 @@ | ||
| 6119 | 6151 | #define SQLITE_TESTCTRL_RESERVE 14 |
| 6120 | 6152 | #define SQLITE_TESTCTRL_OPTIMIZATIONS 15 |
| 6121 | 6153 | #define SQLITE_TESTCTRL_ISKEYWORD 16 |
| 6122 | 6154 | #define SQLITE_TESTCTRL_PGHDRSZ 17 |
| 6123 | 6155 | #define SQLITE_TESTCTRL_SCRATCHMALLOC 18 |
| 6124 | -#define SQLITE_TESTCTRL_LAST 18 | |
| 6156 | +#define SQLITE_TESTCTRL_LOCALTIME_FAULT 19 | |
| 6157 | +#define SQLITE_TESTCTRL_LAST 19 | |
| 6125 | 6158 | |
| 6126 | 6159 | /* |
| 6127 | 6160 | ** CAPI3REF: SQLite Runtime Status |
| 6128 | 6161 | ** |
| 6129 | 6162 | ** ^This interface is used to retrieve runtime status information |
| @@ -6505,11 +6538,11 @@ | ||
| 6505 | 6538 | ** [[the xFetch() page cache methods]] |
| 6506 | 6539 | ** The xFetch() method locates a page in the cache and returns a pointer to |
| 6507 | 6540 | ** the page, or a NULL pointer. |
| 6508 | 6541 | ** A "page", in this context, means a buffer of szPage bytes aligned at an |
| 6509 | 6542 | ** 8-byte boundary. The page to be fetched is determined by the key. ^The |
| 6510 | -** mimimum key value is 1. After it has been retrieved using xFetch, the page | |
| 6543 | +** minimum key value is 1. After it has been retrieved using xFetch, the page | |
| 6511 | 6544 | ** is considered to be "pinned". |
| 6512 | 6545 | ** |
| 6513 | 6546 | ** If the requested page is already in the page cache, then the page cache |
| 6514 | 6547 | ** implementation must return a pointer to the page buffer with its content |
| 6515 | 6548 | ** intact. If the requested page is not already in the cache, then the |
| @@ -7599,10 +7632,18 @@ | ||
| 7599 | 7632 | */ |
| 7600 | 7633 | #ifndef SQLITE_TEMP_STORE |
| 7601 | 7634 | # define SQLITE_TEMP_STORE 1 |
| 7602 | 7635 | #endif |
| 7603 | 7636 | |
| 7637 | +/* | |
| 7638 | +** If all temporary storage is in-memory, then omit the external merge-sort | |
| 7639 | +** logic since it is superfluous. | |
| 7640 | +*/ | |
| 7641 | +#if SQLITE_TEMP_STORE==3 && !defined(SQLITE_OMIT_MERGE_SORT) | |
| 7642 | +# define SQLITE_OMIT_MERGE_SORT | |
| 7643 | +#endif | |
| 7644 | + | |
| 7604 | 7645 | /* |
| 7605 | 7646 | ** GCC does not define the offsetof() macro so we'll have to do it |
| 7606 | 7647 | ** ourselves. |
| 7607 | 7648 | */ |
| 7608 | 7649 | #ifndef offsetof |
| @@ -7941,10 +7982,11 @@ | ||
| 7941 | 7982 | #define BTREE_OMIT_JOURNAL 1 /* Do not create or use a rollback journal */ |
| 7942 | 7983 | #define BTREE_NO_READLOCK 2 /* Omit readlocks on readonly files */ |
| 7943 | 7984 | #define BTREE_MEMORY 4 /* This is an in-memory DB */ |
| 7944 | 7985 | #define BTREE_SINGLE 8 /* The file contains at most 1 b-tree */ |
| 7945 | 7986 | #define BTREE_UNORDERED 16 /* Use of a hash implementation is OK */ |
| 7987 | +#define BTREE_SORTER 32 /* Used as accumulator in external merge sort */ | |
| 7946 | 7988 | |
| 7947 | 7989 | SQLITE_PRIVATE int sqlite3BtreeClose(Btree*); |
| 7948 | 7990 | SQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree*,int); |
| 7949 | 7991 | SQLITE_PRIVATE int sqlite3BtreeSetSafetyLevel(Btree*,int,int,int); |
| 7950 | 7992 | SQLITE_PRIVATE int sqlite3BtreeSyncDisabled(Btree*); |
| @@ -8143,10 +8185,11 @@ | ||
| 8143 | 8185 | ** or VDBE. The VDBE implements an abstract machine that runs a |
| 8144 | 8186 | ** simple program to access and modify the underlying database. |
| 8145 | 8187 | */ |
| 8146 | 8188 | #ifndef _SQLITE_VDBE_H_ |
| 8147 | 8189 | #define _SQLITE_VDBE_H_ |
| 8190 | +/* #include <stdio.h> */ | |
| 8148 | 8191 | |
| 8149 | 8192 | /* |
| 8150 | 8193 | ** A single VDBE is an opaque structure named "Vdbe". Only routines |
| 8151 | 8194 | ** in the source file sqliteVdbe.c are allowed to see the insides |
| 8152 | 8195 | ** of this structure. |
| @@ -8186,10 +8229,11 @@ | ||
| 8186 | 8229 | Mem *pMem; /* Used when p4type is P4_MEM */ |
| 8187 | 8230 | VTable *pVtab; /* Used when p4type is P4_VTAB */ |
| 8188 | 8231 | KeyInfo *pKeyInfo; /* Used when p4type is P4_KEYINFO */ |
| 8189 | 8232 | int *ai; /* Used when p4type is P4_INTARRAY */ |
| 8190 | 8233 | SubProgram *pProgram; /* Used when p4type is P4_SUBPROGRAM */ |
| 8234 | + int (*xAdvance)(BtCursor *, int *); | |
| 8191 | 8235 | } p4; |
| 8192 | 8236 | #ifdef SQLITE_DEBUG |
| 8193 | 8237 | char *zComment; /* Comment to improve readability */ |
| 8194 | 8238 | #endif |
| 8195 | 8239 | #ifdef VDBE_PROFILE |
| @@ -8241,10 +8285,11 @@ | ||
| 8241 | 8285 | #define P4_REAL (-12) /* P4 is a 64-bit floating point value */ |
| 8242 | 8286 | #define P4_INT64 (-13) /* P4 is a 64-bit signed integer */ |
| 8243 | 8287 | #define P4_INT32 (-14) /* P4 is a 32-bit signed integer */ |
| 8244 | 8288 | #define P4_INTARRAY (-15) /* P4 is a vector of 32-bit integers */ |
| 8245 | 8289 | #define P4_SUBPROGRAM (-18) /* P4 is a pointer to a SubProgram structure */ |
| 8290 | +#define P4_ADVANCE (-19) /* P4 is a pointer to BtreeNext() or BtreePrev() */ | |
| 8246 | 8291 | |
| 8247 | 8292 | /* When adding a P4 argument using P4_KEYINFO, a copy of the KeyInfo structure |
| 8248 | 8293 | ** is made. That copy is freed when the Vdbe is finalized. But if the |
| 8249 | 8294 | ** argument is P4_KEYINFO_HANDOFF, the passed in pointer is used. It still |
| 8250 | 8295 | ** gets freed when the Vdbe is finalized so it still should be obtained |
| @@ -8354,89 +8399,89 @@ | ||
| 8354 | 8399 | #define OP_ReadCookie 35 |
| 8355 | 8400 | #define OP_SetCookie 36 |
| 8356 | 8401 | #define OP_VerifyCookie 37 |
| 8357 | 8402 | #define OP_OpenRead 38 |
| 8358 | 8403 | #define OP_OpenWrite 39 |
| 8359 | -#define OP_OpenAutoindex 40 | |
| 8360 | -#define OP_OpenEphemeral 41 | |
| 8361 | -#define OP_OpenPseudo 42 | |
| 8362 | -#define OP_Close 43 | |
| 8363 | -#define OP_SeekLt 44 | |
| 8364 | -#define OP_SeekLe 45 | |
| 8365 | -#define OP_SeekGe 46 | |
| 8366 | -#define OP_SeekGt 47 | |
| 8367 | -#define OP_Seek 48 | |
| 8368 | -#define OP_NotFound 49 | |
| 8369 | -#define OP_Found 50 | |
| 8370 | -#define OP_IsUnique 51 | |
| 8371 | -#define OP_NotExists 52 | |
| 8372 | -#define OP_Sequence 53 | |
| 8373 | -#define OP_NewRowid 54 | |
| 8374 | -#define OP_Insert 55 | |
| 8375 | -#define OP_InsertInt 56 | |
| 8376 | -#define OP_Delete 57 | |
| 8377 | -#define OP_ResetCount 58 | |
| 8378 | -#define OP_RowKey 59 | |
| 8379 | -#define OP_RowData 60 | |
| 8380 | -#define OP_Rowid 61 | |
| 8381 | -#define OP_NullRow 62 | |
| 8382 | -#define OP_Last 63 | |
| 8383 | -#define OP_Sort 64 | |
| 8384 | -#define OP_Rewind 65 | |
| 8385 | -#define OP_Prev 66 | |
| 8386 | -#define OP_Next 67 | |
| 8387 | -#define OP_IdxInsert 70 | |
| 8388 | -#define OP_IdxDelete 71 | |
| 8389 | -#define OP_IdxRowid 72 | |
| 8390 | -#define OP_IdxLT 81 | |
| 8391 | -#define OP_IdxGE 92 | |
| 8392 | -#define OP_Destroy 95 | |
| 8393 | -#define OP_Clear 96 | |
| 8394 | -#define OP_CreateIndex 97 | |
| 8395 | -#define OP_CreateTable 98 | |
| 8396 | -#define OP_ParseSchema 99 | |
| 8397 | -#define OP_LoadAnalysis 100 | |
| 8398 | -#define OP_DropTable 101 | |
| 8399 | -#define OP_DropIndex 102 | |
| 8400 | -#define OP_DropTrigger 103 | |
| 8401 | -#define OP_IntegrityCk 104 | |
| 8402 | -#define OP_RowSetAdd 105 | |
| 8403 | -#define OP_RowSetRead 106 | |
| 8404 | -#define OP_RowSetTest 107 | |
| 8405 | -#define OP_Program 108 | |
| 8406 | -#define OP_Param 109 | |
| 8407 | -#define OP_FkCounter 110 | |
| 8408 | -#define OP_FkIfZero 111 | |
| 8409 | -#define OP_MemMax 112 | |
| 8410 | -#define OP_IfPos 113 | |
| 8411 | -#define OP_IfNeg 114 | |
| 8412 | -#define OP_IfZero 115 | |
| 8413 | -#define OP_AggStep 116 | |
| 8414 | -#define OP_AggFinal 117 | |
| 8415 | -#define OP_Checkpoint 118 | |
| 8416 | -#define OP_JournalMode 119 | |
| 8417 | -#define OP_Vacuum 120 | |
| 8418 | -#define OP_IncrVacuum 121 | |
| 8419 | -#define OP_Expire 122 | |
| 8420 | -#define OP_TableLock 123 | |
| 8421 | -#define OP_VBegin 124 | |
| 8422 | -#define OP_VCreate 125 | |
| 8423 | -#define OP_VDestroy 126 | |
| 8424 | -#define OP_VOpen 127 | |
| 8425 | -#define OP_VFilter 128 | |
| 8426 | -#define OP_VColumn 129 | |
| 8427 | -#define OP_VNext 131 | |
| 8428 | -#define OP_VRename 132 | |
| 8429 | -#define OP_VUpdate 133 | |
| 8430 | -#define OP_Pagecount 134 | |
| 8431 | -#define OP_MaxPgcnt 135 | |
| 8432 | -#define OP_Trace 136 | |
| 8433 | -#define OP_Noop 137 | |
| 8434 | -#define OP_Explain 138 | |
| 8435 | - | |
| 8436 | -/* The following opcode values are never used */ | |
| 8437 | -#define OP_NotUsed_139 139 | |
| 8404 | +#define OP_OpenSorter 40 | |
| 8405 | +#define OP_OpenAutoindex 41 | |
| 8406 | +#define OP_OpenEphemeral 42 | |
| 8407 | +#define OP_OpenPseudo 43 | |
| 8408 | +#define OP_Close 44 | |
| 8409 | +#define OP_SeekLt 45 | |
| 8410 | +#define OP_SeekLe 46 | |
| 8411 | +#define OP_SeekGe 47 | |
| 8412 | +#define OP_SeekGt 48 | |
| 8413 | +#define OP_Seek 49 | |
| 8414 | +#define OP_NotFound 50 | |
| 8415 | +#define OP_Found 51 | |
| 8416 | +#define OP_IsUnique 52 | |
| 8417 | +#define OP_NotExists 53 | |
| 8418 | +#define OP_Sequence 54 | |
| 8419 | +#define OP_NewRowid 55 | |
| 8420 | +#define OP_Insert 56 | |
| 8421 | +#define OP_InsertInt 57 | |
| 8422 | +#define OP_Delete 58 | |
| 8423 | +#define OP_ResetCount 59 | |
| 8424 | +#define OP_RowKey 60 | |
| 8425 | +#define OP_RowData 61 | |
| 8426 | +#define OP_Rowid 62 | |
| 8427 | +#define OP_NullRow 63 | |
| 8428 | +#define OP_Last 64 | |
| 8429 | +#define OP_Sort 65 | |
| 8430 | +#define OP_Rewind 66 | |
| 8431 | +#define OP_Prev 67 | |
| 8432 | +#define OP_Next 70 | |
| 8433 | +#define OP_IdxInsert 71 | |
| 8434 | +#define OP_IdxDelete 72 | |
| 8435 | +#define OP_IdxRowid 81 | |
| 8436 | +#define OP_IdxLT 92 | |
| 8437 | +#define OP_IdxGE 95 | |
| 8438 | +#define OP_Destroy 96 | |
| 8439 | +#define OP_Clear 97 | |
| 8440 | +#define OP_CreateIndex 98 | |
| 8441 | +#define OP_CreateTable 99 | |
| 8442 | +#define OP_ParseSchema 100 | |
| 8443 | +#define OP_LoadAnalysis 101 | |
| 8444 | +#define OP_DropTable 102 | |
| 8445 | +#define OP_DropIndex 103 | |
| 8446 | +#define OP_DropTrigger 104 | |
| 8447 | +#define OP_IntegrityCk 105 | |
| 8448 | +#define OP_RowSetAdd 106 | |
| 8449 | +#define OP_RowSetRead 107 | |
| 8450 | +#define OP_RowSetTest 108 | |
| 8451 | +#define OP_Program 109 | |
| 8452 | +#define OP_Param 110 | |
| 8453 | +#define OP_FkCounter 111 | |
| 8454 | +#define OP_FkIfZero 112 | |
| 8455 | +#define OP_MemMax 113 | |
| 8456 | +#define OP_IfPos 114 | |
| 8457 | +#define OP_IfNeg 115 | |
| 8458 | +#define OP_IfZero 116 | |
| 8459 | +#define OP_AggStep 117 | |
| 8460 | +#define OP_AggFinal 118 | |
| 8461 | +#define OP_Checkpoint 119 | |
| 8462 | +#define OP_JournalMode 120 | |
| 8463 | +#define OP_Vacuum 121 | |
| 8464 | +#define OP_IncrVacuum 122 | |
| 8465 | +#define OP_Expire 123 | |
| 8466 | +#define OP_TableLock 124 | |
| 8467 | +#define OP_VBegin 125 | |
| 8468 | +#define OP_VCreate 126 | |
| 8469 | +#define OP_VDestroy 127 | |
| 8470 | +#define OP_VOpen 128 | |
| 8471 | +#define OP_VFilter 129 | |
| 8472 | +#define OP_VColumn 131 | |
| 8473 | +#define OP_VNext 132 | |
| 8474 | +#define OP_VRename 133 | |
| 8475 | +#define OP_VUpdate 134 | |
| 8476 | +#define OP_Pagecount 135 | |
| 8477 | +#define OP_MaxPgcnt 136 | |
| 8478 | +#define OP_Trace 137 | |
| 8479 | +#define OP_Noop 138 | |
| 8480 | +#define OP_Explain 139 | |
| 8481 | + | |
| 8482 | +/* The following opcode values are never used */ | |
| 8438 | 8483 | #define OP_NotUsed_140 140 |
| 8439 | 8484 | |
| 8440 | 8485 | |
| 8441 | 8486 | /* Properties such as "out2" or "jump" that are specified in |
| 8442 | 8487 | ** comments following the "case" for each opcode in the vdbe.c |
| @@ -8453,23 +8498,23 @@ | ||
| 8453 | 8498 | /* 0 */ 0x00, 0x01, 0x05, 0x04, 0x04, 0x10, 0x00, 0x02,\ |
| 8454 | 8499 | /* 8 */ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x24, 0x24,\ |
| 8455 | 8500 | /* 16 */ 0x00, 0x00, 0x00, 0x24, 0x04, 0x05, 0x04, 0x00,\ |
| 8456 | 8501 | /* 24 */ 0x00, 0x01, 0x05, 0x05, 0x00, 0x00, 0x00, 0x02,\ |
| 8457 | 8502 | /* 32 */ 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00,\ |
| 8458 | -/* 40 */ 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11,\ | |
| 8459 | -/* 48 */ 0x08, 0x11, 0x11, 0x11, 0x11, 0x02, 0x02, 0x00,\ | |
| 8460 | -/* 56 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01,\ | |
| 8461 | -/* 64 */ 0x01, 0x01, 0x01, 0x01, 0x4c, 0x4c, 0x08, 0x00,\ | |
| 8462 | -/* 72 */ 0x02, 0x05, 0x05, 0x15, 0x15, 0x15, 0x15, 0x15,\ | |
| 8463 | -/* 80 */ 0x15, 0x01, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c,\ | |
| 8464 | -/* 88 */ 0x4c, 0x4c, 0x4c, 0x4c, 0x01, 0x24, 0x02, 0x02,\ | |
| 8465 | -/* 96 */ 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,\ | |
| 8466 | -/* 104 */ 0x00, 0x0c, 0x45, 0x15, 0x01, 0x02, 0x00, 0x01,\ | |
| 8467 | -/* 112 */ 0x08, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00, 0x02,\ | |
| 8468 | -/* 120 */ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ | |
| 8469 | -/* 128 */ 0x01, 0x00, 0x02, 0x01, 0x00, 0x00, 0x02, 0x02,\ | |
| 8470 | -/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04,\ | |
| 8503 | +/* 40 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11,\ | |
| 8504 | +/* 48 */ 0x11, 0x08, 0x11, 0x11, 0x11, 0x11, 0x02, 0x02,\ | |
| 8505 | +/* 56 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,\ | |
| 8506 | +/* 64 */ 0x01, 0x01, 0x01, 0x01, 0x4c, 0x4c, 0x01, 0x08,\ | |
| 8507 | +/* 72 */ 0x00, 0x05, 0x05, 0x15, 0x15, 0x15, 0x15, 0x15,\ | |
| 8508 | +/* 80 */ 0x15, 0x02, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c,\ | |
| 8509 | +/* 88 */ 0x4c, 0x4c, 0x4c, 0x4c, 0x01, 0x24, 0x02, 0x01,\ | |
| 8510 | +/* 96 */ 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00,\ | |
| 8511 | +/* 104 */ 0x00, 0x00, 0x0c, 0x45, 0x15, 0x01, 0x02, 0x00,\ | |
| 8512 | +/* 112 */ 0x01, 0x08, 0x05, 0x05, 0x05, 0x00, 0x00, 0x00,\ | |
| 8513 | +/* 120 */ 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,\ | |
| 8514 | +/* 128 */ 0x00, 0x01, 0x02, 0x00, 0x01, 0x00, 0x00, 0x02,\ | |
| 8515 | +/* 136 */ 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04,\ | |
| 8471 | 8516 | /* 144 */ 0x04, 0x04,} |
| 8472 | 8517 | |
| 8473 | 8518 | /************** End of opcodes.h *********************************************/ |
| 8474 | 8519 | /************** Continuing where we left off in vdbe.h ***********************/ |
| 8475 | 8520 | |
| @@ -8484,13 +8529,13 @@ | ||
| 8484 | 8529 | SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int); |
| 8485 | 8530 | SQLITE_PRIVATE int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int); |
| 8486 | 8531 | SQLITE_PRIVATE int sqlite3VdbeAddOp4Int(Vdbe*,int,int,int,int,int); |
| 8487 | 8532 | SQLITE_PRIVATE int sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp); |
| 8488 | 8533 | SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*); |
| 8489 | -SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1); | |
| 8490 | -SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2); | |
| 8491 | -SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe*, int addr, int P3); | |
| 8534 | +SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, u32 addr, int P1); | |
| 8535 | +SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, u32 addr, int P2); | |
| 8536 | +SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe*, u32 addr, int P3); | |
| 8492 | 8537 | SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe*, u8 P5); |
| 8493 | 8538 | SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe*, int addr); |
| 8494 | 8539 | SQLITE_PRIVATE void sqlite3VdbeChangeToNoop(Vdbe*, int addr, int N); |
| 8495 | 8540 | SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe*, int addr, const char *zP4, int N); |
| 8496 | 8541 | SQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe*, int); |
| @@ -8608,10 +8653,11 @@ | ||
| 8608 | 8653 | ** NOTE: These values must match the corresponding BTREE_ values in btree.h. |
| 8609 | 8654 | */ |
| 8610 | 8655 | #define PAGER_OMIT_JOURNAL 0x0001 /* Do not use a rollback journal */ |
| 8611 | 8656 | #define PAGER_NO_READLOCK 0x0002 /* Omit readlocks on readonly files */ |
| 8612 | 8657 | #define PAGER_MEMORY 0x0004 /* In-memory database */ |
| 8658 | +#define PAGER_SORTER 0x0020 /* Accumulator in external merge sort */ | |
| 8613 | 8659 | |
| 8614 | 8660 | /* |
| 8615 | 8661 | ** Valid values for the second argument to sqlite3PagerLockingMode(). |
| 8616 | 8662 | */ |
| 8617 | 8663 | #define PAGER_LOCKINGMODE_QUERY -1 |
| @@ -8703,10 +8749,13 @@ | ||
| 8703 | 8749 | SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager*); |
| 8704 | 8750 | SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager*); |
| 8705 | 8751 | SQLITE_PRIVATE int sqlite3PagerNosync(Pager*); |
| 8706 | 8752 | SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager*); |
| 8707 | 8753 | SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager*); |
| 8754 | +#ifndef SQLITE_OMIT_MERGE_SORT | |
| 8755 | +SQLITE_PRIVATE int sqlite3PagerUnderStress(Pager*); | |
| 8756 | +#endif | |
| 8708 | 8757 | |
| 8709 | 8758 | /* Functions used to truncate the database file. */ |
| 8710 | 8759 | SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager*,Pgno); |
| 8711 | 8760 | |
| 8712 | 8761 | #if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_WAL) |
| @@ -9556,10 +9605,12 @@ | ||
| 9556 | 9605 | #define SQLITE_IndexSort 0x04 /* Disable indexes for sorting */ |
| 9557 | 9606 | #define SQLITE_IndexSearch 0x08 /* Disable indexes for searching */ |
| 9558 | 9607 | #define SQLITE_IndexCover 0x10 /* Disable index covering table */ |
| 9559 | 9608 | #define SQLITE_GroupByOrder 0x20 /* Disable GROUPBY cover of ORDERBY */ |
| 9560 | 9609 | #define SQLITE_FactorOutConst 0x40 /* Disable factoring out constants */ |
| 9610 | +#define SQLITE_IdxRealAsInt 0x80 /* Store REAL as INT in indices */ | |
| 9611 | +#define SQLITE_DistinctOpt 0x80 /* DISTINCT using indexes */ | |
| 9561 | 9612 | #define SQLITE_OptMask 0xff /* Mask of all disablable opts */ |
| 9562 | 9613 | |
| 9563 | 9614 | /* |
| 9564 | 9615 | ** Possible values for the sqlite.magic field. |
| 9565 | 9616 | ** The numbers are obtained at random and have no special meaning, other |
| @@ -10447,10 +10498,11 @@ | ||
| 10447 | 10498 | Table *pTab; /* An SQL table corresponding to zName */ |
| 10448 | 10499 | Select *pSelect; /* A SELECT statement used in place of a table name */ |
| 10449 | 10500 | u8 isPopulated; /* Temporary table associated with SELECT is populated */ |
| 10450 | 10501 | u8 jointype; /* Type of join between this able and the previous */ |
| 10451 | 10502 | u8 notIndexed; /* True if there is a NOT INDEXED clause */ |
| 10503 | + u8 isCorrelated; /* True if sub-query is correlated */ | |
| 10452 | 10504 | #ifndef SQLITE_OMIT_EXPLAIN |
| 10453 | 10505 | u8 iSelectId; /* If pSelect!=0, the id of the sub-select in EQP */ |
| 10454 | 10506 | #endif |
| 10455 | 10507 | int iCursor; /* The VDBE cursor number used to access this table */ |
| 10456 | 10508 | Expr *pOn; /* The ON clause of a join */ |
| @@ -10566,10 +10618,11 @@ | ||
| 10566 | 10618 | struct WhereInfo { |
| 10567 | 10619 | Parse *pParse; /* Parsing and code generating context */ |
| 10568 | 10620 | u16 wctrlFlags; /* Flags originally passed to sqlite3WhereBegin() */ |
| 10569 | 10621 | u8 okOnePass; /* Ok to use one-pass algorithm for UPDATE or DELETE */ |
| 10570 | 10622 | u8 untestedTerms; /* Not all WHERE terms resolved by outer loop */ |
| 10623 | + u8 eDistinct; | |
| 10571 | 10624 | SrcList *pTabList; /* List of tables in the join */ |
| 10572 | 10625 | int iTop; /* The very beginning of the WHERE loop */ |
| 10573 | 10626 | int iContinue; /* Jump here to continue with next record */ |
| 10574 | 10627 | int iBreak; /* Jump here to break out of the loop */ |
| 10575 | 10628 | int nLevel; /* Number of nested loop */ |
| @@ -10577,10 +10630,13 @@ | ||
| 10577 | 10630 | double savedNQueryLoop; /* pParse->nQueryLoop outside the WHERE loop */ |
| 10578 | 10631 | double nRowOut; /* Estimated number of output rows */ |
| 10579 | 10632 | WhereLevel a[1]; /* Information about each nest loop in WHERE */ |
| 10580 | 10633 | }; |
| 10581 | 10634 | |
| 10635 | +#define WHERE_DISTINCT_UNIQUE 1 | |
| 10636 | +#define WHERE_DISTINCT_ORDERED 2 | |
| 10637 | + | |
| 10582 | 10638 | /* |
| 10583 | 10639 | ** A NameContext defines a context in which to resolve table and column |
| 10584 | 10640 | ** names. The context consists of a list of tables (the pSrcList) field and |
| 10585 | 10641 | ** a list of named expression (pEList). The named expression list may |
| 10586 | 10642 | ** be NULL. The pSrc corresponds to the FROM clause of a SELECT or |
| @@ -11053,10 +11109,11 @@ | ||
| 11053 | 11109 | int isPCacheInit; /* True after malloc is initialized */ |
| 11054 | 11110 | sqlite3_mutex *pInitMutex; /* Mutex used by sqlite3_initialize() */ |
| 11055 | 11111 | int nRefInitMutex; /* Number of users of pInitMutex */ |
| 11056 | 11112 | void (*xLog)(void*,int,const char*); /* Function for logging */ |
| 11057 | 11113 | void *pLogArg; /* First argument to xLog() */ |
| 11114 | + int bLocaltimeFault; /* True to fail localtime() calls */ | |
| 11058 | 11115 | }; |
| 11059 | 11116 | |
| 11060 | 11117 | /* |
| 11061 | 11118 | ** Context pointer passed down through the tree-walk. |
| 11062 | 11119 | */ |
| @@ -11337,11 +11394,11 @@ | ||
| 11337 | 11394 | #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) |
| 11338 | 11395 | SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse *, SrcList *, Expr *, ExprList *, Expr *, Expr *, char *); |
| 11339 | 11396 | #endif |
| 11340 | 11397 | SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*); |
| 11341 | 11398 | SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int); |
| 11342 | -SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*, SrcList*, Expr*, ExprList**, u16); | |
| 11399 | +SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*, SrcList*, Expr*, ExprList**,ExprList*,u16); | |
| 11343 | 11400 | SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*); |
| 11344 | 11401 | SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int); |
| 11345 | 11402 | SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int); |
| 11346 | 11403 | SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse*, int, int, int); |
| 11347 | 11404 | SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, int, int, int); |
| @@ -12013,10 +12070,11 @@ | ||
| 12013 | 12070 | 0, /* isPCacheInit */ |
| 12014 | 12071 | 0, /* pInitMutex */ |
| 12015 | 12072 | 0, /* nRefInitMutex */ |
| 12016 | 12073 | 0, /* xLog */ |
| 12017 | 12074 | 0, /* pLogArg */ |
| 12075 | + 0, /* bLocaltimeFault */ | |
| 12018 | 12076 | }; |
| 12019 | 12077 | |
| 12020 | 12078 | |
| 12021 | 12079 | /* |
| 12022 | 12080 | ** Hash table for global functions - functions common to all |
| @@ -12321,10 +12379,13 @@ | ||
| 12321 | 12379 | #ifdef SQLITE_OMIT_LOOKASIDE |
| 12322 | 12380 | "OMIT_LOOKASIDE", |
| 12323 | 12381 | #endif |
| 12324 | 12382 | #ifdef SQLITE_OMIT_MEMORYDB |
| 12325 | 12383 | "OMIT_MEMORYDB", |
| 12384 | +#endif | |
| 12385 | +#ifdef SQLITE_OMIT_MERGE_SORT | |
| 12386 | + "OMIT_MERGE_SORT", | |
| 12326 | 12387 | #endif |
| 12327 | 12388 | #ifdef SQLITE_OMIT_OR_OPTIMIZATION |
| 12328 | 12389 | "OMIT_OR_OPTIMIZATION", |
| 12329 | 12390 | #endif |
| 12330 | 12391 | #ifdef SQLITE_OMIT_PAGER_PRAGMAS |
| @@ -12387,10 +12448,13 @@ | ||
| 12387 | 12448 | #ifdef SQLITE_OMIT_WSD |
| 12388 | 12449 | "OMIT_WSD", |
| 12389 | 12450 | #endif |
| 12390 | 12451 | #ifdef SQLITE_OMIT_XFER_OPT |
| 12391 | 12452 | "OMIT_XFER_OPT", |
| 12453 | +#endif | |
| 12454 | +#ifdef SQLITE_PAGECACHE_BLOCKALLOC | |
| 12455 | + "PAGECACHE_BLOCKALLOC", | |
| 12392 | 12456 | #endif |
| 12393 | 12457 | #ifdef SQLITE_PERFORMANCE_TRACE |
| 12394 | 12458 | "PERFORMANCE_TRACE", |
| 12395 | 12459 | #endif |
| 12396 | 12460 | #ifdef SQLITE_PROXY_DEBUG |
| @@ -12508,10 +12572,13 @@ | ||
| 12508 | 12572 | /* |
| 12509 | 12573 | ** Boolean values |
| 12510 | 12574 | */ |
| 12511 | 12575 | typedef unsigned char Bool; |
| 12512 | 12576 | |
| 12577 | +/* Opaque type used by code in vdbesort.c */ | |
| 12578 | +typedef struct VdbeSorter VdbeSorter; | |
| 12579 | + | |
| 12513 | 12580 | /* |
| 12514 | 12581 | ** A cursor is a pointer into a single BTree within a database file. |
| 12515 | 12582 | ** The cursor can seek to a BTree entry with a particular key, or |
| 12516 | 12583 | ** loop over all entries of the Btree. You can also insert new BTree |
| 12517 | 12584 | ** entries or retrieve the key or data from the entry that the cursor |
| @@ -12539,10 +12606,11 @@ | ||
| 12539 | 12606 | sqlite3_vtab_cursor *pVtabCursor; /* The cursor for a virtual table */ |
| 12540 | 12607 | const sqlite3_module *pModule; /* Module for cursor pVtabCursor */ |
| 12541 | 12608 | i64 seqCount; /* Sequence counter */ |
| 12542 | 12609 | i64 movetoTarget; /* Argument to the deferred sqlite3BtreeMoveto() */ |
| 12543 | 12610 | i64 lastRowid; /* Last rowid from a Next or NextIdx operation */ |
| 12611 | + VdbeSorter *pSorter; /* Sorter object for OP_OpenSorter cursors */ | |
| 12544 | 12612 | |
| 12545 | 12613 | /* Result of last sqlite3BtreeMoveto() done by an OP_NotExists or |
| 12546 | 12614 | ** OP_IsUnique opcode on this cursor. */ |
| 12547 | 12615 | int seekResult; |
| 12548 | 12616 | |
| @@ -12858,17 +12926,36 @@ | ||
| 12858 | 12926 | SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem*); |
| 12859 | 12927 | SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem*); |
| 12860 | 12928 | SQLITE_PRIVATE int sqlite3VdbeMemFromBtree(BtCursor*,int,int,int,Mem*); |
| 12861 | 12929 | SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p); |
| 12862 | 12930 | SQLITE_PRIVATE void sqlite3VdbeMemReleaseExternal(Mem *p); |
| 12931 | +#define MemReleaseExt(X) \ | |
| 12932 | + if((X)->flags&(MEM_Agg|MEM_Dyn|MEM_RowSet|MEM_Frame)) \ | |
| 12933 | + sqlite3VdbeMemReleaseExternal(X); | |
| 12863 | 12934 | SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem*, FuncDef*); |
| 12864 | 12935 | SQLITE_PRIVATE const char *sqlite3OpcodeName(int); |
| 12865 | 12936 | SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve); |
| 12866 | 12937 | SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int); |
| 12867 | 12938 | SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame*); |
| 12868 | 12939 | SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *); |
| 12869 | 12940 | SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem); |
| 12941 | + | |
| 12942 | +#ifdef SQLITE_OMIT_MERGE_SORT | |
| 12943 | +# define sqlite3VdbeSorterInit(Y,Z) SQLITE_OK | |
| 12944 | +# define sqlite3VdbeSorterWrite(X,Y,Z) SQLITE_OK | |
| 12945 | +# define sqlite3VdbeSorterClose(Y,Z) | |
| 12946 | +# define sqlite3VdbeSorterRowkey(Y,Z) SQLITE_OK | |
| 12947 | +# define sqlite3VdbeSorterRewind(X,Y,Z) SQLITE_OK | |
| 12948 | +# define sqlite3VdbeSorterNext(X,Y,Z) SQLITE_OK | |
| 12949 | +#else | |
| 12950 | +SQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *, VdbeCursor *); | |
| 12951 | +SQLITE_PRIVATE int sqlite3VdbeSorterWrite(sqlite3 *, VdbeCursor *, int); | |
| 12952 | +SQLITE_PRIVATE void sqlite3VdbeSorterClose(sqlite3 *, VdbeCursor *); | |
| 12953 | +SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(VdbeCursor *, Mem *); | |
| 12954 | +SQLITE_PRIVATE int sqlite3VdbeSorterRewind(sqlite3 *, VdbeCursor *, int *); | |
| 12955 | +SQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *, VdbeCursor *, int *); | |
| 12956 | +#endif | |
| 12870 | 12957 | |
| 12871 | 12958 | #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0 |
| 12872 | 12959 | SQLITE_PRIVATE void sqlite3VdbeEnter(Vdbe*); |
| 12873 | 12960 | SQLITE_PRIVATE void sqlite3VdbeLeave(Vdbe*); |
| 12874 | 12961 | #else |
| @@ -13159,30 +13246,16 @@ | ||
| 13159 | 13246 | ** Astronomical Algorithms, 2nd Edition, 1998 |
| 13160 | 13247 | ** ISBM 0-943396-61-1 |
| 13161 | 13248 | ** Willmann-Bell, Inc |
| 13162 | 13249 | ** Richmond, Virginia (USA) |
| 13163 | 13250 | */ |
| 13251 | +/* #include <stdlib.h> */ | |
| 13252 | +/* #include <assert.h> */ | |
| 13164 | 13253 | #include <time.h> |
| 13165 | 13254 | |
| 13166 | 13255 | #ifndef SQLITE_OMIT_DATETIME_FUNCS |
| 13167 | 13256 | |
| 13168 | -/* | |
| 13169 | -** On recent Windows platforms, the localtime_s() function is available | |
| 13170 | -** as part of the "Secure CRT". It is essentially equivalent to | |
| 13171 | -** localtime_r() available under most POSIX platforms, except that the | |
| 13172 | -** order of the parameters is reversed. | |
| 13173 | -** | |
| 13174 | -** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx. | |
| 13175 | -** | |
| 13176 | -** If the user has not indicated to use localtime_r() or localtime_s() | |
| 13177 | -** already, check for an MSVC build environment that provides | |
| 13178 | -** localtime_s(). | |
| 13179 | -*/ | |
| 13180 | -#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && \ | |
| 13181 | - defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE) | |
| 13182 | -#define HAVE_LOCALTIME_S 1 | |
| 13183 | -#endif | |
| 13184 | 13257 | |
| 13185 | 13258 | /* |
| 13186 | 13259 | ** A structure for holding a single date and time. |
| 13187 | 13260 | */ |
| 13188 | 13261 | typedef struct DateTime DateTime; |
| @@ -13523,20 +13596,90 @@ | ||
| 13523 | 13596 | static void clearYMD_HMS_TZ(DateTime *p){ |
| 13524 | 13597 | p->validYMD = 0; |
| 13525 | 13598 | p->validHMS = 0; |
| 13526 | 13599 | p->validTZ = 0; |
| 13527 | 13600 | } |
| 13601 | + | |
| 13602 | +/* | |
| 13603 | +** On recent Windows platforms, the localtime_s() function is available | |
| 13604 | +** as part of the "Secure CRT". It is essentially equivalent to | |
| 13605 | +** localtime_r() available under most POSIX platforms, except that the | |
| 13606 | +** order of the parameters is reversed. | |
| 13607 | +** | |
| 13608 | +** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx. | |
| 13609 | +** | |
| 13610 | +** If the user has not indicated to use localtime_r() or localtime_s() | |
| 13611 | +** already, check for an MSVC build environment that provides | |
| 13612 | +** localtime_s(). | |
| 13613 | +*/ | |
| 13614 | +#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && \ | |
| 13615 | + defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE) | |
| 13616 | +#define HAVE_LOCALTIME_S 1 | |
| 13617 | +#endif | |
| 13618 | + | |
| 13619 | +#ifndef SQLITE_OMIT_LOCALTIME | |
| 13620 | +/* | |
| 13621 | +** The following routine implements the rough equivalent of localtime_r() | |
| 13622 | +** using whatever operating-system specific localtime facility that | |
| 13623 | +** is available. This routine returns 0 on success and | |
| 13624 | +** non-zero on any kind of error. | |
| 13625 | +** | |
| 13626 | +** If the sqlite3GlobalConfig.bLocaltimeFault variable is true then this | |
| 13627 | +** routine will always fail. | |
| 13628 | +*/ | |
| 13629 | +static int osLocaltime(time_t *t, struct tm *pTm){ | |
| 13630 | + int rc; | |
| 13631 | +#if (!defined(HAVE_LOCALTIME_R) || !HAVE_LOCALTIME_R) \ | |
| 13632 | + && (!defined(HAVE_LOCALTIME_S) || !HAVE_LOCALTIME_S) | |
| 13633 | + struct tm *pX; | |
| 13634 | +#if SQLITE_THREADSAFE>0 | |
| 13635 | + sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); | |
| 13636 | +#endif | |
| 13637 | + sqlite3_mutex_enter(mutex); | |
| 13638 | + pX = localtime(t); | |
| 13639 | +#ifndef SQLITE_OMIT_BUILTIN_TEST | |
| 13640 | + if( sqlite3GlobalConfig.bLocaltimeFault ) pX = 0; | |
| 13641 | +#endif | |
| 13642 | + if( pX ) *pTm = *pX; | |
| 13643 | + sqlite3_mutex_leave(mutex); | |
| 13644 | + rc = pX==0; | |
| 13645 | +#else | |
| 13646 | +#ifndef SQLITE_OMIT_BUILTIN_TEST | |
| 13647 | + if( sqlite3GlobalConfig.bLocaltimeFault ) return 1; | |
| 13648 | +#endif | |
| 13649 | +#if defined(HAVE_LOCALTIME_R) && HAVE_LOCALTIME_R | |
| 13650 | + rc = localtime_r(t, pTm)==0; | |
| 13651 | +#else | |
| 13652 | + rc = localtime_s(pTm, t); | |
| 13653 | +#endif /* HAVE_LOCALTIME_R */ | |
| 13654 | +#endif /* HAVE_LOCALTIME_R || HAVE_LOCALTIME_S */ | |
| 13655 | + return rc; | |
| 13656 | +} | |
| 13657 | +#endif /* SQLITE_OMIT_LOCALTIME */ | |
| 13658 | + | |
| 13528 | 13659 | |
| 13529 | 13660 | #ifndef SQLITE_OMIT_LOCALTIME |
| 13530 | 13661 | /* |
| 13531 | -** Compute the difference (in milliseconds) | |
| 13532 | -** between localtime and UTC (a.k.a. GMT) | |
| 13533 | -** for the time value p where p is in UTC. | |
| 13662 | +** Compute the difference (in milliseconds) between localtime and UTC | |
| 13663 | +** (a.k.a. GMT) for the time value p where p is in UTC. If no error occurs, | |
| 13664 | +** return this value and set *pRc to SQLITE_OK. | |
| 13665 | +** | |
| 13666 | +** Or, if an error does occur, set *pRc to SQLITE_ERROR. The returned value | |
| 13667 | +** is undefined in this case. | |
| 13534 | 13668 | */ |
| 13535 | -static sqlite3_int64 localtimeOffset(DateTime *p){ | |
| 13669 | +static sqlite3_int64 localtimeOffset( | |
| 13670 | + DateTime *p, /* Date at which to calculate offset */ | |
| 13671 | + sqlite3_context *pCtx, /* Write error here if one occurs */ | |
| 13672 | + int *pRc /* OUT: Error code. SQLITE_OK or ERROR */ | |
| 13673 | +){ | |
| 13536 | 13674 | DateTime x, y; |
| 13537 | 13675 | time_t t; |
| 13676 | + struct tm sLocal; | |
| 13677 | + | |
| 13678 | + /* Initialize the contents of sLocal to avoid a compiler warning. */ | |
| 13679 | + memset(&sLocal, 0, sizeof(sLocal)); | |
| 13680 | + | |
| 13538 | 13681 | x = *p; |
| 13539 | 13682 | computeYMD_HMS(&x); |
| 13540 | 13683 | if( x.Y<1971 || x.Y>=2038 ){ |
| 13541 | 13684 | x.Y = 2000; |
| 13542 | 13685 | x.M = 1; |
| @@ -13550,51 +13693,27 @@ | ||
| 13550 | 13693 | } |
| 13551 | 13694 | x.tz = 0; |
| 13552 | 13695 | x.validJD = 0; |
| 13553 | 13696 | computeJD(&x); |
| 13554 | 13697 | t = (time_t)(x.iJD/1000 - 21086676*(i64)10000); |
| 13555 | -#ifdef HAVE_LOCALTIME_R | |
| 13556 | - { | |
| 13557 | - struct tm sLocal; | |
| 13558 | - localtime_r(&t, &sLocal); | |
| 13559 | - y.Y = sLocal.tm_year + 1900; | |
| 13560 | - y.M = sLocal.tm_mon + 1; | |
| 13561 | - y.D = sLocal.tm_mday; | |
| 13562 | - y.h = sLocal.tm_hour; | |
| 13563 | - y.m = sLocal.tm_min; | |
| 13564 | - y.s = sLocal.tm_sec; | |
| 13565 | - } | |
| 13566 | -#elif defined(HAVE_LOCALTIME_S) && HAVE_LOCALTIME_S | |
| 13567 | - { | |
| 13568 | - struct tm sLocal; | |
| 13569 | - localtime_s(&sLocal, &t); | |
| 13570 | - y.Y = sLocal.tm_year + 1900; | |
| 13571 | - y.M = sLocal.tm_mon + 1; | |
| 13572 | - y.D = sLocal.tm_mday; | |
| 13573 | - y.h = sLocal.tm_hour; | |
| 13574 | - y.m = sLocal.tm_min; | |
| 13575 | - y.s = sLocal.tm_sec; | |
| 13576 | - } | |
| 13577 | -#else | |
| 13578 | - { | |
| 13579 | - struct tm *pTm; | |
| 13580 | - sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); | |
| 13581 | - pTm = localtime(&t); | |
| 13582 | - y.Y = pTm->tm_year + 1900; | |
| 13583 | - y.M = pTm->tm_mon + 1; | |
| 13584 | - y.D = pTm->tm_mday; | |
| 13585 | - y.h = pTm->tm_hour; | |
| 13586 | - y.m = pTm->tm_min; | |
| 13587 | - y.s = pTm->tm_sec; | |
| 13588 | - sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); | |
| 13589 | - } | |
| 13590 | -#endif | |
| 13698 | + if( osLocaltime(&t, &sLocal) ){ | |
| 13699 | + sqlite3_result_error(pCtx, "local time unavailable", -1); | |
| 13700 | + *pRc = SQLITE_ERROR; | |
| 13701 | + return 0; | |
| 13702 | + } | |
| 13703 | + y.Y = sLocal.tm_year + 1900; | |
| 13704 | + y.M = sLocal.tm_mon + 1; | |
| 13705 | + y.D = sLocal.tm_mday; | |
| 13706 | + y.h = sLocal.tm_hour; | |
| 13707 | + y.m = sLocal.tm_min; | |
| 13708 | + y.s = sLocal.tm_sec; | |
| 13591 | 13709 | y.validYMD = 1; |
| 13592 | 13710 | y.validHMS = 1; |
| 13593 | 13711 | y.validJD = 0; |
| 13594 | 13712 | y.validTZ = 0; |
| 13595 | 13713 | computeJD(&y); |
| 13714 | + *pRc = SQLITE_OK; | |
| 13596 | 13715 | return y.iJD - x.iJD; |
| 13597 | 13716 | } |
| 13598 | 13717 | #endif /* SQLITE_OMIT_LOCALTIME */ |
| 13599 | 13718 | |
| 13600 | 13719 | /* |
| @@ -13614,13 +13733,16 @@ | ||
| 13614 | 13733 | ** weekday N |
| 13615 | 13734 | ** unixepoch |
| 13616 | 13735 | ** localtime |
| 13617 | 13736 | ** utc |
| 13618 | 13737 | ** |
| 13619 | -** Return 0 on suc |