Fossil SCM

merge trunk

jan.nijtmans 2013-02-27 09:54 ticket-d17d6e5b17 merge
Commit efe9993f2b787c2fb03ae505cb79f9ce71a6815f
+2 -2
--- src/add.c
+++ src/add.c
@@ -262,11 +262,11 @@
262262
if( vid==0 ){
263263
fossil_panic("no checkout to add to");
264264
}
265265
db_begin_transaction();
266266
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
267
-#if defined(_WIN32)
267
+#if defined(_WIN32) || defined(__CYGWIN__)
268268
db_multi_exec(
269269
"CREATE INDEX IF NOT EXISTS vfile_pathname "
270270
" ON vfile(pathname COLLATE nocase)"
271271
);
272272
#endif
@@ -388,11 +388,11 @@
388388
if( once ){
389389
once = 0;
390390
if( zCaseSensitive ){
391391
caseSensitive = is_truth(zCaseSensitive);
392392
}else{
393
-#if !defined(_WIN32) && !defined(__DARWIN__) && !defined(__APPLE__)
393
+#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__DARWIN__) && !defined(__APPLE__)
394394
caseSensitive = 1; /* Unix */
395395
#else
396396
caseSensitive = 0; /* Windows and Mac */
397397
#endif
398398
caseSensitive = db_get_boolean("case-sensitive",caseSensitive);
399399
--- src/add.c
+++ src/add.c
@@ -262,11 +262,11 @@
262 if( vid==0 ){
263 fossil_panic("no checkout to add to");
264 }
265 db_begin_transaction();
266 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
267 #if defined(_WIN32)
268 db_multi_exec(
269 "CREATE INDEX IF NOT EXISTS vfile_pathname "
270 " ON vfile(pathname COLLATE nocase)"
271 );
272 #endif
@@ -388,11 +388,11 @@
388 if( once ){
389 once = 0;
390 if( zCaseSensitive ){
391 caseSensitive = is_truth(zCaseSensitive);
392 }else{
393 #if !defined(_WIN32) && !defined(__DARWIN__) && !defined(__APPLE__)
394 caseSensitive = 1; /* Unix */
395 #else
396 caseSensitive = 0; /* Windows and Mac */
397 #endif
398 caseSensitive = db_get_boolean("case-sensitive",caseSensitive);
399
--- src/add.c
+++ src/add.c
@@ -262,11 +262,11 @@
262 if( vid==0 ){
263 fossil_panic("no checkout to add to");
264 }
265 db_begin_transaction();
266 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
267 #if defined(_WIN32) || defined(__CYGWIN__)
268 db_multi_exec(
269 "CREATE INDEX IF NOT EXISTS vfile_pathname "
270 " ON vfile(pathname COLLATE nocase)"
271 );
272 #endif
@@ -388,11 +388,11 @@
388 if( once ){
389 once = 0;
390 if( zCaseSensitive ){
391 caseSensitive = is_truth(zCaseSensitive);
392 }else{
393 #if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__DARWIN__) && !defined(__APPLE__)
394 caseSensitive = 1; /* Unix */
395 #else
396 caseSensitive = 0; /* Windows and Mac */
397 #endif
398 caseSensitive = db_get_boolean("case-sensitive",caseSensitive);
399
+16 -3
--- src/db.c
+++ src/db.c
@@ -29,10 +29,13 @@
2929
**
3030
*/
3131
#include "config.h"
3232
#if ! defined(_WIN32)
3333
# include <pwd.h>
34
+# if defined(__CYGWIN__)
35
+# include <sys/cygwin.h>
36
+# endif
3437
#endif
3538
#include <sqlite3.h>
3639
#include <sys/types.h>
3740
#include <sys/stat.h>
3841
#include <unistd.h>
@@ -793,20 +796,29 @@
793796
*/
794797
void db_open_config(int useAttach){
795798
char *zDbName;
796799
const char *zHome;
797800
if( g.configOpen ) return;
798
-#if defined(_WIN32)
801
+#if defined(_WIN32) || defined(__CYGWIN__)
799802
zHome = fossil_getenv("LOCALAPPDATA");
800803
if( zHome==0 ){
801804
zHome = fossil_getenv("APPDATA");
802805
if( zHome==0 ){
803806
char *zDrive = fossil_getenv("HOMEDRIVE");
804807
zHome = fossil_getenv("HOMEPATH");
805808
if( zDrive && zHome ) zHome = mprintf("%s%s", zDrive, zHome);
806809
}
807810
}
811
+#if defined(__CYGWIN__)
812
+ if( zHome!=0 ){
813
+ /* We now have the win32 path, but we need the Cygwin equivalent */
814
+ ssize_t size = cygwin_conv_path(CCP_WIN_A_TO_POSIX, zHome, 0, 0);
815
+ char *converted = fossil_malloc(size);
816
+ cygwin_conv_path(CCP_WIN_A_TO_POSIX, zHome, converted, size);
817
+ zHome = converted;
818
+ }
819
+#endif
808820
if( zHome==0 ){
809821
fossil_fatal("cannot locate home directory - "
810822
"please set the LOCALAPPDATA or APPDATA or HOMEPATH "
811823
"environment variables");
812824
}
@@ -824,11 +836,11 @@
824836
if( access(zHome, W_OK) ){
825837
fossil_fatal("home directory %s must be writeable", zHome);
826838
}
827839
#endif
828840
g.zHome = mprintf("%/", zHome);
829
-#if defined(_WIN32)
841
+#if defined(_WIN32) || defined(__CYGWIN__)
830842
/* . filenames give some window systems problems and many apps problems */
831843
zDbName = mprintf("%//_fossil", zHome);
832844
#else
833845
zDbName = mprintf("%s/.fossil", zHome);
834846
#endif
@@ -882,10 +894,11 @@
882894
lsize = file_size(zDbName);
883895
if( lsize%1024!=0 || lsize<4096 ) return 0;
884896
db_open_or_attach(zDbName, "localdb", 0);
885897
zVFileDef = db_text(0, "SELECT sql FROM %s.sqlite_master"
886898
" WHERE name=='vfile'", db_name("localdb"));
899
+ if( zVFileDef==0 ) return 0;
887900
888901
/* If the "isexe" column is missing from the vfile table, then
889902
** add it now. This code added on 2010-03-06. After all users have
890903
** upgraded, this code can be safely deleted.
891904
*/
@@ -1980,11 +1993,11 @@
19801993
if( !allowNested && db_open_local() ){
19811994
fossil_panic("already within an open tree rooted at %s", g.zLocalRoot);
19821995
}
19831996
file_canonical_name(g.argv[2], &path, 0);
19841997
db_open_repository(blob_str(&path));
1985
-#if defined(_WIN32)
1998
+#if defined(_WIN32) || defined(__CYGWIN__)
19861999
# define LOCALDB_NAME "./_FOSSIL_"
19872000
#else
19882001
# define LOCALDB_NAME "./.fslckout"
19892002
#endif
19902003
db_init_database(LOCALDB_NAME, zLocalSchema,
19912004
--- src/db.c
+++ src/db.c
@@ -29,10 +29,13 @@
29 **
30 */
31 #include "config.h"
32 #if ! defined(_WIN32)
33 # include <pwd.h>
 
 
 
34 #endif
35 #include <sqlite3.h>
36 #include <sys/types.h>
37 #include <sys/stat.h>
38 #include <unistd.h>
@@ -793,20 +796,29 @@
793 */
794 void db_open_config(int useAttach){
795 char *zDbName;
796 const char *zHome;
797 if( g.configOpen ) return;
798 #if defined(_WIN32)
799 zHome = fossil_getenv("LOCALAPPDATA");
800 if( zHome==0 ){
801 zHome = fossil_getenv("APPDATA");
802 if( zHome==0 ){
803 char *zDrive = fossil_getenv("HOMEDRIVE");
804 zHome = fossil_getenv("HOMEPATH");
805 if( zDrive && zHome ) zHome = mprintf("%s%s", zDrive, zHome);
806 }
807 }
 
 
 
 
 
 
 
 
 
808 if( zHome==0 ){
809 fossil_fatal("cannot locate home directory - "
810 "please set the LOCALAPPDATA or APPDATA or HOMEPATH "
811 "environment variables");
812 }
@@ -824,11 +836,11 @@
824 if( access(zHome, W_OK) ){
825 fossil_fatal("home directory %s must be writeable", zHome);
826 }
827 #endif
828 g.zHome = mprintf("%/", zHome);
829 #if defined(_WIN32)
830 /* . filenames give some window systems problems and many apps problems */
831 zDbName = mprintf("%//_fossil", zHome);
832 #else
833 zDbName = mprintf("%s/.fossil", zHome);
834 #endif
@@ -882,10 +894,11 @@
882 lsize = file_size(zDbName);
883 if( lsize%1024!=0 || lsize<4096 ) return 0;
884 db_open_or_attach(zDbName, "localdb", 0);
885 zVFileDef = db_text(0, "SELECT sql FROM %s.sqlite_master"
886 " WHERE name=='vfile'", db_name("localdb"));
 
887
888 /* If the "isexe" column is missing from the vfile table, then
889 ** add it now. This code added on 2010-03-06. After all users have
890 ** upgraded, this code can be safely deleted.
891 */
@@ -1980,11 +1993,11 @@
1980 if( !allowNested && db_open_local() ){
1981 fossil_panic("already within an open tree rooted at %s", g.zLocalRoot);
1982 }
1983 file_canonical_name(g.argv[2], &path, 0);
1984 db_open_repository(blob_str(&path));
1985 #if defined(_WIN32)
1986 # define LOCALDB_NAME "./_FOSSIL_"
1987 #else
1988 # define LOCALDB_NAME "./.fslckout"
1989 #endif
1990 db_init_database(LOCALDB_NAME, zLocalSchema,
1991
--- src/db.c
+++ src/db.c
@@ -29,10 +29,13 @@
29 **
30 */
31 #include "config.h"
32 #if ! defined(_WIN32)
33 # include <pwd.h>
34 # if defined(__CYGWIN__)
35 # include <sys/cygwin.h>
36 # endif
37 #endif
38 #include <sqlite3.h>
39 #include <sys/types.h>
40 #include <sys/stat.h>
41 #include <unistd.h>
@@ -793,20 +796,29 @@
796 */
797 void db_open_config(int useAttach){
798 char *zDbName;
799 const char *zHome;
800 if( g.configOpen ) return;
801 #if defined(_WIN32) || defined(__CYGWIN__)
802 zHome = fossil_getenv("LOCALAPPDATA");
803 if( zHome==0 ){
804 zHome = fossil_getenv("APPDATA");
805 if( zHome==0 ){
806 char *zDrive = fossil_getenv("HOMEDRIVE");
807 zHome = fossil_getenv("HOMEPATH");
808 if( zDrive && zHome ) zHome = mprintf("%s%s", zDrive, zHome);
809 }
810 }
811 #if defined(__CYGWIN__)
812 if( zHome!=0 ){
813 /* We now have the win32 path, but we need the Cygwin equivalent */
814 ssize_t size = cygwin_conv_path(CCP_WIN_A_TO_POSIX, zHome, 0, 0);
815 char *converted = fossil_malloc(size);
816 cygwin_conv_path(CCP_WIN_A_TO_POSIX, zHome, converted, size);
817 zHome = converted;
818 }
819 #endif
820 if( zHome==0 ){
821 fossil_fatal("cannot locate home directory - "
822 "please set the LOCALAPPDATA or APPDATA or HOMEPATH "
823 "environment variables");
824 }
@@ -824,11 +836,11 @@
836 if( access(zHome, W_OK) ){
837 fossil_fatal("home directory %s must be writeable", zHome);
838 }
839 #endif
840 g.zHome = mprintf("%/", zHome);
841 #if defined(_WIN32) || defined(__CYGWIN__)
842 /* . filenames give some window systems problems and many apps problems */
843 zDbName = mprintf("%//_fossil", zHome);
844 #else
845 zDbName = mprintf("%s/.fossil", zHome);
846 #endif
@@ -882,10 +894,11 @@
894 lsize = file_size(zDbName);
895 if( lsize%1024!=0 || lsize<4096 ) return 0;
896 db_open_or_attach(zDbName, "localdb", 0);
897 zVFileDef = db_text(0, "SELECT sql FROM %s.sqlite_master"
898 " WHERE name=='vfile'", db_name("localdb"));
899 if( zVFileDef==0 ) return 0;
900
901 /* If the "isexe" column is missing from the vfile table, then
902 ** add it now. This code added on 2010-03-06. After all users have
903 ** upgraded, this code can be safely deleted.
904 */
@@ -1980,11 +1993,11 @@
1993 if( !allowNested && db_open_local() ){
1994 fossil_panic("already within an open tree rooted at %s", g.zLocalRoot);
1995 }
1996 file_canonical_name(g.argv[2], &path, 0);
1997 db_open_repository(blob_str(&path));
1998 #if defined(_WIN32) || defined(__CYGWIN__)
1999 # define LOCALDB_NAME "./_FOSSIL_"
2000 #else
2001 # define LOCALDB_NAME "./.fslckout"
2002 #endif
2003 db_init_database(LOCALDB_NAME, zLocalSchema,
2004
+2 -2
--- src/file.c
+++ src/file.c
@@ -594,11 +594,11 @@
594594
*/
595595
int file_simplify_name(char *z, int n, int slash){
596596
int i, j;
597597
if( n<0 ) n = strlen(z);
598598
599
- /* On windows/cygwin convert all \ characters to / */
599
+ /* On windows and cygwin convert all \ characters to / */
600600
#if defined(_WIN32) || defined(__CYGWIN__)
601601
for(i=0; i<n; i++){
602602
if( z[i]=='\\' ) z[i] = '/';
603603
}
604604
#endif
@@ -849,11 +849,11 @@
849849
char zBuf[2000];
850850
zPwd = zBuf;
851851
file_getcwd(zBuf, sizeof(zBuf)-20);
852852
zPwd = file_without_drive_letter(zBuf);
853853
i = 1;
854
-#ifdef _WIN32
854
+#if defined(_WIN32) || defined(__CYGWIN__)
855855
while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++;
856856
#else
857857
while( zPath[i] && zPwd[i]==zPath[i] ) i++;
858858
#endif
859859
if( zPath[i]==0 ){
860860
--- src/file.c
+++ src/file.c
@@ -594,11 +594,11 @@
594 */
595 int file_simplify_name(char *z, int n, int slash){
596 int i, j;
597 if( n<0 ) n = strlen(z);
598
599 /* On windows/cygwin convert all \ characters to / */
600 #if defined(_WIN32) || defined(__CYGWIN__)
601 for(i=0; i<n; i++){
602 if( z[i]=='\\' ) z[i] = '/';
603 }
604 #endif
@@ -849,11 +849,11 @@
849 char zBuf[2000];
850 zPwd = zBuf;
851 file_getcwd(zBuf, sizeof(zBuf)-20);
852 zPwd = file_without_drive_letter(zBuf);
853 i = 1;
854 #ifdef _WIN32
855 while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++;
856 #else
857 while( zPath[i] && zPwd[i]==zPath[i] ) i++;
858 #endif
859 if( zPath[i]==0 ){
860
--- src/file.c
+++ src/file.c
@@ -594,11 +594,11 @@
594 */
595 int file_simplify_name(char *z, int n, int slash){
596 int i, j;
597 if( n<0 ) n = strlen(z);
598
599 /* On windows and cygwin convert all \ characters to / */
600 #if defined(_WIN32) || defined(__CYGWIN__)
601 for(i=0; i<n; i++){
602 if( z[i]=='\\' ) z[i] = '/';
603 }
604 #endif
@@ -849,11 +849,11 @@
849 char zBuf[2000];
850 zPwd = zBuf;
851 file_getcwd(zBuf, sizeof(zBuf)-20);
852 zPwd = file_without_drive_letter(zBuf);
853 i = 1;
854 #if defined(_WIN32) || defined(__CYGWIN__)
855 while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++;
856 #else
857 while( zPath[i] && zPwd[i]==zPath[i] ) i++;
858 #endif
859 if( zPath[i]==0 ){
860
+2 -2
--- src/file.c
+++ src/file.c
@@ -594,11 +594,11 @@
594594
*/
595595
int file_simplify_name(char *z, int n, int slash){
596596
int i, j;
597597
if( n<0 ) n = strlen(z);
598598
599
- /* On windows/cygwin convert all \ characters to / */
599
+ /* On windows and cygwin convert all \ characters to / */
600600
#if defined(_WIN32) || defined(__CYGWIN__)
601601
for(i=0; i<n; i++){
602602
if( z[i]=='\\' ) z[i] = '/';
603603
}
604604
#endif
@@ -849,11 +849,11 @@
849849
char zBuf[2000];
850850
zPwd = zBuf;
851851
file_getcwd(zBuf, sizeof(zBuf)-20);
852852
zPwd = file_without_drive_letter(zBuf);
853853
i = 1;
854
-#ifdef _WIN32
854
+#if defined(_WIN32) || defined(__CYGWIN__)
855855
while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++;
856856
#else
857857
while( zPath[i] && zPwd[i]==zPath[i] ) i++;
858858
#endif
859859
if( zPath[i]==0 ){
860860
--- src/file.c
+++ src/file.c
@@ -594,11 +594,11 @@
594 */
595 int file_simplify_name(char *z, int n, int slash){
596 int i, j;
597 if( n<0 ) n = strlen(z);
598
599 /* On windows/cygwin convert all \ characters to / */
600 #if defined(_WIN32) || defined(__CYGWIN__)
601 for(i=0; i<n; i++){
602 if( z[i]=='\\' ) z[i] = '/';
603 }
604 #endif
@@ -849,11 +849,11 @@
849 char zBuf[2000];
850 zPwd = zBuf;
851 file_getcwd(zBuf, sizeof(zBuf)-20);
852 zPwd = file_without_drive_letter(zBuf);
853 i = 1;
854 #ifdef _WIN32
855 while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++;
856 #else
857 while( zPath[i] && zPwd[i]==zPath[i] ) i++;
858 #endif
859 if( zPath[i]==0 ){
860
--- src/file.c
+++ src/file.c
@@ -594,11 +594,11 @@
594 */
595 int file_simplify_name(char *z, int n, int slash){
596 int i, j;
597 if( n<0 ) n = strlen(z);
598
599 /* On windows and cygwin convert all \ characters to / */
600 #if defined(_WIN32) || defined(__CYGWIN__)
601 for(i=0; i<n; i++){
602 if( z[i]=='\\' ) z[i] = '/';
603 }
604 #endif
@@ -849,11 +849,11 @@
849 char zBuf[2000];
850 zPwd = zBuf;
851 file_getcwd(zBuf, sizeof(zBuf)-20);
852 zPwd = file_without_drive_letter(zBuf);
853 i = 1;
854 #if defined(_WIN32) || defined(__CYGWIN__)
855 while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++;
856 #else
857 while( zPath[i] && zPwd[i]==zPath[i] ) i++;
858 #endif
859 if( zPath[i]==0 ){
860
--- src/rebuild.c
+++ src/rebuild.c
@@ -785,10 +785,12 @@
785785
int bVerily = find_option("verily",0,0)!=0;
786786
int bForce = find_option("force", "f", 0)!=0;
787787
int privateOnly = find_option("private",0,0)!=0;
788788
int bNeedRebuild = 0;
789789
db_find_and_open_repository(OPEN_ANY_SCHEMA, 2);
790
+ db_close(1);
791
+ db_open_repository(g.zRepositoryName);
790792
if( !bForce ){
791793
Blob ans;
792794
char cReply;
793795
blob_zero(&ans);
794796
prompt_user(
795797
--- src/rebuild.c
+++ src/rebuild.c
@@ -785,10 +785,12 @@
785 int bVerily = find_option("verily",0,0)!=0;
786 int bForce = find_option("force", "f", 0)!=0;
787 int privateOnly = find_option("private",0,0)!=0;
788 int bNeedRebuild = 0;
789 db_find_and_open_repository(OPEN_ANY_SCHEMA, 2);
 
 
790 if( !bForce ){
791 Blob ans;
792 char cReply;
793 blob_zero(&ans);
794 prompt_user(
795
--- src/rebuild.c
+++ src/rebuild.c
@@ -785,10 +785,12 @@
785 int bVerily = find_option("verily",0,0)!=0;
786 int bForce = find_option("force", "f", 0)!=0;
787 int privateOnly = find_option("private",0,0)!=0;
788 int bNeedRebuild = 0;
789 db_find_and_open_repository(OPEN_ANY_SCHEMA, 2);
790 db_close(1);
791 db_open_repository(g.zRepositoryName);
792 if( !bForce ){
793 Blob ans;
794 char cReply;
795 blob_zero(&ans);
796 prompt_user(
797
--- www/fossil_prompt.wiki
+++ www/fossil_prompt.wiki
@@ -17,7 +17,7 @@
1717
</pre></blockquote>
1818
1919
For a permanent installation, you can graft the code into your
2020
<tt>.bashrc</tt> file in your home directory.
2121
22
-The code is very simply (only 32 non-comment lines, as of this writing)
22
+The code is very simple (only 32 non-comment lines, as of this writing)
2323
and hence easy to customized.
2424
--- www/fossil_prompt.wiki
+++ www/fossil_prompt.wiki
@@ -17,7 +17,7 @@
17 </pre></blockquote>
18
19 For a permanent installation, you can graft the code into your
20 <tt>.bashrc</tt> file in your home directory.
21
22 The code is very simply (only 32 non-comment lines, as of this writing)
23 and hence easy to customized.
24
--- www/fossil_prompt.wiki
+++ www/fossil_prompt.wiki
@@ -17,7 +17,7 @@
17 </pre></blockquote>
18
19 For a permanent installation, you can graft the code into your
20 <tt>.bashrc</tt> file in your home directory.
21
22 The code is very simple (only 32 non-comment lines, as of this writing)
23 and hence easy to customized.
24

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button